@onereach/ui-components 4.0.2 → 4.1.0-beta.2508.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/bundled/v2/components/OrCode/OrCode.js +6 -3727
  2. package/dist/bundled/v2/components/OrCode/index.js +6 -2
  3. package/dist/bundled/v2/components/OrCode/lang.js +3898 -3
  4. package/dist/bundled/v2/components/OrCode/theme.js +3 -1
  5. package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +2033 -0
  6. package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +181 -0
  7. package/dist/bundled/v2/components/OrRichTextEditorV3/index.d.ts +1 -0
  8. package/dist/bundled/v2/components/OrRichTextEditorV3/index.js +67 -0
  9. package/dist/bundled/v2/components/OrRichTextEditorV3/styles.d.ts +7 -0
  10. package/dist/bundled/v2/components/OrRichTextEditorV3/styles.js +43 -0
  11. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +3 -0
  12. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +45 -0
  13. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +27 -0
  14. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +183 -0
  15. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +1 -0
  16. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.js +4 -0
  17. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +19 -0
  18. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/types.js +1 -0
  19. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.d.ts +3 -0
  20. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.js +5 -0
  21. package/dist/bundled/v2/components/index.d.ts +1 -0
  22. package/dist/bundled/v2/components/index.js +14 -2
  23. package/dist/bundled/v2/index-62c3221b.js +6956 -0
  24. package/dist/bundled/v2/index-62e39ec2.js +4534 -0
  25. package/dist/bundled/{v3/OrCode.vue_vue_type_script_lang-c5a9adb7.js → v2/index-92e69736.js} +15 -234
  26. package/dist/bundled/v2/{index-6976c52a.js → index-c76372bb.js} +16 -4659
  27. package/dist/bundled/{v3/lang-02d2bb2d.js → v2/index-db5e8c99.js} +74 -3965
  28. package/dist/bundled/v2/index.es-3f39f316.js +115 -0
  29. package/dist/bundled/v2/index.js +17 -5
  30. package/dist/bundled/v2/markdown-00716a39.js +18683 -0
  31. package/dist/bundled/v2/tiptap-core.esm-f85402b1.js +9360 -0
  32. package/dist/bundled/v3/OrCode.vue_vue_type_script_lang-0c5e41b0.js +236 -0
  33. package/dist/bundled/v3/OrRichTextEditor.vue_vue_type_script_lang-33b56bd6.js +1815 -0
  34. package/dist/bundled/v3/components/OrCode/OrCode.js +9 -5
  35. package/dist/bundled/v3/components/OrCode/index.js +7 -3
  36. package/dist/bundled/v3/components/OrCode/lang.js +3898 -3
  37. package/dist/bundled/v3/components/OrCode/theme.js +3 -1
  38. package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +219 -0
  39. package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +181 -0
  40. package/dist/bundled/v3/components/OrRichTextEditorV3/index.d.ts +1 -0
  41. package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +83 -0
  42. package/dist/bundled/v3/components/OrRichTextEditorV3/styles.d.ts +7 -0
  43. package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +43 -0
  44. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +3 -0
  45. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +45 -0
  46. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +27 -0
  47. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +183 -0
  48. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +1 -0
  49. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.js +4 -0
  50. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +19 -0
  51. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/types.js +1 -0
  52. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.d.ts +3 -0
  53. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.js +5 -0
  54. package/dist/bundled/v3/components/index.d.ts +1 -0
  55. package/dist/bundled/v3/components/index.js +16 -3
  56. package/dist/bundled/v3/index-62c3221b.js +6956 -0
  57. package/dist/bundled/v3/index-62e39ec2.js +4534 -0
  58. package/dist/bundled/v3/index-92e69736.js +3741 -0
  59. package/dist/bundled/v3/{index-6976c52a.js → index-c76372bb.js} +16 -4659
  60. package/dist/bundled/{v2/lang-02d2bb2d.js → v3/index-db5e8c99.js} +74 -3965
  61. package/dist/bundled/v3/index.es-3f39f316.js +115 -0
  62. package/dist/bundled/v3/index.js +20 -7
  63. package/dist/bundled/v3/markdown-00716a39.js +18683 -0
  64. package/dist/bundled/v3/tiptap-core.esm-f85402b1.js +9360 -0
  65. package/dist/esm/v2/OrRichTextEditor-45fb1867.js +718 -0
  66. package/dist/esm/v2/codemirrorView-2e87c938.js +184 -0
  67. package/dist/esm/v2/components/index.d.ts +1 -0
  68. package/dist/esm/v2/components/index.js +24 -0
  69. package/dist/esm/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +181 -0
  70. package/dist/esm/v2/components/or-rich-text-editor-v3/index.d.ts +1 -0
  71. package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +56 -0
  72. package/dist/esm/v2/components/or-rich-text-editor-v3/styles.d.ts +7 -0
  73. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
  74. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +27 -0
  75. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
  76. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.js +5 -0
  77. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
  78. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/markdown.d.ts +3 -0
  79. package/dist/esm/v2/index.js +24 -0
  80. package/dist/esm/v3/OrRichTextEditor-4c0b6030.js +680 -0
  81. package/dist/esm/v3/codemirrorView-2e87c938.js +184 -0
  82. package/dist/esm/v3/components/index.d.ts +1 -0
  83. package/dist/esm/v3/components/index.js +24 -0
  84. package/dist/esm/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +181 -0
  85. package/dist/esm/v3/components/or-rich-text-editor-v3/index.d.ts +1 -0
  86. package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +54 -0
  87. package/dist/esm/v3/components/or-rich-text-editor-v3/styles.d.ts +7 -0
  88. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
  89. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +27 -0
  90. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
  91. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.js +5 -0
  92. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
  93. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/markdown.d.ts +3 -0
  94. package/dist/esm/v3/index.js +24 -0
  95. package/package.json +25 -5
  96. package/src/components/index.ts +1 -0
  97. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.docs.mdx +7 -0
  98. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.ts +79 -0
  99. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +622 -0
  100. package/src/components/or-rich-text-editor-v3/index.ts +1 -0
  101. package/src/components/or-rich-text-editor-v3/styles.ts +72 -0
  102. package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.ts +40 -0
  103. package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.ts +252 -0
  104. package/src/components/or-rich-text-editor-v3/utils/codemirror/index.ts +1 -0
  105. package/src/components/or-rich-text-editor-v3/utils/codemirror/types.ts +22 -0
  106. package/src/components/or-rich-text-editor-v3/utils/markdown.ts +110 -0
@@ -1,3 +1,3898 @@
1
- export { C as CSS, H as HTML, J as JS, e as JSON, M as MD, T as TS, l as default } from '../../lang-02d2bb2d.js';
2
- import './constants.js';
3
- import '../../index-6976c52a.js';
1
+ import { C as ContextTracker, E as ExternalTokenizer, L as LRParser, j as javascriptLanguage, e as javascript } from '../../index-db5e8c99.js';
2
+ import { k as styleTags, t as tags$1, p as parseMixed, L as LanguageSupport, s as syntaxTree, l as LRLanguage, n as indentNodeProp, o as continuedIndent, q as foldNodeProp, r as foldInside, u as NodeType, N as NodeProp, v as NodeSet, P as Parser, T as Tag, w as Tree, x as Language, y as defineLanguageFacet, z as languageDataProp, A as LanguageDescription, B as ParseContext } from '../../index-62e39ec2.js';
3
+ import { E as EditorView, b as EditorSelection, P as Prec, k as keymap } from '../../index-c76372bb.js';
4
+ import { OrCodeLanguages } from './constants.js';
5
+ import '../../index.es-3f39f316.js';
6
+
7
+ // This file was generated by lezer-generator. You probably shouldn't edit it.
8
+ const scriptText = 54,
9
+ StartCloseScriptTag = 1,
10
+ styleText = 55,
11
+ StartCloseStyleTag = 2,
12
+ textareaText = 56,
13
+ StartCloseTextareaTag = 3,
14
+ StartTag = 4,
15
+ StartScriptTag = 5,
16
+ StartStyleTag = 6,
17
+ StartTextareaTag = 7,
18
+ StartSelfClosingTag = 8,
19
+ StartCloseTag = 9,
20
+ NoMatchStartCloseTag = 10,
21
+ MismatchedStartCloseTag = 11,
22
+ missingCloseTag = 57,
23
+ IncompleteCloseTag = 12,
24
+ commentContent$1 = 58,
25
+ Element$1 = 18,
26
+ TagName = 20,
27
+ Attribute = 21,
28
+ AttributeName = 22,
29
+ AttributeValue = 24,
30
+ UnquotedAttributeValue = 25,
31
+ ScriptText = 27,
32
+ StyleText = 30,
33
+ TextareaText = 33,
34
+ OpenTag = 35,
35
+ CloseTag = 36,
36
+ Dialect_noMatch = 0;
37
+
38
+ /* Hand-written tokenizers for HTML. */
39
+
40
+ const selfClosers = {
41
+ area: true,
42
+ base: true,
43
+ br: true,
44
+ col: true,
45
+ command: true,
46
+ embed: true,
47
+ frame: true,
48
+ hr: true,
49
+ img: true,
50
+ input: true,
51
+ keygen: true,
52
+ link: true,
53
+ meta: true,
54
+ param: true,
55
+ source: true,
56
+ track: true,
57
+ wbr: true,
58
+ menuitem: true
59
+ };
60
+ const implicitlyClosed = {
61
+ dd: true,
62
+ li: true,
63
+ optgroup: true,
64
+ option: true,
65
+ p: true,
66
+ rp: true,
67
+ rt: true,
68
+ tbody: true,
69
+ td: true,
70
+ tfoot: true,
71
+ th: true,
72
+ tr: true
73
+ };
74
+ const closeOnOpen = {
75
+ dd: {
76
+ dd: true,
77
+ dt: true
78
+ },
79
+ dt: {
80
+ dd: true,
81
+ dt: true
82
+ },
83
+ li: {
84
+ li: true
85
+ },
86
+ option: {
87
+ option: true,
88
+ optgroup: true
89
+ },
90
+ optgroup: {
91
+ optgroup: true
92
+ },
93
+ p: {
94
+ address: true,
95
+ article: true,
96
+ aside: true,
97
+ blockquote: true,
98
+ dir: true,
99
+ div: true,
100
+ dl: true,
101
+ fieldset: true,
102
+ footer: true,
103
+ form: true,
104
+ h1: true,
105
+ h2: true,
106
+ h3: true,
107
+ h4: true,
108
+ h5: true,
109
+ h6: true,
110
+ header: true,
111
+ hgroup: true,
112
+ hr: true,
113
+ menu: true,
114
+ nav: true,
115
+ ol: true,
116
+ p: true,
117
+ pre: true,
118
+ section: true,
119
+ table: true,
120
+ ul: true
121
+ },
122
+ rp: {
123
+ rp: true,
124
+ rt: true
125
+ },
126
+ rt: {
127
+ rp: true,
128
+ rt: true
129
+ },
130
+ tbody: {
131
+ tbody: true,
132
+ tfoot: true
133
+ },
134
+ td: {
135
+ td: true,
136
+ th: true
137
+ },
138
+ tfoot: {
139
+ tbody: true
140
+ },
141
+ th: {
142
+ td: true,
143
+ th: true
144
+ },
145
+ thead: {
146
+ tbody: true,
147
+ tfoot: true
148
+ },
149
+ tr: {
150
+ tr: true
151
+ }
152
+ };
153
+ function nameChar(ch) {
154
+ return ch == 45 || ch == 46 || ch == 58 || ch >= 65 && ch <= 90 || ch == 95 || ch >= 97 && ch <= 122 || ch >= 161;
155
+ }
156
+ function isSpace(ch) {
157
+ return ch == 9 || ch == 10 || ch == 13 || ch == 32;
158
+ }
159
+ let cachedName = null,
160
+ cachedInput = null,
161
+ cachedPos = 0;
162
+ function tagNameAfter(input, offset) {
163
+ let pos = input.pos + offset;
164
+ if (cachedPos == pos && cachedInput == input) return cachedName;
165
+ let next = input.peek(offset);
166
+ while (isSpace(next)) next = input.peek(++offset);
167
+ let name = "";
168
+ for (;;) {
169
+ if (!nameChar(next)) break;
170
+ name += String.fromCharCode(next);
171
+ next = input.peek(++offset);
172
+ }
173
+ // Undefined to signal there's a <? or <!, null for just missing
174
+ cachedInput = input;
175
+ cachedPos = pos;
176
+ return cachedName = name ? name.toLowerCase() : next == question || next == bang ? undefined : null;
177
+ }
178
+ const lessThan = 60,
179
+ greaterThan = 62,
180
+ slash = 47,
181
+ question = 63,
182
+ bang = 33,
183
+ dash$1 = 45;
184
+ function ElementContext(name, parent) {
185
+ this.name = name;
186
+ this.parent = parent;
187
+ this.hash = parent ? parent.hash : 0;
188
+ for (let i = 0; i < name.length; i++) this.hash += (this.hash << 4) + name.charCodeAt(i) + (name.charCodeAt(i) << 8);
189
+ }
190
+ const startTagTerms = [StartTag, StartSelfClosingTag, StartScriptTag, StartStyleTag, StartTextareaTag];
191
+ const elementContext = new ContextTracker({
192
+ start: null,
193
+ shift(context, term, stack, input) {
194
+ return startTagTerms.indexOf(term) > -1 ? new ElementContext(tagNameAfter(input, 1) || "", context) : context;
195
+ },
196
+ reduce(context, term) {
197
+ return term == Element$1 && context ? context.parent : context;
198
+ },
199
+ reuse(context, node, stack, input) {
200
+ let type = node.type.id;
201
+ return type == StartTag || type == OpenTag ? new ElementContext(tagNameAfter(input, 1) || "", context) : context;
202
+ },
203
+ hash(context) {
204
+ return context ? context.hash : 0;
205
+ },
206
+ strict: false
207
+ });
208
+ const tagStart = new ExternalTokenizer((input, stack) => {
209
+ if (input.next != lessThan) {
210
+ // End of file, close any open tags
211
+ if (input.next < 0 && stack.context) input.acceptToken(missingCloseTag);
212
+ return;
213
+ }
214
+ input.advance();
215
+ let close = input.next == slash;
216
+ if (close) input.advance();
217
+ let name = tagNameAfter(input, 0);
218
+ if (name === undefined) return;
219
+ if (!name) return input.acceptToken(close ? IncompleteCloseTag : StartTag);
220
+ let parent = stack.context ? stack.context.name : null;
221
+ if (close) {
222
+ if (name == parent) return input.acceptToken(StartCloseTag);
223
+ if (parent && implicitlyClosed[parent]) return input.acceptToken(missingCloseTag, -2);
224
+ if (stack.dialectEnabled(Dialect_noMatch)) return input.acceptToken(NoMatchStartCloseTag);
225
+ for (let cx = stack.context; cx; cx = cx.parent) if (cx.name == name) return;
226
+ input.acceptToken(MismatchedStartCloseTag);
227
+ } else {
228
+ if (name == "script") return input.acceptToken(StartScriptTag);
229
+ if (name == "style") return input.acceptToken(StartStyleTag);
230
+ if (name == "textarea") return input.acceptToken(StartTextareaTag);
231
+ if (selfClosers.hasOwnProperty(name)) return input.acceptToken(StartSelfClosingTag);
232
+ if (parent && closeOnOpen[parent] && closeOnOpen[parent][name]) input.acceptToken(missingCloseTag, -1);else input.acceptToken(StartTag);
233
+ }
234
+ }, {
235
+ contextual: true
236
+ });
237
+ const commentContent = new ExternalTokenizer(input => {
238
+ for (let dashes = 0, i = 0;; i++) {
239
+ if (input.next < 0) {
240
+ if (i) input.acceptToken(commentContent$1);
241
+ break;
242
+ }
243
+ if (input.next == dash$1) {
244
+ dashes++;
245
+ } else if (input.next == greaterThan && dashes >= 2) {
246
+ if (i > 3) input.acceptToken(commentContent$1, -2);
247
+ break;
248
+ } else {
249
+ dashes = 0;
250
+ }
251
+ input.advance();
252
+ }
253
+ });
254
+ function contentTokenizer(tag, textToken, endToken) {
255
+ let lastState = 2 + tag.length;
256
+ return new ExternalTokenizer(input => {
257
+ // state means:
258
+ // - 0 nothing matched
259
+ // - 1 '<' matched
260
+ // - 2 '</' + possibly whitespace matched
261
+ // - 3-(1+tag.length) part of the tag matched
262
+ // - lastState whole tag + possibly whitespace matched
263
+ for (let state = 0, matchedLen = 0, i = 0;; i++) {
264
+ if (input.next < 0) {
265
+ if (i) input.acceptToken(textToken);
266
+ break;
267
+ }
268
+ if (state == 0 && input.next == lessThan || state == 1 && input.next == slash || state >= 2 && state < lastState && input.next == tag.charCodeAt(state - 2)) {
269
+ state++;
270
+ matchedLen++;
271
+ } else if ((state == 2 || state == lastState) && isSpace(input.next)) {
272
+ matchedLen++;
273
+ } else if (state == lastState && input.next == greaterThan) {
274
+ if (i > matchedLen) input.acceptToken(textToken, -matchedLen);else input.acceptToken(endToken, -(matchedLen - 2));
275
+ break;
276
+ } else if ((input.next == 10 /* '\n' */ || input.next == 13 /* '\r' */) && i) {
277
+ input.acceptToken(textToken, 1);
278
+ break;
279
+ } else {
280
+ state = matchedLen = 0;
281
+ }
282
+ input.advance();
283
+ }
284
+ });
285
+ }
286
+ const scriptTokens = contentTokenizer("script", scriptText, StartCloseScriptTag);
287
+ const styleTokens = contentTokenizer("style", styleText, StartCloseStyleTag);
288
+ const textareaTokens = contentTokenizer("textarea", textareaText, StartCloseTextareaTag);
289
+ const htmlHighlighting = styleTags({
290
+ "Text RawText": tags$1.content,
291
+ "StartTag StartCloseTag SelfClosingEndTag EndTag": tags$1.angleBracket,
292
+ TagName: tags$1.tagName,
293
+ "MismatchedCloseTag/TagName": [tags$1.tagName, tags$1.invalid],
294
+ AttributeName: tags$1.attributeName,
295
+ "AttributeValue UnquotedAttributeValue": tags$1.attributeValue,
296
+ Is: tags$1.definitionOperator,
297
+ "EntityReference CharacterReference": tags$1.character,
298
+ Comment: tags$1.blockComment,
299
+ ProcessingInst: tags$1.processingInstruction,
300
+ DoctypeDecl: tags$1.documentMeta
301
+ });
302
+
303
+ // This file was generated by lezer-generator. You probably shouldn't edit it.
304
+ const parser$3 = LRParser.deserialize({
305
+ version: 14,
306
+ states: ",xOVOxOOO!WQ!bO'#CoO!]Q!bO'#CyO!bQ!bO'#C|O!gQ!bO'#DPO!lQ!bO'#DRO!qOXO'#CnO!|OYO'#CnO#XO[O'#CnO$eOxO'#CnOOOW'#Cn'#CnO$lO!rO'#DTO$tQ!bO'#DVO$yQ!bO'#DWOOOW'#Dk'#DkOOOW'#DY'#DYQVOxOOO%OQ#tO,59ZO%WQ#tO,59eO%`Q#tO,59hO%hQ#tO,59kO%sQ#tO,59mOOOX'#D^'#D^O%{OXO'#CwO&WOXO,59YOOOY'#D_'#D_O&`OYO'#CzO&kOYO,59YOOO['#D`'#D`O&sO[O'#C}O'OO[O,59YOOOW'#Da'#DaO'WOxO,59YO'_Q!bO'#DQOOOW,59Y,59YOOO`'#Db'#DbO'dO!rO,59oOOOW,59o,59oO'lQ!bO,59qO'qQ!bO,59rOOOW-E7W-E7WO'vQ#tO'#CqOOQO'#DZ'#DZO(UQ#tO1G.uOOOX1G.u1G.uO(^Q#tO1G/POOOY1G/P1G/PO(fQ#tO1G/SOOO[1G/S1G/SO(nQ#tO1G/VOOOW1G/V1G/VOOOW1G/X1G/XO(yQ#tO1G/XOOOX-E7[-E7[O)RQ!bO'#CxOOOW1G.t1G.tOOOY-E7]-E7]O)WQ!bO'#C{OOO[-E7^-E7^O)]Q!bO'#DOOOOW-E7_-E7_O)bQ!bO,59lOOO`-E7`-E7`OOOW1G/Z1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O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",
309
+ nodeNames: "⚠ StartCloseTag StartCloseTag StartCloseTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue EndTag ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag SelfClosingEndTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",
310
+ maxTerm: 67,
311
+ context: elementContext,
312
+ nodeProps: [["closedBy", -10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, "EndTag", 4, "EndTag SelfClosingEndTag", -4, 19, 29, 32, 35, "CloseTag"], ["group", -9, 12, 15, 16, 17, 18, 39, 40, 41, 42, "Entity", 14, "Entity TextContent", -3, 27, 30, 33, "TextContent Entity"], ["openedBy", 26, "StartTag StartCloseTag", -4, 28, 31, 34, 36, "OpenTag", 38, "StartTag"]],
313
+ propSources: [htmlHighlighting],
314
+ skippedNodes: [0],
315
+ repeatNodeCount: 9,
316
+ tokenData: "#(r!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs4ysv-_vw5iwxJ^x}-_}!OKP!O!P-_!P!Q!!O!Q![-_![!]!$c!]!^-_!^!_!(k!_!`#'S!`!a#'z!a!c-_!c!}!$c!}#R-_#R#S!$c#S#T3V#T#o!$c#o#s-_#s$f$q$f%W-_%W%o!$c%o%p-_%p&a!$c&a&b-_&b1p!$c1p4U-_4U4d!$c4d4e-_4e$IS!$c$IS$I`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sv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R#!sP;=`<%l!IrT#!{bfSOq!KTqr#!vrs!KTsw#!vwx!KTx!P#!v!P!Q!KT!Q!_#!v!_!a!KT!a!b#$T!b#s#!v#s$f!KT$f;'S#!v;'S;=`#%b<%l?Ah#!v?Ah?BY!KT?BY?Mn#!v?MnO!KTT#$YbfSOq!KTqr#!vrs!KTsw#!vwx!KTx!P#!v!P!Q!KT!Q!_#!v!_!`!KT!`!a!Ky!a#s#!v#s$f!KT$f;'S#!v;'S;=`#%b<%l?Ah#!v?Ah?BY!KT?BY?Mn#!v?MnO!KTT#%eP;=`<%l#!v!V#%qcfS!a`!cpOq!Irqr!H^rs!Jisv!H^vw#!vwx!MZx!P!H^!P!Q!Ir!Q!_!H^!_!`!Ir!`!a#!Q!a#s!H^#s$f!Ir$f;'S!H^;'S;=`#&|<%l?Ah!H^?Ah?BY!Ir?BY?Mn!H^?MnO!Ir!V#'PP;=`<%l!H^!V#'_XgS^P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!X#(VX^P!a`!cpjUOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",
317
+ tokenizers: [scriptTokens, styleTokens, textareaTokens, tagStart, commentContent, 0, 1, 2, 3, 4, 5],
318
+ topRules: {
319
+ "Document": [0, 13]
320
+ },
321
+ dialects: {
322
+ noMatch: 0,
323
+ selfClosing: 485
324
+ },
325
+ tokenPrec: 487
326
+ });
327
+ function getAttrs(openTag, input) {
328
+ let attrs = Object.create(null);
329
+ for (let att of openTag.getChildren(Attribute)) {
330
+ let name = att.getChild(AttributeName),
331
+ value = att.getChild(AttributeValue) || att.getChild(UnquotedAttributeValue);
332
+ if (name) attrs[input.read(name.from, name.to)] = !value ? "" : value.type.id == AttributeValue ? input.read(value.from + 1, value.to - 1) : input.read(value.from, value.to);
333
+ }
334
+ return attrs;
335
+ }
336
+ function findTagName(openTag, input) {
337
+ let tagNameNode = openTag.getChild(TagName);
338
+ return tagNameNode ? input.read(tagNameNode.from, tagNameNode.to) : " ";
339
+ }
340
+ function maybeNest(node, input, tags) {
341
+ let attrs;
342
+ for (let tag of tags) {
343
+ if (!tag.attrs || tag.attrs(attrs || (attrs = getAttrs(node.node.parent.firstChild, input)))) return {
344
+ parser: tag.parser
345
+ };
346
+ }
347
+ return null;
348
+ }
349
+
350
+ // tags?: {
351
+ // tag: string,
352
+ // attrs?: ({[attr: string]: string}) => boolean,
353
+ // parser: Parser
354
+ // }[]
355
+ // attributes?: {
356
+ // name: string,
357
+ // tagName?: string,
358
+ // parser: Parser
359
+ // }[]
360
+
361
+ function configureNesting(tags = [], attributes = []) {
362
+ let script = [],
363
+ style = [],
364
+ textarea = [],
365
+ other = [];
366
+ for (let tag of tags) {
367
+ let array = tag.tag == "script" ? script : tag.tag == "style" ? style : tag.tag == "textarea" ? textarea : other;
368
+ array.push(tag);
369
+ }
370
+ let attrs = attributes.length ? Object.create(null) : null;
371
+ for (let attr of attributes) (attrs[attr.name] || (attrs[attr.name] = [])).push(attr);
372
+ return parseMixed((node, input) => {
373
+ let id = node.type.id;
374
+ if (id == ScriptText) return maybeNest(node, input, script);
375
+ if (id == StyleText) return maybeNest(node, input, style);
376
+ if (id == TextareaText) return maybeNest(node, input, textarea);
377
+ if (id == OpenTag && other.length) {
378
+ let n = node.node,
379
+ tagName = findTagName(n, input),
380
+ attrs;
381
+ for (let tag of other) {
382
+ if (tag.tag == tagName && (!tag.attrs || tag.attrs(attrs || (attrs = getAttrs(n, input))))) {
383
+ let close = n.parent.lastChild;
384
+ return {
385
+ parser: tag.parser,
386
+ overlay: [{
387
+ from: node.to,
388
+ to: close.type.id == CloseTag ? close.from : n.parent.to
389
+ }]
390
+ };
391
+ }
392
+ }
393
+ }
394
+ if (attrs && id == Attribute) {
395
+ let n = node.node,
396
+ nameNode;
397
+ if (nameNode = n.firstChild) {
398
+ let matches = attrs[input.read(nameNode.from, nameNode.to)];
399
+ if (matches) for (let attr of matches) {
400
+ if (attr.tagName && attr.tagName != findTagName(n.parent, input)) continue;
401
+ let value = n.lastChild;
402
+ if (value.type.id == AttributeValue) return {
403
+ parser: attr.parser,
404
+ overlay: [{
405
+ from: value.from + 1,
406
+ to: value.to - 1
407
+ }]
408
+ };else if (value.type.id == UnquotedAttributeValue) return {
409
+ parser: attr.parser,
410
+ overlay: [{
411
+ from: value.from,
412
+ to: value.to
413
+ }]
414
+ };
415
+ }
416
+ }
417
+ }
418
+ return null;
419
+ });
420
+ }
421
+
422
+ // This file was generated by lezer-generator. You probably shouldn't edit it.
423
+ const descendantOp = 94,
424
+ Unit = 1,
425
+ callee = 95,
426
+ identifier$2 = 96,
427
+ VariableName = 2;
428
+
429
+ /* Hand-written tokenizers for CSS tokens that can't be
430
+ expressed by Lezer's built-in tokenizer. */
431
+
432
+ const space$1 = [9, 10, 11, 12, 13, 32, 133, 160, 5760, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8232, 8233, 8239, 8287, 12288];
433
+ const colon = 58,
434
+ parenL = 40,
435
+ underscore = 95,
436
+ bracketL = 91,
437
+ dash = 45,
438
+ period = 46,
439
+ hash = 35,
440
+ percent = 37;
441
+ function isAlpha(ch) {
442
+ return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 161;
443
+ }
444
+ function isDigit(ch) {
445
+ return ch >= 48 && ch <= 57;
446
+ }
447
+ const identifiers = new ExternalTokenizer((input, stack) => {
448
+ for (let inside = false, dashes = 0, i = 0;; i++) {
449
+ let {
450
+ next
451
+ } = input;
452
+ if (isAlpha(next) || next == dash || next == underscore || inside && isDigit(next)) {
453
+ if (!inside && (next != dash || i > 0)) inside = true;
454
+ if (dashes === i && next == dash) dashes++;
455
+ input.advance();
456
+ } else {
457
+ if (inside) input.acceptToken(next == parenL ? callee : dashes == 2 && stack.canShift(VariableName) ? VariableName : identifier$2);
458
+ break;
459
+ }
460
+ }
461
+ });
462
+ const descendant = new ExternalTokenizer(input => {
463
+ if (space$1.includes(input.peek(-1))) {
464
+ let {
465
+ next
466
+ } = input;
467
+ if (isAlpha(next) || next == underscore || next == hash || next == period || next == bracketL || next == colon || next == dash) input.acceptToken(descendantOp);
468
+ }
469
+ });
470
+ const unitToken = new ExternalTokenizer(input => {
471
+ if (!space$1.includes(input.peek(-1))) {
472
+ let {
473
+ next
474
+ } = input;
475
+ if (next == percent) {
476
+ input.advance();
477
+ input.acceptToken(Unit);
478
+ }
479
+ if (isAlpha(next)) {
480
+ do {
481
+ input.advance();
482
+ } while (isAlpha(input.next));
483
+ input.acceptToken(Unit);
484
+ }
485
+ }
486
+ });
487
+ const cssHighlighting = styleTags({
488
+ "AtKeyword import charset namespace keyframes media supports": tags$1.definitionKeyword,
489
+ "from to selector": tags$1.keyword,
490
+ NamespaceName: tags$1.namespace,
491
+ KeyframeName: tags$1.labelName,
492
+ TagName: tags$1.tagName,
493
+ ClassName: tags$1.className,
494
+ PseudoClassName: tags$1.constant(tags$1.className),
495
+ IdName: tags$1.labelName,
496
+ "FeatureName PropertyName": tags$1.propertyName,
497
+ AttributeName: tags$1.attributeName,
498
+ NumberLiteral: tags$1.number,
499
+ KeywordQuery: tags$1.keyword,
500
+ UnaryQueryOp: tags$1.operatorKeyword,
501
+ "CallTag ValueName": tags$1.atom,
502
+ VariableName: tags$1.variableName,
503
+ Callee: tags$1.operatorKeyword,
504
+ Unit: tags$1.unit,
505
+ "UniversalSelector NestingSelector": tags$1.definitionOperator,
506
+ MatchOp: tags$1.compareOperator,
507
+ "ChildOp SiblingOp, LogicOp": tags$1.logicOperator,
508
+ BinOp: tags$1.arithmeticOperator,
509
+ Important: tags$1.modifier,
510
+ Comment: tags$1.blockComment,
511
+ ParenthesizedContent: tags$1.special(tags$1.name),
512
+ ColorLiteral: tags$1.color,
513
+ StringLiteral: tags$1.string,
514
+ ":": tags$1.punctuation,
515
+ "PseudoOp #": tags$1.derefOperator,
516
+ "; ,": tags$1.separator,
517
+ "( )": tags$1.paren,
518
+ "[ ]": tags$1.squareBracket,
519
+ "{ }": tags$1.brace
520
+ });
521
+
522
+ // This file was generated by lezer-generator. You probably shouldn't edit it.
523
+ const spec_callee = {
524
+ __proto__: null,
525
+ lang: 32,
526
+ "nth-child": 32,
527
+ "nth-last-child": 32,
528
+ "nth-of-type": 32,
529
+ "nth-last-of-type": 32,
530
+ dir: 32,
531
+ "host-context": 32,
532
+ url: 60,
533
+ "url-prefix": 60,
534
+ domain: 60,
535
+ regexp: 60,
536
+ selector: 134
537
+ };
538
+ const spec_AtKeyword = {
539
+ __proto__: null,
540
+ "@import": 114,
541
+ "@media": 138,
542
+ "@charset": 142,
543
+ "@namespace": 146,
544
+ "@keyframes": 152,
545
+ "@supports": 164
546
+ };
547
+ const spec_identifier = {
548
+ __proto__: null,
549
+ not: 128,
550
+ only: 128,
551
+ from: 158,
552
+ to: 160
553
+ };
554
+ const parser$2 = LRParser.deserialize({
555
+ version: 14,
556
+ states: "7WQYQ[OOO#_Q[OOOOQP'#Cd'#CdOOQP'#Cc'#CcO#fQ[O'#CfO$YQXO'#CaO$aQ[O'#ChO$lQ[O'#DPO$qQ[O'#DTOOQP'#Ed'#EdO$vQdO'#DeO%bQ[O'#DrO$vQdO'#DtO%sQ[O'#DvO&OQ[O'#DyO&TQ[O'#EPO&cQ[O'#EROOQS'#Ec'#EcOOQS'#ET'#ETQYQ[OOO&jQXO'#CdO'_QWO'#DaO'dQWO'#EjO'oQ[O'#EjQOQWOOOOQP'#Cg'#CgOOQP,59Q,59QO#fQ[O,59QO'yQ[O'#EWO(eQWO,58{O(mQ[O,59SO$lQ[O,59kO$qQ[O,59oO'yQ[O,59sO'yQ[O,59uO'yQ[O,59vO(xQ[O'#D`OOQS,58{,58{OOQP'#Ck'#CkOOQO'#C}'#C}OOQP,59S,59SO)PQWO,59SO)UQWO,59SOOQP'#DR'#DROOQP,59k,59kOOQO'#DV'#DVO)ZQ`O,59oOOQS'#Cp'#CpO$vQd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h+k+q+z_aOPcgt!j#hkXOPcglqrst!j!z#]#hkROPcglqrst!j!z#]#hQjSR!mkQxUR!qnQ!qzQ#S!UR#k!sq!WY[!Q!i!{!}#Q#f#m#r#y$V$W$_$d$mp!WY[!Q!i!{!}#Q#f#m#r#y$V$W$_$d$mT$R#b$Sq!UY[!Q!i!{!}#Q#f#m#r#y$V$W$_$d$mp!WY[!Q!i!{!}#Q#f#m#r#y$V$W$_$d$mQ!b]R#a!cQyUR!rnQ!qyR#k!rQ|VR!toQ!OWR!upQuTQ!pmQ#^!_Q#d!fQ#e!gR$f$RSfPtQ!lgQ#g!jR$Y#hZePgt!j#ha!^Z_`!S!Y![#X#YR#V!YR!c]R!e^R#c!eQcOSgPtU!hcg#hR#h!jQ#r!{U$^#r$d$mQ$d#yR$m$_Q$`#rR$n$`QmTS!om$[R$[#oQ$W#fR$j$WQ!kfS#i!k#jR#j!lQ#Z!ZR#}#ZQ$S#bR$g$S_bOPcgt!j#h^TOPcgt!j#hQ!nlQ!vqQ!wrQ!xsQ#o!zR$O#]R#s!{Q!SYQ!`[Q#O!QQ#f!i[#q!{#r#y$_$d$mQ#t!}Q#v#QS$U#f$WQ$Z#mR$i$VR#p!zQhPR!ytQ!_ZQ!g`R#R!SU!ZZ`!SQ!f_Q#W!YQ#[![Q#{#XR#|#Y",
559
+ nodeNames: "⚠ Unit VariableName Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NestingSelector ClassSelector ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee CallLiteral CallTag ParenthesizedContent , PseudoClassName ArgList IdSelector # IdName ] AttributeSelector [ AttributeName MatchOp ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp } { Block Declaration PropertyName Important ; ImportStatement AtKeyword import KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList from to SupportsStatement supports AtRule Styles",
560
+ maxTerm: 108,
561
+ nodeProps: [["openedBy", 17, "(", 48, "{"], ["closedBy", 18, ")", 49, "}"]],
562
+ propSources: [cssHighlighting],
563
+ skippedNodes: [0, 3],
564
+ repeatNodeCount: 8,
565
+ tokenData: "Lq~R!^OX$}X^%u^p$}pq%uqr)Xrs.Rst/utu6duv$}vw7^wx7oxy9^yz9oz{9t{|:_|}?Q}!O?c!O!P@Q!P!Q@i!Q![Cu![!]Dp!]!^El!^!_$}!_!`E}!`!aF`!a!b$}!b!cG[!c!}$}!}#OHt#O#P$}#P#QIV#Q#R6d#R#T$}#T#UIh#U#c$}#c#dJy#d#o$}#o#pK`#p#q6d#q#rKq#r#sLS#s#y$}#y#z%u#z$f$}$f$g%u$g#BY$}#BY#BZ%u#BZ$IS$}$IS$I_%u$I_$I|$}$I|$JO%u$JO$JT$}$JT$JU%u$JU$KV$}$KV$KW%u$KW&FU$}&FU&FV%u&FV;'S$};'S;=`Lk<%lO$}W%QSOy%^z;'S%^;'S;=`%o<%lO%^W%cSoWOy%^z;'S%^;'S;=`%o<%lO%^W%rP;=`<%l%^~%zh#U~OX%^X^'f^p%^pq'fqy%^z#y%^#y#z'f#z$f%^$f$g'f$g#BY%^#BY#BZ'f#BZ$IS%^$IS$I_'f$I_$I|%^$I|$JO'f$JO$JT%^$JT$JU'f$JU$KV%^$KV$KW'f$KW&FU%^&FU&FV'f&FV;'S%^;'S;=`%o<%lO%^~'mh#U~oWOX%^X^'f^p%^pq'fqy%^z#y%^#y#z'f#z$f%^$f$g'f$g#BY%^#BY#BZ'f#BZ$IS%^$IS$I_'f$I_$I|%^$I|$JO'f$JO$JT%^$JT$JU'f$JU$KV%^$KV$KW'f$KW&FU%^&FU&FV'f&FV;'S%^;'S;=`%o<%lO%^^)[UOy%^z#]%^#]#^)n#^;'S%^;'S;=`%o<%lO%^^)sU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term: 95,
573
+ get: value => spec_callee[value] || -1
574
+ }, {
575
+ term: 56,
576
+ get: value => spec_AtKeyword[value] || -1
577
+ }, {
578
+ term: 96,
579
+ get: value => spec_identifier[value] || -1
580
+ }],
581
+ tokenPrec: 1123
582
+ });
583
+
584
+ let _properties = null;
585
+ function properties() {
586
+ if (!_properties && typeof document == "object" && document.body) {
587
+ let names = [];
588
+ for (let prop in document.body.style) {
589
+ if (!/[A-Z]|^-|^(item|length)$/.test(prop)) names.push(prop);
590
+ }
591
+ _properties = names.sort().map(name => ({
592
+ type: "property",
593
+ label: name
594
+ }));
595
+ }
596
+ return _properties || [];
597
+ }
598
+ const pseudoClasses = /*@__PURE__*/["active", "after", "before", "checked", "default", "disabled", "empty", "enabled", "first-child", "first-letter", "first-line", "first-of-type", "focus", "hover", "in-range", "indeterminate", "invalid", "lang", "last-child", "last-of-type", "link", "not", "nth-child", "nth-last-child", "nth-last-of-type", "nth-of-type", "only-of-type", "only-child", "optional", "out-of-range", "placeholder", "read-only", "read-write", "required", "root", "selection", "target", "valid", "visited"].map(name => ({
599
+ type: "class",
600
+ label: name
601
+ }));
602
+ const values = /*@__PURE__*/["above", "absolute", "activeborder", "additive", "activecaption", "after-white-space", "ahead", "alias", "all", "all-scroll", "alphabetic", "alternate", "always", "antialiased", "appworkspace", "asterisks", "attr", "auto", "auto-flow", "avoid", "avoid-column", "avoid-page", "avoid-region", "axis-pan", "background", "backwards", "baseline", "below", "bidi-override", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box", "both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel", "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret", "cell", "center", "checkbox", "circle", "cjk-decimal", "clear", "clip", "close-quote", "col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse", "compact", "condensed", "contain", "content", "contents", "content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop", "cross", "crosshair", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal", "decimal-leading-zero", "default", "default-button", "dense", "destination-atop", "destination-in", "destination-out", "destination-over", "difference", "disc", "discard", "disclosure-closed", "disclosure-open", "document", "dot-dash", "dot-dot-dash", "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", "element", "ellipse", "ellipsis", "embed", "end", "ethiopic-abegede-gez", "ethiopic-halehame-aa-er", "ethiopic-halehame-gez", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed", "extra-expanded", "fantasy", "fast", "fill", "fill-box", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes", "forwards", "from", "geometricPrecision", "graytext", "grid", "groove", "hand", "hard-light", "help", "hidden", "hide", "higher", "highlight", "highlighttext", "horizontal", "hsl", "hsla", "hue", "icon", "ignore", "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis", "inline-block", "inline-flex", "inline-grid", "inline-table", "inset", "inside", "intrinsic", "invert", "italic", "justify", "keep-all", "landscape", "large", "larger", "left", "level", "lighter", "lighten", "line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem", "local", "logical", "loud", "lower", "lower-hexadecimal", "lower-latin", "lower-norwegian", "lowercase", "ltr", "luminosity", "manipulation", "match", "matrix", "matrix3d", "medium", "menu", "menutext", "message-box", "middle", "min-intrinsic", "mix", "monospace", "move", "multiple", "multiple_mask_images", "multiply", "n-resize", "narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap", "ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "opacity", "open-quote", "optimizeLegibility", "optimizeSpeed", "outset", "outside", "outside-shape", "overlay", "overline", "padding", "padding-box", "painted", "page", "paused", "perspective", "pinch-zoom", "plus-darker", "plus-lighter", "pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "push-button", "radial-gradient", "radio", "read-only", "read-write", "read-write-plaintext-only", "rectangle", "region", "relative", "repeat", "repeating-linear-gradient", "repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse", "rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY", "rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running", "s-resize", "sans-serif", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen", "scroll", "scrollbar", "scroll-position", "se-resize", "self-start", "self-end", "semi-condensed", "semi-expanded", "separate", "serif", "show", "single", "skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal", "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow", "small", "small-caps", "small-caption", "smaller", "soft-light", "solid", "source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "space-evenly", "spell-out", "square", "start", "static", "status-bar", "stretch", "stroke", "stroke-box", "sub", "subpixel-antialiased", "svg_masks", "super", "sw-resize", "symbolic", "symbols", "system-ui", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row", "table-row-group", "text", "text-bottom", "text-top", "textarea", "textfield", "thick", "thin", "threeddarkshadow", "threedface", "threedhighlight", "threedlightshadow", "threedshadow", "to", "top", "transform", "translate", "translate3d", "translateX", "translateY", "translateZ", "transparent", "ultra-condensed", "ultra-expanded", "underline", "unidirectional-pan", "unset", "up", "upper-latin", "uppercase", "url", "var", "vertical", "vertical-text", "view-box", "visible", "visibleFill", "visiblePainted", "visibleStroke", "visual", "w-resize", "wait", "wave", "wider", "window", "windowframe", "windowtext", "words", "wrap", "wrap-reverse", "x-large", "x-small", "xor", "xx-large", "xx-small"].map(name => ({
603
+ type: "keyword",
604
+ label: name
605
+ })).concat( /*@__PURE__*/["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"].map(name => ({
606
+ type: "constant",
607
+ label: name
608
+ })));
609
+ const tags = /*@__PURE__*/["a", "abbr", "address", "article", "aside", "b", "bdi", "bdo", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "figcaption", "figure", "footer", "form", "header", "hgroup", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "meter", "nav", "ol", "output", "p", "pre", "ruby", "section", "select", "small", "source", "span", "strong", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "tr", "u", "ul"].map(name => ({
610
+ type: "type",
611
+ label: name
612
+ }));
613
+ const identifier$1 = /^[\w-]*/;
614
+ /**
615
+ CSS property and value keyword completion source.
616
+ */
617
+ const cssCompletionSource = context => {
618
+ let {
619
+ state,
620
+ pos
621
+ } = context,
622
+ node = syntaxTree(state).resolveInner(pos, -1);
623
+ if (node.name == "PropertyName") return {
624
+ from: node.from,
625
+ options: properties(),
626
+ validFor: identifier$1
627
+ };
628
+ if (node.name == "ValueName") return {
629
+ from: node.from,
630
+ options: values,
631
+ validFor: identifier$1
632
+ };
633
+ if (node.name == "PseudoClassName") return {
634
+ from: node.from,
635
+ options: pseudoClasses,
636
+ validFor: identifier$1
637
+ };
638
+ if (node.name == "TagName") {
639
+ for (let {
640
+ parent
641
+ } = node; parent; parent = parent.parent) if (parent.name == "Block") return {
642
+ from: node.from,
643
+ options: properties(),
644
+ validFor: identifier$1
645
+ };
646
+ return {
647
+ from: node.from,
648
+ options: tags,
649
+ validFor: identifier$1
650
+ };
651
+ }
652
+ if (!context.explicit) return null;
653
+ let above = node.resolve(pos),
654
+ before = above.childBefore(pos);
655
+ if (before && before.name == ":" && above.name == "PseudoClassSelector") return {
656
+ from: pos,
657
+ options: pseudoClasses,
658
+ validFor: identifier$1
659
+ };
660
+ if (before && before.name == ":" && above.name == "Declaration" || above.name == "ArgList") return {
661
+ from: pos,
662
+ options: values,
663
+ validFor: identifier$1
664
+ };
665
+ if (above.name == "Block") return {
666
+ from: pos,
667
+ options: properties(),
668
+ validFor: identifier$1
669
+ };
670
+ return null;
671
+ };
672
+
673
+ /**
674
+ A language provider based on the [Lezer CSS
675
+ parser](https://github.com/lezer-parser/css), extended with
676
+ highlighting and indentation information.
677
+ */
678
+ const cssLanguage = /*@__PURE__*/LRLanguage.define({
679
+ parser: /*@__PURE__*/parser$2.configure({
680
+ props: [/*@__PURE__*/indentNodeProp.add({
681
+ Declaration: /*@__PURE__*/continuedIndent()
682
+ }), /*@__PURE__*/foldNodeProp.add({
683
+ Block: foldInside
684
+ })]
685
+ }),
686
+ languageData: {
687
+ commentTokens: {
688
+ block: {
689
+ open: "/*",
690
+ close: "*/"
691
+ }
692
+ },
693
+ indentOnInput: /^\s*\}$/,
694
+ wordChars: "-"
695
+ }
696
+ });
697
+ /**
698
+ Language support for CSS.
699
+ */
700
+ function css() {
701
+ return new LanguageSupport(cssLanguage, cssLanguage.data.of({
702
+ autocomplete: cssCompletionSource
703
+ }));
704
+ }
705
+
706
+ const Targets = ["_blank", "_self", "_top", "_parent"];
707
+ const Charsets = ["ascii", "utf-8", "utf-16", "latin1", "latin1"];
708
+ const Methods = ["get", "post", "put", "delete"];
709
+ const Encs = ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"];
710
+ const Bool = ["true", "false"];
711
+ const S = {}; // Empty tag spec
712
+ const Tags = {
713
+ a: {
714
+ attrs: {
715
+ href: null,
716
+ ping: null,
717
+ type: null,
718
+ media: null,
719
+ target: Targets,
720
+ hreflang: null
721
+ }
722
+ },
723
+ abbr: S,
724
+ acronym: S,
725
+ address: S,
726
+ applet: S,
727
+ area: {
728
+ attrs: {
729
+ alt: null,
730
+ coords: null,
731
+ href: null,
732
+ target: null,
733
+ ping: null,
734
+ media: null,
735
+ hreflang: null,
736
+ type: null,
737
+ shape: ["default", "rect", "circle", "poly"]
738
+ }
739
+ },
740
+ article: S,
741
+ aside: S,
742
+ audio: {
743
+ attrs: {
744
+ src: null,
745
+ mediagroup: null,
746
+ crossorigin: ["anonymous", "use-credentials"],
747
+ preload: ["none", "metadata", "auto"],
748
+ autoplay: ["autoplay"],
749
+ loop: ["loop"],
750
+ controls: ["controls"]
751
+ }
752
+ },
753
+ b: S,
754
+ base: {
755
+ attrs: {
756
+ href: null,
757
+ target: Targets
758
+ }
759
+ },
760
+ basefont: S,
761
+ bdi: S,
762
+ bdo: S,
763
+ big: S,
764
+ blockquote: {
765
+ attrs: {
766
+ cite: null
767
+ }
768
+ },
769
+ body: S,
770
+ br: S,
771
+ button: {
772
+ attrs: {
773
+ form: null,
774
+ formaction: null,
775
+ name: null,
776
+ value: null,
777
+ autofocus: ["autofocus"],
778
+ disabled: ["autofocus"],
779
+ formenctype: Encs,
780
+ formmethod: Methods,
781
+ formnovalidate: ["novalidate"],
782
+ formtarget: Targets,
783
+ type: ["submit", "reset", "button"]
784
+ }
785
+ },
786
+ canvas: {
787
+ attrs: {
788
+ width: null,
789
+ height: null
790
+ }
791
+ },
792
+ caption: S,
793
+ center: S,
794
+ cite: S,
795
+ code: S,
796
+ col: {
797
+ attrs: {
798
+ span: null
799
+ }
800
+ },
801
+ colgroup: {
802
+ attrs: {
803
+ span: null
804
+ }
805
+ },
806
+ command: {
807
+ attrs: {
808
+ type: ["command", "checkbox", "radio"],
809
+ label: null,
810
+ icon: null,
811
+ radiogroup: null,
812
+ command: null,
813
+ title: null,
814
+ disabled: ["disabled"],
815
+ checked: ["checked"]
816
+ }
817
+ },
818
+ data: {
819
+ attrs: {
820
+ value: null
821
+ }
822
+ },
823
+ datagrid: {
824
+ attrs: {
825
+ disabled: ["disabled"],
826
+ multiple: ["multiple"]
827
+ }
828
+ },
829
+ datalist: {
830
+ attrs: {
831
+ data: null
832
+ }
833
+ },
834
+ dd: S,
835
+ del: {
836
+ attrs: {
837
+ cite: null,
838
+ datetime: null
839
+ }
840
+ },
841
+ details: {
842
+ attrs: {
843
+ open: ["open"]
844
+ }
845
+ },
846
+ dfn: S,
847
+ dir: S,
848
+ div: S,
849
+ dl: S,
850
+ dt: S,
851
+ em: S,
852
+ embed: {
853
+ attrs: {
854
+ src: null,
855
+ type: null,
856
+ width: null,
857
+ height: null
858
+ }
859
+ },
860
+ eventsource: {
861
+ attrs: {
862
+ src: null
863
+ }
864
+ },
865
+ fieldset: {
866
+ attrs: {
867
+ disabled: ["disabled"],
868
+ form: null,
869
+ name: null
870
+ }
871
+ },
872
+ figcaption: S,
873
+ figure: S,
874
+ font: S,
875
+ footer: S,
876
+ form: {
877
+ attrs: {
878
+ action: null,
879
+ name: null,
880
+ "accept-charset": Charsets,
881
+ autocomplete: ["on", "off"],
882
+ enctype: Encs,
883
+ method: Methods,
884
+ novalidate: ["novalidate"],
885
+ target: Targets
886
+ }
887
+ },
888
+ frame: S,
889
+ frameset: S,
890
+ h1: S,
891
+ h2: S,
892
+ h3: S,
893
+ h4: S,
894
+ h5: S,
895
+ h6: S,
896
+ head: {
897
+ children: ["title", "base", "link", "style", "meta", "script", "noscript", "command"]
898
+ },
899
+ header: S,
900
+ hgroup: S,
901
+ hr: S,
902
+ html: {
903
+ attrs: {
904
+ manifest: null
905
+ }
906
+ },
907
+ i: S,
908
+ iframe: {
909
+ attrs: {
910
+ src: null,
911
+ srcdoc: null,
912
+ name: null,
913
+ width: null,
914
+ height: null,
915
+ sandbox: ["allow-top-navigation", "allow-same-origin", "allow-forms", "allow-scripts"],
916
+ seamless: ["seamless"]
917
+ }
918
+ },
919
+ img: {
920
+ attrs: {
921
+ alt: null,
922
+ src: null,
923
+ ismap: null,
924
+ usemap: null,
925
+ width: null,
926
+ height: null,
927
+ crossorigin: ["anonymous", "use-credentials"]
928
+ }
929
+ },
930
+ input: {
931
+ attrs: {
932
+ alt: null,
933
+ dirname: null,
934
+ form: null,
935
+ formaction: null,
936
+ height: null,
937
+ list: null,
938
+ max: null,
939
+ maxlength: null,
940
+ min: null,
941
+ name: null,
942
+ pattern: null,
943
+ placeholder: null,
944
+ size: null,
945
+ src: null,
946
+ step: null,
947
+ value: null,
948
+ width: null,
949
+ accept: ["audio/*", "video/*", "image/*"],
950
+ autocomplete: ["on", "off"],
951
+ autofocus: ["autofocus"],
952
+ checked: ["checked"],
953
+ disabled: ["disabled"],
954
+ formenctype: Encs,
955
+ formmethod: Methods,
956
+ formnovalidate: ["novalidate"],
957
+ formtarget: Targets,
958
+ multiple: ["multiple"],
959
+ readonly: ["readonly"],
960
+ required: ["required"],
961
+ type: ["hidden", "text", "search", "tel", "url", "email", "password", "datetime", "date", "month", "week", "time", "datetime-local", "number", "range", "color", "checkbox", "radio", "file", "submit", "image", "reset", "button"]
962
+ }
963
+ },
964
+ ins: {
965
+ attrs: {
966
+ cite: null,
967
+ datetime: null
968
+ }
969
+ },
970
+ kbd: S,
971
+ keygen: {
972
+ attrs: {
973
+ challenge: null,
974
+ form: null,
975
+ name: null,
976
+ autofocus: ["autofocus"],
977
+ disabled: ["disabled"],
978
+ keytype: ["RSA"]
979
+ }
980
+ },
981
+ label: {
982
+ attrs: {
983
+ for: null,
984
+ form: null
985
+ }
986
+ },
987
+ legend: S,
988
+ li: {
989
+ attrs: {
990
+ value: null
991
+ }
992
+ },
993
+ link: {
994
+ attrs: {
995
+ href: null,
996
+ type: null,
997
+ hreflang: null,
998
+ media: null,
999
+ sizes: ["all", "16x16", "16x16 32x32", "16x16 32x32 64x64"]
1000
+ }
1001
+ },
1002
+ map: {
1003
+ attrs: {
1004
+ name: null
1005
+ }
1006
+ },
1007
+ mark: S,
1008
+ menu: {
1009
+ attrs: {
1010
+ label: null,
1011
+ type: ["list", "context", "toolbar"]
1012
+ }
1013
+ },
1014
+ meta: {
1015
+ attrs: {
1016
+ content: null,
1017
+ charset: Charsets,
1018
+ name: ["viewport", "application-name", "author", "description", "generator", "keywords"],
1019
+ "http-equiv": ["content-language", "content-type", "default-style", "refresh"]
1020
+ }
1021
+ },
1022
+ meter: {
1023
+ attrs: {
1024
+ value: null,
1025
+ min: null,
1026
+ low: null,
1027
+ high: null,
1028
+ max: null,
1029
+ optimum: null
1030
+ }
1031
+ },
1032
+ nav: S,
1033
+ noframes: S,
1034
+ noscript: S,
1035
+ object: {
1036
+ attrs: {
1037
+ data: null,
1038
+ type: null,
1039
+ name: null,
1040
+ usemap: null,
1041
+ form: null,
1042
+ width: null,
1043
+ height: null,
1044
+ typemustmatch: ["typemustmatch"]
1045
+ }
1046
+ },
1047
+ ol: {
1048
+ attrs: {
1049
+ reversed: ["reversed"],
1050
+ start: null,
1051
+ type: ["1", "a", "A", "i", "I"]
1052
+ },
1053
+ children: ["li", "script", "template", "ul", "ol"]
1054
+ },
1055
+ optgroup: {
1056
+ attrs: {
1057
+ disabled: ["disabled"],
1058
+ label: null
1059
+ }
1060
+ },
1061
+ option: {
1062
+ attrs: {
1063
+ disabled: ["disabled"],
1064
+ label: null,
1065
+ selected: ["selected"],
1066
+ value: null
1067
+ }
1068
+ },
1069
+ output: {
1070
+ attrs: {
1071
+ for: null,
1072
+ form: null,
1073
+ name: null
1074
+ }
1075
+ },
1076
+ p: S,
1077
+ param: {
1078
+ attrs: {
1079
+ name: null,
1080
+ value: null
1081
+ }
1082
+ },
1083
+ pre: S,
1084
+ progress: {
1085
+ attrs: {
1086
+ value: null,
1087
+ max: null
1088
+ }
1089
+ },
1090
+ q: {
1091
+ attrs: {
1092
+ cite: null
1093
+ }
1094
+ },
1095
+ rp: S,
1096
+ rt: S,
1097
+ ruby: S,
1098
+ s: S,
1099
+ samp: S,
1100
+ script: {
1101
+ attrs: {
1102
+ type: ["text/javascript"],
1103
+ src: null,
1104
+ async: ["async"],
1105
+ defer: ["defer"],
1106
+ charset: Charsets
1107
+ }
1108
+ },
1109
+ section: S,
1110
+ select: {
1111
+ attrs: {
1112
+ form: null,
1113
+ name: null,
1114
+ size: null,
1115
+ autofocus: ["autofocus"],
1116
+ disabled: ["disabled"],
1117
+ multiple: ["multiple"]
1118
+ }
1119
+ },
1120
+ slot: {
1121
+ attrs: {
1122
+ name: null
1123
+ }
1124
+ },
1125
+ small: S,
1126
+ source: {
1127
+ attrs: {
1128
+ src: null,
1129
+ type: null,
1130
+ media: null
1131
+ }
1132
+ },
1133
+ span: S,
1134
+ strike: S,
1135
+ strong: S,
1136
+ style: {
1137
+ attrs: {
1138
+ type: ["text/css"],
1139
+ media: null,
1140
+ scoped: null
1141
+ }
1142
+ },
1143
+ sub: S,
1144
+ summary: S,
1145
+ sup: S,
1146
+ table: S,
1147
+ tbody: S,
1148
+ td: {
1149
+ attrs: {
1150
+ colspan: null,
1151
+ rowspan: null,
1152
+ headers: null
1153
+ }
1154
+ },
1155
+ template: S,
1156
+ textarea: {
1157
+ attrs: {
1158
+ dirname: null,
1159
+ form: null,
1160
+ maxlength: null,
1161
+ name: null,
1162
+ placeholder: null,
1163
+ rows: null,
1164
+ cols: null,
1165
+ autofocus: ["autofocus"],
1166
+ disabled: ["disabled"],
1167
+ readonly: ["readonly"],
1168
+ required: ["required"],
1169
+ wrap: ["soft", "hard"]
1170
+ }
1171
+ },
1172
+ tfoot: S,
1173
+ th: {
1174
+ attrs: {
1175
+ colspan: null,
1176
+ rowspan: null,
1177
+ headers: null,
1178
+ scope: ["row", "col", "rowgroup", "colgroup"]
1179
+ }
1180
+ },
1181
+ thead: S,
1182
+ time: {
1183
+ attrs: {
1184
+ datetime: null
1185
+ }
1186
+ },
1187
+ title: S,
1188
+ tr: S,
1189
+ track: {
1190
+ attrs: {
1191
+ src: null,
1192
+ label: null,
1193
+ default: null,
1194
+ kind: ["subtitles", "captions", "descriptions", "chapters", "metadata"],
1195
+ srclang: null
1196
+ }
1197
+ },
1198
+ tt: S,
1199
+ u: S,
1200
+ ul: {
1201
+ children: ["li", "script", "template", "ul", "ol"]
1202
+ },
1203
+ var: S,
1204
+ video: {
1205
+ attrs: {
1206
+ src: null,
1207
+ poster: null,
1208
+ width: null,
1209
+ height: null,
1210
+ crossorigin: ["anonymous", "use-credentials"],
1211
+ preload: ["auto", "metadata", "none"],
1212
+ autoplay: ["autoplay"],
1213
+ mediagroup: ["movie"],
1214
+ muted: ["muted"],
1215
+ controls: ["controls"]
1216
+ }
1217
+ },
1218
+ wbr: S
1219
+ };
1220
+ const GlobalAttrs = {
1221
+ accesskey: null,
1222
+ class: null,
1223
+ contenteditable: Bool,
1224
+ contextmenu: null,
1225
+ dir: ["ltr", "rtl", "auto"],
1226
+ draggable: ["true", "false", "auto"],
1227
+ dropzone: ["copy", "move", "link", "string:", "file:"],
1228
+ hidden: ["hidden"],
1229
+ id: null,
1230
+ inert: ["inert"],
1231
+ itemid: null,
1232
+ itemprop: null,
1233
+ itemref: null,
1234
+ itemscope: ["itemscope"],
1235
+ itemtype: null,
1236
+ lang: ["ar", "bn", "de", "en-GB", "en-US", "es", "fr", "hi", "id", "ja", "pa", "pt", "ru", "tr", "zh"],
1237
+ spellcheck: Bool,
1238
+ autocorrect: Bool,
1239
+ autocapitalize: Bool,
1240
+ style: null,
1241
+ tabindex: null,
1242
+ title: null,
1243
+ translate: ["yes", "no"],
1244
+ onclick: null,
1245
+ rel: ["stylesheet", "alternate", "author", "bookmark", "help", "license", "next", "nofollow", "noreferrer", "prefetch", "prev", "search", "tag"],
1246
+ role: /*@__PURE__*/"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),
1247
+ "aria-activedescendant": null,
1248
+ "aria-atomic": Bool,
1249
+ "aria-autocomplete": ["inline", "list", "both", "none"],
1250
+ "aria-busy": Bool,
1251
+ "aria-checked": ["true", "false", "mixed", "undefined"],
1252
+ "aria-controls": null,
1253
+ "aria-describedby": null,
1254
+ "aria-disabled": Bool,
1255
+ "aria-dropeffect": null,
1256
+ "aria-expanded": ["true", "false", "undefined"],
1257
+ "aria-flowto": null,
1258
+ "aria-grabbed": ["true", "false", "undefined"],
1259
+ "aria-haspopup": Bool,
1260
+ "aria-hidden": Bool,
1261
+ "aria-invalid": ["true", "false", "grammar", "spelling"],
1262
+ "aria-label": null,
1263
+ "aria-labelledby": null,
1264
+ "aria-level": null,
1265
+ "aria-live": ["off", "polite", "assertive"],
1266
+ "aria-multiline": Bool,
1267
+ "aria-multiselectable": Bool,
1268
+ "aria-owns": null,
1269
+ "aria-posinset": null,
1270
+ "aria-pressed": ["true", "false", "mixed", "undefined"],
1271
+ "aria-readonly": Bool,
1272
+ "aria-relevant": null,
1273
+ "aria-required": Bool,
1274
+ "aria-selected": ["true", "false", "undefined"],
1275
+ "aria-setsize": null,
1276
+ "aria-sort": ["ascending", "descending", "none", "other"],
1277
+ "aria-valuemax": null,
1278
+ "aria-valuemin": null,
1279
+ "aria-valuenow": null,
1280
+ "aria-valuetext": null
1281
+ };
1282
+ class Schema {
1283
+ constructor(extraTags, extraAttrs) {
1284
+ this.tags = Object.assign(Object.assign({}, Tags), extraTags);
1285
+ this.globalAttrs = Object.assign(Object.assign({}, GlobalAttrs), extraAttrs);
1286
+ this.allTags = Object.keys(this.tags);
1287
+ this.globalAttrNames = Object.keys(this.globalAttrs);
1288
+ }
1289
+ }
1290
+ Schema.default = /*@__PURE__*/new Schema();
1291
+ function elementName(doc, tree, max = doc.length) {
1292
+ if (!tree) return "";
1293
+ let tag = tree.firstChild;
1294
+ let name = tag && tag.getChild("TagName");
1295
+ return name ? doc.sliceString(name.from, Math.min(name.to, max)) : "";
1296
+ }
1297
+ function findParentElement(tree, skip = false) {
1298
+ for (let cur = tree.parent; cur; cur = cur.parent) if (cur.name == "Element") {
1299
+ if (skip) skip = false;else return cur;
1300
+ }
1301
+ return null;
1302
+ }
1303
+ function allowedChildren(doc, tree, schema) {
1304
+ let parentInfo = schema.tags[elementName(doc, findParentElement(tree, true))];
1305
+ return (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.children) || schema.allTags;
1306
+ }
1307
+ function openTags(doc, tree) {
1308
+ let open = [];
1309
+ for (let parent = tree; parent = findParentElement(parent);) {
1310
+ let tagName = elementName(doc, parent);
1311
+ if (tagName && parent.lastChild.name == "CloseTag") break;
1312
+ if (tagName && open.indexOf(tagName) < 0 && (tree.name == "EndTag" || tree.from >= parent.firstChild.to)) open.push(tagName);
1313
+ }
1314
+ return open;
1315
+ }
1316
+ const identifier = /^[:\-\.\w\u00b7-\uffff]*$/;
1317
+ function completeTag(state, schema, tree, from, to) {
1318
+ let end = /\s*>/.test(state.sliceDoc(to, to + 5)) ? "" : ">";
1319
+ return {
1320
+ from,
1321
+ to,
1322
+ options: allowedChildren(state.doc, tree, schema).map(tagName => ({
1323
+ label: tagName,
1324
+ type: "type"
1325
+ })).concat(openTags(state.doc, tree).map((tag, i) => ({
1326
+ label: "/" + tag,
1327
+ apply: "/" + tag + end,
1328
+ type: "type",
1329
+ boost: 99 - i
1330
+ }))),
1331
+ validFor: /^\/?[:\-\.\w\u00b7-\uffff]*$/
1332
+ };
1333
+ }
1334
+ function completeCloseTag(state, tree, from, to) {
1335
+ let end = /\s*>/.test(state.sliceDoc(to, to + 5)) ? "" : ">";
1336
+ return {
1337
+ from,
1338
+ to,
1339
+ options: openTags(state.doc, tree).map((tag, i) => ({
1340
+ label: tag,
1341
+ apply: tag + end,
1342
+ type: "type",
1343
+ boost: 99 - i
1344
+ })),
1345
+ validFor: identifier
1346
+ };
1347
+ }
1348
+ function completeStartTag(state, schema, tree, pos) {
1349
+ let options = [],
1350
+ level = 0;
1351
+ for (let tagName of allowedChildren(state.doc, tree, schema)) options.push({
1352
+ label: "<" + tagName,
1353
+ type: "type"
1354
+ });
1355
+ for (let open of openTags(state.doc, tree)) options.push({
1356
+ label: "</" + open + ">",
1357
+ type: "type",
1358
+ boost: 99 - level++
1359
+ });
1360
+ return {
1361
+ from: pos,
1362
+ to: pos,
1363
+ options,
1364
+ validFor: /^<\/?[:\-\.\w\u00b7-\uffff]*$/
1365
+ };
1366
+ }
1367
+ function completeAttrName(state, schema, tree, from, to) {
1368
+ let elt = findParentElement(tree),
1369
+ info = elt ? schema.tags[elementName(state.doc, elt)] : null;
1370
+ let names = info && info.attrs ? Object.keys(info.attrs).concat(schema.globalAttrNames) : schema.globalAttrNames;
1371
+ return {
1372
+ from,
1373
+ to,
1374
+ options: names.map(attrName => ({
1375
+ label: attrName,
1376
+ type: "property"
1377
+ })),
1378
+ validFor: identifier
1379
+ };
1380
+ }
1381
+ function completeAttrValue(state, schema, tree, from, to) {
1382
+ var _a;
1383
+ let nameNode = (_a = tree.parent) === null || _a === void 0 ? void 0 : _a.getChild("AttributeName");
1384
+ let options = [],
1385
+ token = undefined;
1386
+ if (nameNode) {
1387
+ let attrName = state.sliceDoc(nameNode.from, nameNode.to);
1388
+ let attrs = schema.globalAttrs[attrName];
1389
+ if (!attrs) {
1390
+ let elt = findParentElement(tree),
1391
+ info = elt ? schema.tags[elementName(state.doc, elt)] : null;
1392
+ attrs = (info === null || info === void 0 ? void 0 : info.attrs) && info.attrs[attrName];
1393
+ }
1394
+ if (attrs) {
1395
+ let base = state.sliceDoc(from, to).toLowerCase(),
1396
+ quoteStart = '"',
1397
+ quoteEnd = '"';
1398
+ if (/^['"]/.test(base)) {
1399
+ token = base[0] == '"' ? /^[^"]*$/ : /^[^']*$/;
1400
+ quoteStart = "";
1401
+ quoteEnd = state.sliceDoc(to, to + 1) == base[0] ? "" : base[0];
1402
+ base = base.slice(1);
1403
+ from++;
1404
+ } else {
1405
+ token = /^[^\s<>='"]*$/;
1406
+ }
1407
+ for (let value of attrs) options.push({
1408
+ label: value,
1409
+ apply: quoteStart + value + quoteEnd,
1410
+ type: "constant"
1411
+ });
1412
+ }
1413
+ }
1414
+ return {
1415
+ from,
1416
+ to,
1417
+ options,
1418
+ validFor: token
1419
+ };
1420
+ }
1421
+ function htmlCompletionFor(schema, context) {
1422
+ let {
1423
+ state,
1424
+ pos
1425
+ } = context,
1426
+ around = syntaxTree(state).resolveInner(pos),
1427
+ tree = around.resolve(pos, -1);
1428
+ for (let scan = pos, before; around == tree && (before = tree.childBefore(scan));) {
1429
+ let last = before.lastChild;
1430
+ if (!last || !last.type.isError || last.from < last.to) break;
1431
+ around = tree = before;
1432
+ scan = last.from;
1433
+ }
1434
+ if (tree.name == "TagName") {
1435
+ return tree.parent && /CloseTag$/.test(tree.parent.name) ? completeCloseTag(state, tree, tree.from, pos) : completeTag(state, schema, tree, tree.from, pos);
1436
+ } else if (tree.name == "StartTag") {
1437
+ return completeTag(state, schema, tree, pos, pos);
1438
+ } else if (tree.name == "StartCloseTag" || tree.name == "IncompleteCloseTag") {
1439
+ return completeCloseTag(state, tree, pos, pos);
1440
+ } else if (context.explicit && (tree.name == "OpenTag" || tree.name == "SelfClosingTag") || tree.name == "AttributeName") {
1441
+ return completeAttrName(state, schema, tree, tree.name == "AttributeName" ? tree.from : pos, pos);
1442
+ } else if (tree.name == "Is" || tree.name == "AttributeValue" || tree.name == "UnquotedAttributeValue") {
1443
+ return completeAttrValue(state, schema, tree, tree.name == "Is" ? pos : tree.from, pos);
1444
+ } else if (context.explicit && (around.name == "Element" || around.name == "Text" || around.name == "Document")) {
1445
+ return completeStartTag(state, schema, tree, pos);
1446
+ } else {
1447
+ return null;
1448
+ }
1449
+ }
1450
+ /**
1451
+ Create a completion source for HTML extended with additional tags
1452
+ or attributes.
1453
+ */
1454
+ function htmlCompletionSourceWith(config) {
1455
+ let {
1456
+ extraTags,
1457
+ extraGlobalAttributes: extraAttrs
1458
+ } = config;
1459
+ let schema = extraAttrs || extraTags ? new Schema(extraTags, extraAttrs) : Schema.default;
1460
+ return context => htmlCompletionFor(schema, context);
1461
+ }
1462
+
1463
+ /**
1464
+ A language provider based on the [Lezer HTML
1465
+ parser](https://github.com/lezer-parser/html), extended with the
1466
+ JavaScript and CSS parsers to parse the content of `<script>` and
1467
+ `<style>` tags.
1468
+ */
1469
+ const htmlLanguage = /*@__PURE__*/LRLanguage.define({
1470
+ parser: /*@__PURE__*/parser$3.configure({
1471
+ props: [/*@__PURE__*/indentNodeProp.add({
1472
+ Element(context) {
1473
+ let after = /^(\s*)(<\/)?/.exec(context.textAfter);
1474
+ if (context.node.to <= context.pos + after[0].length) return context.continue();
1475
+ return context.lineIndent(context.node.from) + (after[2] ? 0 : context.unit);
1476
+ },
1477
+ "OpenTag CloseTag SelfClosingTag"(context) {
1478
+ return context.column(context.node.from) + context.unit;
1479
+ },
1480
+ Document(context) {
1481
+ if (context.pos + /\s*/.exec(context.textAfter)[0].length < context.node.to) return context.continue();
1482
+ let endElt = null,
1483
+ close;
1484
+ for (let cur = context.node;;) {
1485
+ let last = cur.lastChild;
1486
+ if (!last || last.name != "Element" || last.to != cur.to) break;
1487
+ endElt = cur = last;
1488
+ }
1489
+ if (endElt && !((close = endElt.lastChild) && (close.name == "CloseTag" || close.name == "SelfClosingTag"))) return context.lineIndent(endElt.from) + context.unit;
1490
+ return null;
1491
+ }
1492
+ }), /*@__PURE__*/foldNodeProp.add({
1493
+ Element(node) {
1494
+ let first = node.firstChild,
1495
+ last = node.lastChild;
1496
+ if (!first || first.name != "OpenTag") return null;
1497
+ return {
1498
+ from: first.to,
1499
+ to: last.name == "CloseTag" ? last.from : node.to
1500
+ };
1501
+ }
1502
+ })],
1503
+ wrap: /*@__PURE__*/configureNesting([{
1504
+ tag: "script",
1505
+ attrs(attrs) {
1506
+ return !attrs.type || /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(attrs.type);
1507
+ },
1508
+ parser: javascriptLanguage.parser
1509
+ }, {
1510
+ tag: "style",
1511
+ attrs(attrs) {
1512
+ return (!attrs.lang || attrs.lang == "css") && (!attrs.type || /^(text\/)?(x-)?(stylesheet|css)$/i.test(attrs.type));
1513
+ },
1514
+ parser: cssLanguage.parser
1515
+ }])
1516
+ }),
1517
+ languageData: {
1518
+ commentTokens: {
1519
+ block: {
1520
+ open: "<!--",
1521
+ close: "-->"
1522
+ }
1523
+ },
1524
+ indentOnInput: /^\s*<\/\w+\W$/,
1525
+ wordChars: "-._"
1526
+ }
1527
+ });
1528
+ /**
1529
+ Language support for HTML, including
1530
+ [`htmlCompletion`](https://codemirror.net/6/docs/ref/#lang-html.htmlCompletion) and JavaScript and
1531
+ CSS support extensions.
1532
+ */
1533
+ function html(config = {}) {
1534
+ let lang = htmlLanguage;
1535
+ if (config.matchClosingTags === false) lang = lang.configure({
1536
+ dialect: "noMatch"
1537
+ });
1538
+ return new LanguageSupport(lang, [htmlLanguage.data.of({
1539
+ autocomplete: htmlCompletionSourceWith(config)
1540
+ }), config.autoCloseTags !== false ? autoCloseTags : [], javascript().support, css().support]);
1541
+ }
1542
+ /**
1543
+ Extension that will automatically insert close tags when a `>` or
1544
+ `/` is typed.
1545
+ */
1546
+ const autoCloseTags = /*@__PURE__*/EditorView.inputHandler.of((view, from, to, text) => {
1547
+ if (view.composing || view.state.readOnly || from != to || text != ">" && text != "/" || !htmlLanguage.isActiveAt(view.state, from, -1)) return false;
1548
+ let {
1549
+ state
1550
+ } = view;
1551
+ let changes = state.changeByRange(range => {
1552
+ var _a, _b, _c;
1553
+ let {
1554
+ head
1555
+ } = range,
1556
+ around = syntaxTree(state).resolveInner(head, -1),
1557
+ name;
1558
+ if (around.name == "TagName" || around.name == "StartTag") around = around.parent;
1559
+ if (text == ">" && around.name == "OpenTag") {
1560
+ if (((_b = (_a = around.parent) === null || _a === void 0 ? void 0 : _a.lastChild) === null || _b === void 0 ? void 0 : _b.name) != "CloseTag" && (name = elementName(state.doc, around.parent, head))) return {
1561
+ range: EditorSelection.cursor(head + 1),
1562
+ changes: {
1563
+ from: head,
1564
+ insert: `></${name}>`
1565
+ }
1566
+ };
1567
+ } else if (text == "/" && around.name == "OpenTag") {
1568
+ let empty = around.parent,
1569
+ base = empty === null || empty === void 0 ? void 0 : empty.parent;
1570
+ if (empty.from == head - 1 && ((_c = base.lastChild) === null || _c === void 0 ? void 0 : _c.name) != "CloseTag" && (name = elementName(state.doc, base, head))) {
1571
+ let insert = `/${name}>`;
1572
+ return {
1573
+ range: EditorSelection.cursor(head + insert.length),
1574
+ changes: {
1575
+ from: head,
1576
+ insert
1577
+ }
1578
+ };
1579
+ }
1580
+ }
1581
+ return {
1582
+ range
1583
+ };
1584
+ });
1585
+ if (changes.changes.empty) return false;
1586
+ view.dispatch(changes, {
1587
+ userEvent: "input.type",
1588
+ scrollIntoView: true
1589
+ });
1590
+ return true;
1591
+ });
1592
+
1593
+ const jsonHighlighting = styleTags({
1594
+ String: tags$1.string,
1595
+ Number: tags$1.number,
1596
+ "True False": tags$1.bool,
1597
+ PropertyName: tags$1.propertyName,
1598
+ Null: tags$1.null,
1599
+ ",": tags$1.separator,
1600
+ "[ ]": tags$1.squareBracket,
1601
+ "{ }": tags$1.brace
1602
+ });
1603
+
1604
+ // This file was generated by lezer-generator. You probably shouldn't edit it.
1605
+ const parser$1 = LRParser.deserialize({
1606
+ version: 14,
1607
+ states: "$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",
1608
+ stateData: "#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",
1609
+ goto: "!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",
1610
+ nodeNames: "⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",
1611
+ maxTerm: 25,
1612
+ nodeProps: [["openedBy", 7, "{", 12, "["], ["closedBy", 8, "}", 13, "]"]],
1613
+ propSources: [jsonHighlighting],
1614
+ skippedNodes: [0],
1615
+ repeatNodeCount: 2,
1616
+ tokenData: "(p~RaXY!WYZ!W]^!Wpq!Wrs!]|}$i}!O$n!Q!R$w!R![&V![!]&h!}#O&m#P#Q&r#Y#Z&w#b#c'f#h#i'}#o#p(f#q#r(k~!]Oc~~!`Upq!]qr!]rs!rs#O!]#O#P!w#P~!]~!wOe~~!zXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#g~#jR!Q![#s!c!i#s#T#Z#s~#vR!Q![$P!c!i$P#T#Z$P~$SR!Q![$]!c!i$]#T#Z$]~$`R!Q![!]!c!i!]#T#Z!]~$nOh~~$qQ!Q!R$w!R![&V~$|RT~!O!P%V!g!h%k#X#Y%k~%YP!Q![%]~%bRT~!Q![%]!g!h%k#X#Y%k~%nR{|%w}!O%w!Q![%}~%zP!Q![%}~&SPT~!Q![%}~&[ST~!O!P%V!Q![&V!g!h%k#X#Y%k~&mOg~~&rO]~~&wO[~~&zP#T#U&}~'QP#`#a'T~'WP#g#h'Z~'^P#X#Y'a~'fOR~~'iP#i#j'l~'oP#`#a'r~'uP#`#a'x~'}OS~~(QP#f#g(T~(WP#i#j(Z~(^P#X#Y(a~(fOQ~~(kOW~~(pOV~",
1617
+ tokenizers: [0],
1618
+ topRules: {
1619
+ "JsonText": [0, 1]
1620
+ },
1621
+ tokenPrec: 0
1622
+ });
1623
+
1624
+ /**
1625
+ A language provider that provides JSON parsing.
1626
+ */
1627
+ const jsonLanguage = /*@__PURE__*/LRLanguage.define({
1628
+ parser: /*@__PURE__*/parser$1.configure({
1629
+ props: [/*@__PURE__*/indentNodeProp.add({
1630
+ Object: /*@__PURE__*/continuedIndent({
1631
+ except: /^\s*\}/
1632
+ }),
1633
+ Array: /*@__PURE__*/continuedIndent({
1634
+ except: /^\s*\]/
1635
+ })
1636
+ }), /*@__PURE__*/foldNodeProp.add({
1637
+ "Object Array": foldInside
1638
+ })]
1639
+ }),
1640
+ languageData: {
1641
+ closeBrackets: {
1642
+ brackets: ["[", "{", '"']
1643
+ },
1644
+ indentOnInput: /^\s*[\}\]]$/
1645
+ }
1646
+ });
1647
+ /**
1648
+ JSON language support.
1649
+ */
1650
+ function json() {
1651
+ return new LanguageSupport(jsonLanguage);
1652
+ }
1653
+
1654
+ class CompositeBlock {
1655
+ constructor(type,
1656
+ // Used for indentation in list items, markup character in lists
1657
+ value, from, hash, end, children, positions) {
1658
+ this.type = type;
1659
+ this.value = value;
1660
+ this.from = from;
1661
+ this.hash = hash;
1662
+ this.end = end;
1663
+ this.children = children;
1664
+ this.positions = positions;
1665
+ this.hashProp = [[NodeProp.contextHash, hash]];
1666
+ }
1667
+ static create(type, value, from, parentHash, end) {
1668
+ let hash = parentHash + (parentHash << 8) + type + (value << 4) | 0;
1669
+ return new CompositeBlock(type, value, from, hash, end, [], []);
1670
+ }
1671
+ addChild(child, pos) {
1672
+ if (child.prop(NodeProp.contextHash) != this.hash) child = new Tree(child.type, child.children, child.positions, child.length, this.hashProp);
1673
+ this.children.push(child);
1674
+ this.positions.push(pos);
1675
+ }
1676
+ toTree(nodeSet, end = this.end) {
1677
+ let last = this.children.length - 1;
1678
+ if (last >= 0) end = Math.max(end, this.positions[last] + this.children[last].length + this.from);
1679
+ let tree = new Tree(nodeSet.types[this.type], this.children, this.positions, end - this.from).balance({
1680
+ makeTree: (children, positions, length) => new Tree(NodeType.none, children, positions, length, this.hashProp)
1681
+ });
1682
+ return tree;
1683
+ }
1684
+ }
1685
+ var Type;
1686
+ (function (Type) {
1687
+ Type[Type["Document"] = 1] = "Document";
1688
+ Type[Type["CodeBlock"] = 2] = "CodeBlock";
1689
+ Type[Type["FencedCode"] = 3] = "FencedCode";
1690
+ Type[Type["Blockquote"] = 4] = "Blockquote";
1691
+ Type[Type["HorizontalRule"] = 5] = "HorizontalRule";
1692
+ Type[Type["BulletList"] = 6] = "BulletList";
1693
+ Type[Type["OrderedList"] = 7] = "OrderedList";
1694
+ Type[Type["ListItem"] = 8] = "ListItem";
1695
+ Type[Type["ATXHeading1"] = 9] = "ATXHeading1";
1696
+ Type[Type["ATXHeading2"] = 10] = "ATXHeading2";
1697
+ Type[Type["ATXHeading3"] = 11] = "ATXHeading3";
1698
+ Type[Type["ATXHeading4"] = 12] = "ATXHeading4";
1699
+ Type[Type["ATXHeading5"] = 13] = "ATXHeading5";
1700
+ Type[Type["ATXHeading6"] = 14] = "ATXHeading6";
1701
+ Type[Type["SetextHeading1"] = 15] = "SetextHeading1";
1702
+ Type[Type["SetextHeading2"] = 16] = "SetextHeading2";
1703
+ Type[Type["HTMLBlock"] = 17] = "HTMLBlock";
1704
+ Type[Type["LinkReference"] = 18] = "LinkReference";
1705
+ Type[Type["Paragraph"] = 19] = "Paragraph";
1706
+ Type[Type["CommentBlock"] = 20] = "CommentBlock";
1707
+ Type[Type["ProcessingInstructionBlock"] = 21] = "ProcessingInstructionBlock";
1708
+ // Inline
1709
+ Type[Type["Escape"] = 22] = "Escape";
1710
+ Type[Type["Entity"] = 23] = "Entity";
1711
+ Type[Type["HardBreak"] = 24] = "HardBreak";
1712
+ Type[Type["Emphasis"] = 25] = "Emphasis";
1713
+ Type[Type["StrongEmphasis"] = 26] = "StrongEmphasis";
1714
+ Type[Type["Link"] = 27] = "Link";
1715
+ Type[Type["Image"] = 28] = "Image";
1716
+ Type[Type["InlineCode"] = 29] = "InlineCode";
1717
+ Type[Type["HTMLTag"] = 30] = "HTMLTag";
1718
+ Type[Type["Comment"] = 31] = "Comment";
1719
+ Type[Type["ProcessingInstruction"] = 32] = "ProcessingInstruction";
1720
+ Type[Type["URL"] = 33] = "URL";
1721
+ // Smaller tokens
1722
+ Type[Type["HeaderMark"] = 34] = "HeaderMark";
1723
+ Type[Type["QuoteMark"] = 35] = "QuoteMark";
1724
+ Type[Type["ListMark"] = 36] = "ListMark";
1725
+ Type[Type["LinkMark"] = 37] = "LinkMark";
1726
+ Type[Type["EmphasisMark"] = 38] = "EmphasisMark";
1727
+ Type[Type["CodeMark"] = 39] = "CodeMark";
1728
+ Type[Type["CodeText"] = 40] = "CodeText";
1729
+ Type[Type["CodeInfo"] = 41] = "CodeInfo";
1730
+ Type[Type["LinkTitle"] = 42] = "LinkTitle";
1731
+ Type[Type["LinkLabel"] = 43] = "LinkLabel";
1732
+ })(Type || (Type = {}));
1733
+ /// Data structure used to accumulate a block's content during [leaf
1734
+ /// block parsing](#BlockParser.leaf).
1735
+ class LeafBlock {
1736
+ /// @internal
1737
+ constructor(
1738
+ /// The start position of the block.
1739
+ start,
1740
+ /// The block's text content.
1741
+ content) {
1742
+ this.start = start;
1743
+ this.content = content;
1744
+ /// @internal
1745
+ this.marks = [];
1746
+ /// The block parsers active for this block.
1747
+ this.parsers = [];
1748
+ }
1749
+ }
1750
+ /// Data structure used during block-level per-line parsing.
1751
+ class Line {
1752
+ constructor() {
1753
+ /// The line's full text.
1754
+ this.text = "";
1755
+ /// The base indent provided by the composite contexts (that have
1756
+ /// been handled so far).
1757
+ this.baseIndent = 0;
1758
+ /// The string position corresponding to the base indent.
1759
+ this.basePos = 0;
1760
+ /// The number of contexts handled @internal
1761
+ this.depth = 0;
1762
+ /// Any markers (i.e. block quote markers) parsed for the contexts. @internal
1763
+ this.markers = [];
1764
+ /// The position of the next non-whitespace character beyond any
1765
+ /// list, blockquote, or other composite block markers.
1766
+ this.pos = 0;
1767
+ /// The column of the next non-whitespace character.
1768
+ this.indent = 0;
1769
+ /// The character code of the character after `pos`.
1770
+ this.next = -1;
1771
+ }
1772
+ /// @internal
1773
+ forward() {
1774
+ if (this.basePos > this.pos) this.forwardInner();
1775
+ }
1776
+ /// @internal
1777
+ forwardInner() {
1778
+ let newPos = this.skipSpace(this.basePos);
1779
+ this.indent = this.countIndent(newPos, this.pos, this.indent);
1780
+ this.pos = newPos;
1781
+ this.next = newPos == this.text.length ? -1 : this.text.charCodeAt(newPos);
1782
+ }
1783
+ /// Skip whitespace after the given position, return the position of
1784
+ /// the next non-space character or the end of the line if there's
1785
+ /// only space after `from`.
1786
+ skipSpace(from) {
1787
+ return skipSpace(this.text, from);
1788
+ }
1789
+ /// @internal
1790
+ reset(text) {
1791
+ this.text = text;
1792
+ this.baseIndent = this.basePos = this.pos = this.indent = 0;
1793
+ this.forwardInner();
1794
+ this.depth = 1;
1795
+ while (this.markers.length) this.markers.pop();
1796
+ }
1797
+ /// Move the line's base position forward to the given position.
1798
+ /// This should only be called by composite [block
1799
+ /// parsers](#BlockParser.parse) or [markup skipping
1800
+ /// functions](#NodeSpec.composite).
1801
+ moveBase(to) {
1802
+ this.basePos = to;
1803
+ this.baseIndent = this.countIndent(to, this.pos, this.indent);
1804
+ }
1805
+ /// Move the line's base position forward to the given _column_.
1806
+ moveBaseColumn(indent) {
1807
+ this.baseIndent = indent;
1808
+ this.basePos = this.findColumn(indent);
1809
+ }
1810
+ /// Store a composite-block-level marker. Should be called from
1811
+ /// [markup skipping functions](#NodeSpec.composite) when they
1812
+ /// consume any non-whitespace characters.
1813
+ addMarker(elt) {
1814
+ this.markers.push(elt);
1815
+ }
1816
+ /// Find the column position at `to`, optionally starting at a given
1817
+ /// position and column.
1818
+ countIndent(to, from = 0, indent = 0) {
1819
+ for (let i = from; i < to; i++) indent += this.text.charCodeAt(i) == 9 ? 4 - indent % 4 : 1;
1820
+ return indent;
1821
+ }
1822
+ /// Find the position corresponding to the given column.
1823
+ findColumn(goal) {
1824
+ let i = 0;
1825
+ for (let indent = 0; i < this.text.length && indent < goal; i++) indent += this.text.charCodeAt(i) == 9 ? 4 - indent % 4 : 1;
1826
+ return i;
1827
+ }
1828
+ /// @internal
1829
+ scrub() {
1830
+ if (!this.baseIndent) return this.text;
1831
+ let result = "";
1832
+ for (let i = 0; i < this.basePos; i++) result += " ";
1833
+ return result + this.text.slice(this.basePos);
1834
+ }
1835
+ }
1836
+ function skipForList(bl, cx, line) {
1837
+ if (line.pos == line.text.length || bl != cx.block && line.indent >= cx.stack[line.depth + 1].value + line.baseIndent) return true;
1838
+ if (line.indent >= line.baseIndent + 4) return false;
1839
+ let size = (bl.type == Type.OrderedList ? isOrderedList : isBulletList)(line, cx, false);
1840
+ return size > 0 && (bl.type != Type.BulletList || isHorizontalRule(line, cx, false) < 0) && line.text.charCodeAt(line.pos + size - 1) == bl.value;
1841
+ }
1842
+ const DefaultSkipMarkup = {
1843
+ [Type.Blockquote](bl, cx, line) {
1844
+ if (line.next != 62 /* '>' */) return false;
1845
+ line.markers.push(elt(Type.QuoteMark, cx.lineStart + line.pos, cx.lineStart + line.pos + 1));
1846
+ line.moveBase(line.pos + (space(line.text.charCodeAt(line.pos + 1)) ? 2 : 1));
1847
+ bl.end = cx.lineStart + line.text.length;
1848
+ return true;
1849
+ },
1850
+ [Type.ListItem](bl, _cx, line) {
1851
+ if (line.indent < line.baseIndent + bl.value && line.next > -1) return false;
1852
+ line.moveBaseColumn(line.baseIndent + bl.value);
1853
+ return true;
1854
+ },
1855
+ [Type.OrderedList]: skipForList,
1856
+ [Type.BulletList]: skipForList,
1857
+ [Type.Document]() {
1858
+ return true;
1859
+ }
1860
+ };
1861
+ function space(ch) {
1862
+ return ch == 32 || ch == 9 || ch == 10 || ch == 13;
1863
+ }
1864
+ function skipSpace(line, i = 0) {
1865
+ while (i < line.length && space(line.charCodeAt(i))) i++;
1866
+ return i;
1867
+ }
1868
+ function skipSpaceBack(line, i, to) {
1869
+ while (i > to && space(line.charCodeAt(i - 1))) i--;
1870
+ return i;
1871
+ }
1872
+ function isFencedCode(line) {
1873
+ if (line.next != 96 && line.next != 126 /* '`~' */) return -1;
1874
+ let pos = line.pos + 1;
1875
+ while (pos < line.text.length && line.text.charCodeAt(pos) == line.next) pos++;
1876
+ if (pos < line.pos + 3) return -1;
1877
+ if (line.next == 96) for (let i = pos; i < line.text.length; i++) if (line.text.charCodeAt(i) == 96) return -1;
1878
+ return pos;
1879
+ }
1880
+ function isBlockquote(line) {
1881
+ return line.next != 62 /* '>' */ ? -1 : line.text.charCodeAt(line.pos + 1) == 32 ? 2 : 1;
1882
+ }
1883
+ function isHorizontalRule(line, cx, breaking) {
1884
+ if (line.next != 42 && line.next != 45 && line.next != 95 /* '_-*' */) return -1;
1885
+ let count = 1;
1886
+ for (let pos = line.pos + 1; pos < line.text.length; pos++) {
1887
+ let ch = line.text.charCodeAt(pos);
1888
+ if (ch == line.next) count++;else if (!space(ch)) return -1;
1889
+ }
1890
+ // Setext headers take precedence
1891
+ if (breaking && line.next == 45 && isSetextUnderline(line) > -1 && line.depth == cx.stack.length) return -1;
1892
+ return count < 3 ? -1 : 1;
1893
+ }
1894
+ function inList(cx, type) {
1895
+ for (let i = cx.stack.length - 1; i >= 0; i--) if (cx.stack[i].type == type) return true;
1896
+ return false;
1897
+ }
1898
+ function isBulletList(line, cx, breaking) {
1899
+ return (line.next == 45 || line.next == 43 || line.next == 42 /* '-+*' */) && (line.pos == line.text.length - 1 || space(line.text.charCodeAt(line.pos + 1))) && (!breaking || inList(cx, Type.BulletList) || line.skipSpace(line.pos + 2) < line.text.length) ? 1 : -1;
1900
+ }
1901
+ function isOrderedList(line, cx, breaking) {
1902
+ let pos = line.pos,
1903
+ next = line.next;
1904
+ for (;;) {
1905
+ if (next >= 48 && next <= 57 /* '0-9' */) pos++;else break;
1906
+ if (pos == line.text.length) return -1;
1907
+ next = line.text.charCodeAt(pos);
1908
+ }
1909
+ if (pos == line.pos || pos > line.pos + 9 || next != 46 && next != 41 /* '.)' */ || pos < line.text.length - 1 && !space(line.text.charCodeAt(pos + 1)) || breaking && !inList(cx, Type.OrderedList) && (line.skipSpace(pos + 1) == line.text.length || pos > line.pos + 1 || line.next != 49 /* '1' */)) return -1;
1910
+ return pos + 1 - line.pos;
1911
+ }
1912
+ function isAtxHeading(line) {
1913
+ if (line.next != 35 /* '#' */) return -1;
1914
+ let pos = line.pos + 1;
1915
+ while (pos < line.text.length && line.text.charCodeAt(pos) == 35) pos++;
1916
+ if (pos < line.text.length && line.text.charCodeAt(pos) != 32) return -1;
1917
+ let size = pos - line.pos;
1918
+ return size > 6 ? -1 : size;
1919
+ }
1920
+ function isSetextUnderline(line) {
1921
+ if (line.next != 45 && line.next != 61 /* '-=' */ || line.indent >= line.baseIndent + 4) return -1;
1922
+ let pos = line.pos + 1;
1923
+ while (pos < line.text.length && line.text.charCodeAt(pos) == line.next) pos++;
1924
+ let end = pos;
1925
+ while (pos < line.text.length && space(line.text.charCodeAt(pos))) pos++;
1926
+ return pos == line.text.length ? end : -1;
1927
+ }
1928
+ const EmptyLine = /^[ \t]*$/,
1929
+ CommentEnd = /-->/,
1930
+ ProcessingEnd = /\?>/;
1931
+ const HTMLBlockStyle = [[/^<(?:script|pre|style)(?:\s|>|$)/i, /<\/(?:script|pre|style)>/i], [/^\s*<!--/, CommentEnd], [/^\s*<\?/, ProcessingEnd], [/^\s*<![A-Z]/, />/], [/^\s*<!\[CDATA\[/, /\]\]>/], [/^\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, EmptyLine], [/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i, EmptyLine]];
1932
+ function isHTMLBlock(line, _cx, breaking) {
1933
+ if (line.next != 60 /* '<' */) return -1;
1934
+ let rest = line.text.slice(line.pos);
1935
+ for (let i = 0, e = HTMLBlockStyle.length - (breaking ? 1 : 0); i < e; i++) if (HTMLBlockStyle[i][0].test(rest)) return i;
1936
+ return -1;
1937
+ }
1938
+ function getListIndent(line, pos) {
1939
+ let indentAfter = line.countIndent(pos, line.pos, line.indent);
1940
+ let indented = line.countIndent(line.skipSpace(pos), pos, indentAfter);
1941
+ return indented >= indentAfter + 5 ? indentAfter + 1 : indented;
1942
+ }
1943
+ function addCodeText(marks, from, to) {
1944
+ let last = marks.length - 1;
1945
+ if (last >= 0 && marks[last].to == from && marks[last].type == Type.CodeText) marks[last].to = to;else marks.push(elt(Type.CodeText, from, to));
1946
+ }
1947
+ // Rules for parsing blocks. A return value of false means the rule
1948
+ // doesn't apply here, true means it does. When true is returned and
1949
+ // `p.line` has been updated, the rule is assumed to have consumed a
1950
+ // leaf block. Otherwise, it is assumed to have opened a context.
1951
+ const DefaultBlockParsers = {
1952
+ LinkReference: undefined,
1953
+ IndentedCode(cx, line) {
1954
+ let base = line.baseIndent + 4;
1955
+ if (line.indent < base) return false;
1956
+ let start = line.findColumn(base);
1957
+ let from = cx.lineStart + start,
1958
+ to = cx.lineStart + line.text.length;
1959
+ let marks = [],
1960
+ pendingMarks = [];
1961
+ addCodeText(marks, from, to);
1962
+ while (cx.nextLine() && line.depth >= cx.stack.length) {
1963
+ if (line.pos == line.text.length) {
1964
+ // Empty
1965
+ addCodeText(pendingMarks, cx.lineStart - 1, cx.lineStart);
1966
+ for (let m of line.markers) pendingMarks.push(m);
1967
+ } else if (line.indent < base) {
1968
+ break;
1969
+ } else {
1970
+ if (pendingMarks.length) {
1971
+ for (let m of pendingMarks) {
1972
+ if (m.type == Type.CodeText) addCodeText(marks, m.from, m.to);else marks.push(m);
1973
+ }
1974
+ pendingMarks = [];
1975
+ }
1976
+ addCodeText(marks, cx.lineStart - 1, cx.lineStart);
1977
+ for (let m of line.markers) marks.push(m);
1978
+ to = cx.lineStart + line.text.length;
1979
+ let codeStart = cx.lineStart + line.findColumn(line.baseIndent + 4);
1980
+ if (codeStart < to) addCodeText(marks, codeStart, to);
1981
+ }
1982
+ }
1983
+ if (pendingMarks.length) {
1984
+ pendingMarks = pendingMarks.filter(m => m.type != Type.CodeText);
1985
+ if (pendingMarks.length) line.markers = pendingMarks.concat(line.markers);
1986
+ }
1987
+ cx.addNode(cx.buffer.writeElements(marks, -from).finish(Type.CodeBlock, to - from), from);
1988
+ return true;
1989
+ },
1990
+ FencedCode(cx, line) {
1991
+ let fenceEnd = isFencedCode(line);
1992
+ if (fenceEnd < 0) return false;
1993
+ let from = cx.lineStart + line.pos,
1994
+ ch = line.next,
1995
+ len = fenceEnd - line.pos;
1996
+ let infoFrom = line.skipSpace(fenceEnd),
1997
+ infoTo = skipSpaceBack(line.text, line.text.length, infoFrom);
1998
+ let marks = [elt(Type.CodeMark, from, from + len)];
1999
+ if (infoFrom < infoTo) marks.push(elt(Type.CodeInfo, cx.lineStart + infoFrom, cx.lineStart + infoTo));
2000
+ for (let first = true; cx.nextLine() && line.depth >= cx.stack.length; first = false) {
2001
+ let i = line.pos;
2002
+ if (line.indent - line.baseIndent < 4) while (i < line.text.length && line.text.charCodeAt(i) == ch) i++;
2003
+ if (i - line.pos >= len && line.skipSpace(i) == line.text.length) {
2004
+ for (let m of line.markers) marks.push(m);
2005
+ marks.push(elt(Type.CodeMark, cx.lineStart + line.pos, cx.lineStart + i));
2006
+ cx.nextLine();
2007
+ break;
2008
+ } else {
2009
+ if (!first) addCodeText(marks, cx.lineStart - 1, cx.lineStart);
2010
+ for (let m of line.markers) marks.push(m);
2011
+ let textStart = cx.lineStart + line.basePos,
2012
+ textEnd = cx.lineStart + line.text.length;
2013
+ if (textStart < textEnd) addCodeText(marks, textStart, textEnd);
2014
+ }
2015
+ }
2016
+ cx.addNode(cx.buffer.writeElements(marks, -from).finish(Type.FencedCode, cx.prevLineEnd() - from), from);
2017
+ return true;
2018
+ },
2019
+ Blockquote(cx, line) {
2020
+ let size = isBlockquote(line);
2021
+ if (size < 0) return false;
2022
+ cx.startContext(Type.Blockquote, line.pos);
2023
+ cx.addNode(Type.QuoteMark, cx.lineStart + line.pos, cx.lineStart + line.pos + 1);
2024
+ line.moveBase(line.pos + size);
2025
+ return null;
2026
+ },
2027
+ HorizontalRule(cx, line) {
2028
+ if (isHorizontalRule(line, cx, false) < 0) return false;
2029
+ let from = cx.lineStart + line.pos;
2030
+ cx.nextLine();
2031
+ cx.addNode(Type.HorizontalRule, from);
2032
+ return true;
2033
+ },
2034
+ BulletList(cx, line) {
2035
+ let size = isBulletList(line, cx, false);
2036
+ if (size < 0) return false;
2037
+ if (cx.block.type != Type.BulletList) cx.startContext(Type.BulletList, line.basePos, line.next);
2038
+ let newBase = getListIndent(line, line.pos + 1);
2039
+ cx.startContext(Type.ListItem, line.basePos, newBase - line.baseIndent);
2040
+ cx.addNode(Type.ListMark, cx.lineStart + line.pos, cx.lineStart + line.pos + size);
2041
+ line.moveBaseColumn(newBase);
2042
+ return null;
2043
+ },
2044
+ OrderedList(cx, line) {
2045
+ let size = isOrderedList(line, cx, false);
2046
+ if (size < 0) return false;
2047
+ if (cx.block.type != Type.OrderedList) cx.startContext(Type.OrderedList, line.basePos, line.text.charCodeAt(line.pos + size - 1));
2048
+ let newBase = getListIndent(line, line.pos + size);
2049
+ cx.startContext(Type.ListItem, line.basePos, newBase - line.baseIndent);
2050
+ cx.addNode(Type.ListMark, cx.lineStart + line.pos, cx.lineStart + line.pos + size);
2051
+ line.moveBaseColumn(newBase);
2052
+ return null;
2053
+ },
2054
+ ATXHeading(cx, line) {
2055
+ let size = isAtxHeading(line);
2056
+ if (size < 0) return false;
2057
+ let off = line.pos,
2058
+ from = cx.lineStart + off;
2059
+ let endOfSpace = skipSpaceBack(line.text, line.text.length, off),
2060
+ after = endOfSpace;
2061
+ while (after > off && line.text.charCodeAt(after - 1) == line.next) after--;
2062
+ if (after == endOfSpace || after == off || !space(line.text.charCodeAt(after - 1))) after = line.text.length;
2063
+ let buf = cx.buffer.write(Type.HeaderMark, 0, size).writeElements(cx.parser.parseInline(line.text.slice(off + size + 1, after), from + size + 1), -from);
2064
+ if (after < line.text.length) buf.write(Type.HeaderMark, after - off, endOfSpace - off);
2065
+ let node = buf.finish(Type.ATXHeading1 - 1 + size, line.text.length - off);
2066
+ cx.nextLine();
2067
+ cx.addNode(node, from);
2068
+ return true;
2069
+ },
2070
+ HTMLBlock(cx, line) {
2071
+ let type = isHTMLBlock(line, cx, false);
2072
+ if (type < 0) return false;
2073
+ let from = cx.lineStart + line.pos,
2074
+ end = HTMLBlockStyle[type][1];
2075
+ let marks = [],
2076
+ trailing = end != EmptyLine;
2077
+ while (!end.test(line.text) && cx.nextLine()) {
2078
+ if (line.depth < cx.stack.length) {
2079
+ trailing = false;
2080
+ break;
2081
+ }
2082
+ for (let m of line.markers) marks.push(m);
2083
+ }
2084
+ if (trailing) cx.nextLine();
2085
+ let nodeType = end == CommentEnd ? Type.CommentBlock : end == ProcessingEnd ? Type.ProcessingInstructionBlock : Type.HTMLBlock;
2086
+ let to = cx.prevLineEnd();
2087
+ cx.addNode(cx.buffer.writeElements(marks, -from).finish(nodeType, to - from), from);
2088
+ return true;
2089
+ },
2090
+ SetextHeading: undefined // Specifies relative precedence for block-continue function
2091
+ };
2092
+ // This implements a state machine that incrementally parses link references. At each
2093
+ // next line, it looks ahead to see if the line continues the reference or not. If it
2094
+ // doesn't and a valid link is available ending before that line, it finishes that.
2095
+ // Similarly, on `finish` (when the leaf is terminated by external circumstances), it
2096
+ // creates a link reference if there's a valid reference up to the current point.
2097
+ class LinkReferenceParser {
2098
+ constructor(leaf) {
2099
+ this.stage = 0 /* Start */;
2100
+ this.elts = [];
2101
+ this.pos = 0;
2102
+ this.start = leaf.start;
2103
+ this.advance(leaf.content);
2104
+ }
2105
+ nextLine(cx, line, leaf) {
2106
+ if (this.stage == -1 /* Failed */) return false;
2107
+ let content = leaf.content + "\n" + line.scrub();
2108
+ let finish = this.advance(content);
2109
+ if (finish > -1 && finish < content.length) return this.complete(cx, leaf, finish);
2110
+ return false;
2111
+ }
2112
+ finish(cx, leaf) {
2113
+ if ((this.stage == 2 /* Link */ || this.stage == 3 /* Title */) && skipSpace(leaf.content, this.pos) == leaf.content.length) return this.complete(cx, leaf, leaf.content.length);
2114
+ return false;
2115
+ }
2116
+ complete(cx, leaf, len) {
2117
+ cx.addLeafElement(leaf, elt(Type.LinkReference, this.start, this.start + len, this.elts));
2118
+ return true;
2119
+ }
2120
+ nextStage(elt) {
2121
+ if (elt) {
2122
+ this.pos = elt.to - this.start;
2123
+ this.elts.push(elt);
2124
+ this.stage++;
2125
+ return true;
2126
+ }
2127
+ if (elt === false) this.stage = -1 /* Failed */;
2128
+ return false;
2129
+ }
2130
+ advance(content) {
2131
+ for (;;) {
2132
+ if (this.stage == -1 /* Failed */) {
2133
+ return -1;
2134
+ } else if (this.stage == 0 /* Start */) {
2135
+ if (!this.nextStage(parseLinkLabel(content, this.pos, this.start, true))) return -1;
2136
+ if (content.charCodeAt(this.pos) != 58 /* ':' */) return this.stage = -1 /* Failed */;
2137
+ this.elts.push(elt(Type.LinkMark, this.pos + this.start, this.pos + this.start + 1));
2138
+ this.pos++;
2139
+ } else if (this.stage == 1 /* Label */) {
2140
+ if (!this.nextStage(parseURL(content, skipSpace(content, this.pos), this.start))) return -1;
2141
+ } else if (this.stage == 2 /* Link */) {
2142
+ let skip = skipSpace(content, this.pos),
2143
+ end = 0;
2144
+ if (skip > this.pos) {
2145
+ let title = parseLinkTitle(content, skip, this.start);
2146
+ if (title) {
2147
+ let titleEnd = lineEnd(content, title.to - this.start);
2148
+ if (titleEnd > 0) {
2149
+ this.nextStage(title);
2150
+ end = titleEnd;
2151
+ }
2152
+ }
2153
+ }
2154
+ if (!end) end = lineEnd(content, this.pos);
2155
+ return end > 0 && end < content.length ? end : -1;
2156
+ } else {
2157
+ // RefStage.Title
2158
+ return lineEnd(content, this.pos);
2159
+ }
2160
+ }
2161
+ }
2162
+ }
2163
+ function lineEnd(text, pos) {
2164
+ for (; pos < text.length; pos++) {
2165
+ let next = text.charCodeAt(pos);
2166
+ if (next == 10) break;
2167
+ if (!space(next)) return -1;
2168
+ }
2169
+ return pos;
2170
+ }
2171
+ class SetextHeadingParser {
2172
+ nextLine(cx, line, leaf) {
2173
+ let underline = line.depth < cx.stack.length ? -1 : isSetextUnderline(line);
2174
+ let next = line.next;
2175
+ if (underline < 0) return false;
2176
+ let underlineMark = elt(Type.HeaderMark, cx.lineStart + line.pos, cx.lineStart + underline);
2177
+ cx.nextLine();
2178
+ cx.addLeafElement(leaf, elt(next == 61 ? Type.SetextHeading1 : Type.SetextHeading2, leaf.start, cx.prevLineEnd(), [...cx.parser.parseInline(leaf.content, leaf.start), underlineMark]));
2179
+ return true;
2180
+ }
2181
+ finish() {
2182
+ return false;
2183
+ }
2184
+ }
2185
+ const DefaultLeafBlocks = {
2186
+ LinkReference(_, leaf) {
2187
+ return leaf.content.charCodeAt(0) == 91 /* '[' */ ? new LinkReferenceParser(leaf) : null;
2188
+ },
2189
+ SetextHeading() {
2190
+ return new SetextHeadingParser();
2191
+ }
2192
+ };
2193
+ const DefaultEndLeaf = [(_, line) => isAtxHeading(line) >= 0, (_, line) => isFencedCode(line) >= 0, (_, line) => isBlockquote(line) >= 0, (p, line) => isBulletList(line, p, true) >= 0, (p, line) => isOrderedList(line, p, true) >= 0, (p, line) => isHorizontalRule(line, p, true) >= 0, (p, line) => isHTMLBlock(line, p, true) >= 0];
2194
+ const scanLineResult = {
2195
+ text: "",
2196
+ end: 0
2197
+ };
2198
+ /// Block-level parsing functions get access to this context object.
2199
+ class BlockContext {
2200
+ /// @internal
2201
+ constructor(
2202
+ /// The parser configuration used.
2203
+ parser,
2204
+ /// @internal
2205
+ input, fragments,
2206
+ /// @internal
2207
+ ranges) {
2208
+ this.parser = parser;
2209
+ this.input = input;
2210
+ this.ranges = ranges;
2211
+ this.line = new Line();
2212
+ this.atEnd = false;
2213
+ /// @internal
2214
+ this.dontInject = new Set();
2215
+ this.stoppedAt = null;
2216
+ /// The range index that absoluteLineStart points into @internal
2217
+ this.rangeI = 0;
2218
+ this.to = ranges[ranges.length - 1].to;
2219
+ this.lineStart = this.absoluteLineStart = this.absoluteLineEnd = ranges[0].from;
2220
+ this.block = CompositeBlock.create(Type.Document, 0, this.lineStart, 0, 0);
2221
+ this.stack = [this.block];
2222
+ this.fragments = fragments.length ? new FragmentCursor(fragments, input) : null;
2223
+ this.readLine();
2224
+ }
2225
+ get parsedPos() {
2226
+ return this.absoluteLineStart;
2227
+ }
2228
+ advance() {
2229
+ if (this.stoppedAt != null && this.absoluteLineStart > this.stoppedAt) return this.finish();
2230
+ let {
2231
+ line
2232
+ } = this;
2233
+ for (;;) {
2234
+ while (line.depth < this.stack.length) this.finishContext();
2235
+ for (let mark of line.markers) this.addNode(mark.type, mark.from, mark.to);
2236
+ if (line.pos < line.text.length) break;
2237
+ // Empty line
2238
+ if (!this.nextLine()) return this.finish();
2239
+ }
2240
+ if (this.fragments && this.reuseFragment(line.basePos)) return null;
2241
+ start: for (;;) {
2242
+ for (let type of this.parser.blockParsers) if (type) {
2243
+ let result = type(this, line);
2244
+ if (result != false) {
2245
+ if (result == true) return null;
2246
+ line.forward();
2247
+ continue start;
2248
+ }
2249
+ }
2250
+ break;
2251
+ }
2252
+ let leaf = new LeafBlock(this.lineStart + line.pos, line.text.slice(line.pos));
2253
+ for (let parse of this.parser.leafBlockParsers) if (parse) {
2254
+ let parser = parse(this, leaf);
2255
+ if (parser) leaf.parsers.push(parser);
2256
+ }
2257
+ lines: while (this.nextLine()) {
2258
+ if (line.pos == line.text.length) break;
2259
+ if (line.indent < line.baseIndent + 4) {
2260
+ for (let stop of this.parser.endLeafBlock) if (stop(this, line, leaf)) break lines;
2261
+ }
2262
+ for (let parser of leaf.parsers) if (parser.nextLine(this, line, leaf)) return null;
2263
+ leaf.content += "\n" + line.scrub();
2264
+ for (let m of line.markers) leaf.marks.push(m);
2265
+ }
2266
+ this.finishLeaf(leaf);
2267
+ return null;
2268
+ }
2269
+ stopAt(pos) {
2270
+ if (this.stoppedAt != null && this.stoppedAt < pos) throw new RangeError("Can't move stoppedAt forward");
2271
+ this.stoppedAt = pos;
2272
+ }
2273
+ reuseFragment(start) {
2274
+ if (!this.fragments.moveTo(this.absoluteLineStart + start, this.absoluteLineStart) || !this.fragments.matches(this.block.hash)) return false;
2275
+ let taken = this.fragments.takeNodes(this);
2276
+ if (!taken) return false;
2277
+ let withoutGaps = taken,
2278
+ end = this.absoluteLineStart + taken;
2279
+ for (let i = 1; i < this.ranges.length; i++) {
2280
+ let gapFrom = this.ranges[i - 1].to,
2281
+ gapTo = this.ranges[i].from;
2282
+ if (gapFrom >= this.lineStart && gapTo < end) withoutGaps -= gapTo - gapFrom;
2283
+ }
2284
+ this.lineStart += withoutGaps;
2285
+ this.absoluteLineStart += taken;
2286
+ this.moveRangeI();
2287
+ if (this.absoluteLineStart < this.to) {
2288
+ this.lineStart++;
2289
+ this.absoluteLineStart++;
2290
+ this.readLine();
2291
+ } else {
2292
+ this.atEnd = true;
2293
+ this.readLine();
2294
+ }
2295
+ return true;
2296
+ }
2297
+ /// The number of parent blocks surrounding the current block.
2298
+ get depth() {
2299
+ return this.stack.length;
2300
+ }
2301
+ /// Get the type of the parent block at the given depth. When no
2302
+ /// depth is passed, return the type of the innermost parent.
2303
+ parentType(depth = this.depth - 1) {
2304
+ return this.parser.nodeSet.types[this.stack[depth].type];
2305
+ }
2306
+ /// Move to the next input line. This should only be called by
2307
+ /// (non-composite) [block parsers](#BlockParser.parse) that consume
2308
+ /// the line directly, or leaf block parser
2309
+ /// [`nextLine`](#LeafBlockParser.nextLine) methods when they
2310
+ /// consume the current line (and return true).
2311
+ nextLine() {
2312
+ this.lineStart += this.line.text.length;
2313
+ if (this.absoluteLineEnd >= this.to) {
2314
+ this.absoluteLineStart = this.absoluteLineEnd;
2315
+ this.atEnd = true;
2316
+ this.readLine();
2317
+ return false;
2318
+ } else {
2319
+ this.lineStart++;
2320
+ this.absoluteLineStart = this.absoluteLineEnd + 1;
2321
+ this.moveRangeI();
2322
+ this.readLine();
2323
+ return true;
2324
+ }
2325
+ }
2326
+ moveRangeI() {
2327
+ while (this.rangeI < this.ranges.length - 1 && this.absoluteLineStart >= this.ranges[this.rangeI].to) {
2328
+ this.rangeI++;
2329
+ this.absoluteLineStart = Math.max(this.absoluteLineStart, this.ranges[this.rangeI].from);
2330
+ }
2331
+ }
2332
+ /// @internal
2333
+ scanLine(start) {
2334
+ let r = scanLineResult;
2335
+ r.end = start;
2336
+ if (start >= this.to) {
2337
+ r.text = "";
2338
+ } else {
2339
+ r.text = this.lineChunkAt(start);
2340
+ r.end += r.text.length;
2341
+ if (this.ranges.length > 1) {
2342
+ let textOffset = this.absoluteLineStart,
2343
+ rangeI = this.rangeI;
2344
+ while (this.ranges[rangeI].to < r.end) {
2345
+ rangeI++;
2346
+ let nextFrom = this.ranges[rangeI].from;
2347
+ let after = this.lineChunkAt(nextFrom);
2348
+ r.end = nextFrom + after.length;
2349
+ r.text = r.text.slice(0, this.ranges[rangeI - 1].to - textOffset) + after;
2350
+ textOffset = r.end - r.text.length;
2351
+ }
2352
+ }
2353
+ }
2354
+ return r;
2355
+ }
2356
+ /// @internal
2357
+ readLine() {
2358
+ let {
2359
+ line
2360
+ } = this,
2361
+ {
2362
+ text,
2363
+ end
2364
+ } = this.scanLine(this.absoluteLineStart);
2365
+ this.absoluteLineEnd = end;
2366
+ line.reset(text);
2367
+ for (; line.depth < this.stack.length; line.depth++) {
2368
+ let cx = this.stack[line.depth],
2369
+ handler = this.parser.skipContextMarkup[cx.type];
2370
+ if (!handler) throw new Error("Unhandled block context " + Type[cx.type]);
2371
+ if (!handler(cx, this, line)) break;
2372
+ line.forward();
2373
+ }
2374
+ }
2375
+ lineChunkAt(pos) {
2376
+ let next = this.input.chunk(pos),
2377
+ text;
2378
+ if (!this.input.lineChunks) {
2379
+ let eol = next.indexOf("\n");
2380
+ text = eol < 0 ? next : next.slice(0, eol);
2381
+ } else {
2382
+ text = next == "\n" ? "" : next;
2383
+ }
2384
+ return pos + text.length > this.to ? text.slice(0, this.to - pos) : text;
2385
+ }
2386
+ /// The end position of the previous line.
2387
+ prevLineEnd() {
2388
+ return this.atEnd ? this.lineStart : this.lineStart - 1;
2389
+ }
2390
+ /// @internal
2391
+ startContext(type, start, value = 0) {
2392
+ this.block = CompositeBlock.create(type, value, this.lineStart + start, this.block.hash, this.lineStart + this.line.text.length);
2393
+ this.stack.push(this.block);
2394
+ }
2395
+ /// Start a composite block. Should only be called from [block
2396
+ /// parser functions](#BlockParser.parse) that return null.
2397
+ startComposite(type, start, value = 0) {
2398
+ this.startContext(this.parser.getNodeType(type), start, value);
2399
+ }
2400
+ /// @internal
2401
+ addNode(block, from, to) {
2402
+ if (typeof block == "number") block = new Tree(this.parser.nodeSet.types[block], none, none, (to !== null && to !== void 0 ? to : this.prevLineEnd()) - from);
2403
+ this.block.addChild(block, from - this.block.from);
2404
+ }
2405
+ /// Add a block element. Can be called by [block
2406
+ /// parsers](#BlockParser.parse).
2407
+ addElement(elt) {
2408
+ this.block.addChild(elt.toTree(this.parser.nodeSet), elt.from - this.block.from);
2409
+ }
2410
+ /// Add a block element from a [leaf parser](#LeafBlockParser). This
2411
+ /// makes sure any extra composite block markup (such as blockquote
2412
+ /// markers) inside the block are also added to the syntax tree.
2413
+ addLeafElement(leaf, elt) {
2414
+ this.addNode(this.buffer.writeElements(injectMarks(elt.children, leaf.marks), -elt.from).finish(elt.type, elt.to - elt.from), elt.from);
2415
+ }
2416
+ /// @internal
2417
+ finishContext() {
2418
+ let cx = this.stack.pop();
2419
+ let top = this.stack[this.stack.length - 1];
2420
+ top.addChild(cx.toTree(this.parser.nodeSet), cx.from - top.from);
2421
+ this.block = top;
2422
+ }
2423
+ finish() {
2424
+ while (this.stack.length > 1) this.finishContext();
2425
+ return this.addGaps(this.block.toTree(this.parser.nodeSet, this.lineStart));
2426
+ }
2427
+ addGaps(tree) {
2428
+ return this.ranges.length > 1 ? injectGaps(this.ranges, 0, tree.topNode, this.ranges[0].from, this.dontInject) : tree;
2429
+ }
2430
+ /// @internal
2431
+ finishLeaf(leaf) {
2432
+ for (let parser of leaf.parsers) if (parser.finish(this, leaf)) return;
2433
+ let inline = injectMarks(this.parser.parseInline(leaf.content, leaf.start), leaf.marks);
2434
+ this.addNode(this.buffer.writeElements(inline, -leaf.start).finish(Type.Paragraph, leaf.content.length), leaf.start);
2435
+ }
2436
+ elt(type, from, to, children) {
2437
+ if (typeof type == "string") return elt(this.parser.getNodeType(type), from, to, children);
2438
+ return new TreeElement(type, from);
2439
+ }
2440
+ /// @internal
2441
+ get buffer() {
2442
+ return new Buffer(this.parser.nodeSet);
2443
+ }
2444
+ }
2445
+ function injectGaps(ranges, rangeI, tree, offset, dont) {
2446
+ if (dont.has(tree.tree)) return tree.tree;
2447
+ let rangeEnd = ranges[rangeI].to;
2448
+ let children = [],
2449
+ positions = [],
2450
+ start = tree.from + offset;
2451
+ function movePastNext(upto, inclusive) {
2452
+ while (inclusive ? upto >= rangeEnd : upto > rangeEnd) {
2453
+ let size = ranges[rangeI + 1].from - rangeEnd;
2454
+ offset += size;
2455
+ upto += size;
2456
+ rangeI++;
2457
+ rangeEnd = ranges[rangeI].to;
2458
+ }
2459
+ }
2460
+ for (let ch = tree.firstChild; ch; ch = ch.nextSibling) {
2461
+ movePastNext(ch.from + offset, true);
2462
+ let from = ch.from + offset,
2463
+ node;
2464
+ if (ch.to + offset > rangeEnd) {
2465
+ node = injectGaps(ranges, rangeI, ch, offset, dont);
2466
+ movePastNext(ch.to + offset, false);
2467
+ } else {
2468
+ node = ch.toTree();
2469
+ }
2470
+ children.push(node);
2471
+ positions.push(from - start);
2472
+ }
2473
+ movePastNext(tree.to + offset, false);
2474
+ return new Tree(tree.type, children, positions, tree.to + offset - start, tree.tree ? tree.tree.propValues : undefined);
2475
+ }
2476
+ /// A Markdown parser configuration.
2477
+ class MarkdownParser extends Parser {
2478
+ /// @internal
2479
+ constructor(
2480
+ /// The parser's syntax [node
2481
+ /// types](https://lezer.codemirror.net/docs/ref/#common.NodeSet).
2482
+ nodeSet,
2483
+ /// @internal
2484
+ blockParsers,
2485
+ /// @internal
2486
+ leafBlockParsers,
2487
+ /// @internal
2488
+ blockNames,
2489
+ /// @internal
2490
+ endLeafBlock,
2491
+ /// @internal
2492
+ skipContextMarkup,
2493
+ /// @internal
2494
+ inlineParsers,
2495
+ /// @internal
2496
+ inlineNames,
2497
+ /// @internal
2498
+ wrappers) {
2499
+ super();
2500
+ this.nodeSet = nodeSet;
2501
+ this.blockParsers = blockParsers;
2502
+ this.leafBlockParsers = leafBlockParsers;
2503
+ this.blockNames = blockNames;
2504
+ this.endLeafBlock = endLeafBlock;
2505
+ this.skipContextMarkup = skipContextMarkup;
2506
+ this.inlineParsers = inlineParsers;
2507
+ this.inlineNames = inlineNames;
2508
+ this.wrappers = wrappers;
2509
+ /// @internal
2510
+ this.nodeTypes = Object.create(null);
2511
+ for (let t of nodeSet.types) this.nodeTypes[t.name] = t.id;
2512
+ }
2513
+ createParse(input, fragments, ranges) {
2514
+ let parse = new BlockContext(this, input, fragments, ranges);
2515
+ for (let w of this.wrappers) parse = w(parse, input, fragments, ranges);
2516
+ return parse;
2517
+ }
2518
+ /// Reconfigure the parser.
2519
+ configure(spec) {
2520
+ let config = resolveConfig(spec);
2521
+ if (!config) return this;
2522
+ let {
2523
+ nodeSet,
2524
+ skipContextMarkup
2525
+ } = this;
2526
+ let blockParsers = this.blockParsers.slice(),
2527
+ leafBlockParsers = this.leafBlockParsers.slice(),
2528
+ blockNames = this.blockNames.slice(),
2529
+ inlineParsers = this.inlineParsers.slice(),
2530
+ inlineNames = this.inlineNames.slice(),
2531
+ endLeafBlock = this.endLeafBlock.slice(),
2532
+ wrappers = this.wrappers;
2533
+ if (nonEmpty(config.defineNodes)) {
2534
+ skipContextMarkup = Object.assign({}, skipContextMarkup);
2535
+ let nodeTypes = nodeSet.types.slice(),
2536
+ styles;
2537
+ for (let s of config.defineNodes) {
2538
+ let {
2539
+ name,
2540
+ block,
2541
+ composite,
2542
+ style
2543
+ } = typeof s == "string" ? {
2544
+ name: s
2545
+ } : s;
2546
+ if (nodeTypes.some(t => t.name == name)) continue;
2547
+ if (composite) skipContextMarkup[nodeTypes.length] = (bl, cx, line) => composite(cx, line, bl.value);
2548
+ let id = nodeTypes.length;
2549
+ let group = composite ? ["Block", "BlockContext"] : !block ? undefined : id >= Type.ATXHeading1 && id <= Type.SetextHeading2 ? ["Block", "LeafBlock", "Heading"] : ["Block", "LeafBlock"];
2550
+ nodeTypes.push(NodeType.define({
2551
+ id,
2552
+ name,
2553
+ props: group && [[NodeProp.group, group]]
2554
+ }));
2555
+ if (style) {
2556
+ if (!styles) styles = {};
2557
+ if (Array.isArray(style) || style instanceof Tag) styles[name] = style;else Object.assign(styles, style);
2558
+ }
2559
+ }
2560
+ nodeSet = new NodeSet(nodeTypes);
2561
+ if (styles) nodeSet = nodeSet.extend(styleTags(styles));
2562
+ }
2563
+ if (nonEmpty(config.props)) nodeSet = nodeSet.extend(...config.props);
2564
+ if (nonEmpty(config.remove)) {
2565
+ for (let rm of config.remove) {
2566
+ let block = this.blockNames.indexOf(rm),
2567
+ inline = this.inlineNames.indexOf(rm);
2568
+ if (block > -1) blockParsers[block] = leafBlockParsers[block] = undefined;
2569
+ if (inline > -1) inlineParsers[inline] = undefined;
2570
+ }
2571
+ }
2572
+ if (nonEmpty(config.parseBlock)) {
2573
+ for (let spec of config.parseBlock) {
2574
+ let found = blockNames.indexOf(spec.name);
2575
+ if (found > -1) {
2576
+ blockParsers[found] = spec.parse;
2577
+ leafBlockParsers[found] = spec.leaf;
2578
+ } else {
2579
+ let pos = spec.before ? findName(blockNames, spec.before) : spec.after ? findName(blockNames, spec.after) + 1 : blockNames.length - 1;
2580
+ blockParsers.splice(pos, 0, spec.parse);
2581
+ leafBlockParsers.splice(pos, 0, spec.leaf);
2582
+ blockNames.splice(pos, 0, spec.name);
2583
+ }
2584
+ if (spec.endLeaf) endLeafBlock.push(spec.endLeaf);
2585
+ }
2586
+ }
2587
+ if (nonEmpty(config.parseInline)) {
2588
+ for (let spec of config.parseInline) {
2589
+ let found = inlineNames.indexOf(spec.name);
2590
+ if (found > -1) {
2591
+ inlineParsers[found] = spec.parse;
2592
+ } else {
2593
+ let pos = spec.before ? findName(inlineNames, spec.before) : spec.after ? findName(inlineNames, spec.after) + 1 : inlineNames.length - 1;
2594
+ inlineParsers.splice(pos, 0, spec.parse);
2595
+ inlineNames.splice(pos, 0, spec.name);
2596
+ }
2597
+ }
2598
+ }
2599
+ if (config.wrap) wrappers = wrappers.concat(config.wrap);
2600
+ return new MarkdownParser(nodeSet, blockParsers, leafBlockParsers, blockNames, endLeafBlock, skipContextMarkup, inlineParsers, inlineNames, wrappers);
2601
+ }
2602
+ /// @internal
2603
+ getNodeType(name) {
2604
+ let found = this.nodeTypes[name];
2605
+ if (found == null) throw new RangeError(`Unknown node type '${name}'`);
2606
+ return found;
2607
+ }
2608
+ /// Parse the given piece of inline text at the given offset,
2609
+ /// returning an array of [`Element`](#Element) objects representing
2610
+ /// the inline content.
2611
+ parseInline(text, offset) {
2612
+ let cx = new InlineContext(this, text, offset);
2613
+ outer: for (let pos = offset; pos < cx.end;) {
2614
+ let next = cx.char(pos);
2615
+ for (let token of this.inlineParsers) if (token) {
2616
+ let result = token(cx, next, pos);
2617
+ if (result >= 0) {
2618
+ pos = result;
2619
+ continue outer;
2620
+ }
2621
+ }
2622
+ pos++;
2623
+ }
2624
+ return cx.resolveMarkers(0);
2625
+ }
2626
+ }
2627
+ function nonEmpty(a) {
2628
+ return a != null && a.length > 0;
2629
+ }
2630
+ function resolveConfig(spec) {
2631
+ if (!Array.isArray(spec)) return spec;
2632
+ if (spec.length == 0) return null;
2633
+ let conf = resolveConfig(spec[0]);
2634
+ if (spec.length == 1) return conf;
2635
+ let rest = resolveConfig(spec.slice(1));
2636
+ if (!rest || !conf) return conf || rest;
2637
+ let conc = (a, b) => (a || none).concat(b || none);
2638
+ let wrapA = conf.wrap,
2639
+ wrapB = rest.wrap;
2640
+ return {
2641
+ props: conc(conf.props, rest.props),
2642
+ defineNodes: conc(conf.defineNodes, rest.defineNodes),
2643
+ parseBlock: conc(conf.parseBlock, rest.parseBlock),
2644
+ parseInline: conc(conf.parseInline, rest.parseInline),
2645
+ remove: conc(conf.remove, rest.remove),
2646
+ wrap: !wrapA ? wrapB : !wrapB ? wrapA : (inner, input, fragments, ranges) => wrapA(wrapB(inner, input, fragments, ranges), input, fragments, ranges)
2647
+ };
2648
+ }
2649
+ function findName(names, name) {
2650
+ let found = names.indexOf(name);
2651
+ if (found < 0) throw new RangeError(`Position specified relative to unknown parser ${name}`);
2652
+ return found;
2653
+ }
2654
+ let nodeTypes = [NodeType.none];
2655
+ for (let i = 1, name; name = Type[i]; i++) {
2656
+ nodeTypes[i] = NodeType.define({
2657
+ id: i,
2658
+ name,
2659
+ props: i >= Type.Escape ? [] : [[NodeProp.group, i in DefaultSkipMarkup ? ["Block", "BlockContext"] : ["Block", "LeafBlock"]]]
2660
+ });
2661
+ }
2662
+ const none = [];
2663
+ class Buffer {
2664
+ constructor(nodeSet) {
2665
+ this.nodeSet = nodeSet;
2666
+ this.content = [];
2667
+ this.nodes = [];
2668
+ }
2669
+ write(type, from, to, children = 0) {
2670
+ this.content.push(type, from, to, 4 + children * 4);
2671
+ return this;
2672
+ }
2673
+ writeElements(elts, offset = 0) {
2674
+ for (let e of elts) e.writeTo(this, offset);
2675
+ return this;
2676
+ }
2677
+ finish(type, length) {
2678
+ return Tree.build({
2679
+ buffer: this.content,
2680
+ nodeSet: this.nodeSet,
2681
+ reused: this.nodes,
2682
+ topID: type,
2683
+ length
2684
+ });
2685
+ }
2686
+ }
2687
+ /// Elements are used to compose syntax nodes during parsing.
2688
+ class Element {
2689
+ /// @internal
2690
+ constructor(
2691
+ /// The node's
2692
+ /// [id](https://lezer.codemirror.net/docs/ref/#common.NodeType.id).
2693
+ type,
2694
+ /// The start of the node, as an offset from the start of the document.
2695
+ from,
2696
+ /// The end of the node.
2697
+ to,
2698
+ /// The node's child nodes @internal
2699
+ children = none) {
2700
+ this.type = type;
2701
+ this.from = from;
2702
+ this.to = to;
2703
+ this.children = children;
2704
+ }
2705
+ /// @internal
2706
+ writeTo(buf, offset) {
2707
+ let startOff = buf.content.length;
2708
+ buf.writeElements(this.children, offset);
2709
+ buf.content.push(this.type, this.from + offset, this.to + offset, buf.content.length + 4 - startOff);
2710
+ }
2711
+ /// @internal
2712
+ toTree(nodeSet) {
2713
+ return new Buffer(nodeSet).writeElements(this.children, -this.from).finish(this.type, this.to - this.from);
2714
+ }
2715
+ }
2716
+ class TreeElement {
2717
+ constructor(tree, from) {
2718
+ this.tree = tree;
2719
+ this.from = from;
2720
+ }
2721
+ get to() {
2722
+ return this.from + this.tree.length;
2723
+ }
2724
+ get type() {
2725
+ return this.tree.type.id;
2726
+ }
2727
+ get children() {
2728
+ return none;
2729
+ }
2730
+ writeTo(buf, offset) {
2731
+ buf.nodes.push(this.tree);
2732
+ buf.content.push(buf.nodes.length - 1, this.from + offset, this.to + offset, -1);
2733
+ }
2734
+ toTree() {
2735
+ return this.tree;
2736
+ }
2737
+ }
2738
+ function elt(type, from, to, children) {
2739
+ return new Element(type, from, to, children);
2740
+ }
2741
+ const EmphasisUnderscore = {
2742
+ resolve: "Emphasis",
2743
+ mark: "EmphasisMark"
2744
+ };
2745
+ const EmphasisAsterisk = {
2746
+ resolve: "Emphasis",
2747
+ mark: "EmphasisMark"
2748
+ };
2749
+ const LinkStart = {},
2750
+ ImageStart = {};
2751
+ class InlineDelimiter {
2752
+ constructor(type, from, to, side) {
2753
+ this.type = type;
2754
+ this.from = from;
2755
+ this.to = to;
2756
+ this.side = side;
2757
+ }
2758
+ }
2759
+ const Escapable = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
2760
+ let Punctuation = /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;
2761
+ try {
2762
+ Punctuation = new RegExp("[\\p{Pc}|\\p{Pd}|\\p{Pe}|\\p{Pf}|\\p{Pi}|\\p{Po}|\\p{Ps}]", "u");
2763
+ } catch (_) {}
2764
+ const DefaultInline = {
2765
+ Escape(cx, next, start) {
2766
+ if (next != 92 /* '\\' */ || start == cx.end - 1) return -1;
2767
+ let escaped = cx.char(start + 1);
2768
+ for (let i = 0; i < Escapable.length; i++) if (Escapable.charCodeAt(i) == escaped) return cx.append(elt(Type.Escape, start, start + 2));
2769
+ return -1;
2770
+ },
2771
+ Entity(cx, next, start) {
2772
+ if (next != 38 /* '&' */) return -1;
2773
+ let m = /^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(cx.slice(start + 1, start + 31));
2774
+ return m ? cx.append(elt(Type.Entity, start, start + 1 + m[0].length)) : -1;
2775
+ },
2776
+ InlineCode(cx, next, start) {
2777
+ if (next != 96 /* '`' */ || start && cx.char(start - 1) == 96) return -1;
2778
+ let pos = start + 1;
2779
+ while (pos < cx.end && cx.char(pos) == 96) pos++;
2780
+ let size = pos - start,
2781
+ curSize = 0;
2782
+ for (; pos < cx.end; pos++) {
2783
+ if (cx.char(pos) == 96) {
2784
+ curSize++;
2785
+ if (curSize == size && cx.char(pos + 1) != 96) return cx.append(elt(Type.InlineCode, start, pos + 1, [elt(Type.CodeMark, start, start + size), elt(Type.CodeMark, pos + 1 - size, pos + 1)]));
2786
+ } else {
2787
+ curSize = 0;
2788
+ }
2789
+ }
2790
+ return -1;
2791
+ },
2792
+ HTMLTag(cx, next, start) {
2793
+ if (next != 60 /* '<' */ || start == cx.end - 1) return -1;
2794
+ let after = cx.slice(start + 1, cx.end);
2795
+ let url = /^(?:[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(after);
2796
+ if (url) return cx.append(elt(Type.URL, start, start + 1 + url[0].length));
2797
+ let comment = /^!--[^>](?:-[^-]|[^-])*?-->/i.exec(after);
2798
+ if (comment) return cx.append(elt(Type.Comment, start, start + 1 + comment[0].length));
2799
+ let procInst = /^\?[^]*?\?>/.exec(after);
2800
+ if (procInst) return cx.append(elt(Type.ProcessingInstruction, start, start + 1 + procInst[0].length));
2801
+ let m = /^(?:![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(after);
2802
+ if (!m) return -1;
2803
+ return cx.append(elt(Type.HTMLTag, start, start + 1 + m[0].length));
2804
+ },
2805
+ Emphasis(cx, next, start) {
2806
+ if (next != 95 && next != 42) return -1;
2807
+ let pos = start + 1;
2808
+ while (cx.char(pos) == next) pos++;
2809
+ let before = cx.slice(start - 1, start),
2810
+ after = cx.slice(pos, pos + 1);
2811
+ let pBefore = Punctuation.test(before),
2812
+ pAfter = Punctuation.test(after);
2813
+ let sBefore = /\s|^$/.test(before),
2814
+ sAfter = /\s|^$/.test(after);
2815
+ let leftFlanking = !sAfter && (!pAfter || sBefore || pBefore);
2816
+ let rightFlanking = !sBefore && (!pBefore || sAfter || pAfter);
2817
+ let canOpen = leftFlanking && (next == 42 || !rightFlanking || pBefore);
2818
+ let canClose = rightFlanking && (next == 42 || !leftFlanking || pAfter);
2819
+ return cx.append(new InlineDelimiter(next == 95 ? EmphasisUnderscore : EmphasisAsterisk, start, pos, (canOpen ? 1 /* Open */ : 0) | (canClose ? 2 /* Close */ : 0)));
2820
+ },
2821
+ HardBreak(cx, next, start) {
2822
+ if (next == 92 /* '\\' */ && cx.char(start + 1) == 10 /* '\n' */) return cx.append(elt(Type.HardBreak, start, start + 2));
2823
+ if (next == 32) {
2824
+ let pos = start + 1;
2825
+ while (cx.char(pos) == 32) pos++;
2826
+ if (cx.char(pos) == 10 && pos >= start + 2) return cx.append(elt(Type.HardBreak, start, pos + 1));
2827
+ }
2828
+ return -1;
2829
+ },
2830
+ Link(cx, next, start) {
2831
+ return next == 91 /* '[' */ ? cx.append(new InlineDelimiter(LinkStart, start, start + 1, 1 /* Open */)) : -1;
2832
+ },
2833
+ Image(cx, next, start) {
2834
+ return next == 33 /* '!' */ && cx.char(start + 1) == 91 /* '[' */ ? cx.append(new InlineDelimiter(ImageStart, start, start + 2, 1 /* Open */)) : -1;
2835
+ },
2836
+ LinkEnd(cx, next, start) {
2837
+ if (next != 93 /* ']' */) return -1;
2838
+ // Scanning back to the next link/image start marker
2839
+ for (let i = cx.parts.length - 1; i >= 0; i--) {
2840
+ let part = cx.parts[i];
2841
+ if (part instanceof InlineDelimiter && (part.type == LinkStart || part.type == ImageStart)) {
2842
+ // If this one has been set invalid (because it would produce
2843
+ // a nested link) or there's no valid link here ignore both.
2844
+ if (!part.side || cx.skipSpace(part.to) == start && !/[(\[]/.test(cx.slice(start + 1, start + 2))) {
2845
+ cx.parts[i] = null;
2846
+ return -1;
2847
+ }
2848
+ // Finish the content and replace the entire range in
2849
+ // this.parts with the link/image node.
2850
+ let content = cx.takeContent(i);
2851
+ let link = cx.parts[i] = finishLink(cx, content, part.type == LinkStart ? Type.Link : Type.Image, part.from, start + 1);
2852
+ // Set any open-link markers before this link to invalid.
2853
+ if (part.type == LinkStart) for (let j = 0; j < i; j++) {
2854
+ let p = cx.parts[j];
2855
+ if (p instanceof InlineDelimiter && p.type == LinkStart) p.side = 0;
2856
+ }
2857
+ return link.to;
2858
+ }
2859
+ }
2860
+ return -1;
2861
+ }
2862
+ };
2863
+ function finishLink(cx, content, type, start, startPos) {
2864
+ let {
2865
+ text
2866
+ } = cx,
2867
+ next = cx.char(startPos),
2868
+ endPos = startPos;
2869
+ content.unshift(elt(Type.LinkMark, start, start + (type == Type.Image ? 2 : 1)));
2870
+ content.push(elt(Type.LinkMark, startPos - 1, startPos));
2871
+ if (next == 40 /* '(' */) {
2872
+ let pos = cx.skipSpace(startPos + 1);
2873
+ let dest = parseURL(text, pos - cx.offset, cx.offset),
2874
+ title;
2875
+ if (dest) {
2876
+ pos = cx.skipSpace(dest.to);
2877
+ title = parseLinkTitle(text, pos - cx.offset, cx.offset);
2878
+ if (title) pos = cx.skipSpace(title.to);
2879
+ }
2880
+ if (cx.char(pos) == 41 /* ')' */) {
2881
+ content.push(elt(Type.LinkMark, startPos, startPos + 1));
2882
+ endPos = pos + 1;
2883
+ if (dest) content.push(dest);
2884
+ if (title) content.push(title);
2885
+ content.push(elt(Type.LinkMark, pos, endPos));
2886
+ }
2887
+ } else if (next == 91 /* '[' */) {
2888
+ let label = parseLinkLabel(text, startPos - cx.offset, cx.offset, false);
2889
+ if (label) {
2890
+ content.push(label);
2891
+ endPos = label.to;
2892
+ }
2893
+ }
2894
+ return elt(type, start, endPos, content);
2895
+ }
2896
+ // These return `null` when falling off the end of the input, `false`
2897
+ // when parsing fails otherwise (for use in the incremental link
2898
+ // reference parser).
2899
+ function parseURL(text, start, offset) {
2900
+ let next = text.charCodeAt(start);
2901
+ if (next == 60 /* '<' */) {
2902
+ for (let pos = start + 1; pos < text.length; pos++) {
2903
+ let ch = text.charCodeAt(pos);
2904
+ if (ch == 62 /* '>' */) return elt(Type.URL, start + offset, pos + 1 + offset);
2905
+ if (ch == 60 || ch == 10 /* '<\n' */) return false;
2906
+ }
2907
+ return null;
2908
+ } else {
2909
+ let depth = 0,
2910
+ pos = start;
2911
+ for (let escaped = false; pos < text.length; pos++) {
2912
+ let ch = text.charCodeAt(pos);
2913
+ if (space(ch)) {
2914
+ break;
2915
+ } else if (escaped) {
2916
+ escaped = false;
2917
+ } else if (ch == 40 /* '(' */) {
2918
+ depth++;
2919
+ } else if (ch == 41 /* ')' */) {
2920
+ if (!depth) break;
2921
+ depth--;
2922
+ } else if (ch == 92 /* '\\' */) {
2923
+ escaped = true;
2924
+ }
2925
+ }
2926
+ return pos > start ? elt(Type.URL, start + offset, pos + offset) : pos == text.length ? null : false;
2927
+ }
2928
+ }
2929
+ function parseLinkTitle(text, start, offset) {
2930
+ let next = text.charCodeAt(start);
2931
+ if (next != 39 && next != 34 && next != 40 /* '"\'(' */) return false;
2932
+ let end = next == 40 ? 41 : next;
2933
+ for (let pos = start + 1, escaped = false; pos < text.length; pos++) {
2934
+ let ch = text.charCodeAt(pos);
2935
+ if (escaped) escaped = false;else if (ch == end) return elt(Type.LinkTitle, start + offset, pos + 1 + offset);else if (ch == 92 /* '\\' */) escaped = true;
2936
+ }
2937
+ return null;
2938
+ }
2939
+ function parseLinkLabel(text, start, offset, requireNonWS) {
2940
+ for (let escaped = false, pos = start + 1, end = Math.min(text.length, pos + 999); pos < end; pos++) {
2941
+ let ch = text.charCodeAt(pos);
2942
+ if (escaped) escaped = false;else if (ch == 93 /* ']' */) return requireNonWS ? false : elt(Type.LinkLabel, start + offset, pos + 1 + offset);else {
2943
+ if (requireNonWS && !space(ch)) requireNonWS = false;
2944
+ if (ch == 91 /* '[' */) return false;else if (ch == 92 /* '\\' */) escaped = true;
2945
+ }
2946
+ }
2947
+ return null;
2948
+ }
2949
+ /// Inline parsing functions get access to this context, and use it to
2950
+ /// read the content and emit syntax nodes.
2951
+ class InlineContext {
2952
+ /// @internal
2953
+ constructor(
2954
+ /// The parser that is being used.
2955
+ parser,
2956
+ /// The text of this inline section.
2957
+ text,
2958
+ /// The starting offset of the section in the document.
2959
+ offset) {
2960
+ this.parser = parser;
2961
+ this.text = text;
2962
+ this.offset = offset;
2963
+ /// @internal
2964
+ this.parts = [];
2965
+ }
2966
+ /// Get the character code at the given (document-relative)
2967
+ /// position.
2968
+ char(pos) {
2969
+ return pos >= this.end ? -1 : this.text.charCodeAt(pos - this.offset);
2970
+ }
2971
+ /// The position of the end of this inline section.
2972
+ get end() {
2973
+ return this.offset + this.text.length;
2974
+ }
2975
+ /// Get a substring of this inline section. Again uses
2976
+ /// document-relative positions.
2977
+ slice(from, to) {
2978
+ return this.text.slice(from - this.offset, to - this.offset);
2979
+ }
2980
+ /// @internal
2981
+ append(elt) {
2982
+ this.parts.push(elt);
2983
+ return elt.to;
2984
+ }
2985
+ /// Add a [delimiter](#DelimiterType) at this given position. `open`
2986
+ /// and `close` indicate whether this delimiter is opening, closing,
2987
+ /// or both. Returns the end of the delimiter, for convenient
2988
+ /// returning from [parse functions](#InlineParser.parse).
2989
+ addDelimiter(type, from, to, open, close) {
2990
+ return this.append(new InlineDelimiter(type, from, to, (open ? 1 /* Open */ : 0) | (close ? 2 /* Close */ : 0)));
2991
+ }
2992
+ /// Add an inline element. Returns the end of the element.
2993
+ addElement(elt) {
2994
+ return this.append(elt);
2995
+ }
2996
+ /// Resolve markers between this.parts.length and from, wrapping matched markers in the
2997
+ /// appropriate node and updating the content of this.parts. @internal
2998
+ resolveMarkers(from) {
2999
+ // Scan forward, looking for closing tokens
3000
+ for (let i = from; i < this.parts.length; i++) {
3001
+ let close = this.parts[i];
3002
+ if (!(close instanceof InlineDelimiter && close.type.resolve && close.side & 2 /* Close */)) continue;
3003
+ let emp = close.type == EmphasisUnderscore || close.type == EmphasisAsterisk;
3004
+ let closeSize = close.to - close.from;
3005
+ let open,
3006
+ j = i - 1;
3007
+ // Continue scanning for a matching opening token
3008
+ for (; j >= from; j--) {
3009
+ let part = this.parts[j];
3010
+ if (part instanceof InlineDelimiter && part.side & 1 /* Open */ && part.type == close.type &&
3011
+ // Ignore emphasis delimiters where the character count doesn't match
3012
+ !(emp && (close.side & 1 /* Open */ || part.side & 2 /* Close */) && (part.to - part.from + closeSize) % 3 == 0 && ((part.to - part.from) % 3 || closeSize % 3))) {
3013
+ open = part;
3014
+ break;
3015
+ }
3016
+ }
3017
+ if (!open) continue;
3018
+ let type = close.type.resolve,
3019
+ content = [];
3020
+ let start = open.from,
3021
+ end = close.to;
3022
+ // Emphasis marker effect depends on the character count. Size consumed is minimum of the two
3023
+ // markers.
3024
+ if (emp) {
3025
+ let size = Math.min(2, open.to - open.from, closeSize);
3026
+ start = open.to - size;
3027
+ end = close.from + size;
3028
+ type = size == 1 ? "Emphasis" : "StrongEmphasis";
3029
+ }
3030
+ // Move the covered region into content, optionally adding marker nodes
3031
+ if (open.type.mark) content.push(this.elt(open.type.mark, start, open.to));
3032
+ for (let k = j + 1; k < i; k++) {
3033
+ if (this.parts[k] instanceof Element) content.push(this.parts[k]);
3034
+ this.parts[k] = null;
3035
+ }
3036
+ if (close.type.mark) content.push(this.elt(close.type.mark, close.from, end));
3037
+ let element = this.elt(type, start, end, content);
3038
+ // If there are leftover emphasis marker characters, shrink the close/open markers. Otherwise, clear them.
3039
+ this.parts[j] = emp && open.from != start ? new InlineDelimiter(open.type, open.from, start, open.side) : null;
3040
+ let keep = this.parts[i] = emp && close.to != end ? new InlineDelimiter(close.type, end, close.to, close.side) : null;
3041
+ // Insert the new element in this.parts
3042
+ if (keep) this.parts.splice(i, 0, element);else this.parts[i] = element;
3043
+ }
3044
+ // Collect the elements remaining in this.parts into an array.
3045
+ let result = [];
3046
+ for (let i = from; i < this.parts.length; i++) {
3047
+ let part = this.parts[i];
3048
+ if (part instanceof Element) result.push(part);
3049
+ }
3050
+ return result;
3051
+ }
3052
+ /// Find an opening delimiter of the given type. Returns `null` if
3053
+ /// no delimiter is found, or an index that can be passed to
3054
+ /// [`takeContent`](#InlineContext.takeContent) otherwise.
3055
+ findOpeningDelimiter(type) {
3056
+ for (let i = this.parts.length - 1; i >= 0; i--) {
3057
+ let part = this.parts[i];
3058
+ if (part instanceof InlineDelimiter && part.type == type) return i;
3059
+ }
3060
+ return null;
3061
+ }
3062
+ /// Remove all inline elements and delimiters starting from the
3063
+ /// given index (which you should get from
3064
+ /// [`findOpeningDelimiter`](#InlineContext.findOpeningDelimiter),
3065
+ /// resolve delimiters inside of them, and return them as an array
3066
+ /// of elements.
3067
+ takeContent(startIndex) {
3068
+ let content = this.resolveMarkers(startIndex);
3069
+ this.parts.length = startIndex;
3070
+ return content;
3071
+ }
3072
+ /// Skip space after the given (document) position, returning either
3073
+ /// the position of the next non-space character or the end of the
3074
+ /// section.
3075
+ skipSpace(from) {
3076
+ return skipSpace(this.text, from - this.offset) + this.offset;
3077
+ }
3078
+ elt(type, from, to, children) {
3079
+ if (typeof type == "string") return elt(this.parser.getNodeType(type), from, to, children);
3080
+ return new TreeElement(type, from);
3081
+ }
3082
+ }
3083
+ function injectMarks(elements, marks) {
3084
+ if (!marks.length) return elements;
3085
+ if (!elements.length) return marks;
3086
+ let elts = elements.slice(),
3087
+ eI = 0;
3088
+ for (let mark of marks) {
3089
+ while (eI < elts.length && elts[eI].to < mark.to) eI++;
3090
+ if (eI < elts.length && elts[eI].from < mark.from) {
3091
+ let e = elts[eI];
3092
+ if (e instanceof Element) elts[eI] = new Element(e.type, e.from, e.to, injectMarks(e.children, [mark]));
3093
+ } else {
3094
+ elts.splice(eI++, 0, mark);
3095
+ }
3096
+ }
3097
+ return elts;
3098
+ }
3099
+ // These are blocks that can span blank lines, and should thus only be
3100
+ // reused if their next sibling is also being reused.
3101
+ const NotLast = [Type.CodeBlock, Type.ListItem, Type.OrderedList, Type.BulletList];
3102
+ class FragmentCursor {
3103
+ constructor(fragments, input) {
3104
+ this.fragments = fragments;
3105
+ this.input = input;
3106
+ // Index into fragment array
3107
+ this.i = 0;
3108
+ // Active fragment
3109
+ this.fragment = null;
3110
+ this.fragmentEnd = -1;
3111
+ // Cursor into the current fragment, if any. When `moveTo` returns
3112
+ // true, this points at the first block after `pos`.
3113
+ this.cursor = null;
3114
+ if (fragments.length) this.fragment = fragments[this.i++];
3115
+ }
3116
+ nextFragment() {
3117
+ this.fragment = this.i < this.fragments.length ? this.fragments[this.i++] : null;
3118
+ this.cursor = null;
3119
+ this.fragmentEnd = -1;
3120
+ }
3121
+ moveTo(pos, lineStart) {
3122
+ while (this.fragment && this.fragment.to <= pos) this.nextFragment();
3123
+ if (!this.fragment || this.fragment.from > (pos ? pos - 1 : 0)) return false;
3124
+ if (this.fragmentEnd < 0) {
3125
+ let end = this.fragment.to;
3126
+ while (end > 0 && this.input.read(end - 1, end) != "\n") end--;
3127
+ this.fragmentEnd = end ? end - 1 : 0;
3128
+ }
3129
+ let c = this.cursor;
3130
+ if (!c) {
3131
+ c = this.cursor = this.fragment.tree.cursor();
3132
+ c.firstChild();
3133
+ }
3134
+ let rPos = pos + this.fragment.offset;
3135
+ while (c.to <= rPos) if (!c.parent()) return false;
3136
+ for (;;) {
3137
+ if (c.from >= rPos) return this.fragment.from <= lineStart;
3138
+ if (!c.childAfter(rPos)) return false;
3139
+ }
3140
+ }
3141
+ matches(hash) {
3142
+ let tree = this.cursor.tree;
3143
+ return tree && tree.prop(NodeProp.contextHash) == hash;
3144
+ }
3145
+ takeNodes(cx) {
3146
+ let cur = this.cursor,
3147
+ off = this.fragment.offset,
3148
+ fragEnd = this.fragmentEnd - (this.fragment.openEnd ? 1 : 0);
3149
+ let start = cx.absoluteLineStart,
3150
+ end = start,
3151
+ blockI = cx.block.children.length;
3152
+ let prevEnd = end,
3153
+ prevI = blockI;
3154
+ for (;;) {
3155
+ if (cur.to - off > fragEnd) {
3156
+ if (cur.type.isAnonymous && cur.firstChild()) continue;
3157
+ break;
3158
+ }
3159
+ cx.dontInject.add(cur.tree);
3160
+ cx.addNode(cur.tree, cur.from - off);
3161
+ // Taken content must always end in a block, because incremental
3162
+ // parsing happens on block boundaries. Never stop directly
3163
+ // after an indented code block, since those can continue after
3164
+ // any number of blank lines.
3165
+ if (cur.type.is("Block")) {
3166
+ if (NotLast.indexOf(cur.type.id) < 0) {
3167
+ end = cur.to - off;
3168
+ blockI = cx.block.children.length;
3169
+ } else {
3170
+ end = prevEnd;
3171
+ blockI = prevI;
3172
+ prevEnd = cur.to - off;
3173
+ prevI = cx.block.children.length;
3174
+ }
3175
+ }
3176
+ if (!cur.nextSibling()) break;
3177
+ }
3178
+ while (cx.block.children.length > blockI) {
3179
+ cx.block.children.pop();
3180
+ cx.block.positions.pop();
3181
+ }
3182
+ return end - start;
3183
+ }
3184
+ }
3185
+ const markdownHighlighting = styleTags({
3186
+ "Blockquote/...": tags$1.quote,
3187
+ HorizontalRule: tags$1.contentSeparator,
3188
+ "ATXHeading1/... SetextHeading1/...": tags$1.heading1,
3189
+ "ATXHeading2/... SetextHeading2/...": tags$1.heading2,
3190
+ "ATXHeading3/...": tags$1.heading3,
3191
+ "ATXHeading4/...": tags$1.heading4,
3192
+ "ATXHeading5/...": tags$1.heading5,
3193
+ "ATXHeading6/...": tags$1.heading6,
3194
+ "Comment CommentBlock": tags$1.comment,
3195
+ Escape: tags$1.escape,
3196
+ Entity: tags$1.character,
3197
+ "Emphasis/...": tags$1.emphasis,
3198
+ "StrongEmphasis/...": tags$1.strong,
3199
+ "Link/... Image/...": tags$1.link,
3200
+ "OrderedList/... BulletList/...": tags$1.list,
3201
+ "BlockQuote/...": tags$1.quote,
3202
+ "InlineCode CodeText": tags$1.monospace,
3203
+ URL: tags$1.url,
3204
+ "HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark": tags$1.processingInstruction,
3205
+ "CodeInfo LinkLabel": tags$1.labelName,
3206
+ LinkTitle: tags$1.string,
3207
+ Paragraph: tags$1.content
3208
+ });
3209
+ /// The default CommonMark parser.
3210
+ const parser = new MarkdownParser(new NodeSet(nodeTypes).extend(markdownHighlighting), Object.keys(DefaultBlockParsers).map(n => DefaultBlockParsers[n]), Object.keys(DefaultBlockParsers).map(n => DefaultLeafBlocks[n]), Object.keys(DefaultBlockParsers), DefaultEndLeaf, DefaultSkipMarkup, Object.keys(DefaultInline).map(n => DefaultInline[n]), Object.keys(DefaultInline), []);
3211
+ function leftOverSpace(node, from, to) {
3212
+ let ranges = [];
3213
+ for (let n = node.firstChild, pos = from;; n = n.nextSibling) {
3214
+ let nextPos = n ? n.from : to;
3215
+ if (nextPos > pos) ranges.push({
3216
+ from: pos,
3217
+ to: nextPos
3218
+ });
3219
+ if (!n) break;
3220
+ pos = n.to;
3221
+ }
3222
+ return ranges;
3223
+ }
3224
+ /// Create a Markdown extension to enable nested parsing on code
3225
+ /// blocks and/or embedded HTML.
3226
+ function parseCode(config) {
3227
+ let {
3228
+ codeParser,
3229
+ htmlParser
3230
+ } = config;
3231
+ let wrap = parseMixed((node, input) => {
3232
+ let id = node.type.id;
3233
+ if (codeParser && (id == Type.CodeBlock || id == Type.FencedCode)) {
3234
+ let info = "";
3235
+ if (id == Type.FencedCode) {
3236
+ let infoNode = node.node.getChild(Type.CodeInfo);
3237
+ if (infoNode) info = input.read(infoNode.from, infoNode.to);
3238
+ }
3239
+ let parser = codeParser(info);
3240
+ if (parser) return {
3241
+ parser,
3242
+ overlay: node => node.type.id == Type.CodeText
3243
+ };
3244
+ } else if (htmlParser && (id == Type.HTMLBlock || id == Type.HTMLTag)) {
3245
+ return {
3246
+ parser: htmlParser,
3247
+ overlay: leftOverSpace(node.node, node.from, node.to)
3248
+ };
3249
+ }
3250
+ return null;
3251
+ });
3252
+ return {
3253
+ wrap
3254
+ };
3255
+ }
3256
+ const StrikethroughDelim = {
3257
+ resolve: "Strikethrough",
3258
+ mark: "StrikethroughMark"
3259
+ };
3260
+ /// An extension that implements
3261
+ /// [GFM-style](https://github.github.com/gfm/#strikethrough-extension-)
3262
+ /// Strikethrough syntax using `~~` delimiters.
3263
+ const Strikethrough = {
3264
+ defineNodes: [{
3265
+ name: "Strikethrough",
3266
+ style: {
3267
+ "Strikethrough/...": tags$1.strikethrough
3268
+ }
3269
+ }, {
3270
+ name: "StrikethroughMark",
3271
+ style: tags$1.processingInstruction
3272
+ }],
3273
+ parseInline: [{
3274
+ name: "Strikethrough",
3275
+ parse(cx, next, pos) {
3276
+ if (next != 126 /* '~' */ || cx.char(pos + 1) != 126 || cx.char(pos + 2) == 126) return -1;
3277
+ let before = cx.slice(pos - 1, pos),
3278
+ after = cx.slice(pos + 2, pos + 3);
3279
+ let sBefore = /\s|^$/.test(before),
3280
+ sAfter = /\s|^$/.test(after);
3281
+ let pBefore = Punctuation.test(before),
3282
+ pAfter = Punctuation.test(after);
3283
+ return cx.addDelimiter(StrikethroughDelim, pos, pos + 2, !sAfter && (!pAfter || sBefore || pBefore), !sBefore && (!pBefore || sAfter || pAfter));
3284
+ },
3285
+ after: "Emphasis"
3286
+ }]
3287
+ };
3288
+ function parseRow(cx, line, startI = 0, elts, offset = 0) {
3289
+ let count = 0,
3290
+ first = true,
3291
+ cellStart = -1,
3292
+ cellEnd = -1,
3293
+ esc = false;
3294
+ let parseCell = () => {
3295
+ elts.push(cx.elt("TableCell", offset + cellStart, offset + cellEnd, cx.parser.parseInline(line.slice(cellStart, cellEnd), offset + cellStart)));
3296
+ };
3297
+ for (let i = startI; i < line.length; i++) {
3298
+ let next = line.charCodeAt(i);
3299
+ if (next == 124 /* '|' */ && !esc) {
3300
+ if (!first || cellStart > -1) count++;
3301
+ first = false;
3302
+ if (elts) {
3303
+ if (cellStart > -1) parseCell();
3304
+ elts.push(cx.elt("TableDelimiter", i + offset, i + offset + 1));
3305
+ }
3306
+ cellStart = cellEnd = -1;
3307
+ } else if (esc || next != 32 && next != 9) {
3308
+ if (cellStart < 0) cellStart = i;
3309
+ cellEnd = i + 1;
3310
+ }
3311
+ esc = !esc && next == 92;
3312
+ }
3313
+ if (cellStart > -1) {
3314
+ count++;
3315
+ if (elts) parseCell();
3316
+ }
3317
+ return count;
3318
+ }
3319
+ function hasPipe(str, start) {
3320
+ for (let i = start; i < str.length; i++) {
3321
+ let next = str.charCodeAt(i);
3322
+ if (next == 124 /* '|' */) return true;
3323
+ if (next == 92 /* '\\' */) i++;
3324
+ }
3325
+ return false;
3326
+ }
3327
+ const delimiterLine = /^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;
3328
+ class TableParser {
3329
+ constructor() {
3330
+ // Null means we haven't seen the second line yet, false means this
3331
+ // isn't a table, and an array means this is a table and we've
3332
+ // parsed the given rows so far.
3333
+ this.rows = null;
3334
+ }
3335
+ nextLine(cx, line, leaf) {
3336
+ if (this.rows == null) {
3337
+ // Second line
3338
+ this.rows = false;
3339
+ let lineText;
3340
+ if ((line.next == 45 || line.next == 58 || line.next == 124 /* '-:|' */) && delimiterLine.test(lineText = line.text.slice(line.pos))) {
3341
+ let firstRow = [],
3342
+ firstCount = parseRow(cx, leaf.content, 0, firstRow, leaf.start);
3343
+ if (firstCount == parseRow(cx, lineText, line.pos)) this.rows = [cx.elt("TableHeader", leaf.start, leaf.start + leaf.content.length, firstRow), cx.elt("TableDelimiter", cx.lineStart + line.pos, cx.lineStart + line.text.length)];
3344
+ }
3345
+ } else if (this.rows) {
3346
+ // Line after the second
3347
+ let content = [];
3348
+ parseRow(cx, line.text, line.pos, content, cx.lineStart);
3349
+ this.rows.push(cx.elt("TableRow", cx.lineStart + line.pos, cx.lineStart + line.text.length, content));
3350
+ }
3351
+ return false;
3352
+ }
3353
+ finish(cx, leaf) {
3354
+ if (!this.rows) return false;
3355
+ cx.addLeafElement(leaf, cx.elt("Table", leaf.start, leaf.start + leaf.content.length, this.rows));
3356
+ return true;
3357
+ }
3358
+ }
3359
+ /// This extension provides
3360
+ /// [GFM-style](https://github.github.com/gfm/#tables-extension-)
3361
+ /// tables, using syntax like this:
3362
+ ///
3363
+ /// ```
3364
+ /// | head 1 | head 2 |
3365
+ /// | --- | --- |
3366
+ /// | cell 1 | cell 2 |
3367
+ /// ```
3368
+ const Table = {
3369
+ defineNodes: [{
3370
+ name: "Table",
3371
+ block: true
3372
+ }, {
3373
+ name: "TableHeader",
3374
+ style: {
3375
+ "TableHeader/...": tags$1.heading
3376
+ }
3377
+ }, "TableRow", {
3378
+ name: "TableCell",
3379
+ style: tags$1.content
3380
+ }, {
3381
+ name: "TableDelimiter",
3382
+ style: tags$1.processingInstruction
3383
+ }],
3384
+ parseBlock: [{
3385
+ name: "Table",
3386
+ leaf(_, leaf) {
3387
+ return hasPipe(leaf.content, 0) ? new TableParser() : null;
3388
+ },
3389
+ endLeaf(cx, line, leaf) {
3390
+ if (leaf.parsers.some(p => p instanceof TableParser) || !hasPipe(line.text, line.basePos)) return false;
3391
+ let next = cx.scanLine(cx.absoluteLineEnd + 1).text;
3392
+ return delimiterLine.test(next) && parseRow(cx, line.text, line.basePos) == parseRow(cx, next, line.basePos);
3393
+ },
3394
+ before: "SetextHeading"
3395
+ }]
3396
+ };
3397
+ class TaskParser {
3398
+ nextLine() {
3399
+ return false;
3400
+ }
3401
+ finish(cx, leaf) {
3402
+ cx.addLeafElement(leaf, cx.elt("Task", leaf.start, leaf.start + leaf.content.length, [cx.elt("TaskMarker", leaf.start, leaf.start + 3), ...cx.parser.parseInline(leaf.content.slice(3), leaf.start + 3)]));
3403
+ return true;
3404
+ }
3405
+ }
3406
+ /// Extension providing
3407
+ /// [GFM-style](https://github.github.com/gfm/#task-list-items-extension-)
3408
+ /// task list items, where list items can be prefixed with `[ ]` or
3409
+ /// `[x]` to add a checkbox.
3410
+ const TaskList = {
3411
+ defineNodes: [{
3412
+ name: "Task",
3413
+ block: true,
3414
+ style: tags$1.list
3415
+ }, {
3416
+ name: "TaskMarker",
3417
+ style: tags$1.atom
3418
+ }],
3419
+ parseBlock: [{
3420
+ name: "TaskList",
3421
+ leaf(cx, leaf) {
3422
+ return /^\[[ xX]\]/.test(leaf.content) && cx.parentType().name == "ListItem" ? new TaskParser() : null;
3423
+ },
3424
+ after: "SetextHeading"
3425
+ }]
3426
+ };
3427
+ /// Extension bundle containing [`Table`](#Table),
3428
+ /// [`TaskList`](#TaskList) and [`Strikethrough`](#Strikethrough).
3429
+ const GFM = [Table, TaskList, Strikethrough];
3430
+ function parseSubSuper(ch, node, mark) {
3431
+ return (cx, next, pos) => {
3432
+ if (next != ch || cx.char(pos + 1) == ch) return -1;
3433
+ let elts = [cx.elt(mark, pos, pos + 1)];
3434
+ for (let i = pos + 1; i < cx.end; i++) {
3435
+ let next = cx.char(i);
3436
+ if (next == ch) return cx.addElement(cx.elt(node, pos, i + 1, elts.concat(cx.elt(mark, i, i + 1))));
3437
+ if (next == 92 /* '\\' */) elts.push(cx.elt("Escape", i, i++ + 2));
3438
+ if (space(next)) break;
3439
+ }
3440
+ return -1;
3441
+ };
3442
+ }
3443
+ /// Extension providing
3444
+ /// [Pandoc-style](https://pandoc.org/MANUAL.html#superscripts-and-subscripts)
3445
+ /// superscript using `^` markers.
3446
+ const Superscript = {
3447
+ defineNodes: [{
3448
+ name: "Superscript",
3449
+ style: tags$1.special(tags$1.content)
3450
+ }, {
3451
+ name: "SuperscriptMark",
3452
+ style: tags$1.processingInstruction
3453
+ }],
3454
+ parseInline: [{
3455
+ name: "Superscript",
3456
+ parse: parseSubSuper(94 /* '^' */, "Superscript", "SuperscriptMark")
3457
+ }]
3458
+ };
3459
+ /// Extension providing
3460
+ /// [Pandoc-style](https://pandoc.org/MANUAL.html#superscripts-and-subscripts)
3461
+ /// subscript using `~` markers.
3462
+ const Subscript = {
3463
+ defineNodes: [{
3464
+ name: "Subscript",
3465
+ style: tags$1.special(tags$1.content)
3466
+ }, {
3467
+ name: "SubscriptMark",
3468
+ style: tags$1.processingInstruction
3469
+ }],
3470
+ parseInline: [{
3471
+ name: "Subscript",
3472
+ parse: parseSubSuper(126 /* '~' */, "Subscript", "SubscriptMark")
3473
+ }]
3474
+ };
3475
+ /// Extension that parses two colons with only letters, underscores,
3476
+ /// and numbers between them as `Emoji` nodes.
3477
+ const Emoji = {
3478
+ defineNodes: [{
3479
+ name: "Emoji",
3480
+ style: tags$1.character
3481
+ }],
3482
+ parseInline: [{
3483
+ name: "Emoji",
3484
+ parse(cx, next, pos) {
3485
+ let match;
3486
+ if (next != 58 /* ':' */ || !(match = /^[a-zA-Z_0-9]+:/.exec(cx.slice(pos + 1, cx.end)))) return -1;
3487
+ return cx.addElement(cx.elt("Emoji", pos, pos + 1 + match[0].length));
3488
+ }
3489
+ }]
3490
+ };
3491
+
3492
+ const data = /*@__PURE__*/defineLanguageFacet({
3493
+ block: {
3494
+ open: "<!--",
3495
+ close: "-->"
3496
+ }
3497
+ });
3498
+ const commonmark = /*@__PURE__*/parser.configure({
3499
+ props: [/*@__PURE__*/foldNodeProp.add(type => {
3500
+ if (!type.is("Block") || type.is("Document")) return undefined;
3501
+ return (tree, state) => ({
3502
+ from: state.doc.lineAt(tree.from).to,
3503
+ to: tree.to
3504
+ });
3505
+ }), /*@__PURE__*/indentNodeProp.add({
3506
+ Document: () => null
3507
+ }), /*@__PURE__*/languageDataProp.add({
3508
+ Document: data
3509
+ })]
3510
+ });
3511
+ function mkLang(parser) {
3512
+ return new Language(data, parser);
3513
+ }
3514
+ /**
3515
+ Language support for strict CommonMark.
3516
+ */
3517
+ const commonmarkLanguage = /*@__PURE__*/mkLang(commonmark);
3518
+ const extended = /*@__PURE__*/commonmark.configure([GFM, Subscript, Superscript, Emoji]);
3519
+ /**
3520
+ Language support for [GFM](https://github.github.com/gfm/) plus
3521
+ subscript, superscript, and emoji syntax.
3522
+ */
3523
+ const markdownLanguage = /*@__PURE__*/mkLang(extended);
3524
+ function getCodeParser(languages, defaultLanguage) {
3525
+ return info => {
3526
+ if (info && languages) {
3527
+ let found = null;
3528
+ // Strip anything after whitespace
3529
+ info = /\S*/.exec(info)[0];
3530
+ if (typeof languages == "function") found = languages(info);else found = LanguageDescription.matchLanguageName(languages, info, true);
3531
+ if (found instanceof LanguageDescription) return found.support ? found.support.language.parser : ParseContext.getSkippingParser(found.load());else if (found) return found.parser;
3532
+ }
3533
+ return defaultLanguage ? defaultLanguage.parser : null;
3534
+ };
3535
+ }
3536
+ function nodeStart(node, doc) {
3537
+ return doc.sliceString(node.from, node.from + 50);
3538
+ }
3539
+ class Context {
3540
+ constructor(node, from, to, spaceBefore, spaceAfter, type, item) {
3541
+ this.node = node;
3542
+ this.from = from;
3543
+ this.to = to;
3544
+ this.spaceBefore = spaceBefore;
3545
+ this.spaceAfter = spaceAfter;
3546
+ this.type = type;
3547
+ this.item = item;
3548
+ }
3549
+ blank(trailing = true) {
3550
+ let result = this.spaceBefore;
3551
+ if (this.node.name == "Blockquote") result += ">";else for (let i = this.to - this.from - result.length - this.spaceAfter.length; i > 0; i--) result += " ";
3552
+ return result + (trailing ? this.spaceAfter : "");
3553
+ }
3554
+ marker(doc, add) {
3555
+ let number = this.node.name == "OrderedList" ? String(+itemNumber(this.item, doc)[2] + add) : "";
3556
+ return this.spaceBefore + number + this.type + this.spaceAfter;
3557
+ }
3558
+ }
3559
+ function getContext(node, line, doc) {
3560
+ let nodes = [];
3561
+ for (let cur = node; cur && cur.name != "Document"; cur = cur.parent) {
3562
+ if (cur.name == "ListItem" || cur.name == "Blockquote") nodes.push(cur);
3563
+ }
3564
+ let context = [],
3565
+ pos = 0;
3566
+ for (let i = nodes.length - 1; i >= 0; i--) {
3567
+ let node = nodes[i],
3568
+ match,
3569
+ start = pos;
3570
+ if (node.name == "Blockquote" && (match = /^[ \t]*>( ?)/.exec(line.slice(pos)))) {
3571
+ pos += match[0].length;
3572
+ context.push(new Context(node, start, pos, "", match[1], ">", null));
3573
+ } else if (node.name == "ListItem" && node.parent.name == "OrderedList" && (match = /^([ \t]*)\d+([.)])([ \t]*)/.exec(nodeStart(node, doc)))) {
3574
+ let after = match[3],
3575
+ len = match[0].length;
3576
+ if (after.length >= 4) {
3577
+ after = after.slice(0, after.length - 4);
3578
+ len -= 4;
3579
+ }
3580
+ pos += len;
3581
+ context.push(new Context(node.parent, start, pos, match[1], after, match[2], node));
3582
+ } else if (node.name == "ListItem" && node.parent.name == "BulletList" && (match = /^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(nodeStart(node, doc)))) {
3583
+ let after = match[4],
3584
+ len = match[0].length;
3585
+ if (after.length > 4) {
3586
+ after = after.slice(0, after.length - 4);
3587
+ len -= 4;
3588
+ }
3589
+ let type = match[2];
3590
+ if (match[3]) type += match[3].replace(/[xX]/, ' ');
3591
+ pos += len;
3592
+ context.push(new Context(node.parent, start, pos, match[1], after, type, node));
3593
+ }
3594
+ }
3595
+ return context;
3596
+ }
3597
+ function itemNumber(item, doc) {
3598
+ return /^(\s*)(\d+)(?=[.)])/.exec(doc.sliceString(item.from, item.from + 10));
3599
+ }
3600
+ function renumberList(after, doc, changes, offset = 0) {
3601
+ for (let prev = -1, node = after;;) {
3602
+ if (node.name == "ListItem") {
3603
+ let m = itemNumber(node, doc);
3604
+ let number = +m[2];
3605
+ if (prev >= 0) {
3606
+ if (number != prev + 1) return;
3607
+ changes.push({
3608
+ from: node.from + m[1].length,
3609
+ to: node.from + m[0].length,
3610
+ insert: String(prev + 2 + offset)
3611
+ });
3612
+ }
3613
+ prev = number;
3614
+ }
3615
+ let next = node.nextSibling;
3616
+ if (!next) break;
3617
+ node = next;
3618
+ }
3619
+ }
3620
+ /**
3621
+ This command, when invoked in Markdown context with cursor
3622
+ selection(s), will create a new line with the markup for
3623
+ blockquotes and lists that were active on the old line. If the
3624
+ cursor was directly after the end of the markup for the old line,
3625
+ trailing whitespace and list markers are removed from that line.
3626
+
3627
+ The command does nothing in non-Markdown context, so it should
3628
+ not be used as the only binding for Enter (even in a Markdown
3629
+ document, HTML and code regions might use a different language).
3630
+ */
3631
+ const insertNewlineContinueMarkup = ({
3632
+ state,
3633
+ dispatch
3634
+ }) => {
3635
+ let tree = syntaxTree(state),
3636
+ {
3637
+ doc
3638
+ } = state;
3639
+ let dont = null,
3640
+ changes = state.changeByRange(range => {
3641
+ if (!range.empty || !markdownLanguage.isActiveAt(state, range.from)) return dont = {
3642
+ range
3643
+ };
3644
+ let pos = range.from,
3645
+ line = doc.lineAt(pos);
3646
+ let context = getContext(tree.resolveInner(pos, -1), line.text, doc);
3647
+ while (context.length && context[context.length - 1].from > pos - line.from) context.pop();
3648
+ if (!context.length) return dont = {
3649
+ range
3650
+ };
3651
+ let inner = context[context.length - 1];
3652
+ if (inner.to - inner.spaceAfter.length > pos - line.from) return dont = {
3653
+ range
3654
+ };
3655
+ let emptyLine = pos >= inner.to - inner.spaceAfter.length && !/\S/.test(line.text.slice(inner.to));
3656
+ // Empty line in list
3657
+ if (inner.item && emptyLine) {
3658
+ // First list item or blank line before: delete a level of markup
3659
+ if (inner.node.firstChild.to >= pos || line.from > 0 && !/[^\s>]/.test(doc.lineAt(line.from - 1).text)) {
3660
+ let next = context.length > 1 ? context[context.length - 2] : null;
3661
+ let delTo,
3662
+ insert = "";
3663
+ if (next && next.item) {
3664
+ // Re-add marker for the list at the next level
3665
+ delTo = line.from + next.from;
3666
+ insert = next.marker(doc, 1);
3667
+ } else {
3668
+ delTo = line.from + (next ? next.to : 0);
3669
+ }
3670
+ let changes = [{
3671
+ from: delTo,
3672
+ to: pos,
3673
+ insert
3674
+ }];
3675
+ if (inner.node.name == "OrderedList") renumberList(inner.item, doc, changes, -2);
3676
+ if (next && next.node.name == "OrderedList") renumberList(next.item, doc, changes);
3677
+ return {
3678
+ range: EditorSelection.cursor(delTo + insert.length),
3679
+ changes
3680
+ };
3681
+ } else {
3682
+ // Move this line down
3683
+ let insert = "";
3684
+ for (let i = 0, e = context.length - 2; i <= e; i++) insert += context[i].blank(i < e);
3685
+ insert += state.lineBreak;
3686
+ return {
3687
+ range: EditorSelection.cursor(pos + insert.length),
3688
+ changes: {
3689
+ from: line.from,
3690
+ insert
3691
+ }
3692
+ };
3693
+ }
3694
+ }
3695
+ if (inner.node.name == "Blockquote" && emptyLine && line.from) {
3696
+ let prevLine = doc.lineAt(line.from - 1),
3697
+ quoted = />\s*$/.exec(prevLine.text);
3698
+ // Two aligned empty quoted lines in a row
3699
+ if (quoted && quoted.index == inner.from) {
3700
+ let changes = state.changes([{
3701
+ from: prevLine.from + quoted.index,
3702
+ to: prevLine.to
3703
+ }, {
3704
+ from: line.from + inner.from,
3705
+ to: line.to
3706
+ }]);
3707
+ return {
3708
+ range: range.map(changes),
3709
+ changes
3710
+ };
3711
+ }
3712
+ }
3713
+ let changes = [];
3714
+ if (inner.node.name == "OrderedList") renumberList(inner.item, doc, changes);
3715
+ let insert = state.lineBreak;
3716
+ let continued = inner.item && inner.item.from < line.from;
3717
+ // If not dedented
3718
+ if (!continued || /^[\s\d.)\-+*>]*/.exec(line.text)[0].length >= inner.to) {
3719
+ for (let i = 0, e = context.length - 1; i <= e; i++) insert += i == e && !continued ? context[i].marker(doc, 1) : context[i].blank();
3720
+ }
3721
+ let from = pos;
3722
+ while (from > line.from && /\s/.test(line.text.charAt(from - line.from - 1))) from--;
3723
+ changes.push({
3724
+ from,
3725
+ to: pos,
3726
+ insert
3727
+ });
3728
+ return {
3729
+ range: EditorSelection.cursor(from + insert.length),
3730
+ changes
3731
+ };
3732
+ });
3733
+ if (dont) return false;
3734
+ dispatch(state.update(changes, {
3735
+ scrollIntoView: true,
3736
+ userEvent: "input"
3737
+ }));
3738
+ return true;
3739
+ };
3740
+ function isMark(node) {
3741
+ return node.name == "QuoteMark" || node.name == "ListMark";
3742
+ }
3743
+ function contextNodeForDelete(tree, pos) {
3744
+ let node = tree.resolveInner(pos, -1),
3745
+ scan = pos;
3746
+ if (isMark(node)) {
3747
+ scan = node.from;
3748
+ node = node.parent;
3749
+ }
3750
+ for (let prev; prev = node.childBefore(scan);) {
3751
+ if (isMark(prev)) {
3752
+ scan = prev.from;
3753
+ } else if (prev.name == "OrderedList" || prev.name == "BulletList") {
3754
+ node = prev.lastChild;
3755
+ scan = node.to;
3756
+ } else {
3757
+ break;
3758
+ }
3759
+ }
3760
+ return node;
3761
+ }
3762
+ /**
3763
+ This command will, when invoked in a Markdown context with the
3764
+ cursor directly after list or blockquote markup, delete one level
3765
+ of markup. When the markup is for a list, it will be replaced by
3766
+ spaces on the first invocation (a further invocation will delete
3767
+ the spaces), to make it easy to continue a list.
3768
+
3769
+ When not after Markdown block markup, this command will return
3770
+ false, so it is intended to be bound alongside other deletion
3771
+ commands, with a higher precedence than the more generic commands.
3772
+ */
3773
+ const deleteMarkupBackward = ({
3774
+ state,
3775
+ dispatch
3776
+ }) => {
3777
+ let tree = syntaxTree(state);
3778
+ let dont = null,
3779
+ changes = state.changeByRange(range => {
3780
+ let pos = range.from,
3781
+ {
3782
+ doc
3783
+ } = state;
3784
+ if (range.empty && markdownLanguage.isActiveAt(state, range.from)) {
3785
+ let line = doc.lineAt(pos);
3786
+ let context = getContext(contextNodeForDelete(tree, pos), line.text, doc);
3787
+ if (context.length) {
3788
+ let inner = context[context.length - 1];
3789
+ let spaceEnd = inner.to - inner.spaceAfter.length + (inner.spaceAfter ? 1 : 0);
3790
+ // Delete extra trailing space after markup
3791
+ if (pos - line.from > spaceEnd && !/\S/.test(line.text.slice(spaceEnd, pos - line.from))) return {
3792
+ range: EditorSelection.cursor(line.from + spaceEnd),
3793
+ changes: {
3794
+ from: line.from + spaceEnd,
3795
+ to: pos
3796
+ }
3797
+ };
3798
+ if (pos - line.from == spaceEnd) {
3799
+ let start = line.from + inner.from;
3800
+ // Replace a list item marker with blank space
3801
+ if (inner.item && inner.node.from < inner.item.from && /\S/.test(line.text.slice(inner.from, inner.to))) return {
3802
+ range,
3803
+ changes: {
3804
+ from: start,
3805
+ to: line.from + inner.to,
3806
+ insert: inner.blank()
3807
+ }
3808
+ };
3809
+ // Delete one level of indentation
3810
+ if (start < pos) return {
3811
+ range: EditorSelection.cursor(start),
3812
+ changes: {
3813
+ from: start,
3814
+ to: pos
3815
+ }
3816
+ };
3817
+ }
3818
+ }
3819
+ }
3820
+ return dont = {
3821
+ range
3822
+ };
3823
+ });
3824
+ if (dont) return false;
3825
+ dispatch(state.update(changes, {
3826
+ scrollIntoView: true,
3827
+ userEvent: "delete"
3828
+ }));
3829
+ return true;
3830
+ };
3831
+
3832
+ /**
3833
+ A small keymap with Markdown-specific bindings. Binds Enter to
3834
+ [`insertNewlineContinueMarkup`](https://codemirror.net/6/docs/ref/#lang-markdown.insertNewlineContinueMarkup)
3835
+ and Backspace to
3836
+ [`deleteMarkupBackward`](https://codemirror.net/6/docs/ref/#lang-markdown.deleteMarkupBackward).
3837
+ */
3838
+ const markdownKeymap = [{
3839
+ key: "Enter",
3840
+ run: insertNewlineContinueMarkup
3841
+ }, {
3842
+ key: "Backspace",
3843
+ run: deleteMarkupBackward
3844
+ }];
3845
+ const htmlNoMatch = /*@__PURE__*/html({
3846
+ matchClosingTags: false
3847
+ });
3848
+ /**
3849
+ Markdown language support.
3850
+ */
3851
+ function markdown(config = {}) {
3852
+ let {
3853
+ codeLanguages,
3854
+ defaultCodeLanguage,
3855
+ addKeymap = true,
3856
+ base: {
3857
+ parser
3858
+ } = commonmarkLanguage
3859
+ } = config;
3860
+ if (!(parser instanceof MarkdownParser)) throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");
3861
+ let extensions = config.extensions ? [config.extensions] : [];
3862
+ let support = [htmlNoMatch.support],
3863
+ defaultCode;
3864
+ if (defaultCodeLanguage instanceof LanguageSupport) {
3865
+ support.push(defaultCodeLanguage.support);
3866
+ defaultCode = defaultCodeLanguage.language;
3867
+ } else if (defaultCodeLanguage) {
3868
+ defaultCode = defaultCodeLanguage;
3869
+ }
3870
+ let codeParser = codeLanguages || defaultCode ? getCodeParser(codeLanguages, defaultCode) : undefined;
3871
+ extensions.push(parseCode({
3872
+ codeParser,
3873
+ htmlParser: htmlNoMatch.language.parser
3874
+ }));
3875
+ if (addKeymap) support.push(Prec.high(keymap.of(markdownKeymap)));
3876
+ return new LanguageSupport(mkLang(parser.configure(extensions)), support);
3877
+ }
3878
+
3879
+ const JS = javascript({
3880
+ typescript: false
3881
+ });
3882
+ const TS = javascript({
3883
+ typescript: true
3884
+ });
3885
+ const CSS = css();
3886
+ const HTML = html();
3887
+ const JSON$1 = json();
3888
+ const MD = markdown();
3889
+ var languages = {
3890
+ [OrCodeLanguages.JS]: JS,
3891
+ [OrCodeLanguages.TS]: TS,
3892
+ [OrCodeLanguages.CSS]: CSS,
3893
+ [OrCodeLanguages.HTML]: HTML,
3894
+ [OrCodeLanguages.JSON]: JSON$1,
3895
+ [OrCodeLanguages.MD]: MD
3896
+ };
3897
+
3898
+ export { CSS, HTML, JS, JSON$1 as JSON, MD, TS, languages as default };