@burger-editor/client 4.0.0-alpha.6 → 4.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.css +33 -26
- package/dist/client.js +619 -2709
- package/dist/client.js.map +1 -1
- package/package.json +7 -7
package/dist/client.js
CHANGED
|
@@ -27,7 +27,7 @@ function kebabCase(str) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* marked
|
|
30
|
+
* marked v16.0.0 - a markdown parser
|
|
31
31
|
* Copyright (c) 2011-2025, Christopher Jeffrey. (MIT Licensed)
|
|
32
32
|
* https://github.com/markedjs/marked
|
|
33
33
|
*/
|
|
@@ -37,2160 +37,62 @@ function kebabCase(str) {
|
|
|
37
37
|
* The code in this file is generated from files in ./src/
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
replace
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
|
|
97
|
-
listIsTask: /^\[[ xX]\] /,
|
|
98
|
-
listReplaceTask: /^\[[ xX]\] +/,
|
|
99
|
-
anyLine: /\n.*\n/,
|
|
100
|
-
hrefBrackets: /^<(.*)>$/,
|
|
101
|
-
tableDelimiter: /[:|]/,
|
|
102
|
-
tableAlignChars: /^\||\| *$/g,
|
|
103
|
-
tableRowBlankLine: /\n[ \t]*$/,
|
|
104
|
-
tableAlignRight: /^ *-+: *$/,
|
|
105
|
-
tableAlignCenter: /^ *:-+: *$/,
|
|
106
|
-
tableAlignLeft: /^ *:-+ *$/,
|
|
107
|
-
startATag: /^<a /i,
|
|
108
|
-
endATag: /^<\/a>/i,
|
|
109
|
-
startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
|
|
110
|
-
endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
|
|
111
|
-
startAngleBracket: /^</,
|
|
112
|
-
endAngleBracket: />$/,
|
|
113
|
-
pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
|
|
114
|
-
unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
|
|
115
|
-
escapeTest: /[&<>"']/,
|
|
116
|
-
escapeReplace: /[&<>"']/g,
|
|
117
|
-
escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
|
|
118
|
-
escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
|
|
119
|
-
unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,
|
|
120
|
-
caret: /(^|[^\[])\^/g,
|
|
121
|
-
percentDecode: /%25/g,
|
|
122
|
-
findPipe: /\|/g,
|
|
123
|
-
splitPipe: / \|/,
|
|
124
|
-
slashPipe: /\\\|/g,
|
|
125
|
-
carriageReturn: /\r\n|\r/g,
|
|
126
|
-
spaceLine: /^ +$/gm,
|
|
127
|
-
notSpaceStart: /^\S*/,
|
|
128
|
-
endingNewline: /\n$/,
|
|
129
|
-
listItemRegex: (bull) => new RegExp(`^( {0,3}${bull})((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
130
|
-
nextBulletRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
131
|
-
hrRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
|
|
132
|
-
fencesBeginRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`),
|
|
133
|
-
headingBeginRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`),
|
|
134
|
-
htmlBeginRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}<(?:[a-z].*>|!--)`, "i")
|
|
135
|
-
};
|
|
136
|
-
var newline = /^(?:[ \t]*(?:\n|$))+/;
|
|
137
|
-
var blockCode = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
|
|
138
|
-
var fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
|
|
139
|
-
var hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
|
140
|
-
var heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
|
141
|
-
var bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
|
142
|
-
var lheadingCore = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
|
|
143
|
-
var lheading = edit(lheadingCore).replace(/bull/g, bullet).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
|
|
144
|
-
var lheadingGfm = edit(lheadingCore).replace(/bull/g, bullet).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
|
|
145
|
-
var _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
|
|
146
|
-
var blockText = /^[^\n]+/;
|
|
147
|
-
var _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
|
|
148
|
-
var def = edit(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", _blockLabel).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
|
|
149
|
-
var list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet).getRegex();
|
|
150
|
-
var _tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
|
|
151
|
-
var _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
152
|
-
var html$1 = edit(
|
|
153
|
-
"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))",
|
|
154
|
-
"i"
|
|
155
|
-
).replace("comment", _comment).replace("tag", _tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
156
|
-
var paragraph = edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex();
|
|
157
|
-
var blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", paragraph).getRegex();
|
|
158
|
-
var blockNormal = {
|
|
159
|
-
blockquote,
|
|
160
|
-
code: blockCode,
|
|
161
|
-
def,
|
|
162
|
-
fences,
|
|
163
|
-
heading,
|
|
164
|
-
hr,
|
|
165
|
-
html: html$1,
|
|
166
|
-
lheading,
|
|
167
|
-
list,
|
|
168
|
-
newline,
|
|
169
|
-
paragraph,
|
|
170
|
-
table: noopTest,
|
|
171
|
-
text: blockText
|
|
172
|
-
};
|
|
173
|
-
var gfmTable = edit(
|
|
174
|
-
"^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
|
|
175
|
-
).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex();
|
|
176
|
-
var blockGfm = {
|
|
177
|
-
...blockNormal,
|
|
178
|
-
lheading: lheadingGfm,
|
|
179
|
-
table: gfmTable,
|
|
180
|
-
paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", gfmTable).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex()
|
|
181
|
-
};
|
|
182
|
-
var blockPedantic = {
|
|
183
|
-
...blockNormal,
|
|
184
|
-
html: edit(
|
|
185
|
-
`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
|
|
186
|
-
).replace("comment", _comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
|
|
187
|
-
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
188
|
-
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
189
|
-
fences: noopTest,
|
|
190
|
-
// fences not supported
|
|
191
|
-
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
192
|
-
paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " *#{1,6} *[^\n]").replace("lheading", lheading).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
193
|
-
};
|
|
194
|
-
var escape = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
|
|
195
|
-
var inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
|
|
196
|
-
var br = /^( {2,}|\\)\n(?!\s*$)/;
|
|
197
|
-
var inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
|
198
|
-
var _punctuation = /[\p{P}\p{S}]/u;
|
|
199
|
-
var _punctuationOrSpace = /[\s\p{P}\p{S}]/u;
|
|
200
|
-
var _notPunctuationOrSpace = /[^\s\p{P}\p{S}]/u;
|
|
201
|
-
var punctuation = edit(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, _punctuationOrSpace).getRegex();
|
|
202
|
-
var _punctuationGfmStrongEm = /(?!~)[\p{P}\p{S}]/u;
|
|
203
|
-
var _punctuationOrSpaceGfmStrongEm = /(?!~)[\s\p{P}\p{S}]/u;
|
|
204
|
-
var _notPunctuationOrSpaceGfmStrongEm = /(?:[^\s\p{P}\p{S}]|~)/u;
|
|
205
|
-
var blockSkip = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g;
|
|
206
|
-
var emStrongLDelimCore = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/;
|
|
207
|
-
var emStrongLDelim = edit(emStrongLDelimCore, "u").replace(/punct/g, _punctuation).getRegex();
|
|
208
|
-
var emStrongLDelimGfm = edit(emStrongLDelimCore, "u").replace(/punct/g, _punctuationGfmStrongEm).getRegex();
|
|
209
|
-
var emStrongRDelimAstCore = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
|
|
210
|
-
var emStrongRDelimAst = edit(emStrongRDelimAstCore, "gu").replace(/notPunctSpace/g, _notPunctuationOrSpace).replace(/punctSpace/g, _punctuationOrSpace).replace(/punct/g, _punctuation).getRegex();
|
|
211
|
-
var emStrongRDelimAstGfm = edit(emStrongRDelimAstCore, "gu").replace(/notPunctSpace/g, _notPunctuationOrSpaceGfmStrongEm).replace(/punctSpace/g, _punctuationOrSpaceGfmStrongEm).replace(/punct/g, _punctuationGfmStrongEm).getRegex();
|
|
212
|
-
var emStrongRDelimUnd = edit(
|
|
213
|
-
"^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)",
|
|
214
|
-
"gu"
|
|
215
|
-
).replace(/notPunctSpace/g, _notPunctuationOrSpace).replace(/punctSpace/g, _punctuationOrSpace).replace(/punct/g, _punctuation).getRegex();
|
|
216
|
-
var anyPunctuation = edit(/\\(punct)/, "gu").replace(/punct/g, _punctuation).getRegex();
|
|
217
|
-
var autolink = edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
|
|
218
|
-
var _inlineComment = edit(_comment).replace("(?:-->|$)", "-->").getRegex();
|
|
219
|
-
var tag = edit(
|
|
220
|
-
"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>"
|
|
221
|
-
).replace("comment", _inlineComment).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
|
|
222
|
-
var _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
|
|
223
|
-
var link$1 = edit(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", _inlineLabel).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
|
|
224
|
-
var reflink = edit(/^!?\[(label)\]\[(ref)\]/).replace("label", _inlineLabel).replace("ref", _blockLabel).getRegex();
|
|
225
|
-
var nolink = edit(/^!?\[(ref)\](?:\[\])?/).replace("ref", _blockLabel).getRegex();
|
|
226
|
-
var reflinkSearch = edit("reflink|nolink(?!\\()", "g").replace("reflink", reflink).replace("nolink", nolink).getRegex();
|
|
227
|
-
var inlineNormal = {
|
|
228
|
-
_backpedal: noopTest,
|
|
229
|
-
// only used for GFM url
|
|
230
|
-
anyPunctuation,
|
|
231
|
-
autolink,
|
|
232
|
-
blockSkip,
|
|
233
|
-
br,
|
|
234
|
-
code: inlineCode,
|
|
235
|
-
del: noopTest,
|
|
236
|
-
emStrongLDelim,
|
|
237
|
-
emStrongRDelimAst,
|
|
238
|
-
emStrongRDelimUnd,
|
|
239
|
-
escape,
|
|
240
|
-
link: link$1,
|
|
241
|
-
nolink,
|
|
242
|
-
punctuation,
|
|
243
|
-
reflink,
|
|
244
|
-
reflinkSearch,
|
|
245
|
-
tag,
|
|
246
|
-
text: inlineText,
|
|
247
|
-
url: noopTest
|
|
248
|
-
};
|
|
249
|
-
var inlinePedantic = {
|
|
250
|
-
...inlineNormal,
|
|
251
|
-
link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", _inlineLabel).getRegex(),
|
|
252
|
-
reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", _inlineLabel).getRegex()
|
|
253
|
-
};
|
|
254
|
-
var inlineGfm = {
|
|
255
|
-
...inlineNormal,
|
|
256
|
-
emStrongRDelimAst: emStrongRDelimAstGfm,
|
|
257
|
-
emStrongLDelim: emStrongLDelimGfm,
|
|
258
|
-
url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
259
|
-
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
260
|
-
del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
|
|
261
|
-
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
262
|
-
};
|
|
263
|
-
var inlineBreaks = {
|
|
264
|
-
...inlineGfm,
|
|
265
|
-
br: edit(br).replace("{2,}", "*").getRegex(),
|
|
266
|
-
text: edit(inlineGfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
267
|
-
};
|
|
268
|
-
var block$1 = {
|
|
269
|
-
normal: blockNormal,
|
|
270
|
-
gfm: blockGfm,
|
|
271
|
-
pedantic: blockPedantic
|
|
272
|
-
};
|
|
273
|
-
var inline = {
|
|
274
|
-
normal: inlineNormal,
|
|
275
|
-
gfm: inlineGfm,
|
|
276
|
-
breaks: inlineBreaks,
|
|
277
|
-
pedantic: inlinePedantic
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
// src/helpers.ts
|
|
281
|
-
var escapeReplacements = {
|
|
282
|
-
"&": "&",
|
|
283
|
-
"<": "<",
|
|
284
|
-
">": ">",
|
|
285
|
-
'"': """,
|
|
286
|
-
"'": "'"
|
|
287
|
-
};
|
|
288
|
-
var getEscapeReplacement = (ch) => escapeReplacements[ch];
|
|
289
|
-
function escape2(html2, encode) {
|
|
290
|
-
if (encode) {
|
|
291
|
-
if (other.escapeTest.test(html2)) {
|
|
292
|
-
return html2.replace(other.escapeReplace, getEscapeReplacement);
|
|
293
|
-
}
|
|
294
|
-
} else {
|
|
295
|
-
if (other.escapeTestNoEncode.test(html2)) {
|
|
296
|
-
return html2.replace(other.escapeReplaceNoEncode, getEscapeReplacement);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
return html2;
|
|
300
|
-
}
|
|
301
|
-
function cleanUrl(href) {
|
|
302
|
-
try {
|
|
303
|
-
href = encodeURI(href).replace(other.percentDecode, "%");
|
|
304
|
-
} catch {
|
|
305
|
-
return null;
|
|
306
|
-
}
|
|
307
|
-
return href;
|
|
308
|
-
}
|
|
309
|
-
function splitCells(tableRow, count) {
|
|
310
|
-
const row = tableRow.replace(other.findPipe, (match, offset, str) => {
|
|
311
|
-
let escaped = false;
|
|
312
|
-
let curr = offset;
|
|
313
|
-
while (--curr >= 0 && str[curr] === "\\") escaped = !escaped;
|
|
314
|
-
if (escaped) {
|
|
315
|
-
return "|";
|
|
316
|
-
} else {
|
|
317
|
-
return " |";
|
|
318
|
-
}
|
|
319
|
-
}), cells = row.split(other.splitPipe);
|
|
320
|
-
let i = 0;
|
|
321
|
-
if (!cells[0].trim()) {
|
|
322
|
-
cells.shift();
|
|
323
|
-
}
|
|
324
|
-
if (cells.length > 0 && !cells.at(-1)?.trim()) {
|
|
325
|
-
cells.pop();
|
|
326
|
-
}
|
|
327
|
-
if (count) {
|
|
328
|
-
if (cells.length > count) {
|
|
329
|
-
cells.splice(count);
|
|
330
|
-
} else {
|
|
331
|
-
while (cells.length < count) cells.push("");
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
for (; i < cells.length; i++) {
|
|
335
|
-
cells[i] = cells[i].trim().replace(other.slashPipe, "|");
|
|
336
|
-
}
|
|
337
|
-
return cells;
|
|
338
|
-
}
|
|
339
|
-
function rtrim(str, c, invert) {
|
|
340
|
-
const l = str.length;
|
|
341
|
-
if (l === 0) {
|
|
342
|
-
return "";
|
|
343
|
-
}
|
|
344
|
-
let suffLen = 0;
|
|
345
|
-
while (suffLen < l) {
|
|
346
|
-
const currChar = str.charAt(l - suffLen - 1);
|
|
347
|
-
if (currChar === c && true) {
|
|
348
|
-
suffLen++;
|
|
349
|
-
} else {
|
|
350
|
-
break;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
return str.slice(0, l - suffLen);
|
|
354
|
-
}
|
|
355
|
-
function findClosingBracket(str, b) {
|
|
356
|
-
if (str.indexOf(b[1]) === -1) {
|
|
357
|
-
return -1;
|
|
358
|
-
}
|
|
359
|
-
let level = 0;
|
|
360
|
-
for (let i = 0; i < str.length; i++) {
|
|
361
|
-
if (str[i] === "\\") {
|
|
362
|
-
i++;
|
|
363
|
-
} else if (str[i] === b[0]) {
|
|
364
|
-
level++;
|
|
365
|
-
} else if (str[i] === b[1]) {
|
|
366
|
-
level--;
|
|
367
|
-
if (level < 0) {
|
|
368
|
-
return i;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
if (level > 0) {
|
|
373
|
-
return -2;
|
|
374
|
-
}
|
|
375
|
-
return -1;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
// src/Tokenizer.ts
|
|
379
|
-
function outputLink(cap, link2, raw, lexer2, rules) {
|
|
380
|
-
const href = link2.href;
|
|
381
|
-
const title = link2.title || null;
|
|
382
|
-
const text = cap[1].replace(rules.other.outputLinkReplace, "$1");
|
|
383
|
-
lexer2.state.inLink = true;
|
|
384
|
-
const token = {
|
|
385
|
-
type: cap[0].charAt(0) === "!" ? "image" : "link",
|
|
386
|
-
raw,
|
|
387
|
-
href,
|
|
388
|
-
title,
|
|
389
|
-
text,
|
|
390
|
-
tokens: lexer2.inlineTokens(text)
|
|
391
|
-
};
|
|
392
|
-
lexer2.state.inLink = false;
|
|
393
|
-
return token;
|
|
394
|
-
}
|
|
395
|
-
function indentCodeCompensation(raw, text, rules) {
|
|
396
|
-
const matchIndentToCode = raw.match(rules.other.indentCodeCompensation);
|
|
397
|
-
if (matchIndentToCode === null) {
|
|
398
|
-
return text;
|
|
399
|
-
}
|
|
400
|
-
const indentToCode = matchIndentToCode[1];
|
|
401
|
-
return text.split("\n").map((node) => {
|
|
402
|
-
const matchIndentInNode = node.match(rules.other.beginningSpace);
|
|
403
|
-
if (matchIndentInNode === null) {
|
|
404
|
-
return node;
|
|
405
|
-
}
|
|
406
|
-
const [indentInNode] = matchIndentInNode;
|
|
407
|
-
if (indentInNode.length >= indentToCode.length) {
|
|
408
|
-
return node.slice(indentToCode.length);
|
|
409
|
-
}
|
|
410
|
-
return node;
|
|
411
|
-
}).join("\n");
|
|
412
|
-
}
|
|
413
|
-
var _Tokenizer = class {
|
|
414
|
-
options;
|
|
415
|
-
rules;
|
|
416
|
-
// set by the lexer
|
|
417
|
-
lexer;
|
|
418
|
-
// set by the lexer
|
|
419
|
-
constructor(options2) {
|
|
420
|
-
this.options = options2 || _defaults;
|
|
421
|
-
}
|
|
422
|
-
space(src) {
|
|
423
|
-
const cap = this.rules.block.newline.exec(src);
|
|
424
|
-
if (cap && cap[0].length > 0) {
|
|
425
|
-
return {
|
|
426
|
-
type: "space",
|
|
427
|
-
raw: cap[0]
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
code(src) {
|
|
432
|
-
const cap = this.rules.block.code.exec(src);
|
|
433
|
-
if (cap) {
|
|
434
|
-
const text = cap[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
435
|
-
return {
|
|
436
|
-
type: "code",
|
|
437
|
-
raw: cap[0],
|
|
438
|
-
codeBlockStyle: "indented",
|
|
439
|
-
text: !this.options.pedantic ? rtrim(text, "\n") : text
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
fences(src) {
|
|
444
|
-
const cap = this.rules.block.fences.exec(src);
|
|
445
|
-
if (cap) {
|
|
446
|
-
const raw = cap[0];
|
|
447
|
-
const text = indentCodeCompensation(raw, cap[3] || "", this.rules);
|
|
448
|
-
return {
|
|
449
|
-
type: "code",
|
|
450
|
-
raw,
|
|
451
|
-
lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : cap[2],
|
|
452
|
-
text
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
heading(src) {
|
|
457
|
-
const cap = this.rules.block.heading.exec(src);
|
|
458
|
-
if (cap) {
|
|
459
|
-
let text = cap[2].trim();
|
|
460
|
-
if (this.rules.other.endingHash.test(text)) {
|
|
461
|
-
const trimmed = rtrim(text, "#");
|
|
462
|
-
if (this.options.pedantic) {
|
|
463
|
-
text = trimmed.trim();
|
|
464
|
-
} else if (!trimmed || this.rules.other.endingSpaceChar.test(trimmed)) {
|
|
465
|
-
text = trimmed.trim();
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
return {
|
|
469
|
-
type: "heading",
|
|
470
|
-
raw: cap[0],
|
|
471
|
-
depth: cap[1].length,
|
|
472
|
-
text,
|
|
473
|
-
tokens: this.lexer.inline(text)
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
hr(src) {
|
|
478
|
-
const cap = this.rules.block.hr.exec(src);
|
|
479
|
-
if (cap) {
|
|
480
|
-
return {
|
|
481
|
-
type: "hr",
|
|
482
|
-
raw: rtrim(cap[0], "\n")
|
|
483
|
-
};
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
blockquote(src) {
|
|
487
|
-
const cap = this.rules.block.blockquote.exec(src);
|
|
488
|
-
if (cap) {
|
|
489
|
-
let lines = rtrim(cap[0], "\n").split("\n");
|
|
490
|
-
let raw = "";
|
|
491
|
-
let text = "";
|
|
492
|
-
const tokens = [];
|
|
493
|
-
while (lines.length > 0) {
|
|
494
|
-
let inBlockquote = false;
|
|
495
|
-
const currentLines = [];
|
|
496
|
-
let i;
|
|
497
|
-
for (i = 0; i < lines.length; i++) {
|
|
498
|
-
if (this.rules.other.blockquoteStart.test(lines[i])) {
|
|
499
|
-
currentLines.push(lines[i]);
|
|
500
|
-
inBlockquote = true;
|
|
501
|
-
} else if (!inBlockquote) {
|
|
502
|
-
currentLines.push(lines[i]);
|
|
503
|
-
} else {
|
|
504
|
-
break;
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
lines = lines.slice(i);
|
|
508
|
-
const currentRaw = currentLines.join("\n");
|
|
509
|
-
const currentText = currentRaw.replace(this.rules.other.blockquoteSetextReplace, "\n $1").replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
510
|
-
raw = raw ? `${raw}
|
|
511
|
-
${currentRaw}` : currentRaw;
|
|
512
|
-
text = text ? `${text}
|
|
513
|
-
${currentText}` : currentText;
|
|
514
|
-
const top = this.lexer.state.top;
|
|
515
|
-
this.lexer.state.top = true;
|
|
516
|
-
this.lexer.blockTokens(currentText, tokens, true);
|
|
517
|
-
this.lexer.state.top = top;
|
|
518
|
-
if (lines.length === 0) {
|
|
519
|
-
break;
|
|
520
|
-
}
|
|
521
|
-
const lastToken = tokens.at(-1);
|
|
522
|
-
if (lastToken?.type === "code") {
|
|
523
|
-
break;
|
|
524
|
-
} else if (lastToken?.type === "blockquote") {
|
|
525
|
-
const oldToken = lastToken;
|
|
526
|
-
const newText = oldToken.raw + "\n" + lines.join("\n");
|
|
527
|
-
const newToken = this.blockquote(newText);
|
|
528
|
-
tokens[tokens.length - 1] = newToken;
|
|
529
|
-
raw = raw.substring(0, raw.length - oldToken.raw.length) + newToken.raw;
|
|
530
|
-
text = text.substring(0, text.length - oldToken.text.length) + newToken.text;
|
|
531
|
-
break;
|
|
532
|
-
} else if (lastToken?.type === "list") {
|
|
533
|
-
const oldToken = lastToken;
|
|
534
|
-
const newText = oldToken.raw + "\n" + lines.join("\n");
|
|
535
|
-
const newToken = this.list(newText);
|
|
536
|
-
tokens[tokens.length - 1] = newToken;
|
|
537
|
-
raw = raw.substring(0, raw.length - lastToken.raw.length) + newToken.raw;
|
|
538
|
-
text = text.substring(0, text.length - oldToken.raw.length) + newToken.raw;
|
|
539
|
-
lines = newText.substring(tokens.at(-1).raw.length).split("\n");
|
|
540
|
-
continue;
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
return {
|
|
544
|
-
type: "blockquote",
|
|
545
|
-
raw,
|
|
546
|
-
tokens,
|
|
547
|
-
text
|
|
548
|
-
};
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
list(src) {
|
|
552
|
-
let cap = this.rules.block.list.exec(src);
|
|
553
|
-
if (cap) {
|
|
554
|
-
let bull = cap[1].trim();
|
|
555
|
-
const isordered = bull.length > 1;
|
|
556
|
-
const list2 = {
|
|
557
|
-
type: "list",
|
|
558
|
-
raw: "",
|
|
559
|
-
ordered: isordered,
|
|
560
|
-
start: isordered ? +bull.slice(0, -1) : "",
|
|
561
|
-
loose: false,
|
|
562
|
-
items: []
|
|
563
|
-
};
|
|
564
|
-
bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
|
|
565
|
-
if (this.options.pedantic) {
|
|
566
|
-
bull = isordered ? bull : "[*+-]";
|
|
567
|
-
}
|
|
568
|
-
const itemRegex = this.rules.other.listItemRegex(bull);
|
|
569
|
-
let endsWithBlankLine = false;
|
|
570
|
-
while (src) {
|
|
571
|
-
let endEarly = false;
|
|
572
|
-
let raw = "";
|
|
573
|
-
let itemContents = "";
|
|
574
|
-
if (!(cap = itemRegex.exec(src))) {
|
|
575
|
-
break;
|
|
576
|
-
}
|
|
577
|
-
if (this.rules.block.hr.test(src)) {
|
|
578
|
-
break;
|
|
579
|
-
}
|
|
580
|
-
raw = cap[0];
|
|
581
|
-
src = src.substring(raw.length);
|
|
582
|
-
let line = cap[2].split("\n", 1)[0].replace(this.rules.other.listReplaceTabs, (t) => " ".repeat(3 * t.length));
|
|
583
|
-
let nextLine = src.split("\n", 1)[0];
|
|
584
|
-
let blankLine = !line.trim();
|
|
585
|
-
let indent = 0;
|
|
586
|
-
if (this.options.pedantic) {
|
|
587
|
-
indent = 2;
|
|
588
|
-
itemContents = line.trimStart();
|
|
589
|
-
} else if (blankLine) {
|
|
590
|
-
indent = cap[1].length + 1;
|
|
591
|
-
} else {
|
|
592
|
-
indent = cap[2].search(this.rules.other.nonSpaceChar);
|
|
593
|
-
indent = indent > 4 ? 1 : indent;
|
|
594
|
-
itemContents = line.slice(indent);
|
|
595
|
-
indent += cap[1].length;
|
|
596
|
-
}
|
|
597
|
-
if (blankLine && this.rules.other.blankLine.test(nextLine)) {
|
|
598
|
-
raw += nextLine + "\n";
|
|
599
|
-
src = src.substring(nextLine.length + 1);
|
|
600
|
-
endEarly = true;
|
|
601
|
-
}
|
|
602
|
-
if (!endEarly) {
|
|
603
|
-
const nextBulletRegex = this.rules.other.nextBulletRegex(indent);
|
|
604
|
-
const hrRegex = this.rules.other.hrRegex(indent);
|
|
605
|
-
const fencesBeginRegex = this.rules.other.fencesBeginRegex(indent);
|
|
606
|
-
const headingBeginRegex = this.rules.other.headingBeginRegex(indent);
|
|
607
|
-
const htmlBeginRegex = this.rules.other.htmlBeginRegex(indent);
|
|
608
|
-
while (src) {
|
|
609
|
-
const rawLine = src.split("\n", 1)[0];
|
|
610
|
-
let nextLineWithoutTabs;
|
|
611
|
-
nextLine = rawLine;
|
|
612
|
-
if (this.options.pedantic) {
|
|
613
|
-
nextLine = nextLine.replace(this.rules.other.listReplaceNesting, " ");
|
|
614
|
-
nextLineWithoutTabs = nextLine;
|
|
615
|
-
} else {
|
|
616
|
-
nextLineWithoutTabs = nextLine.replace(this.rules.other.tabCharGlobal, " ");
|
|
617
|
-
}
|
|
618
|
-
if (fencesBeginRegex.test(nextLine)) {
|
|
619
|
-
break;
|
|
620
|
-
}
|
|
621
|
-
if (headingBeginRegex.test(nextLine)) {
|
|
622
|
-
break;
|
|
623
|
-
}
|
|
624
|
-
if (htmlBeginRegex.test(nextLine)) {
|
|
625
|
-
break;
|
|
626
|
-
}
|
|
627
|
-
if (nextBulletRegex.test(nextLine)) {
|
|
628
|
-
break;
|
|
629
|
-
}
|
|
630
|
-
if (hrRegex.test(nextLine)) {
|
|
631
|
-
break;
|
|
632
|
-
}
|
|
633
|
-
if (nextLineWithoutTabs.search(this.rules.other.nonSpaceChar) >= indent || !nextLine.trim()) {
|
|
634
|
-
itemContents += "\n" + nextLineWithoutTabs.slice(indent);
|
|
635
|
-
} else {
|
|
636
|
-
if (blankLine) {
|
|
637
|
-
break;
|
|
638
|
-
}
|
|
639
|
-
if (line.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4) {
|
|
640
|
-
break;
|
|
641
|
-
}
|
|
642
|
-
if (fencesBeginRegex.test(line)) {
|
|
643
|
-
break;
|
|
644
|
-
}
|
|
645
|
-
if (headingBeginRegex.test(line)) {
|
|
646
|
-
break;
|
|
647
|
-
}
|
|
648
|
-
if (hrRegex.test(line)) {
|
|
649
|
-
break;
|
|
650
|
-
}
|
|
651
|
-
itemContents += "\n" + nextLine;
|
|
652
|
-
}
|
|
653
|
-
if (!blankLine && !nextLine.trim()) {
|
|
654
|
-
blankLine = true;
|
|
655
|
-
}
|
|
656
|
-
raw += rawLine + "\n";
|
|
657
|
-
src = src.substring(rawLine.length + 1);
|
|
658
|
-
line = nextLineWithoutTabs.slice(indent);
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
if (!list2.loose) {
|
|
662
|
-
if (endsWithBlankLine) {
|
|
663
|
-
list2.loose = true;
|
|
664
|
-
} else if (this.rules.other.doubleBlankLine.test(raw)) {
|
|
665
|
-
endsWithBlankLine = true;
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
let istask = null;
|
|
669
|
-
let ischecked;
|
|
670
|
-
if (this.options.gfm) {
|
|
671
|
-
istask = this.rules.other.listIsTask.exec(itemContents);
|
|
672
|
-
if (istask) {
|
|
673
|
-
ischecked = istask[0] !== "[ ] ";
|
|
674
|
-
itemContents = itemContents.replace(this.rules.other.listReplaceTask, "");
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
list2.items.push({
|
|
678
|
-
type: "list_item",
|
|
679
|
-
raw,
|
|
680
|
-
task: !!istask,
|
|
681
|
-
checked: ischecked,
|
|
682
|
-
loose: false,
|
|
683
|
-
text: itemContents,
|
|
684
|
-
tokens: []
|
|
685
|
-
});
|
|
686
|
-
list2.raw += raw;
|
|
687
|
-
}
|
|
688
|
-
const lastItem = list2.items.at(-1);
|
|
689
|
-
if (lastItem) {
|
|
690
|
-
lastItem.raw = lastItem.raw.trimEnd();
|
|
691
|
-
lastItem.text = lastItem.text.trimEnd();
|
|
692
|
-
} else {
|
|
693
|
-
return;
|
|
694
|
-
}
|
|
695
|
-
list2.raw = list2.raw.trimEnd();
|
|
696
|
-
for (let i = 0; i < list2.items.length; i++) {
|
|
697
|
-
this.lexer.state.top = false;
|
|
698
|
-
list2.items[i].tokens = this.lexer.blockTokens(list2.items[i].text, []);
|
|
699
|
-
if (!list2.loose) {
|
|
700
|
-
const spacers = list2.items[i].tokens.filter((t) => t.type === "space");
|
|
701
|
-
const hasMultipleLineBreaks = spacers.length > 0 && spacers.some((t) => this.rules.other.anyLine.test(t.raw));
|
|
702
|
-
list2.loose = hasMultipleLineBreaks;
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
if (list2.loose) {
|
|
706
|
-
for (let i = 0; i < list2.items.length; i++) {
|
|
707
|
-
list2.items[i].loose = true;
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
return list2;
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
html(src) {
|
|
714
|
-
const cap = this.rules.block.html.exec(src);
|
|
715
|
-
if (cap) {
|
|
716
|
-
const token = {
|
|
717
|
-
type: "html",
|
|
718
|
-
block: true,
|
|
719
|
-
raw: cap[0],
|
|
720
|
-
pre: cap[1] === "pre" || cap[1] === "script" || cap[1] === "style",
|
|
721
|
-
text: cap[0]
|
|
722
|
-
};
|
|
723
|
-
return token;
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
def(src) {
|
|
727
|
-
const cap = this.rules.block.def.exec(src);
|
|
728
|
-
if (cap) {
|
|
729
|
-
const tag2 = cap[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " ");
|
|
730
|
-
const href = cap[2] ? cap[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "";
|
|
731
|
-
const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : cap[3];
|
|
732
|
-
return {
|
|
733
|
-
type: "def",
|
|
734
|
-
tag: tag2,
|
|
735
|
-
raw: cap[0],
|
|
736
|
-
href,
|
|
737
|
-
title
|
|
738
|
-
};
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
table(src) {
|
|
742
|
-
const cap = this.rules.block.table.exec(src);
|
|
743
|
-
if (!cap) {
|
|
744
|
-
return;
|
|
745
|
-
}
|
|
746
|
-
if (!this.rules.other.tableDelimiter.test(cap[2])) {
|
|
747
|
-
return;
|
|
748
|
-
}
|
|
749
|
-
const headers = splitCells(cap[1]);
|
|
750
|
-
const aligns = cap[2].replace(this.rules.other.tableAlignChars, "").split("|");
|
|
751
|
-
const rows = cap[3]?.trim() ? cap[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [];
|
|
752
|
-
const item = {
|
|
753
|
-
type: "table",
|
|
754
|
-
raw: cap[0],
|
|
755
|
-
header: [],
|
|
756
|
-
align: [],
|
|
757
|
-
rows: []
|
|
758
|
-
};
|
|
759
|
-
if (headers.length !== aligns.length) {
|
|
760
|
-
return;
|
|
761
|
-
}
|
|
762
|
-
for (const align of aligns) {
|
|
763
|
-
if (this.rules.other.tableAlignRight.test(align)) {
|
|
764
|
-
item.align.push("right");
|
|
765
|
-
} else if (this.rules.other.tableAlignCenter.test(align)) {
|
|
766
|
-
item.align.push("center");
|
|
767
|
-
} else if (this.rules.other.tableAlignLeft.test(align)) {
|
|
768
|
-
item.align.push("left");
|
|
769
|
-
} else {
|
|
770
|
-
item.align.push(null);
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
for (let i = 0; i < headers.length; i++) {
|
|
774
|
-
item.header.push({
|
|
775
|
-
text: headers[i],
|
|
776
|
-
tokens: this.lexer.inline(headers[i]),
|
|
777
|
-
header: true,
|
|
778
|
-
align: item.align[i]
|
|
779
|
-
});
|
|
780
|
-
}
|
|
781
|
-
for (const row of rows) {
|
|
782
|
-
item.rows.push(splitCells(row, item.header.length).map((cell, i) => {
|
|
783
|
-
return {
|
|
784
|
-
text: cell,
|
|
785
|
-
tokens: this.lexer.inline(cell),
|
|
786
|
-
header: false,
|
|
787
|
-
align: item.align[i]
|
|
788
|
-
};
|
|
789
|
-
}));
|
|
790
|
-
}
|
|
791
|
-
return item;
|
|
792
|
-
}
|
|
793
|
-
lheading(src) {
|
|
794
|
-
const cap = this.rules.block.lheading.exec(src);
|
|
795
|
-
if (cap) {
|
|
796
|
-
return {
|
|
797
|
-
type: "heading",
|
|
798
|
-
raw: cap[0],
|
|
799
|
-
depth: cap[2].charAt(0) === "=" ? 1 : 2,
|
|
800
|
-
text: cap[1],
|
|
801
|
-
tokens: this.lexer.inline(cap[1])
|
|
802
|
-
};
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
paragraph(src) {
|
|
806
|
-
const cap = this.rules.block.paragraph.exec(src);
|
|
807
|
-
if (cap) {
|
|
808
|
-
const text = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1];
|
|
809
|
-
return {
|
|
810
|
-
type: "paragraph",
|
|
811
|
-
raw: cap[0],
|
|
812
|
-
text,
|
|
813
|
-
tokens: this.lexer.inline(text)
|
|
814
|
-
};
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
text(src) {
|
|
818
|
-
const cap = this.rules.block.text.exec(src);
|
|
819
|
-
if (cap) {
|
|
820
|
-
return {
|
|
821
|
-
type: "text",
|
|
822
|
-
raw: cap[0],
|
|
823
|
-
text: cap[0],
|
|
824
|
-
tokens: this.lexer.inline(cap[0])
|
|
825
|
-
};
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
escape(src) {
|
|
829
|
-
const cap = this.rules.inline.escape.exec(src);
|
|
830
|
-
if (cap) {
|
|
831
|
-
return {
|
|
832
|
-
type: "escape",
|
|
833
|
-
raw: cap[0],
|
|
834
|
-
text: cap[1]
|
|
835
|
-
};
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
tag(src) {
|
|
839
|
-
const cap = this.rules.inline.tag.exec(src);
|
|
840
|
-
if (cap) {
|
|
841
|
-
if (!this.lexer.state.inLink && this.rules.other.startATag.test(cap[0])) {
|
|
842
|
-
this.lexer.state.inLink = true;
|
|
843
|
-
} else if (this.lexer.state.inLink && this.rules.other.endATag.test(cap[0])) {
|
|
844
|
-
this.lexer.state.inLink = false;
|
|
845
|
-
}
|
|
846
|
-
if (!this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(cap[0])) {
|
|
847
|
-
this.lexer.state.inRawBlock = true;
|
|
848
|
-
} else if (this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(cap[0])) {
|
|
849
|
-
this.lexer.state.inRawBlock = false;
|
|
850
|
-
}
|
|
851
|
-
return {
|
|
852
|
-
type: "html",
|
|
853
|
-
raw: cap[0],
|
|
854
|
-
inLink: this.lexer.state.inLink,
|
|
855
|
-
inRawBlock: this.lexer.state.inRawBlock,
|
|
856
|
-
block: false,
|
|
857
|
-
text: cap[0]
|
|
858
|
-
};
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
link(src) {
|
|
862
|
-
const cap = this.rules.inline.link.exec(src);
|
|
863
|
-
if (cap) {
|
|
864
|
-
const trimmedUrl = cap[2].trim();
|
|
865
|
-
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(trimmedUrl)) {
|
|
866
|
-
if (!this.rules.other.endAngleBracket.test(trimmedUrl)) {
|
|
867
|
-
return;
|
|
868
|
-
}
|
|
869
|
-
const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
|
|
870
|
-
if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
|
|
871
|
-
return;
|
|
872
|
-
}
|
|
873
|
-
} else {
|
|
874
|
-
const lastParenIndex = findClosingBracket(cap[2], "()");
|
|
875
|
-
if (lastParenIndex === -2) {
|
|
876
|
-
return;
|
|
877
|
-
}
|
|
878
|
-
if (lastParenIndex > -1) {
|
|
879
|
-
const start = cap[0].indexOf("!") === 0 ? 5 : 4;
|
|
880
|
-
const linkLen = start + cap[1].length + lastParenIndex;
|
|
881
|
-
cap[2] = cap[2].substring(0, lastParenIndex);
|
|
882
|
-
cap[0] = cap[0].substring(0, linkLen).trim();
|
|
883
|
-
cap[3] = "";
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
let href = cap[2];
|
|
887
|
-
let title = "";
|
|
888
|
-
if (this.options.pedantic) {
|
|
889
|
-
const link2 = this.rules.other.pedanticHrefTitle.exec(href);
|
|
890
|
-
if (link2) {
|
|
891
|
-
href = link2[1];
|
|
892
|
-
title = link2[3];
|
|
893
|
-
}
|
|
894
|
-
} else {
|
|
895
|
-
title = cap[3] ? cap[3].slice(1, -1) : "";
|
|
896
|
-
}
|
|
897
|
-
href = href.trim();
|
|
898
|
-
if (this.rules.other.startAngleBracket.test(href)) {
|
|
899
|
-
if (this.options.pedantic && !this.rules.other.endAngleBracket.test(trimmedUrl)) {
|
|
900
|
-
href = href.slice(1);
|
|
901
|
-
} else {
|
|
902
|
-
href = href.slice(1, -1);
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
return outputLink(cap, {
|
|
906
|
-
href: href ? href.replace(this.rules.inline.anyPunctuation, "$1") : href,
|
|
907
|
-
title: title ? title.replace(this.rules.inline.anyPunctuation, "$1") : title
|
|
908
|
-
}, cap[0], this.lexer, this.rules);
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
reflink(src, links) {
|
|
912
|
-
let cap;
|
|
913
|
-
if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
|
|
914
|
-
const linkString = (cap[2] || cap[1]).replace(this.rules.other.multipleSpaceGlobal, " ");
|
|
915
|
-
const link2 = links[linkString.toLowerCase()];
|
|
916
|
-
if (!link2) {
|
|
917
|
-
const text = cap[0].charAt(0);
|
|
918
|
-
return {
|
|
919
|
-
type: "text",
|
|
920
|
-
raw: text,
|
|
921
|
-
text
|
|
922
|
-
};
|
|
923
|
-
}
|
|
924
|
-
return outputLink(cap, link2, cap[0], this.lexer, this.rules);
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
emStrong(src, maskedSrc, prevChar = "") {
|
|
928
|
-
let match = this.rules.inline.emStrongLDelim.exec(src);
|
|
929
|
-
if (!match) return;
|
|
930
|
-
if (match[3] && prevChar.match(this.rules.other.unicodeAlphaNumeric)) return;
|
|
931
|
-
const nextChar = match[1] || match[2] || "";
|
|
932
|
-
if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
|
|
933
|
-
const lLength = [...match[0]].length - 1;
|
|
934
|
-
let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
|
|
935
|
-
const endReg = match[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
936
|
-
endReg.lastIndex = 0;
|
|
937
|
-
maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
|
|
938
|
-
while ((match = endReg.exec(maskedSrc)) != null) {
|
|
939
|
-
rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
|
|
940
|
-
if (!rDelim) continue;
|
|
941
|
-
rLength = [...rDelim].length;
|
|
942
|
-
if (match[3] || match[4]) {
|
|
943
|
-
delimTotal += rLength;
|
|
944
|
-
continue;
|
|
945
|
-
} else if (match[5] || match[6]) {
|
|
946
|
-
if (lLength % 3 && !((lLength + rLength) % 3)) {
|
|
947
|
-
midDelimTotal += rLength;
|
|
948
|
-
continue;
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
delimTotal -= rLength;
|
|
952
|
-
if (delimTotal > 0) continue;
|
|
953
|
-
rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
|
|
954
|
-
const lastCharLength = [...match[0]][0].length;
|
|
955
|
-
const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
|
|
956
|
-
if (Math.min(lLength, rLength) % 2) {
|
|
957
|
-
const text2 = raw.slice(1, -1);
|
|
958
|
-
return {
|
|
959
|
-
type: "em",
|
|
960
|
-
raw,
|
|
961
|
-
text: text2,
|
|
962
|
-
tokens: this.lexer.inlineTokens(text2)
|
|
963
|
-
};
|
|
964
|
-
}
|
|
965
|
-
const text = raw.slice(2, -2);
|
|
966
|
-
return {
|
|
967
|
-
type: "strong",
|
|
968
|
-
raw,
|
|
969
|
-
text,
|
|
970
|
-
tokens: this.lexer.inlineTokens(text)
|
|
971
|
-
};
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
codespan(src) {
|
|
976
|
-
const cap = this.rules.inline.code.exec(src);
|
|
977
|
-
if (cap) {
|
|
978
|
-
let text = cap[2].replace(this.rules.other.newLineCharGlobal, " ");
|
|
979
|
-
const hasNonSpaceChars = this.rules.other.nonSpaceChar.test(text);
|
|
980
|
-
const hasSpaceCharsOnBothEnds = this.rules.other.startingSpaceChar.test(text) && this.rules.other.endingSpaceChar.test(text);
|
|
981
|
-
if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
|
|
982
|
-
text = text.substring(1, text.length - 1);
|
|
983
|
-
}
|
|
984
|
-
return {
|
|
985
|
-
type: "codespan",
|
|
986
|
-
raw: cap[0],
|
|
987
|
-
text
|
|
988
|
-
};
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
br(src) {
|
|
992
|
-
const cap = this.rules.inline.br.exec(src);
|
|
993
|
-
if (cap) {
|
|
994
|
-
return {
|
|
995
|
-
type: "br",
|
|
996
|
-
raw: cap[0]
|
|
997
|
-
};
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
del(src) {
|
|
1001
|
-
const cap = this.rules.inline.del.exec(src);
|
|
1002
|
-
if (cap) {
|
|
1003
|
-
return {
|
|
1004
|
-
type: "del",
|
|
1005
|
-
raw: cap[0],
|
|
1006
|
-
text: cap[2],
|
|
1007
|
-
tokens: this.lexer.inlineTokens(cap[2])
|
|
1008
|
-
};
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
autolink(src) {
|
|
1012
|
-
const cap = this.rules.inline.autolink.exec(src);
|
|
1013
|
-
if (cap) {
|
|
1014
|
-
let text, href;
|
|
1015
|
-
if (cap[2] === "@") {
|
|
1016
|
-
text = cap[1];
|
|
1017
|
-
href = "mailto:" + text;
|
|
1018
|
-
} else {
|
|
1019
|
-
text = cap[1];
|
|
1020
|
-
href = text;
|
|
1021
|
-
}
|
|
1022
|
-
return {
|
|
1023
|
-
type: "link",
|
|
1024
|
-
raw: cap[0],
|
|
1025
|
-
text,
|
|
1026
|
-
href,
|
|
1027
|
-
tokens: [
|
|
1028
|
-
{
|
|
1029
|
-
type: "text",
|
|
1030
|
-
raw: text,
|
|
1031
|
-
text
|
|
1032
|
-
}
|
|
1033
|
-
]
|
|
1034
|
-
};
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
url(src) {
|
|
1038
|
-
let cap;
|
|
1039
|
-
if (cap = this.rules.inline.url.exec(src)) {
|
|
1040
|
-
let text, href;
|
|
1041
|
-
if (cap[2] === "@") {
|
|
1042
|
-
text = cap[0];
|
|
1043
|
-
href = "mailto:" + text;
|
|
1044
|
-
} else {
|
|
1045
|
-
let prevCapZero;
|
|
1046
|
-
do {
|
|
1047
|
-
prevCapZero = cap[0];
|
|
1048
|
-
cap[0] = this.rules.inline._backpedal.exec(cap[0])?.[0] ?? "";
|
|
1049
|
-
} while (prevCapZero !== cap[0]);
|
|
1050
|
-
text = cap[0];
|
|
1051
|
-
if (cap[1] === "www.") {
|
|
1052
|
-
href = "http://" + cap[0];
|
|
1053
|
-
} else {
|
|
1054
|
-
href = cap[0];
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
return {
|
|
1058
|
-
type: "link",
|
|
1059
|
-
raw: cap[0],
|
|
1060
|
-
text,
|
|
1061
|
-
href,
|
|
1062
|
-
tokens: [
|
|
1063
|
-
{
|
|
1064
|
-
type: "text",
|
|
1065
|
-
raw: text,
|
|
1066
|
-
text
|
|
1067
|
-
}
|
|
1068
|
-
]
|
|
1069
|
-
};
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
inlineText(src) {
|
|
1073
|
-
const cap = this.rules.inline.text.exec(src);
|
|
1074
|
-
if (cap) {
|
|
1075
|
-
const escaped = this.lexer.state.inRawBlock;
|
|
1076
|
-
return {
|
|
1077
|
-
type: "text",
|
|
1078
|
-
raw: cap[0],
|
|
1079
|
-
text: cap[0],
|
|
1080
|
-
escaped
|
|
1081
|
-
};
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
};
|
|
1085
|
-
|
|
1086
|
-
// src/Lexer.ts
|
|
1087
|
-
var _Lexer = class __Lexer {
|
|
1088
|
-
tokens;
|
|
1089
|
-
options;
|
|
1090
|
-
state;
|
|
1091
|
-
tokenizer;
|
|
1092
|
-
inlineQueue;
|
|
1093
|
-
constructor(options2) {
|
|
1094
|
-
this.tokens = [];
|
|
1095
|
-
this.tokens.links = /* @__PURE__ */ Object.create(null);
|
|
1096
|
-
this.options = options2 || _defaults;
|
|
1097
|
-
this.options.tokenizer = this.options.tokenizer || new _Tokenizer();
|
|
1098
|
-
this.tokenizer = this.options.tokenizer;
|
|
1099
|
-
this.tokenizer.options = this.options;
|
|
1100
|
-
this.tokenizer.lexer = this;
|
|
1101
|
-
this.inlineQueue = [];
|
|
1102
|
-
this.state = {
|
|
1103
|
-
inLink: false,
|
|
1104
|
-
inRawBlock: false,
|
|
1105
|
-
top: true
|
|
1106
|
-
};
|
|
1107
|
-
const rules = {
|
|
1108
|
-
other,
|
|
1109
|
-
block: block$1.normal,
|
|
1110
|
-
inline: inline.normal
|
|
1111
|
-
};
|
|
1112
|
-
if (this.options.pedantic) {
|
|
1113
|
-
rules.block = block$1.pedantic;
|
|
1114
|
-
rules.inline = inline.pedantic;
|
|
1115
|
-
} else if (this.options.gfm) {
|
|
1116
|
-
rules.block = block$1.gfm;
|
|
1117
|
-
if (this.options.breaks) {
|
|
1118
|
-
rules.inline = inline.breaks;
|
|
1119
|
-
} else {
|
|
1120
|
-
rules.inline = inline.gfm;
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
this.tokenizer.rules = rules;
|
|
1124
|
-
}
|
|
1125
|
-
/**
|
|
1126
|
-
* Expose Rules
|
|
1127
|
-
*/
|
|
1128
|
-
static get rules() {
|
|
1129
|
-
return {
|
|
1130
|
-
block: block$1,
|
|
1131
|
-
inline
|
|
1132
|
-
};
|
|
1133
|
-
}
|
|
1134
|
-
/**
|
|
1135
|
-
* Static Lex Method
|
|
1136
|
-
*/
|
|
1137
|
-
static lex(src, options2) {
|
|
1138
|
-
const lexer2 = new __Lexer(options2);
|
|
1139
|
-
return lexer2.lex(src);
|
|
1140
|
-
}
|
|
1141
|
-
/**
|
|
1142
|
-
* Static Lex Inline Method
|
|
1143
|
-
*/
|
|
1144
|
-
static lexInline(src, options2) {
|
|
1145
|
-
const lexer2 = new __Lexer(options2);
|
|
1146
|
-
return lexer2.inlineTokens(src);
|
|
1147
|
-
}
|
|
1148
|
-
/**
|
|
1149
|
-
* Preprocessing
|
|
1150
|
-
*/
|
|
1151
|
-
lex(src) {
|
|
1152
|
-
src = src.replace(other.carriageReturn, "\n");
|
|
1153
|
-
this.blockTokens(src, this.tokens);
|
|
1154
|
-
for (let i = 0; i < this.inlineQueue.length; i++) {
|
|
1155
|
-
const next = this.inlineQueue[i];
|
|
1156
|
-
this.inlineTokens(next.src, next.tokens);
|
|
1157
|
-
}
|
|
1158
|
-
this.inlineQueue = [];
|
|
1159
|
-
return this.tokens;
|
|
1160
|
-
}
|
|
1161
|
-
blockTokens(src, tokens = [], lastParagraphClipped = false) {
|
|
1162
|
-
if (this.options.pedantic) {
|
|
1163
|
-
src = src.replace(other.tabCharGlobal, " ").replace(other.spaceLine, "");
|
|
1164
|
-
}
|
|
1165
|
-
while (src) {
|
|
1166
|
-
let token;
|
|
1167
|
-
if (this.options.extensions?.block?.some((extTokenizer) => {
|
|
1168
|
-
if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
|
1169
|
-
src = src.substring(token.raw.length);
|
|
1170
|
-
tokens.push(token);
|
|
1171
|
-
return true;
|
|
1172
|
-
}
|
|
1173
|
-
return false;
|
|
1174
|
-
})) {
|
|
1175
|
-
continue;
|
|
1176
|
-
}
|
|
1177
|
-
if (token = this.tokenizer.space(src)) {
|
|
1178
|
-
src = src.substring(token.raw.length);
|
|
1179
|
-
const lastToken = tokens.at(-1);
|
|
1180
|
-
if (token.raw.length === 1 && lastToken !== void 0) {
|
|
1181
|
-
lastToken.raw += "\n";
|
|
1182
|
-
} else {
|
|
1183
|
-
tokens.push(token);
|
|
1184
|
-
}
|
|
1185
|
-
continue;
|
|
1186
|
-
}
|
|
1187
|
-
if (token = this.tokenizer.code(src)) {
|
|
1188
|
-
src = src.substring(token.raw.length);
|
|
1189
|
-
const lastToken = tokens.at(-1);
|
|
1190
|
-
if (lastToken?.type === "paragraph" || lastToken?.type === "text") {
|
|
1191
|
-
lastToken.raw += "\n" + token.raw;
|
|
1192
|
-
lastToken.text += "\n" + token.text;
|
|
1193
|
-
this.inlineQueue.at(-1).src = lastToken.text;
|
|
1194
|
-
} else {
|
|
1195
|
-
tokens.push(token);
|
|
1196
|
-
}
|
|
1197
|
-
continue;
|
|
1198
|
-
}
|
|
1199
|
-
if (token = this.tokenizer.fences(src)) {
|
|
1200
|
-
src = src.substring(token.raw.length);
|
|
1201
|
-
tokens.push(token);
|
|
1202
|
-
continue;
|
|
1203
|
-
}
|
|
1204
|
-
if (token = this.tokenizer.heading(src)) {
|
|
1205
|
-
src = src.substring(token.raw.length);
|
|
1206
|
-
tokens.push(token);
|
|
1207
|
-
continue;
|
|
1208
|
-
}
|
|
1209
|
-
if (token = this.tokenizer.hr(src)) {
|
|
1210
|
-
src = src.substring(token.raw.length);
|
|
1211
|
-
tokens.push(token);
|
|
1212
|
-
continue;
|
|
1213
|
-
}
|
|
1214
|
-
if (token = this.tokenizer.blockquote(src)) {
|
|
1215
|
-
src = src.substring(token.raw.length);
|
|
1216
|
-
tokens.push(token);
|
|
1217
|
-
continue;
|
|
1218
|
-
}
|
|
1219
|
-
if (token = this.tokenizer.list(src)) {
|
|
1220
|
-
src = src.substring(token.raw.length);
|
|
1221
|
-
tokens.push(token);
|
|
1222
|
-
continue;
|
|
1223
|
-
}
|
|
1224
|
-
if (token = this.tokenizer.html(src)) {
|
|
1225
|
-
src = src.substring(token.raw.length);
|
|
1226
|
-
tokens.push(token);
|
|
1227
|
-
continue;
|
|
1228
|
-
}
|
|
1229
|
-
if (token = this.tokenizer.def(src)) {
|
|
1230
|
-
src = src.substring(token.raw.length);
|
|
1231
|
-
const lastToken = tokens.at(-1);
|
|
1232
|
-
if (lastToken?.type === "paragraph" || lastToken?.type === "text") {
|
|
1233
|
-
lastToken.raw += "\n" + token.raw;
|
|
1234
|
-
lastToken.text += "\n" + token.raw;
|
|
1235
|
-
this.inlineQueue.at(-1).src = lastToken.text;
|
|
1236
|
-
} else if (!this.tokens.links[token.tag]) {
|
|
1237
|
-
this.tokens.links[token.tag] = {
|
|
1238
|
-
href: token.href,
|
|
1239
|
-
title: token.title
|
|
1240
|
-
};
|
|
1241
|
-
}
|
|
1242
|
-
continue;
|
|
1243
|
-
}
|
|
1244
|
-
if (token = this.tokenizer.table(src)) {
|
|
1245
|
-
src = src.substring(token.raw.length);
|
|
1246
|
-
tokens.push(token);
|
|
1247
|
-
continue;
|
|
1248
|
-
}
|
|
1249
|
-
if (token = this.tokenizer.lheading(src)) {
|
|
1250
|
-
src = src.substring(token.raw.length);
|
|
1251
|
-
tokens.push(token);
|
|
1252
|
-
continue;
|
|
1253
|
-
}
|
|
1254
|
-
let cutSrc = src;
|
|
1255
|
-
if (this.options.extensions?.startBlock) {
|
|
1256
|
-
let startIndex = Infinity;
|
|
1257
|
-
const tempSrc = src.slice(1);
|
|
1258
|
-
let tempStart;
|
|
1259
|
-
this.options.extensions.startBlock.forEach((getStartIndex) => {
|
|
1260
|
-
tempStart = getStartIndex.call({ lexer: this }, tempSrc);
|
|
1261
|
-
if (typeof tempStart === "number" && tempStart >= 0) {
|
|
1262
|
-
startIndex = Math.min(startIndex, tempStart);
|
|
1263
|
-
}
|
|
1264
|
-
});
|
|
1265
|
-
if (startIndex < Infinity && startIndex >= 0) {
|
|
1266
|
-
cutSrc = src.substring(0, startIndex + 1);
|
|
1267
|
-
}
|
|
1268
|
-
}
|
|
1269
|
-
if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
|
|
1270
|
-
const lastToken = tokens.at(-1);
|
|
1271
|
-
if (lastParagraphClipped && lastToken?.type === "paragraph") {
|
|
1272
|
-
lastToken.raw += "\n" + token.raw;
|
|
1273
|
-
lastToken.text += "\n" + token.text;
|
|
1274
|
-
this.inlineQueue.pop();
|
|
1275
|
-
this.inlineQueue.at(-1).src = lastToken.text;
|
|
1276
|
-
} else {
|
|
1277
|
-
tokens.push(token);
|
|
1278
|
-
}
|
|
1279
|
-
lastParagraphClipped = cutSrc.length !== src.length;
|
|
1280
|
-
src = src.substring(token.raw.length);
|
|
1281
|
-
continue;
|
|
1282
|
-
}
|
|
1283
|
-
if (token = this.tokenizer.text(src)) {
|
|
1284
|
-
src = src.substring(token.raw.length);
|
|
1285
|
-
const lastToken = tokens.at(-1);
|
|
1286
|
-
if (lastToken?.type === "text") {
|
|
1287
|
-
lastToken.raw += "\n" + token.raw;
|
|
1288
|
-
lastToken.text += "\n" + token.text;
|
|
1289
|
-
this.inlineQueue.pop();
|
|
1290
|
-
this.inlineQueue.at(-1).src = lastToken.text;
|
|
1291
|
-
} else {
|
|
1292
|
-
tokens.push(token);
|
|
1293
|
-
}
|
|
1294
|
-
continue;
|
|
1295
|
-
}
|
|
1296
|
-
if (src) {
|
|
1297
|
-
const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
|
|
1298
|
-
if (this.options.silent) {
|
|
1299
|
-
console.error(errMsg);
|
|
1300
|
-
break;
|
|
1301
|
-
} else {
|
|
1302
|
-
throw new Error(errMsg);
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
this.state.top = true;
|
|
1307
|
-
return tokens;
|
|
1308
|
-
}
|
|
1309
|
-
inline(src, tokens = []) {
|
|
1310
|
-
this.inlineQueue.push({ src, tokens });
|
|
1311
|
-
return tokens;
|
|
1312
|
-
}
|
|
1313
|
-
/**
|
|
1314
|
-
* Lexing/Compiling
|
|
1315
|
-
*/
|
|
1316
|
-
inlineTokens(src, tokens = []) {
|
|
1317
|
-
let maskedSrc = src;
|
|
1318
|
-
let match = null;
|
|
1319
|
-
if (this.tokens.links) {
|
|
1320
|
-
const links = Object.keys(this.tokens.links);
|
|
1321
|
-
if (links.length > 0) {
|
|
1322
|
-
while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
|
|
1323
|
-
if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) {
|
|
1324
|
-
maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
|
|
1325
|
-
}
|
|
1326
|
-
}
|
|
1327
|
-
}
|
|
1328
|
-
}
|
|
1329
|
-
while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
|
|
1330
|
-
maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
1331
|
-
}
|
|
1332
|
-
while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
|
|
1333
|
-
maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
1334
|
-
}
|
|
1335
|
-
let keepPrevChar = false;
|
|
1336
|
-
let prevChar = "";
|
|
1337
|
-
while (src) {
|
|
1338
|
-
if (!keepPrevChar) {
|
|
1339
|
-
prevChar = "";
|
|
1340
|
-
}
|
|
1341
|
-
keepPrevChar = false;
|
|
1342
|
-
let token;
|
|
1343
|
-
if (this.options.extensions?.inline?.some((extTokenizer) => {
|
|
1344
|
-
if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
|
1345
|
-
src = src.substring(token.raw.length);
|
|
1346
|
-
tokens.push(token);
|
|
1347
|
-
return true;
|
|
1348
|
-
}
|
|
1349
|
-
return false;
|
|
1350
|
-
})) {
|
|
1351
|
-
continue;
|
|
1352
|
-
}
|
|
1353
|
-
if (token = this.tokenizer.escape(src)) {
|
|
1354
|
-
src = src.substring(token.raw.length);
|
|
1355
|
-
tokens.push(token);
|
|
1356
|
-
continue;
|
|
1357
|
-
}
|
|
1358
|
-
if (token = this.tokenizer.tag(src)) {
|
|
1359
|
-
src = src.substring(token.raw.length);
|
|
1360
|
-
tokens.push(token);
|
|
1361
|
-
continue;
|
|
1362
|
-
}
|
|
1363
|
-
if (token = this.tokenizer.link(src)) {
|
|
1364
|
-
src = src.substring(token.raw.length);
|
|
1365
|
-
tokens.push(token);
|
|
1366
|
-
continue;
|
|
1367
|
-
}
|
|
1368
|
-
if (token = this.tokenizer.reflink(src, this.tokens.links)) {
|
|
1369
|
-
src = src.substring(token.raw.length);
|
|
1370
|
-
const lastToken = tokens.at(-1);
|
|
1371
|
-
if (token.type === "text" && lastToken?.type === "text") {
|
|
1372
|
-
lastToken.raw += token.raw;
|
|
1373
|
-
lastToken.text += token.text;
|
|
1374
|
-
} else {
|
|
1375
|
-
tokens.push(token);
|
|
1376
|
-
}
|
|
1377
|
-
continue;
|
|
1378
|
-
}
|
|
1379
|
-
if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
|
|
1380
|
-
src = src.substring(token.raw.length);
|
|
1381
|
-
tokens.push(token);
|
|
1382
|
-
continue;
|
|
1383
|
-
}
|
|
1384
|
-
if (token = this.tokenizer.codespan(src)) {
|
|
1385
|
-
src = src.substring(token.raw.length);
|
|
1386
|
-
tokens.push(token);
|
|
1387
|
-
continue;
|
|
1388
|
-
}
|
|
1389
|
-
if (token = this.tokenizer.br(src)) {
|
|
1390
|
-
src = src.substring(token.raw.length);
|
|
1391
|
-
tokens.push(token);
|
|
1392
|
-
continue;
|
|
1393
|
-
}
|
|
1394
|
-
if (token = this.tokenizer.del(src)) {
|
|
1395
|
-
src = src.substring(token.raw.length);
|
|
1396
|
-
tokens.push(token);
|
|
1397
|
-
continue;
|
|
1398
|
-
}
|
|
1399
|
-
if (token = this.tokenizer.autolink(src)) {
|
|
1400
|
-
src = src.substring(token.raw.length);
|
|
1401
|
-
tokens.push(token);
|
|
1402
|
-
continue;
|
|
1403
|
-
}
|
|
1404
|
-
if (!this.state.inLink && (token = this.tokenizer.url(src))) {
|
|
1405
|
-
src = src.substring(token.raw.length);
|
|
1406
|
-
tokens.push(token);
|
|
1407
|
-
continue;
|
|
1408
|
-
}
|
|
1409
|
-
let cutSrc = src;
|
|
1410
|
-
if (this.options.extensions?.startInline) {
|
|
1411
|
-
let startIndex = Infinity;
|
|
1412
|
-
const tempSrc = src.slice(1);
|
|
1413
|
-
let tempStart;
|
|
1414
|
-
this.options.extensions.startInline.forEach((getStartIndex) => {
|
|
1415
|
-
tempStart = getStartIndex.call({ lexer: this }, tempSrc);
|
|
1416
|
-
if (typeof tempStart === "number" && tempStart >= 0) {
|
|
1417
|
-
startIndex = Math.min(startIndex, tempStart);
|
|
1418
|
-
}
|
|
1419
|
-
});
|
|
1420
|
-
if (startIndex < Infinity && startIndex >= 0) {
|
|
1421
|
-
cutSrc = src.substring(0, startIndex + 1);
|
|
1422
|
-
}
|
|
1423
|
-
}
|
|
1424
|
-
if (token = this.tokenizer.inlineText(cutSrc)) {
|
|
1425
|
-
src = src.substring(token.raw.length);
|
|
1426
|
-
if (token.raw.slice(-1) !== "_") {
|
|
1427
|
-
prevChar = token.raw.slice(-1);
|
|
1428
|
-
}
|
|
1429
|
-
keepPrevChar = true;
|
|
1430
|
-
const lastToken = tokens.at(-1);
|
|
1431
|
-
if (lastToken?.type === "text") {
|
|
1432
|
-
lastToken.raw += token.raw;
|
|
1433
|
-
lastToken.text += token.text;
|
|
1434
|
-
} else {
|
|
1435
|
-
tokens.push(token);
|
|
1436
|
-
}
|
|
1437
|
-
continue;
|
|
1438
|
-
}
|
|
1439
|
-
if (src) {
|
|
1440
|
-
const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
|
|
1441
|
-
if (this.options.silent) {
|
|
1442
|
-
console.error(errMsg);
|
|
1443
|
-
break;
|
|
1444
|
-
} else {
|
|
1445
|
-
throw new Error(errMsg);
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
}
|
|
1449
|
-
return tokens;
|
|
1450
|
-
}
|
|
1451
|
-
};
|
|
1452
|
-
|
|
1453
|
-
// src/Renderer.ts
|
|
1454
|
-
var _Renderer = class {
|
|
1455
|
-
options;
|
|
1456
|
-
parser;
|
|
1457
|
-
// set by the parser
|
|
1458
|
-
constructor(options2) {
|
|
1459
|
-
this.options = options2 || _defaults;
|
|
1460
|
-
}
|
|
1461
|
-
space(token) {
|
|
1462
|
-
return "";
|
|
1463
|
-
}
|
|
1464
|
-
code({ text, lang, escaped }) {
|
|
1465
|
-
const langString = (lang || "").match(other.notSpaceStart)?.[0];
|
|
1466
|
-
const code = text.replace(other.endingNewline, "") + "\n";
|
|
1467
|
-
if (!langString) {
|
|
1468
|
-
return "<pre><code>" + (escaped ? code : escape2(code, true)) + "</code></pre>\n";
|
|
1469
|
-
}
|
|
1470
|
-
return '<pre><code class="language-' + escape2(langString) + '">' + (escaped ? code : escape2(code, true)) + "</code></pre>\n";
|
|
1471
|
-
}
|
|
1472
|
-
blockquote({ tokens }) {
|
|
1473
|
-
const body = this.parser.parse(tokens);
|
|
1474
|
-
return `<blockquote>
|
|
1475
|
-
${body}</blockquote>
|
|
1476
|
-
`;
|
|
1477
|
-
}
|
|
1478
|
-
html({ text }) {
|
|
1479
|
-
return text;
|
|
1480
|
-
}
|
|
1481
|
-
heading({ tokens, depth }) {
|
|
1482
|
-
return `<h${depth}>${this.parser.parseInline(tokens)}</h${depth}>
|
|
1483
|
-
`;
|
|
1484
|
-
}
|
|
1485
|
-
hr(token) {
|
|
1486
|
-
return "<hr>\n";
|
|
1487
|
-
}
|
|
1488
|
-
list(token) {
|
|
1489
|
-
const ordered = token.ordered;
|
|
1490
|
-
const start = token.start;
|
|
1491
|
-
let body = "";
|
|
1492
|
-
for (let j = 0; j < token.items.length; j++) {
|
|
1493
|
-
const item = token.items[j];
|
|
1494
|
-
body += this.listitem(item);
|
|
1495
|
-
}
|
|
1496
|
-
const type = ordered ? "ol" : "ul";
|
|
1497
|
-
const startAttr = ordered && start !== 1 ? ' start="' + start + '"' : "";
|
|
1498
|
-
return "<" + type + startAttr + ">\n" + body + "</" + type + ">\n";
|
|
1499
|
-
}
|
|
1500
|
-
listitem(item) {
|
|
1501
|
-
let itemBody = "";
|
|
1502
|
-
if (item.task) {
|
|
1503
|
-
const checkbox = this.checkbox({ checked: !!item.checked });
|
|
1504
|
-
if (item.loose) {
|
|
1505
|
-
if (item.tokens[0]?.type === "paragraph") {
|
|
1506
|
-
item.tokens[0].text = checkbox + " " + item.tokens[0].text;
|
|
1507
|
-
if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
|
|
1508
|
-
item.tokens[0].tokens[0].text = checkbox + " " + escape2(item.tokens[0].tokens[0].text);
|
|
1509
|
-
item.tokens[0].tokens[0].escaped = true;
|
|
1510
|
-
}
|
|
1511
|
-
} else {
|
|
1512
|
-
item.tokens.unshift({
|
|
1513
|
-
type: "text",
|
|
1514
|
-
raw: checkbox + " ",
|
|
1515
|
-
text: checkbox + " ",
|
|
1516
|
-
escaped: true
|
|
1517
|
-
});
|
|
1518
|
-
}
|
|
1519
|
-
} else {
|
|
1520
|
-
itemBody += checkbox + " ";
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
itemBody += this.parser.parse(item.tokens, !!item.loose);
|
|
1524
|
-
return `<li>${itemBody}</li>
|
|
1525
|
-
`;
|
|
1526
|
-
}
|
|
1527
|
-
checkbox({ checked }) {
|
|
1528
|
-
return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
|
|
1529
|
-
}
|
|
1530
|
-
paragraph({ tokens }) {
|
|
1531
|
-
return `<p>${this.parser.parseInline(tokens)}</p>
|
|
1532
|
-
`;
|
|
1533
|
-
}
|
|
1534
|
-
table(token) {
|
|
1535
|
-
let header = "";
|
|
1536
|
-
let cell = "";
|
|
1537
|
-
for (let j = 0; j < token.header.length; j++) {
|
|
1538
|
-
cell += this.tablecell(token.header[j]);
|
|
1539
|
-
}
|
|
1540
|
-
header += this.tablerow({ text: cell });
|
|
1541
|
-
let body = "";
|
|
1542
|
-
for (let j = 0; j < token.rows.length; j++) {
|
|
1543
|
-
const row = token.rows[j];
|
|
1544
|
-
cell = "";
|
|
1545
|
-
for (let k = 0; k < row.length; k++) {
|
|
1546
|
-
cell += this.tablecell(row[k]);
|
|
1547
|
-
}
|
|
1548
|
-
body += this.tablerow({ text: cell });
|
|
1549
|
-
}
|
|
1550
|
-
if (body) body = `<tbody>${body}</tbody>`;
|
|
1551
|
-
return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
|
|
1552
|
-
}
|
|
1553
|
-
tablerow({ text }) {
|
|
1554
|
-
return `<tr>
|
|
1555
|
-
${text}</tr>
|
|
1556
|
-
`;
|
|
1557
|
-
}
|
|
1558
|
-
tablecell(token) {
|
|
1559
|
-
const content = this.parser.parseInline(token.tokens);
|
|
1560
|
-
const type = token.header ? "th" : "td";
|
|
1561
|
-
const tag2 = token.align ? `<${type} align="${token.align}">` : `<${type}>`;
|
|
1562
|
-
return tag2 + content + `</${type}>
|
|
1563
|
-
`;
|
|
1564
|
-
}
|
|
1565
|
-
/**
|
|
1566
|
-
* span level renderer
|
|
1567
|
-
*/
|
|
1568
|
-
strong({ tokens }) {
|
|
1569
|
-
return `<strong>${this.parser.parseInline(tokens)}</strong>`;
|
|
1570
|
-
}
|
|
1571
|
-
em({ tokens }) {
|
|
1572
|
-
return `<em>${this.parser.parseInline(tokens)}</em>`;
|
|
1573
|
-
}
|
|
1574
|
-
codespan({ text }) {
|
|
1575
|
-
return `<code>${escape2(text, true)}</code>`;
|
|
1576
|
-
}
|
|
1577
|
-
br(token) {
|
|
1578
|
-
return "<br>";
|
|
1579
|
-
}
|
|
1580
|
-
del({ tokens }) {
|
|
1581
|
-
return `<del>${this.parser.parseInline(tokens)}</del>`;
|
|
1582
|
-
}
|
|
1583
|
-
link({ href, title, tokens }) {
|
|
1584
|
-
const text = this.parser.parseInline(tokens);
|
|
1585
|
-
const cleanHref = cleanUrl(href);
|
|
1586
|
-
if (cleanHref === null) {
|
|
1587
|
-
return text;
|
|
1588
|
-
}
|
|
1589
|
-
href = cleanHref;
|
|
1590
|
-
let out = '<a href="' + href + '"';
|
|
1591
|
-
if (title) {
|
|
1592
|
-
out += ' title="' + escape2(title) + '"';
|
|
1593
|
-
}
|
|
1594
|
-
out += ">" + text + "</a>";
|
|
1595
|
-
return out;
|
|
1596
|
-
}
|
|
1597
|
-
image({ href, title, text, tokens }) {
|
|
1598
|
-
if (tokens) {
|
|
1599
|
-
text = this.parser.parseInline(tokens, this.parser.textRenderer);
|
|
1600
|
-
}
|
|
1601
|
-
const cleanHref = cleanUrl(href);
|
|
1602
|
-
if (cleanHref === null) {
|
|
1603
|
-
return escape2(text);
|
|
1604
|
-
}
|
|
1605
|
-
href = cleanHref;
|
|
1606
|
-
let out = `<img src="${href}" alt="${text}"`;
|
|
1607
|
-
if (title) {
|
|
1608
|
-
out += ` title="${escape2(title)}"`;
|
|
1609
|
-
}
|
|
1610
|
-
out += ">";
|
|
1611
|
-
return out;
|
|
1612
|
-
}
|
|
1613
|
-
text(token) {
|
|
1614
|
-
return "tokens" in token && token.tokens ? this.parser.parseInline(token.tokens) : "escaped" in token && token.escaped ? token.text : escape2(token.text);
|
|
1615
|
-
}
|
|
1616
|
-
};
|
|
1617
|
-
|
|
1618
|
-
// src/TextRenderer.ts
|
|
1619
|
-
var _TextRenderer = class {
|
|
1620
|
-
// no need for block level renderers
|
|
1621
|
-
strong({ text }) {
|
|
1622
|
-
return text;
|
|
1623
|
-
}
|
|
1624
|
-
em({ text }) {
|
|
1625
|
-
return text;
|
|
1626
|
-
}
|
|
1627
|
-
codespan({ text }) {
|
|
1628
|
-
return text;
|
|
1629
|
-
}
|
|
1630
|
-
del({ text }) {
|
|
1631
|
-
return text;
|
|
1632
|
-
}
|
|
1633
|
-
html({ text }) {
|
|
1634
|
-
return text;
|
|
1635
|
-
}
|
|
1636
|
-
text({ text }) {
|
|
1637
|
-
return text;
|
|
1638
|
-
}
|
|
1639
|
-
link({ text }) {
|
|
1640
|
-
return "" + text;
|
|
1641
|
-
}
|
|
1642
|
-
image({ text }) {
|
|
1643
|
-
return "" + text;
|
|
1644
|
-
}
|
|
1645
|
-
br() {
|
|
1646
|
-
return "";
|
|
1647
|
-
}
|
|
1648
|
-
};
|
|
1649
|
-
|
|
1650
|
-
// src/Parser.ts
|
|
1651
|
-
var _Parser = class __Parser {
|
|
1652
|
-
options;
|
|
1653
|
-
renderer;
|
|
1654
|
-
textRenderer;
|
|
1655
|
-
constructor(options2) {
|
|
1656
|
-
this.options = options2 || _defaults;
|
|
1657
|
-
this.options.renderer = this.options.renderer || new _Renderer();
|
|
1658
|
-
this.renderer = this.options.renderer;
|
|
1659
|
-
this.renderer.options = this.options;
|
|
1660
|
-
this.renderer.parser = this;
|
|
1661
|
-
this.textRenderer = new _TextRenderer();
|
|
1662
|
-
}
|
|
1663
|
-
/**
|
|
1664
|
-
* Static Parse Method
|
|
1665
|
-
*/
|
|
1666
|
-
static parse(tokens, options2) {
|
|
1667
|
-
const parser2 = new __Parser(options2);
|
|
1668
|
-
return parser2.parse(tokens);
|
|
1669
|
-
}
|
|
1670
|
-
/**
|
|
1671
|
-
* Static Parse Inline Method
|
|
1672
|
-
*/
|
|
1673
|
-
static parseInline(tokens, options2) {
|
|
1674
|
-
const parser2 = new __Parser(options2);
|
|
1675
|
-
return parser2.parseInline(tokens);
|
|
1676
|
-
}
|
|
1677
|
-
/**
|
|
1678
|
-
* Parse Loop
|
|
1679
|
-
*/
|
|
1680
|
-
parse(tokens, top = true) {
|
|
1681
|
-
let out = "";
|
|
1682
|
-
for (let i = 0; i < tokens.length; i++) {
|
|
1683
|
-
const anyToken = tokens[i];
|
|
1684
|
-
if (this.options.extensions?.renderers?.[anyToken.type]) {
|
|
1685
|
-
const genericToken = anyToken;
|
|
1686
|
-
const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken);
|
|
1687
|
-
if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(genericToken.type)) {
|
|
1688
|
-
out += ret || "";
|
|
1689
|
-
continue;
|
|
1690
|
-
}
|
|
1691
|
-
}
|
|
1692
|
-
const token = anyToken;
|
|
1693
|
-
switch (token.type) {
|
|
1694
|
-
case "space": {
|
|
1695
|
-
out += this.renderer.space(token);
|
|
1696
|
-
continue;
|
|
1697
|
-
}
|
|
1698
|
-
case "hr": {
|
|
1699
|
-
out += this.renderer.hr(token);
|
|
1700
|
-
continue;
|
|
1701
|
-
}
|
|
1702
|
-
case "heading": {
|
|
1703
|
-
out += this.renderer.heading(token);
|
|
1704
|
-
continue;
|
|
1705
|
-
}
|
|
1706
|
-
case "code": {
|
|
1707
|
-
out += this.renderer.code(token);
|
|
1708
|
-
continue;
|
|
1709
|
-
}
|
|
1710
|
-
case "table": {
|
|
1711
|
-
out += this.renderer.table(token);
|
|
1712
|
-
continue;
|
|
1713
|
-
}
|
|
1714
|
-
case "blockquote": {
|
|
1715
|
-
out += this.renderer.blockquote(token);
|
|
1716
|
-
continue;
|
|
1717
|
-
}
|
|
1718
|
-
case "list": {
|
|
1719
|
-
out += this.renderer.list(token);
|
|
1720
|
-
continue;
|
|
1721
|
-
}
|
|
1722
|
-
case "html": {
|
|
1723
|
-
out += this.renderer.html(token);
|
|
1724
|
-
continue;
|
|
1725
|
-
}
|
|
1726
|
-
case "paragraph": {
|
|
1727
|
-
out += this.renderer.paragraph(token);
|
|
1728
|
-
continue;
|
|
1729
|
-
}
|
|
1730
|
-
case "text": {
|
|
1731
|
-
let textToken = token;
|
|
1732
|
-
let body = this.renderer.text(textToken);
|
|
1733
|
-
while (i + 1 < tokens.length && tokens[i + 1].type === "text") {
|
|
1734
|
-
textToken = tokens[++i];
|
|
1735
|
-
body += "\n" + this.renderer.text(textToken);
|
|
1736
|
-
}
|
|
1737
|
-
if (top) {
|
|
1738
|
-
out += this.renderer.paragraph({
|
|
1739
|
-
type: "paragraph",
|
|
1740
|
-
raw: body,
|
|
1741
|
-
text: body,
|
|
1742
|
-
tokens: [{ type: "text", raw: body, text: body, escaped: true }]
|
|
1743
|
-
});
|
|
1744
|
-
} else {
|
|
1745
|
-
out += body;
|
|
1746
|
-
}
|
|
1747
|
-
continue;
|
|
1748
|
-
}
|
|
1749
|
-
default: {
|
|
1750
|
-
const errMsg = 'Token with "' + token.type + '" type was not found.';
|
|
1751
|
-
if (this.options.silent) {
|
|
1752
|
-
console.error(errMsg);
|
|
1753
|
-
return "";
|
|
1754
|
-
} else {
|
|
1755
|
-
throw new Error(errMsg);
|
|
1756
|
-
}
|
|
1757
|
-
}
|
|
1758
|
-
}
|
|
1759
|
-
}
|
|
1760
|
-
return out;
|
|
1761
|
-
}
|
|
1762
|
-
/**
|
|
1763
|
-
* Parse Inline Tokens
|
|
1764
|
-
*/
|
|
1765
|
-
parseInline(tokens, renderer = this.renderer) {
|
|
1766
|
-
let out = "";
|
|
1767
|
-
for (let i = 0; i < tokens.length; i++) {
|
|
1768
|
-
const anyToken = tokens[i];
|
|
1769
|
-
if (this.options.extensions?.renderers?.[anyToken.type]) {
|
|
1770
|
-
const ret = this.options.extensions.renderers[anyToken.type].call({ parser: this }, anyToken);
|
|
1771
|
-
if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(anyToken.type)) {
|
|
1772
|
-
out += ret || "";
|
|
1773
|
-
continue;
|
|
1774
|
-
}
|
|
1775
|
-
}
|
|
1776
|
-
const token = anyToken;
|
|
1777
|
-
switch (token.type) {
|
|
1778
|
-
case "escape": {
|
|
1779
|
-
out += renderer.text(token);
|
|
1780
|
-
break;
|
|
1781
|
-
}
|
|
1782
|
-
case "html": {
|
|
1783
|
-
out += renderer.html(token);
|
|
1784
|
-
break;
|
|
1785
|
-
}
|
|
1786
|
-
case "link": {
|
|
1787
|
-
out += renderer.link(token);
|
|
1788
|
-
break;
|
|
1789
|
-
}
|
|
1790
|
-
case "image": {
|
|
1791
|
-
out += renderer.image(token);
|
|
1792
|
-
break;
|
|
1793
|
-
}
|
|
1794
|
-
case "strong": {
|
|
1795
|
-
out += renderer.strong(token);
|
|
1796
|
-
break;
|
|
1797
|
-
}
|
|
1798
|
-
case "em": {
|
|
1799
|
-
out += renderer.em(token);
|
|
1800
|
-
break;
|
|
1801
|
-
}
|
|
1802
|
-
case "codespan": {
|
|
1803
|
-
out += renderer.codespan(token);
|
|
1804
|
-
break;
|
|
1805
|
-
}
|
|
1806
|
-
case "br": {
|
|
1807
|
-
out += renderer.br(token);
|
|
1808
|
-
break;
|
|
1809
|
-
}
|
|
1810
|
-
case "del": {
|
|
1811
|
-
out += renderer.del(token);
|
|
1812
|
-
break;
|
|
1813
|
-
}
|
|
1814
|
-
case "text": {
|
|
1815
|
-
out += renderer.text(token);
|
|
1816
|
-
break;
|
|
1817
|
-
}
|
|
1818
|
-
default: {
|
|
1819
|
-
const errMsg = 'Token with "' + token.type + '" type was not found.';
|
|
1820
|
-
if (this.options.silent) {
|
|
1821
|
-
console.error(errMsg);
|
|
1822
|
-
return "";
|
|
1823
|
-
} else {
|
|
1824
|
-
throw new Error(errMsg);
|
|
1825
|
-
}
|
|
1826
|
-
}
|
|
1827
|
-
}
|
|
1828
|
-
}
|
|
1829
|
-
return out;
|
|
1830
|
-
}
|
|
1831
|
-
};
|
|
1832
|
-
|
|
1833
|
-
// src/Hooks.ts
|
|
1834
|
-
var _Hooks = class {
|
|
1835
|
-
options;
|
|
1836
|
-
block;
|
|
1837
|
-
constructor(options2) {
|
|
1838
|
-
this.options = options2 || _defaults;
|
|
1839
|
-
}
|
|
1840
|
-
static passThroughHooks = /* @__PURE__ */ new Set([
|
|
1841
|
-
"preprocess",
|
|
1842
|
-
"postprocess",
|
|
1843
|
-
"processAllTokens"
|
|
1844
|
-
]);
|
|
1845
|
-
/**
|
|
1846
|
-
* Process markdown before marked
|
|
1847
|
-
*/
|
|
1848
|
-
preprocess(markdown) {
|
|
1849
|
-
return markdown;
|
|
1850
|
-
}
|
|
1851
|
-
/**
|
|
1852
|
-
* Process HTML after marked is finished
|
|
1853
|
-
*/
|
|
1854
|
-
postprocess(html2) {
|
|
1855
|
-
return html2;
|
|
1856
|
-
}
|
|
1857
|
-
/**
|
|
1858
|
-
* Process all tokens before walk tokens
|
|
1859
|
-
*/
|
|
1860
|
-
processAllTokens(tokens) {
|
|
1861
|
-
return tokens;
|
|
1862
|
-
}
|
|
1863
|
-
/**
|
|
1864
|
-
* Provide function to tokenize markdown
|
|
1865
|
-
*/
|
|
1866
|
-
provideLexer() {
|
|
1867
|
-
return this.block ? _Lexer.lex : _Lexer.lexInline;
|
|
1868
|
-
}
|
|
1869
|
-
/**
|
|
1870
|
-
* Provide function to parse tokens
|
|
1871
|
-
*/
|
|
1872
|
-
provideParser() {
|
|
1873
|
-
return this.block ? _Parser.parse : _Parser.parseInline;
|
|
1874
|
-
}
|
|
1875
|
-
};
|
|
1876
|
-
|
|
1877
|
-
// src/Instance.ts
|
|
1878
|
-
var Marked = class {
|
|
1879
|
-
defaults = _getDefaults();
|
|
1880
|
-
options = this.setOptions;
|
|
1881
|
-
parse = this.parseMarkdown(true);
|
|
1882
|
-
parseInline = this.parseMarkdown(false);
|
|
1883
|
-
Parser = _Parser;
|
|
1884
|
-
Renderer = _Renderer;
|
|
1885
|
-
TextRenderer = _TextRenderer;
|
|
1886
|
-
Lexer = _Lexer;
|
|
1887
|
-
Tokenizer = _Tokenizer;
|
|
1888
|
-
Hooks = _Hooks;
|
|
1889
|
-
constructor(...args) {
|
|
1890
|
-
this.use(...args);
|
|
1891
|
-
}
|
|
1892
|
-
/**
|
|
1893
|
-
* Run callback for every token
|
|
1894
|
-
*/
|
|
1895
|
-
walkTokens(tokens, callback) {
|
|
1896
|
-
let values = [];
|
|
1897
|
-
for (const token of tokens) {
|
|
1898
|
-
values = values.concat(callback.call(this, token));
|
|
1899
|
-
switch (token.type) {
|
|
1900
|
-
case "table": {
|
|
1901
|
-
const tableToken = token;
|
|
1902
|
-
for (const cell of tableToken.header) {
|
|
1903
|
-
values = values.concat(this.walkTokens(cell.tokens, callback));
|
|
1904
|
-
}
|
|
1905
|
-
for (const row of tableToken.rows) {
|
|
1906
|
-
for (const cell of row) {
|
|
1907
|
-
values = values.concat(this.walkTokens(cell.tokens, callback));
|
|
1908
|
-
}
|
|
1909
|
-
}
|
|
1910
|
-
break;
|
|
1911
|
-
}
|
|
1912
|
-
case "list": {
|
|
1913
|
-
const listToken = token;
|
|
1914
|
-
values = values.concat(this.walkTokens(listToken.items, callback));
|
|
1915
|
-
break;
|
|
1916
|
-
}
|
|
1917
|
-
default: {
|
|
1918
|
-
const genericToken = token;
|
|
1919
|
-
if (this.defaults.extensions?.childTokens?.[genericToken.type]) {
|
|
1920
|
-
this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {
|
|
1921
|
-
const tokens2 = genericToken[childTokens].flat(Infinity);
|
|
1922
|
-
values = values.concat(this.walkTokens(tokens2, callback));
|
|
1923
|
-
});
|
|
1924
|
-
} else if (genericToken.tokens) {
|
|
1925
|
-
values = values.concat(this.walkTokens(genericToken.tokens, callback));
|
|
1926
|
-
}
|
|
1927
|
-
}
|
|
1928
|
-
}
|
|
1929
|
-
}
|
|
1930
|
-
return values;
|
|
1931
|
-
}
|
|
1932
|
-
use(...args) {
|
|
1933
|
-
const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
1934
|
-
args.forEach((pack) => {
|
|
1935
|
-
const opts = { ...pack };
|
|
1936
|
-
opts.async = this.defaults.async || opts.async || false;
|
|
1937
|
-
if (pack.extensions) {
|
|
1938
|
-
pack.extensions.forEach((ext) => {
|
|
1939
|
-
if (!ext.name) {
|
|
1940
|
-
throw new Error("extension name required");
|
|
1941
|
-
}
|
|
1942
|
-
if ("renderer" in ext) {
|
|
1943
|
-
const prevRenderer = extensions.renderers[ext.name];
|
|
1944
|
-
if (prevRenderer) {
|
|
1945
|
-
extensions.renderers[ext.name] = function(...args2) {
|
|
1946
|
-
let ret = ext.renderer.apply(this, args2);
|
|
1947
|
-
if (ret === false) {
|
|
1948
|
-
ret = prevRenderer.apply(this, args2);
|
|
1949
|
-
}
|
|
1950
|
-
return ret;
|
|
1951
|
-
};
|
|
1952
|
-
} else {
|
|
1953
|
-
extensions.renderers[ext.name] = ext.renderer;
|
|
1954
|
-
}
|
|
1955
|
-
}
|
|
1956
|
-
if ("tokenizer" in ext) {
|
|
1957
|
-
if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
|
|
1958
|
-
throw new Error("extension level must be 'block' or 'inline'");
|
|
1959
|
-
}
|
|
1960
|
-
const extLevel = extensions[ext.level];
|
|
1961
|
-
if (extLevel) {
|
|
1962
|
-
extLevel.unshift(ext.tokenizer);
|
|
1963
|
-
} else {
|
|
1964
|
-
extensions[ext.level] = [ext.tokenizer];
|
|
1965
|
-
}
|
|
1966
|
-
if (ext.start) {
|
|
1967
|
-
if (ext.level === "block") {
|
|
1968
|
-
if (extensions.startBlock) {
|
|
1969
|
-
extensions.startBlock.push(ext.start);
|
|
1970
|
-
} else {
|
|
1971
|
-
extensions.startBlock = [ext.start];
|
|
1972
|
-
}
|
|
1973
|
-
} else if (ext.level === "inline") {
|
|
1974
|
-
if (extensions.startInline) {
|
|
1975
|
-
extensions.startInline.push(ext.start);
|
|
1976
|
-
} else {
|
|
1977
|
-
extensions.startInline = [ext.start];
|
|
1978
|
-
}
|
|
1979
|
-
}
|
|
1980
|
-
}
|
|
1981
|
-
}
|
|
1982
|
-
if ("childTokens" in ext && ext.childTokens) {
|
|
1983
|
-
extensions.childTokens[ext.name] = ext.childTokens;
|
|
1984
|
-
}
|
|
1985
|
-
});
|
|
1986
|
-
opts.extensions = extensions;
|
|
1987
|
-
}
|
|
1988
|
-
if (pack.renderer) {
|
|
1989
|
-
const renderer = this.defaults.renderer || new _Renderer(this.defaults);
|
|
1990
|
-
for (const prop in pack.renderer) {
|
|
1991
|
-
if (!(prop in renderer)) {
|
|
1992
|
-
throw new Error(`renderer '${prop}' does not exist`);
|
|
1993
|
-
}
|
|
1994
|
-
if (["options", "parser"].includes(prop)) {
|
|
1995
|
-
continue;
|
|
1996
|
-
}
|
|
1997
|
-
const rendererProp = prop;
|
|
1998
|
-
const rendererFunc = pack.renderer[rendererProp];
|
|
1999
|
-
const prevRenderer = renderer[rendererProp];
|
|
2000
|
-
renderer[rendererProp] = (...args2) => {
|
|
2001
|
-
let ret = rendererFunc.apply(renderer, args2);
|
|
2002
|
-
if (ret === false) {
|
|
2003
|
-
ret = prevRenderer.apply(renderer, args2);
|
|
2004
|
-
}
|
|
2005
|
-
return ret || "";
|
|
2006
|
-
};
|
|
2007
|
-
}
|
|
2008
|
-
opts.renderer = renderer;
|
|
2009
|
-
}
|
|
2010
|
-
if (pack.tokenizer) {
|
|
2011
|
-
const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
|
|
2012
|
-
for (const prop in pack.tokenizer) {
|
|
2013
|
-
if (!(prop in tokenizer)) {
|
|
2014
|
-
throw new Error(`tokenizer '${prop}' does not exist`);
|
|
2015
|
-
}
|
|
2016
|
-
if (["options", "rules", "lexer"].includes(prop)) {
|
|
2017
|
-
continue;
|
|
2018
|
-
}
|
|
2019
|
-
const tokenizerProp = prop;
|
|
2020
|
-
const tokenizerFunc = pack.tokenizer[tokenizerProp];
|
|
2021
|
-
const prevTokenizer = tokenizer[tokenizerProp];
|
|
2022
|
-
tokenizer[tokenizerProp] = (...args2) => {
|
|
2023
|
-
let ret = tokenizerFunc.apply(tokenizer, args2);
|
|
2024
|
-
if (ret === false) {
|
|
2025
|
-
ret = prevTokenizer.apply(tokenizer, args2);
|
|
2026
|
-
}
|
|
2027
|
-
return ret;
|
|
2028
|
-
};
|
|
2029
|
-
}
|
|
2030
|
-
opts.tokenizer = tokenizer;
|
|
2031
|
-
}
|
|
2032
|
-
if (pack.hooks) {
|
|
2033
|
-
const hooks = this.defaults.hooks || new _Hooks();
|
|
2034
|
-
for (const prop in pack.hooks) {
|
|
2035
|
-
if (!(prop in hooks)) {
|
|
2036
|
-
throw new Error(`hook '${prop}' does not exist`);
|
|
2037
|
-
}
|
|
2038
|
-
if (["options", "block"].includes(prop)) {
|
|
2039
|
-
continue;
|
|
2040
|
-
}
|
|
2041
|
-
const hooksProp = prop;
|
|
2042
|
-
const hooksFunc = pack.hooks[hooksProp];
|
|
2043
|
-
const prevHook = hooks[hooksProp];
|
|
2044
|
-
if (_Hooks.passThroughHooks.has(prop)) {
|
|
2045
|
-
hooks[hooksProp] = (arg) => {
|
|
2046
|
-
if (this.defaults.async) {
|
|
2047
|
-
return Promise.resolve(hooksFunc.call(hooks, arg)).then((ret2) => {
|
|
2048
|
-
return prevHook.call(hooks, ret2);
|
|
2049
|
-
});
|
|
2050
|
-
}
|
|
2051
|
-
const ret = hooksFunc.call(hooks, arg);
|
|
2052
|
-
return prevHook.call(hooks, ret);
|
|
2053
|
-
};
|
|
2054
|
-
} else {
|
|
2055
|
-
hooks[hooksProp] = (...args2) => {
|
|
2056
|
-
let ret = hooksFunc.apply(hooks, args2);
|
|
2057
|
-
if (ret === false) {
|
|
2058
|
-
ret = prevHook.apply(hooks, args2);
|
|
2059
|
-
}
|
|
2060
|
-
return ret;
|
|
2061
|
-
};
|
|
2062
|
-
}
|
|
2063
|
-
}
|
|
2064
|
-
opts.hooks = hooks;
|
|
2065
|
-
}
|
|
2066
|
-
if (pack.walkTokens) {
|
|
2067
|
-
const walkTokens2 = this.defaults.walkTokens;
|
|
2068
|
-
const packWalktokens = pack.walkTokens;
|
|
2069
|
-
opts.walkTokens = function(token) {
|
|
2070
|
-
let values = [];
|
|
2071
|
-
values.push(packWalktokens.call(this, token));
|
|
2072
|
-
if (walkTokens2) {
|
|
2073
|
-
values = values.concat(walkTokens2.call(this, token));
|
|
2074
|
-
}
|
|
2075
|
-
return values;
|
|
2076
|
-
};
|
|
2077
|
-
}
|
|
2078
|
-
this.defaults = { ...this.defaults, ...opts };
|
|
2079
|
-
});
|
|
2080
|
-
return this;
|
|
2081
|
-
}
|
|
2082
|
-
setOptions(opt) {
|
|
2083
|
-
this.defaults = { ...this.defaults, ...opt };
|
|
2084
|
-
return this;
|
|
2085
|
-
}
|
|
2086
|
-
lexer(src, options2) {
|
|
2087
|
-
return _Lexer.lex(src, options2 ?? this.defaults);
|
|
2088
|
-
}
|
|
2089
|
-
parser(tokens, options2) {
|
|
2090
|
-
return _Parser.parse(tokens, options2 ?? this.defaults);
|
|
2091
|
-
}
|
|
2092
|
-
parseMarkdown(blockType) {
|
|
2093
|
-
const parse2 = (src, options2) => {
|
|
2094
|
-
const origOpt = { ...options2 };
|
|
2095
|
-
const opt = { ...this.defaults, ...origOpt };
|
|
2096
|
-
const throwError = this.onError(!!opt.silent, !!opt.async);
|
|
2097
|
-
if (this.defaults.async === true && origOpt.async === false) {
|
|
2098
|
-
return throwError(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
2099
|
-
}
|
|
2100
|
-
if (typeof src === "undefined" || src === null) {
|
|
2101
|
-
return throwError(new Error("marked(): input parameter is undefined or null"));
|
|
2102
|
-
}
|
|
2103
|
-
if (typeof src !== "string") {
|
|
2104
|
-
return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
|
|
2105
|
-
}
|
|
2106
|
-
if (opt.hooks) {
|
|
2107
|
-
opt.hooks.options = opt;
|
|
2108
|
-
opt.hooks.block = blockType;
|
|
2109
|
-
}
|
|
2110
|
-
const lexer2 = opt.hooks ? opt.hooks.provideLexer() : blockType ? _Lexer.lex : _Lexer.lexInline;
|
|
2111
|
-
const parser2 = opt.hooks ? opt.hooks.provideParser() : blockType ? _Parser.parse : _Parser.parseInline;
|
|
2112
|
-
if (opt.async) {
|
|
2113
|
-
return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser2(tokens, opt)).then((html2) => opt.hooks ? opt.hooks.postprocess(html2) : html2).catch(throwError);
|
|
2114
|
-
}
|
|
2115
|
-
try {
|
|
2116
|
-
if (opt.hooks) {
|
|
2117
|
-
src = opt.hooks.preprocess(src);
|
|
2118
|
-
}
|
|
2119
|
-
let tokens = lexer2(src, opt);
|
|
2120
|
-
if (opt.hooks) {
|
|
2121
|
-
tokens = opt.hooks.processAllTokens(tokens);
|
|
2122
|
-
}
|
|
2123
|
-
if (opt.walkTokens) {
|
|
2124
|
-
this.walkTokens(tokens, opt.walkTokens);
|
|
2125
|
-
}
|
|
2126
|
-
let html2 = parser2(tokens, opt);
|
|
2127
|
-
if (opt.hooks) {
|
|
2128
|
-
html2 = opt.hooks.postprocess(html2);
|
|
2129
|
-
}
|
|
2130
|
-
return html2;
|
|
2131
|
-
} catch (e) {
|
|
2132
|
-
return throwError(e);
|
|
2133
|
-
}
|
|
2134
|
-
};
|
|
2135
|
-
return parse2;
|
|
2136
|
-
}
|
|
2137
|
-
onError(silent, async) {
|
|
2138
|
-
return (e) => {
|
|
2139
|
-
e.message += "\nPlease report this to https://github.com/markedjs/marked.";
|
|
2140
|
-
if (silent) {
|
|
2141
|
-
const msg = "<p>An error occurred:</p><pre>" + escape2(e.message + "", true) + "</pre>";
|
|
2142
|
-
if (async) {
|
|
2143
|
-
return Promise.resolve(msg);
|
|
2144
|
-
}
|
|
2145
|
-
return msg;
|
|
2146
|
-
}
|
|
2147
|
-
if (async) {
|
|
2148
|
-
return Promise.reject(e);
|
|
2149
|
-
}
|
|
2150
|
-
throw e;
|
|
2151
|
-
};
|
|
2152
|
-
}
|
|
2153
|
-
};
|
|
2154
|
-
|
|
2155
|
-
// src/marked.ts
|
|
2156
|
-
var markedInstance = new Marked();
|
|
2157
|
-
function marked(src, opt) {
|
|
2158
|
-
return markedInstance.parse(src, opt);
|
|
2159
|
-
}
|
|
2160
|
-
marked.options = marked.setOptions = function(options2) {
|
|
2161
|
-
markedInstance.setOptions(options2);
|
|
2162
|
-
marked.defaults = markedInstance.defaults;
|
|
2163
|
-
changeDefaults(marked.defaults);
|
|
2164
|
-
return marked;
|
|
2165
|
-
};
|
|
2166
|
-
marked.getDefaults = _getDefaults;
|
|
2167
|
-
marked.defaults = _defaults;
|
|
2168
|
-
marked.use = function(...args) {
|
|
2169
|
-
markedInstance.use(...args);
|
|
2170
|
-
marked.defaults = markedInstance.defaults;
|
|
2171
|
-
changeDefaults(marked.defaults);
|
|
2172
|
-
return marked;
|
|
2173
|
-
};
|
|
2174
|
-
marked.walkTokens = function(tokens, callback) {
|
|
2175
|
-
return markedInstance.walkTokens(tokens, callback);
|
|
2176
|
-
};
|
|
2177
|
-
marked.parseInline = markedInstance.parseInline;
|
|
2178
|
-
marked.Parser = _Parser;
|
|
2179
|
-
marked.parser = _Parser.parse;
|
|
2180
|
-
marked.Renderer = _Renderer;
|
|
2181
|
-
marked.TextRenderer = _TextRenderer;
|
|
2182
|
-
marked.Lexer = _Lexer;
|
|
2183
|
-
marked.lexer = _Lexer.lex;
|
|
2184
|
-
marked.Tokenizer = _Tokenizer;
|
|
2185
|
-
marked.Hooks = _Hooks;
|
|
2186
|
-
marked.parse = marked;
|
|
2187
|
-
marked.options;
|
|
2188
|
-
marked.setOptions;
|
|
2189
|
-
marked.use;
|
|
2190
|
-
marked.walkTokens;
|
|
2191
|
-
marked.parseInline;
|
|
2192
|
-
_Parser.parse;
|
|
2193
|
-
_Lexer.lex;
|
|
40
|
+
function M(){return {async:false,breaks:false,extensions:null,gfm:true,hooks:null,pedantic:false,renderer:null,silent:false,tokenizer:null,walkTokens:null}}var w=M();function H(a){w=a;}var C={exec:()=>null};function h(a,e=""){let t=typeof a=="string"?a:a.source,n={replace:(s,i)=>{let r=typeof i=="string"?i:i.source;return r=r.replace(m.caret,"$1"),t=t.replace(s,r),n},getRegex:()=>new RegExp(t,e)};return n}var m={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:a=>new RegExp(`^( {0,3}${a})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}#`),htmlBeginRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}<(?:[a-z].*>|!--)`,"i")},xe=/^(?:[ \t]*(?:\n|$))+/,be=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Te=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,I=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,we=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,j=/(?:[*+-]|\d{1,9}[.)])/,re$1=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ie=h(re$1).replace(/bull/g,j).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),ye=h(re$1).replace(/bull/g,j).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),F=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Re=/^[^\n]+/,Q=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Se=h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Q).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),$e=h(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,j).getRegex(),v="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",U=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,_e=h("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",U).replace("tag",v).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),oe=h(F).replace("hr",I).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",v).getRegex(),Le=h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",oe).getRegex(),K={blockquote:Le,code:be,def:Se,fences:Te,heading:we,hr:I,html:_e,lheading:ie,list:$e,newline:xe,paragraph:oe,table:C,text:Re},se=h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",I).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",v).getRegex(),ze={...K,lheading:ye,table:se,paragraph:h(F).replace("hr",I).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",se).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",v).getRegex()},Me={...K,html:h(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",U).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:C,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:h(F).replace("hr",I).replace("heading",` *#{1,6} *[^
|
|
41
|
+
]`).replace("lheading",ie).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Pe=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ae=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,le=/^( {2,}|\\)\n(?!\s*$)/,Ee=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,D=/[\p{P}\p{S}]/u,X=/[\s\p{P}\p{S}]/u,ae=/[^\s\p{P}\p{S}]/u,Ce=h(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,X).getRegex(),ce=/(?!~)[\p{P}\p{S}]/u,Ie=/(?!~)[\s\p{P}\p{S}]/u,Oe=/(?:[^\s\p{P}\p{S}]|~)/u,Be=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,pe=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,qe=h(pe,"u").replace(/punct/g,D).getRegex(),ve=h(pe,"u").replace(/punct/g,ce).getRegex(),ue="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",De=h(ue,"gu").replace(/notPunctSpace/g,ae).replace(/punctSpace/g,X).replace(/punct/g,D).getRegex(),Ze=h(ue,"gu").replace(/notPunctSpace/g,Oe).replace(/punctSpace/g,Ie).replace(/punct/g,ce).getRegex(),Ge=h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ae).replace(/punctSpace/g,X).replace(/punct/g,D).getRegex(),He=h(/\\(punct)/,"gu").replace(/punct/g,D).getRegex(),Ne=h(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),je=h(U).replace("(?:-->|$)","-->").getRegex(),Fe=h("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",je).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),q=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Qe=h(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",q).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),he=h(/^!?\[(label)\]\[(ref)\]/).replace("label",q).replace("ref",Q).getRegex(),ke=h(/^!?\[(ref)\](?:\[\])?/).replace("ref",Q).getRegex(),Ue=h("reflink|nolink(?!\\()","g").replace("reflink",he).replace("nolink",ke).getRegex(),W={_backpedal:C,anyPunctuation:He,autolink:Ne,blockSkip:Be,br:le,code:Ae,del:C,emStrongLDelim:qe,emStrongRDelimAst:De,emStrongRDelimUnd:Ge,escape:Pe,link:Qe,nolink:ke,punctuation:Ce,reflink:he,reflinkSearch:Ue,tag:Fe,text:Ee,url:C},Ke={...W,link:h(/^!?\[(label)\]\((.*?)\)/).replace("label",q).getRegex(),reflink:h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",q).getRegex()},N={...W,emStrongRDelimAst:Ze,emStrongLDelim:ve,url:h(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Xe={...N,br:h(le).replace("{2,}","*").getRegex(),text:h(N.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},O={normal:K,gfm:ze,pedantic:Me},P={normal:W,gfm:N,breaks:Xe,pedantic:Ke};var We={"&":"&","<":"<",">":">",'"':""","'":"'"},ge=a=>We[a];function R(a,e){if(e){if(m.escapeTest.test(a))return a.replace(m.escapeReplace,ge)}else if(m.escapeTestNoEncode.test(a))return a.replace(m.escapeReplaceNoEncode,ge);return a}function J(a){try{a=encodeURI(a).replace(m.percentDecode,"%");}catch{return null}return a}function V(a,e){let t=a.replace(m.findPipe,(i,r,o)=>{let l=false,c=r;for(;--c>=0&&o[c]==="\\";)l=!l;return l?"|":" |"}),n=t.split(m.splitPipe),s=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(m.slashPipe,"|");return n}function A(a,e,t){let n=a.length;if(n===0)return "";let s=0;for(;s<n;){let i=a.charAt(n-s-1);if(i===e&&true)s++;else break}return a.slice(0,n-s)}function fe(a,e){if(a.indexOf(e[1])===-1)return -1;let t=0;for(let n=0;n<a.length;n++)if(a[n]==="\\")n++;else if(a[n]===e[0])t++;else if(a[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function de(a,e,t,n,s){let i=e.href,r=e.title||null,o=a[1].replace(s.other.outputLinkReplace,"$1");n.state.inLink=true;let l={type:a[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:r,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=false,l}function Je(a,e,t){let n=a.match(t.other.indentCodeCompensation);if(n===null)return e;let s=n[1];return e.split(`
|
|
42
|
+
`).map(i=>{let r=i.match(t.other.beginningSpace);if(r===null)return i;let[o]=r;return o.length>=s.length?i.slice(s.length):i}).join(`
|
|
43
|
+
`)}var S=class{options;rules;lexer;constructor(e){this.options=e||w;}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return {type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return {type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:A(n,`
|
|
44
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=Je(n,t[3]||"",this.rules);return {type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let s=A(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(n=s.trim());}return {type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return {type:"hr",raw:A(t[0],`
|
|
45
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=A(t[0],`
|
|
46
|
+
`).split(`
|
|
47
|
+
`),s="",i="",r=[];for(;n.length>0;){let o=false,l=[],c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))l.push(n[c]),o=true;else if(!o)l.push(n[c]);else break;n=n.slice(c);let p=l.join(`
|
|
48
|
+
`),u=p.replace(this.rules.other.blockquoteSetextReplace,`
|
|
49
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
50
|
+
${p}`:p,i=i?`${i}
|
|
51
|
+
${u}`:u;let d=this.lexer.state.top;if(this.lexer.state.top=true,this.lexer.blockTokens(u,r,true),this.lexer.state.top=d,n.length===0)break;let g=r.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){let x=g,f=x.raw+`
|
|
52
|
+
`+n.join(`
|
|
53
|
+
`),y=this.blockquote(f);r[r.length-1]=y,s=s.substring(0,s.length-x.raw.length)+y.raw,i=i.substring(0,i.length-x.text.length)+y.text;break}else if(g?.type==="list"){let x=g,f=x.raw+`
|
|
54
|
+
`+n.join(`
|
|
55
|
+
`),y=this.list(f);r[r.length-1]=y,s=s.substring(0,s.length-g.raw.length)+y.raw,i=i.substring(0,i.length-x.raw.length)+y.raw,n=f.substring(r.at(-1).raw.length).split(`
|
|
56
|
+
`);continue}}return {type:"blockquote",raw:s,tokens:r,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),s=n.length>1,i={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:false,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let r=this.rules.other.listItemRegex(n),o=false;for(;e;){let c=false,p="",u="";if(!(t=r.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let d=t[2].split(`
|
|
57
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,Z=>" ".repeat(3*Z.length)),g=e.split(`
|
|
58
|
+
`,1)[0],x=!d.trim(),f=0;if(this.options.pedantic?(f=2,u=d.trimStart()):x?f=t[1].length+1:(f=t[2].search(this.rules.other.nonSpaceChar),f=f>4?1:f,u=d.slice(f),f+=t[1].length),x&&this.rules.other.blankLine.test(g)&&(p+=g+`
|
|
59
|
+
`,e=e.substring(g.length+1),c=true),!c){let Z=this.rules.other.nextBulletRegex(f),ee=this.rules.other.hrRegex(f),te=this.rules.other.fencesBeginRegex(f),ne=this.rules.other.headingBeginRegex(f),me=this.rules.other.htmlBeginRegex(f);for(;e;){let G=e.split(`
|
|
60
|
+
`,1)[0],E;if(g=G,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),E=g):E=g.replace(this.rules.other.tabCharGlobal," "),te.test(g)||ne.test(g)||me.test(g)||Z.test(g)||ee.test(g))break;if(E.search(this.rules.other.nonSpaceChar)>=f||!g.trim())u+=`
|
|
61
|
+
`+E.slice(f);else {if(x||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||te.test(d)||ne.test(d)||ee.test(d))break;u+=`
|
|
62
|
+
`+g;}!x&&!g.trim()&&(x=true),p+=G+`
|
|
63
|
+
`,e=e.substring(G.length+1),d=E.slice(f);}}i.loose||(o?i.loose=true:this.rules.other.doubleBlankLine.test(p)&&(o=true));let y=null,Y;this.options.gfm&&(y=this.rules.other.listIsTask.exec(u),y&&(Y=y[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:p,task:!!y,checked:Y,loose:false,text:u,tokens:[]}),i.raw+=p;}let l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let c=0;c<i.items.length;c++)if(this.lexer.state.top=false,i.items[c].tokens=this.lexer.blockTokens(i.items[c].text,[]),!i.loose){let p=i.items[c].tokens.filter(d=>d.type==="space"),u=p.length>0&&p.some(d=>this.rules.other.anyLine.test(d.raw));i.loose=u;}if(i.loose)for(let c=0;c<i.items.length;c++)i.items[c].loose=true;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return {type:"html",block:true,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return {type:"def",tag:n,raw:t[0],href:s,title:i}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=V(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
64
|
+
`):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?r.align.push("right"):this.rules.other.tableAlignCenter.test(o)?r.align.push("center"):this.rules.other.tableAlignLeft.test(o)?r.align.push("left"):r.align.push(null);for(let o=0;o<n.length;o++)r.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:true,align:r.align[o]});for(let o of i)r.rows.push(V(o,r.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:false,align:r.align[c]})));return r}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return {type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
65
|
+
`?t[1].slice(0,-1):t[1];return {type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return {type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return {type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return !this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=true:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=false),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=true:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=false),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:false,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let r=A(n.slice(0,-1),"\\");if((n.length-r.length)%2===0)return}else {let r=fe(t[2],"()");if(r===-2)return;if(r>-1){let l=(t[0].indexOf("!")===0?5:4)+t[1].length+r;t[2]=t[2].substring(0,r),t[0]=t[0].substring(0,l).trim(),t[3]="";}}let s=t[2],i="";if(this.options.pedantic){let r=this.rules.other.pedanticHrefTitle.exec(s);r&&(s=r[1],i=r[3]);}else i=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),de(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[s.toLowerCase()];if(!i){let r=n[0].charAt(0);return {type:"text",raw:r,text:r}}return de(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s||s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(s[1]||s[2]||"")||!n||this.rules.inline.punctuation.exec(n)){let r=[...s[0]].length-1,o,l,c=r,p=0,u=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+r);(s=u.exec(t))!=null;){if(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o)continue;if(l=[...o].length,s[3]||s[4]){c+=l;continue}else if((s[5]||s[6])&&r%3&&!((r+l)%3)){p+=l;continue}if(c-=l,c>0)continue;l=Math.min(l,l+c+p);let d=[...s[0]][0].length,g=e.slice(0,r+s.index+d+l);if(Math.min(r,l)%2){let f=g.slice(1,-1);return {type:"em",raw:g,text:f,tokens:this.lexer.inlineTokens(f)}}let x=g.slice(2,-2);return {type:"strong",raw:g,text:x,tokens:this.lexer.inlineTokens(x)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return {type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return {type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=t[1],s="mailto:"+n):(n=t[1],s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,s;if(t[2]==="@")n=t[0],s="mailto:"+n;else {let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);n=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0];}return {type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return {type:"text",raw:t[0],text:t[0],escaped:n}}}};var b=class a{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||w,this.options.tokenizer=this.options.tokenizer||new S,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:false,inRawBlock:false,top:true};let t={other:m,block:O.normal,inline:P.normal};this.options.pedantic?(t.block=O.pedantic,t.inline=P.pedantic):this.options.gfm&&(t.block=O.gfm,this.options.breaks?t.inline=P.breaks:t.inline=P.gfm),this.tokenizer.rules=t;}static get rules(){return {block:O,inline:P}}static lex(e,t){return new a(t).lex(e)}static lexInline(e,t){return new a(t).inlineTokens(e)}lex(e){e=e.replace(m.carriageReturn,`
|
|
66
|
+
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens);}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=false){for(this.options.pedantic&&(e=e.replace(m.tabCharGlobal," ").replace(m.spaceLine,""));e;){let s;if(this.options.extensions?.block?.some(r=>(s=r.call({lexer:this},e,t))?(e=e.substring(s.raw.length),t.push(s),true):false))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);let r=t.at(-1);s.raw.length===1&&r!==void 0?r.raw+=`
|
|
67
|
+
`:t.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);let r=t.at(-1);r?.type==="paragraph"||r?.type==="text"?(r.raw+=`
|
|
68
|
+
`+s.raw,r.text+=`
|
|
69
|
+
`+s.text,this.inlineQueue.at(-1).src=r.text):t.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);let r=t.at(-1);r?.type==="paragraph"||r?.type==="text"?(r.raw+=`
|
|
70
|
+
`+s.raw,r.text+=`
|
|
71
|
+
`+s.raw,this.inlineQueue.at(-1).src=r.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title});continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),t.push(s);continue}let i=e;if(this.options.extensions?.startBlock){let r=1/0,o=e.slice(1),l;this.options.extensions.startBlock.forEach(c=>{l=c.call({lexer:this},o),typeof l=="number"&&l>=0&&(r=Math.min(r,l));}),r<1/0&&r>=0&&(i=e.substring(0,r+1));}if(this.state.top&&(s=this.tokenizer.paragraph(i))){let r=t.at(-1);n&&r?.type==="paragraph"?(r.raw+=`
|
|
72
|
+
`+s.raw,r.text+=`
|
|
73
|
+
`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(s),n=i.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);let r=t.at(-1);r?.type==="text"?(r.raw+=`
|
|
74
|
+
`+s.raw,r.text+=`
|
|
75
|
+
`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(s);continue}if(e){let r="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(r);break}else throw new Error(r)}}return this.state.top=true,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,s=null;if(this.tokens.links){let o=Object.keys(this.tokens.links);if(o.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)o.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,s.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(s=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=false,r="";for(;e;){i||(r=""),i=false;let o;if(this.options.extensions?.inline?.some(c=>(o=c.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),true):false))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let c=t.at(-1);o.type==="text"&&c?.type==="text"?(c.raw+=o.raw,c.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,r)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let l=e;if(this.options.extensions?.startInline){let c=1/0,p=e.slice(1),u;this.options.extensions.startInline.forEach(d=>{u=d.call({lexer:this},p),typeof u=="number"&&u>=0&&(c=Math.min(c,u));}),c<1/0&&c>=0&&(l=e.substring(0,c+1));}if(o=this.tokenizer.inlineText(l)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(r=o.raw.slice(-1)),i=true;let c=t.at(-1);c?.type==="text"?(c.raw+=o.raw,c.text+=o.text):t.push(o);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return t}};var $=class{options;parser;constructor(e){this.options=e||w;}space(e){return ""}code({text:e,lang:t,escaped:n}){let s=(t||"").match(m.notSpaceStart)?.[0],i=e.replace(m.endingNewline,"")+`
|
|
76
|
+
`;return s?'<pre><code class="language-'+R(s)+'">'+(n?i:R(i,true))+`</code></pre>
|
|
77
|
+
`:"<pre><code>"+(n?i:R(i,true))+`</code></pre>
|
|
78
|
+
`}blockquote({tokens:e}){return `<blockquote>
|
|
79
|
+
${this.parser.parse(e)}</blockquote>
|
|
80
|
+
`}html({text:e}){return e}heading({tokens:e,depth:t}){return `<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
81
|
+
`}hr(e){return `<hr>
|
|
82
|
+
`}list(e){let t=e.ordered,n=e.start,s="";for(let o=0;o<e.items.length;o++){let l=e.items[o];s+=this.listitem(l);}let i=t?"ol":"ul",r=t&&n!==1?' start="'+n+'"':"";return "<"+i+r+`>
|
|
83
|
+
`+s+"</"+i+`>
|
|
84
|
+
`}listitem(e){let t="";if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=n+" "+R(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=true)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:true}):t+=n+" ";}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
|
|
85
|
+
`}checkbox({checked:e}){return "<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return `<p>${this.parser.parseInline(e)}</p>
|
|
86
|
+
`}table(e){let t="",n="";for(let i=0;i<e.header.length;i++)n+=this.tablecell(e.header[i]);t+=this.tablerow({text:n});let s="";for(let i=0;i<e.rows.length;i++){let r=e.rows[i];n="";for(let o=0;o<r.length;o++)n+=this.tablecell(r[o]);s+=this.tablerow({text:n});}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
|
87
|
+
<thead>
|
|
88
|
+
`+t+`</thead>
|
|
89
|
+
`+s+`</table>
|
|
90
|
+
`}tablerow({text:e}){return `<tr>
|
|
91
|
+
${e}</tr>
|
|
92
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return (e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
93
|
+
`}strong({tokens:e}){return `<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return `<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return `<code>${R(e,true)}</code>`}br(e){return "<br>"}del({tokens:e}){return `<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let s=this.parser.parseInline(n),i=J(e);if(i===null)return s;e=i;let r='<a href="'+e+'"';return t&&(r+=' title="'+R(t)+'"'),r+=">"+s+"</a>",r}image({href:e,title:t,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let i=J(e);if(i===null)return R(n);e=i;let r=`<img src="${e}" alt="${n}"`;return t&&(r+=` title="${R(t)}"`),r+=">",r}text(e){return "tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:R(e.text)}};var _=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return ""+e}image({text:e}){return ""+e}br(){return ""}};var T=class a{options;renderer;textRenderer;constructor(e){this.options=e||w,this.options.renderer=this.options.renderer||new $,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _;}static parse(e,t){return new a(t).parse(e)}static parseInline(e,t){return new a(t).parseInline(e)}parse(e,t=true){let n="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==false||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(o.type)){n+=l||"";continue}}let r=i;switch(r.type){case "space":{n+=this.renderer.space(r);continue}case "hr":{n+=this.renderer.hr(r);continue}case "heading":{n+=this.renderer.heading(r);continue}case "code":{n+=this.renderer.code(r);continue}case "table":{n+=this.renderer.table(r);continue}case "blockquote":{n+=this.renderer.blockquote(r);continue}case "list":{n+=this.renderer.list(r);continue}case "html":{n+=this.renderer.html(r);continue}case "paragraph":{n+=this.renderer.paragraph(r);continue}case "text":{let o=r,l=this.renderer.text(o);for(;s+1<e.length&&e[s+1].type==="text";)o=e[++s],l+=`
|
|
94
|
+
`+this.renderer.text(o);t?n+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:true}]}):n+=l;continue}default:{let o='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(e,t=this.renderer){let n="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let o=this.options.extensions.renderers[i.type].call({parser:this},i);if(o!==false||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=o||"";continue}}let r=i;switch(r.type){case "escape":{n+=t.text(r);break}case "html":{n+=t.html(r);break}case "link":{n+=t.link(r);break}case "image":{n+=t.image(r);break}case "strong":{n+=t.strong(r);break}case "em":{n+=t.em(r);break}case "codespan":{n+=t.codespan(r);break}case "br":{n+=t.br(r);break}case "del":{n+=t.del(r);break}case "text":{n+=t.text(r);break}default:{let o='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}};var L=class{options;block;constructor(e){this.options=e||w;}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?b.lex:b.lexInline}provideParser(){return this.block?T.parse:T.parseInline}};var B=class{defaults=M();options=this.setOptions;parse=this.parseMarkdown(true);parseInline=this.parseMarkdown(false);Parser=T;Renderer=$;TextRenderer=_;Lexer=b;Tokenizer=S;Hooks=L;constructor(...e){this.use(...e);}walkTokens(e,t){let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case "table":{let i=s;for(let r of i.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of i.rows)for(let o of r)n=n.concat(this.walkTokens(o.tokens,t));break}case "list":{let i=s;n=n.concat(this.walkTokens(i.items,t));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(r=>{let o=i[r].flat(1/0);n=n.concat(this.walkTokens(o,t));}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)));}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||false,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let r=t.renderers[i.name];r?t.renderers[i.name]=function(...o){let l=i.renderer.apply(this,o);return l===false&&(l=r.apply(this,o)),l}:t.renderers[i.name]=i.renderer;}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let r=t[i.level];r?r.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]));}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens);}),s.extensions=t),n.renderer){let i=this.defaults.renderer||new $(this.defaults);for(let r in n.renderer){if(!(r in i))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let o=r,l=n.renderer[o],c=i[o];i[o]=(...p)=>{let u=l.apply(i,p);return u===false&&(u=c.apply(i,p)),u||""};}s.renderer=i;}if(n.tokenizer){let i=this.defaults.tokenizer||new S(this.defaults);for(let r in n.tokenizer){if(!(r in i))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let o=r,l=n.tokenizer[o],c=i[o];i[o]=(...p)=>{let u=l.apply(i,p);return u===false&&(u=c.apply(i,p)),u};}s.tokenizer=i;}if(n.hooks){let i=this.defaults.hooks||new L;for(let r in n.hooks){if(!(r in i))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;let o=r,l=n.hooks[o],c=i[o];L.passThroughHooks.has(r)?i[o]=p=>{if(this.defaults.async)return Promise.resolve(l.call(i,p)).then(d=>c.call(i,d));let u=l.call(i,p);return c.call(i,u)}:i[o]=(...p)=>{let u=l.apply(i,p);return u===false&&(u=c.apply(i,p)),u};}s.hooks=i;}if(n.walkTokens){let i=this.defaults.walkTokens,r=n.walkTokens;s.walkTokens=function(o){let l=[];return l.push(r.call(this,o)),i&&(l=l.concat(i.call(this,o))),l};}this.defaults={...this.defaults,...s};}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return b.lex(e,t??this.defaults)}parser(e,t){return T.parse(e,t??this.defaults)}parseMarkdown(e){return (n,s)=>{let i={...s},r={...this.defaults,...i},o=this.onError(!!r.silent,!!r.async);if(this.defaults.async===true&&i.async===false)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));r.hooks&&(r.hooks.options=r,r.hooks.block=e);let l=r.hooks?r.hooks.provideLexer():e?b.lex:b.lexInline,c=r.hooks?r.hooks.provideParser():e?T.parse:T.parseInline;if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(n):n).then(p=>l(p,r)).then(p=>r.hooks?r.hooks.processAllTokens(p):p).then(p=>r.walkTokens?Promise.all(this.walkTokens(p,r.walkTokens)).then(()=>p):p).then(p=>c(p,r)).then(p=>r.hooks?r.hooks.postprocess(p):p).catch(o);try{r.hooks&&(n=r.hooks.preprocess(n));let p=l(n,r);r.hooks&&(p=r.hooks.processAllTokens(p)),r.walkTokens&&this.walkTokens(p,r.walkTokens);let u=c(p,r);return r.hooks&&(u=r.hooks.postprocess(u)),u}catch(p){return o(p)}}}onError(e,t){return n=>{if(n.message+=`
|
|
95
|
+
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+R(n.message+"",true)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}};var z=new B;function k(a,e){return z.parse(a,e)}k.options=k.setOptions=function(a){return z.setOptions(a),k.defaults=z.defaults,H(k.defaults),k};k.getDefaults=M;k.defaults=w;k.use=function(...a){return z.use(...a),k.defaults=z.defaults,H(k.defaults),k};k.walkTokens=function(a,e){return z.walkTokens(a,e)};k.parseInline=z.parseInline;k.Parser=T;k.parser=T.parse;k.Renderer=$;k.TextRenderer=_;k.Lexer=b;k.lexer=b.lex;k.Tokenizer=S;k.Hooks=L;k.parse=k;k.options;k.setOptions;k.use;k.walkTokens;k.parseInline;T.parse;b.lex;
|
|
2194
96
|
|
|
2195
97
|
/*
|
|
2196
98
|
* Set up window for Node.js
|
|
@@ -5026,6 +2928,12 @@ function requireSemver () {
|
|
|
5026
2928
|
var semverExports = requireSemver();
|
|
5027
2929
|
const semver = /*@__PURE__*/getDefaultExportFromCjs(semverExports);
|
|
5028
2930
|
|
|
2931
|
+
const CSS_LAYER = {
|
|
2932
|
+
base: 'bge-component-bases',
|
|
2933
|
+
components: 'bge-components',
|
|
2934
|
+
ui: 'bge-ui',
|
|
2935
|
+
};
|
|
2936
|
+
|
|
5029
2937
|
/**
|
|
5030
2938
|
*
|
|
5031
2939
|
* @param doc
|
|
@@ -5039,6 +2947,18 @@ function appendStylesheetTo(doc, url) {
|
|
|
5039
2947
|
doc.head.append(link);
|
|
5040
2948
|
}
|
|
5041
2949
|
|
|
2950
|
+
/**
|
|
2951
|
+
*
|
|
2952
|
+
* @param cssContents
|
|
2953
|
+
* @param layer
|
|
2954
|
+
*/
|
|
2955
|
+
function createStylesheet(cssContents, layer) {
|
|
2956
|
+
const css = layer ? `@layer ${layer} {${cssContents}}` : cssContents;
|
|
2957
|
+
const blob = new Blob([css], { type: 'text/css' });
|
|
2958
|
+
const url = URL.createObjectURL(blob);
|
|
2959
|
+
return url;
|
|
2960
|
+
}
|
|
2961
|
+
|
|
5042
2962
|
class ElementNotFoundError extends Error {
|
|
5043
2963
|
static {
|
|
5044
2964
|
this.prototype.name = 'ElementNotFoundError';
|
|
@@ -5087,9 +3007,7 @@ class EditorUI {
|
|
|
5087
3007
|
this.#el = typeof elOrSelector === 'string' ? getElement(elOrSelector) : elOrSelector;
|
|
5088
3008
|
this.#el.dataset.bgeComponent = name;
|
|
5089
3009
|
if (options?.stylesheet) {
|
|
5090
|
-
const
|
|
5091
|
-
const blob = new Blob([css], { type: 'text/css' });
|
|
5092
|
-
const url = URL.createObjectURL(blob);
|
|
3010
|
+
const url = createStylesheet(options.stylesheet, CSS_LAYER.ui);
|
|
5093
3011
|
appendStylesheetTo(this.el.ownerDocument, url);
|
|
5094
3012
|
}
|
|
5095
3013
|
}
|
|
@@ -5378,35 +3296,43 @@ class ComponentObserver {
|
|
|
5378
3296
|
*
|
|
5379
3297
|
* @param items
|
|
5380
3298
|
* @param generalCSS
|
|
3299
|
+
* @param layer
|
|
5381
3300
|
*/
|
|
5382
|
-
function createComponentStylesheet(items, generalCSS) {
|
|
3301
|
+
function createComponentStylesheet(items, generalCSS, layer) {
|
|
5383
3302
|
const itemStyles = Object.values(items)
|
|
5384
3303
|
.map((item) => item.style)
|
|
5385
3304
|
.filter(Boolean)
|
|
5386
3305
|
.join('\n');
|
|
5387
|
-
|
|
3306
|
+
return createStylesheet(itemStyles + '\n' + generalCSS, layer);
|
|
3307
|
+
}
|
|
3308
|
+
|
|
3309
|
+
/**
|
|
3310
|
+
*
|
|
3311
|
+
* @param url
|
|
3312
|
+
* @param layer
|
|
3313
|
+
*/
|
|
3314
|
+
async function createStylesheetFromUrl(url, layer) {
|
|
3315
|
+
const response = await fetch(url);
|
|
3316
|
+
const cssContents = await response.text();
|
|
3317
|
+
const css = layer ? `@layer ${layer} {${cssContents}}` : cssContents;
|
|
5388
3318
|
const blob = new Blob([css], { type: 'text/css' });
|
|
5389
|
-
const
|
|
5390
|
-
return
|
|
3319
|
+
const blobUrl = URL.createObjectURL(blob);
|
|
3320
|
+
return blobUrl;
|
|
5391
3321
|
}
|
|
5392
3322
|
|
|
5393
3323
|
const PREFIX = '--bge-options-';
|
|
5394
3324
|
/**
|
|
5395
|
-
*
|
|
3325
|
+
* Get all custom properties from editorArea
|
|
5396
3326
|
* @param editorArea
|
|
5397
3327
|
*/
|
|
5398
3328
|
function getCustomProperties(editorArea) {
|
|
5399
3329
|
const categories = new Map();
|
|
5400
3330
|
const defaultValues = new Map();
|
|
5401
|
-
// From iframe scope
|
|
5402
|
-
const CSSStyleRule = editorArea.containerElement.ownerDocument.defaultView?.CSSStyleRule;
|
|
5403
|
-
if (CSSStyleRule === undefined) {
|
|
5404
|
-
throw new Error('CSSStyleRule is not available');
|
|
5405
|
-
}
|
|
5406
3331
|
for (const styleSheet of editorArea.containerElement.ownerDocument.styleSheets) {
|
|
5407
3332
|
try {
|
|
5408
|
-
|
|
5409
|
-
|
|
3333
|
+
const styleRules = getStyleRules(styleSheet.cssRules, editorArea);
|
|
3334
|
+
for (const cssRule of styleRules) {
|
|
3335
|
+
if (cssRule.selectorText === ':root') {
|
|
5410
3336
|
for (const cssProperty of cssRule.style) {
|
|
5411
3337
|
if (cssProperty.startsWith(PREFIX)) {
|
|
5412
3338
|
const [type, key] = cssProperty.slice(PREFIX.length).split('-');
|
|
@@ -5435,6 +3361,13 @@ function getCustomProperties(editorArea) {
|
|
|
5435
3361
|
throw error;
|
|
5436
3362
|
}
|
|
5437
3363
|
}
|
|
3364
|
+
for (const propList of categories.values()) {
|
|
3365
|
+
for (const [key, customProperty] of propList.entries()) {
|
|
3366
|
+
if (customProperty.value.trim().toLowerCase() === 'null') {
|
|
3367
|
+
propList.delete(key);
|
|
3368
|
+
}
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
5438
3371
|
for (const [category, value] of defaultValues.entries()) {
|
|
5439
3372
|
const currentMap = categories.get(category);
|
|
5440
3373
|
if (!currentMap) {
|
|
@@ -5448,6 +3381,34 @@ function getCustomProperties(editorArea) {
|
|
|
5448
3381
|
}
|
|
5449
3382
|
return categories;
|
|
5450
3383
|
}
|
|
3384
|
+
/**
|
|
3385
|
+
* Get all CSSStyleRule from CSSRule array recursively
|
|
3386
|
+
* @param rules - CSSRule array
|
|
3387
|
+
* @param scope - EditableArea
|
|
3388
|
+
* @returns CSSStyleRule array
|
|
3389
|
+
*/
|
|
3390
|
+
function getStyleRules(rules, scope) {
|
|
3391
|
+
const CSSStyleRule = scope.containerElement.ownerDocument.defaultView?.CSSStyleRule;
|
|
3392
|
+
if (CSSStyleRule === undefined) {
|
|
3393
|
+
throw new Error('CSSStyleRule is not available');
|
|
3394
|
+
}
|
|
3395
|
+
const CSSGroupingRule = scope.containerElement.ownerDocument.defaultView?.CSSGroupingRule;
|
|
3396
|
+
if (CSSGroupingRule === undefined) {
|
|
3397
|
+
throw new Error('CSSGroupingRule is not available');
|
|
3398
|
+
}
|
|
3399
|
+
const styleRules = [];
|
|
3400
|
+
for (const rule of rules) {
|
|
3401
|
+
if (rule instanceof CSSStyleRule) {
|
|
3402
|
+
styleRules.push(rule);
|
|
3403
|
+
continue;
|
|
3404
|
+
}
|
|
3405
|
+
if (rule instanceof CSSGroupingRule) {
|
|
3406
|
+
styleRules.push(...getStyleRules(rule.cssRules, scope));
|
|
3407
|
+
continue;
|
|
3408
|
+
}
|
|
3409
|
+
}
|
|
3410
|
+
return styleRules;
|
|
3411
|
+
}
|
|
5451
3412
|
|
|
5452
3413
|
const getCSSPropertyAsNumberCache = new Map();
|
|
5453
3414
|
/**
|
|
@@ -5482,10 +3443,6 @@ class BlockMenu extends EditorUI {
|
|
|
5482
3443
|
position: absolute;
|
|
5483
3444
|
z-index: 2147483647;
|
|
5484
3445
|
pointer-events: none;
|
|
5485
|
-
|
|
5486
|
-
> * {
|
|
5487
|
-
pointer-events: auto;
|
|
5488
|
-
}
|
|
5489
3446
|
}
|
|
5490
3447
|
`,
|
|
5491
3448
|
});
|
|
@@ -7394,8 +5351,12 @@ class BurgerEditorEngine {
|
|
|
7394
5351
|
static #itemSeeds = new Map();
|
|
7395
5352
|
static async new(options) {
|
|
7396
5353
|
const engine = new BurgerEditorEngine(options);
|
|
7397
|
-
const
|
|
7398
|
-
const
|
|
5354
|
+
const layers = createStylesheet(`@layer ${CSS_LAYER.base}, ${CSS_LAYER.components}, ${CSS_LAYER.ui};`);
|
|
5355
|
+
const baseStylesheet = createComponentStylesheet(options.items, options.generalCSS, CSS_LAYER.base);
|
|
5356
|
+
const componentStylesheets = await Promise.all(options.config.stylesheets.map(async (stylesheet) => {
|
|
5357
|
+
return createStylesheetFromUrl(stylesheet.path, stylesheet.layer ?? CSS_LAYER.components);
|
|
5358
|
+
}));
|
|
5359
|
+
const stylesheets = [layers, baseStylesheet, ...componentStylesheets];
|
|
7399
5360
|
const mainInitialContent = typeof options.initialContents === 'string'
|
|
7400
5361
|
? options.initialContents
|
|
7401
5362
|
: options.initialContents.main;
|
|
@@ -8647,17 +6608,22 @@ const DESTROYED = 1 << 14;
|
|
|
8647
6608
|
const EFFECT_RAN = 1 << 15;
|
|
8648
6609
|
/** 'Transparent' effects do not create a transition boundary */
|
|
8649
6610
|
const EFFECT_TRANSPARENT = 1 << 16;
|
|
8650
|
-
|
|
8651
|
-
const
|
|
8652
|
-
const
|
|
8653
|
-
const
|
|
8654
|
-
const
|
|
8655
|
-
const EFFECT_IS_UPDATING = 1 << 21;
|
|
6611
|
+
const INSPECT_EFFECT = 1 << 17;
|
|
6612
|
+
const HEAD_EFFECT = 1 << 18;
|
|
6613
|
+
const EFFECT_PRESERVED = 1 << 19;
|
|
6614
|
+
const EFFECT_IS_UPDATING = 1 << 20;
|
|
6615
|
+
const USER_EFFECT = 1 << 21;
|
|
8656
6616
|
|
|
8657
6617
|
const STATE_SYMBOL = Symbol('$state');
|
|
8658
6618
|
const LEGACY_PROPS = Symbol('legacy props');
|
|
8659
6619
|
const LOADING_ATTR_SYMBOL = Symbol('');
|
|
8660
6620
|
|
|
6621
|
+
/** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */
|
|
6622
|
+
const STALE_REACTION = new (class StaleReactionError extends Error {
|
|
6623
|
+
name = 'StaleReactionError';
|
|
6624
|
+
message = 'The reaction that called `getAbortSignal()` was re-run or destroyed';
|
|
6625
|
+
})();
|
|
6626
|
+
|
|
8661
6627
|
/** @import { Equals } from '#client' */
|
|
8662
6628
|
|
|
8663
6629
|
/** @type {Equals} */
|
|
@@ -8781,7 +6747,7 @@ function lifecycle_outside_component(name) {
|
|
|
8781
6747
|
}
|
|
8782
6748
|
}
|
|
8783
6749
|
|
|
8784
|
-
/** @import { ComponentContext } from '#client' */
|
|
6750
|
+
/** @import { ComponentContext, DevStackEntry } from '#client' */
|
|
8785
6751
|
|
|
8786
6752
|
|
|
8787
6753
|
/** @type {ComponentContext | null} */
|
|
@@ -8842,7 +6808,7 @@ function pop(component) {
|
|
|
8842
6808
|
var component_effect = component_effects[i];
|
|
8843
6809
|
set_active_effect(component_effect.effect);
|
|
8844
6810
|
set_active_reaction(component_effect.reaction);
|
|
8845
|
-
|
|
6811
|
+
create_user_effect(component_effect.fn);
|
|
8846
6812
|
}
|
|
8847
6813
|
} finally {
|
|
8848
6814
|
set_active_effect(previous_effect);
|
|
@@ -9192,7 +7158,7 @@ function derived(fn) {
|
|
|
9192
7158
|
} else {
|
|
9193
7159
|
// Since deriveds are evaluated lazily, any effects created inside them are
|
|
9194
7160
|
// created too late to ensure that the parent effect is added to the tree
|
|
9195
|
-
active_effect.f |=
|
|
7161
|
+
active_effect.f |= EFFECT_PRESERVED;
|
|
9196
7162
|
}
|
|
9197
7163
|
|
|
9198
7164
|
/** @type {Derived<V>} */
|
|
@@ -9205,9 +7171,10 @@ function derived(fn) {
|
|
|
9205
7171
|
fn,
|
|
9206
7172
|
reactions: null,
|
|
9207
7173
|
rv: 0,
|
|
9208
|
-
v: /** @type {V} */ (
|
|
7174
|
+
v: /** @type {V} */ (UNINITIALIZED),
|
|
9209
7175
|
wv: 0,
|
|
9210
|
-
parent: parent_derived ?? active_effect
|
|
7176
|
+
parent: parent_derived ?? active_effect,
|
|
7177
|
+
ac: null
|
|
9211
7178
|
};
|
|
9212
7179
|
|
|
9213
7180
|
return signal;
|
|
@@ -9405,7 +7372,7 @@ function set(source, value, should_proxy = false) {
|
|
|
9405
7372
|
(!untracking || (active_reaction.f & INSPECT_EFFECT) !== 0) &&
|
|
9406
7373
|
is_runes() &&
|
|
9407
7374
|
(active_reaction.f & (DERIVED | BLOCK_EFFECT | INSPECT_EFFECT)) !== 0 &&
|
|
9408
|
-
!(
|
|
7375
|
+
!(source_ownership?.reaction === active_reaction && source_ownership.sources.includes(source))
|
|
9409
7376
|
) {
|
|
9410
7377
|
state_unsafe_mutation();
|
|
9411
7378
|
}
|
|
@@ -9736,10 +7703,12 @@ function create_effect(type, fn, sync, push = true) {
|
|
|
9736
7703
|
last: null,
|
|
9737
7704
|
next: null,
|
|
9738
7705
|
parent,
|
|
7706
|
+
b: parent && parent.b,
|
|
9739
7707
|
prev: null,
|
|
9740
7708
|
teardown: null,
|
|
9741
7709
|
transitions: null,
|
|
9742
|
-
wv: 0
|
|
7710
|
+
wv: 0,
|
|
7711
|
+
ac: null
|
|
9743
7712
|
};
|
|
9744
7713
|
|
|
9745
7714
|
if (sync) {
|
|
@@ -9762,7 +7731,7 @@ function create_effect(type, fn, sync, push = true) {
|
|
|
9762
7731
|
effect.first === null &&
|
|
9763
7732
|
effect.nodes_start === null &&
|
|
9764
7733
|
effect.teardown === null &&
|
|
9765
|
-
(effect.f & (
|
|
7734
|
+
(effect.f & (EFFECT_PRESERVED | BOUNDARY_EFFECT)) === 0;
|
|
9766
7735
|
|
|
9767
7736
|
if (!inert && push) {
|
|
9768
7737
|
if (parent !== null) {
|
|
@@ -9812,11 +7781,17 @@ function user_effect(fn) {
|
|
|
9812
7781
|
reaction: active_reaction
|
|
9813
7782
|
});
|
|
9814
7783
|
} else {
|
|
9815
|
-
|
|
9816
|
-
return signal;
|
|
7784
|
+
return create_user_effect(fn);
|
|
9817
7785
|
}
|
|
9818
7786
|
}
|
|
9819
7787
|
|
|
7788
|
+
/**
|
|
7789
|
+
* @param {() => void | (() => void)} fn
|
|
7790
|
+
*/
|
|
7791
|
+
function create_user_effect(fn) {
|
|
7792
|
+
return create_effect(EFFECT | USER_EFFECT, fn, false);
|
|
7793
|
+
}
|
|
7794
|
+
|
|
9820
7795
|
/**
|
|
9821
7796
|
* Internal representation of `$effect.pre(...)`
|
|
9822
7797
|
* @param {() => void | (() => void)} fn
|
|
@@ -9824,7 +7799,7 @@ function user_effect(fn) {
|
|
|
9824
7799
|
*/
|
|
9825
7800
|
function user_pre_effect(fn) {
|
|
9826
7801
|
validate_effect();
|
|
9827
|
-
return
|
|
7802
|
+
return create_effect(RENDER_EFFECT | USER_EFFECT, fn, true);
|
|
9828
7803
|
}
|
|
9829
7804
|
|
|
9830
7805
|
/**
|
|
@@ -9935,7 +7910,8 @@ function template_effect(fn, thunks = [], d = derived) {
|
|
|
9935
7910
|
* @param {number} flags
|
|
9936
7911
|
*/
|
|
9937
7912
|
function block(fn, flags = 0) {
|
|
9938
|
-
|
|
7913
|
+
var effect = create_effect(RENDER_EFFECT | BLOCK_EFFECT | flags, fn, true);
|
|
7914
|
+
return effect;
|
|
9939
7915
|
}
|
|
9940
7916
|
|
|
9941
7917
|
/**
|
|
@@ -9975,6 +7951,8 @@ function destroy_effect_children(signal, remove_dom = false) {
|
|
|
9975
7951
|
signal.first = signal.last = null;
|
|
9976
7952
|
|
|
9977
7953
|
while (effect !== null) {
|
|
7954
|
+
effect.ac?.abort(STALE_REACTION);
|
|
7955
|
+
|
|
9978
7956
|
var next = effect.next;
|
|
9979
7957
|
|
|
9980
7958
|
if ((effect.f & ROOT_EFFECT) !== 0) {
|
|
@@ -10052,6 +8030,7 @@ function destroy_effect(effect, remove_dom = true) {
|
|
|
10052
8030
|
effect.fn =
|
|
10053
8031
|
effect.nodes_start =
|
|
10054
8032
|
effect.nodes_end =
|
|
8033
|
+
effect.ac =
|
|
10055
8034
|
null;
|
|
10056
8035
|
}
|
|
10057
8036
|
|
|
@@ -10215,6 +8194,7 @@ function queue_micro_task(fn) {
|
|
|
10215
8194
|
}
|
|
10216
8195
|
|
|
10217
8196
|
/** @import { Effect } from '#client' */
|
|
8197
|
+
/** @import { Boundary } from './dom/blocks/boundary.js' */
|
|
10218
8198
|
|
|
10219
8199
|
/**
|
|
10220
8200
|
* @param {unknown} error
|
|
@@ -10245,8 +8225,7 @@ function invoke_error_boundary(error, effect) {
|
|
|
10245
8225
|
while (effect !== null) {
|
|
10246
8226
|
if ((effect.f & BOUNDARY_EFFECT) !== 0) {
|
|
10247
8227
|
try {
|
|
10248
|
-
|
|
10249
|
-
effect.fn(error);
|
|
8228
|
+
/** @type {Boundary} */ (effect.b).error(error);
|
|
10250
8229
|
return;
|
|
10251
8230
|
} catch {}
|
|
10252
8231
|
}
|
|
@@ -10303,17 +8282,17 @@ function set_active_effect(effect) {
|
|
|
10303
8282
|
/**
|
|
10304
8283
|
* When sources are created within a reaction, reading and writing
|
|
10305
8284
|
* them within that reaction should not cause a re-run
|
|
10306
|
-
* @type {null |
|
|
8285
|
+
* @type {null | { reaction: Reaction, sources: Source[] }}
|
|
10307
8286
|
*/
|
|
10308
|
-
let
|
|
8287
|
+
let source_ownership = null;
|
|
10309
8288
|
|
|
10310
8289
|
/** @param {Value} value */
|
|
10311
8290
|
function push_reaction_value(value) {
|
|
10312
8291
|
if (active_reaction !== null && active_reaction.f & EFFECT_IS_UPDATING) {
|
|
10313
|
-
if (
|
|
10314
|
-
|
|
8292
|
+
if (source_ownership === null) {
|
|
8293
|
+
source_ownership = { reaction: active_reaction, sources: [value] };
|
|
10315
8294
|
} else {
|
|
10316
|
-
|
|
8295
|
+
source_ownership.sources.push(value);
|
|
10317
8296
|
}
|
|
10318
8297
|
}
|
|
10319
8298
|
}
|
|
@@ -10447,7 +8426,12 @@ function schedule_possible_effect_self_invalidation(signal, effect, root = true)
|
|
|
10447
8426
|
for (var i = 0; i < reactions.length; i++) {
|
|
10448
8427
|
var reaction = reactions[i];
|
|
10449
8428
|
|
|
10450
|
-
if (
|
|
8429
|
+
if (
|
|
8430
|
+
source_ownership?.reaction === active_reaction &&
|
|
8431
|
+
source_ownership.sources.includes(signal)
|
|
8432
|
+
) {
|
|
8433
|
+
continue;
|
|
8434
|
+
}
|
|
10451
8435
|
|
|
10452
8436
|
if ((reaction.f & DERIVED) !== 0) {
|
|
10453
8437
|
schedule_possible_effect_self_invalidation(/** @type {Derived} */ (reaction), effect, false);
|
|
@@ -10469,7 +8453,7 @@ function update_reaction(reaction) {
|
|
|
10469
8453
|
var previous_untracked_writes = untracked_writes;
|
|
10470
8454
|
var previous_reaction = active_reaction;
|
|
10471
8455
|
var previous_skip_reaction = skip_reaction;
|
|
10472
|
-
var previous_reaction_sources =
|
|
8456
|
+
var previous_reaction_sources = source_ownership;
|
|
10473
8457
|
var previous_component_context = component_context;
|
|
10474
8458
|
var previous_untracking = untracking;
|
|
10475
8459
|
|
|
@@ -10482,13 +8466,18 @@ function update_reaction(reaction) {
|
|
|
10482
8466
|
(flags & UNOWNED) !== 0 && (untracking || !is_updating_effect || active_reaction === null);
|
|
10483
8467
|
active_reaction = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) === 0 ? reaction : null;
|
|
10484
8468
|
|
|
10485
|
-
|
|
8469
|
+
source_ownership = null;
|
|
10486
8470
|
set_component_context(reaction.ctx);
|
|
10487
8471
|
untracking = false;
|
|
10488
|
-
read_version
|
|
8472
|
+
++read_version;
|
|
10489
8473
|
|
|
10490
8474
|
reaction.f |= EFFECT_IS_UPDATING;
|
|
10491
8475
|
|
|
8476
|
+
if (reaction.ac !== null) {
|
|
8477
|
+
reaction.ac.abort(STALE_REACTION);
|
|
8478
|
+
reaction.ac = null;
|
|
8479
|
+
}
|
|
8480
|
+
|
|
10492
8481
|
try {
|
|
10493
8482
|
var result = /** @type {Function} */ (0, reaction.fn)();
|
|
10494
8483
|
var deps = reaction.deps;
|
|
@@ -10507,7 +8496,12 @@ function update_reaction(reaction) {
|
|
|
10507
8496
|
reaction.deps = deps = new_deps;
|
|
10508
8497
|
}
|
|
10509
8498
|
|
|
10510
|
-
if (
|
|
8499
|
+
if (
|
|
8500
|
+
!skip_reaction ||
|
|
8501
|
+
// Deriveds that already have reactions can cleanup, so we still add them as reactions
|
|
8502
|
+
((flags & DERIVED) !== 0 &&
|
|
8503
|
+
/** @type {import('#client').Derived} */ (reaction).reactions !== null)
|
|
8504
|
+
) {
|
|
10511
8505
|
for (i = skipped_deps; i < deps.length; i++) {
|
|
10512
8506
|
(deps[i].reactions ??= []).push(reaction);
|
|
10513
8507
|
}
|
|
@@ -10560,7 +8554,7 @@ function update_reaction(reaction) {
|
|
|
10560
8554
|
untracked_writes = previous_untracked_writes;
|
|
10561
8555
|
active_reaction = previous_reaction;
|
|
10562
8556
|
skip_reaction = previous_skip_reaction;
|
|
10563
|
-
|
|
8557
|
+
source_ownership = previous_reaction_sources;
|
|
10564
8558
|
set_component_context(previous_component_context);
|
|
10565
8559
|
untracking = previous_untracking;
|
|
10566
8560
|
|
|
@@ -10727,6 +8721,8 @@ function flush_queued_effects(effects) {
|
|
|
10727
8721
|
|
|
10728
8722
|
if ((effect.f & (DESTROYED | INERT)) === 0) {
|
|
10729
8723
|
if (check_dirtiness(effect)) {
|
|
8724
|
+
var wv = write_version;
|
|
8725
|
+
|
|
10730
8726
|
update_effect(effect);
|
|
10731
8727
|
|
|
10732
8728
|
// Effects with no dependencies or teardown do not get added to the effect tree.
|
|
@@ -10743,9 +8739,19 @@ function flush_queued_effects(effects) {
|
|
|
10743
8739
|
effect.fn = null;
|
|
10744
8740
|
}
|
|
10745
8741
|
}
|
|
8742
|
+
|
|
8743
|
+
// if state is written in a user effect, abort and re-schedule, lest we run
|
|
8744
|
+
// effects that should be removed as a result of the state change
|
|
8745
|
+
if (write_version > wv && (effect.f & USER_EFFECT) !== 0) {
|
|
8746
|
+
break;
|
|
8747
|
+
}
|
|
10746
8748
|
}
|
|
10747
8749
|
}
|
|
10748
8750
|
}
|
|
8751
|
+
|
|
8752
|
+
for (; i < length; i += 1) {
|
|
8753
|
+
schedule_effect(effects[i]);
|
|
8754
|
+
}
|
|
10749
8755
|
}
|
|
10750
8756
|
|
|
10751
8757
|
/**
|
|
@@ -10842,7 +8848,10 @@ function get(signal) {
|
|
|
10842
8848
|
|
|
10843
8849
|
// Register the dependency on the current reaction signal.
|
|
10844
8850
|
if (active_reaction !== null && !untracking) {
|
|
10845
|
-
if (
|
|
8851
|
+
if (
|
|
8852
|
+
source_ownership?.reaction !== active_reaction ||
|
|
8853
|
+
!source_ownership?.sources.includes(signal)
|
|
8854
|
+
) {
|
|
10846
8855
|
var deps = active_reaction.deps;
|
|
10847
8856
|
if (signal.rv < read_version) {
|
|
10848
8857
|
signal.rv = read_version;
|
|
@@ -10877,7 +8886,7 @@ function get(signal) {
|
|
|
10877
8886
|
}
|
|
10878
8887
|
}
|
|
10879
8888
|
|
|
10880
|
-
if (is_derived) {
|
|
8889
|
+
if (is_derived && !is_destroying_effect) {
|
|
10881
8890
|
derived = /** @type {Derived} */ (signal);
|
|
10882
8891
|
|
|
10883
8892
|
if (check_dirtiness(derived)) {
|
|
@@ -10885,13 +8894,48 @@ function get(signal) {
|
|
|
10885
8894
|
}
|
|
10886
8895
|
}
|
|
10887
8896
|
|
|
10888
|
-
if (is_destroying_effect
|
|
10889
|
-
|
|
8897
|
+
if (is_destroying_effect) {
|
|
8898
|
+
if (old_values.has(signal)) {
|
|
8899
|
+
return old_values.get(signal);
|
|
8900
|
+
}
|
|
8901
|
+
|
|
8902
|
+
if (is_derived) {
|
|
8903
|
+
derived = /** @type {Derived} */ (signal);
|
|
8904
|
+
|
|
8905
|
+
var value = derived.v;
|
|
8906
|
+
|
|
8907
|
+
// if the derived is dirty, or depends on the values that just changed, re-execute
|
|
8908
|
+
if ((derived.f & CLEAN) !== 0 || depends_on_old_values(derived)) {
|
|
8909
|
+
value = execute_derived(derived);
|
|
8910
|
+
}
|
|
8911
|
+
|
|
8912
|
+
old_values.set(derived, value);
|
|
8913
|
+
|
|
8914
|
+
return value;
|
|
8915
|
+
}
|
|
10890
8916
|
}
|
|
10891
8917
|
|
|
10892
8918
|
return signal.v;
|
|
10893
8919
|
}
|
|
10894
8920
|
|
|
8921
|
+
/** @param {Derived} derived */
|
|
8922
|
+
function depends_on_old_values(derived) {
|
|
8923
|
+
if (derived.v === UNINITIALIZED) return true; // we don't know, so assume the worst
|
|
8924
|
+
if (derived.deps === null) return false;
|
|
8925
|
+
|
|
8926
|
+
for (const dep of derived.deps) {
|
|
8927
|
+
if (old_values.has(dep)) {
|
|
8928
|
+
return true;
|
|
8929
|
+
}
|
|
8930
|
+
|
|
8931
|
+
if ((dep.f & DERIVED) !== 0 && depends_on_old_values(/** @type {Derived} */ (dep))) {
|
|
8932
|
+
return true;
|
|
8933
|
+
}
|
|
8934
|
+
}
|
|
8935
|
+
|
|
8936
|
+
return false;
|
|
8937
|
+
}
|
|
8938
|
+
|
|
10895
8939
|
/**
|
|
10896
8940
|
* Capture an array of all the signals that are read when `fn` is called
|
|
10897
8941
|
* @template T
|
|
@@ -10927,17 +8971,7 @@ function invalidate_inner_signals(fn) {
|
|
|
10927
8971
|
var captured = capture_signals(() => untrack(fn));
|
|
10928
8972
|
|
|
10929
8973
|
for (var signal of captured) {
|
|
10930
|
-
|
|
10931
|
-
if ((signal.f & LEGACY_DERIVED_PROP) !== 0) {
|
|
10932
|
-
for (const dep of /** @type {Derived} */ (signal).deps || []) {
|
|
10933
|
-
if ((dep.f & DERIVED) === 0) {
|
|
10934
|
-
// Use internal_set instead of set here and below to avoid mutation validation
|
|
10935
|
-
internal_set(dep, dep.v);
|
|
10936
|
-
}
|
|
10937
|
-
}
|
|
10938
|
-
} else {
|
|
10939
|
-
internal_set(signal, signal.v);
|
|
10940
|
-
}
|
|
8974
|
+
internal_set(signal, signal.v);
|
|
10941
8975
|
}
|
|
10942
8976
|
}
|
|
10943
8977
|
|
|
@@ -12908,9 +10942,9 @@ function set_style(dom, value, prev_styles, next_styles) {
|
|
|
12908
10942
|
* @template V
|
|
12909
10943
|
* @param {HTMLSelectElement} select
|
|
12910
10944
|
* @param {V} value
|
|
12911
|
-
* @param {boolean}
|
|
10945
|
+
* @param {boolean} mounting
|
|
12912
10946
|
*/
|
|
12913
|
-
function select_option(select, value, mounting) {
|
|
10947
|
+
function select_option(select, value, mounting = false) {
|
|
12914
10948
|
if (select.multiple) {
|
|
12915
10949
|
// If value is null or undefined, keep the selection as is
|
|
12916
10950
|
if (value == undefined) {
|
|
@@ -12949,40 +10983,29 @@ function select_option(select, value, mounting) {
|
|
|
12949
10983
|
* current selection to the dom when it changes. Such
|
|
12950
10984
|
* changes could for example occur when options are
|
|
12951
10985
|
* inside an `#each` block.
|
|
12952
|
-
* @template V
|
|
12953
10986
|
* @param {HTMLSelectElement} select
|
|
12954
|
-
* @param {() => V} [get_value]
|
|
12955
10987
|
*/
|
|
12956
|
-
function init_select(select
|
|
12957
|
-
|
|
12958
|
-
|
|
12959
|
-
|
|
12960
|
-
|
|
12961
|
-
|
|
12962
|
-
|
|
12963
|
-
|
|
12964
|
-
var observer = new MutationObserver(() => {
|
|
12965
|
-
// @ts-ignore
|
|
12966
|
-
var value = select.__value;
|
|
12967
|
-
select_option(select, value);
|
|
12968
|
-
// Deliberately don't update the potential binding value,
|
|
12969
|
-
// the model should be preserved unless explicitly changed
|
|
12970
|
-
});
|
|
10988
|
+
function init_select(select) {
|
|
10989
|
+
var observer = new MutationObserver(() => {
|
|
10990
|
+
// @ts-ignore
|
|
10991
|
+
select_option(select, select.__value);
|
|
10992
|
+
// Deliberately don't update the potential binding value,
|
|
10993
|
+
// the model should be preserved unless explicitly changed
|
|
10994
|
+
});
|
|
12971
10995
|
|
|
12972
|
-
|
|
12973
|
-
|
|
12974
|
-
|
|
12975
|
-
|
|
12976
|
-
|
|
12977
|
-
|
|
12978
|
-
|
|
12979
|
-
|
|
12980
|
-
|
|
12981
|
-
|
|
10996
|
+
observer.observe(select, {
|
|
10997
|
+
// Listen to option element changes
|
|
10998
|
+
childList: true,
|
|
10999
|
+
subtree: true, // because of <optgroup>
|
|
11000
|
+
// Listen to option element value attribute changes
|
|
11001
|
+
// (doesn't get notified of select value changes,
|
|
11002
|
+
// because that property is not reflected as an attribute)
|
|
11003
|
+
attributes: true,
|
|
11004
|
+
attributeFilter: ['value']
|
|
11005
|
+
});
|
|
12982
11006
|
|
|
12983
|
-
|
|
12984
|
-
|
|
12985
|
-
};
|
|
11007
|
+
teardown(() => {
|
|
11008
|
+
observer.disconnect();
|
|
12986
11009
|
});
|
|
12987
11010
|
}
|
|
12988
11011
|
|
|
@@ -13290,7 +11313,7 @@ function attribute_effect(
|
|
|
13290
11313
|
var current = set_attributes(element, prev, next, css_hash, skip_warning);
|
|
13291
11314
|
|
|
13292
11315
|
if (inited && is_select && 'value' in next) {
|
|
13293
|
-
select_option(/** @type {HTMLSelectElement} */ (element), next.value
|
|
11316
|
+
select_option(/** @type {HTMLSelectElement} */ (element), next.value);
|
|
13294
11317
|
}
|
|
13295
11318
|
|
|
13296
11319
|
for (let symbol of Object.getOwnPropertySymbols(effects)) {
|
|
@@ -13312,10 +11335,12 @@ function attribute_effect(
|
|
|
13312
11335
|
});
|
|
13313
11336
|
|
|
13314
11337
|
if (is_select) {
|
|
13315
|
-
|
|
13316
|
-
|
|
13317
|
-
|
|
13318
|
-
|
|
11338
|
+
var select = /** @type {HTMLSelectElement} */ (element);
|
|
11339
|
+
|
|
11340
|
+
effect(() => {
|
|
11341
|
+
select_option(select, /** @type {Record<string | symbol, any>} */ (prev).value, true);
|
|
11342
|
+
init_select(select);
|
|
11343
|
+
});
|
|
13319
11344
|
}
|
|
13320
11345
|
|
|
13321
11346
|
inited = true;
|
|
@@ -13611,11 +11636,12 @@ function capture_store_binding(fn) {
|
|
|
13611
11636
|
}
|
|
13612
11637
|
}
|
|
13613
11638
|
|
|
13614
|
-
/** @import {
|
|
11639
|
+
/** @import { ComponentContext } from '#client' */
|
|
11640
|
+
/** @import { Derived, Effect, Source } from './types.js' */
|
|
13615
11641
|
|
|
13616
11642
|
/**
|
|
13617
11643
|
* The proxy handler for legacy $$restProps and $$props
|
|
13618
|
-
* @type {ProxyHandler<{ props: Record<string | symbol, unknown>, exclude: Array<string | symbol>, special: Record<string | symbol, (v?: unknown) => unknown>, version: Source<number
|
|
11644
|
+
* @type {ProxyHandler<{ props: Record<string | symbol, unknown>, exclude: Array<string | symbol>, special: Record<string | symbol, (v?: unknown) => unknown>, version: Source<number>, parent_effect: Effect }>}}
|
|
13619
11645
|
*/
|
|
13620
11646
|
const legacy_rest_props_handler = {
|
|
13621
11647
|
get(target, key) {
|
|
@@ -13625,17 +11651,25 @@ const legacy_rest_props_handler = {
|
|
|
13625
11651
|
},
|
|
13626
11652
|
set(target, key, value) {
|
|
13627
11653
|
if (!(key in target.special)) {
|
|
13628
|
-
|
|
13629
|
-
|
|
13630
|
-
|
|
13631
|
-
|
|
13632
|
-
|
|
13633
|
-
|
|
13634
|
-
|
|
13635
|
-
|
|
13636
|
-
|
|
13637
|
-
|
|
13638
|
-
|
|
11654
|
+
var previous_effect = active_effect;
|
|
11655
|
+
|
|
11656
|
+
try {
|
|
11657
|
+
set_active_effect(target.parent_effect);
|
|
11658
|
+
|
|
11659
|
+
// Handle props that can temporarily get out of sync with the parent
|
|
11660
|
+
/** @type {Record<string, (v?: unknown) => unknown>} */
|
|
11661
|
+
target.special[key] = prop(
|
|
11662
|
+
{
|
|
11663
|
+
get [key]() {
|
|
11664
|
+
return target.props[key];
|
|
11665
|
+
}
|
|
11666
|
+
},
|
|
11667
|
+
/** @type {string} */ (key),
|
|
11668
|
+
PROPS_IS_UPDATED
|
|
11669
|
+
);
|
|
11670
|
+
} finally {
|
|
11671
|
+
set_active_effect(previous_effect);
|
|
11672
|
+
}
|
|
13639
11673
|
}
|
|
13640
11674
|
|
|
13641
11675
|
target.special[key](value);
|
|
@@ -13674,7 +11708,19 @@ const legacy_rest_props_handler = {
|
|
|
13674
11708
|
* @returns {Record<string, unknown>}
|
|
13675
11709
|
*/
|
|
13676
11710
|
function legacy_rest_props(props, exclude) {
|
|
13677
|
-
return new Proxy(
|
|
11711
|
+
return new Proxy(
|
|
11712
|
+
{
|
|
11713
|
+
props,
|
|
11714
|
+
exclude,
|
|
11715
|
+
special: {},
|
|
11716
|
+
version: source(0),
|
|
11717
|
+
// TODO this is only necessary because we need to track component
|
|
11718
|
+
// destruction inside `prop`, because of `bind:this`, but it
|
|
11719
|
+
// seems likely that we can simplify `bind:this` instead
|
|
11720
|
+
parent_effect: /** @type {Effect} */ (active_effect)
|
|
11721
|
+
},
|
|
11722
|
+
legacy_rest_props_handler
|
|
11723
|
+
);
|
|
13678
11724
|
}
|
|
13679
11725
|
|
|
13680
11726
|
/**
|
|
@@ -13763,14 +11809,6 @@ function spread_props(...props) {
|
|
|
13763
11809
|
return new Proxy({ props }, spread_props_handler);
|
|
13764
11810
|
}
|
|
13765
11811
|
|
|
13766
|
-
/**
|
|
13767
|
-
* @param {Derived} current_value
|
|
13768
|
-
* @returns {boolean}
|
|
13769
|
-
*/
|
|
13770
|
-
function has_destroyed_component_ctx(current_value) {
|
|
13771
|
-
return current_value.ctx?.d ?? false;
|
|
13772
|
-
}
|
|
13773
|
-
|
|
13774
11812
|
/**
|
|
13775
11813
|
* This function is responsible for synchronizing a possibly bound prop with the inner component state.
|
|
13776
11814
|
* It is used whenever the compiler sees that the component writes to the prop, or when it has a default prop_value.
|
|
@@ -13782,89 +11820,92 @@ function has_destroyed_component_ctx(current_value) {
|
|
|
13782
11820
|
* @returns {(() => V | ((arg: V) => V) | ((arg: V, mutation: boolean) => V))}
|
|
13783
11821
|
*/
|
|
13784
11822
|
function prop(props, key, flags, fallback) {
|
|
13785
|
-
var immutable = (flags & PROPS_IS_IMMUTABLE) !== 0;
|
|
13786
11823
|
var runes = !legacy_mode_flag || (flags & PROPS_IS_RUNES) !== 0;
|
|
13787
11824
|
var bindable = (flags & PROPS_IS_BINDABLE) !== 0;
|
|
13788
|
-
var lazy = (flags & PROPS_IS_LAZY_INITIAL) !== 0;
|
|
13789
|
-
var is_store_sub = false;
|
|
13790
|
-
var prop_value;
|
|
13791
|
-
|
|
13792
|
-
if (bindable) {
|
|
13793
|
-
[prop_value, is_store_sub] = capture_store_binding(() => /** @type {V} */ (props[key]));
|
|
13794
|
-
} else {
|
|
13795
|
-
prop_value = /** @type {V} */ (props[key]);
|
|
13796
|
-
}
|
|
13797
|
-
|
|
13798
|
-
// Can be the case when someone does `mount(Component, props)` with `let props = $state({...})`
|
|
13799
|
-
// or `createClassComponent(Component, props)`
|
|
13800
|
-
var is_entry_props = STATE_SYMBOL in props || LEGACY_PROPS in props;
|
|
13801
|
-
|
|
13802
|
-
var setter =
|
|
13803
|
-
(bindable &&
|
|
13804
|
-
(get_descriptor(props, key)?.set ??
|
|
13805
|
-
(is_entry_props && key in props && ((v) => (props[key] = v))))) ||
|
|
13806
|
-
undefined;
|
|
11825
|
+
var lazy = (flags & PROPS_IS_LAZY_INITIAL) !== 0;
|
|
13807
11826
|
|
|
13808
11827
|
var fallback_value = /** @type {V} */ (fallback);
|
|
13809
11828
|
var fallback_dirty = true;
|
|
13810
|
-
var fallback_used = false;
|
|
13811
11829
|
|
|
13812
11830
|
var get_fallback = () => {
|
|
13813
|
-
fallback_used = true;
|
|
13814
11831
|
if (fallback_dirty) {
|
|
13815
11832
|
fallback_dirty = false;
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
|
|
13819
|
-
|
|
13820
|
-
}
|
|
11833
|
+
|
|
11834
|
+
fallback_value = lazy
|
|
11835
|
+
? untrack(/** @type {() => V} */ (fallback))
|
|
11836
|
+
: /** @type {V} */ (fallback);
|
|
13821
11837
|
}
|
|
13822
11838
|
|
|
13823
11839
|
return fallback_value;
|
|
13824
11840
|
};
|
|
13825
11841
|
|
|
13826
|
-
|
|
13827
|
-
|
|
13828
|
-
|
|
13829
|
-
|
|
11842
|
+
/** @type {((v: V) => void) | undefined} */
|
|
11843
|
+
var setter;
|
|
11844
|
+
|
|
11845
|
+
if (bindable) {
|
|
11846
|
+
// Can be the case when someone does `mount(Component, props)` with `let props = $state({...})`
|
|
11847
|
+
// or `createClassComponent(Component, props)`
|
|
11848
|
+
var is_entry_props = STATE_SYMBOL in props || LEGACY_PROPS in props;
|
|
11849
|
+
|
|
11850
|
+
setter =
|
|
11851
|
+
get_descriptor(props, key)?.set ??
|
|
11852
|
+
(is_entry_props && key in props ? (v) => (props[key] = v) : undefined);
|
|
11853
|
+
}
|
|
11854
|
+
|
|
11855
|
+
var initial_value;
|
|
11856
|
+
var is_store_sub = false;
|
|
11857
|
+
|
|
11858
|
+
if (bindable) {
|
|
11859
|
+
[initial_value, is_store_sub] = capture_store_binding(() => /** @type {V} */ (props[key]));
|
|
11860
|
+
} else {
|
|
11861
|
+
initial_value = /** @type {V} */ (props[key]);
|
|
11862
|
+
}
|
|
11863
|
+
|
|
11864
|
+
if (initial_value === undefined && fallback !== undefined) {
|
|
11865
|
+
initial_value = get_fallback();
|
|
13830
11866
|
|
|
13831
|
-
|
|
13832
|
-
|
|
11867
|
+
if (setter) {
|
|
11868
|
+
if (runes) props_invalid_value();
|
|
11869
|
+
setter(initial_value);
|
|
11870
|
+
}
|
|
13833
11871
|
}
|
|
13834
11872
|
|
|
13835
11873
|
/** @type {() => V} */
|
|
13836
11874
|
var getter;
|
|
11875
|
+
|
|
13837
11876
|
if (runes) {
|
|
13838
11877
|
getter = () => {
|
|
13839
11878
|
var value = /** @type {V} */ (props[key]);
|
|
13840
11879
|
if (value === undefined) return get_fallback();
|
|
13841
11880
|
fallback_dirty = true;
|
|
13842
|
-
fallback_used = false;
|
|
13843
11881
|
return value;
|
|
13844
11882
|
};
|
|
13845
11883
|
} else {
|
|
13846
|
-
// Svelte 4 did not trigger updates when a primitive value was updated to the same value.
|
|
13847
|
-
// Replicate that behavior through using a derived
|
|
13848
|
-
var derived_getter = (immutable ? derived : derived_safe_equal)(
|
|
13849
|
-
() => /** @type {V} */ (props[key])
|
|
13850
|
-
);
|
|
13851
|
-
derived_getter.f |= LEGACY_DERIVED_PROP;
|
|
13852
11884
|
getter = () => {
|
|
13853
|
-
var value =
|
|
13854
|
-
|
|
11885
|
+
var value = /** @type {V} */ (props[key]);
|
|
11886
|
+
|
|
11887
|
+
if (value !== undefined) {
|
|
11888
|
+
// in legacy mode, we don't revert to the fallback value
|
|
11889
|
+
// if the prop goes from defined to undefined. The easiest
|
|
11890
|
+
// way to model this is to make the fallback undefined
|
|
11891
|
+
// as soon as the prop has a value
|
|
11892
|
+
fallback_value = /** @type {V} */ (undefined);
|
|
11893
|
+
}
|
|
11894
|
+
|
|
13855
11895
|
return value === undefined ? fallback_value : value;
|
|
13856
11896
|
};
|
|
13857
11897
|
}
|
|
13858
11898
|
|
|
13859
|
-
//
|
|
13860
|
-
if ((flags & PROPS_IS_UPDATED) === 0
|
|
11899
|
+
// prop is never written to — we only need a getter
|
|
11900
|
+
if (runes && (flags & PROPS_IS_UPDATED) === 0) {
|
|
13861
11901
|
return getter;
|
|
13862
11902
|
}
|
|
13863
11903
|
|
|
13864
|
-
//
|
|
13865
|
-
//
|
|
11904
|
+
// prop is written to, but the parent component had `bind:foo` which
|
|
11905
|
+
// means we can just call `$$props.foo = value` directly
|
|
13866
11906
|
if (setter) {
|
|
13867
11907
|
var legacy_parent = props.$$legacy;
|
|
11908
|
+
|
|
13868
11909
|
return function (/** @type {any} */ value, /** @type {boolean} */ mutation) {
|
|
13869
11910
|
if (arguments.length > 0) {
|
|
13870
11911
|
// We don't want to notify if the value was mutated and the parent is in runes mode.
|
|
@@ -13874,83 +11915,54 @@ function prop(props, key, flags, fallback) {
|
|
|
13874
11915
|
if (!runes || !mutation || legacy_parent || is_store_sub) {
|
|
13875
11916
|
/** @type {Function} */ (setter)(mutation ? getter() : value);
|
|
13876
11917
|
}
|
|
11918
|
+
|
|
13877
11919
|
return value;
|
|
13878
|
-
} else {
|
|
13879
|
-
return getter();
|
|
13880
11920
|
}
|
|
11921
|
+
|
|
11922
|
+
return getter();
|
|
13881
11923
|
};
|
|
13882
11924
|
}
|
|
13883
11925
|
|
|
13884
|
-
//
|
|
13885
|
-
//
|
|
13886
|
-
//
|
|
13887
|
-
|
|
13888
|
-
var
|
|
13889
|
-
|
|
13890
|
-
// The derived returns the current value. The underlying mutable
|
|
13891
|
-
// source is written to from various places to persist this value.
|
|
13892
|
-
var inner_current_value = mutable_source(prop_value);
|
|
13893
|
-
var current_value = derived(() => {
|
|
13894
|
-
var parent_value = getter();
|
|
13895
|
-
var child_value = get(inner_current_value);
|
|
13896
|
-
|
|
13897
|
-
if (from_child) {
|
|
13898
|
-
from_child = false;
|
|
13899
|
-
was_from_child = true;
|
|
13900
|
-
return child_value;
|
|
13901
|
-
}
|
|
11926
|
+
// Either prop is written to, but there's no binding, which means we
|
|
11927
|
+
// create a derived that we can write to locally.
|
|
11928
|
+
// Or we are in legacy mode where we always create a derived to replicate that
|
|
11929
|
+
// Svelte 4 did not trigger updates when a primitive value was updated to the same value.
|
|
11930
|
+
var overridden = false;
|
|
13902
11931
|
|
|
13903
|
-
|
|
13904
|
-
|
|
11932
|
+
var d = ((flags & PROPS_IS_IMMUTABLE) !== 0 ? derived : derived_safe_equal)(() => {
|
|
11933
|
+
overridden = false;
|
|
11934
|
+
return getter();
|
|
13905
11935
|
});
|
|
13906
11936
|
|
|
13907
|
-
//
|
|
13908
|
-
if (bindable)
|
|
13909
|
-
get(current_value);
|
|
13910
|
-
}
|
|
11937
|
+
// Capture the initial value if it's bindable
|
|
11938
|
+
if (bindable) get(d);
|
|
13911
11939
|
|
|
13912
|
-
|
|
11940
|
+
var parent_effect = /** @type {Effect} */ (active_effect);
|
|
13913
11941
|
|
|
13914
11942
|
return function (/** @type {any} */ value, /** @type {boolean} */ mutation) {
|
|
13915
|
-
// legacy nonsense — need to ensure the source is invalidated when necessary
|
|
13916
|
-
// also needed for when handling inspect logic so we can inspect the correct source signal
|
|
13917
|
-
if (captured_signals !== null) {
|
|
13918
|
-
// set this so that we don't reset to the parent value if `d`
|
|
13919
|
-
// is invalidated because of `invalidate_inner_signals` (rather
|
|
13920
|
-
// than because the parent or child value changed)
|
|
13921
|
-
from_child = was_from_child;
|
|
13922
|
-
// invoke getters so that signals are picked up by `invalidate_inner_signals`
|
|
13923
|
-
getter();
|
|
13924
|
-
get(inner_current_value);
|
|
13925
|
-
}
|
|
13926
|
-
|
|
13927
11943
|
if (arguments.length > 0) {
|
|
13928
|
-
const new_value = mutation ? get(
|
|
13929
|
-
|
|
13930
|
-
if (!current_value.equals(new_value)) {
|
|
13931
|
-
from_child = true;
|
|
13932
|
-
set(inner_current_value, new_value);
|
|
13933
|
-
// To ensure the fallback value is consistent when used with proxies, we
|
|
13934
|
-
// update the local fallback_value, but only if the fallback is actively used
|
|
13935
|
-
if (fallback_used && fallback_value !== undefined) {
|
|
13936
|
-
fallback_value = new_value;
|
|
13937
|
-
}
|
|
11944
|
+
const new_value = mutation ? get(d) : runes && bindable ? proxy(value) : value;
|
|
13938
11945
|
|
|
13939
|
-
|
|
13940
|
-
|
|
13941
|
-
}
|
|
11946
|
+
set(d, new_value);
|
|
11947
|
+
overridden = true;
|
|
13942
11948
|
|
|
13943
|
-
|
|
11949
|
+
if (fallback_value !== undefined) {
|
|
11950
|
+
fallback_value = new_value;
|
|
13944
11951
|
}
|
|
13945
11952
|
|
|
13946
11953
|
return value;
|
|
13947
11954
|
}
|
|
13948
11955
|
|
|
13949
|
-
if
|
|
13950
|
-
|
|
11956
|
+
// special case — avoid recalculating the derived if we're in a
|
|
11957
|
+
// teardown function and the prop was overridden locally, or the
|
|
11958
|
+
// component was already destroyed (this latter part is necessary
|
|
11959
|
+
// because `bind:this` can read props after the component has
|
|
11960
|
+
// been destroyed. TODO simplify `bind:this`
|
|
11961
|
+
if ((is_destroying_effect && overridden) || (parent_effect.f & DESTROYED) !== 0) {
|
|
11962
|
+
return d.v;
|
|
13951
11963
|
}
|
|
13952
11964
|
|
|
13953
|
-
return get(
|
|
11965
|
+
return get(d);
|
|
13954
11966
|
};
|
|
13955
11967
|
}
|
|
13956
11968
|
|
|
@@ -14015,11 +12027,7 @@ function Block_catalog($$anchor, $$props) {
|
|
|
14015
12027
|
var consequent = ($$anchor) => {
|
|
14016
12028
|
var img = root_4$3();
|
|
14017
12029
|
|
|
14018
|
-
template_effect(() => set_attribute(img, 'src', (
|
|
14019
|
-
blockInfo(),
|
|
14020
|
-
untrack(() => blockInfo().img)
|
|
14021
|
-
)));
|
|
14022
|
-
|
|
12030
|
+
template_effect(() => set_attribute(img, 'src', (blockInfo(), untrack(() => blockInfo().img))));
|
|
14023
12031
|
append($$anchor, img);
|
|
14024
12032
|
};
|
|
14025
12033
|
|
|
@@ -14029,21 +12037,14 @@ function Block_catalog($$anchor, $$props) {
|
|
|
14029
12037
|
var fragment_1 = comment();
|
|
14030
12038
|
var node_2 = first_child(fragment_1);
|
|
14031
12039
|
|
|
14032
|
-
html(node_2, () => (
|
|
14033
|
-
blockInfo(),
|
|
14034
|
-
untrack(() => blockInfo().svg)
|
|
14035
|
-
));
|
|
14036
|
-
|
|
12040
|
+
html(node_2, () => (blockInfo(), untrack(() => blockInfo().svg)));
|
|
14037
12041
|
append($$anchor, fragment_1);
|
|
14038
12042
|
};
|
|
14039
12043
|
|
|
14040
12044
|
if_block(
|
|
14041
12045
|
$$anchor,
|
|
14042
12046
|
($$render) => {
|
|
14043
|
-
if ((
|
|
14044
|
-
blockInfo(),
|
|
14045
|
-
untrack(() => blockInfo().svg)
|
|
14046
|
-
)) $$render(consequent_1);
|
|
12047
|
+
if ((blockInfo(), untrack(() => blockInfo().svg))) $$render(consequent_1);
|
|
14047
12048
|
},
|
|
14048
12049
|
$$elseif
|
|
14049
12050
|
);
|
|
@@ -14051,32 +12052,20 @@ function Block_catalog($$anchor, $$props) {
|
|
|
14051
12052
|
};
|
|
14052
12053
|
|
|
14053
12054
|
if_block(node_1, ($$render) => {
|
|
14054
|
-
if ((
|
|
14055
|
-
blockInfo(),
|
|
14056
|
-
untrack(() => blockInfo().img)
|
|
14057
|
-
)) $$render(consequent); else $$render(alternate, false);
|
|
12055
|
+
if ((blockInfo(), untrack(() => blockInfo().img))) $$render(consequent); else $$render(alternate, false);
|
|
14058
12056
|
});
|
|
14059
12057
|
}
|
|
14060
12058
|
|
|
14061
12059
|
var figcaption = sibling(div_2, 2);
|
|
14062
12060
|
var text_1 = child(figcaption);
|
|
14063
|
-
|
|
14064
|
-
template_effect(() => set_text(text_1, (
|
|
14065
|
-
blockInfo(),
|
|
14066
|
-
untrack(() => blockInfo().label)
|
|
14067
|
-
)));
|
|
14068
|
-
|
|
12061
|
+
template_effect(() => set_text(text_1, (blockInfo(), untrack(() => blockInfo().label))));
|
|
14069
12062
|
append($$anchor, figure);
|
|
14070
12063
|
};
|
|
14071
12064
|
|
|
14072
12065
|
var alternate_1 = ($$anchor) => {
|
|
14073
12066
|
var text_2 = text();
|
|
14074
12067
|
|
|
14075
|
-
template_effect(() => set_text(text_2, (
|
|
14076
|
-
blockInfo(),
|
|
14077
|
-
untrack(() => blockInfo().label)
|
|
14078
|
-
)));
|
|
14079
|
-
|
|
12068
|
+
template_effect(() => set_text(text_2, (blockInfo(), untrack(() => blockInfo().label))));
|
|
14080
12069
|
append($$anchor, text_2);
|
|
14081
12070
|
};
|
|
14082
12071
|
|
|
@@ -14123,21 +12112,8 @@ const defaultAttributes = {
|
|
|
14123
12112
|
var root$a = from_svg(`<svg><!><!></svg>`);
|
|
14124
12113
|
|
|
14125
12114
|
function Icon($$anchor, $$props) {
|
|
14126
|
-
const $$sanitized_props = legacy_rest_props($$props, [
|
|
14127
|
-
|
|
14128
|
-
'$$slots',
|
|
14129
|
-
'$$events',
|
|
14130
|
-
'$$legacy'
|
|
14131
|
-
]);
|
|
14132
|
-
|
|
14133
|
-
const $$restProps = legacy_rest_props($$sanitized_props, [
|
|
14134
|
-
'type',
|
|
14135
|
-
'name',
|
|
14136
|
-
'color',
|
|
14137
|
-
'size',
|
|
14138
|
-
'stroke',
|
|
14139
|
-
'iconNode'
|
|
14140
|
-
]);
|
|
12115
|
+
const $$sanitized_props = legacy_rest_props($$props, ['children', '$$slots', '$$events', '$$legacy']);
|
|
12116
|
+
const $$restProps = legacy_rest_props($$sanitized_props, ['type', 'name', 'color', 'size', 'stroke', 'iconNode']);
|
|
14141
12117
|
|
|
14142
12118
|
push($$props, false);
|
|
14143
12119
|
|
|
@@ -14157,17 +12133,16 @@ function Icon($$anchor, $$props) {
|
|
|
14157
12133
|
...$$restProps,
|
|
14158
12134
|
width: size(),
|
|
14159
12135
|
height: size(),
|
|
12136
|
+
|
|
14160
12137
|
class: (
|
|
14161
12138
|
deep_read_state(name()),
|
|
14162
12139
|
deep_read_state($$sanitized_props),
|
|
14163
12140
|
untrack(() => `tabler-icon tabler-icon-${name()} ${$$sanitized_props.class ?? ''}`)
|
|
14164
12141
|
),
|
|
12142
|
+
|
|
14165
12143
|
...type() === 'filled'
|
|
14166
12144
|
? { fill: color() }
|
|
14167
|
-
: {
|
|
14168
|
-
'stroke-width': stroke(),
|
|
14169
|
-
stroke: color()
|
|
14170
|
-
}
|
|
12145
|
+
: { 'stroke-width': stroke(), stroke: color() }
|
|
14171
12146
|
}));
|
|
14172
12147
|
|
|
14173
12148
|
var node = child(svg);
|
|
@@ -14194,20 +12169,17 @@ function Icon($$anchor, $$props) {
|
|
|
14194
12169
|
}
|
|
14195
12170
|
|
|
14196
12171
|
function Arrow_big_down_line($$anchor, $$props) {
|
|
14197
|
-
const $$sanitized_props = legacy_rest_props($$props, [
|
|
14198
|
-
'children',
|
|
14199
|
-
'$$slots',
|
|
14200
|
-
'$$events',
|
|
14201
|
-
'$$legacy'
|
|
14202
|
-
]);
|
|
12172
|
+
const $$sanitized_props = legacy_rest_props($$props, ['children', '$$slots', '$$events', '$$legacy']);
|
|
14203
12173
|
|
|
14204
12174
|
const iconNode = [
|
|
14205
12175
|
[
|
|
14206
12176
|
"path",
|
|
12177
|
+
|
|
14207
12178
|
{
|
|
14208
12179
|
"d": "M15 12h3.586a1 1 0 0 1 .707 1.707l-6.586 6.586a1 1 0 0 1 -1.414 0l-6.586 -6.586a1 1 0 0 1 .707 -1.707h3.586v-6h6v6z"
|
|
14209
12180
|
}
|
|
14210
12181
|
],
|
|
12182
|
+
|
|
14211
12183
|
["path", { "d": "M15 3h-6" }]
|
|
14212
12184
|
];
|
|
14213
12185
|
|
|
@@ -14215,6 +12187,7 @@ function Arrow_big_down_line($$anchor, $$props) {
|
|
|
14215
12187
|
get iconNode() {
|
|
14216
12188
|
return iconNode;
|
|
14217
12189
|
},
|
|
12190
|
+
|
|
14218
12191
|
children: ($$anchor, $$slotProps) => {
|
|
14219
12192
|
var fragment_1 = comment();
|
|
14220
12193
|
var node = first_child(fragment_1);
|
|
@@ -14222,25 +12195,23 @@ function Arrow_big_down_line($$anchor, $$props) {
|
|
|
14222
12195
|
slot(node, $$props, 'default', {});
|
|
14223
12196
|
append($$anchor, fragment_1);
|
|
14224
12197
|
},
|
|
12198
|
+
|
|
14225
12199
|
$$slots: { default: true }
|
|
14226
12200
|
}));
|
|
14227
12201
|
}
|
|
14228
12202
|
|
|
14229
12203
|
function Arrow_big_up_line($$anchor, $$props) {
|
|
14230
|
-
const $$sanitized_props = legacy_rest_props($$props, [
|
|
14231
|
-
'children',
|
|
14232
|
-
'$$slots',
|
|
14233
|
-
'$$events',
|
|
14234
|
-
'$$legacy'
|
|
14235
|
-
]);
|
|
12204
|
+
const $$sanitized_props = legacy_rest_props($$props, ['children', '$$slots', '$$events', '$$legacy']);
|
|
14236
12205
|
|
|
14237
12206
|
const iconNode = [
|
|
14238
12207
|
[
|
|
14239
12208
|
"path",
|
|
12209
|
+
|
|
14240
12210
|
{
|
|
14241
12211
|
"d": "M9 12h-3.586a1 1 0 0 1 -.707 -1.707l6.586 -6.586a1 1 0 0 1 1.414 0l6.586 6.586a1 1 0 0 1 -.707 1.707h-3.586v6h-6v-6z"
|
|
14242
12212
|
}
|
|
14243
12213
|
],
|
|
12214
|
+
|
|
14244
12215
|
["path", { "d": "M9 21h6" }]
|
|
14245
12216
|
];
|
|
14246
12217
|
|
|
@@ -14248,6 +12219,7 @@ function Arrow_big_up_line($$anchor, $$props) {
|
|
|
14248
12219
|
get iconNode() {
|
|
14249
12220
|
return iconNode;
|
|
14250
12221
|
},
|
|
12222
|
+
|
|
14251
12223
|
children: ($$anchor, $$slotProps) => {
|
|
14252
12224
|
var fragment_1 = comment();
|
|
14253
12225
|
var node = first_child(fragment_1);
|
|
@@ -14255,31 +12227,31 @@ function Arrow_big_up_line($$anchor, $$props) {
|
|
|
14255
12227
|
slot(node, $$props, 'default', {});
|
|
14256
12228
|
append($$anchor, fragment_1);
|
|
14257
12229
|
},
|
|
12230
|
+
|
|
14258
12231
|
$$slots: { default: true }
|
|
14259
12232
|
}));
|
|
14260
12233
|
}
|
|
14261
12234
|
|
|
14262
12235
|
function Clipboard_plus($$anchor, $$props) {
|
|
14263
|
-
const $$sanitized_props = legacy_rest_props($$props, [
|
|
14264
|
-
'children',
|
|
14265
|
-
'$$slots',
|
|
14266
|
-
'$$events',
|
|
14267
|
-
'$$legacy'
|
|
14268
|
-
]);
|
|
12236
|
+
const $$sanitized_props = legacy_rest_props($$props, ['children', '$$slots', '$$events', '$$legacy']);
|
|
14269
12237
|
|
|
14270
12238
|
const iconNode = [
|
|
14271
12239
|
[
|
|
14272
12240
|
"path",
|
|
12241
|
+
|
|
14273
12242
|
{
|
|
14274
12243
|
"d": "M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2"
|
|
14275
12244
|
}
|
|
14276
12245
|
],
|
|
12246
|
+
|
|
14277
12247
|
[
|
|
14278
12248
|
"path",
|
|
12249
|
+
|
|
14279
12250
|
{
|
|
14280
12251
|
"d": "M9 3m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v0a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z"
|
|
14281
12252
|
}
|
|
14282
12253
|
],
|
|
12254
|
+
|
|
14283
12255
|
["path", { "d": "M10 14h4" }],
|
|
14284
12256
|
["path", { "d": "M12 12v4" }]
|
|
14285
12257
|
];
|
|
@@ -14288,6 +12260,7 @@ function Clipboard_plus($$anchor, $$props) {
|
|
|
14288
12260
|
get iconNode() {
|
|
14289
12261
|
return iconNode;
|
|
14290
12262
|
},
|
|
12263
|
+
|
|
14291
12264
|
children: ($$anchor, $$slotProps) => {
|
|
14292
12265
|
var fragment_1 = comment();
|
|
14293
12266
|
var node = first_child(fragment_1);
|
|
@@ -14295,37 +12268,39 @@ function Clipboard_plus($$anchor, $$props) {
|
|
|
14295
12268
|
slot(node, $$props, 'default', {});
|
|
14296
12269
|
append($$anchor, fragment_1);
|
|
14297
12270
|
},
|
|
12271
|
+
|
|
14298
12272
|
$$slots: { default: true }
|
|
14299
12273
|
}));
|
|
14300
12274
|
}
|
|
14301
12275
|
|
|
14302
12276
|
function Layout_grid_add($$anchor, $$props) {
|
|
14303
|
-
const $$sanitized_props = legacy_rest_props($$props, [
|
|
14304
|
-
'children',
|
|
14305
|
-
'$$slots',
|
|
14306
|
-
'$$events',
|
|
14307
|
-
'$$legacy'
|
|
14308
|
-
]);
|
|
12277
|
+
const $$sanitized_props = legacy_rest_props($$props, ['children', '$$slots', '$$events', '$$legacy']);
|
|
14309
12278
|
|
|
14310
12279
|
const iconNode = [
|
|
14311
12280
|
[
|
|
14312
12281
|
"path",
|
|
12282
|
+
|
|
14313
12283
|
{
|
|
14314
12284
|
"d": "M4 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z"
|
|
14315
12285
|
}
|
|
14316
12286
|
],
|
|
12287
|
+
|
|
14317
12288
|
[
|
|
14318
12289
|
"path",
|
|
12290
|
+
|
|
14319
12291
|
{
|
|
14320
12292
|
"d": "M14 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z"
|
|
14321
12293
|
}
|
|
14322
12294
|
],
|
|
12295
|
+
|
|
14323
12296
|
[
|
|
14324
12297
|
"path",
|
|
12298
|
+
|
|
14325
12299
|
{
|
|
14326
12300
|
"d": "M4 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z"
|
|
14327
12301
|
}
|
|
14328
12302
|
],
|
|
12303
|
+
|
|
14329
12304
|
["path", { "d": "M14 17h6m-3 -3v6" }]
|
|
14330
12305
|
];
|
|
14331
12306
|
|
|
@@ -14333,6 +12308,7 @@ function Layout_grid_add($$anchor, $$props) {
|
|
|
14333
12308
|
get iconNode() {
|
|
14334
12309
|
return iconNode;
|
|
14335
12310
|
},
|
|
12311
|
+
|
|
14336
12312
|
children: ($$anchor, $$slotProps) => {
|
|
14337
12313
|
var fragment_1 = comment();
|
|
14338
12314
|
var node = first_child(fragment_1);
|
|
@@ -14340,37 +12316,39 @@ function Layout_grid_add($$anchor, $$props) {
|
|
|
14340
12316
|
slot(node, $$props, 'default', {});
|
|
14341
12317
|
append($$anchor, fragment_1);
|
|
14342
12318
|
},
|
|
12319
|
+
|
|
14343
12320
|
$$slots: { default: true }
|
|
14344
12321
|
}));
|
|
14345
12322
|
}
|
|
14346
12323
|
|
|
14347
12324
|
function Layout_grid_remove($$anchor, $$props) {
|
|
14348
|
-
const $$sanitized_props = legacy_rest_props($$props, [
|
|
14349
|
-
'children',
|
|
14350
|
-
'$$slots',
|
|
14351
|
-
'$$events',
|
|
14352
|
-
'$$legacy'
|
|
14353
|
-
]);
|
|
12325
|
+
const $$sanitized_props = legacy_rest_props($$props, ['children', '$$slots', '$$events', '$$legacy']);
|
|
14354
12326
|
|
|
14355
12327
|
const iconNode = [
|
|
14356
12328
|
[
|
|
14357
12329
|
"path",
|
|
12330
|
+
|
|
14358
12331
|
{
|
|
14359
12332
|
"d": "M4 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-4z"
|
|
14360
12333
|
}
|
|
14361
12334
|
],
|
|
12335
|
+
|
|
14362
12336
|
[
|
|
14363
12337
|
"path",
|
|
12338
|
+
|
|
14364
12339
|
{
|
|
14365
12340
|
"d": "M14 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-4z"
|
|
14366
12341
|
}
|
|
14367
12342
|
],
|
|
12343
|
+
|
|
14368
12344
|
[
|
|
14369
12345
|
"path",
|
|
12346
|
+
|
|
14370
12347
|
{
|
|
14371
12348
|
"d": "M4 15a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-4z"
|
|
14372
12349
|
}
|
|
14373
12350
|
],
|
|
12351
|
+
|
|
14374
12352
|
["path", { "d": "M14 17h6" }]
|
|
14375
12353
|
];
|
|
14376
12354
|
|
|
@@ -14378,6 +12356,7 @@ function Layout_grid_remove($$anchor, $$props) {
|
|
|
14378
12356
|
get iconNode() {
|
|
14379
12357
|
return iconNode;
|
|
14380
12358
|
},
|
|
12359
|
+
|
|
14381
12360
|
children: ($$anchor, $$slotProps) => {
|
|
14382
12361
|
var fragment_1 = comment();
|
|
14383
12362
|
var node = first_child(fragment_1);
|
|
@@ -14385,25 +12364,23 @@ function Layout_grid_remove($$anchor, $$props) {
|
|
|
14385
12364
|
slot(node, $$props, 'default', {});
|
|
14386
12365
|
append($$anchor, fragment_1);
|
|
14387
12366
|
},
|
|
12367
|
+
|
|
14388
12368
|
$$slots: { default: true }
|
|
14389
12369
|
}));
|
|
14390
12370
|
}
|
|
14391
12371
|
|
|
14392
12372
|
function Row_insert_bottom($$anchor, $$props) {
|
|
14393
|
-
const $$sanitized_props = legacy_rest_props($$props, [
|
|
14394
|
-
'children',
|
|
14395
|
-
'$$slots',
|
|
14396
|
-
'$$events',
|
|
14397
|
-
'$$legacy'
|
|
14398
|
-
]);
|
|
12373
|
+
const $$sanitized_props = legacy_rest_props($$props, ['children', '$$slots', '$$events', '$$legacy']);
|
|
14399
12374
|
|
|
14400
12375
|
const iconNode = [
|
|
14401
12376
|
[
|
|
14402
12377
|
"path",
|
|
12378
|
+
|
|
14403
12379
|
{
|
|
14404
12380
|
"d": "M20 6v4a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1z"
|
|
14405
12381
|
}
|
|
14406
12382
|
],
|
|
12383
|
+
|
|
14407
12384
|
["path", { "d": "M12 15l0 4" }],
|
|
14408
12385
|
["path", { "d": "M14 17l-4 0" }]
|
|
14409
12386
|
];
|
|
@@ -14412,6 +12389,7 @@ function Row_insert_bottom($$anchor, $$props) {
|
|
|
14412
12389
|
get iconNode() {
|
|
14413
12390
|
return iconNode;
|
|
14414
12391
|
},
|
|
12392
|
+
|
|
14415
12393
|
children: ($$anchor, $$slotProps) => {
|
|
14416
12394
|
var fragment_1 = comment();
|
|
14417
12395
|
var node = first_child(fragment_1);
|
|
@@ -14419,25 +12397,23 @@ function Row_insert_bottom($$anchor, $$props) {
|
|
|
14419
12397
|
slot(node, $$props, 'default', {});
|
|
14420
12398
|
append($$anchor, fragment_1);
|
|
14421
12399
|
},
|
|
12400
|
+
|
|
14422
12401
|
$$slots: { default: true }
|
|
14423
12402
|
}));
|
|
14424
12403
|
}
|
|
14425
12404
|
|
|
14426
12405
|
function Row_insert_top($$anchor, $$props) {
|
|
14427
|
-
const $$sanitized_props = legacy_rest_props($$props, [
|
|
14428
|
-
'children',
|
|
14429
|
-
'$$slots',
|
|
14430
|
-
'$$events',
|
|
14431
|
-
'$$legacy'
|
|
14432
|
-
]);
|
|
12406
|
+
const $$sanitized_props = legacy_rest_props($$props, ['children', '$$slots', '$$events', '$$legacy']);
|
|
14433
12407
|
|
|
14434
12408
|
const iconNode = [
|
|
14435
12409
|
[
|
|
14436
12410
|
"path",
|
|
12411
|
+
|
|
14437
12412
|
{
|
|
14438
12413
|
"d": "M4 18v-4a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1z"
|
|
14439
12414
|
}
|
|
14440
12415
|
],
|
|
12416
|
+
|
|
14441
12417
|
["path", { "d": "M12 9v-4" }],
|
|
14442
12418
|
["path", { "d": "M10 7l4 0" }]
|
|
14443
12419
|
];
|
|
@@ -14446,6 +12422,7 @@ function Row_insert_top($$anchor, $$props) {
|
|
|
14446
12422
|
get iconNode() {
|
|
14447
12423
|
return iconNode;
|
|
14448
12424
|
},
|
|
12425
|
+
|
|
14449
12426
|
children: ($$anchor, $$slotProps) => {
|
|
14450
12427
|
var fragment_1 = comment();
|
|
14451
12428
|
var node = first_child(fragment_1);
|
|
@@ -14453,35 +12430,31 @@ function Row_insert_top($$anchor, $$props) {
|
|
|
14453
12430
|
slot(node, $$props, 'default', {});
|
|
14454
12431
|
append($$anchor, fragment_1);
|
|
14455
12432
|
},
|
|
12433
|
+
|
|
14456
12434
|
$$slots: { default: true }
|
|
14457
12435
|
}));
|
|
14458
12436
|
}
|
|
14459
12437
|
|
|
14460
12438
|
function Settings($$anchor, $$props) {
|
|
14461
|
-
const $$sanitized_props = legacy_rest_props($$props, [
|
|
14462
|
-
'children',
|
|
14463
|
-
'$$slots',
|
|
14464
|
-
'$$events',
|
|
14465
|
-
'$$legacy'
|
|
14466
|
-
]);
|
|
12439
|
+
const $$sanitized_props = legacy_rest_props($$props, ['children', '$$slots', '$$events', '$$legacy']);
|
|
14467
12440
|
|
|
14468
12441
|
const iconNode = [
|
|
14469
12442
|
[
|
|
14470
12443
|
"path",
|
|
12444
|
+
|
|
14471
12445
|
{
|
|
14472
12446
|
"d": "M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z"
|
|
14473
12447
|
}
|
|
14474
12448
|
],
|
|
14475
|
-
|
|
14476
|
-
|
|
14477
|
-
{ "d": "M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0" }
|
|
14478
|
-
]
|
|
12449
|
+
|
|
12450
|
+
["path", { "d": "M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0" }]
|
|
14479
12451
|
];
|
|
14480
12452
|
|
|
14481
12453
|
Icon($$anchor, spread_props({ type: 'outline', name: 'settings' }, () => $$sanitized_props, {
|
|
14482
12454
|
get iconNode() {
|
|
14483
12455
|
return iconNode;
|
|
14484
12456
|
},
|
|
12457
|
+
|
|
14485
12458
|
children: ($$anchor, $$slotProps) => {
|
|
14486
12459
|
var fragment_1 = comment();
|
|
14487
12460
|
var node = first_child(fragment_1);
|
|
@@ -14489,40 +12462,32 @@ function Settings($$anchor, $$props) {
|
|
|
14489
12462
|
slot(node, $$props, 'default', {});
|
|
14490
12463
|
append($$anchor, fragment_1);
|
|
14491
12464
|
},
|
|
12465
|
+
|
|
14492
12466
|
$$slots: { default: true }
|
|
14493
12467
|
}));
|
|
14494
12468
|
}
|
|
14495
12469
|
|
|
14496
12470
|
function Trash($$anchor, $$props) {
|
|
14497
|
-
const $$sanitized_props = legacy_rest_props($$props, [
|
|
14498
|
-
'children',
|
|
14499
|
-
'$$slots',
|
|
14500
|
-
'$$events',
|
|
14501
|
-
'$$legacy'
|
|
14502
|
-
]);
|
|
12471
|
+
const $$sanitized_props = legacy_rest_props($$props, ['children', '$$slots', '$$events', '$$legacy']);
|
|
14503
12472
|
|
|
14504
12473
|
const iconNode = [
|
|
14505
12474
|
["path", { "d": "M4 7l16 0" }],
|
|
14506
12475
|
["path", { "d": "M10 11l0 6" }],
|
|
14507
12476
|
["path", { "d": "M14 11l0 6" }],
|
|
12477
|
+
|
|
14508
12478
|
[
|
|
14509
12479
|
"path",
|
|
14510
|
-
{
|
|
14511
|
-
"d": "M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"
|
|
14512
|
-
}
|
|
12480
|
+
{ "d": "M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12" }
|
|
14513
12481
|
],
|
|
14514
|
-
|
|
14515
|
-
|
|
14516
|
-
{
|
|
14517
|
-
"d": "M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"
|
|
14518
|
-
}
|
|
14519
|
-
]
|
|
12482
|
+
|
|
12483
|
+
["path", { "d": "M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3" }]
|
|
14520
12484
|
];
|
|
14521
12485
|
|
|
14522
12486
|
Icon($$anchor, spread_props({ type: 'outline', name: 'trash' }, () => $$sanitized_props, {
|
|
14523
12487
|
get iconNode() {
|
|
14524
12488
|
return iconNode;
|
|
14525
12489
|
},
|
|
12490
|
+
|
|
14526
12491
|
children: ($$anchor, $$slotProps) => {
|
|
14527
12492
|
var fragment_1 = comment();
|
|
14528
12493
|
var node = first_child(fragment_1);
|
|
@@ -14530,6 +12495,7 @@ function Trash($$anchor, $$props) {
|
|
|
14530
12495
|
slot(node, $$props, 'default', {});
|
|
14531
12496
|
append($$anchor, fragment_1);
|
|
14532
12497
|
},
|
|
12498
|
+
|
|
14533
12499
|
$$slots: { default: true }
|
|
14534
12500
|
}));
|
|
14535
12501
|
}
|
|
@@ -14553,12 +12519,15 @@ function Block_menu_button($$anchor, $$props) {
|
|
|
14553
12519
|
var span = sibling(button, 2);
|
|
14554
12520
|
var text = child(span);
|
|
14555
12521
|
|
|
14556
|
-
template_effect(
|
|
14557
|
-
|
|
14558
|
-
|
|
14559
|
-
|
|
14560
|
-
|
|
14561
|
-
|
|
12522
|
+
template_effect(
|
|
12523
|
+
($0) => {
|
|
12524
|
+
styles = set_style(div, '', styles, $0);
|
|
12525
|
+
set_attribute(button, 'aria-labelledby', uid);
|
|
12526
|
+
set_attribute(span, 'id', uid);
|
|
12527
|
+
set_text(text, $$props.label);
|
|
12528
|
+
},
|
|
12529
|
+
[() => ({ '--name': `--anchor-${uid}` })]
|
|
12530
|
+
);
|
|
14562
12531
|
|
|
14563
12532
|
append($$anchor, div);
|
|
14564
12533
|
}
|
|
@@ -14627,7 +12596,7 @@ async function replaceElement(elA, elB, duration = 600) {
|
|
|
14627
12596
|
}
|
|
14628
12597
|
|
|
14629
12598
|
var root_5$3 = from_html(`<!> <!>`, 1);
|
|
14630
|
-
var root$8 = from_html(`<div class="bge-menu-base svelte-
|
|
12599
|
+
var root$8 = from_html(`<div class="bge-menu-base svelte-1i5f2fs"><div class="bge-menu svelte-1i5f2fs"><div class="bge-move-group svelte-1i5f2fs"><!> <!></div> <div class="bge-standard-group svelte-1i5f2fs"><!> <!> <!> <!> <!> <!></div></div> <div class="bge-menu-margin svelte-1i5f2fs"><span class="svelte-1i5f2fs"> </span></div></div>`);
|
|
14631
12600
|
|
|
14632
12601
|
function Block_menu($$anchor, $$props) {
|
|
14633
12602
|
push($$props, false);
|
|
@@ -14646,16 +12615,7 @@ function Block_menu($$anchor, $$props) {
|
|
|
14646
12615
|
set(currentBlock, block);
|
|
14647
12616
|
});
|
|
14648
12617
|
|
|
14649
|
-
engine().componentObserver.on('select-block', (
|
|
14650
|
-
{
|
|
14651
|
-
block,
|
|
14652
|
-
width,
|
|
14653
|
-
height,
|
|
14654
|
-
x,
|
|
14655
|
-
y,
|
|
14656
|
-
marginBlockEnd
|
|
14657
|
-
}
|
|
14658
|
-
) => {
|
|
12618
|
+
engine().componentObserver.on('select-block', ({ block, width, height, x, y, marginBlockEnd }) => {
|
|
14659
12619
|
set(currentBlock, block);
|
|
14660
12620
|
set(_width, width);
|
|
14661
12621
|
set(_height, height);
|
|
@@ -14787,6 +12747,7 @@ function Block_menu($$anchor, $$props) {
|
|
|
14787
12747
|
Block_menu_button(node, {
|
|
14788
12748
|
label: 'ひとつ上へ移動',
|
|
14789
12749
|
action: () => move(true),
|
|
12750
|
+
|
|
14790
12751
|
children: ($$anchor, $$slotProps) => {
|
|
14791
12752
|
Arrow_big_up_line($$anchor, {});
|
|
14792
12753
|
}});
|
|
@@ -14796,6 +12757,7 @@ function Block_menu($$anchor, $$props) {
|
|
|
14796
12757
|
Block_menu_button(node_1, {
|
|
14797
12758
|
label: 'ひとつ下へ移動',
|
|
14798
12759
|
action: () => move(false),
|
|
12760
|
+
|
|
14799
12761
|
children: ($$anchor, $$slotProps) => {
|
|
14800
12762
|
Arrow_big_down_line($$anchor, {});
|
|
14801
12763
|
}});
|
|
@@ -14806,6 +12768,7 @@ function Block_menu($$anchor, $$props) {
|
|
|
14806
12768
|
Block_menu_button(node_2, {
|
|
14807
12769
|
label: '上にブロックを追加',
|
|
14808
12770
|
action: () => insert(true),
|
|
12771
|
+
|
|
14809
12772
|
children: ($$anchor, $$slotProps) => {
|
|
14810
12773
|
Row_insert_top($$anchor, {});
|
|
14811
12774
|
}});
|
|
@@ -14815,6 +12778,7 @@ function Block_menu($$anchor, $$props) {
|
|
|
14815
12778
|
Block_menu_button(node_3, {
|
|
14816
12779
|
label: '下にブロックを追加',
|
|
14817
12780
|
action: () => insert(false),
|
|
12781
|
+
|
|
14818
12782
|
children: ($$anchor, $$slotProps) => {
|
|
14819
12783
|
Row_insert_bottom($$anchor, {});
|
|
14820
12784
|
}});
|
|
@@ -14829,6 +12793,7 @@ function Block_menu($$anchor, $$props) {
|
|
|
14829
12793
|
Block_menu_button(node_5, {
|
|
14830
12794
|
label: 'ブロック内に要素を追加',
|
|
14831
12795
|
action: () => updateGridItems(1),
|
|
12796
|
+
|
|
14832
12797
|
children: ($$anchor, $$slotProps) => {
|
|
14833
12798
|
Layout_grid_add($$anchor, {});
|
|
14834
12799
|
}});
|
|
@@ -14838,6 +12803,7 @@ function Block_menu($$anchor, $$props) {
|
|
|
14838
12803
|
Block_menu_button(node_6, {
|
|
14839
12804
|
label: 'ブロック内の要素を削除',
|
|
14840
12805
|
action: () => updateGridItems(-1),
|
|
12806
|
+
|
|
14841
12807
|
children: ($$anchor, $$slotProps) => {
|
|
14842
12808
|
Layout_grid_remove($$anchor, {});
|
|
14843
12809
|
}});
|
|
@@ -14855,6 +12821,7 @@ function Block_menu($$anchor, $$props) {
|
|
|
14855
12821
|
Block_menu_button(node_7, {
|
|
14856
12822
|
label: 'オプション設定',
|
|
14857
12823
|
action: () => openConfig(),
|
|
12824
|
+
|
|
14858
12825
|
children: ($$anchor, $$slotProps) => {
|
|
14859
12826
|
Settings($$anchor, {});
|
|
14860
12827
|
}});
|
|
@@ -14864,6 +12831,7 @@ function Block_menu($$anchor, $$props) {
|
|
|
14864
12831
|
Block_menu_button(node_8, {
|
|
14865
12832
|
label: 'ブロックをコピー',
|
|
14866
12833
|
action: () => copy(),
|
|
12834
|
+
|
|
14867
12835
|
children: ($$anchor, $$slotProps) => {
|
|
14868
12836
|
Clipboard_plus($$anchor, {});
|
|
14869
12837
|
}});
|
|
@@ -14873,6 +12841,7 @@ function Block_menu($$anchor, $$props) {
|
|
|
14873
12841
|
Block_menu_button(node_9, {
|
|
14874
12842
|
label: 'ブロックを削除',
|
|
14875
12843
|
action: () => remove(),
|
|
12844
|
+
|
|
14876
12845
|
children: ($$anchor, $$slotProps) => {
|
|
14877
12846
|
Trash($$anchor, {});
|
|
14878
12847
|
}});
|
|
@@ -15089,16 +13058,17 @@ function Block_options($$anchor, $$props) {
|
|
|
15089
13058
|
let propName = () => get($$array_1)[0];
|
|
15090
13059
|
let data = () => get($$array_1)[1];
|
|
15091
13060
|
var option = root_9$1();
|
|
15092
|
-
var option_value = {};
|
|
15093
13061
|
var text_3 = child(option);
|
|
15094
13062
|
|
|
13063
|
+
var option_value = {};
|
|
13064
|
+
|
|
15095
13065
|
template_effect(() => {
|
|
13066
|
+
set_selected(option, options.style[category()] === propName() || data().isDefault);
|
|
13067
|
+
set_text(text_3, `${propName()} (${data().value})`);
|
|
13068
|
+
|
|
15096
13069
|
if (option_value !== (option_value = data().isDefault ? '@@default' : propName())) {
|
|
15097
13070
|
option.value = (option.__value = data().isDefault ? '@@default' : propName()) ?? '';
|
|
15098
13071
|
}
|
|
15099
|
-
|
|
15100
|
-
set_selected(option, options.style[category()] === propName() || data().isDefault);
|
|
15101
|
-
set_text(text_3, `${propName()} (${data().value})`);
|
|
15102
13072
|
});
|
|
15103
13073
|
|
|
15104
13074
|
append($$anchor, option);
|
|
@@ -15299,17 +13269,14 @@ function Draft_switcher($$anchor, $$props) {
|
|
|
15299
13269
|
}
|
|
15300
13270
|
|
|
15301
13271
|
function File($$anchor, $$props) {
|
|
15302
|
-
const $$sanitized_props = legacy_rest_props($$props, [
|
|
15303
|
-
'children',
|
|
15304
|
-
'$$slots',
|
|
15305
|
-
'$$events',
|
|
15306
|
-
'$$legacy'
|
|
15307
|
-
]);
|
|
13272
|
+
const $$sanitized_props = legacy_rest_props($$props, ['children', '$$slots', '$$events', '$$legacy']);
|
|
15308
13273
|
|
|
15309
13274
|
const iconNode = [
|
|
15310
13275
|
["path", { "d": "M14 3v4a1 1 0 0 0 1 1h4" }],
|
|
13276
|
+
|
|
15311
13277
|
[
|
|
15312
13278
|
"path",
|
|
13279
|
+
|
|
15313
13280
|
{
|
|
15314
13281
|
"d": "M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"
|
|
15315
13282
|
}
|
|
@@ -15320,6 +13287,7 @@ function File($$anchor, $$props) {
|
|
|
15320
13287
|
get iconNode() {
|
|
15321
13288
|
return iconNode;
|
|
15322
13289
|
},
|
|
13290
|
+
|
|
15323
13291
|
children: ($$anchor, $$slotProps) => {
|
|
15324
13292
|
var fragment_1 = comment();
|
|
15325
13293
|
var node = first_child(fragment_1);
|
|
@@ -15327,38 +13295,31 @@ function File($$anchor, $$props) {
|
|
|
15327
13295
|
slot(node, $$props, 'default', {});
|
|
15328
13296
|
append($$anchor, fragment_1);
|
|
15329
13297
|
},
|
|
13298
|
+
|
|
15330
13299
|
$$slots: { default: true }
|
|
15331
13300
|
}));
|
|
15332
13301
|
}
|
|
15333
13302
|
|
|
15334
13303
|
function File_type_doc($$anchor, $$props) {
|
|
15335
|
-
const $$sanitized_props = legacy_rest_props($$props, [
|
|
15336
|
-
'children',
|
|
15337
|
-
'$$slots',
|
|
15338
|
-
'$$events',
|
|
15339
|
-
'$$legacy'
|
|
15340
|
-
]);
|
|
13304
|
+
const $$sanitized_props = legacy_rest_props($$props, ['children', '$$slots', '$$events', '$$legacy']);
|
|
15341
13305
|
|
|
15342
13306
|
const iconNode = [
|
|
15343
13307
|
["path", { "d": "M14 3v4a1 1 0 0 0 1 1h4" }],
|
|
13308
|
+
["path", { "d": "M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4" }],
|
|
13309
|
+
|
|
15344
13310
|
[
|
|
15345
13311
|
"path",
|
|
15346
|
-
{ "d": "M5
|
|
15347
|
-
],
|
|
15348
|
-
[
|
|
15349
|
-
"path",
|
|
15350
|
-
{
|
|
15351
|
-
"d": "M5 15v6h1a2 2 0 0 0 2 -2v-2a2 2 0 0 0 -2 -2h-1z"
|
|
15352
|
-
}
|
|
13312
|
+
{ "d": "M5 15v6h1a2 2 0 0 0 2 -2v-2a2 2 0 0 0 -2 -2h-1z" }
|
|
15353
13313
|
],
|
|
13314
|
+
|
|
15354
13315
|
[
|
|
15355
13316
|
"path",
|
|
15356
|
-
{
|
|
15357
|
-
"d": "M20 16.5a1.5 1.5 0 0 0 -3 0v3a1.5 1.5 0 0 0 3 0"
|
|
15358
|
-
}
|
|
13317
|
+
{ "d": "M20 16.5a1.5 1.5 0 0 0 -3 0v3a1.5 1.5 0 0 0 3 0" }
|
|
15359
13318
|
],
|
|
13319
|
+
|
|
15360
13320
|
[
|
|
15361
13321
|
"path",
|
|
13322
|
+
|
|
15362
13323
|
{
|
|
15363
13324
|
"d": "M12.5 15a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1 -3 0v-3a1.5 1.5 0 0 1 1.5 -1.5z"
|
|
15364
13325
|
}
|
|
@@ -15369,6 +13330,7 @@ function File_type_doc($$anchor, $$props) {
|
|
|
15369
13330
|
get iconNode() {
|
|
15370
13331
|
return iconNode;
|
|
15371
13332
|
},
|
|
13333
|
+
|
|
15372
13334
|
children: ($$anchor, $$slotProps) => {
|
|
15373
13335
|
var fragment_1 = comment();
|
|
15374
13336
|
var node = first_child(fragment_1);
|
|
@@ -15376,35 +13338,24 @@ function File_type_doc($$anchor, $$props) {
|
|
|
15376
13338
|
slot(node, $$props, 'default', {});
|
|
15377
13339
|
append($$anchor, fragment_1);
|
|
15378
13340
|
},
|
|
13341
|
+
|
|
15379
13342
|
$$slots: { default: true }
|
|
15380
13343
|
}));
|
|
15381
13344
|
}
|
|
15382
13345
|
|
|
15383
13346
|
function File_type_pdf($$anchor, $$props) {
|
|
15384
|
-
const $$sanitized_props = legacy_rest_props($$props, [
|
|
15385
|
-
'children',
|
|
15386
|
-
'$$slots',
|
|
15387
|
-
'$$events',
|
|
15388
|
-
'$$legacy'
|
|
15389
|
-
]);
|
|
13347
|
+
const $$sanitized_props = legacy_rest_props($$props, ['children', '$$slots', '$$events', '$$legacy']);
|
|
15390
13348
|
|
|
15391
13349
|
const iconNode = [
|
|
15392
13350
|
["path", { "d": "M14 3v4a1 1 0 0 0 1 1h4" }],
|
|
15393
|
-
[
|
|
15394
|
-
|
|
15395
|
-
{ "d": "M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4" }
|
|
15396
|
-
],
|
|
15397
|
-
[
|
|
15398
|
-
"path",
|
|
15399
|
-
{ "d": "M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6" }
|
|
15400
|
-
],
|
|
13351
|
+
["path", { "d": "M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4" }],
|
|
13352
|
+
["path", { "d": "M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6" }],
|
|
15401
13353
|
["path", { "d": "M17 18h2" }],
|
|
15402
13354
|
["path", { "d": "M20 15h-3v6" }],
|
|
13355
|
+
|
|
15403
13356
|
[
|
|
15404
13357
|
"path",
|
|
15405
|
-
{
|
|
15406
|
-
"d": "M11 15v6h1a2 2 0 0 0 2 -2v-2a2 2 0 0 0 -2 -2h-1z"
|
|
15407
|
-
}
|
|
13358
|
+
{ "d": "M11 15v6h1a2 2 0 0 0 2 -2v-2a2 2 0 0 0 -2 -2h-1z" }
|
|
15408
13359
|
]
|
|
15409
13360
|
];
|
|
15410
13361
|
|
|
@@ -15412,6 +13363,7 @@ function File_type_pdf($$anchor, $$props) {
|
|
|
15412
13363
|
get iconNode() {
|
|
15413
13364
|
return iconNode;
|
|
15414
13365
|
},
|
|
13366
|
+
|
|
15415
13367
|
children: ($$anchor, $$slotProps) => {
|
|
15416
13368
|
var fragment_1 = comment();
|
|
15417
13369
|
var node = first_child(fragment_1);
|
|
@@ -15419,41 +13371,29 @@ function File_type_pdf($$anchor, $$props) {
|
|
|
15419
13371
|
slot(node, $$props, 'default', {});
|
|
15420
13372
|
append($$anchor, fragment_1);
|
|
15421
13373
|
},
|
|
13374
|
+
|
|
15422
13375
|
$$slots: { default: true }
|
|
15423
13376
|
}));
|
|
15424
13377
|
}
|
|
15425
13378
|
|
|
15426
13379
|
function File_type_ppt($$anchor, $$props) {
|
|
15427
|
-
const $$sanitized_props = legacy_rest_props($$props, [
|
|
15428
|
-
'children',
|
|
15429
|
-
'$$slots',
|
|
15430
|
-
'$$events',
|
|
15431
|
-
'$$legacy'
|
|
15432
|
-
]);
|
|
13380
|
+
const $$sanitized_props = legacy_rest_props($$props, ['children', '$$slots', '$$events', '$$legacy']);
|
|
15433
13381
|
|
|
15434
13382
|
const iconNode = [
|
|
15435
13383
|
["path", { "d": "M14 3v4a1 1 0 0 0 1 1h4" }],
|
|
15436
13384
|
["path", { "d": "M14 3v4a1 1 0 0 0 1 1h4" }],
|
|
15437
|
-
[
|
|
15438
|
-
|
|
15439
|
-
{ "d": "M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6" }
|
|
15440
|
-
],
|
|
15441
|
-
[
|
|
15442
|
-
"path",
|
|
15443
|
-
{ "d": "M11 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6" }
|
|
15444
|
-
],
|
|
13385
|
+
["path", { "d": "M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6" }],
|
|
13386
|
+
["path", { "d": "M11 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6" }],
|
|
15445
13387
|
["path", { "d": "M16.5 15h3" }],
|
|
15446
13388
|
["path", { "d": "M18 15v6" }],
|
|
15447
|
-
[
|
|
15448
|
-
"path",
|
|
15449
|
-
{ "d": "M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4" }
|
|
15450
|
-
]
|
|
13389
|
+
["path", { "d": "M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4" }]
|
|
15451
13390
|
];
|
|
15452
13391
|
|
|
15453
13392
|
Icon($$anchor, spread_props({ type: 'outline', name: 'file-type-ppt' }, () => $$sanitized_props, {
|
|
15454
13393
|
get iconNode() {
|
|
15455
13394
|
return iconNode;
|
|
15456
13395
|
},
|
|
13396
|
+
|
|
15457
13397
|
children: ($$anchor, $$slotProps) => {
|
|
15458
13398
|
var fragment_1 = comment();
|
|
15459
13399
|
var node = first_child(fragment_1);
|
|
@@ -15461,32 +13401,28 @@ function File_type_ppt($$anchor, $$props) {
|
|
|
15461
13401
|
slot(node, $$props, 'default', {});
|
|
15462
13402
|
append($$anchor, fragment_1);
|
|
15463
13403
|
},
|
|
13404
|
+
|
|
15464
13405
|
$$slots: { default: true }
|
|
15465
13406
|
}));
|
|
15466
13407
|
}
|
|
15467
13408
|
|
|
15468
13409
|
function File_type_xls($$anchor, $$props) {
|
|
15469
|
-
const $$sanitized_props = legacy_rest_props($$props, [
|
|
15470
|
-
'children',
|
|
15471
|
-
'$$slots',
|
|
15472
|
-
'$$events',
|
|
15473
|
-
'$$legacy'
|
|
15474
|
-
]);
|
|
13410
|
+
const $$sanitized_props = legacy_rest_props($$props, ['children', '$$slots', '$$events', '$$legacy']);
|
|
15475
13411
|
|
|
15476
13412
|
const iconNode = [
|
|
15477
13413
|
["path", { "d": "M14 3v4a1 1 0 0 0 1 1h4" }],
|
|
15478
|
-
[
|
|
15479
|
-
"path",
|
|
15480
|
-
{ "d": "M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4" }
|
|
15481
|
-
],
|
|
13414
|
+
["path", { "d": "M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4" }],
|
|
15482
13415
|
["path", { "d": "M4 15l4 6" }],
|
|
15483
13416
|
["path", { "d": "M4 21l4 -6" }],
|
|
13417
|
+
|
|
15484
13418
|
[
|
|
15485
13419
|
"path",
|
|
13420
|
+
|
|
15486
13421
|
{
|
|
15487
13422
|
"d": "M17 20.25c0 .414 .336 .75 .75 .75h1.25a1 1 0 0 0 1 -1v-1a1 1 0 0 0 -1 -1h-1a1 1 0 0 1 -1 -1v-1a1 1 0 0 1 1 -1h1.25a.75 .75 0 0 1 .75 .75"
|
|
15488
13423
|
}
|
|
15489
13424
|
],
|
|
13425
|
+
|
|
15490
13426
|
["path", { "d": "M11 15v6h3" }]
|
|
15491
13427
|
];
|
|
15492
13428
|
|
|
@@ -15494,6 +13430,7 @@ function File_type_xls($$anchor, $$props) {
|
|
|
15494
13430
|
get iconNode() {
|
|
15495
13431
|
return iconNode;
|
|
15496
13432
|
},
|
|
13433
|
+
|
|
15497
13434
|
children: ($$anchor, $$slotProps) => {
|
|
15498
13435
|
var fragment_1 = comment();
|
|
15499
13436
|
var node = first_child(fragment_1);
|
|
@@ -15501,31 +13438,31 @@ function File_type_xls($$anchor, $$props) {
|
|
|
15501
13438
|
slot(node, $$props, 'default', {});
|
|
15502
13439
|
append($$anchor, fragment_1);
|
|
15503
13440
|
},
|
|
13441
|
+
|
|
15504
13442
|
$$slots: { default: true }
|
|
15505
13443
|
}));
|
|
15506
13444
|
}
|
|
15507
13445
|
|
|
15508
13446
|
function Headphones($$anchor, $$props) {
|
|
15509
|
-
const $$sanitized_props = legacy_rest_props($$props, [
|
|
15510
|
-
'children',
|
|
15511
|
-
'$$slots',
|
|
15512
|
-
'$$events',
|
|
15513
|
-
'$$legacy'
|
|
15514
|
-
]);
|
|
13447
|
+
const $$sanitized_props = legacy_rest_props($$props, ['children', '$$slots', '$$events', '$$legacy']);
|
|
15515
13448
|
|
|
15516
13449
|
const iconNode = [
|
|
15517
13450
|
[
|
|
15518
13451
|
"path",
|
|
13452
|
+
|
|
15519
13453
|
{
|
|
15520
13454
|
"d": "M4 13m0 2a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v3a2 2 0 0 1 -2 2h-1a2 2 0 0 1 -2 -2z"
|
|
15521
13455
|
}
|
|
15522
13456
|
],
|
|
13457
|
+
|
|
15523
13458
|
[
|
|
15524
13459
|
"path",
|
|
13460
|
+
|
|
15525
13461
|
{
|
|
15526
13462
|
"d": "M15 13m0 2a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v3a2 2 0 0 1 -2 2h-1a2 2 0 0 1 -2 -2z"
|
|
15527
13463
|
}
|
|
15528
13464
|
],
|
|
13465
|
+
|
|
15529
13466
|
["path", { "d": "M4 15v-3a8 8 0 0 1 16 0v3" }]
|
|
15530
13467
|
];
|
|
15531
13468
|
|
|
@@ -15533,6 +13470,7 @@ function Headphones($$anchor, $$props) {
|
|
|
15533
13470
|
get iconNode() {
|
|
15534
13471
|
return iconNode;
|
|
15535
13472
|
},
|
|
13473
|
+
|
|
15536
13474
|
children: ($$anchor, $$slotProps) => {
|
|
15537
13475
|
var fragment_1 = comment();
|
|
15538
13476
|
var node = first_child(fragment_1);
|
|
@@ -15540,27 +13478,26 @@ function Headphones($$anchor, $$props) {
|
|
|
15540
13478
|
slot(node, $$props, 'default', {});
|
|
15541
13479
|
append($$anchor, fragment_1);
|
|
15542
13480
|
},
|
|
13481
|
+
|
|
15543
13482
|
$$slots: { default: true }
|
|
15544
13483
|
}));
|
|
15545
13484
|
}
|
|
15546
13485
|
|
|
15547
13486
|
function Video($$anchor, $$props) {
|
|
15548
|
-
const $$sanitized_props = legacy_rest_props($$props, [
|
|
15549
|
-
'children',
|
|
15550
|
-
'$$slots',
|
|
15551
|
-
'$$events',
|
|
15552
|
-
'$$legacy'
|
|
15553
|
-
]);
|
|
13487
|
+
const $$sanitized_props = legacy_rest_props($$props, ['children', '$$slots', '$$events', '$$legacy']);
|
|
15554
13488
|
|
|
15555
13489
|
const iconNode = [
|
|
15556
13490
|
[
|
|
15557
13491
|
"path",
|
|
13492
|
+
|
|
15558
13493
|
{
|
|
15559
13494
|
"d": "M15 10l4.553 -2.276a1 1 0 0 1 1.447 .894v6.764a1 1 0 0 1 -1.447 .894l-4.553 -2.276v-4z"
|
|
15560
13495
|
}
|
|
15561
13496
|
],
|
|
13497
|
+
|
|
15562
13498
|
[
|
|
15563
13499
|
"path",
|
|
13500
|
+
|
|
15564
13501
|
{
|
|
15565
13502
|
"d": "M3 6m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"
|
|
15566
13503
|
}
|
|
@@ -15571,6 +13508,7 @@ function Video($$anchor, $$props) {
|
|
|
15571
13508
|
get iconNode() {
|
|
15572
13509
|
return iconNode;
|
|
15573
13510
|
},
|
|
13511
|
+
|
|
15574
13512
|
children: ($$anchor, $$slotProps) => {
|
|
15575
13513
|
var fragment_1 = comment();
|
|
15576
13514
|
var node = first_child(fragment_1);
|
|
@@ -15578,6 +13516,7 @@ function Video($$anchor, $$props) {
|
|
|
15578
13516
|
slot(node, $$props, 'default', {});
|
|
15579
13517
|
append($$anchor, fragment_1);
|
|
15580
13518
|
},
|
|
13519
|
+
|
|
15581
13520
|
$$slots: { default: true }
|
|
15582
13521
|
}));
|
|
15583
13522
|
}
|
|
@@ -15762,7 +13701,29 @@ var root$4 = from_html(`<div class="ctrl svelte-15rcfwg"><div class="pagination
|
|
|
15762
13701
|
function File_list($$anchor, $$props) {
|
|
15763
13702
|
push($$props, false);
|
|
15764
13703
|
|
|
15765
|
-
const marked = (
|
|
13704
|
+
const marked = (
|
|
13705
|
+
$$anchor,
|
|
13706
|
+
|
|
13707
|
+
// On initial mount
|
|
13708
|
+
/**
|
|
13709
|
+
*
|
|
13710
|
+
* @param page
|
|
13711
|
+
*/
|
|
13712
|
+
/**
|
|
13713
|
+
*
|
|
13714
|
+
* @param value
|
|
13715
|
+
*/
|
|
13716
|
+
/**
|
|
13717
|
+
*
|
|
13718
|
+
* @param path
|
|
13719
|
+
* @param fileSize
|
|
13720
|
+
*/
|
|
13721
|
+
/**
|
|
13722
|
+
*
|
|
13723
|
+
* @param callback
|
|
13724
|
+
*/
|
|
13725
|
+
chars = noop
|
|
13726
|
+
) => {
|
|
15766
13727
|
var fragment = comment();
|
|
15767
13728
|
var node = first_child(fragment);
|
|
15768
13729
|
|
|
@@ -15810,11 +13771,7 @@ function File_list($$anchor, $$props) {
|
|
|
15810
13771
|
|
|
15811
13772
|
if (!isMounted && // On initial mount
|
|
15812
13773
|
getFileList) {
|
|
15813
|
-
const result = await getFileList(fileType(), {
|
|
15814
|
-
filter: '',
|
|
15815
|
-
page: 0,
|
|
15816
|
-
selected: get(selectedPath)
|
|
15817
|
-
});
|
|
13774
|
+
const result = await getFileList(fileType(), { filter: '', page: 0, selected: get(selectedPath) });
|
|
15818
13775
|
|
|
15819
13776
|
set(fileList, result.data);
|
|
15820
13777
|
set(currentPage, result.pagination.current);
|
|
@@ -15831,6 +13788,7 @@ function File_list($$anchor, $$props) {
|
|
|
15831
13788
|
url: path,
|
|
15832
13789
|
sizes: {}
|
|
15833
13790
|
},
|
|
13791
|
+
|
|
15834
13792
|
...get(fileList).filter((file) => !file.url.startsWith('blob:'))
|
|
15835
13793
|
]);
|
|
15836
13794
|
}
|
|
@@ -15911,12 +13869,7 @@ function File_list($$anchor, $$props) {
|
|
|
15911
13869
|
* @param fileSize
|
|
15912
13870
|
*/
|
|
15913
13871
|
function selectFile(path, fileSize) {
|
|
15914
|
-
engine().componentObserver.notify('file-select', {
|
|
15915
|
-
path,
|
|
15916
|
-
fileSize,
|
|
15917
|
-
isEmpty: false,
|
|
15918
|
-
isMounted: true
|
|
15919
|
-
});
|
|
13872
|
+
engine().componentObserver.notify('file-select', { path, fileSize, isEmpty: false, isMounted: true });
|
|
15920
13873
|
}
|
|
15921
13874
|
|
|
15922
13875
|
/**
|
|
@@ -15964,10 +13917,7 @@ function File_list($$anchor, $$props) {
|
|
|
15964
13917
|
|
|
15965
13918
|
Thumbnail(node_2, {
|
|
15966
13919
|
get src() {
|
|
15967
|
-
return (
|
|
15968
|
-
get(file),
|
|
15969
|
-
untrack(() => get(file).url)
|
|
15970
|
-
);
|
|
13920
|
+
return (get(file), untrack(() => get(file).url));
|
|
15971
13921
|
}
|
|
15972
13922
|
});
|
|
15973
13923
|
|
|
@@ -16035,6 +13985,7 @@ function File_list($$anchor, $$props) {
|
|
|
16035
13985
|
get(file),
|
|
16036
13986
|
untrack(() => formatDate(get(file).timestamp / 1000, 'YYYY-MM-DD HH:mm'))
|
|
16037
13987
|
),
|
|
13988
|
+
|
|
16038
13989
|
() => (
|
|
16039
13990
|
deep_read_state(formatByteSize),
|
|
16040
13991
|
get(file),
|
|
@@ -16139,10 +14090,7 @@ function File_uploader($$anchor, $$props) {
|
|
|
16139
14090
|
throw new Error(`Failed to upload file: ${file.name}`);
|
|
16140
14091
|
}
|
|
16141
14092
|
|
|
16142
|
-
engine().componentObserver.notify('file-listup', {
|
|
16143
|
-
fileType: fileType(),
|
|
16144
|
-
data: [res.uploaded]
|
|
16145
|
-
});
|
|
14093
|
+
engine().componentObserver.notify('file-listup', { fileType: fileType(), data: [res.uploaded] });
|
|
16146
14094
|
|
|
16147
14095
|
engine().componentObserver.notify('file-select', {
|
|
16148
14096
|
path: res.uploaded.url,
|
|
@@ -16262,11 +14210,7 @@ function Preview($$anchor, $$props) {
|
|
|
16262
14210
|
|
|
16263
14211
|
template_effect(() => {
|
|
16264
14212
|
set_attribute(source, 'src', get(selectedPath));
|
|
16265
|
-
|
|
16266
|
-
set_attribute(source, 'type', (
|
|
16267
|
-
get(file),
|
|
16268
|
-
untrack(() => `video/${get(file).ext}`)
|
|
16269
|
-
));
|
|
14213
|
+
set_attribute(source, 'type', (get(file), untrack(() => `video/${get(file).ext}`)));
|
|
16270
14214
|
});
|
|
16271
14215
|
|
|
16272
14216
|
append($$anchor, video_1);
|
|
@@ -16280,11 +14224,7 @@ function Preview($$anchor, $$props) {
|
|
|
16280
14224
|
|
|
16281
14225
|
template_effect(() => {
|
|
16282
14226
|
set_attribute(source_1, 'src', get(selectedPath));
|
|
16283
|
-
|
|
16284
|
-
set_attribute(source_1, 'type', (
|
|
16285
|
-
get(file),
|
|
16286
|
-
untrack(() => `audio/${get(file).ext}`)
|
|
16287
|
-
));
|
|
14227
|
+
set_attribute(source_1, 'type', (get(file), untrack(() => `audio/${get(file).ext}`)));
|
|
16288
14228
|
});
|
|
16289
14229
|
|
|
16290
14230
|
append($$anchor, audio);
|
|
@@ -16303,10 +14243,7 @@ function Preview($$anchor, $$props) {
|
|
|
16303
14243
|
untrack(() => `application/${get(file).ext}`)
|
|
16304
14244
|
));
|
|
16305
14245
|
|
|
16306
|
-
set_attribute(object, 'title', (
|
|
16307
|
-
get(file),
|
|
16308
|
-
untrack(() => `${get(file).ext}ファイルのプレビュー`)
|
|
16309
|
-
));
|
|
14246
|
+
set_attribute(object, 'title', (get(file), untrack(() => `${get(file).ext}ファイルのプレビュー`)));
|
|
16310
14247
|
});
|
|
16311
14248
|
|
|
16312
14249
|
append($$anchor, object);
|
|
@@ -16334,10 +14271,7 @@ function Preview($$anchor, $$props) {
|
|
|
16334
14271
|
if_block(
|
|
16335
14272
|
$$anchor,
|
|
16336
14273
|
($$render) => {
|
|
16337
|
-
if ((
|
|
16338
|
-
get(file),
|
|
16339
|
-
untrack(() => get(file)?.isAudio)
|
|
16340
|
-
)) $$render(consequent_2); else $$render(alternate_2, false);
|
|
14274
|
+
if ((get(file), untrack(() => get(file)?.isAudio))) $$render(consequent_2); else $$render(alternate_2, false);
|
|
16341
14275
|
},
|
|
16342
14276
|
$$elseif
|
|
16343
14277
|
);
|
|
@@ -16347,10 +14281,7 @@ function Preview($$anchor, $$props) {
|
|
|
16347
14281
|
if_block(
|
|
16348
14282
|
$$anchor,
|
|
16349
14283
|
($$render) => {
|
|
16350
|
-
if ((
|
|
16351
|
-
get(file),
|
|
16352
|
-
untrack(() => get(file)?.isVideo)
|
|
16353
|
-
)) $$render(consequent_1); else $$render(alternate_1, false);
|
|
14284
|
+
if ((get(file), untrack(() => get(file)?.isVideo))) $$render(consequent_1); else $$render(alternate_1, false);
|
|
16354
14285
|
},
|
|
16355
14286
|
$$elseif
|
|
16356
14287
|
);
|
|
@@ -16358,10 +14289,7 @@ function Preview($$anchor, $$props) {
|
|
|
16358
14289
|
};
|
|
16359
14290
|
|
|
16360
14291
|
if_block(node, ($$render) => {
|
|
16361
|
-
if ((
|
|
16362
|
-
get(file),
|
|
16363
|
-
untrack(() => get(file)?.isImage)
|
|
16364
|
-
)) $$render(consequent); else $$render(alternate, false);
|
|
14292
|
+
if ((get(file), untrack(() => get(file)?.isImage))) $$render(consequent); else $$render(alternate, false);
|
|
16365
14293
|
});
|
|
16366
14294
|
}
|
|
16367
14295
|
|
|
@@ -16372,9 +14300,13 @@ function Preview($$anchor, $$props) {
|
|
|
16372
14300
|
var div_2 = root_9();
|
|
16373
14301
|
let styles;
|
|
16374
14302
|
|
|
16375
|
-
template_effect(
|
|
16376
|
-
|
|
16377
|
-
|
|
14303
|
+
template_effect(
|
|
14304
|
+
($0) => styles = set_style(div_2, '', styles, $0),
|
|
14305
|
+
[
|
|
14306
|
+
() => ({ translate: `${get(uploaded) / get(total) * 100}%` })
|
|
14307
|
+
],
|
|
14308
|
+
derived_safe_equal
|
|
14309
|
+
);
|
|
16378
14310
|
|
|
16379
14311
|
append($$anchor, div_2);
|
|
16380
14312
|
};
|
|
@@ -16444,15 +14376,7 @@ function Preview($$anchor, $$props) {
|
|
|
16444
14376
|
)) $$render(consequent_6);
|
|
16445
14377
|
});
|
|
16446
14378
|
}
|
|
16447
|
-
|
|
16448
|
-
template_effect(
|
|
16449
|
-
($0) => classes = set_class(div_1, 1, 'img svelte-1ie51m5', null, classes, $0),
|
|
16450
|
-
[
|
|
16451
|
-
() => ({ uploading: get(isUploadingMode) })
|
|
16452
|
-
],
|
|
16453
|
-
derived_safe_equal
|
|
16454
|
-
);
|
|
16455
|
-
|
|
14379
|
+
template_effect(($0) => classes = set_class(div_1, 1, 'img svelte-1ie51m5', null, classes, $0), [() => ({ uploading: get(isUploadingMode) })], derived_safe_equal);
|
|
16456
14380
|
append($$anchor, div);
|
|
16457
14381
|
pop();
|
|
16458
14382
|
}
|
|
@@ -16467,12 +14391,7 @@ function svelteMount(component, options) {
|
|
|
16467
14391
|
}
|
|
16468
14392
|
|
|
16469
14393
|
function Arrows_transfer_down($$anchor, $$props) {
|
|
16470
|
-
const $$sanitized_props = legacy_rest_props($$props, [
|
|
16471
|
-
'children',
|
|
16472
|
-
'$$slots',
|
|
16473
|
-
'$$events',
|
|
16474
|
-
'$$legacy'
|
|
16475
|
-
]);
|
|
14394
|
+
const $$sanitized_props = legacy_rest_props($$props, ['children', '$$slots', '$$events', '$$legacy']);
|
|
16476
14395
|
|
|
16477
14396
|
const iconNode = [
|
|
16478
14397
|
["path", { "d": "M17 3v6" }],
|
|
@@ -16487,6 +14406,7 @@ function Arrows_transfer_down($$anchor, $$props) {
|
|
|
16487
14406
|
get iconNode() {
|
|
16488
14407
|
return iconNode;
|
|
16489
14408
|
},
|
|
14409
|
+
|
|
16490
14410
|
children: ($$anchor, $$slotProps) => {
|
|
16491
14411
|
var fragment_1 = comment();
|
|
16492
14412
|
var node = first_child(fragment_1);
|
|
@@ -16494,6 +14414,7 @@ function Arrows_transfer_down($$anchor, $$props) {
|
|
|
16494
14414
|
slot(node, $$props, 'default', {});
|
|
16495
14415
|
append($$anchor, fragment_1);
|
|
16496
14416
|
},
|
|
14417
|
+
|
|
16497
14418
|
$$slots: { default: true }
|
|
16498
14419
|
}));
|
|
16499
14420
|
}
|
|
@@ -16614,10 +14535,7 @@ function Table_editor($$anchor, $$props) {
|
|
|
16614
14535
|
Arrows_transfer_down(node_2, { class: 'icon' });
|
|
16615
14536
|
|
|
16616
14537
|
template_effect(() => {
|
|
16617
|
-
button_1.disabled = (
|
|
16618
|
-
get(table),
|
|
16619
|
-
untrack(() => get(table).length === 1)
|
|
16620
|
-
);
|
|
14538
|
+
button_1.disabled = (get(table), untrack(() => get(table).length === 1));
|
|
16621
14539
|
|
|
16622
14540
|
button_2.disabled = (
|
|
16623
14541
|
get(table),
|
|
@@ -16644,18 +14562,10 @@ function Table_editor($$anchor, $$props) {
|
|
|
16644
14562
|
delegate(['input', 'click']);
|
|
16645
14563
|
|
|
16646
14564
|
function Circle_plus($$anchor, $$props) {
|
|
16647
|
-
const $$sanitized_props = legacy_rest_props($$props, [
|
|
16648
|
-
'children',
|
|
16649
|
-
'$$slots',
|
|
16650
|
-
'$$events',
|
|
16651
|
-
'$$legacy'
|
|
16652
|
-
]);
|
|
14565
|
+
const $$sanitized_props = legacy_rest_props($$props, ['children', '$$slots', '$$events', '$$legacy']);
|
|
16653
14566
|
|
|
16654
14567
|
const iconNode = [
|
|
16655
|
-
[
|
|
16656
|
-
"path",
|
|
16657
|
-
{ "d": "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0" }
|
|
16658
|
-
],
|
|
14568
|
+
["path", { "d": "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0" }],
|
|
16659
14569
|
["path", { "d": "M9 12h6" }],
|
|
16660
14570
|
["path", { "d": "M12 9v6" }]
|
|
16661
14571
|
];
|
|
@@ -16664,6 +14574,7 @@ function Circle_plus($$anchor, $$props) {
|
|
|
16664
14574
|
get iconNode() {
|
|
16665
14575
|
return iconNode;
|
|
16666
14576
|
},
|
|
14577
|
+
|
|
16667
14578
|
children: ($$anchor, $$slotProps) => {
|
|
16668
14579
|
var fragment_1 = comment();
|
|
16669
14580
|
var node = first_child(fragment_1);
|
|
@@ -16671,6 +14582,7 @@ function Circle_plus($$anchor, $$props) {
|
|
|
16671
14582
|
slot(node, $$props, 'default', {});
|
|
16672
14583
|
append($$anchor, fragment_1);
|
|
16673
14584
|
},
|
|
14585
|
+
|
|
16674
14586
|
$$slots: { default: true }
|
|
16675
14587
|
}));
|
|
16676
14588
|
}
|
|
@@ -16685,7 +14597,16 @@ const onKeyDown = (event, update, currentIndex, length) => {
|
|
|
16685
14597
|
}
|
|
16686
14598
|
};
|
|
16687
14599
|
|
|
16688
|
-
var on_click =
|
|
14600
|
+
var on_click = /**
|
|
14601
|
+
*
|
|
14602
|
+
* @param index
|
|
14603
|
+
*/
|
|
14604
|
+
/**
|
|
14605
|
+
*
|
|
14606
|
+
* @param index
|
|
14607
|
+
*/
|
|
14608
|
+
(__1, onClick, index) => onClick(get(index));
|
|
14609
|
+
|
|
16689
14610
|
var root_1 = from_html(`<button type="button" role="tab" class="svelte-2oedib"> </button>`);
|
|
16690
14611
|
var on_click_1 = () => {};
|
|
16691
14612
|
var root = from_html(`<div role="tablist" class="svelte-2oedib"><!> <button class="add-tab svelte-2oedib" type="button" title="タブを追加"><!></button></div>`);
|
|
@@ -16741,41 +14662,30 @@ function Tabs($$anchor, $$props) {
|
|
|
16741
14662
|
var div = root();
|
|
16742
14663
|
var node = child(div);
|
|
16743
14664
|
|
|
16744
|
-
each(
|
|
16745
|
-
|
|
16746
|
-
1,
|
|
16747
|
-
() => (
|
|
16748
|
-
untrack(() => Array.from({ length }, (_, index) => index))
|
|
16749
|
-
),
|
|
16750
|
-
(index) => index,
|
|
16751
|
-
($$anchor, index) => {
|
|
16752
|
-
var button = root_1();
|
|
14665
|
+
each(node, 1, () => (untrack(() => Array.from({ length }, (_, index) => index))), (index) => index, ($$anchor, index) => {
|
|
14666
|
+
var button = root_1();
|
|
16753
14667
|
|
|
16754
|
-
|
|
16755
|
-
|
|
14668
|
+
button.__click = [on_click, onClick, index];
|
|
14669
|
+
button.__keydown = [onKeyDown, update, currentIndex, length];
|
|
16756
14670
|
|
|
16757
|
-
|
|
16758
|
-
|
|
14671
|
+
var text = child(button);
|
|
14672
|
+
bind_this(button, ($$value, index) => mutate(refs, get(refs)[index] = $$value), (index) => get(refs)?.[index], () => [get(index)]);
|
|
16759
14673
|
|
|
16760
|
-
|
|
16761
|
-
|
|
16762
|
-
|
|
16763
|
-
|
|
16764
|
-
|
|
16765
|
-
|
|
16766
|
-
|
|
16767
|
-
|
|
16768
|
-
|
|
16769
|
-
|
|
16770
|
-
|
|
16771
|
-
|
|
16772
|
-
],
|
|
16773
|
-
derived_safe_equal
|
|
16774
|
-
);
|
|
14674
|
+
template_effect(
|
|
14675
|
+
($0) => {
|
|
14676
|
+
set_attribute(button, 'aria-controls', contentId());
|
|
14677
|
+
set_attribute(button, 'aria-selected', get(currentIndex) === get(index));
|
|
14678
|
+
set_attribute(button, 'tabindex', get(currentIndex) === get(index) ? 0 : -1);
|
|
14679
|
+
set_text(text, $0);
|
|
14680
|
+
},
|
|
14681
|
+
[
|
|
14682
|
+
() => (get(index), untrack(() => createLabel(get(index))))
|
|
14683
|
+
],
|
|
14684
|
+
derived_safe_equal
|
|
14685
|
+
);
|
|
16775
14686
|
|
|
16776
|
-
|
|
16777
|
-
|
|
16778
|
-
);
|
|
14687
|
+
append($$anchor, button);
|
|
14688
|
+
});
|
|
16779
14689
|
|
|
16780
14690
|
var button_1 = sibling(node, 2);
|
|
16781
14691
|
|
|
@@ -16827,7 +14737,7 @@ function parseConfig(config) {
|
|
|
16827
14737
|
}
|
|
16828
14738
|
}
|
|
16829
14739
|
|
|
16830
|
-
const version = "4.0.0-alpha.
|
|
14740
|
+
const version = "4.0.0-alpha.7";
|
|
16831
14741
|
function attachDraftSwitcher(engine) {
|
|
16832
14742
|
if (engine.hasDraft()) {
|
|
16833
14743
|
const container = document.createElement("div");
|