@oomol-lab/open-flow 0.1.0-alpha.10 → 0.1.0-alpha.13
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/README.md +5 -1
- package/dist/browser/addNodeOptions-JRHMwVOl.js +9597 -0
- package/dist/browser/{change-Cu6pQIit.js → change-BATEvjif.js} +2 -2
- package/dist/browser/createResourceDialog-CWD62rU0.js +467 -0
- package/dist/browser/{esm-CvAs_mAS.js → esm-C04lx1pd.js} +1 -1
- package/dist/browser/flow-authoring-node.d.ts +2 -0
- package/dist/browser/flow-authoring.d.ts +1 -1
- package/dist/browser/flow-authoring.js +387 -126
- package/dist/browser/flow-change.d.ts +9 -4
- package/dist/browser/flow-change.js +49 -46
- package/dist/browser/{flowRunInputEditorStore-DXOyyY7o.js → flowRunInputEditorStore-BUwR9Vbp.js} +1615 -882
- package/dist/browser/{flowWorkspace-X_T_DcQf.js → flowWorkspace-_qaqIyDi.js} +18174 -16631
- package/dist/browser/languages-DgJehE1g.js +62 -0
- package/dist/browser/lib-C5Ipyfps.js +7856 -0
- package/dist/browser/main-DmjVyuWr.js +76 -0
- package/dist/browser/{markdownContent-BI-2PmDX.js → markdownContent-CX77lBFM.js} +4795 -4787
- package/dist/browser/theme.css +63 -0
- package/dist/browser/theme.css.d.ts +1 -0
- package/dist/browser/typeScriptSession-D5neIpug.js +2560 -0
- package/dist/browser/{createLucideIcon-COMgwa_u.js → useOpenInteractionType-CRgOHg5M.js} +2484 -2254
- package/dist/browser/workbench-contract.d.ts +2 -1
- package/dist/browser/workbench.css +1 -1
- package/dist/browser/workbench.d.ts +16 -1
- package/dist/browser/workbench.js +1492 -1307
- package/dist/common/control-api-conformance.js +39 -0
- package/dist/common/control-api-errors.d.ts +12 -0
- package/dist/common/control-api.d.ts +13 -0
- package/dist/common/control-api.js +120 -73
- package/dist/common/flow-encoding.d.ts +2 -2
- package/dist/common/flow-encoding.js +4 -1
- package/dist/common/flow-semantics.d.ts +2 -0
- package/dist/common/flow-semantics.js +869 -838
- package/dist/common/licenses.md +1 -25
- package/dist/common/localization.d.ts +21 -0
- package/dist/common/localization.js +62 -0
- package/dist/common/scheduler.d.ts +1 -0
- package/dist/common/scheduler.js +64 -50
- package/package.json +9 -1
- package/dist/browser/addNodeOptions-BwrMvPQC.js +0 -5230
- package/dist/browser/assets/typeScriptWorker-CaA4llbX.js +0 -59850
- package/dist/browser/createResourceDialog-YgMLylQz.js +0 -467
- package/dist/browser/field-BrEG-7ap.js +0 -312
- package/dist/browser/typeScriptSession-Dagu_tRs.js +0 -2549
|
@@ -1,2549 +0,0 @@
|
|
|
1
|
-
import { r as e } from "./dist-BpopSHwP.js";
|
|
2
|
-
import { n as t } from "./dist-DUzA0Ukh.js";
|
|
3
|
-
import { c as n, l as r, m as i, o as a, p as o, r as s, s as c } from "./dist-Mecbzdl2.js";
|
|
4
|
-
import { D as l, E as u, T as d, a as f, b as p, f as m, r as h, y as ee } from "./dist-BKuSVKCC.js";
|
|
5
|
-
import { C as te, D as ne, O as g, x as re } from "./dist-CUSrALSX.js";
|
|
6
|
-
import { c as ie, l as ae, n as oe } from "./dist-CPuF50D9.js";
|
|
7
|
-
import { n as se } from "./dist-CeSZ2xSM.js";
|
|
8
|
-
//#region ../../node_modules/.bun/marked@15.0.12/node_modules/marked/lib/marked.esm.js
|
|
9
|
-
function _() {
|
|
10
|
-
return {
|
|
11
|
-
async: !1,
|
|
12
|
-
breaks: !1,
|
|
13
|
-
extensions: null,
|
|
14
|
-
gfm: !0,
|
|
15
|
-
hooks: null,
|
|
16
|
-
pedantic: !1,
|
|
17
|
-
renderer: null,
|
|
18
|
-
silent: !1,
|
|
19
|
-
tokenizer: null,
|
|
20
|
-
walkTokens: null
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
var v = _();
|
|
24
|
-
function ce(e) {
|
|
25
|
-
v = e;
|
|
26
|
-
}
|
|
27
|
-
var y = { exec: () => null };
|
|
28
|
-
function b(e, t = "") {
|
|
29
|
-
let n = typeof e == "string" ? e : e.source, r = {
|
|
30
|
-
replace: (e, t) => {
|
|
31
|
-
let i = typeof t == "string" ? t : t.source;
|
|
32
|
-
return i = i.replace(x.caret, "$1"), n = n.replace(e, i), r;
|
|
33
|
-
},
|
|
34
|
-
getRegex: () => new RegExp(n, t)
|
|
35
|
-
};
|
|
36
|
-
return r;
|
|
37
|
-
}
|
|
38
|
-
var x = {
|
|
39
|
-
codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
|
|
40
|
-
outputLinkReplace: /\\([\[\]])/g,
|
|
41
|
-
indentCodeCompensation: /^(\s+)(?:```)/,
|
|
42
|
-
beginningSpace: /^\s+/,
|
|
43
|
-
endingHash: /#$/,
|
|
44
|
-
startingSpaceChar: /^ /,
|
|
45
|
-
endingSpaceChar: / $/,
|
|
46
|
-
nonSpaceChar: /[^ ]/,
|
|
47
|
-
newLineCharGlobal: /\n/g,
|
|
48
|
-
tabCharGlobal: /\t/g,
|
|
49
|
-
multipleSpaceGlobal: /\s+/g,
|
|
50
|
-
blankLine: /^[ \t]*$/,
|
|
51
|
-
doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
|
|
52
|
-
blockquoteStart: /^ {0,3}>/,
|
|
53
|
-
blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
|
|
54
|
-
blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
|
|
55
|
-
listReplaceTabs: /^\t+/,
|
|
56
|
-
listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
|
|
57
|
-
listIsTask: /^\[[ xX]\] /,
|
|
58
|
-
listReplaceTask: /^\[[ xX]\] +/,
|
|
59
|
-
anyLine: /\n.*\n/,
|
|
60
|
-
hrefBrackets: /^<(.*)>$/,
|
|
61
|
-
tableDelimiter: /[:|]/,
|
|
62
|
-
tableAlignChars: /^\||\| *$/g,
|
|
63
|
-
tableRowBlankLine: /\n[ \t]*$/,
|
|
64
|
-
tableAlignRight: /^ *-+: *$/,
|
|
65
|
-
tableAlignCenter: /^ *:-+: *$/,
|
|
66
|
-
tableAlignLeft: /^ *:-+ *$/,
|
|
67
|
-
startATag: /^<a /i,
|
|
68
|
-
endATag: /^<\/a>/i,
|
|
69
|
-
startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
|
|
70
|
-
endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
|
|
71
|
-
startAngleBracket: /^</,
|
|
72
|
-
endAngleBracket: />$/,
|
|
73
|
-
pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
|
|
74
|
-
unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
|
|
75
|
-
escapeTest: /[&<>"']/,
|
|
76
|
-
escapeReplace: /[&<>"']/g,
|
|
77
|
-
escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
|
|
78
|
-
escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
|
|
79
|
-
unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,
|
|
80
|
-
caret: /(^|[^\[])\^/g,
|
|
81
|
-
percentDecode: /%25/g,
|
|
82
|
-
findPipe: /\|/g,
|
|
83
|
-
splitPipe: / \|/,
|
|
84
|
-
slashPipe: /\\\|/g,
|
|
85
|
-
carriageReturn: /\r\n|\r/g,
|
|
86
|
-
spaceLine: /^ +$/gm,
|
|
87
|
-
notSpaceStart: /^\S*/,
|
|
88
|
-
endingNewline: /\n$/,
|
|
89
|
-
listItemRegex: (e) => RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
90
|
-
nextBulletRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
91
|
-
hrRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
|
|
92
|
-
fencesBeginRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}(?:\`\`\`|~~~)`),
|
|
93
|
-
headingBeginRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}#`),
|
|
94
|
-
htmlBeginRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}<(?:[a-z].*>|!--)`, "i")
|
|
95
|
-
}, le = /^(?:[ \t]*(?:\n|$))+/, ue = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, de = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, S = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, fe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, pe = /(?:[*+-]|\d{1,9}[.)])/, me = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, he = b(me).replace(/bull/g, pe).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(), ge = b(me).replace(/bull/g, pe).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(), C = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, _e = /^[^\n]+/, w = /(?!\s*\])(?:\\.|[^\[\]\\])+/, ve = b(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", w).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), ye = b(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, pe).getRegex(), T = "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", E = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, be = b("^ {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", E).replace("tag", T).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), xe = b(C).replace("hr", S).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", T).getRegex(), D = {
|
|
96
|
-
blockquote: b(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", xe).getRegex(),
|
|
97
|
-
code: ue,
|
|
98
|
-
def: ve,
|
|
99
|
-
fences: de,
|
|
100
|
-
heading: fe,
|
|
101
|
-
hr: S,
|
|
102
|
-
html: be,
|
|
103
|
-
lheading: he,
|
|
104
|
-
list: ye,
|
|
105
|
-
newline: le,
|
|
106
|
-
paragraph: xe,
|
|
107
|
-
table: y,
|
|
108
|
-
text: _e
|
|
109
|
-
}, Se = b("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", S).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", T).getRegex(), Ce = {
|
|
110
|
-
...D,
|
|
111
|
-
lheading: ge,
|
|
112
|
-
table: Se,
|
|
113
|
-
paragraph: b(C).replace("hr", S).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", T).getRegex()
|
|
114
|
-
}, we = {
|
|
115
|
-
...D,
|
|
116
|
-
html: b("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", E).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(),
|
|
117
|
-
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
118
|
-
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
119
|
-
fences: y,
|
|
120
|
-
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
121
|
-
paragraph: b(C).replace("hr", S).replace("heading", " *#{1,6} *[^\n]").replace("lheading", he).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
122
|
-
}, Te = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ee = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, De = /^( {2,}|\\)\n(?!\s*$)/, Oe = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, O = /[\p{P}\p{S}]/u, k = /[\s\p{P}\p{S}]/u, ke = /[^\s\p{P}\p{S}]/u, Ae = b(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, k).getRegex(), je = /(?!~)[\p{P}\p{S}]/u, Me = /(?!~)[\s\p{P}\p{S}]/u, Ne = /(?:[^\s\p{P}\p{S}]|~)/u, Pe = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, Fe = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Ie = b(Fe, "u").replace(/punct/g, O).getRegex(), Le = b(Fe, "u").replace(/punct/g, je).getRegex(), Re = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", ze = b(Re, "gu").replace(/notPunctSpace/g, ke).replace(/punctSpace/g, k).replace(/punct/g, O).getRegex(), Be = b(Re, "gu").replace(/notPunctSpace/g, Ne).replace(/punctSpace/g, Me).replace(/punct/g, je).getRegex(), Ve = b("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ke).replace(/punctSpace/g, k).replace(/punct/g, O).getRegex(), He = b(/\\(punct)/, "gu").replace(/punct/g, O).getRegex(), Ue = b(/^<(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(), We = b(E).replace("(?:-->|$)", "-->").getRegex(), Ge = b("^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", We).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), A = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, Ke = b(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", A).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), qe = b(/^!?\[(label)\]\[(ref)\]/).replace("label", A).replace("ref", w).getRegex(), Je = b(/^!?\[(ref)\](?:\[\])?/).replace("ref", w).getRegex(), j = {
|
|
123
|
-
_backpedal: y,
|
|
124
|
-
anyPunctuation: He,
|
|
125
|
-
autolink: Ue,
|
|
126
|
-
blockSkip: Pe,
|
|
127
|
-
br: De,
|
|
128
|
-
code: Ee,
|
|
129
|
-
del: y,
|
|
130
|
-
emStrongLDelim: Ie,
|
|
131
|
-
emStrongRDelimAst: ze,
|
|
132
|
-
emStrongRDelimUnd: Ve,
|
|
133
|
-
escape: Te,
|
|
134
|
-
link: Ke,
|
|
135
|
-
nolink: Je,
|
|
136
|
-
punctuation: Ae,
|
|
137
|
-
reflink: qe,
|
|
138
|
-
reflinkSearch: b("reflink|nolink(?!\\()", "g").replace("reflink", qe).replace("nolink", Je).getRegex(),
|
|
139
|
-
tag: Ge,
|
|
140
|
-
text: Oe,
|
|
141
|
-
url: y
|
|
142
|
-
}, Ye = {
|
|
143
|
-
...j,
|
|
144
|
-
link: b(/^!?\[(label)\]\((.*?)\)/).replace("label", A).getRegex(),
|
|
145
|
-
reflink: b(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", A).getRegex()
|
|
146
|
-
}, M = {
|
|
147
|
-
...j,
|
|
148
|
-
emStrongRDelimAst: Be,
|
|
149
|
-
emStrongLDelim: Le,
|
|
150
|
-
url: b(/^((?: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(),
|
|
151
|
-
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
152
|
-
del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
|
|
153
|
-
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
154
|
-
}, Xe = {
|
|
155
|
-
...M,
|
|
156
|
-
br: b(De).replace("{2,}", "*").getRegex(),
|
|
157
|
-
text: b(M.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
158
|
-
}, N = {
|
|
159
|
-
normal: D,
|
|
160
|
-
gfm: Ce,
|
|
161
|
-
pedantic: we
|
|
162
|
-
}, P = {
|
|
163
|
-
normal: j,
|
|
164
|
-
gfm: M,
|
|
165
|
-
breaks: Xe,
|
|
166
|
-
pedantic: Ye
|
|
167
|
-
}, Ze = {
|
|
168
|
-
"&": "&",
|
|
169
|
-
"<": "<",
|
|
170
|
-
">": ">",
|
|
171
|
-
"\"": """,
|
|
172
|
-
"'": "'"
|
|
173
|
-
}, Qe = (e) => Ze[e];
|
|
174
|
-
function F(e, t) {
|
|
175
|
-
if (t) {
|
|
176
|
-
if (x.escapeTest.test(e)) return e.replace(x.escapeReplace, Qe);
|
|
177
|
-
} else if (x.escapeTestNoEncode.test(e)) return e.replace(x.escapeReplaceNoEncode, Qe);
|
|
178
|
-
return e;
|
|
179
|
-
}
|
|
180
|
-
function $e(e) {
|
|
181
|
-
try {
|
|
182
|
-
e = encodeURI(e).replace(x.percentDecode, "%");
|
|
183
|
-
} catch {
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
186
|
-
return e;
|
|
187
|
-
}
|
|
188
|
-
function et(e, t) {
|
|
189
|
-
let n = e.replace(x.findPipe, (e, t, n) => {
|
|
190
|
-
let r = !1, i = t;
|
|
191
|
-
for (; --i >= 0 && n[i] === "\\";) r = !r;
|
|
192
|
-
return r ? "|" : " |";
|
|
193
|
-
}).split(x.splitPipe), r = 0;
|
|
194
|
-
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), t) {
|
|
195
|
-
if (n.length > t) n.splice(t);
|
|
196
|
-
else for (; n.length < t;) n.push("");
|
|
197
|
-
}
|
|
198
|
-
for (; r < n.length; r++) n[r] = n[r].trim().replace(x.slashPipe, "|");
|
|
199
|
-
return n;
|
|
200
|
-
}
|
|
201
|
-
function I(e, t, n) {
|
|
202
|
-
let r = e.length;
|
|
203
|
-
if (r === 0) return "";
|
|
204
|
-
let i = 0;
|
|
205
|
-
for (; i < r;) {
|
|
206
|
-
let a = e.charAt(r - i - 1);
|
|
207
|
-
if (a === t && !n) i++;
|
|
208
|
-
else if (a !== t && n) i++;
|
|
209
|
-
else break;
|
|
210
|
-
}
|
|
211
|
-
return e.slice(0, r - i);
|
|
212
|
-
}
|
|
213
|
-
function tt(e, t) {
|
|
214
|
-
if (e.indexOf(t[1]) === -1) return -1;
|
|
215
|
-
let n = 0;
|
|
216
|
-
for (let r = 0; r < e.length; r++) if (e[r] === "\\") r++;
|
|
217
|
-
else if (e[r] === t[0]) n++;
|
|
218
|
-
else if (e[r] === t[1] && (n--, n < 0)) return r;
|
|
219
|
-
return n > 0 ? -2 : -1;
|
|
220
|
-
}
|
|
221
|
-
function nt(e, t, n, r, i) {
|
|
222
|
-
let a = t.href, o = t.title || null, s = e[1].replace(i.other.outputLinkReplace, "$1");
|
|
223
|
-
r.state.inLink = !0;
|
|
224
|
-
let c = {
|
|
225
|
-
type: e[0].charAt(0) === "!" ? "image" : "link",
|
|
226
|
-
raw: n,
|
|
227
|
-
href: a,
|
|
228
|
-
title: o,
|
|
229
|
-
text: s,
|
|
230
|
-
tokens: r.inlineTokens(s)
|
|
231
|
-
};
|
|
232
|
-
return r.state.inLink = !1, c;
|
|
233
|
-
}
|
|
234
|
-
function rt(e, t, n) {
|
|
235
|
-
let r = e.match(n.other.indentCodeCompensation);
|
|
236
|
-
if (r === null) return t;
|
|
237
|
-
let i = r[1];
|
|
238
|
-
return t.split("\n").map((e) => {
|
|
239
|
-
let t = e.match(n.other.beginningSpace);
|
|
240
|
-
if (t === null) return e;
|
|
241
|
-
let [r] = t;
|
|
242
|
-
return r.length >= i.length ? e.slice(i.length) : e;
|
|
243
|
-
}).join("\n");
|
|
244
|
-
}
|
|
245
|
-
var L = class {
|
|
246
|
-
options;
|
|
247
|
-
rules;
|
|
248
|
-
lexer;
|
|
249
|
-
constructor(e) {
|
|
250
|
-
this.options = e || v;
|
|
251
|
-
}
|
|
252
|
-
space(e) {
|
|
253
|
-
let t = this.rules.block.newline.exec(e);
|
|
254
|
-
if (t && t[0].length > 0) return {
|
|
255
|
-
type: "space",
|
|
256
|
-
raw: t[0]
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
code(e) {
|
|
260
|
-
let t = this.rules.block.code.exec(e);
|
|
261
|
-
if (t) {
|
|
262
|
-
let e = t[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
263
|
-
return {
|
|
264
|
-
type: "code",
|
|
265
|
-
raw: t[0],
|
|
266
|
-
codeBlockStyle: "indented",
|
|
267
|
-
text: this.options.pedantic ? e : I(e, "\n")
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
fences(e) {
|
|
272
|
-
let t = this.rules.block.fences.exec(e);
|
|
273
|
-
if (t) {
|
|
274
|
-
let e = t[0], n = rt(e, t[3] || "", this.rules);
|
|
275
|
-
return {
|
|
276
|
-
type: "code",
|
|
277
|
-
raw: e,
|
|
278
|
-
lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
|
|
279
|
-
text: n
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
heading(e) {
|
|
284
|
-
let t = this.rules.block.heading.exec(e);
|
|
285
|
-
if (t) {
|
|
286
|
-
let e = t[2].trim();
|
|
287
|
-
if (this.rules.other.endingHash.test(e)) {
|
|
288
|
-
let t = I(e, "#");
|
|
289
|
-
(this.options.pedantic || !t || this.rules.other.endingSpaceChar.test(t)) && (e = t.trim());
|
|
290
|
-
}
|
|
291
|
-
return {
|
|
292
|
-
type: "heading",
|
|
293
|
-
raw: t[0],
|
|
294
|
-
depth: t[1].length,
|
|
295
|
-
text: e,
|
|
296
|
-
tokens: this.lexer.inline(e)
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
hr(e) {
|
|
301
|
-
let t = this.rules.block.hr.exec(e);
|
|
302
|
-
if (t) return {
|
|
303
|
-
type: "hr",
|
|
304
|
-
raw: I(t[0], "\n")
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
blockquote(e) {
|
|
308
|
-
let t = this.rules.block.blockquote.exec(e);
|
|
309
|
-
if (t) {
|
|
310
|
-
let e = I(t[0], "\n").split("\n"), n = "", r = "", i = [];
|
|
311
|
-
for (; e.length > 0;) {
|
|
312
|
-
let t = !1, a = [], o;
|
|
313
|
-
for (o = 0; o < e.length; o++) if (this.rules.other.blockquoteStart.test(e[o])) a.push(e[o]), t = !0;
|
|
314
|
-
else if (!t) a.push(e[o]);
|
|
315
|
-
else break;
|
|
316
|
-
e = e.slice(o);
|
|
317
|
-
let s = a.join("\n"), c = s.replace(this.rules.other.blockquoteSetextReplace, "\n $1").replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
318
|
-
n = n ? `${n}
|
|
319
|
-
${s}` : s, r = r ? `${r}
|
|
320
|
-
${c}` : c;
|
|
321
|
-
let l = this.lexer.state.top;
|
|
322
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(c, i, !0), this.lexer.state.top = l, e.length === 0) break;
|
|
323
|
-
let u = i.at(-1);
|
|
324
|
-
if (u?.type === "code") break;
|
|
325
|
-
if (u?.type === "blockquote") {
|
|
326
|
-
let t = u, a = t.raw + "\n" + e.join("\n"), o = this.blockquote(a);
|
|
327
|
-
i[i.length - 1] = o, n = n.substring(0, n.length - t.raw.length) + o.raw, r = r.substring(0, r.length - t.text.length) + o.text;
|
|
328
|
-
break;
|
|
329
|
-
}
|
|
330
|
-
if (u?.type === "list") {
|
|
331
|
-
let t = u, a = t.raw + "\n" + e.join("\n"), o = this.list(a);
|
|
332
|
-
i[i.length - 1] = o, n = n.substring(0, n.length - u.raw.length) + o.raw, r = r.substring(0, r.length - t.raw.length) + o.raw, e = a.substring(i.at(-1).raw.length).split("\n");
|
|
333
|
-
continue;
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
return {
|
|
337
|
-
type: "blockquote",
|
|
338
|
-
raw: n,
|
|
339
|
-
tokens: i,
|
|
340
|
-
text: r
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
list(e) {
|
|
345
|
-
let t = this.rules.block.list.exec(e);
|
|
346
|
-
if (t) {
|
|
347
|
-
let n = t[1].trim(), r = n.length > 1, i = {
|
|
348
|
-
type: "list",
|
|
349
|
-
raw: "",
|
|
350
|
-
ordered: r,
|
|
351
|
-
start: r ? +n.slice(0, -1) : "",
|
|
352
|
-
loose: !1,
|
|
353
|
-
items: []
|
|
354
|
-
};
|
|
355
|
-
n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
|
|
356
|
-
let a = this.rules.other.listItemRegex(n), o = !1;
|
|
357
|
-
for (; e;) {
|
|
358
|
-
let n = !1, r = "", s = "";
|
|
359
|
-
if (!(t = a.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
360
|
-
r = t[0], e = e.substring(r.length);
|
|
361
|
-
let c = t[2].split("\n", 1)[0].replace(this.rules.other.listReplaceTabs, (e) => " ".repeat(3 * e.length)), l = e.split("\n", 1)[0], u = !c.trim(), d = 0;
|
|
362
|
-
if (this.options.pedantic ? (d = 2, s = c.trimStart()) : u ? d = t[1].length + 1 : (d = t[2].search(this.rules.other.nonSpaceChar), d = d > 4 ? 1 : d, s = c.slice(d), d += t[1].length), u && this.rules.other.blankLine.test(l) && (r += l + "\n", e = e.substring(l.length + 1), n = !0), !n) {
|
|
363
|
-
let t = this.rules.other.nextBulletRegex(d), n = this.rules.other.hrRegex(d), i = this.rules.other.fencesBeginRegex(d), a = this.rules.other.headingBeginRegex(d), o = this.rules.other.htmlBeginRegex(d);
|
|
364
|
-
for (; e;) {
|
|
365
|
-
let f = e.split("\n", 1)[0], p;
|
|
366
|
-
if (l = f, this.options.pedantic ? (l = l.replace(this.rules.other.listReplaceNesting, " "), p = l) : p = l.replace(this.rules.other.tabCharGlobal, " "), i.test(l) || a.test(l) || o.test(l) || t.test(l) || n.test(l)) break;
|
|
367
|
-
if (p.search(this.rules.other.nonSpaceChar) >= d || !l.trim()) s += "\n" + p.slice(d);
|
|
368
|
-
else {
|
|
369
|
-
if (u || c.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || i.test(c) || a.test(c) || n.test(c)) break;
|
|
370
|
-
s += "\n" + l;
|
|
371
|
-
}
|
|
372
|
-
!u && !l.trim() && (u = !0), r += f + "\n", e = e.substring(f.length + 1), c = p.slice(d);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
i.loose || (o ? i.loose = !0 : this.rules.other.doubleBlankLine.test(r) && (o = !0));
|
|
376
|
-
let f = null, p;
|
|
377
|
-
this.options.gfm && (f = this.rules.other.listIsTask.exec(s), f && (p = f[0] !== "[ ] ", s = s.replace(this.rules.other.listReplaceTask, ""))), i.items.push({
|
|
378
|
-
type: "list_item",
|
|
379
|
-
raw: r,
|
|
380
|
-
task: !!f,
|
|
381
|
-
checked: p,
|
|
382
|
-
loose: !1,
|
|
383
|
-
text: s,
|
|
384
|
-
tokens: []
|
|
385
|
-
}), i.raw += r;
|
|
386
|
-
}
|
|
387
|
-
let s = i.items.at(-1);
|
|
388
|
-
if (s) s.raw = s.raw.trimEnd(), s.text = s.text.trimEnd();
|
|
389
|
-
else return;
|
|
390
|
-
i.raw = i.raw.trimEnd();
|
|
391
|
-
for (let e = 0; e < i.items.length; e++) if (this.lexer.state.top = !1, i.items[e].tokens = this.lexer.blockTokens(i.items[e].text, []), !i.loose) {
|
|
392
|
-
let t = i.items[e].tokens.filter((e) => e.type === "space");
|
|
393
|
-
i.loose = t.length > 0 && t.some((e) => this.rules.other.anyLine.test(e.raw));
|
|
394
|
-
}
|
|
395
|
-
if (i.loose) for (let e = 0; e < i.items.length; e++) i.items[e].loose = !0;
|
|
396
|
-
return i;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
html(e) {
|
|
400
|
-
let t = this.rules.block.html.exec(e);
|
|
401
|
-
if (t) return {
|
|
402
|
-
type: "html",
|
|
403
|
-
block: !0,
|
|
404
|
-
raw: t[0],
|
|
405
|
-
pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
|
|
406
|
-
text: t[0]
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
def(e) {
|
|
410
|
-
let t = this.rules.block.def.exec(e);
|
|
411
|
-
if (t) {
|
|
412
|
-
let e = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), n = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
413
|
-
return {
|
|
414
|
-
type: "def",
|
|
415
|
-
tag: e,
|
|
416
|
-
raw: t[0],
|
|
417
|
-
href: n,
|
|
418
|
-
title: r
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
table(e) {
|
|
423
|
-
let t = this.rules.block.table.exec(e);
|
|
424
|
-
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
425
|
-
let n = et(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [], a = {
|
|
426
|
-
type: "table",
|
|
427
|
-
raw: t[0],
|
|
428
|
-
header: [],
|
|
429
|
-
align: [],
|
|
430
|
-
rows: []
|
|
431
|
-
};
|
|
432
|
-
if (n.length === r.length) {
|
|
433
|
-
for (let e of r) this.rules.other.tableAlignRight.test(e) ? a.align.push("right") : this.rules.other.tableAlignCenter.test(e) ? a.align.push("center") : this.rules.other.tableAlignLeft.test(e) ? a.align.push("left") : a.align.push(null);
|
|
434
|
-
for (let e = 0; e < n.length; e++) a.header.push({
|
|
435
|
-
text: n[e],
|
|
436
|
-
tokens: this.lexer.inline(n[e]),
|
|
437
|
-
header: !0,
|
|
438
|
-
align: a.align[e]
|
|
439
|
-
});
|
|
440
|
-
for (let e of i) a.rows.push(et(e, a.header.length).map((e, t) => ({
|
|
441
|
-
text: e,
|
|
442
|
-
tokens: this.lexer.inline(e),
|
|
443
|
-
header: !1,
|
|
444
|
-
align: a.align[t]
|
|
445
|
-
})));
|
|
446
|
-
return a;
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
lheading(e) {
|
|
450
|
-
let t = this.rules.block.lheading.exec(e);
|
|
451
|
-
if (t) return {
|
|
452
|
-
type: "heading",
|
|
453
|
-
raw: t[0],
|
|
454
|
-
depth: t[2].charAt(0) === "=" ? 1 : 2,
|
|
455
|
-
text: t[1],
|
|
456
|
-
tokens: this.lexer.inline(t[1])
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
paragraph(e) {
|
|
460
|
-
let t = this.rules.block.paragraph.exec(e);
|
|
461
|
-
if (t) {
|
|
462
|
-
let e = t[1].charAt(t[1].length - 1) === "\n" ? t[1].slice(0, -1) : t[1];
|
|
463
|
-
return {
|
|
464
|
-
type: "paragraph",
|
|
465
|
-
raw: t[0],
|
|
466
|
-
text: e,
|
|
467
|
-
tokens: this.lexer.inline(e)
|
|
468
|
-
};
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
text(e) {
|
|
472
|
-
let t = this.rules.block.text.exec(e);
|
|
473
|
-
if (t) return {
|
|
474
|
-
type: "text",
|
|
475
|
-
raw: t[0],
|
|
476
|
-
text: t[0],
|
|
477
|
-
tokens: this.lexer.inline(t[0])
|
|
478
|
-
};
|
|
479
|
-
}
|
|
480
|
-
escape(e) {
|
|
481
|
-
let t = this.rules.inline.escape.exec(e);
|
|
482
|
-
if (t) return {
|
|
483
|
-
type: "escape",
|
|
484
|
-
raw: t[0],
|
|
485
|
-
text: t[1]
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
|
-
tag(e) {
|
|
489
|
-
let t = this.rules.inline.tag.exec(e);
|
|
490
|
-
if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
|
|
491
|
-
type: "html",
|
|
492
|
-
raw: t[0],
|
|
493
|
-
inLink: this.lexer.state.inLink,
|
|
494
|
-
inRawBlock: this.lexer.state.inRawBlock,
|
|
495
|
-
block: !1,
|
|
496
|
-
text: t[0]
|
|
497
|
-
};
|
|
498
|
-
}
|
|
499
|
-
link(e) {
|
|
500
|
-
let t = this.rules.inline.link.exec(e);
|
|
501
|
-
if (t) {
|
|
502
|
-
let e = t[2].trim();
|
|
503
|
-
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(e)) {
|
|
504
|
-
if (!this.rules.other.endAngleBracket.test(e)) return;
|
|
505
|
-
let t = I(e.slice(0, -1), "\\");
|
|
506
|
-
if ((e.length - t.length) % 2 == 0) return;
|
|
507
|
-
} else {
|
|
508
|
-
let e = tt(t[2], "()");
|
|
509
|
-
if (e === -2) return;
|
|
510
|
-
if (e > -1) {
|
|
511
|
-
let n = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + e;
|
|
512
|
-
t[2] = t[2].substring(0, e), t[0] = t[0].substring(0, n).trim(), t[3] = "";
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
let n = t[2], r = "";
|
|
516
|
-
if (this.options.pedantic) {
|
|
517
|
-
let e = this.rules.other.pedanticHrefTitle.exec(n);
|
|
518
|
-
e && (n = e[1], r = e[3]);
|
|
519
|
-
} else r = t[3] ? t[3].slice(1, -1) : "";
|
|
520
|
-
return n = n.trim(), this.rules.other.startAngleBracket.test(n) && (n = this.options.pedantic && !this.rules.other.endAngleBracket.test(e) ? n.slice(1) : n.slice(1, -1)), nt(t, {
|
|
521
|
-
href: n && n.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
522
|
-
title: r && r.replace(this.rules.inline.anyPunctuation, "$1")
|
|
523
|
-
}, t[0], this.lexer, this.rules);
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
reflink(e, t) {
|
|
527
|
-
let n;
|
|
528
|
-
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
529
|
-
let e = t[(n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " ").toLowerCase()];
|
|
530
|
-
if (!e) {
|
|
531
|
-
let e = n[0].charAt(0);
|
|
532
|
-
return {
|
|
533
|
-
type: "text",
|
|
534
|
-
raw: e,
|
|
535
|
-
text: e
|
|
536
|
-
};
|
|
537
|
-
}
|
|
538
|
-
return nt(n, e, n[0], this.lexer, this.rules);
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
emStrong(e, t, n = "") {
|
|
542
|
-
let r = this.rules.inline.emStrongLDelim.exec(e);
|
|
543
|
-
if (r && !(r[3] && n.match(this.rules.other.unicodeAlphaNumeric)) && (!(r[1] || r[2]) || !n || this.rules.inline.punctuation.exec(n))) {
|
|
544
|
-
let n = [...r[0]].length - 1, i, a, o = n, s = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
545
|
-
for (c.lastIndex = 0, t = t.slice(-1 * e.length + n); (r = c.exec(t)) != null;) {
|
|
546
|
-
if (i = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !i) continue;
|
|
547
|
-
if (a = [...i].length, r[3] || r[4]) {
|
|
548
|
-
o += a;
|
|
549
|
-
continue;
|
|
550
|
-
}
|
|
551
|
-
if ((r[5] || r[6]) && n % 3 && !((n + a) % 3)) {
|
|
552
|
-
s += a;
|
|
553
|
-
continue;
|
|
554
|
-
}
|
|
555
|
-
if (o -= a, o > 0) continue;
|
|
556
|
-
a = Math.min(a, a + o + s);
|
|
557
|
-
let t = [...r[0]][0].length, c = e.slice(0, n + r.index + t + a);
|
|
558
|
-
if (Math.min(n, a) % 2) {
|
|
559
|
-
let e = c.slice(1, -1);
|
|
560
|
-
return {
|
|
561
|
-
type: "em",
|
|
562
|
-
raw: c,
|
|
563
|
-
text: e,
|
|
564
|
-
tokens: this.lexer.inlineTokens(e)
|
|
565
|
-
};
|
|
566
|
-
}
|
|
567
|
-
let l = c.slice(2, -2);
|
|
568
|
-
return {
|
|
569
|
-
type: "strong",
|
|
570
|
-
raw: c,
|
|
571
|
-
text: l,
|
|
572
|
-
tokens: this.lexer.inlineTokens(l)
|
|
573
|
-
};
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
codespan(e) {
|
|
578
|
-
let t = this.rules.inline.code.exec(e);
|
|
579
|
-
if (t) {
|
|
580
|
-
let e = t[2].replace(this.rules.other.newLineCharGlobal, " "), n = this.rules.other.nonSpaceChar.test(e), r = this.rules.other.startingSpaceChar.test(e) && this.rules.other.endingSpaceChar.test(e);
|
|
581
|
-
return n && r && (e = e.substring(1, e.length - 1)), {
|
|
582
|
-
type: "codespan",
|
|
583
|
-
raw: t[0],
|
|
584
|
-
text: e
|
|
585
|
-
};
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
br(e) {
|
|
589
|
-
let t = this.rules.inline.br.exec(e);
|
|
590
|
-
if (t) return {
|
|
591
|
-
type: "br",
|
|
592
|
-
raw: t[0]
|
|
593
|
-
};
|
|
594
|
-
}
|
|
595
|
-
del(e) {
|
|
596
|
-
let t = this.rules.inline.del.exec(e);
|
|
597
|
-
if (t) return {
|
|
598
|
-
type: "del",
|
|
599
|
-
raw: t[0],
|
|
600
|
-
text: t[2],
|
|
601
|
-
tokens: this.lexer.inlineTokens(t[2])
|
|
602
|
-
};
|
|
603
|
-
}
|
|
604
|
-
autolink(e) {
|
|
605
|
-
let t = this.rules.inline.autolink.exec(e);
|
|
606
|
-
if (t) {
|
|
607
|
-
let e, n;
|
|
608
|
-
return t[2] === "@" ? (e = t[1], n = "mailto:" + e) : (e = t[1], n = e), {
|
|
609
|
-
type: "link",
|
|
610
|
-
raw: t[0],
|
|
611
|
-
text: e,
|
|
612
|
-
href: n,
|
|
613
|
-
tokens: [{
|
|
614
|
-
type: "text",
|
|
615
|
-
raw: e,
|
|
616
|
-
text: e
|
|
617
|
-
}]
|
|
618
|
-
};
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
url(e) {
|
|
622
|
-
let t;
|
|
623
|
-
if (t = this.rules.inline.url.exec(e)) {
|
|
624
|
-
let e, n;
|
|
625
|
-
if (t[2] === "@") e = t[0], n = "mailto:" + e;
|
|
626
|
-
else {
|
|
627
|
-
let r;
|
|
628
|
-
do
|
|
629
|
-
r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
|
|
630
|
-
while (r !== t[0]);
|
|
631
|
-
e = t[0], n = t[1] === "www." ? "http://" + t[0] : t[0];
|
|
632
|
-
}
|
|
633
|
-
return {
|
|
634
|
-
type: "link",
|
|
635
|
-
raw: t[0],
|
|
636
|
-
text: e,
|
|
637
|
-
href: n,
|
|
638
|
-
tokens: [{
|
|
639
|
-
type: "text",
|
|
640
|
-
raw: e,
|
|
641
|
-
text: e
|
|
642
|
-
}]
|
|
643
|
-
};
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
inlineText(e) {
|
|
647
|
-
let t = this.rules.inline.text.exec(e);
|
|
648
|
-
if (t) {
|
|
649
|
-
let e = this.lexer.state.inRawBlock;
|
|
650
|
-
return {
|
|
651
|
-
type: "text",
|
|
652
|
-
raw: t[0],
|
|
653
|
-
text: t[0],
|
|
654
|
-
escaped: e
|
|
655
|
-
};
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
}, R = class e {
|
|
659
|
-
tokens;
|
|
660
|
-
options;
|
|
661
|
-
state;
|
|
662
|
-
tokenizer;
|
|
663
|
-
inlineQueue;
|
|
664
|
-
constructor(e) {
|
|
665
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || v, this.options.tokenizer = this.options.tokenizer || new L(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
666
|
-
inLink: !1,
|
|
667
|
-
inRawBlock: !1,
|
|
668
|
-
top: !0
|
|
669
|
-
};
|
|
670
|
-
let t = {
|
|
671
|
-
other: x,
|
|
672
|
-
block: N.normal,
|
|
673
|
-
inline: P.normal
|
|
674
|
-
};
|
|
675
|
-
this.options.pedantic ? (t.block = N.pedantic, t.inline = P.pedantic) : this.options.gfm && (t.block = N.gfm, t.inline = this.options.breaks ? P.breaks : P.gfm), this.tokenizer.rules = t;
|
|
676
|
-
}
|
|
677
|
-
static get rules() {
|
|
678
|
-
return {
|
|
679
|
-
block: N,
|
|
680
|
-
inline: P
|
|
681
|
-
};
|
|
682
|
-
}
|
|
683
|
-
static lex(t, n) {
|
|
684
|
-
return new e(n).lex(t);
|
|
685
|
-
}
|
|
686
|
-
static lexInline(t, n) {
|
|
687
|
-
return new e(n).inlineTokens(t);
|
|
688
|
-
}
|
|
689
|
-
lex(e) {
|
|
690
|
-
e = e.replace(x.carriageReturn, "\n"), this.blockTokens(e, this.tokens);
|
|
691
|
-
for (let e = 0; e < this.inlineQueue.length; e++) {
|
|
692
|
-
let t = this.inlineQueue[e];
|
|
693
|
-
this.inlineTokens(t.src, t.tokens);
|
|
694
|
-
}
|
|
695
|
-
return this.inlineQueue = [], this.tokens;
|
|
696
|
-
}
|
|
697
|
-
blockTokens(e, t = [], n = !1) {
|
|
698
|
-
for (this.options.pedantic && (e = e.replace(x.tabCharGlobal, " ").replace(x.spaceLine, "")); e;) {
|
|
699
|
-
let r;
|
|
700
|
-
if (this.options.extensions?.block?.some((n) => (r = n.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1)) continue;
|
|
701
|
-
if (r = this.tokenizer.space(e)) {
|
|
702
|
-
e = e.substring(r.raw.length);
|
|
703
|
-
let n = t.at(-1);
|
|
704
|
-
r.raw.length === 1 && n !== void 0 ? n.raw += "\n" : t.push(r);
|
|
705
|
-
continue;
|
|
706
|
-
}
|
|
707
|
-
if (r = this.tokenizer.code(e)) {
|
|
708
|
-
e = e.substring(r.raw.length);
|
|
709
|
-
let n = t.at(-1);
|
|
710
|
-
n?.type === "paragraph" || n?.type === "text" ? (n.raw += "\n" + r.raw, n.text += "\n" + r.text, this.inlineQueue.at(-1).src = n.text) : t.push(r);
|
|
711
|
-
continue;
|
|
712
|
-
}
|
|
713
|
-
if (r = this.tokenizer.fences(e)) {
|
|
714
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
715
|
-
continue;
|
|
716
|
-
}
|
|
717
|
-
if (r = this.tokenizer.heading(e)) {
|
|
718
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
719
|
-
continue;
|
|
720
|
-
}
|
|
721
|
-
if (r = this.tokenizer.hr(e)) {
|
|
722
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
723
|
-
continue;
|
|
724
|
-
}
|
|
725
|
-
if (r = this.tokenizer.blockquote(e)) {
|
|
726
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
727
|
-
continue;
|
|
728
|
-
}
|
|
729
|
-
if (r = this.tokenizer.list(e)) {
|
|
730
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
731
|
-
continue;
|
|
732
|
-
}
|
|
733
|
-
if (r = this.tokenizer.html(e)) {
|
|
734
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
735
|
-
continue;
|
|
736
|
-
}
|
|
737
|
-
if (r = this.tokenizer.def(e)) {
|
|
738
|
-
e = e.substring(r.raw.length);
|
|
739
|
-
let n = t.at(-1);
|
|
740
|
-
n?.type === "paragraph" || n?.type === "text" ? (n.raw += "\n" + r.raw, n.text += "\n" + r.raw, this.inlineQueue.at(-1).src = n.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = {
|
|
741
|
-
href: r.href,
|
|
742
|
-
title: r.title
|
|
743
|
-
});
|
|
744
|
-
continue;
|
|
745
|
-
}
|
|
746
|
-
if (r = this.tokenizer.table(e)) {
|
|
747
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
748
|
-
continue;
|
|
749
|
-
}
|
|
750
|
-
if (r = this.tokenizer.lheading(e)) {
|
|
751
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
752
|
-
continue;
|
|
753
|
-
}
|
|
754
|
-
let i = e;
|
|
755
|
-
if (this.options.extensions?.startBlock) {
|
|
756
|
-
let t = Infinity, n = e.slice(1), r;
|
|
757
|
-
this.options.extensions.startBlock.forEach((e) => {
|
|
758
|
-
r = e.call({ lexer: this }, n), typeof r == "number" && r >= 0 && (t = Math.min(t, r));
|
|
759
|
-
}), t < Infinity && t >= 0 && (i = e.substring(0, t + 1));
|
|
760
|
-
}
|
|
761
|
-
if (this.state.top && (r = this.tokenizer.paragraph(i))) {
|
|
762
|
-
let a = t.at(-1);
|
|
763
|
-
n && a?.type === "paragraph" ? (a.raw += "\n" + r.raw, a.text += "\n" + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
|
|
764
|
-
continue;
|
|
765
|
-
}
|
|
766
|
-
if (r = this.tokenizer.text(e)) {
|
|
767
|
-
e = e.substring(r.raw.length);
|
|
768
|
-
let n = t.at(-1);
|
|
769
|
-
n?.type === "text" ? (n.raw += "\n" + r.raw, n.text += "\n" + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = n.text) : t.push(r);
|
|
770
|
-
continue;
|
|
771
|
-
}
|
|
772
|
-
if (e) {
|
|
773
|
-
let t = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
774
|
-
if (this.options.silent) {
|
|
775
|
-
console.error(t);
|
|
776
|
-
break;
|
|
777
|
-
}
|
|
778
|
-
throw Error(t);
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
return this.state.top = !0, t;
|
|
782
|
-
}
|
|
783
|
-
inline(e, t = []) {
|
|
784
|
-
return this.inlineQueue.push({
|
|
785
|
-
src: e,
|
|
786
|
-
tokens: t
|
|
787
|
-
}), t;
|
|
788
|
-
}
|
|
789
|
-
inlineTokens(e, t = []) {
|
|
790
|
-
let n = e, r = null;
|
|
791
|
-
if (this.tokens.links) {
|
|
792
|
-
let e = Object.keys(this.tokens.links);
|
|
793
|
-
if (e.length > 0) for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null;) e.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
794
|
-
}
|
|
795
|
-
for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null;) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
796
|
-
for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) != null;) n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
797
|
-
let i = !1, a = "";
|
|
798
|
-
for (; e;) {
|
|
799
|
-
i || (a = ""), i = !1;
|
|
800
|
-
let r;
|
|
801
|
-
if (this.options.extensions?.inline?.some((n) => (r = n.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1)) continue;
|
|
802
|
-
if (r = this.tokenizer.escape(e)) {
|
|
803
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
804
|
-
continue;
|
|
805
|
-
}
|
|
806
|
-
if (r = this.tokenizer.tag(e)) {
|
|
807
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
808
|
-
continue;
|
|
809
|
-
}
|
|
810
|
-
if (r = this.tokenizer.link(e)) {
|
|
811
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
812
|
-
continue;
|
|
813
|
-
}
|
|
814
|
-
if (r = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
815
|
-
e = e.substring(r.raw.length);
|
|
816
|
-
let n = t.at(-1);
|
|
817
|
-
r.type === "text" && n?.type === "text" ? (n.raw += r.raw, n.text += r.text) : t.push(r);
|
|
818
|
-
continue;
|
|
819
|
-
}
|
|
820
|
-
if (r = this.tokenizer.emStrong(e, n, a)) {
|
|
821
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
822
|
-
continue;
|
|
823
|
-
}
|
|
824
|
-
if (r = this.tokenizer.codespan(e)) {
|
|
825
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
826
|
-
continue;
|
|
827
|
-
}
|
|
828
|
-
if (r = this.tokenizer.br(e)) {
|
|
829
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
830
|
-
continue;
|
|
831
|
-
}
|
|
832
|
-
if (r = this.tokenizer.del(e)) {
|
|
833
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
834
|
-
continue;
|
|
835
|
-
}
|
|
836
|
-
if (r = this.tokenizer.autolink(e)) {
|
|
837
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
838
|
-
continue;
|
|
839
|
-
}
|
|
840
|
-
if (!this.state.inLink && (r = this.tokenizer.url(e))) {
|
|
841
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
842
|
-
continue;
|
|
843
|
-
}
|
|
844
|
-
let o = e;
|
|
845
|
-
if (this.options.extensions?.startInline) {
|
|
846
|
-
let t = Infinity, n = e.slice(1), r;
|
|
847
|
-
this.options.extensions.startInline.forEach((e) => {
|
|
848
|
-
r = e.call({ lexer: this }, n), typeof r == "number" && r >= 0 && (t = Math.min(t, r));
|
|
849
|
-
}), t < Infinity && t >= 0 && (o = e.substring(0, t + 1));
|
|
850
|
-
}
|
|
851
|
-
if (r = this.tokenizer.inlineText(o)) {
|
|
852
|
-
e = e.substring(r.raw.length), r.raw.slice(-1) !== "_" && (a = r.raw.slice(-1)), i = !0;
|
|
853
|
-
let n = t.at(-1);
|
|
854
|
-
n?.type === "text" ? (n.raw += r.raw, n.text += r.text) : t.push(r);
|
|
855
|
-
continue;
|
|
856
|
-
}
|
|
857
|
-
if (e) {
|
|
858
|
-
let t = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
859
|
-
if (this.options.silent) {
|
|
860
|
-
console.error(t);
|
|
861
|
-
break;
|
|
862
|
-
}
|
|
863
|
-
throw Error(t);
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
return t;
|
|
867
|
-
}
|
|
868
|
-
}, z = class {
|
|
869
|
-
options;
|
|
870
|
-
parser;
|
|
871
|
-
constructor(e) {
|
|
872
|
-
this.options = e || v;
|
|
873
|
-
}
|
|
874
|
-
space(e) {
|
|
875
|
-
return "";
|
|
876
|
-
}
|
|
877
|
-
code({ text: e, lang: t, escaped: n }) {
|
|
878
|
-
let r = (t || "").match(x.notSpaceStart)?.[0], i = e.replace(x.endingNewline, "") + "\n";
|
|
879
|
-
return r ? "<pre><code class=\"language-" + F(r) + "\">" + (n ? i : F(i, !0)) + "</code></pre>\n" : "<pre><code>" + (n ? i : F(i, !0)) + "</code></pre>\n";
|
|
880
|
-
}
|
|
881
|
-
blockquote({ tokens: e }) {
|
|
882
|
-
return `<blockquote>
|
|
883
|
-
${this.parser.parse(e)}</blockquote>
|
|
884
|
-
`;
|
|
885
|
-
}
|
|
886
|
-
html({ text: e }) {
|
|
887
|
-
return e;
|
|
888
|
-
}
|
|
889
|
-
heading({ tokens: e, depth: t }) {
|
|
890
|
-
return `<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
891
|
-
`;
|
|
892
|
-
}
|
|
893
|
-
hr(e) {
|
|
894
|
-
return "<hr>\n";
|
|
895
|
-
}
|
|
896
|
-
list(e) {
|
|
897
|
-
let t = e.ordered, n = e.start, r = "";
|
|
898
|
-
for (let t = 0; t < e.items.length; t++) {
|
|
899
|
-
let n = e.items[t];
|
|
900
|
-
r += this.listitem(n);
|
|
901
|
-
}
|
|
902
|
-
let i = t ? "ol" : "ul", a = t && n !== 1 ? " start=\"" + n + "\"" : "";
|
|
903
|
-
return "<" + i + a + ">\n" + r + "</" + i + ">\n";
|
|
904
|
-
}
|
|
905
|
-
listitem(e) {
|
|
906
|
-
let t = "";
|
|
907
|
-
if (e.task) {
|
|
908
|
-
let n = this.checkbox({ checked: !!e.checked });
|
|
909
|
-
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 + " " + F(e.tokens[0].tokens[0].text), e.tokens[0].tokens[0].escaped = !0)) : e.tokens.unshift({
|
|
910
|
-
type: "text",
|
|
911
|
-
raw: n + " ",
|
|
912
|
-
text: n + " ",
|
|
913
|
-
escaped: !0
|
|
914
|
-
}) : t += n + " ";
|
|
915
|
-
}
|
|
916
|
-
return t += this.parser.parse(e.tokens, !!e.loose), `<li>${t}</li>
|
|
917
|
-
`;
|
|
918
|
-
}
|
|
919
|
-
checkbox({ checked: e }) {
|
|
920
|
-
return "<input " + (e ? "checked=\"\" " : "") + "disabled=\"\" type=\"checkbox\">";
|
|
921
|
-
}
|
|
922
|
-
paragraph({ tokens: e }) {
|
|
923
|
-
return `<p>${this.parser.parseInline(e)}</p>
|
|
924
|
-
`;
|
|
925
|
-
}
|
|
926
|
-
table(e) {
|
|
927
|
-
let t = "", n = "";
|
|
928
|
-
for (let t = 0; t < e.header.length; t++) n += this.tablecell(e.header[t]);
|
|
929
|
-
t += this.tablerow({ text: n });
|
|
930
|
-
let r = "";
|
|
931
|
-
for (let t = 0; t < e.rows.length; t++) {
|
|
932
|
-
let i = e.rows[t];
|
|
933
|
-
n = "";
|
|
934
|
-
for (let e = 0; e < i.length; e++) n += this.tablecell(i[e]);
|
|
935
|
-
r += this.tablerow({ text: n });
|
|
936
|
-
}
|
|
937
|
-
return r &&= `<tbody>${r}</tbody>`, "<table>\n<thead>\n" + t + "</thead>\n" + r + "</table>\n";
|
|
938
|
-
}
|
|
939
|
-
tablerow({ text: e }) {
|
|
940
|
-
return `<tr>
|
|
941
|
-
${e}</tr>
|
|
942
|
-
`;
|
|
943
|
-
}
|
|
944
|
-
tablecell(e) {
|
|
945
|
-
let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
|
|
946
|
-
return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
|
|
947
|
-
`;
|
|
948
|
-
}
|
|
949
|
-
strong({ tokens: e }) {
|
|
950
|
-
return `<strong>${this.parser.parseInline(e)}</strong>`;
|
|
951
|
-
}
|
|
952
|
-
em({ tokens: e }) {
|
|
953
|
-
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
954
|
-
}
|
|
955
|
-
codespan({ text: e }) {
|
|
956
|
-
return `<code>${F(e, !0)}</code>`;
|
|
957
|
-
}
|
|
958
|
-
br(e) {
|
|
959
|
-
return "<br>";
|
|
960
|
-
}
|
|
961
|
-
del({ tokens: e }) {
|
|
962
|
-
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
963
|
-
}
|
|
964
|
-
link({ href: e, title: t, tokens: n }) {
|
|
965
|
-
let r = this.parser.parseInline(n), i = $e(e);
|
|
966
|
-
if (i === null) return r;
|
|
967
|
-
e = i;
|
|
968
|
-
let a = "<a href=\"" + e + "\"";
|
|
969
|
-
return t && (a += " title=\"" + F(t) + "\""), a += ">" + r + "</a>", a;
|
|
970
|
-
}
|
|
971
|
-
image({ href: e, title: t, text: n, tokens: r }) {
|
|
972
|
-
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
973
|
-
let i = $e(e);
|
|
974
|
-
if (i === null) return F(n);
|
|
975
|
-
e = i;
|
|
976
|
-
let a = `<img src="${e}" alt="${n}"`;
|
|
977
|
-
return t && (a += ` title="${F(t)}"`), a += ">", a;
|
|
978
|
-
}
|
|
979
|
-
text(e) {
|
|
980
|
-
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : F(e.text);
|
|
981
|
-
}
|
|
982
|
-
}, B = class {
|
|
983
|
-
strong({ text: e }) {
|
|
984
|
-
return e;
|
|
985
|
-
}
|
|
986
|
-
em({ text: e }) {
|
|
987
|
-
return e;
|
|
988
|
-
}
|
|
989
|
-
codespan({ text: e }) {
|
|
990
|
-
return e;
|
|
991
|
-
}
|
|
992
|
-
del({ text: e }) {
|
|
993
|
-
return e;
|
|
994
|
-
}
|
|
995
|
-
html({ text: e }) {
|
|
996
|
-
return e;
|
|
997
|
-
}
|
|
998
|
-
text({ text: e }) {
|
|
999
|
-
return e;
|
|
1000
|
-
}
|
|
1001
|
-
link({ text: e }) {
|
|
1002
|
-
return "" + e;
|
|
1003
|
-
}
|
|
1004
|
-
image({ text: e }) {
|
|
1005
|
-
return "" + e;
|
|
1006
|
-
}
|
|
1007
|
-
br() {
|
|
1008
|
-
return "";
|
|
1009
|
-
}
|
|
1010
|
-
}, V = class e {
|
|
1011
|
-
options;
|
|
1012
|
-
renderer;
|
|
1013
|
-
textRenderer;
|
|
1014
|
-
constructor(e) {
|
|
1015
|
-
this.options = e || v, this.options.renderer = this.options.renderer || new z(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new B();
|
|
1016
|
-
}
|
|
1017
|
-
static parse(t, n) {
|
|
1018
|
-
return new e(n).parse(t);
|
|
1019
|
-
}
|
|
1020
|
-
static parseInline(t, n) {
|
|
1021
|
-
return new e(n).parseInline(t);
|
|
1022
|
-
}
|
|
1023
|
-
parse(e, t = !0) {
|
|
1024
|
-
let n = "";
|
|
1025
|
-
for (let r = 0; r < e.length; r++) {
|
|
1026
|
-
let i = e[r];
|
|
1027
|
-
if (this.options.extensions?.renderers?.[i.type]) {
|
|
1028
|
-
let e = i, t = this.options.extensions.renderers[e.type].call({ parser: this }, e);
|
|
1029
|
-
if (t !== !1 || ![
|
|
1030
|
-
"space",
|
|
1031
|
-
"hr",
|
|
1032
|
-
"heading",
|
|
1033
|
-
"code",
|
|
1034
|
-
"table",
|
|
1035
|
-
"blockquote",
|
|
1036
|
-
"list",
|
|
1037
|
-
"html",
|
|
1038
|
-
"paragraph",
|
|
1039
|
-
"text"
|
|
1040
|
-
].includes(e.type)) {
|
|
1041
|
-
n += t || "";
|
|
1042
|
-
continue;
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
let a = i;
|
|
1046
|
-
switch (a.type) {
|
|
1047
|
-
case "space":
|
|
1048
|
-
n += this.renderer.space(a);
|
|
1049
|
-
continue;
|
|
1050
|
-
case "hr":
|
|
1051
|
-
n += this.renderer.hr(a);
|
|
1052
|
-
continue;
|
|
1053
|
-
case "heading":
|
|
1054
|
-
n += this.renderer.heading(a);
|
|
1055
|
-
continue;
|
|
1056
|
-
case "code":
|
|
1057
|
-
n += this.renderer.code(a);
|
|
1058
|
-
continue;
|
|
1059
|
-
case "table":
|
|
1060
|
-
n += this.renderer.table(a);
|
|
1061
|
-
continue;
|
|
1062
|
-
case "blockquote":
|
|
1063
|
-
n += this.renderer.blockquote(a);
|
|
1064
|
-
continue;
|
|
1065
|
-
case "list":
|
|
1066
|
-
n += this.renderer.list(a);
|
|
1067
|
-
continue;
|
|
1068
|
-
case "html":
|
|
1069
|
-
n += this.renderer.html(a);
|
|
1070
|
-
continue;
|
|
1071
|
-
case "paragraph":
|
|
1072
|
-
n += this.renderer.paragraph(a);
|
|
1073
|
-
continue;
|
|
1074
|
-
case "text": {
|
|
1075
|
-
let i = a, o = this.renderer.text(i);
|
|
1076
|
-
for (; r + 1 < e.length && e[r + 1].type === "text";) i = e[++r], o += "\n" + this.renderer.text(i);
|
|
1077
|
-
n += t ? this.renderer.paragraph({
|
|
1078
|
-
type: "paragraph",
|
|
1079
|
-
raw: o,
|
|
1080
|
-
text: o,
|
|
1081
|
-
tokens: [{
|
|
1082
|
-
type: "text",
|
|
1083
|
-
raw: o,
|
|
1084
|
-
text: o,
|
|
1085
|
-
escaped: !0
|
|
1086
|
-
}]
|
|
1087
|
-
}) : o;
|
|
1088
|
-
continue;
|
|
1089
|
-
}
|
|
1090
|
-
default: {
|
|
1091
|
-
let e = "Token with \"" + a.type + "\" type was not found.";
|
|
1092
|
-
if (this.options.silent) return console.error(e), "";
|
|
1093
|
-
throw Error(e);
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
return n;
|
|
1098
|
-
}
|
|
1099
|
-
parseInline(e, t = this.renderer) {
|
|
1100
|
-
let n = "";
|
|
1101
|
-
for (let r = 0; r < e.length; r++) {
|
|
1102
|
-
let i = e[r];
|
|
1103
|
-
if (this.options.extensions?.renderers?.[i.type]) {
|
|
1104
|
-
let e = this.options.extensions.renderers[i.type].call({ parser: this }, i);
|
|
1105
|
-
if (e !== !1 || ![
|
|
1106
|
-
"escape",
|
|
1107
|
-
"html",
|
|
1108
|
-
"link",
|
|
1109
|
-
"image",
|
|
1110
|
-
"strong",
|
|
1111
|
-
"em",
|
|
1112
|
-
"codespan",
|
|
1113
|
-
"br",
|
|
1114
|
-
"del",
|
|
1115
|
-
"text"
|
|
1116
|
-
].includes(i.type)) {
|
|
1117
|
-
n += e || "";
|
|
1118
|
-
continue;
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
let a = i;
|
|
1122
|
-
switch (a.type) {
|
|
1123
|
-
case "escape":
|
|
1124
|
-
n += t.text(a);
|
|
1125
|
-
break;
|
|
1126
|
-
case "html":
|
|
1127
|
-
n += t.html(a);
|
|
1128
|
-
break;
|
|
1129
|
-
case "link":
|
|
1130
|
-
n += t.link(a);
|
|
1131
|
-
break;
|
|
1132
|
-
case "image":
|
|
1133
|
-
n += t.image(a);
|
|
1134
|
-
break;
|
|
1135
|
-
case "strong":
|
|
1136
|
-
n += t.strong(a);
|
|
1137
|
-
break;
|
|
1138
|
-
case "em":
|
|
1139
|
-
n += t.em(a);
|
|
1140
|
-
break;
|
|
1141
|
-
case "codespan":
|
|
1142
|
-
n += t.codespan(a);
|
|
1143
|
-
break;
|
|
1144
|
-
case "br":
|
|
1145
|
-
n += t.br(a);
|
|
1146
|
-
break;
|
|
1147
|
-
case "del":
|
|
1148
|
-
n += t.del(a);
|
|
1149
|
-
break;
|
|
1150
|
-
case "text":
|
|
1151
|
-
n += t.text(a);
|
|
1152
|
-
break;
|
|
1153
|
-
default: {
|
|
1154
|
-
let e = "Token with \"" + a.type + "\" type was not found.";
|
|
1155
|
-
if (this.options.silent) return console.error(e), "";
|
|
1156
|
-
throw Error(e);
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1159
|
-
}
|
|
1160
|
-
return n;
|
|
1161
|
-
}
|
|
1162
|
-
}, H = class {
|
|
1163
|
-
options;
|
|
1164
|
-
block;
|
|
1165
|
-
constructor(e) {
|
|
1166
|
-
this.options = e || v;
|
|
1167
|
-
}
|
|
1168
|
-
static passThroughHooks = /* @__PURE__ */ new Set([
|
|
1169
|
-
"preprocess",
|
|
1170
|
-
"postprocess",
|
|
1171
|
-
"processAllTokens"
|
|
1172
|
-
]);
|
|
1173
|
-
preprocess(e) {
|
|
1174
|
-
return e;
|
|
1175
|
-
}
|
|
1176
|
-
postprocess(e) {
|
|
1177
|
-
return e;
|
|
1178
|
-
}
|
|
1179
|
-
processAllTokens(e) {
|
|
1180
|
-
return e;
|
|
1181
|
-
}
|
|
1182
|
-
provideLexer() {
|
|
1183
|
-
return this.block ? R.lex : R.lexInline;
|
|
1184
|
-
}
|
|
1185
|
-
provideParser() {
|
|
1186
|
-
return this.block ? V.parse : V.parseInline;
|
|
1187
|
-
}
|
|
1188
|
-
}, it = class {
|
|
1189
|
-
defaults = _();
|
|
1190
|
-
options = this.setOptions;
|
|
1191
|
-
parse = this.parseMarkdown(!0);
|
|
1192
|
-
parseInline = this.parseMarkdown(!1);
|
|
1193
|
-
Parser = V;
|
|
1194
|
-
Renderer = z;
|
|
1195
|
-
TextRenderer = B;
|
|
1196
|
-
Lexer = R;
|
|
1197
|
-
Tokenizer = L;
|
|
1198
|
-
Hooks = H;
|
|
1199
|
-
constructor(...e) {
|
|
1200
|
-
this.use(...e);
|
|
1201
|
-
}
|
|
1202
|
-
walkTokens(e, t) {
|
|
1203
|
-
let n = [];
|
|
1204
|
-
for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
|
|
1205
|
-
case "table": {
|
|
1206
|
-
let e = r;
|
|
1207
|
-
for (let r of e.header) n = n.concat(this.walkTokens(r.tokens, t));
|
|
1208
|
-
for (let r of e.rows) for (let e of r) n = n.concat(this.walkTokens(e.tokens, t));
|
|
1209
|
-
break;
|
|
1210
|
-
}
|
|
1211
|
-
case "list": {
|
|
1212
|
-
let e = r;
|
|
1213
|
-
n = n.concat(this.walkTokens(e.items, t));
|
|
1214
|
-
break;
|
|
1215
|
-
}
|
|
1216
|
-
default: {
|
|
1217
|
-
let e = r;
|
|
1218
|
-
this.defaults.extensions?.childTokens?.[e.type] ? this.defaults.extensions.childTokens[e.type].forEach((r) => {
|
|
1219
|
-
let i = e[r].flat(Infinity);
|
|
1220
|
-
n = n.concat(this.walkTokens(i, t));
|
|
1221
|
-
}) : e.tokens && (n = n.concat(this.walkTokens(e.tokens, t)));
|
|
1222
|
-
}
|
|
1223
|
-
}
|
|
1224
|
-
return n;
|
|
1225
|
-
}
|
|
1226
|
-
use(...e) {
|
|
1227
|
-
let t = this.defaults.extensions || {
|
|
1228
|
-
renderers: {},
|
|
1229
|
-
childTokens: {}
|
|
1230
|
-
};
|
|
1231
|
-
return e.forEach((e) => {
|
|
1232
|
-
let n = { ...e };
|
|
1233
|
-
if (n.async = this.defaults.async || n.async || !1, e.extensions && (e.extensions.forEach((e) => {
|
|
1234
|
-
if (!e.name) throw Error("extension name required");
|
|
1235
|
-
if ("renderer" in e) {
|
|
1236
|
-
let n = t.renderers[e.name];
|
|
1237
|
-
n ? t.renderers[e.name] = function(...t) {
|
|
1238
|
-
let r = e.renderer.apply(this, t);
|
|
1239
|
-
return r === !1 && (r = n.apply(this, t)), r;
|
|
1240
|
-
} : t.renderers[e.name] = e.renderer;
|
|
1241
|
-
}
|
|
1242
|
-
if ("tokenizer" in e) {
|
|
1243
|
-
if (!e.level || e.level !== "block" && e.level !== "inline") throw Error("extension level must be 'block' or 'inline'");
|
|
1244
|
-
let n = t[e.level];
|
|
1245
|
-
n ? n.unshift(e.tokenizer) : t[e.level] = [e.tokenizer], e.start && (e.level === "block" ? t.startBlock ? t.startBlock.push(e.start) : t.startBlock = [e.start] : e.level === "inline" && (t.startInline ? t.startInline.push(e.start) : t.startInline = [e.start]));
|
|
1246
|
-
}
|
|
1247
|
-
"childTokens" in e && e.childTokens && (t.childTokens[e.name] = e.childTokens);
|
|
1248
|
-
}), n.extensions = t), e.renderer) {
|
|
1249
|
-
let t = this.defaults.renderer || new z(this.defaults);
|
|
1250
|
-
for (let n in e.renderer) {
|
|
1251
|
-
if (!(n in t)) throw Error(`renderer '${n}' does not exist`);
|
|
1252
|
-
if (["options", "parser"].includes(n)) continue;
|
|
1253
|
-
let r = n, i = e.renderer[r], a = t[r];
|
|
1254
|
-
t[r] = (...e) => {
|
|
1255
|
-
let n = i.apply(t, e);
|
|
1256
|
-
return n === !1 && (n = a.apply(t, e)), n || "";
|
|
1257
|
-
};
|
|
1258
|
-
}
|
|
1259
|
-
n.renderer = t;
|
|
1260
|
-
}
|
|
1261
|
-
if (e.tokenizer) {
|
|
1262
|
-
let t = this.defaults.tokenizer || new L(this.defaults);
|
|
1263
|
-
for (let n in e.tokenizer) {
|
|
1264
|
-
if (!(n in t)) throw Error(`tokenizer '${n}' does not exist`);
|
|
1265
|
-
if ([
|
|
1266
|
-
"options",
|
|
1267
|
-
"rules",
|
|
1268
|
-
"lexer"
|
|
1269
|
-
].includes(n)) continue;
|
|
1270
|
-
let r = n, i = e.tokenizer[r], a = t[r];
|
|
1271
|
-
t[r] = (...e) => {
|
|
1272
|
-
let n = i.apply(t, e);
|
|
1273
|
-
return n === !1 && (n = a.apply(t, e)), n;
|
|
1274
|
-
};
|
|
1275
|
-
}
|
|
1276
|
-
n.tokenizer = t;
|
|
1277
|
-
}
|
|
1278
|
-
if (e.hooks) {
|
|
1279
|
-
let t = this.defaults.hooks || new H();
|
|
1280
|
-
for (let n in e.hooks) {
|
|
1281
|
-
if (!(n in t)) throw Error(`hook '${n}' does not exist`);
|
|
1282
|
-
if (["options", "block"].includes(n)) continue;
|
|
1283
|
-
let r = n, i = e.hooks[r], a = t[r];
|
|
1284
|
-
t[r] = H.passThroughHooks.has(n) ? (e) => {
|
|
1285
|
-
if (this.defaults.async) return Promise.resolve(i.call(t, e)).then((e) => a.call(t, e));
|
|
1286
|
-
let n = i.call(t, e);
|
|
1287
|
-
return a.call(t, n);
|
|
1288
|
-
} : (...e) => {
|
|
1289
|
-
let n = i.apply(t, e);
|
|
1290
|
-
return n === !1 && (n = a.apply(t, e)), n;
|
|
1291
|
-
};
|
|
1292
|
-
}
|
|
1293
|
-
n.hooks = t;
|
|
1294
|
-
}
|
|
1295
|
-
if (e.walkTokens) {
|
|
1296
|
-
let t = this.defaults.walkTokens, r = e.walkTokens;
|
|
1297
|
-
n.walkTokens = function(e) {
|
|
1298
|
-
let n = [];
|
|
1299
|
-
return n.push(r.call(this, e)), t && (n = n.concat(t.call(this, e))), n;
|
|
1300
|
-
};
|
|
1301
|
-
}
|
|
1302
|
-
this.defaults = {
|
|
1303
|
-
...this.defaults,
|
|
1304
|
-
...n
|
|
1305
|
-
};
|
|
1306
|
-
}), this;
|
|
1307
|
-
}
|
|
1308
|
-
setOptions(e) {
|
|
1309
|
-
return this.defaults = {
|
|
1310
|
-
...this.defaults,
|
|
1311
|
-
...e
|
|
1312
|
-
}, this;
|
|
1313
|
-
}
|
|
1314
|
-
lexer(e, t) {
|
|
1315
|
-
return R.lex(e, t ?? this.defaults);
|
|
1316
|
-
}
|
|
1317
|
-
parser(e, t) {
|
|
1318
|
-
return V.parse(e, t ?? this.defaults);
|
|
1319
|
-
}
|
|
1320
|
-
parseMarkdown(e) {
|
|
1321
|
-
return (t, n) => {
|
|
1322
|
-
let r = { ...n }, i = {
|
|
1323
|
-
...this.defaults,
|
|
1324
|
-
...r
|
|
1325
|
-
}, a = this.onError(!!i.silent, !!i.async);
|
|
1326
|
-
if (this.defaults.async === !0 && r.async === !1) return a(/* @__PURE__ */ Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
1327
|
-
if (t == null) return a(/* @__PURE__ */ Error("marked(): input parameter is undefined or null"));
|
|
1328
|
-
if (typeof t != "string") return a(/* @__PURE__ */ Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
|
|
1329
|
-
i.hooks && (i.hooks.options = i, i.hooks.block = e);
|
|
1330
|
-
let o = i.hooks ? i.hooks.provideLexer() : e ? R.lex : R.lexInline, s = i.hooks ? i.hooks.provideParser() : e ? V.parse : V.parseInline;
|
|
1331
|
-
if (i.async) return Promise.resolve(i.hooks ? i.hooks.preprocess(t) : t).then((e) => o(e, i)).then((e) => i.hooks ? i.hooks.processAllTokens(e) : e).then((e) => i.walkTokens ? Promise.all(this.walkTokens(e, i.walkTokens)).then(() => e) : e).then((e) => s(e, i)).then((e) => i.hooks ? i.hooks.postprocess(e) : e).catch(a);
|
|
1332
|
-
try {
|
|
1333
|
-
i.hooks && (t = i.hooks.preprocess(t));
|
|
1334
|
-
let e = o(t, i);
|
|
1335
|
-
i.hooks && (e = i.hooks.processAllTokens(e)), i.walkTokens && this.walkTokens(e, i.walkTokens);
|
|
1336
|
-
let n = s(e, i);
|
|
1337
|
-
return i.hooks && (n = i.hooks.postprocess(n)), n;
|
|
1338
|
-
} catch (e) {
|
|
1339
|
-
return a(e);
|
|
1340
|
-
}
|
|
1341
|
-
};
|
|
1342
|
-
}
|
|
1343
|
-
onError(e, t) {
|
|
1344
|
-
return (n) => {
|
|
1345
|
-
if (n.message += "\nPlease report this to https://github.com/markedjs/marked.", e) {
|
|
1346
|
-
let e = "<p>An error occurred:</p><pre>" + F(n.message + "", !0) + "</pre>";
|
|
1347
|
-
return t ? Promise.resolve(e) : e;
|
|
1348
|
-
}
|
|
1349
|
-
if (t) return Promise.reject(n);
|
|
1350
|
-
throw n;
|
|
1351
|
-
};
|
|
1352
|
-
}
|
|
1353
|
-
}, U = new it();
|
|
1354
|
-
function W(e, t) {
|
|
1355
|
-
return U.parse(e, t);
|
|
1356
|
-
}
|
|
1357
|
-
W.options = W.setOptions = function(e) {
|
|
1358
|
-
return U.setOptions(e), W.defaults = U.defaults, ce(W.defaults), W;
|
|
1359
|
-
}, W.getDefaults = _, W.defaults = v, W.use = function(...e) {
|
|
1360
|
-
return U.use(...e), W.defaults = U.defaults, ce(W.defaults), W;
|
|
1361
|
-
}, W.walkTokens = function(e, t) {
|
|
1362
|
-
return U.walkTokens(e, t);
|
|
1363
|
-
}, W.parseInline = U.parseInline, W.Parser = V, W.parser = V.parse, W.Renderer = z, W.TextRenderer = B, W.Lexer = R, W.lexer = R.lex, W.Tokenizer = L, W.Hooks = H, W.parse = W, W.options, W.setOptions, W.use, W.walkTokens, W.parseInline, V.parse, R.lex;
|
|
1364
|
-
//#endregion
|
|
1365
|
-
//#region ../../node_modules/.bun/@codemirror+lsp-client@6.2.5/node_modules/@codemirror/lsp-client/dist/index.js
|
|
1366
|
-
var G = null;
|
|
1367
|
-
function at(e, t, n) {
|
|
1368
|
-
let r = G;
|
|
1369
|
-
try {
|
|
1370
|
-
return G = {
|
|
1371
|
-
view: e,
|
|
1372
|
-
language: t
|
|
1373
|
-
}, n();
|
|
1374
|
-
} finally {
|
|
1375
|
-
G = r;
|
|
1376
|
-
}
|
|
1377
|
-
}
|
|
1378
|
-
var ot = /*@__PURE__*/ new it({ walkTokens(t) {
|
|
1379
|
-
if (!G || t.type != "code") return;
|
|
1380
|
-
let n = G.language && G.language(t.lang);
|
|
1381
|
-
if (!n) {
|
|
1382
|
-
let e = G.view.state.facet(g);
|
|
1383
|
-
e && e.name == t.lang && (n = e);
|
|
1384
|
-
}
|
|
1385
|
-
if (!n) return;
|
|
1386
|
-
let r = { style: (e) => te(G.view.state, e) }, i = "";
|
|
1387
|
-
e(t.text, n.parser.parse(t.text), r, (e, t) => {
|
|
1388
|
-
i += t ? `<span class="${t}">${K(e)}</span>` : K(e);
|
|
1389
|
-
}, () => {
|
|
1390
|
-
i += "<br>";
|
|
1391
|
-
}), t.escaped = !0, t.text = i;
|
|
1392
|
-
} });
|
|
1393
|
-
function K(e) {
|
|
1394
|
-
return e.replace(/[\n<&]/g, (e) => e == "\n" ? "<br>" : e == "<" ? "<" : "&");
|
|
1395
|
-
}
|
|
1396
|
-
function st(e, t) {
|
|
1397
|
-
let n = t, r = e;
|
|
1398
|
-
return typeof r != "string" && (n = r.kind, r = r.value), n == "plaintext" ? K(r) : ot.parse(r, { async: !1 });
|
|
1399
|
-
}
|
|
1400
|
-
function q(e, t) {
|
|
1401
|
-
let n = e.lineAt(t);
|
|
1402
|
-
return {
|
|
1403
|
-
line: n.number - 1,
|
|
1404
|
-
character: t - n.from
|
|
1405
|
-
};
|
|
1406
|
-
}
|
|
1407
|
-
function J(e, t) {
|
|
1408
|
-
return e.line(t.line + 1).from + t.character;
|
|
1409
|
-
}
|
|
1410
|
-
function ct(e, t) {
|
|
1411
|
-
if (t.line < 0 || t.line >= e.lines) return null;
|
|
1412
|
-
let n = e.line(t.line + 1);
|
|
1413
|
-
return t.character < 0 || t.character > n.length ? null : n.from + t.character;
|
|
1414
|
-
}
|
|
1415
|
-
var Y = class {
|
|
1416
|
-
constructor(e, { client: t, uri: n, languageID: r }) {
|
|
1417
|
-
if (this.view = e, this.client = t, this.uri = n, !r) {
|
|
1418
|
-
let t = e.state.facet(g);
|
|
1419
|
-
r = t ? t.name : "";
|
|
1420
|
-
}
|
|
1421
|
-
t.workspace.openFile(n, r, e), this.syncedDoc = e.state.doc, this.unsyncedChanges = s.empty(e.state.doc.length);
|
|
1422
|
-
}
|
|
1423
|
-
docToHTML(e, t = "plaintext") {
|
|
1424
|
-
let n = at(this.view, this.client.config.highlightLanguage, () => st(e, t));
|
|
1425
|
-
return this.client.config.sanitizeHTML ? this.client.config.sanitizeHTML(n) : n;
|
|
1426
|
-
}
|
|
1427
|
-
toPosition(e, t = this.view.state.doc) {
|
|
1428
|
-
return q(t, e);
|
|
1429
|
-
}
|
|
1430
|
-
fromPosition(e, t = this.view.state.doc) {
|
|
1431
|
-
return J(t, e);
|
|
1432
|
-
}
|
|
1433
|
-
reportError(e, t) {
|
|
1434
|
-
d(this.view, {
|
|
1435
|
-
label: this.view.state.phrase(e) + ": " + (t.message || t),
|
|
1436
|
-
class: "cm-lsp-message cm-lsp-message-error",
|
|
1437
|
-
top: !0
|
|
1438
|
-
});
|
|
1439
|
-
}
|
|
1440
|
-
clear() {
|
|
1441
|
-
this.syncedDoc = this.view.state.doc, this.unsyncedChanges = s.empty(this.view.state.doc.length);
|
|
1442
|
-
}
|
|
1443
|
-
update(e) {
|
|
1444
|
-
e.docChanged && (this.unsyncedChanges = this.unsyncedChanges.compose(e.changes));
|
|
1445
|
-
}
|
|
1446
|
-
destroy() {
|
|
1447
|
-
this.client.workspace.closeFile(this.uri, this.view);
|
|
1448
|
-
}
|
|
1449
|
-
static get(e) {
|
|
1450
|
-
return e.plugin(lt);
|
|
1451
|
-
}
|
|
1452
|
-
static create(e, t, n) {
|
|
1453
|
-
return e.plugin(t, n);
|
|
1454
|
-
}
|
|
1455
|
-
}, lt = /*@__PURE__*/ f.fromClass(Y), ut = class {
|
|
1456
|
-
constructor(e) {
|
|
1457
|
-
this.client = e;
|
|
1458
|
-
}
|
|
1459
|
-
getFile(e) {
|
|
1460
|
-
return this.files.find((t) => t.uri == e) || null;
|
|
1461
|
-
}
|
|
1462
|
-
requestFile(e) {
|
|
1463
|
-
return Promise.resolve(this.getFile(e));
|
|
1464
|
-
}
|
|
1465
|
-
connected() {
|
|
1466
|
-
for (let e of this.files) this.client.didOpen(e);
|
|
1467
|
-
}
|
|
1468
|
-
disconnected() {}
|
|
1469
|
-
updateFile(e, t) {
|
|
1470
|
-
var n;
|
|
1471
|
-
let r = this.getFile(e);
|
|
1472
|
-
r && ((n = r.getView()) == null || n.dispatch(t));
|
|
1473
|
-
}
|
|
1474
|
-
displayFile(e) {
|
|
1475
|
-
let t = this.getFile(e);
|
|
1476
|
-
return Promise.resolve(t ? t.getView() : null);
|
|
1477
|
-
}
|
|
1478
|
-
}, dt = class {
|
|
1479
|
-
constructor(e, t, n, r, i) {
|
|
1480
|
-
this.uri = e, this.languageId = t, this.version = n, this.doc = r, this.view = i;
|
|
1481
|
-
}
|
|
1482
|
-
getView() {
|
|
1483
|
-
return this.view;
|
|
1484
|
-
}
|
|
1485
|
-
}, ft = class extends ut {
|
|
1486
|
-
constructor() {
|
|
1487
|
-
super(...arguments), this.files = [], this.fileVersions = Object.create(null);
|
|
1488
|
-
}
|
|
1489
|
-
nextFileVersion(e) {
|
|
1490
|
-
return this.fileVersions[e] = (this.fileVersions[e] ?? -1) + 1;
|
|
1491
|
-
}
|
|
1492
|
-
syncFiles() {
|
|
1493
|
-
let e = [];
|
|
1494
|
-
for (let t of this.files) {
|
|
1495
|
-
let n = Y.get(t.view);
|
|
1496
|
-
if (!n) continue;
|
|
1497
|
-
let r = n.unsyncedChanges;
|
|
1498
|
-
r.empty || (e.push({
|
|
1499
|
-
changes: r,
|
|
1500
|
-
file: t,
|
|
1501
|
-
prevDoc: t.doc
|
|
1502
|
-
}), t.doc = t.view.state.doc, t.version = this.nextFileVersion(t.uri), n.clear());
|
|
1503
|
-
}
|
|
1504
|
-
return e;
|
|
1505
|
-
}
|
|
1506
|
-
openFile(e, t, n) {
|
|
1507
|
-
if (this.getFile(e)) throw Error("Default workspace implementation doesn't support multiple views on the same file");
|
|
1508
|
-
let r = new dt(e, t, this.nextFileVersion(e), n.state.doc, n);
|
|
1509
|
-
this.files.push(r), this.client.didOpen(r);
|
|
1510
|
-
}
|
|
1511
|
-
closeFile(e) {
|
|
1512
|
-
let t = this.getFile(e);
|
|
1513
|
-
t && (this.files = this.files.filter((e) => e != t), this.client.didClose(e));
|
|
1514
|
-
}
|
|
1515
|
-
}, pt = /*@__PURE__*/ h.baseTheme({
|
|
1516
|
-
".cm-lsp-documentation": {
|
|
1517
|
-
padding: "0 7px",
|
|
1518
|
-
"& p, & pre": { margin: "2px 0" }
|
|
1519
|
-
},
|
|
1520
|
-
".cm-lsp-signature-tooltip": {
|
|
1521
|
-
padding: "2px 6px",
|
|
1522
|
-
borderRadius: "2.5px",
|
|
1523
|
-
position: "relative",
|
|
1524
|
-
maxWidth: "30em",
|
|
1525
|
-
maxHeight: "10em",
|
|
1526
|
-
overflowY: "scroll",
|
|
1527
|
-
"& .cm-lsp-documentation": {
|
|
1528
|
-
padding: "0",
|
|
1529
|
-
fontSize: "80%"
|
|
1530
|
-
},
|
|
1531
|
-
"& .cm-lsp-signature-num": {
|
|
1532
|
-
fontFamily: "monospace",
|
|
1533
|
-
position: "absolute",
|
|
1534
|
-
left: "2px",
|
|
1535
|
-
top: "4px",
|
|
1536
|
-
fontSize: "70%",
|
|
1537
|
-
lineHeight: "1.3"
|
|
1538
|
-
},
|
|
1539
|
-
"& .cm-lsp-signature": {
|
|
1540
|
-
fontFamily: "monospace",
|
|
1541
|
-
textIndent: "1em hanging"
|
|
1542
|
-
},
|
|
1543
|
-
"& .cm-lsp-active-parameter": { fontWeight: "bold" }
|
|
1544
|
-
},
|
|
1545
|
-
".cm-lsp-signature-multiple": { paddingLeft: "1.5em" },
|
|
1546
|
-
".cm-panel.cm-lsp-rename-panel": {
|
|
1547
|
-
padding: "2px 6px 4px",
|
|
1548
|
-
position: "relative",
|
|
1549
|
-
"& label": { fontSize: "80%" },
|
|
1550
|
-
"& [name=close]": {
|
|
1551
|
-
position: "absolute",
|
|
1552
|
-
top: "0",
|
|
1553
|
-
bottom: "0",
|
|
1554
|
-
right: "4px",
|
|
1555
|
-
backgroundColor: "inherit",
|
|
1556
|
-
border: "none",
|
|
1557
|
-
font: "inherit",
|
|
1558
|
-
padding: "0"
|
|
1559
|
-
}
|
|
1560
|
-
},
|
|
1561
|
-
".cm-lsp-message button[type=submit]": { display: "block" },
|
|
1562
|
-
".cm-lsp-reference-panel": {
|
|
1563
|
-
fontFamily: "monospace",
|
|
1564
|
-
whiteSpace: "pre",
|
|
1565
|
-
padding: "3px 6px",
|
|
1566
|
-
maxHeight: "120px",
|
|
1567
|
-
overflow: "auto",
|
|
1568
|
-
"& .cm-lsp-reference-file": { fontWeight: "bold" },
|
|
1569
|
-
"& .cm-lsp-reference": {
|
|
1570
|
-
cursor: "pointer",
|
|
1571
|
-
"&[aria-selected]": { backgroundColor: "#0077ee44" }
|
|
1572
|
-
},
|
|
1573
|
-
"& .cm-lsp-reference-line": { opacity: "0.7" }
|
|
1574
|
-
}
|
|
1575
|
-
}), mt = class {
|
|
1576
|
-
constructor(e, t, n) {
|
|
1577
|
-
this.id = e, this.params = t, this.timeout = n, this.promise = new Promise((e, t) => {
|
|
1578
|
-
this.resolve = e, this.reject = t;
|
|
1579
|
-
});
|
|
1580
|
-
}
|
|
1581
|
-
}, ht = {
|
|
1582
|
-
general: { markdown: { parser: "marked" } },
|
|
1583
|
-
textDocument: {
|
|
1584
|
-
completion: {
|
|
1585
|
-
completionItem: {
|
|
1586
|
-
snippetSupport: !0,
|
|
1587
|
-
documentationFormat: ["markdown", "plaintext"],
|
|
1588
|
-
insertReplaceSupport: !1
|
|
1589
|
-
},
|
|
1590
|
-
completionList: { itemDefaults: [
|
|
1591
|
-
"commitCharacters",
|
|
1592
|
-
"editRange",
|
|
1593
|
-
"insertTextFormat"
|
|
1594
|
-
] },
|
|
1595
|
-
completionItemKind: { valueSet: [] },
|
|
1596
|
-
contextSupport: !0
|
|
1597
|
-
},
|
|
1598
|
-
hover: { contentFormat: ["markdown", "plaintext"] },
|
|
1599
|
-
formatting: {},
|
|
1600
|
-
rename: {},
|
|
1601
|
-
signatureHelp: {
|
|
1602
|
-
contextSupport: !0,
|
|
1603
|
-
signatureInformation: {
|
|
1604
|
-
documentationFormat: ["markdown", "plaintext"],
|
|
1605
|
-
parameterInformation: { labelOffsetSupport: !0 },
|
|
1606
|
-
activeParameterSupport: !0
|
|
1607
|
-
}
|
|
1608
|
-
},
|
|
1609
|
-
definition: {},
|
|
1610
|
-
declaration: {},
|
|
1611
|
-
implementation: {},
|
|
1612
|
-
typeDefinition: {},
|
|
1613
|
-
references: {},
|
|
1614
|
-
diagnostic: {}
|
|
1615
|
-
},
|
|
1616
|
-
window: { showMessage: {} }
|
|
1617
|
-
}, gt = class {
|
|
1618
|
-
constructor(e) {
|
|
1619
|
-
this.client = e, this.mappings = /* @__PURE__ */ new Map(), this.startDocs = /* @__PURE__ */ new Map();
|
|
1620
|
-
for (let t of e.workspace.files) this.mappings.set(t.uri, s.empty(t.doc.length)), this.startDocs.set(t.uri, t.doc);
|
|
1621
|
-
}
|
|
1622
|
-
addChanges(e, t) {
|
|
1623
|
-
let n = this.mappings.get(e);
|
|
1624
|
-
n && this.mappings.set(e, n.composeDesc(t));
|
|
1625
|
-
}
|
|
1626
|
-
getMapping(e) {
|
|
1627
|
-
let t = this.mappings.get(e);
|
|
1628
|
-
if (!t) return null;
|
|
1629
|
-
let n = this.client.workspace.getFile(e)?.getView(), r = n && Y.get(n);
|
|
1630
|
-
return r ? t.composeDesc(r.unsyncedChanges) : t;
|
|
1631
|
-
}
|
|
1632
|
-
mapPos(e, t, r = -1, i = n.Simple) {
|
|
1633
|
-
let a = this.getMapping(e);
|
|
1634
|
-
return a ? a.mapPos(t, r, i) : t;
|
|
1635
|
-
}
|
|
1636
|
-
mapPosition(e, t, r = -1, i = n.Simple) {
|
|
1637
|
-
let a = this.startDocs.get(e);
|
|
1638
|
-
if (!a) throw Error("Cannot map from a file that's not in the workspace");
|
|
1639
|
-
let o = J(a, t), s = this.getMapping(e);
|
|
1640
|
-
return s ? s.mapPos(o, r, i) : o;
|
|
1641
|
-
}
|
|
1642
|
-
destroy() {
|
|
1643
|
-
this.client.activeMappings = this.client.activeMappings.filter((e) => e != this);
|
|
1644
|
-
}
|
|
1645
|
-
}, _t = {
|
|
1646
|
-
"window/logMessage": (e, t) => {
|
|
1647
|
-
t.type == 1 ? console.error("[lsp] " + t.message) : t.type == 2 && console.warn("[lsp] " + t.message);
|
|
1648
|
-
},
|
|
1649
|
-
"window/showMessage": (e, t) => {
|
|
1650
|
-
if (t.type > 3) return;
|
|
1651
|
-
let n;
|
|
1652
|
-
for (let t of e.workspace.files) if (n = t.getView()) break;
|
|
1653
|
-
n && d(n, {
|
|
1654
|
-
label: t.message,
|
|
1655
|
-
class: "cm-lsp-message cm-lsp-message-" + (t.type == 1 ? "error" : t.type == 2 ? "warning" : "info"),
|
|
1656
|
-
top: !0
|
|
1657
|
-
});
|
|
1658
|
-
}
|
|
1659
|
-
}, vt = class {
|
|
1660
|
-
constructor(e = {}) {
|
|
1661
|
-
if (this.config = e, this.transport = null, this.nextReqID = 0, this.requests = [], this.activeMappings = [], this.serverCapabilities = null, this.supportSync = -1, this.extensions = [], this.receiveMessage = this.receiveMessage.bind(this), this.initializing = new Promise((e, t) => this.init = {
|
|
1662
|
-
resolve: e,
|
|
1663
|
-
reject: t
|
|
1664
|
-
}), this.timeout = e.timeout ?? 3e3, this.workspace = e.workspace ? e.workspace(this) : new ft(this), e.extensions) for (let t of e.extensions) Array.isArray(t) || t.extension ? this.extensions.push(t) : t.editorExtension && this.extensions.push(t.editorExtension);
|
|
1665
|
-
}
|
|
1666
|
-
get connected() {
|
|
1667
|
-
return !!this.transport;
|
|
1668
|
-
}
|
|
1669
|
-
connect(e) {
|
|
1670
|
-
this.transport && this.transport.unsubscribe(this.receiveMessage), this.transport = e, e.subscribe(this.receiveMessage);
|
|
1671
|
-
let t = ht;
|
|
1672
|
-
if (this.config.extensions) for (let e of this.config.extensions) {
|
|
1673
|
-
let { clientCapabilities: n } = e;
|
|
1674
|
-
n && (t = bt(t, n));
|
|
1675
|
-
}
|
|
1676
|
-
return this.requestInner("initialize", {
|
|
1677
|
-
processId: null,
|
|
1678
|
-
clientInfo: { name: "@codemirror/lsp-client" },
|
|
1679
|
-
rootUri: this.config.rootUri || null,
|
|
1680
|
-
capabilities: t
|
|
1681
|
-
}).promise.then((t) => {
|
|
1682
|
-
this.serverCapabilities = t.capabilities;
|
|
1683
|
-
let n = t.capabilities.textDocumentSync;
|
|
1684
|
-
this.supportSync = n == null ? 0 : typeof n == "number" ? n : n.change ?? 0, e.send(JSON.stringify({
|
|
1685
|
-
jsonrpc: "2.0",
|
|
1686
|
-
method: "initialized",
|
|
1687
|
-
params: {}
|
|
1688
|
-
})), this.init.resolve(null);
|
|
1689
|
-
}, this.init.reject), this.workspace.connected(), this;
|
|
1690
|
-
}
|
|
1691
|
-
disconnect() {
|
|
1692
|
-
this.transport && this.transport.unsubscribe(this.receiveMessage), this.serverCapabilities = null, this.initializing = new Promise((e, t) => this.init = {
|
|
1693
|
-
resolve: e,
|
|
1694
|
-
reject: t
|
|
1695
|
-
}), this.workspace.disconnected();
|
|
1696
|
-
}
|
|
1697
|
-
plugin(e, t) {
|
|
1698
|
-
return [
|
|
1699
|
-
lt.of({
|
|
1700
|
-
client: this,
|
|
1701
|
-
uri: e,
|
|
1702
|
-
languageID: t
|
|
1703
|
-
}),
|
|
1704
|
-
pt,
|
|
1705
|
-
this.extensions
|
|
1706
|
-
];
|
|
1707
|
-
}
|
|
1708
|
-
didOpen(e) {
|
|
1709
|
-
this.notification("textDocument/didOpen", { textDocument: {
|
|
1710
|
-
uri: e.uri,
|
|
1711
|
-
languageId: e.languageId,
|
|
1712
|
-
text: e.doc.toString(),
|
|
1713
|
-
version: e.version
|
|
1714
|
-
} });
|
|
1715
|
-
}
|
|
1716
|
-
didClose(e) {
|
|
1717
|
-
this.notification("textDocument/didClose", { textDocument: { uri: e } });
|
|
1718
|
-
}
|
|
1719
|
-
receiveMessage(e) {
|
|
1720
|
-
let t = JSON.parse(e);
|
|
1721
|
-
if ("id" in t && !("method" in t)) {
|
|
1722
|
-
let e = this.requests.findIndex((e) => e.id == t.id);
|
|
1723
|
-
if (e < 0) console.warn(`[lsp] Received a response for non-existent request ${t.id}`);
|
|
1724
|
-
else {
|
|
1725
|
-
let n = this.requests[e];
|
|
1726
|
-
clearTimeout(n.timeout), this.requests.splice(e, 1), t.error ? n.reject(t.error) : n.resolve(t.result);
|
|
1727
|
-
}
|
|
1728
|
-
} else if ("id" in t) {
|
|
1729
|
-
let e = {
|
|
1730
|
-
jsonrpc: "2.0",
|
|
1731
|
-
id: t.id,
|
|
1732
|
-
error: {
|
|
1733
|
-
code: -32601,
|
|
1734
|
-
message: "Method not implemented"
|
|
1735
|
-
}
|
|
1736
|
-
};
|
|
1737
|
-
this.transport.send(JSON.stringify(e));
|
|
1738
|
-
} else {
|
|
1739
|
-
let e = this.config.notificationHandlers?.[t.method];
|
|
1740
|
-
if (e && e(this, t.params)) return;
|
|
1741
|
-
if (this.config.extensions) for (let e of this.config.extensions) {
|
|
1742
|
-
let { notificationHandlers: n } = e, r = n?.[t.method];
|
|
1743
|
-
if (r && r(this, t.params)) return;
|
|
1744
|
-
}
|
|
1745
|
-
let n = _t[t.method];
|
|
1746
|
-
n ? n(this, t.params) : this.config.unhandledNotification && this.config.unhandledNotification(this, t.method, t.params);
|
|
1747
|
-
}
|
|
1748
|
-
}
|
|
1749
|
-
request(e, t) {
|
|
1750
|
-
return this.transport ? this.initializing.then(() => this.requestInner(e, t).promise) : Promise.reject(/* @__PURE__ */ Error("Client not connected"));
|
|
1751
|
-
}
|
|
1752
|
-
requestInner(e, t, n = !1) {
|
|
1753
|
-
let r = ++this.nextReqID, i = {
|
|
1754
|
-
jsonrpc: "2.0",
|
|
1755
|
-
id: r,
|
|
1756
|
-
method: e,
|
|
1757
|
-
params: t
|
|
1758
|
-
}, a = new mt(r, t, setTimeout(() => this.timeoutRequest(a), this.timeout));
|
|
1759
|
-
this.requests.push(a);
|
|
1760
|
-
try {
|
|
1761
|
-
this.transport.send(JSON.stringify(i));
|
|
1762
|
-
} catch (e) {
|
|
1763
|
-
a.reject(e);
|
|
1764
|
-
}
|
|
1765
|
-
return a;
|
|
1766
|
-
}
|
|
1767
|
-
notification(e, t) {
|
|
1768
|
-
this.transport && this.initializing.then(() => {
|
|
1769
|
-
let n = {
|
|
1770
|
-
jsonrpc: "2.0",
|
|
1771
|
-
method: e,
|
|
1772
|
-
params: t
|
|
1773
|
-
};
|
|
1774
|
-
this.transport.send(JSON.stringify(n));
|
|
1775
|
-
});
|
|
1776
|
-
}
|
|
1777
|
-
cancelRequest(e) {
|
|
1778
|
-
let t = this.requests.find((t) => t.params === e);
|
|
1779
|
-
t && this.notification("$/cancelRequest", { id: t.id });
|
|
1780
|
-
}
|
|
1781
|
-
hasCapability(e) {
|
|
1782
|
-
return this.serverCapabilities ? !!this.serverCapabilities[e] : null;
|
|
1783
|
-
}
|
|
1784
|
-
workspaceMapping() {
|
|
1785
|
-
let e = new gt(this);
|
|
1786
|
-
return this.activeMappings.push(e), e;
|
|
1787
|
-
}
|
|
1788
|
-
withMapping(e) {
|
|
1789
|
-
let t = this.workspaceMapping();
|
|
1790
|
-
return e(t).finally(() => t.destroy());
|
|
1791
|
-
}
|
|
1792
|
-
sync() {
|
|
1793
|
-
for (let { file: e, changes: t, prevDoc: n } of this.workspace.syncFiles()) {
|
|
1794
|
-
for (let n of this.activeMappings) n.addChanges(e.uri, t);
|
|
1795
|
-
this.supportSync && this.notification("textDocument/didChange", {
|
|
1796
|
-
textDocument: {
|
|
1797
|
-
uri: e.uri,
|
|
1798
|
-
version: e.version
|
|
1799
|
-
},
|
|
1800
|
-
contentChanges: yt(e, n, t, this.supportSync == 2)
|
|
1801
|
-
});
|
|
1802
|
-
}
|
|
1803
|
-
}
|
|
1804
|
-
timeoutRequest(e) {
|
|
1805
|
-
let t = this.requests.indexOf(e);
|
|
1806
|
-
t > -1 && (e.reject(/* @__PURE__ */ Error("Request timed out")), this.requests.splice(t, 1));
|
|
1807
|
-
}
|
|
1808
|
-
};
|
|
1809
|
-
function yt(e, t, n, r) {
|
|
1810
|
-
if (!r || e.doc.length < 1024) return [{ text: e.doc.toString() }];
|
|
1811
|
-
let i = [];
|
|
1812
|
-
return n.iterChanges((e, n, r, a, o) => {
|
|
1813
|
-
i.push({
|
|
1814
|
-
range: {
|
|
1815
|
-
start: q(t, e),
|
|
1816
|
-
end: q(t, n)
|
|
1817
|
-
},
|
|
1818
|
-
text: o.toString()
|
|
1819
|
-
});
|
|
1820
|
-
}), i.reverse();
|
|
1821
|
-
}
|
|
1822
|
-
function bt(e, t) {
|
|
1823
|
-
if (t == null) return e;
|
|
1824
|
-
if (typeof e != "object" || typeof t != "object") return t;
|
|
1825
|
-
let n = {}, r = Object.keys(e), i = Object.keys(t);
|
|
1826
|
-
for (let a of r) n[a] = i.indexOf(a) > -1 ? bt(e[a], t[a]) : e[a];
|
|
1827
|
-
for (let e of i) r.indexOf(e) < 0 && (n[e] = t[e]);
|
|
1828
|
-
return n;
|
|
1829
|
-
}
|
|
1830
|
-
function xt(e) {
|
|
1831
|
-
return e.replace(/\\([$}\\])|\$(\d+)/g, (e, t, n) => t || `\${${n}}`);
|
|
1832
|
-
}
|
|
1833
|
-
function St(e = {}) {
|
|
1834
|
-
let t;
|
|
1835
|
-
if (e.override) t = [oe({ override: [kt] })];
|
|
1836
|
-
else {
|
|
1837
|
-
let e = [{ autocomplete: kt }];
|
|
1838
|
-
t = [oe(), a.languageData.of(() => e)];
|
|
1839
|
-
}
|
|
1840
|
-
return e.validFor && t.push(Ct.of({ validFor: e.validFor })), t;
|
|
1841
|
-
}
|
|
1842
|
-
var Ct = /*@__PURE__*/ c.define({ combine: (e) => e.length ? e[0] : { validFor: null } });
|
|
1843
|
-
function wt(e, t, n, r) {
|
|
1844
|
-
if (e.client.hasCapability("completionProvider") === !1) return Promise.resolve(null);
|
|
1845
|
-
e.client.sync();
|
|
1846
|
-
let i = {
|
|
1847
|
-
position: e.toPosition(t),
|
|
1848
|
-
textDocument: { uri: e.uri },
|
|
1849
|
-
context: n
|
|
1850
|
-
};
|
|
1851
|
-
return r && r.addEventListener("abort", () => e.client.cancelRequest(i)), e.client.request("textDocument/completion", i);
|
|
1852
|
-
}
|
|
1853
|
-
function Tt(e) {
|
|
1854
|
-
let t = Math.ceil(e.length / 50), n = [];
|
|
1855
|
-
for (let r = 0; r < e.length; r += t) {
|
|
1856
|
-
let t = e[r], i = t.textEdit?.newText || t.textEditText || t.insertText || t.label;
|
|
1857
|
-
if (!/^\w/.test(i)) {
|
|
1858
|
-
let e = /^[^\w]*/.exec(i)[0];
|
|
1859
|
-
n.indexOf(e) < 0 && n.push(e);
|
|
1860
|
-
}
|
|
1861
|
-
}
|
|
1862
|
-
return n.length ? RegExp("^(?:" + n.map(RegExp.escape || ((e) => e.replace(/[^\w\s]/g, "\\$&"))).join("|") + ")?\\w*$") : /^\w*$/;
|
|
1863
|
-
}
|
|
1864
|
-
function Et(e, t) {
|
|
1865
|
-
let n = e.client.serverCapabilities?.completionProvider?.triggerCharacters;
|
|
1866
|
-
return n && n.indexOf(t) > -1 ? "triggerCharacter" : /[a-zA-Z_]/.test(t) ? "identifier" : null;
|
|
1867
|
-
}
|
|
1868
|
-
function Dt(e, t) {
|
|
1869
|
-
return (n, r) => {
|
|
1870
|
-
e = e ? e.composeDesc(r) : r;
|
|
1871
|
-
let i = n.options.slice();
|
|
1872
|
-
for (let { index: n, edits: r, text: a } of t) i[n] = {
|
|
1873
|
-
...i[n],
|
|
1874
|
-
apply: Ot(r, a, e)
|
|
1875
|
-
};
|
|
1876
|
-
return {
|
|
1877
|
-
...n,
|
|
1878
|
-
options: i,
|
|
1879
|
-
map: Dt(e, t)
|
|
1880
|
-
};
|
|
1881
|
-
};
|
|
1882
|
-
}
|
|
1883
|
-
function Ot(e, t, n) {
|
|
1884
|
-
return (r, i, a, o) => {
|
|
1885
|
-
let s = ie(r.state, t, a, o), c = [];
|
|
1886
|
-
for (let { from: t, to: r, text: i } of e) {
|
|
1887
|
-
if (n) {
|
|
1888
|
-
if (n.touchesRange(t, r)) continue;
|
|
1889
|
-
let e = r - t;
|
|
1890
|
-
t = n.mapPos(t, 1), r = t + e;
|
|
1891
|
-
}
|
|
1892
|
-
c.push({
|
|
1893
|
-
from: t,
|
|
1894
|
-
to: r,
|
|
1895
|
-
insert: i
|
|
1896
|
-
});
|
|
1897
|
-
}
|
|
1898
|
-
r.dispatch(s, { changes: c });
|
|
1899
|
-
};
|
|
1900
|
-
}
|
|
1901
|
-
var kt = (e) => {
|
|
1902
|
-
let t = e.view && Y.get(e.view);
|
|
1903
|
-
if (!t) return null;
|
|
1904
|
-
let n = e.state.sliceDoc(e.pos - 1, e.pos), r = e.explicit ? "invoked" : Et(t, n);
|
|
1905
|
-
if (!r) return null;
|
|
1906
|
-
let i = r == "triggerCharacter" ? {
|
|
1907
|
-
triggerKind: 2,
|
|
1908
|
-
triggerCharacter: n
|
|
1909
|
-
} : { triggerKind: 1 };
|
|
1910
|
-
return wt(t, e.pos, i, e).then((n) => {
|
|
1911
|
-
if (!n) return null;
|
|
1912
|
-
Array.isArray(n) && (n = { items: n });
|
|
1913
|
-
let { from: r, to: i } = At(e, n), a = n.itemDefaults?.commitCharacters, o = e.state.facet(Ct), s = [];
|
|
1914
|
-
return {
|
|
1915
|
-
from: r,
|
|
1916
|
-
to: i,
|
|
1917
|
-
options: n.items.map((r, i) => {
|
|
1918
|
-
let o = r.textEdit?.newText || r.textEditText || r.insertText || r.label, c = {
|
|
1919
|
-
label: r.filterText || r.label,
|
|
1920
|
-
displayLabel: r.label,
|
|
1921
|
-
type: r.kind && Mt[r.kind]
|
|
1922
|
-
}, l = r.insertTextFormat ?? n.itemDefaults?.insertTextFormat;
|
|
1923
|
-
if (r.commitCharacters && r.commitCharacters != a && (c.commitCharacters = r.commitCharacters), r.detail && (c.detail = r.detail), r.sortText && (c.sortText = r.sortText), l == 2) c.apply = (e, t, n, r) => ae(xt(o))(e, t, n, r);
|
|
1924
|
-
else if (r.additionalTextEdits) {
|
|
1925
|
-
let t = [];
|
|
1926
|
-
for (let n of r.additionalTextEdits) {
|
|
1927
|
-
let r = ct(e.state.doc, n.range.start), i = ct(e.state.doc, n.range.end);
|
|
1928
|
-
r != null && i != null && t.push({
|
|
1929
|
-
from: r,
|
|
1930
|
-
to: i,
|
|
1931
|
-
text: n.newText
|
|
1932
|
-
});
|
|
1933
|
-
}
|
|
1934
|
-
s.push({
|
|
1935
|
-
index: i,
|
|
1936
|
-
text: o,
|
|
1937
|
-
edits: t
|
|
1938
|
-
}), c.apply = Ot(t, o, null);
|
|
1939
|
-
} else c.label != o && (c.apply = o);
|
|
1940
|
-
return r.documentation && (c.info = () => jt(t, r.documentation)), c;
|
|
1941
|
-
}),
|
|
1942
|
-
commitCharacters: a,
|
|
1943
|
-
validFor: n.isIncomplete ? void 0 : o.validFor ?? Tt(n.items),
|
|
1944
|
-
map: s.length ? Dt(null, s) : void 0
|
|
1945
|
-
};
|
|
1946
|
-
}, (e) => {
|
|
1947
|
-
if ("code" in e && e.code == -32800) return null;
|
|
1948
|
-
throw e;
|
|
1949
|
-
});
|
|
1950
|
-
};
|
|
1951
|
-
function At(e, t) {
|
|
1952
|
-
if (!t.items.length) return {
|
|
1953
|
-
from: e.pos,
|
|
1954
|
-
to: e.pos
|
|
1955
|
-
};
|
|
1956
|
-
let n = t.itemDefaults?.editRange, r = t.items[0], i = n ? "insert" in n ? n.insert : n : r.textEdit ? "range" in r.textEdit ? r.textEdit.range : r.textEdit.insert : null;
|
|
1957
|
-
if (!i) return e.state.wordAt(e.pos) || {
|
|
1958
|
-
from: e.pos,
|
|
1959
|
-
to: e.pos
|
|
1960
|
-
};
|
|
1961
|
-
let a = e.state.doc.lineAt(e.pos);
|
|
1962
|
-
return {
|
|
1963
|
-
from: a.from + i.start.character,
|
|
1964
|
-
to: a.from + i.end.character
|
|
1965
|
-
};
|
|
1966
|
-
}
|
|
1967
|
-
function jt(e, t) {
|
|
1968
|
-
let n = document.createElement("div");
|
|
1969
|
-
return n.className = "cm-lsp-documentation cm-lsp-completion-documentation", n.innerHTML = e.docToHTML(t), n;
|
|
1970
|
-
}
|
|
1971
|
-
var Mt = {
|
|
1972
|
-
1: "text",
|
|
1973
|
-
2: "method",
|
|
1974
|
-
3: "function",
|
|
1975
|
-
4: "class",
|
|
1976
|
-
5: "property",
|
|
1977
|
-
6: "variable",
|
|
1978
|
-
7: "class",
|
|
1979
|
-
8: "interface",
|
|
1980
|
-
9: "namespace",
|
|
1981
|
-
10: "property",
|
|
1982
|
-
11: "keyword",
|
|
1983
|
-
12: "constant",
|
|
1984
|
-
13: "constant",
|
|
1985
|
-
14: "keyword",
|
|
1986
|
-
16: "constant",
|
|
1987
|
-
20: "constant",
|
|
1988
|
-
21: "constant",
|
|
1989
|
-
22: "class",
|
|
1990
|
-
25: "type"
|
|
1991
|
-
};
|
|
1992
|
-
function Nt(e = {}) {
|
|
1993
|
-
return ee(Ft, {
|
|
1994
|
-
hideOn: (e) => e.docChanged,
|
|
1995
|
-
hoverTime: e.hoverTime
|
|
1996
|
-
});
|
|
1997
|
-
}
|
|
1998
|
-
function Pt(e, t) {
|
|
1999
|
-
return e.client.hasCapability("hoverProvider") === !1 ? Promise.resolve(null) : (e.client.sync(), e.client.request("textDocument/hover", {
|
|
2000
|
-
position: e.toPosition(t),
|
|
2001
|
-
textDocument: { uri: e.uri }
|
|
2002
|
-
}));
|
|
2003
|
-
}
|
|
2004
|
-
function Ft(e, t) {
|
|
2005
|
-
let n = Y.get(e);
|
|
2006
|
-
return n ? Pt(n, t).then((r) => r ? {
|
|
2007
|
-
pos: r.range ? J(e.state.doc, r.range.start) : t,
|
|
2008
|
-
end: r.range ? J(e.state.doc, r.range.end) : t,
|
|
2009
|
-
create() {
|
|
2010
|
-
let e = document.createElement("div");
|
|
2011
|
-
return e.className = "cm-lsp-hover-tooltip cm-lsp-documentation", e.innerHTML = It(n, r.contents), { dom: e };
|
|
2012
|
-
},
|
|
2013
|
-
above: !0
|
|
2014
|
-
} : null) : Promise.resolve(null);
|
|
2015
|
-
}
|
|
2016
|
-
function It(e, t) {
|
|
2017
|
-
return Array.isArray(t) ? t.map((t) => Lt(e, t)).join("<br>") : typeof t == "string" || typeof t == "object" && "language" in t ? Lt(e, t) : e.docToHTML(t);
|
|
2018
|
-
}
|
|
2019
|
-
function Lt(t, n) {
|
|
2020
|
-
if (typeof n == "string") return t.docToHTML(n, "markdown");
|
|
2021
|
-
let { language: r, value: i } = n, a = t.client.config.highlightLanguage && t.client.config.highlightLanguage(r || "");
|
|
2022
|
-
if (!a) {
|
|
2023
|
-
let e = t.view.state.facet(g);
|
|
2024
|
-
e && (!r || e.name == r) && (a = e);
|
|
2025
|
-
}
|
|
2026
|
-
if (!a) return K(i);
|
|
2027
|
-
let o = "";
|
|
2028
|
-
return e(i, a.parser.parse(i), { style: (e) => te(t.view.state, e) }, (e, t) => {
|
|
2029
|
-
o += t ? `<span class="${t}">${K(e)}</span>` : K(e);
|
|
2030
|
-
}, () => {
|
|
2031
|
-
o += "<br>";
|
|
2032
|
-
}), o;
|
|
2033
|
-
}
|
|
2034
|
-
function Rt(e, t) {
|
|
2035
|
-
return e.client.request("textDocument/formatting", {
|
|
2036
|
-
options: t,
|
|
2037
|
-
textDocument: { uri: e.uri }
|
|
2038
|
-
});
|
|
2039
|
-
}
|
|
2040
|
-
var zt = [{
|
|
2041
|
-
key: "Shift-Alt-f",
|
|
2042
|
-
run: (e) => {
|
|
2043
|
-
let t = Y.get(e);
|
|
2044
|
-
return t ? (t.client.sync(), t.client.withMapping((n) => Rt(t, {
|
|
2045
|
-
tabSize: re(e.state),
|
|
2046
|
-
insertSpaces: e.state.facet(ne).indexOf(" ") < 0
|
|
2047
|
-
}).then((r) => {
|
|
2048
|
-
if (!r) return;
|
|
2049
|
-
let i = n.getMapping(t.uri), a = [];
|
|
2050
|
-
for (let e of r) {
|
|
2051
|
-
let r = n.mapPosition(t.uri, e.range.start), o = n.mapPosition(t.uri, e.range.end);
|
|
2052
|
-
if (i) {
|
|
2053
|
-
if (i.touchesRange(r, o)) return;
|
|
2054
|
-
r = i.mapPos(r, 1), o = i.mapPos(o, -1);
|
|
2055
|
-
}
|
|
2056
|
-
a.push({
|
|
2057
|
-
from: r,
|
|
2058
|
-
to: o,
|
|
2059
|
-
insert: e.newText
|
|
2060
|
-
});
|
|
2061
|
-
}
|
|
2062
|
-
e.dispatch({
|
|
2063
|
-
changes: a,
|
|
2064
|
-
userEvent: "format"
|
|
2065
|
-
});
|
|
2066
|
-
}, (e) => {
|
|
2067
|
-
t.reportError("Formatting request failed", e);
|
|
2068
|
-
})), !0) : !1;
|
|
2069
|
-
},
|
|
2070
|
-
preventDefault: !0
|
|
2071
|
-
}];
|
|
2072
|
-
function Bt(e, t, n) {
|
|
2073
|
-
return e.client.request("textDocument/rename", {
|
|
2074
|
-
newName: n,
|
|
2075
|
-
position: e.toPosition(t),
|
|
2076
|
-
textDocument: { uri: e.uri }
|
|
2077
|
-
});
|
|
2078
|
-
}
|
|
2079
|
-
var Vt = (e) => {
|
|
2080
|
-
let t = e.state.wordAt(e.state.selection.main.head), n = Y.get(e);
|
|
2081
|
-
if (!t || !n || n.client.hasCapability("renameProvider") === !1) return !1;
|
|
2082
|
-
let r = e.state.sliceDoc(t.from, t.to), i = m(e, "cm-lsp-rename-panel");
|
|
2083
|
-
if (i) {
|
|
2084
|
-
let e = i.dom.querySelector("[name=name]");
|
|
2085
|
-
e.value = r, e.select();
|
|
2086
|
-
} else {
|
|
2087
|
-
let { close: t, result: n } = d(e, {
|
|
2088
|
-
label: e.state.phrase("New name"),
|
|
2089
|
-
input: {
|
|
2090
|
-
name: "name",
|
|
2091
|
-
value: r
|
|
2092
|
-
},
|
|
2093
|
-
focus: !0,
|
|
2094
|
-
submitLabel: e.state.phrase("rename"),
|
|
2095
|
-
class: "cm-lsp-rename-panel"
|
|
2096
|
-
});
|
|
2097
|
-
n.then((n) => {
|
|
2098
|
-
e.dispatch({ effects: t }), n && Ht(e, n.elements.namedItem("name").value);
|
|
2099
|
-
});
|
|
2100
|
-
}
|
|
2101
|
-
return !0;
|
|
2102
|
-
};
|
|
2103
|
-
function Ht(e, t) {
|
|
2104
|
-
let n = Y.get(e), r = e.state.wordAt(e.state.selection.main.head);
|
|
2105
|
-
if (!n || !r) return !1;
|
|
2106
|
-
n.client.sync(), n.client.withMapping((e) => Bt(n, r.from, t).then((t) => {
|
|
2107
|
-
if (t) for (let r in t.changes) {
|
|
2108
|
-
let i = t.changes[r], a = n.client.workspace.getFile(r);
|
|
2109
|
-
!i.length || !a || n.client.workspace.updateFile(r, {
|
|
2110
|
-
changes: i.map((t) => ({
|
|
2111
|
-
from: e.mapPosition(r, t.range.start),
|
|
2112
|
-
to: e.mapPosition(r, t.range.end),
|
|
2113
|
-
insert: t.newText
|
|
2114
|
-
})),
|
|
2115
|
-
userEvent: "rename"
|
|
2116
|
-
});
|
|
2117
|
-
}
|
|
2118
|
-
}, (e) => {
|
|
2119
|
-
n.reportError("Rename request failed", e);
|
|
2120
|
-
}));
|
|
2121
|
-
}
|
|
2122
|
-
var Ut = [{
|
|
2123
|
-
key: "F2",
|
|
2124
|
-
run: Vt,
|
|
2125
|
-
preventDefault: !0
|
|
2126
|
-
}];
|
|
2127
|
-
function Wt(e, t, n) {
|
|
2128
|
-
return e.client.hasCapability("signatureHelpProvider") === !1 ? Promise.resolve(null) : (e.client.sync(), e.client.request("textDocument/signatureHelp", {
|
|
2129
|
-
context: n,
|
|
2130
|
-
position: e.toPosition(t),
|
|
2131
|
-
textDocument: { uri: e.uri }
|
|
2132
|
-
}));
|
|
2133
|
-
}
|
|
2134
|
-
var X = /*@__PURE__*/ f.fromClass(class {
|
|
2135
|
-
constructor() {
|
|
2136
|
-
this.activeRequest = null, this.delayedRequest = 0;
|
|
2137
|
-
}
|
|
2138
|
-
update(e) {
|
|
2139
|
-
this.activeRequest && (e.selectionSet ? (this.activeRequest.drop = !0, this.activeRequest = null) : e.docChanged && (this.activeRequest.pos = e.changes.mapPos(this.activeRequest.pos)));
|
|
2140
|
-
let t = Y.get(e.view);
|
|
2141
|
-
if (!t) return;
|
|
2142
|
-
let n = e.view.state.field(Z), r = "";
|
|
2143
|
-
if (e.docChanged && e.transactions.some((e) => e.isUserEvent("input.type"))) {
|
|
2144
|
-
let i = t.client.serverCapabilities?.signatureHelpProvider, a = (i?.triggerCharacters || []).concat(n && i?.retriggerCharacters || []);
|
|
2145
|
-
a && e.changes.iterChanges((e, t, n, i, o) => {
|
|
2146
|
-
let s = o.toString();
|
|
2147
|
-
if (s) for (let e of a) s.indexOf(e) > -1 && (r = e);
|
|
2148
|
-
});
|
|
2149
|
-
}
|
|
2150
|
-
r ? this.startRequest(t, {
|
|
2151
|
-
triggerKind: 2,
|
|
2152
|
-
isRetrigger: !!n,
|
|
2153
|
-
triggerCharacter: r,
|
|
2154
|
-
activeSignatureHelp: n ? n.data : void 0
|
|
2155
|
-
}) : n && e.selectionSet && (this.delayedRequest && clearTimeout(this.delayedRequest), this.delayedRequest = setTimeout(() => {
|
|
2156
|
-
this.startRequest(t, {
|
|
2157
|
-
triggerKind: 3,
|
|
2158
|
-
isRetrigger: !0,
|
|
2159
|
-
activeSignatureHelp: n.data
|
|
2160
|
-
});
|
|
2161
|
-
}, 250));
|
|
2162
|
-
}
|
|
2163
|
-
startRequest(e, t) {
|
|
2164
|
-
this.delayedRequest && clearTimeout(this.delayedRequest);
|
|
2165
|
-
let { view: n } = e, r = n.state.selection.main.head;
|
|
2166
|
-
this.activeRequest && (this.activeRequest.drop = !0);
|
|
2167
|
-
let i = this.activeRequest = {
|
|
2168
|
-
pos: r,
|
|
2169
|
-
drop: !1
|
|
2170
|
-
};
|
|
2171
|
-
Wt(e, r, t).then((e) => {
|
|
2172
|
-
if (!i.drop) {
|
|
2173
|
-
if (e && e.signatures.length) {
|
|
2174
|
-
let r = n.state.field(Z), a = r && Gt(r.data, e), o = a && t.triggerKind == 3 ? r.active : e.activeSignature ?? 0;
|
|
2175
|
-
if (a && Kt(r.data, e, o)) return;
|
|
2176
|
-
n.dispatch({ effects: Q.of({
|
|
2177
|
-
data: e,
|
|
2178
|
-
active: o,
|
|
2179
|
-
pos: a ? r.tooltip.pos : i.pos
|
|
2180
|
-
}) });
|
|
2181
|
-
} else n.state.field(Z) && n.dispatch({ effects: Q.of(null) });
|
|
2182
|
-
}
|
|
2183
|
-
}, t.triggerKind == 1 ? (t) => e.reportError("Signature request failed", t) : void 0);
|
|
2184
|
-
}
|
|
2185
|
-
destroy() {
|
|
2186
|
-
this.delayedRequest && clearTimeout(this.delayedRequest), this.activeRequest && (this.activeRequest.drop = !0);
|
|
2187
|
-
}
|
|
2188
|
-
});
|
|
2189
|
-
function Gt(e, t) {
|
|
2190
|
-
return e.signatures.length == t.signatures.length && e.signatures.every((e, n) => e.label == t.signatures[n].label);
|
|
2191
|
-
}
|
|
2192
|
-
function Kt(e, t, n) {
|
|
2193
|
-
return (e.signatures[n].activeParameter ?? e.activeParameter) == (t.signatures[n].activeParameter ?? t.activeParameter);
|
|
2194
|
-
}
|
|
2195
|
-
var qt = class {
|
|
2196
|
-
constructor(e, t, n) {
|
|
2197
|
-
this.data = e, this.active = t, this.tooltip = n;
|
|
2198
|
-
}
|
|
2199
|
-
}, Z = /*@__PURE__*/ i.define({
|
|
2200
|
-
create() {
|
|
2201
|
-
return null;
|
|
2202
|
-
},
|
|
2203
|
-
update(e, t) {
|
|
2204
|
-
for (let e of t.effects) if (e.is(Q)) return e.value ? new qt(e.value.data, e.value.active, Jt(e.value.data, e.value.active, e.value.pos)) : null;
|
|
2205
|
-
return e && t.docChanged ? new qt(e.data, e.active, {
|
|
2206
|
-
...e.tooltip,
|
|
2207
|
-
pos: t.changes.mapPos(e.tooltip.pos)
|
|
2208
|
-
}) : e;
|
|
2209
|
-
},
|
|
2210
|
-
provide: (e) => l.from(e, (e) => e && e.tooltip)
|
|
2211
|
-
}), Q = /*@__PURE__*/ o.define();
|
|
2212
|
-
function Jt(e, t, n) {
|
|
2213
|
-
return {
|
|
2214
|
-
pos: n,
|
|
2215
|
-
above: !0,
|
|
2216
|
-
create: (n) => Yt(n, e, t)
|
|
2217
|
-
};
|
|
2218
|
-
}
|
|
2219
|
-
function Yt(e, t, n) {
|
|
2220
|
-
let r = document.createElement("div");
|
|
2221
|
-
if (r.className = "cm-lsp-signature-tooltip", t.signatures.length > 1) {
|
|
2222
|
-
r.classList.add("cm-lsp-signature-multiple");
|
|
2223
|
-
let e = r.appendChild(document.createElement("div"));
|
|
2224
|
-
e.className = "cm-lsp-signature-num", e.textContent = `${n + 1}/${t.signatures.length}`;
|
|
2225
|
-
}
|
|
2226
|
-
let i = t.signatures[n], a = r.appendChild(document.createElement("div"));
|
|
2227
|
-
a.className = "cm-lsp-signature";
|
|
2228
|
-
let o = 0, s = 0, c = i.activeParameter ?? t.activeParameter, l = c != null && i.parameters ? i.parameters[c] : null;
|
|
2229
|
-
if (l && Array.isArray(l.label)) [o, s] = l.label;
|
|
2230
|
-
else if (l) {
|
|
2231
|
-
let e = i.label.indexOf(l.label);
|
|
2232
|
-
e > -1 && (o = e, s = e + l.label.length);
|
|
2233
|
-
}
|
|
2234
|
-
if (s) {
|
|
2235
|
-
a.appendChild(document.createTextNode(i.label.slice(0, o)));
|
|
2236
|
-
let e = a.appendChild(document.createElement("span"));
|
|
2237
|
-
e.className = "cm-lsp-active-parameter", e.textContent = i.label.slice(o, s), a.appendChild(document.createTextNode(i.label.slice(s)));
|
|
2238
|
-
} else a.textContent = i.label;
|
|
2239
|
-
if (i.documentation) {
|
|
2240
|
-
let t = Y.get(e);
|
|
2241
|
-
if (t) {
|
|
2242
|
-
let e = r.appendChild(document.createElement("div"));
|
|
2243
|
-
e.className = "cm-lsp-signature-documentation cm-lsp-documentation", e.innerHTML = t.docToHTML(i.documentation);
|
|
2244
|
-
}
|
|
2245
|
-
}
|
|
2246
|
-
return { dom: r };
|
|
2247
|
-
}
|
|
2248
|
-
var Xt = [
|
|
2249
|
-
{
|
|
2250
|
-
key: "Mod-Shift-Space",
|
|
2251
|
-
run: (e) => {
|
|
2252
|
-
let t = e.plugin(X);
|
|
2253
|
-
t ||= (e.dispatch({ effects: o.appendConfig.of([Z, X]) }), e.plugin(X));
|
|
2254
|
-
let n = e.state.field(Z);
|
|
2255
|
-
if (!t || n === void 0) return !1;
|
|
2256
|
-
let r = Y.get(e);
|
|
2257
|
-
return r ? (t.startRequest(r, {
|
|
2258
|
-
triggerKind: 1,
|
|
2259
|
-
activeSignatureHelp: n ? n.data : void 0,
|
|
2260
|
-
isRetrigger: !!n
|
|
2261
|
-
}), !0) : !1;
|
|
2262
|
-
}
|
|
2263
|
-
},
|
|
2264
|
-
{
|
|
2265
|
-
key: "Mod-Shift-ArrowUp",
|
|
2266
|
-
run: (e) => {
|
|
2267
|
-
let t = e.state.field(Z);
|
|
2268
|
-
return t ? (t.active > 0 && e.dispatch({ effects: Q.of({
|
|
2269
|
-
data: t.data,
|
|
2270
|
-
active: t.active - 1,
|
|
2271
|
-
pos: t.tooltip.pos
|
|
2272
|
-
}) }), !0) : !1;
|
|
2273
|
-
}
|
|
2274
|
-
},
|
|
2275
|
-
{
|
|
2276
|
-
key: "Mod-Shift-ArrowDown",
|
|
2277
|
-
run: (e) => {
|
|
2278
|
-
let t = e.state.field(Z);
|
|
2279
|
-
return t ? (t.active < t.data.signatures.length - 1 && e.dispatch({ effects: Q.of({
|
|
2280
|
-
data: t.data,
|
|
2281
|
-
active: t.active + 1,
|
|
2282
|
-
pos: t.tooltip.pos
|
|
2283
|
-
}) }), !0) : !1;
|
|
2284
|
-
}
|
|
2285
|
-
}
|
|
2286
|
-
];
|
|
2287
|
-
function Zt(e = {}) {
|
|
2288
|
-
return [
|
|
2289
|
-
Z,
|
|
2290
|
-
X,
|
|
2291
|
-
e.keymap === !1 ? [] : r.high(p.of(Xt))
|
|
2292
|
-
];
|
|
2293
|
-
}
|
|
2294
|
-
function Qt(e, t) {
|
|
2295
|
-
return e.client.request("textDocument/definition", {
|
|
2296
|
-
textDocument: { uri: e.uri },
|
|
2297
|
-
position: e.toPosition(t)
|
|
2298
|
-
});
|
|
2299
|
-
}
|
|
2300
|
-
function $t(e, t) {
|
|
2301
|
-
let n = Y.get(e);
|
|
2302
|
-
return !n || n.client.hasCapability(t.capability) === !1 ? !1 : (n.client.sync(), n.client.withMapping((r) => t.get(n, e.state.selection.main.head).then((t) => {
|
|
2303
|
-
let i = Array.isArray(t) ? t[0] : t;
|
|
2304
|
-
if (i) return (i.uri == n.uri ? Promise.resolve(e) : n.client.workspace.displayFile(i.uri)).then((e) => {
|
|
2305
|
-
if (!e) return;
|
|
2306
|
-
let t = r.getMapping(i.uri) ? r.mapPosition(i.uri, i.range.start) : n.fromPosition(i.range.start, e.state.doc);
|
|
2307
|
-
e.dispatch({
|
|
2308
|
-
selection: { anchor: t },
|
|
2309
|
-
scrollIntoView: !0,
|
|
2310
|
-
userEvent: "select.definition"
|
|
2311
|
-
});
|
|
2312
|
-
});
|
|
2313
|
-
}, (e) => n.reportError("Find definition failed", e))), !0);
|
|
2314
|
-
}
|
|
2315
|
-
var en = [{
|
|
2316
|
-
key: "F12",
|
|
2317
|
-
run: (e) => $t(e, {
|
|
2318
|
-
get: Qt,
|
|
2319
|
-
capability: "definitionProvider"
|
|
2320
|
-
}),
|
|
2321
|
-
preventDefault: !0
|
|
2322
|
-
}];
|
|
2323
|
-
function tn(e, t) {
|
|
2324
|
-
return e.client.request("textDocument/references", {
|
|
2325
|
-
textDocument: { uri: e.uri },
|
|
2326
|
-
position: e.toPosition(t),
|
|
2327
|
-
context: { includeDeclaration: !0 }
|
|
2328
|
-
});
|
|
2329
|
-
}
|
|
2330
|
-
var nn = (e) => {
|
|
2331
|
-
let t = Y.get(e);
|
|
2332
|
-
if (!t || t.client.hasCapability("referencesProvider") === !1) return !1;
|
|
2333
|
-
t.client.sync();
|
|
2334
|
-
let n = t.client.workspaceMapping(), r = !1;
|
|
2335
|
-
return tn(t, e.state.selection.main.head).then((e) => {
|
|
2336
|
-
if (e) return Promise.all(e.map((e) => t.client.workspace.requestFile(e.uri).then((t) => t ? {
|
|
2337
|
-
file: t,
|
|
2338
|
-
range: e.range
|
|
2339
|
-
} : null))).then((e) => {
|
|
2340
|
-
let i = e.filter((e) => e);
|
|
2341
|
-
i.length && (on(t.view, i, n), r = !0);
|
|
2342
|
-
});
|
|
2343
|
-
}, (e) => t.reportError("Finding references failed", e)).finally(() => {
|
|
2344
|
-
r || n.destroy();
|
|
2345
|
-
}), !0;
|
|
2346
|
-
}, rn = (e) => e.state.field(an, !1) ? (e.dispatch({ effects: $.of(null) }), !0) : !1, an = /*@__PURE__*/ i.define({
|
|
2347
|
-
create() {
|
|
2348
|
-
return null;
|
|
2349
|
-
},
|
|
2350
|
-
update(e, t) {
|
|
2351
|
-
for (let e of t.effects) if (e.is($)) return e.value;
|
|
2352
|
-
return e;
|
|
2353
|
-
},
|
|
2354
|
-
provide: (e) => u.from(e)
|
|
2355
|
-
}), $ = /*@__PURE__*/ o.define();
|
|
2356
|
-
function on(e, t, n) {
|
|
2357
|
-
let r = sn(t, n), i = e.state.field(an, !1) === void 0 ? o.appendConfig.of(an.init(() => r)) : $.of(r);
|
|
2358
|
-
e.dispatch({ effects: i });
|
|
2359
|
-
}
|
|
2360
|
-
function sn(e, t) {
|
|
2361
|
-
let n = !1;
|
|
2362
|
-
return setTimeout(() => {
|
|
2363
|
-
n || t.destroy();
|
|
2364
|
-
}, 500), (r) => {
|
|
2365
|
-
n = !0;
|
|
2366
|
-
let i = cn(e.map((e) => e.file.uri)), a = document.createElement("div"), o = null;
|
|
2367
|
-
a.className = "cm-lsp-reference-panel", a.tabIndex = 0, a.role = "listbox", a.setAttribute("aria-label", r.state.phrase("Reference list"));
|
|
2368
|
-
let s = [];
|
|
2369
|
-
for (let { file: n, range: r } of e) {
|
|
2370
|
-
let e = n.uri.slice(i);
|
|
2371
|
-
if (e != o) {
|
|
2372
|
-
o = e;
|
|
2373
|
-
let t = a.appendChild(document.createElement("div"));
|
|
2374
|
-
t.className = "cm-lsp-reference-file", t.textContent = e;
|
|
2375
|
-
}
|
|
2376
|
-
let c = a.appendChild(document.createElement("div"));
|
|
2377
|
-
c.className = "cm-lsp-reference", c.role = "option";
|
|
2378
|
-
let l = t.mapPosition(n.uri, r.start, 1), u = t.mapPosition(n.uri, r.end, -1), d = n.getView(), f = (d ? d.state.doc : n.doc).lineAt(l), p = c.appendChild(document.createElement("span"));
|
|
2379
|
-
p.className = "cm-lsp-reference-line", p.textContent = (f.number + ": ").padStart(5, " ");
|
|
2380
|
-
let m = f.text.slice(Math.max(0, l - f.from - 50), l - f.from);
|
|
2381
|
-
m && c.appendChild(document.createTextNode(m)), c.appendChild(document.createElement("strong")).textContent = f.text.slice(l - f.from, u - f.from);
|
|
2382
|
-
let h = f.text.slice(u - f.from, Math.min(f.length, 100 - m.length));
|
|
2383
|
-
h && c.appendChild(document.createTextNode(h)), s.length || c.setAttribute("aria-selected", "true"), s.push(c);
|
|
2384
|
-
}
|
|
2385
|
-
function c() {
|
|
2386
|
-
for (let e = 0; e < s.length; e++) if (s[e].hasAttribute("aria-selected")) return e;
|
|
2387
|
-
return 0;
|
|
2388
|
-
}
|
|
2389
|
-
function l(e) {
|
|
2390
|
-
for (let t = 0; t < s.length; t++) t == e ? s[t].setAttribute("aria-selected", "true") : s[t].removeAttribute("aria-selected");
|
|
2391
|
-
}
|
|
2392
|
-
function u(n) {
|
|
2393
|
-
let { file: i, range: a } = e[n], o = Y.get(r);
|
|
2394
|
-
o && Promise.resolve(i.uri == o.uri ? r : o.client.workspace.displayFile(i.uri)).then((e) => {
|
|
2395
|
-
if (!e) return;
|
|
2396
|
-
let n = t.mapPosition(i.uri, a.start, 1);
|
|
2397
|
-
e.focus(), e.dispatch({
|
|
2398
|
-
selection: { anchor: n },
|
|
2399
|
-
scrollIntoView: !0
|
|
2400
|
-
});
|
|
2401
|
-
});
|
|
2402
|
-
}
|
|
2403
|
-
a.addEventListener("keydown", (t) => {
|
|
2404
|
-
if (t.keyCode == 27) rn(r), r.focus();
|
|
2405
|
-
else if (t.keyCode == 38 || t.keyCode == 33) l((c() - 1 + e.length) % e.length);
|
|
2406
|
-
else if (t.keyCode == 40 || t.keyCode == 34) l((c() + 1) % e.length);
|
|
2407
|
-
else if (t.keyCode == 36) l(0);
|
|
2408
|
-
else if (t.keyCode == 35) l(s.length - 1);
|
|
2409
|
-
else if (t.keyCode == 13 || t.keyCode == 10) u(c());
|
|
2410
|
-
else return;
|
|
2411
|
-
t.preventDefault();
|
|
2412
|
-
}), a.addEventListener("click", (e) => {
|
|
2413
|
-
for (let t = 0; t < s.length; t++) s[t].contains(e.target) && (l(t), u(t), e.preventDefault());
|
|
2414
|
-
});
|
|
2415
|
-
let d = document.createElement("div");
|
|
2416
|
-
d.appendChild(a);
|
|
2417
|
-
let f = d.appendChild(document.createElement("button"));
|
|
2418
|
-
return f.className = "cm-dialog-close", f.textContent = "×", f.addEventListener("click", () => rn(r)), f.setAttribute("aria-label", r.state.phrase("close")), {
|
|
2419
|
-
dom: d,
|
|
2420
|
-
destroy: () => t.destroy(),
|
|
2421
|
-
mount: () => a.focus()
|
|
2422
|
-
};
|
|
2423
|
-
};
|
|
2424
|
-
}
|
|
2425
|
-
function cn(e) {
|
|
2426
|
-
let t = e[0], n = t.length;
|
|
2427
|
-
for (let r = 1; r < e.length; r++) {
|
|
2428
|
-
let i = e[r], a = 0;
|
|
2429
|
-
for (let e = Math.min(n, i.length); a < e && t[a] == i[a]; a++);
|
|
2430
|
-
n = a;
|
|
2431
|
-
}
|
|
2432
|
-
for (; n && t[n - 1] != "/";) n--;
|
|
2433
|
-
return n;
|
|
2434
|
-
}
|
|
2435
|
-
var ln = [{
|
|
2436
|
-
key: "Shift-F12",
|
|
2437
|
-
run: nn,
|
|
2438
|
-
preventDefault: !0
|
|
2439
|
-
}, {
|
|
2440
|
-
key: "Escape",
|
|
2441
|
-
run: rn
|
|
2442
|
-
}];
|
|
2443
|
-
function un(e) {
|
|
2444
|
-
return e == 1 ? "error" : e == 2 ? "warning" : e == 3 ? "info" : "hint";
|
|
2445
|
-
}
|
|
2446
|
-
var dn = /*@__PURE__*/ f.fromClass(class {
|
|
2447
|
-
constructor() {
|
|
2448
|
-
this.pending = -1;
|
|
2449
|
-
}
|
|
2450
|
-
update(e) {
|
|
2451
|
-
e.docChanged && (this.pending > -1 && clearTimeout(this.pending), this.pending = setTimeout(() => {
|
|
2452
|
-
this.pending = -1;
|
|
2453
|
-
let t = Y.get(e.view);
|
|
2454
|
-
t && t.client.sync();
|
|
2455
|
-
}, 500));
|
|
2456
|
-
}
|
|
2457
|
-
destroy() {
|
|
2458
|
-
this.pending > -1 && clearTimeout(this.pending);
|
|
2459
|
-
}
|
|
2460
|
-
});
|
|
2461
|
-
function fn() {
|
|
2462
|
-
return {
|
|
2463
|
-
clientCapabilities: { textDocument: { publishDiagnostics: { versionSupport: !0 } } },
|
|
2464
|
-
notificationHandlers: { "textDocument/publishDiagnostics": (e, t) => {
|
|
2465
|
-
let n = e.workspace.getFile(t.uri);
|
|
2466
|
-
if (!n || t.version != null && t.version != n.version) return !1;
|
|
2467
|
-
let r = n.getView(), i = r && Y.get(r);
|
|
2468
|
-
return !r || !i ? !1 : (r.dispatch(se(r.state, t.diagnostics.map((e) => ({
|
|
2469
|
-
from: i.unsyncedChanges.mapPos(i.fromPosition(e.range.start, i.syncedDoc)),
|
|
2470
|
-
to: i.unsyncedChanges.mapPos(i.fromPosition(e.range.end, i.syncedDoc)),
|
|
2471
|
-
severity: un(e.severity ?? 1),
|
|
2472
|
-
message: e.message
|
|
2473
|
-
})))), !0);
|
|
2474
|
-
} },
|
|
2475
|
-
editorExtension: dn
|
|
2476
|
-
};
|
|
2477
|
-
}
|
|
2478
|
-
function pn() {
|
|
2479
|
-
return [
|
|
2480
|
-
St(),
|
|
2481
|
-
Nt(),
|
|
2482
|
-
p.of([
|
|
2483
|
-
...zt,
|
|
2484
|
-
...Ut,
|
|
2485
|
-
...en,
|
|
2486
|
-
...ln
|
|
2487
|
-
]),
|
|
2488
|
-
Zt(),
|
|
2489
|
-
fn()
|
|
2490
|
-
];
|
|
2491
|
-
}
|
|
2492
|
-
//#endregion
|
|
2493
|
-
//#region src/workbench/browser/typeScriptSession.ts
|
|
2494
|
-
var mn, hn = t({ typescript: !0 }).language;
|
|
2495
|
-
function gn(e) {
|
|
2496
|
-
switch (e.toLowerCase()) {
|
|
2497
|
-
case "javascript":
|
|
2498
|
-
case "js":
|
|
2499
|
-
case "jsx":
|
|
2500
|
-
case "typescript":
|
|
2501
|
-
case "ts":
|
|
2502
|
-
case "tsx": return hn;
|
|
2503
|
-
default: return null;
|
|
2504
|
-
}
|
|
2505
|
-
}
|
|
2506
|
-
function _n(e) {
|
|
2507
|
-
let t = document.createElement("template");
|
|
2508
|
-
t.innerHTML = e;
|
|
2509
|
-
for (let e of t.content.querySelectorAll("a")) e.setAttribute("target", "_blank"), e.setAttribute("rel", "noopener noreferrer");
|
|
2510
|
-
return t.innerHTML;
|
|
2511
|
-
}
|
|
2512
|
-
function vn(e) {
|
|
2513
|
-
let t = /* @__PURE__ */ new Set();
|
|
2514
|
-
return e.addEventListener("message", (e) => {
|
|
2515
|
-
let n = JSON.stringify(e.data);
|
|
2516
|
-
for (let e of t) e(n);
|
|
2517
|
-
}), {
|
|
2518
|
-
send(t) {
|
|
2519
|
-
e.postMessage(JSON.parse(t));
|
|
2520
|
-
},
|
|
2521
|
-
subscribe(e) {
|
|
2522
|
-
t.add(e);
|
|
2523
|
-
},
|
|
2524
|
-
unsubscribe(e) {
|
|
2525
|
-
t.delete(e);
|
|
2526
|
-
}
|
|
2527
|
-
};
|
|
2528
|
-
}
|
|
2529
|
-
async function yn() {
|
|
2530
|
-
let e = new Worker(new URL(
|
|
2531
|
-
/* @vite-ignore */
|
|
2532
|
-
"/assets/typeScriptWorker-CaA4llbX.js",
|
|
2533
|
-
"" + import.meta.url
|
|
2534
|
-
), { type: "module" }), t = new vt({
|
|
2535
|
-
extensions: pn(),
|
|
2536
|
-
highlightLanguage: gn,
|
|
2537
|
-
sanitizeHTML: _n,
|
|
2538
|
-
timeout: 6e4
|
|
2539
|
-
});
|
|
2540
|
-
return await t.connect(vn(e)), {
|
|
2541
|
-
client: t,
|
|
2542
|
-
worker: e
|
|
2543
|
-
};
|
|
2544
|
-
}
|
|
2545
|
-
async function bn(e) {
|
|
2546
|
-
return mn ??= yn(), (await mn).client.plugin(e, "javascript");
|
|
2547
|
-
}
|
|
2548
|
-
//#endregion
|
|
2549
|
-
export { bn as loadTypeScriptExtension };
|