markdown-text-editor 1.9.4 → 1.9.5

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.
@@ -100,56 +100,56 @@ var o = ((e = "") => {
100
100
  hrRegex: i((e) => RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),
101
101
  fencesBeginRegex: i((e) => RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),
102
102
  headingBeginRegex: i((e) => RegExp(`^ {0,${e}}#`)),
103
- htmlBeginRegex: i((e) => RegExp(`^ {0,${e}}(?:</?(?:${_})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`, "i")),
103
+ htmlBeginRegex: i((e) => RegExp(`^ {0,${e}}(?:</?(?:${v})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`, "i")),
104
104
  blockquoteBeginRegex: i((e) => RegExp(`^ {0,${e}}>`))
105
- }, c = /^(?:[ \t]*(?:\n|$))+/, l = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, u = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, d = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, f = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, p = / {0,3}(?:[*+-]|\d{1,9}[.)])/, m = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, ee = a(m).replace(/bull/g, p).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}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), te = a(m).replace(/bull/g, p).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}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), h = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/, g = /^[^\n]+/, ne = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, re = a(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", ne).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), ie = a(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, p).getRegex(), _ = "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", v = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, ae = a("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", v).replace("tag", _).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), oe = (e) => a(h).replace("hr", d).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", e).replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _).getRegex(), se = oe(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/), y = oe(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/), b = {
106
- blockquote: a(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", y).getRegex(),
105
+ }, c = /^(?:[ \t]*(?:\n|$))+/, l = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, u = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, d = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, f = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, p = / {0,3}(?:[*+-]|\d{1,9}[.)])/, m = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, h = a(m).replace(/bull/g, p).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}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), ee = a(m).replace(/bull/g, p).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}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), g = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/, _ = /^[^\n]+/, te = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, ne = a(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", te).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), re = a(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, p).getRegex(), v = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", y = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, ie = a("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", y).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), ae = (e) => a(g).replace("hr", d).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", e).replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), oe = ae(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/), b = ae(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/), x = {
106
+ blockquote: a(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", b).getRegex(),
107
107
  code: l,
108
- def: re,
108
+ def: ne,
109
109
  fences: u,
110
110
  heading: f,
111
111
  hr: d,
112
- html: ae,
113
- lheading: ee,
114
- list: ie,
112
+ html: ie,
113
+ lheading: h,
114
+ list: re,
115
115
  newline: c,
116
- paragraph: se,
116
+ paragraph: oe,
117
117
  table: r,
118
- text: g
119
- }, ce = a("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", d).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _).getRegex(), le = {
120
- ...b,
121
- lheading: te,
122
- table: ce,
123
- paragraph: a(h).replace("hr", d).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ce).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _).getRegex()
124
- }, ue = {
125
- ...b,
126
- html: a("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", v).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(),
118
+ text: _
119
+ }, se = a("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", d).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), ce = {
120
+ ...x,
121
+ lheading: ee,
122
+ table: se,
123
+ paragraph: a(g).replace("hr", d).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", se).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex()
124
+ }, le = {
125
+ ...x,
126
+ html: a("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", y).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(),
127
127
  def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
128
128
  heading: /^(#{1,6})(.*)(?:\n+|$)/,
129
129
  fences: r,
130
130
  lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
131
- paragraph: a(h).replace("hr", d).replace("heading", " *#{1,6} *[^\n]").replace("lheading", ee).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
132
- }, de = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, fe = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, pe = /^( {2,}|\\)\n(?!\s*$)[ \t]*/, me = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, x = /[\p{P}\p{S}]/u, S = /[\s\p{P}\p{S}]/u, he = /[^\s\p{P}\p{S}]/u, ge = a(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, S).getRegex(), _e = /[\p{Pi}\p{Ps}"']/u, ve = /(?!~)[\p{P}\p{S}]/u, C = /(?!~)[\s\p{P}\p{S}]/u, ye = /(?:[^\s\p{P}\p{S}]|~)/u, be = a(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", o ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), xe = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, Se = a(xe, "u").replace(/punct/g, x).getRegex(), Ce = a(xe, "u").replace(/punct/g, ve).getRegex(), we = a(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/, "u").replace(/openQuote/g, _e).replace(/punct/g, x).getRegex(), Te = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ee = a(Te, "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, S).replace(/punct/g, x).getRegex(), De = a(Te, "gu").replace(/notPunctSpace/g, ye).replace(/punctSpace/g, C).replace(/punct/g, ve).getRegex(), w = a("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, S).replace(/punct/g, x).getRegex(), Oe = a("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, S).replace(/punct/g, x).getRegex(), T = a("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, S).replace(/punct/g, x).getRegex(), ke = a(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, x).getRegex(), E = a("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, S).replace(/punct/g, x).getRegex(), Ae = a(/\\(punct)/, "gu").replace(/punct/g, x).getRegex(), je = a(/^<(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(), D = a(v).replace("(?:-->|$)", "-->").getRegex(), Me = a("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", D).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Ne = /\[(?:\\[\s\S]|[^\[\]\\])*\]/, Pe = a(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets", Ne).getRegex(), Fe = a(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", Pe).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), O = a(/^!?\[(label)\]\[(ref)\]/).replace("label", Pe).replace("ref", ne).getRegex(), Ie = a(/^!?\[(ref)\](?:\[\])?/).replace("ref", ne).getRegex(), k = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/, Le = a(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets", Ne).getRegex(), Re = a("reflink|nolink(?!\\()", "g").replace("reflink", a(/^!?\[(label)\]\[(ref)\]/).replace("label", Le).replace("ref", k).getRegex()).replace("nolink", a(/^!?\[(ref)\](?:\[\])?/).replace("ref", k).getRegex()).getRegex(), ze = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, Be = a(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g, /[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(), A = {
131
+ paragraph: a(g).replace("hr", d).replace("heading", " *#{1,6} *[^\n]").replace("lheading", h).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
132
+ }, ue = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, de = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, fe = /^( {2,}|\\)\n(?!\s*$)[ \t]*/, pe = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, S = /[\p{P}\p{S}]/u, me = /[\s\p{P}\p{S}]/u, he = /[^\s\p{P}\p{S}]/u, ge = a(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, me).getRegex(), _e = /[\p{Pi}\p{Ps}"']/u, ve = /(?!~)[\p{P}\p{S}]/u, C = /(?!~)[\s\p{P}\p{S}]/u, ye = /(?:[^\s\p{P}\p{S}]|~)/u, be = a(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", o ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), xe = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, Se = a(xe, "u").replace(/punct/g, S).getRegex(), Ce = a(xe, "u").replace(/punct/g, ve).getRegex(), we = a(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/, "u").replace(/openQuote/g, _e).replace(/punct/g, S).getRegex(), Te = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ee = a(Te, "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, me).replace(/punct/g, S).getRegex(), De = a(Te, "gu").replace(/notPunctSpace/g, ye).replace(/punctSpace/g, C).replace(/punct/g, ve).getRegex(), w = a("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, me).replace(/punct/g, S).getRegex(), Oe = a("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, me).replace(/punct/g, S).getRegex(), T = a("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, me).replace(/punct/g, S).getRegex(), ke = a(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, S).getRegex(), E = a("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, me).replace(/punct/g, S).getRegex(), Ae = a(/\\(punct)/, "gu").replace(/punct/g, S).getRegex(), je = a(/^<(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(), D = a(y).replace("(?:-->|$)", "-->").getRegex(), Me = a("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", D).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Ne = /\[(?:\\[\s\S]|[^\[\]\\])*\]/, Pe = a(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets", Ne).getRegex(), Fe = a(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", Pe).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), O = a(/^!?\[(label)\]\[(ref)\]/).replace("label", Pe).replace("ref", te).getRegex(), Ie = a(/^!?\[(ref)\](?:\[\])?/).replace("ref", te).getRegex(), k = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/, Le = a(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets", Ne).getRegex(), Re = a("reflink|nolink(?!\\()", "g").replace("reflink", a(/^!?\[(label)\]\[(ref)\]/).replace("label", Le).replace("ref", k).getRegex()).replace("nolink", a(/^!?\[(ref)\](?:\[\])?/).replace("ref", k).getRegex()).getRegex(), ze = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, Be = a(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g, /[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(), A = {
133
133
  _backpedal: r,
134
134
  anyPunctuation: Ae,
135
135
  autolink: je,
136
136
  blockSkip: be,
137
- br: pe,
138
- code: fe,
137
+ br: fe,
138
+ code: de,
139
139
  del: r,
140
140
  delLDelim: r,
141
141
  delRDelim: r,
142
142
  emStrongLDelim: Se,
143
143
  emStrongRDelimAst: Ee,
144
144
  emStrongRDelimUnd: Oe,
145
- escape: de,
145
+ escape: ue,
146
146
  link: Fe,
147
147
  nolink: Ie,
148
148
  punctuation: ge,
149
149
  reflink: O,
150
150
  reflinkSearch: Re,
151
151
  tag: Me,
152
- text: me,
152
+ text: pe,
153
153
  url: r
154
154
  }, Ve = {
155
155
  ...A,
@@ -170,12 +170,12 @@ var o = ((e = "") => {
170
170
  text: a(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol", ze).replace(/emailProtocol/g, /(?:mailto|xmpp):/).getRegex()
171
171
  }, Ue = {
172
172
  ...He,
173
- br: a(pe).replace("{2,}", "*").getRegex(),
173
+ br: a(fe).replace("{2,}", "*").getRegex(),
174
174
  text: a(He.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
175
175
  }, We = {
176
- normal: b,
177
- gfm: le,
178
- pedantic: ue
176
+ normal: x,
177
+ gfm: ce,
178
+ pedantic: le
179
179
  }, Ge = {
180
180
  normal: A,
181
181
  gfm: He,
@@ -1870,37 +1870,37 @@ function Dn() {
1870
1870
  e.DocumentFragment;
1871
1871
  let a = e.HTMLTemplateElement, o = e.Node, s = e.Element, c = e.NodeFilter;
1872
1872
  e.NamedNodeMap === void 0 && (e.NamedNodeMap || e.MozNamedAttrMap), e.HTMLFormElement;
1873
- let l = e.DOMParser, u = e.trustedTypes, d = s.prototype, f = Y(d, "cloneNode"), p = Y(d, "remove"), m = Y(d, "removeAttributeNode"), ee = Y(d, "nextSibling"), te = Y(d, "childNodes"), h = Y(d, "parentNode"), g = Y(d, "shadowRoot"), ne = Y(d, "attributes"), re = o && o.prototype ? Y(o.prototype, "nodeType") : null, ie = o && o.prototype ? Y(o.prototype, "nodeName") : null, _ = o && o.prototype ? Y(o.prototype, "ownerDocument") : null, v = function(e) {
1874
- return re ? re(e) : e.nodeType;
1875
- }, ae = function(e) {
1876
- return ie ? ie(e) : e.nodeName;
1877
- }, oe = qt(d, "namespaceURI"), se = function(e) {
1878
- return oe ? oe(e) : e.namespaceURI;
1873
+ let l = e.DOMParser, u = e.trustedTypes, d = s.prototype, f = Y(d, "cloneNode"), p = Y(d, "remove"), m = Y(d, "removeAttributeNode"), h = Y(d, "nextSibling"), ee = Y(d, "childNodes"), g = Y(d, "parentNode"), _ = Y(d, "shadowRoot"), te = Y(d, "attributes"), ne = o && o.prototype ? Y(o.prototype, "nodeType") : null, re = o && o.prototype ? Y(o.prototype, "nodeName") : null, v = o && o.prototype ? Y(o.prototype, "ownerDocument") : null, y = function(e) {
1874
+ return ne ? ne(e) : e.nodeType;
1875
+ }, ie = function(e) {
1876
+ return re ? re(e) : e.nodeName;
1877
+ }, ae = qt(d, "namespaceURI"), oe = function(e) {
1878
+ return ae ? ae(e) : e.namespaceURI;
1879
1879
  };
1880
1880
  if (typeof a == "function") {
1881
1881
  let e = n.createElement("template");
1882
1882
  e.content && e.content.ownerDocument && (n = e.content.ownerDocument);
1883
1883
  }
1884
- let y, b = "", ce, le = !1, ue = 0, de = function() {
1885
- if (ue > 0) throw G("A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the \"DOMPurify and Trusted Types\" section of the README.");
1886
- }, fe = function(e) {
1887
- de(), ue++;
1884
+ let b, x = "", se, ce = !1, le = 0, ue = function() {
1885
+ if (le > 0) throw G("A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the \"DOMPurify and Trusted Types\" section of the README.");
1886
+ }, de = function(e) {
1887
+ ue(), le++;
1888
1888
  try {
1889
- return y.createHTML(e);
1889
+ return b.createHTML(e);
1890
1890
  } finally {
1891
- ue--;
1891
+ le--;
1892
1892
  }
1893
- }, pe = function(e) {
1894
- de(), ue++;
1893
+ }, fe = function(e) {
1894
+ ue(), le++;
1895
1895
  try {
1896
- return y.createScriptURL(e);
1896
+ return b.createScriptURL(e);
1897
1897
  } finally {
1898
- ue--;
1898
+ le--;
1899
1899
  }
1900
- }, me = function() {
1901
- return le ||= (ce = Cn(u, i), !0), ce;
1902
- }, x = n, S = x.implementation, he = x.createNodeIterator, ge = x.createDocumentFragment, _e = x.getElementsByTagName, ve = r.importNode, C = wn();
1903
- t.isSupported = typeof gt == "function" && typeof h == "function" && S && S.createHTMLDocument !== void 0;
1900
+ }, pe = function() {
1901
+ return ce ||= (se = Cn(u, i), !0), se;
1902
+ }, S = n, me = S.implementation, he = S.createNodeIterator, ge = S.createDocumentFragment, _e = S.getElementsByTagName, ve = r.importNode, C = wn();
1903
+ t.isSupported = typeof gt == "function" && typeof g == "function" && me && me.createHTMLDocument !== void 0;
1904
1904
  let ye = sn, be = cn, xe = ln, Se = un, Ce = dn, we = pn, Te = mn, Ee = gn, De = fn, w = null, Oe = q({}, [
1905
1905
  ...Yt,
1906
1906
  ...Xt,
@@ -2002,14 +2002,14 @@ function Dn() {
2002
2002
  ]), w.table && (q(w, ["tbody"]), delete Ae.tbody), e.TRUSTED_TYPES_POLICY) {
2003
2003
  if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw G("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
2004
2004
  if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw G("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
2005
- let t = y;
2006
- y = e.TRUSTED_TYPES_POLICY;
2005
+ let t = b;
2006
+ b = e.TRUSTED_TYPES_POLICY;
2007
2007
  try {
2008
- b = fe("");
2008
+ x = de("");
2009
2009
  } catch (e) {
2010
- throw y = t, e;
2010
+ throw b = t, e;
2011
2011
  }
2012
- } else e.TRUSTED_TYPES_POLICY === null ? (y = void 0, b = "") : (y === void 0 && (y = me()), y && typeof b == "string" && (b = fe("")));
2012
+ } else e.TRUSTED_TYPES_POLICY === null ? (b = void 0, x = "") : (b === void 0 && (b = pe()), b && typeof x == "string" && (x = de("")));
2013
2013
  B && B(e), lt = e;
2014
2014
  }, pt = q({}, [
2015
2015
  ...Xt,
@@ -2022,14 +2022,14 @@ function Dn() {
2022
2022
  }, vt = function(e, t, n) {
2023
2023
  return t.namespaceURI === et && !ot[n] || t.namespaceURI === $e && !I[n] ? !1 : !mt[e] && (st[e] || !pt[e]);
2024
2024
  }, yt = function(e) {
2025
- let t = se(e), n = Nt(ae(e)), r = h(e), i, a;
2026
- return r && v(r) === X.element ? (i = { namespaceURI: se(r) }, a = Nt(ae(r))) : (i = { namespaceURI: tt }, a = "template"), F[t] ? t === et ? ht(n, i, a) : t === $e ? _t(n, i, a) : t === P ? vt(n, i, a) : !!(L === "application/xhtml+xml" && F[t]) : !1;
2025
+ let t = oe(e), n = Nt(ie(e)), r = g(e), i, a;
2026
+ return r && y(r) === X.element ? (i = { namespaceURI: oe(r) }, a = Nt(ie(r))) : (i = { namespaceURI: tt }, a = "template"), F[t] ? t === et ? ht(n, i, a) : t === $e ? _t(n, i, a) : t === P ? vt(n, i, a) : !!(L === "application/xhtml+xml" && F[t]) : !1;
2027
2027
  }, z = function(e) {
2028
2028
  Et(t.removed, { element: e });
2029
2029
  try {
2030
- h(e).removeChild(e);
2030
+ g(e).removeChild(e);
2031
2031
  } catch {
2032
- if (p(e), !h(e)) throw G("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
2032
+ if (p(e), !g(e)) throw G("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
2033
2033
  }
2034
2034
  }, xt = function(e, t, n) {
2035
2035
  try {
@@ -2041,13 +2041,13 @@ function Dn() {
2041
2041
  }
2042
2042
  }, St = function(e) {
2043
2043
  Vt(e);
2044
- let t = te(e);
2044
+ let t = ee(e);
2045
2045
  t && H(Dt(t), (e) => {
2046
2046
  try {
2047
2047
  p(e);
2048
2048
  } catch {}
2049
2049
  });
2050
- let n = v(e) === X.element ? ne(e) : null;
2050
+ let n = y(e) === X.element ? te(e) : null;
2051
2051
  if (n) for (let t = n.length - 1; t >= 0; --t) {
2052
2052
  let r = n[t], i = r && r.name;
2053
2053
  typeof i == "string" && xt(e, r, i);
@@ -2078,7 +2078,7 @@ function Dn() {
2078
2078
  } catch {}
2079
2079
  }
2080
2080
  }, zt = function(e) {
2081
- let t = ne(e);
2081
+ let t = te(e);
2082
2082
  if (t) for (let n = t.length - 1; n >= 0; --n) {
2083
2083
  let r = t[n], i = r && r.name;
2084
2084
  typeof i != "string" || T[R(i)] || xt(e, r, i);
@@ -2088,16 +2088,16 @@ function Dn() {
2088
2088
  for (; r.length > 0;) {
2089
2089
  let e = r.pop();
2090
2090
  if (t(e) === !1) continue;
2091
- if (n && v(e) === X.element) {
2092
- let t = g(e);
2093
- Q(t) && r.push(t);
2091
+ if (n && y(e) === X.element) {
2092
+ let t = _(e);
2093
+ In(t) && r.push(t);
2094
2094
  }
2095
- let i = te(e);
2095
+ let i = ee(e);
2096
2096
  if (i) for (let e = i.length - 1; e >= 0; --e) r.push(i[e]);
2097
2097
  }
2098
2098
  }, Vt = function(e) {
2099
2099
  Bt(e, (e) => {
2100
- v(e) === X.element && zt(e);
2100
+ y(e) === X.element && zt(e);
2101
2101
  });
2102
2102
  }, Ht = function(e) {
2103
2103
  let t = [];
@@ -2107,9 +2107,9 @@ function Dn() {
2107
2107
  }, Ut = function(e, t) {
2108
2108
  let n = At();
2109
2109
  H(Ht(e), (e) => {
2110
- v(e) === X.element && jt(n, e);
2110
+ y(e) === X.element && jt(n, e);
2111
2111
  }), H(t, (e) => {
2112
- v(e) === X.element && !Mt(n, e) && zt(e);
2112
+ y(e) === X.element && !Mt(n, e) && zt(e);
2113
2113
  });
2114
2114
  }, K = function(e, n) {
2115
2115
  let r = !1;
@@ -2123,7 +2123,7 @@ function Dn() {
2123
2123
  for (let t = 0;; t++) {
2124
2124
  let r = Ht(e), a = [e], o = !1;
2125
2125
  if (H(r, (e) => {
2126
- v(e) === X.documentFragment ? Et(a, e) : !o && !Mt(n, e) && (o = Mt(i(), e));
2126
+ y(e) === X.documentFragment ? Et(a, e) : !o && !Mt(n, e) && (o = Mt(i(), e));
2127
2127
  }), !o) return;
2128
2128
  if (t >= 8) throw G("the tree kept changing during in-place sanitization; refusing to return it");
2129
2129
  H(a, (t, n) => {
@@ -2132,14 +2132,14 @@ function Dn() {
2132
2132
  }
2133
2133
  }, Gt = function(e, t, n, r) {
2134
2134
  let i = jn(e), a;
2135
- for (; a = i.nextNode();) Mt(r, a) && !Mt(j, a) && (t && $(C.uponSanitizeShadowNode, a, null), Hn(a, n), Yn(a, n), Q(a.content) && Xn(a.content));
2135
+ for (; a = i.nextNode();) Mt(r, a) && !Mt(j, a) && (t && $(C.uponSanitizeShadowNode, a, null), Hn(a, n), Yn(a, n), In(a.content) && Xn(a.content));
2136
2136
  }, On = function(e) {
2137
2137
  j && jt(j, e);
2138
2138
  }, Z = function(e, t) {
2139
2139
  return Ie ? e === "patchsrc" || e === "for" && t !== "label" && t !== "output" : !1;
2140
2140
  }, kn = function(e) {
2141
2141
  Ie && Bt(e, (e) => {
2142
- let t = v(e);
2142
+ let t = y(e);
2143
2143
  if (t === X.processingInstruction || t === X.comment && W(vn, e.data)) {
2144
2144
  try {
2145
2145
  p(e);
@@ -2147,7 +2147,7 @@ function Dn() {
2147
2147
  return !1;
2148
2148
  }
2149
2149
  if (t === X.element) {
2150
- let t = e, n = R(ae(e));
2150
+ let t = e, n = R(ie(e));
2151
2151
  try {
2152
2152
  t.hasAttribute && t.hasAttribute("patchsrc") && t.removeAttribute("patchsrc"), t.hasAttribute && t.hasAttribute("for") && Z("for", n) && t.removeAttribute("for");
2153
2153
  } catch {}
@@ -2162,20 +2162,20 @@ function Dn() {
2162
2162
  r = t && t[0];
2163
2163
  }
2164
2164
  L === "application/xhtml+xml" && tt === P && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>");
2165
- let i = y ? fe(e) : e;
2165
+ let i = b ? de(e) : e;
2166
2166
  if (tt === P) try {
2167
2167
  t = new l().parseFromString(i, L);
2168
2168
  } catch {}
2169
2169
  if (!t || !t.documentElement) {
2170
- t = S.createDocument(tt, "template", null);
2170
+ t = me.createDocument(tt, "template", null);
2171
2171
  try {
2172
- t.documentElement.innerHTML = nt ? b : i;
2172
+ t.documentElement.innerHTML = nt ? x : i;
2173
2173
  } catch {}
2174
2174
  }
2175
2175
  let a = t.body || t.documentElement;
2176
2176
  return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), tt === P ? _e.call(t, k ? "html" : "body")[0] : k ? t.documentElement : a;
2177
2177
  }, jn = function(e) {
2178
- let t = _ ? _(e) : e.ownerDocument;
2178
+ let t = v ? v(e) : e.ownerDocument;
2179
2179
  return he.call(t || e, e, c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT | c.SHOW_PROCESSING_INSTRUCTION | c.SHOW_CDATA_SECTION, null);
2180
2180
  }, Mn = function(e) {
2181
2181
  return e = It(e, ye, " "), e = It(e, be, " "), e = It(e, xe, " "), e;
@@ -2183,26 +2183,26 @@ function Dn() {
2183
2183
  Pn(e);
2184
2184
  let t = e.querySelectorAll?.call(e, "template");
2185
2185
  t && H(t, (e) => {
2186
- Q(e.content) && Nn(e.content);
2186
+ In(e.content) && Nn(e.content);
2187
2187
  });
2188
2188
  }, Pn = function(e) {
2189
2189
  e.normalize();
2190
- let t = _ ? _(e) : e.ownerDocument, n = he.call(t || e, e, c.SHOW_TEXT | c.SHOW_COMMENT | c.SHOW_CDATA_SECTION | c.SHOW_PROCESSING_INSTRUCTION, null), r = n.nextNode();
2190
+ let t = v ? v(e) : e.ownerDocument, n = he.call(t || e, e, c.SHOW_TEXT | c.SHOW_COMMENT | c.SHOW_CDATA_SECTION | c.SHOW_PROCESSING_INSTRUCTION, null), r = n.nextNode();
2191
2191
  for (; r;) r.data = Mn(r.data), r = n.nextNode();
2192
2192
  }, Fn = function(e) {
2193
- let t = ie ? ie(e) : null;
2194
- return typeof t != "string" || R(t) !== "form" ? !1 : typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || e.attributes !== ne(e) || typeof e.removeAttribute != "function" || typeof e.removeAttributeNode != "function" || typeof e.getAttributeNode != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function" || e.nodeType !== re(e) || e.childNodes !== te(e);
2195
- }, Q = function(e) {
2196
- if (!re || typeof e != "object" || !e) return !1;
2193
+ let t = re ? re(e) : null;
2194
+ return typeof t != "string" || R(t) !== "form" ? !1 : typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || e.attributes !== te(e) || typeof e.removeAttribute != "function" || typeof e.removeAttributeNode != "function" || typeof e.getAttributeNode != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function" || e.nodeType !== ne(e) || e.childNodes !== ee(e);
2195
+ }, In = function(e) {
2196
+ if (!ne || typeof e != "object" || !e) return !1;
2197
2197
  try {
2198
- return re(e) === X.documentFragment;
2198
+ return ne(e) === X.documentFragment;
2199
2199
  } catch {
2200
2200
  return !1;
2201
2201
  }
2202
- }, In = function(e) {
2203
- if (!re || typeof e != "object" || !e) return !1;
2202
+ }, Q = function(e) {
2203
+ if (!ne || typeof e != "object" || !e) return !1;
2204
2204
  try {
2205
- return typeof re(e) == "number";
2205
+ return typeof ne(e) == "number";
2206
2206
  } catch {
2207
2207
  return !1;
2208
2208
  }
@@ -2213,18 +2213,18 @@ function Dn() {
2213
2213
  });
2214
2214
  }
2215
2215
  let Ln = function(e, t) {
2216
- return !!(Ie && e.hasChildNodes() && !In(e.firstElementChild) && W(_n, e.textContent) && W(_n, e.innerHTML) || Ie && xn[t] && v(e) === X.element && se(e) === P && (In(e.firstElementChild) || typeof e.textContent == "string" && W(_n, e.textContent)) || e.nodeType === X.processingInstruction || Ie && e.nodeType === X.comment && W(vn, e.data));
2216
+ return !!(Ie && e.hasChildNodes() && !Q(e.firstElementChild) && W(_n, e.textContent) && W(_n, e.innerHTML) || Ie && xn[t] && y(e) === X.element && oe(e) === P && (Q(e.firstElementChild) || typeof e.textContent == "string" && W(_n, e.textContent)) || e.nodeType === X.processingInstruction || Ie && e.nodeType === X.comment && W(vn, e.data));
2217
2217
  }, Rn = function(e, t) {
2218
2218
  return e instanceof RegExp ? W(e, t) : e instanceof Function && !!e(t, ...[...arguments].slice(2));
2219
2219
  }, zn = function(e, t, n) {
2220
2220
  if (!Ae[t] && Gn(t) && Rn(E.tagNameCheck, t)) return !1;
2221
2221
  if (Ke && !M[t] && !M[Nt(t)]) {
2222
- let t = h(e), r = te(e);
2222
+ let t = g(e), r = ee(e);
2223
2223
  if (r && t) {
2224
2224
  let i = r.length;
2225
2225
  for (let a = i - 1; a >= 0; --a) {
2226
2226
  let i = e === n ? f(r[a], !0) : r[a];
2227
- t.insertBefore(i, ee(e));
2227
+ t.insertBefore(i, h(e));
2228
2228
  }
2229
2229
  }
2230
2230
  }
@@ -2232,11 +2232,11 @@ function Dn() {
2232
2232
  }, Bn = function(e, t, n, r) {
2233
2233
  return e.length === 0 ? t : t === n || t === r ? J(t) : t;
2234
2234
  }, Vn = function(e, t) {
2235
- return e === t || h(e) !== null ? !1 : (qe && Vt(e), !0);
2235
+ return e === t || g(e) !== null ? !1 : (qe && Vt(e), !0);
2236
2236
  }, Hn = function(e, n) {
2237
2237
  if (On(e), $(C.beforeSanitizeElements, e, null), Vn(e, n)) return !0;
2238
2238
  if (Fn(e)) return z(e), !0;
2239
- let r = R(ae(e));
2239
+ let r = R(ie(e));
2240
2240
  if (w = Bn(C.uponSanitizeElement, w, Oe, Re), $(C.uponSanitizeElement, e, {
2241
2241
  tagName: r,
2242
2242
  allowedTags: w
@@ -2246,7 +2246,7 @@ function Dn() {
2246
2246
  let t = zn(e, r, n);
2247
2247
  return t === !1 && ($(C.afterSanitizeElements, e, null), Vn(e, n)) ? !0 : t;
2248
2248
  }
2249
- if (v(e) === X.element && !yt(e) || (r === "noscript" || r === "noembed" || r === "noframes") && W(yn, e.innerHTML)) return z(e), !0;
2249
+ if (y(e) === X.element && !yt(e) || (r === "noscript" || r === "noembed" || r === "noframes") && W(yn, e.innerHTML)) return z(e), !0;
2250
2250
  if (O && e.nodeType === X.text) {
2251
2251
  let n = Mn(e.textContent);
2252
2252
  e.textContent !== n && (Et(t.removed, { element: e.cloneNode() }), e.textContent = n);
@@ -2268,9 +2268,9 @@ function Dn() {
2268
2268
  ]), Gn = function(e) {
2269
2269
  return !Wn[Nt(e)] && W(Ee, e);
2270
2270
  }, Kn = function(e, t, n, r) {
2271
- if (y && typeof u == "object" && typeof u.getAttributeType == "function" && !n) switch (u.getAttributeType(e, t)) {
2272
- case "TrustedHTML": return fe(r);
2273
- case "TrustedScriptURL": return pe(r);
2271
+ if (b && typeof u == "object" && typeof u.getAttributeType == "function" && !n) switch (u.getAttributeType(e, t)) {
2272
+ case "TrustedHTML": return de(r);
2273
+ case "TrustedScriptURL": return fe(r);
2274
2274
  }
2275
2275
  return r;
2276
2276
  }, qn = function(e, t, n, r) {
@@ -2318,9 +2318,9 @@ function Dn() {
2318
2318
  $(C.afterSanitizeAttributes, e, null), Vn(e, n);
2319
2319
  }, Xn = function(e) {
2320
2320
  let t = null, n = jn(e);
2321
- for ($(C.beforeSanitizeShadowDOM, e, null); t = n.nextNode();) if ($(C.uponSanitizeShadowNode, t, null), Hn(t, e), Yn(t, e), Q(t.content) && Xn(t.content), v(t) === X.element) {
2322
- let e = g(t);
2323
- Q(e) && (Zn(e), Xn(e));
2321
+ for ($(C.beforeSanitizeShadowDOM, e, null); t = n.nextNode();) if ($(C.uponSanitizeShadowNode, t, null), Hn(t, e), Yn(t, e), In(t.content) && Xn(t.content), y(t) === X.element) {
2322
+ let e = _(t);
2323
+ In(e) && (Zn(e), Xn(e));
2324
2324
  }
2325
2325
  O && Pn(e), $(C.afterSanitizeShadowDOM, e, null);
2326
2326
  }, Zn = function(e) {
@@ -2334,24 +2334,24 @@ function Dn() {
2334
2334
  Xn(e.shadow);
2335
2335
  continue;
2336
2336
  }
2337
- let n = e.node, r = v(n) === X.element, i = te(n);
2337
+ let n = e.node, r = y(n) === X.element, i = ee(n);
2338
2338
  if (i) for (let e = i.length - 1; e >= 0; --e) t.push({
2339
2339
  node: i[e],
2340
2340
  shadow: null
2341
2341
  });
2342
2342
  if (r) {
2343
- let e = ie ? ie(n) : null;
2343
+ let e = re ? re(n) : null;
2344
2344
  if (typeof e == "string" && R(e) === "template") {
2345
2345
  let e = n.content;
2346
- Q(e) && t.push({
2346
+ In(e) && t.push({
2347
2347
  node: e,
2348
2348
  shadow: null
2349
2349
  });
2350
2350
  }
2351
2351
  }
2352
2352
  if (r) {
2353
- let e = g(n);
2354
- Q(e) && t.push({
2353
+ let e = _(n);
2354
+ In(e) && t.push({
2355
2355
  node: null,
2356
2356
  shadow: e
2357
2357
  }, {
@@ -2363,30 +2363,30 @@ function Dn() {
2363
2363
  };
2364
2364
  return t.sanitize = function(e) {
2365
2365
  let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = null, a = null, o = null, s = null;
2366
- if (nt = !e, nt && (e = "<!-->"), typeof e != "string" && !In(e) && (e = Kt(e), typeof e != "string")) throw G("dirty is not a string, aborting");
2366
+ if (nt = !e, nt && (e = "<!-->"), typeof e != "string" && !Q(e) && (e = Kt(e), typeof e != "string")) throw G("dirty is not a string, aborting");
2367
2367
  if (!t.isSupported) return e;
2368
2368
  Le ? (w = Re, T = ze) : ft(n), (C.uponSanitizeElement.length > 0 || C.uponSanitizeAttribute.length > 0) && (w = J(w)), C.uponSanitizeAttribute.length > 0 && (T = J(T)), t.removed = [];
2369
- let c = qe && typeof e != "string" && In(e), l = [], u = j;
2369
+ let c = qe && typeof e != "string" && Q(e), l = [], u = j;
2370
2370
  if (c) {
2371
2371
  kn(e);
2372
- let t = ae(e);
2372
+ let t = ie(e);
2373
2373
  if (typeof t == "string") {
2374
2374
  let n = R(t);
2375
2375
  if (!w[n] || Ae[n]) throw St(e), G("root node is forbidden and cannot be sanitized in-place");
2376
2376
  }
2377
2377
  if (Fn(e)) throw St(e), G("root node is clobbered and cannot be sanitized in-place");
2378
2378
  l = Ht(e), j = At();
2379
- } else if (In(e)) i = An("<!---->"), a = i.ownerDocument.importNode(e, !0), a.nodeType === X.element && a.nodeName === "BODY" || a.nodeName === "HTML" ? i = a : i.appendChild(a), Zn(i);
2379
+ } else if (Q(e)) i = An("<!---->"), a = i.ownerDocument.importNode(e, !0), a.nodeType === X.element && a.nodeName === "BODY" || a.nodeName === "HTML" ? i = a : i.appendChild(a), Zn(i);
2380
2380
  else {
2381
- if (!A && !O && !k && e.indexOf("<") === -1) return y && He ? fe(e) : e;
2382
- if (i = An(e), !i) return A ? null : He ? b : "";
2381
+ if (!A && !O && !k && e.indexOf("<") === -1) return b && He ? de(e) : e;
2382
+ if (i = An(e), !i) return A ? null : He ? x : "";
2383
2383
  }
2384
2384
  i && Be && z(i.firstChild);
2385
2385
  let d = c ? e : i;
2386
2386
  try {
2387
2387
  c && Zn(e);
2388
2388
  let t = jn(d);
2389
- for (; o = t.nextNode();) Hn(o, d), Yn(o, d), Q(o.content) && Xn(o.content);
2389
+ for (; o = t.nextNode();) Hn(o, d), Yn(o, d), In(o.content) && Xn(o.content);
2390
2390
  c && Wt(e, l);
2391
2391
  } catch (t) {
2392
2392
  throw c && (St(e), K(e, l)), t;
@@ -2403,12 +2403,12 @@ function Dn() {
2403
2403
  return (T.shadowroot || T.shadowrootmode) && (s = ve.call(r, s, !0)), s;
2404
2404
  }
2405
2405
  let f = k ? i.outerHTML : i.innerHTML;
2406
- return k && w["!doctype"] && i.ownerDocument && i.ownerDocument.doctype && i.ownerDocument.doctype.name && W(hn, i.ownerDocument.doctype.name) && (f = "<!DOCTYPE " + i.ownerDocument.doctype.name + ">\n" + f), O && (f = Mn(f)), y && He ? fe(f) : f;
2406
+ return k && w["!doctype"] && i.ownerDocument && i.ownerDocument.doctype && i.ownerDocument.doctype.name && W(hn, i.ownerDocument.doctype.name) && (f = "<!DOCTYPE " + i.ownerDocument.doctype.name + ">\n" + f), O && (f = Mn(f)), b && He ? de(f) : f;
2407
2407
  }, t.setConfig = function() {
2408
2408
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2409
2409
  ft(e), Le = !0, Re = w, ze = T;
2410
2410
  }, t.clearConfig = function() {
2411
- lt = null, Le = !1, Re = null, ze = null, y = ce, b = "";
2411
+ lt = null, Le = !1, Re = null, ze = null, b = se, x = "";
2412
2412
  }, t.isValidAttribute = function(e, t, n) {
2413
2413
  lt || ft({});
2414
2414
  let r = R(e), i = R(t);
@@ -2575,7 +2575,7 @@ var On = Dn(), Z = class {
2575
2575
  }
2576
2576
  this.editor.insertText(s, c);
2577
2577
  }
2578
- }, Q = class extends Z {
2578
+ }, In = class extends Z {
2579
2579
  constructor(e) {
2580
2580
  super(e, "Blockquote"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M10 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5\" /><path d=\"M19 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5\" /></svg>\n ");
2581
2581
  }
@@ -2590,12 +2590,17 @@ var On = Dn(), Z = class {
2590
2590
  }
2591
2591
  };
2592
2592
  //#endregion
2593
+ //#region src/utils/escapeHtml.js
2594
+ function Q(e) {
2595
+ return String(e ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
2596
+ }
2597
+ //#endregion
2593
2598
  //#region src/components/modal.js
2594
- function In(e, t, n, r = "") {
2599
+ function $(e, t, n, r = "") {
2595
2600
  let i = e.target.closest(".markdown-editor-wrapper");
2596
2601
  i.querySelector(".markdown-modal") && i.querySelector(".markdown-modal").remove();
2597
2602
  let a = `
2598
- <dialog class="markdown-modal fj:me-modal fj:me-modal-top fj:lg:me-modal-middle fj:me-modal-center" id="nezanuha_toggleModal" ${r ? `aria-label="${r}"` : ""}>
2603
+ <dialog class="markdown-modal fj:me-modal fj:me-modal-top fj:lg:me-modal-middle fj:me-modal-center" id="nezanuha_toggleModal" ${r ? `aria-label="${Q(r)}"` : ""}>
2599
2604
  <div class="fj:me-modal-content ${t}">
2600
2605
  ${n}
2601
2606
  </div>
@@ -2607,7 +2612,7 @@ function In(e, t, n, r = "") {
2607
2612
  }
2608
2613
  //#endregion
2609
2614
  //#region src/components/toolbar/tools/LinkTool.js
2610
- var $ = class extends Z {
2615
+ var Ln = class extends Z {
2611
2616
  constructor(e) {
2612
2617
  super(e, "Link"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M9 15l6 -6\" /><path d=\"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464\" /><path d=\"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463\" /></svg>\n ");
2613
2618
  }
@@ -2618,7 +2623,7 @@ var $ = class extends Z {
2618
2623
  let e = s.match(/^\]\(([^)]+)\)/);
2619
2624
  e && (r = o.length - 1, i += e[0].length, n.setSelectionRange(r, i));
2620
2625
  }
2621
- let c = a.substring(r, i), l = c && c.match(/^\[([^\]]+)\]\(([^)]+)\)$/), u = l ? l[1] : c, d = l ? l[2] : "", f = In(e, "fj:max-w-sm", `
2626
+ let c = a.substring(r, i), l = c && c.match(/^\[([^\]]+)\]\(([^)]+)\)$/), u = l ? l[1] : c, d = l ? l[2] : "", f = $(e, "fj:max-w-sm", `
2622
2627
  <div class="fj:flex fj:justify-between fj:items-center fj:gap-3">
2623
2628
  <div class="fj:font-medium">${this.editor.label("Link")}</div>
2624
2629
  <button type="button" class="modal-close-btn fj:me-btn fj:me-btn-ghost fj:me-btn-xs fj:me-btn-circle" aria-label="${this.editor.label("Close")}">
@@ -2627,8 +2632,8 @@ var $ = class extends Z {
2627
2632
  </div>
2628
2633
  <form method="post">
2629
2634
  <div class="fj:flex fj:flex-col fj:justify-center fj:gap-y-4.5 fj:mt-4">
2630
- <input type="url" placeholder="${this.editor.label("URL")}" class="link-input fj:me-input fj:w-full" value="${d}" required>
2631
- <input type="text" placeholder="${this.editor.label("Link text")}" class="link-text-input fj:me-input fj:w-full" value="${u}" required>
2635
+ <input type="url" placeholder="${this.editor.label("URL")}" class="link-input fj:me-input fj:w-full" value="${Q(d)}" required>
2636
+ <input type="text" placeholder="${this.editor.label("Link text")}" class="link-text-input fj:me-input fj:w-full" value="${Q(u)}" required>
2632
2637
  <button type="submit" class="submit-link fj:me-btn fj:me-btn-sm fj:self-end">${this.editor.label("Apply")}</button>
2633
2638
  </div>
2634
2639
  </form>`, "Link");
@@ -2643,7 +2648,7 @@ var $ = class extends Z {
2643
2648
  }
2644
2649
  });
2645
2650
  }
2646
- }, Ln = class extends Z {
2651
+ }, Rn = class extends Z {
2647
2652
  constructor(e) {
2648
2653
  super(e, "Heading"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M7 12h10\" /><path d=\"M7 5v14\" /><path d=\"M17 5v14\" /><path d=\"M15 19h4\" /><path d=\"M15 5h4\" /><path d=\"M5 19h4\" /><path d=\"M5 5h4\" /></svg>\n ");
2649
2654
  }
@@ -2679,14 +2684,14 @@ var $ = class extends Z {
2679
2684
  applyHeading(e) {
2680
2685
  let t = this.editor.usertextarea, { selectionStart: n, selectionEnd: r } = t, i = t.value, a = i.lastIndexOf("\n", n - 1) + 1, o = i.indexOf("\n", r), s = o === -1 ? i.length : o, c = i.substring(a, s), l = (c.match(/^(#+)\s/) || [])[1], u = c.replace(/^#+\s*/, ""), d = `${"#".repeat(e)} `, f = l && l.length === e ? u || "Heading" : u ? `${d}${u}` : `${d}Heading`, p = t.scrollTop;
2681
2686
  t.value = `${i.substring(0, a)}${f}${i.substring(s)}`, t.focus();
2682
- let m = a + (f === u || f === "Heading" ? 0 : d.length), ee = a + f.length;
2683
- t.setSelectionRange(m, ee), this.editor.render(), this.editor.notifyChange(), this.editor.restoreScroll(p);
2687
+ let m = a + (f === u || f === "Heading" ? 0 : d.length), h = a + f.length;
2688
+ t.setSelectionRange(m, h), this.editor.render(), this.editor.notifyChange(), this.editor.restoreScroll(p);
2684
2689
  }
2685
2690
  applySyntax() {}
2686
2691
  };
2687
2692
  //#endregion
2688
2693
  //#region src/utils/imageUpload.js
2689
- async function Rn(e, { uploadUrl: t, params: n = {}, alt: r = "" } = {}) {
2694
+ async function zn(e, { uploadUrl: t, params: n = {}, alt: r = "" } = {}) {
2690
2695
  let i = new FormData();
2691
2696
  i.append("image_file", e), i.append("image_alt", r);
2692
2697
  for (let [e, t] of Object.entries(n)) i.append(e, t);
@@ -2704,7 +2709,7 @@ async function Rn(e, { uploadUrl: t, params: n = {}, alt: r = "" } = {}) {
2704
2709
  }
2705
2710
  //#endregion
2706
2711
  //#region src/components/toolbar/tools/ImageTool.js
2707
- var zn = class extends Z {
2712
+ var Bn = class extends Z {
2708
2713
  constructor(e, t = {}) {
2709
2714
  super(e, "Image link"), this.config = t, this.fileInputConfig = t.fileInput || !1, this.altInputConfig = t.altInput === void 0 ? { required: !0 } : t.altInput, this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M15 8h.01\" /><path d=\"M12.5 21h-6.5a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v6.5\" /><path d=\"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l4 4\" /><path d=\"M14 14l1 -1c.67 -.644 1.45 -.824 2.182 -.54\" /><path d=\"M16 19h6\" /><path d=\"M19 16v6\" /></svg>\n ");
2710
2715
  }
@@ -2714,12 +2719,12 @@ var zn = class extends Z {
2714
2719
  let e = s.match(/^\]\(([^)]+)\)/);
2715
2720
  e && (r = o.length - 2, i += e[0].length, n.setSelectionRange(r, i));
2716
2721
  }
2717
- let c = a.substring(r, i), l = this.fileInputConfig.accept ? this.fileInputConfig.accept.map((e) => `image/${e}`).join(",") : "image/*", u = typeof this.altInputConfig == "boolean" ? this.altInputConfig : this.altInputConfig.required !== !1, d = this.fileInputConfig.uploadUrl || null, f = this.fileInputConfig.params || {}, p = c && c.match(/^!\[([^\]]*)\]\(([^)]+)\)$/), m = p ? p[1] : c, ee = p ? p[2] : "", te = "";
2718
- this.fileInputConfig && (te = `
2719
- <input type="file" accept="${l}" class="img-file-input fj:me-input fj:w-full">
2722
+ let c = a.substring(r, i), l = this.fileInputConfig.accept ? this.fileInputConfig.accept.map((e) => `image/${e}`).join(",") : "image/*", u = typeof this.altInputConfig == "boolean" ? this.altInputConfig : this.altInputConfig.required !== !1, d = this.fileInputConfig.uploadUrl || null, f = this.fileInputConfig.params || {}, p = c && c.match(/^!\[([^\]]*)\]\(([^)]+)\)$/), m = p ? p[1] : c, h = p ? p[2] : "", ee = "";
2723
+ this.fileInputConfig && (ee = `
2724
+ <input type="file" accept="${Q(l)}" class="img-file-input fj:me-input fj:w-full">
2720
2725
  <div class="fj:me-divider fj:my-1">OR</div>
2721
2726
  `);
2722
- let h = In(e, "fj:max-w-sm", `
2727
+ let g = $(e, "fj:max-w-sm", `
2723
2728
  <div class="fj:flex fj:justify-between fj:items-center fj:gap-3">
2724
2729
  <div class="fj:font-medium">${t.label("Image")}</div>
2725
2730
  <button type="button" class="modal-close-btn fj:me-btn fj:me-btn-ghost fj:me-btn-xs fj:me-btn-circle" aria-label="${t.label("Close")}">
@@ -2727,16 +2732,16 @@ var zn = class extends Z {
2727
2732
  </button>
2728
2733
  </div>
2729
2734
  <div class="fj:mt-4 fj:flex fj:flex-col fj:gap-y-4">
2730
- ${te}
2731
- <input type="url" placeholder="${t.label("URL")}" class="img-link-input fj:me-input fj:w-full" value="${ee}" required>
2732
- <input type="text" placeholder="${t.label("Alt text")}" class="img-link-alt-input fj:me-input fj:w-full" value="${m}" ${u ? "required" : ""}>
2735
+ ${ee}
2736
+ <input type="url" placeholder="${t.label("URL")}" class="img-link-input fj:me-input fj:w-full" value="${Q(h)}" required>
2737
+ <input type="text" placeholder="${t.label("Alt text")}" class="img-link-alt-input fj:me-input fj:w-full" value="${Q(m)}" ${u ? "required" : ""}>
2733
2738
  <button type="button" class="submit-img-link fj:me-btn fj:me-btn-sm fj:self-end">${t.label("Apply")}</button>
2734
2739
  </div>`, "Image");
2735
- h.querySelector(".modal-close-btn").addEventListener("click", () => h.close());
2736
- let g = h.querySelector(".submit-img-link");
2737
- g.addEventListener("click", async (e) => {
2740
+ g.querySelector(".modal-close-btn").addEventListener("click", () => g.close());
2741
+ let _ = g.querySelector(".submit-img-link");
2742
+ _.addEventListener("click", async (e) => {
2738
2743
  e.preventDefault();
2739
- let n = h.querySelector(".img-file-input"), r = h.querySelector(".img-link-input"), i = h.querySelector(".img-link-alt-input"), a = n?.files[0];
2744
+ let n = g.querySelector(".img-file-input"), r = g.querySelector(".img-link-input"), i = g.querySelector(".img-link-alt-input"), a = n?.files[0];
2740
2745
  if (a && (r.required = !1), u && !i.validity.valid) {
2741
2746
  i.reportValidity(), a && (r.required = !0);
2742
2747
  return;
@@ -2747,25 +2752,25 @@ var zn = class extends Z {
2747
2752
  }
2748
2753
  if (a && d) {
2749
2754
  let e = n.files[0];
2750
- g.disabled = !0, g.textContent = t.label("Uploading...");
2755
+ _.disabled = !0, _.textContent = t.label("Uploading...");
2751
2756
  try {
2752
- let { path: t, alt: n } = await Rn(e, {
2757
+ let { path: t, alt: n } = await zn(e, {
2753
2758
  uploadUrl: d,
2754
2759
  params: f,
2755
2760
  alt: i.value
2756
2761
  });
2757
2762
  r.value = t, n && !i.value.trim() && (i.value = n);
2758
2763
  } catch (e) {
2759
- alert(e.message || "Upload failed."), g.disabled = !1, g.textContent = t.label("Apply"), r.required = !0;
2764
+ alert(e.message || "Upload failed."), _.disabled = !1, _.textContent = t.label("Apply"), r.required = !0;
2760
2765
  return;
2761
2766
  }
2762
- g.disabled = !1, g.textContent = t.label("Apply");
2767
+ _.disabled = !1, _.textContent = t.label("Apply");
2763
2768
  }
2764
2769
  let o = r.value, s = `![${i.value || ""}](${o})`;
2765
- t.insertText(s), h.close();
2770
+ t.insertText(s), g.close();
2766
2771
  });
2767
2772
  }
2768
- }, Bn = class extends Z {
2773
+ }, Vn = class extends Z {
2769
2774
  constructor(e) {
2770
2775
  super(e, "Undo"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M9 14l-4 -4l4 -4\" /><path d=\"M5 10h11a4 4 0 1 1 0 8h-1\" /></svg>\n ");
2771
2776
  }
@@ -2773,7 +2778,7 @@ var zn = class extends Z {
2773
2778
  let e = this.editor.undoRedoManager;
2774
2779
  e && e.undo();
2775
2780
  }
2776
- }, Vn = class extends Z {
2781
+ }, Hn = class extends Z {
2777
2782
  constructor(e) {
2778
2783
  super(e, "Redo"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M15 14l4 -4l-4 -4\" /><path d=\"M19 10h-11a4 4 0 1 0 0 8h1\" /></svg>\n ");
2779
2784
  }
@@ -2781,7 +2786,7 @@ var zn = class extends Z {
2781
2786
  let e = this.editor.undoRedoManager;
2782
2787
  e && e.redo();
2783
2788
  }
2784
- }, Hn = class extends Z {
2789
+ }, Un = class extends Z {
2785
2790
  constructor(e) {
2786
2791
  super(e, "Indent"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M20 6l-11 0\" /><path d=\"M20 12l-7 0\" /><path d=\"M20 18l-11 0\" /><path d=\"M4 8l4 4l-4 4\" /></svg>\n ");
2787
2792
  }
@@ -2789,7 +2794,7 @@ var zn = class extends Z {
2789
2794
  let e = this.editor.indentManager;
2790
2795
  e && (e.indent(), this.editor.render());
2791
2796
  }
2792
- }, Un = class extends Z {
2797
+ }, Wn = class extends Z {
2793
2798
  constructor(e) {
2794
2799
  super(e, "Outdent"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M20 6l-7 0\" /><path d=\"M20 12l-9 0\" /><path d=\"M20 18l-7 0\" /><path d=\"M8 8l-4 4l4 4\" /></svg>\n ");
2795
2800
  }
@@ -2797,7 +2802,7 @@ var zn = class extends Z {
2797
2802
  let t = this.editor.indentManager;
2798
2803
  t && (t.outdent(), this.editor.render());
2799
2804
  }
2800
- }, Wn = class extends Z {
2805
+ }, Gn = class extends Z {
2801
2806
  constructor(e) {
2802
2807
  super(e, "Code"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M7 8l-4 4l4 4\" /><path d=\"M17 8l4 4l-4 4\" /><path d=\"M14 4l-4 16\" /></svg>\n ");
2803
2808
  }
@@ -2815,7 +2820,7 @@ var zn = class extends Z {
2815
2820
  let a = `\`${i || "code"}\``;
2816
2821
  this.editor.insertText(a, 1, 1);
2817
2822
  }
2818
- }, Gn = class extends Z {
2823
+ }, Kn = class extends Z {
2819
2824
  constructor(e) {
2820
2825
  super(e, "Code Block"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M8 9l3 3l-3 3\" /><path d=\"M13 15l3 0\" /><rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\" /></svg>\n ");
2821
2826
  }
@@ -2829,7 +2834,7 @@ var zn = class extends Z {
2829
2834
  let i = `\`\`\`\n${r || "code"}\n\`\`\``;
2830
2835
  this.editor.insertText(i, 4, 4);
2831
2836
  }
2832
- }, Kn = class extends Z {
2837
+ }, qn = class extends Z {
2833
2838
  constructor(e) {
2834
2839
  super(e, "Horizontal Rule"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M4 12l16 0\" stroke-width=\"3\"/><path d=\"M4 7l6 0\" /><path d=\"M4 17l6 0\" /><path d=\"M14 7l6 0\" /><path d=\"M14 17l6 0\" /></svg>\n ");
2835
2840
  }
@@ -2837,7 +2842,7 @@ var zn = class extends Z {
2837
2842
  let e = this.editor.usertextarea, { selectionStart: t } = e, n = e.value, r = t === 0 || n[t - 1] === "\n" ? "---\n" : "\n\n---\n";
2838
2843
  this.editor.insertText(r, r.length, 0);
2839
2844
  }
2840
- }, qn = class extends Z {
2845
+ }, Jn = class extends Z {
2841
2846
  constructor(e) {
2842
2847
  super(e, "Table"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z\" /><path d=\"M3 10h18\" /><path d=\"M10 3v18\" /></svg>\n ");
2843
2848
  }
@@ -2848,26 +2853,26 @@ var zn = class extends Z {
2848
2853
  };
2849
2854
  //#endregion
2850
2855
  //#region src/utils/variables.js
2851
- function Jn(e) {
2856
+ function Yn(e) {
2852
2857
  let t = (e) => e && e.label && typeof e.value == "string", n = [];
2853
2858
  for (let r of Array.isArray(e) ? e : []) r && (Array.isArray(r.items) ? n.push(...r.items.filter(t)) : t(r) && n.push(r));
2854
2859
  return n;
2855
2860
  }
2856
- function Yn(e, t) {
2857
- let n = Jn(t).filter((e) => typeof e.sample == "string");
2861
+ function Xn(e, t) {
2862
+ let n = Yn(t).filter((e) => typeof e.sample == "string");
2858
2863
  return n.length ? n.slice().sort((e, t) => t.value.length - e.value.length).reduce((e, t) => e.split(t.value).join(t.sample), e) : e;
2859
2864
  }
2860
2865
  //#endregion
2861
2866
  //#region src/components/toolbar/tools/VariableTool.js
2862
- var Xn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M7 4a2 2 0 0 0 -2 2v3a2 2 0 0 1 -2 2a2 2 0 0 1 2 2v3a2 2 0 0 0 2 2\" /><path d=\"M17 4a2 2 0 0 1 2 2v3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2v3a2 2 0 0 1 -2 2\" /></svg>\n", Zn = class extends Z {
2867
+ var Zn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M7 4a2 2 0 0 0 -2 2v3a2 2 0 0 1 -2 2a2 2 0 0 1 2 2v3a2 2 0 0 0 2 2\" /><path d=\"M17 4a2 2 0 0 1 2 2v3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2v3a2 2 0 0 1 -2 2\" /></svg>\n", Qn = class extends Z {
2863
2868
  constructor(e) {
2864
2869
  super(e, "Variables");
2865
2870
  }
2866
2871
  createButton() {
2867
2872
  let e = this.editor.variables ?? [];
2868
- if (!Jn(e).length) return null;
2873
+ if (!Yn(e).length) return null;
2869
2874
  let t = `variable-popover-${Math.random().toString(36).slice(2, 7)}`, n = document.createElement("button");
2870
- n.innerHTML = Xn, n.querySelector("svg")?.setAttribute("aria-hidden", "true"), n.type = "button", n.title = this.editor.label("Insert variable"), n.setAttribute("aria-label", this.editor.label("Insert variable")), n.setAttribute("aria-haspopup", "menu"), n.className = "markdown-btn variable-btn fj:me-btn fj:me-btn-xs fj:me-btn-square fj:me-btn-ghost fj:me-popover-toggle", n.setAttribute("popovertarget", t);
2875
+ n.innerHTML = Zn, n.querySelector("svg")?.setAttribute("aria-hidden", "true"), n.type = "button", n.title = this.editor.label("Insert variable"), n.setAttribute("aria-label", this.editor.label("Insert variable")), n.setAttribute("aria-haspopup", "menu"), n.className = "markdown-btn variable-btn fj:me-btn fj:me-btn-xs fj:me-btn-square fj:me-btn-ghost fj:me-popover-toggle", n.setAttribute("popovertarget", t);
2871
2876
  let r = document.createElement("div");
2872
2877
  r.id = t, r.setAttribute("role", "menu"), r.setAttribute("aria-label", this.editor.label("Variables")), r.className = "fj:me-popover-content", r.setAttribute("popover", "");
2873
2878
  let i = document.createElement("ul");
@@ -2898,14 +2903,14 @@ var Xn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
2898
2903
  }), n.appendChild(r), n;
2899
2904
  }
2900
2905
  applySyntax() {}
2901
- }, Qn = class extends Z {
2906
+ }, $n = class extends Z {
2902
2907
  constructor(e, t = {}) {
2903
2908
  super(e, t.title || "Custom"), this.action = t.action, this.button = typeof this.action == "function" ? this.createButton(t.icon || "") : null, this.shortcut = this.button ? t.shortcut : void 0, this.button || console.warn("[MarkdownEditor] A custom tool needs an action function. Skipping it.", t);
2904
2909
  }
2905
2910
  applySyntax(e) {
2906
2911
  this.action(this.editor, e);
2907
2912
  }
2908
- }, $n = class {
2913
+ }, er = class {
2909
2914
  constructor(e, t, { standalone: n = !1 } = {}) {
2910
2915
  this.editor = e, this.options = t, this.standalone = n, this.tools = [], this.toolbar = document.createElement("div"), this.toolbar.className = n ? "toolbar not-prose fj:flex fj:items-center fj:gap-x-1" : "toolbar not-prose fj:me-surface fj:me-surface-outline fj:border-base-soft fj:border-0 fj:border-b fj:flex fj:items-center fj:gap-x-1 fj:p-1.5 fj:overflow-x-auto", this.toolbar.setAttribute("role", "toolbar"), this.toolbar.setAttribute("aria-label", e.label("Editor toolbar")), this.init();
2911
2916
  }
@@ -2914,32 +2919,32 @@ var Xn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
2914
2919
  }
2915
2920
  init() {
2916
2921
  let e = {
2917
- heading: Ln,
2922
+ heading: Rn,
2918
2923
  ul: Mn,
2919
2924
  ol: Nn,
2920
2925
  checklist: Fn,
2921
2926
  bold: kn,
2922
2927
  italic: An,
2923
2928
  strikethrough: jn,
2924
- blockquote: Q,
2925
- code: Wn,
2926
- codeblock: Gn,
2927
- hr: Kn,
2928
- table: qn,
2929
- link: $,
2930
- image: zn,
2931
- undo: Bn,
2932
- redo: Vn,
2933
- indent: Hn,
2934
- outdent: Un,
2935
- variables: Zn
2929
+ blockquote: In,
2930
+ code: Gn,
2931
+ codeblock: Kn,
2932
+ hr: qn,
2933
+ table: Jn,
2934
+ link: Ln,
2935
+ image: Bn,
2936
+ undo: Vn,
2937
+ redo: Hn,
2938
+ indent: Un,
2939
+ outdent: Wn,
2940
+ variables: Qn
2936
2941
  };
2937
2942
  if (this.options.forEach((t) => {
2938
2943
  let n, r;
2939
2944
  if (typeof t == "string") n = e[t];
2940
2945
  else if (typeof t == "function") n = t;
2941
2946
  else if (t && typeof t.tool == "function") n = t.tool, r = t.config;
2942
- else if (t && t.custom) n = Qn, r = t.custom;
2947
+ else if (t && t.custom) n = $n, r = t.custom;
2943
2948
  else if (typeof t == "object") {
2944
2949
  let i = Object.keys(t)[0];
2945
2950
  r = t[i], n = e[i];
@@ -2956,14 +2961,14 @@ var Xn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
2956
2961
  this.editor.editorContainer.insertBefore(this.toolbar, this.editor.markdownEditorDiv);
2957
2962
  }
2958
2963
  }
2959
- }, er = class {
2964
+ }, tr = class {
2960
2965
  constructor(e) {
2961
2966
  this.previewContainer = document.createElement("div"), this.previewContainer.className = "preview-wrapper fj:p-2 fj:hidden fj:me-surface fj:me-surface-outline fj:border-base-soft fj:border-0 fj:border-l", this.previewContainer.setAttribute("role", "region"), this.previewContainer.setAttribute("aria-label", "Preview"), this.previewContent = document.createElement("div"), this.previewContent.className = "preview-content fj:mte-prose fj:mte-prose-sm fj:md:mte-prose-base fj:me-prose-frutjam fj:p-1.5 fj:overflow-y-auto fj:h-full fj:max-w-full", this.previewContainer.appendChild(this.previewContent), e.appendChild(this.previewContainer);
2962
2967
  }
2963
2968
  getPreviewContent() {
2964
2969
  return this.previewContent;
2965
2970
  }
2966
- }, tr = class {
2971
+ }, nr = class {
2967
2972
  constructor(e, t = {}) {
2968
2973
  this.options = t, this.footer = document.createElement("div"), this.footer.className = "editor-footer not-prose fj:me-surface fj:me-surface-outline fj:border-base-soft fj:border-0 fj:border-t fj:flex fj:justify-between fj:items-center fj:px-3 fj:py-1 fj:text-xs fj:opacity-60 fj:select-none", this.footer.setAttribute("aria-hidden", "true"), this.positionEl = document.createElement("span"), this.charsEl = document.createElement("span"), this.wordsEl = document.createElement("span"), (this.options.line || this.options.col) && this.footer.appendChild(this.positionEl), this.options.chars && this.footer.appendChild(this.charsEl), this.options.words && this.footer.appendChild(this.wordsEl), e.appendChild(this.footer);
2969
2974
  }
@@ -2978,7 +2983,7 @@ var Xn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
2978
2983
  this.wordsEl.textContent = `${e.toLocaleString()} words`;
2979
2984
  }
2980
2985
  }
2981
- }, nr = class {
2986
+ }, rr = class {
2982
2987
  diff(e, t, n = {}) {
2983
2988
  let r;
2984
2989
  typeof n == "function" ? (r = n, n = {}) : "callback" in n && (r = n.callback);
@@ -3001,7 +3006,7 @@ var Xn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
3001
3006
  lastComponent: void 0
3002
3007
  }], f = this.extractCommon(d[0], t, e, 0, n);
3003
3008
  if (d[0].oldPos + 1 >= o && f + 1 >= a) return i(this.buildValues(d[0].lastComponent, t, e));
3004
- let p = -Infinity, m = Infinity, ee = () => {
3009
+ let p = -Infinity, m = Infinity, h = () => {
3005
3010
  for (let r = Math.max(p, -s); r <= Math.min(m, s); r += 2) {
3006
3011
  let s, c = d[r - 1], l = d[r + 1];
3007
3012
  c && (d[r - 1] = void 0);
@@ -3010,12 +3015,12 @@ var Xn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
3010
3015
  let e = l.oldPos - r;
3011
3016
  u = l && 0 <= e && e < a;
3012
3017
  }
3013
- let ee = c && c.oldPos + 1 < o;
3014
- if (!u && !ee) {
3018
+ let h = c && c.oldPos + 1 < o;
3019
+ if (!u && !h) {
3015
3020
  d[r] = void 0;
3016
3021
  continue;
3017
3022
  }
3018
- if (s = !ee || u && c.oldPos < l.oldPos ? this.addToPath(l, !0, !1, 0, n) : this.addToPath(c, !1, !0, 1, n), f = this.extractCommon(s, t, e, r, n), s.oldPos + 1 >= o && f + 1 >= a) return i(this.buildValues(s.lastComponent, t, e)) || !0;
3023
+ if (s = !h || u && c.oldPos < l.oldPos ? this.addToPath(l, !0, !1, 0, n) : this.addToPath(c, !1, !0, 1, n), f = this.extractCommon(s, t, e, r, n), s.oldPos + 1 >= o && f + 1 >= a) return i(this.buildValues(s.lastComponent, t, e)) || !0;
3019
3024
  d[r] = s, s.oldPos + 1 >= o && (m = Math.min(m, r - 1)), f + 1 >= a && (p = Math.max(p, r + 1));
3020
3025
  }
3021
3026
  s++;
@@ -3023,11 +3028,11 @@ var Xn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
3023
3028
  if (r) (function e() {
3024
3029
  setTimeout(function() {
3025
3030
  if (s > c || Date.now() > u) return r(void 0);
3026
- ee() || e();
3031
+ h() || e();
3027
3032
  }, 0);
3028
3033
  })();
3029
3034
  else for (; s <= c && Date.now() <= u;) {
3030
- let e = ee();
3035
+ let e = h();
3031
3036
  if (e) return e;
3032
3037
  }
3033
3038
  }
@@ -3110,42 +3115,42 @@ var Xn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
3110
3115
  }
3111
3116
  return r;
3112
3117
  }
3113
- }, rr = new class extends nr {}();
3114
- function ir(e, t, n) {
3115
- return rr.diff(e, t, n);
3118
+ }, ir = new class extends rr {}();
3119
+ function ar(e, t, n) {
3120
+ return ir.diff(e, t, n);
3116
3121
  }
3117
3122
  //#endregion
3118
3123
  //#region node_modules/diff/libesm/util/string.js
3119
- function ar(e, t) {
3124
+ function or(e, t) {
3120
3125
  let n = 0;
3121
3126
  for (; n < e.length && n < t.length; n++) if (e[n] != t[n]) return e.slice(0, n);
3122
3127
  return e.slice(0, n);
3123
3128
  }
3124
- function or(e, t) {
3129
+ function sr(e, t) {
3125
3130
  let n;
3126
3131
  if (!e || !t || e[e.length - 1] != t[t.length - 1]) return "";
3127
3132
  for (n = 0; n < e.length && n < t.length; n++) if (e[e.length - (n + 1)] != t[t.length - (n + 1)]) return e.slice(-n);
3128
3133
  return e.slice(-n);
3129
3134
  }
3130
- function sr(e, t, n) {
3135
+ function cr(e, t, n) {
3131
3136
  if (e.slice(0, t.length) != t) throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);
3132
3137
  return n + e.slice(t.length);
3133
3138
  }
3134
- function cr(e, t, n) {
3139
+ function lr(e, t, n) {
3135
3140
  if (!t) return e + n;
3136
3141
  if (e.slice(-t.length) != t) throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);
3137
3142
  return e.slice(0, -t.length) + n;
3138
3143
  }
3139
- function lr(e, t) {
3140
- return sr(e, t, "");
3141
- }
3142
3144
  function ur(e, t) {
3143
3145
  return cr(e, t, "");
3144
3146
  }
3145
3147
  function dr(e, t) {
3146
- return t.slice(0, fr(e, t));
3148
+ return lr(e, t, "");
3147
3149
  }
3148
3150
  function fr(e, t) {
3151
+ return t.slice(0, pr(e, t));
3152
+ }
3153
+ function pr(e, t) {
3149
3154
  let n = 0;
3150
3155
  e.length > t.length && (n = e.length - t.length);
3151
3156
  let r = t.length;
@@ -3163,7 +3168,7 @@ function fr(e, t) {
3163
3168
  }
3164
3169
  return a;
3165
3170
  }
3166
- function pr(e, t) {
3171
+ function mr(e, t) {
3167
3172
  let n = [];
3168
3173
  for (let r of Array.from(t.segment(e))) {
3169
3174
  let e = r.segment;
@@ -3171,27 +3176,27 @@ function pr(e, t) {
3171
3176
  }
3172
3177
  return n;
3173
3178
  }
3174
- function mr(e, t) {
3175
- if (t) return gr(e, t)[1];
3179
+ function hr(e, t) {
3180
+ if (t) return _r(e, t)[1];
3176
3181
  let n;
3177
3182
  for (n = e.length - 1; n >= 0 && e[n].match(/\s/); n--);
3178
3183
  return e.substring(n + 1);
3179
3184
  }
3180
- function hr(e, t) {
3181
- if (t) return gr(e, t)[0];
3185
+ function gr(e, t) {
3186
+ if (t) return _r(e, t)[0];
3182
3187
  let n = e.match(/^\s*/);
3183
3188
  return n ? n[0] : "";
3184
3189
  }
3185
- function gr(e, t) {
3186
- if (!t) return [hr(e), mr(e)];
3190
+ function _r(e, t) {
3191
+ if (!t) return [gr(e), hr(e)];
3187
3192
  if (t.resolvedOptions().granularity != "word") throw Error("The segmenter passed must have a granularity of \"word\"");
3188
- let n = pr(e, t), r = n[0], i = n[n.length - 1];
3193
+ let n = mr(e, t), r = n[0], i = n[n.length - 1];
3189
3194
  return [/\s/.test(r) ? r : "", /\s/.test(i) ? i : ""];
3190
3195
  }
3191
3196
  //#endregion
3192
3197
  //#region node_modules/diff/libesm/diff/word.js
3193
- var _r = "a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}", vr = RegExp(`[${_r}]+|\\s+|[^${_r}]`, "ug");
3194
- new class extends nr {
3198
+ var vr = "a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}", yr = RegExp(`[${vr}]+|\\s+|[^${vr}]`, "ug");
3199
+ new class extends rr {
3195
3200
  equals(e, t, n) {
3196
3201
  return n.ignoreCase && (e = e.toLowerCase(), t = t.toLowerCase()), e.trim() === t.trim();
3197
3202
  }
@@ -3200,8 +3205,8 @@ new class extends nr {
3200
3205
  if (t.intlSegmenter) {
3201
3206
  let r = t.intlSegmenter;
3202
3207
  if (r.resolvedOptions().granularity != "word") throw Error("The segmenter passed must have a granularity of \"word\"");
3203
- n = pr(e, r);
3204
- } else n = e.match(vr) || [];
3208
+ n = mr(e, r);
3209
+ } else n = e.match(yr) || [];
3205
3210
  let r = [], i = null;
3206
3211
  return n.forEach((e) => {
3207
3212
  /\s/.test(e) ? i == null ? r.push(e) : r.push(r.pop() + e) : i != null && /\s/.test(i) ? r[r.length - 1] == i ? r.push(r.pop() + e) : r.push(i + e) : r.push(e), i = e;
@@ -3214,57 +3219,57 @@ new class extends nr {
3214
3219
  if (!e || t.oneChangePerToken) return e;
3215
3220
  let n = null, r = null, i = null;
3216
3221
  return e.forEach((e) => {
3217
- e.added ? r = e : e.removed ? i = e : ((r || i) && yr(n, i, r, e, t.intlSegmenter), n = e, r = null, i = null);
3218
- }), (r || i) && yr(n, i, r, null, t.intlSegmenter), e;
3222
+ e.added ? r = e : e.removed ? i = e : ((r || i) && br(n, i, r, e, t.intlSegmenter), n = e, r = null, i = null);
3223
+ }), (r || i) && br(n, i, r, null, t.intlSegmenter), e;
3219
3224
  }
3220
3225
  }();
3221
- function yr(e, t, n, r, i) {
3226
+ function br(e, t, n, r, i) {
3222
3227
  if (t && n) {
3223
- let [a, o] = gr(t.value, i), [s, c] = gr(n.value, i);
3228
+ let [a, o] = _r(t.value, i), [s, c] = _r(n.value, i);
3224
3229
  if (e) {
3225
- let r = ar(a, s);
3226
- e.value = cr(e.value, s, r), t.value = lr(t.value, r), n.value = lr(n.value, r);
3230
+ let r = or(a, s);
3231
+ e.value = lr(e.value, s, r), t.value = ur(t.value, r), n.value = ur(n.value, r);
3227
3232
  }
3228
3233
  if (r) {
3229
- let e = or(o, c);
3230
- r.value = sr(r.value, c, e), t.value = ur(t.value, e), n.value = ur(n.value, e);
3234
+ let e = sr(o, c);
3235
+ r.value = cr(r.value, c, e), t.value = dr(t.value, e), n.value = dr(n.value, e);
3231
3236
  }
3232
3237
  } else if (n) {
3233
3238
  if (e) {
3234
- let e = hr(n.value, i);
3239
+ let e = gr(n.value, i);
3235
3240
  n.value = n.value.substring(e.length);
3236
3241
  }
3237
3242
  if (r) {
3238
- let e = hr(r.value, i);
3243
+ let e = gr(r.value, i);
3239
3244
  r.value = r.value.substring(e.length);
3240
3245
  }
3241
3246
  } else if (e && r) {
3242
- let n = hr(r.value, i), [a, o] = gr(t.value, i), s = ar(n, a);
3243
- t.value = lr(t.value, s);
3244
- let c = or(lr(n, s), o);
3245
- t.value = ur(t.value, c), r.value = sr(r.value, n, c), e.value = cr(e.value, n, n.slice(0, n.length - c.length));
3247
+ let n = gr(r.value, i), [a, o] = _r(t.value, i), s = or(n, a);
3248
+ t.value = ur(t.value, s);
3249
+ let c = sr(ur(n, s), o);
3250
+ t.value = dr(t.value, c), r.value = cr(r.value, n, c), e.value = lr(e.value, n, n.slice(0, n.length - c.length));
3246
3251
  } else if (r) {
3247
- let e = hr(r.value, i), n = dr(mr(t.value, i), e);
3248
- t.value = ur(t.value, n);
3252
+ let e = gr(r.value, i), n = fr(hr(t.value, i), e);
3253
+ t.value = dr(t.value, n);
3249
3254
  } else if (e) {
3250
- let n = dr(mr(e.value, i), hr(t.value, i));
3251
- t.value = lr(t.value, n);
3255
+ let n = fr(hr(e.value, i), gr(t.value, i));
3256
+ t.value = ur(t.value, n);
3252
3257
  }
3253
3258
  }
3254
- new class extends nr {
3259
+ new class extends rr {
3255
3260
  tokenize(e) {
3256
- let t = RegExp(`(\\r?\\n)|[${_r}]+|[^\\S\\n\\r]+|[^${_r}]`, "ug");
3261
+ let t = RegExp(`(\\r?\\n)|[${vr}]+|[^\\S\\n\\r]+|[^${vr}]`, "ug");
3257
3262
  return e.match(t) || [];
3258
3263
  }
3259
- }(), new class extends nr {
3264
+ }(), new class extends rr {
3260
3265
  constructor() {
3261
- super(...arguments), this.tokenize = br;
3266
+ super(...arguments), this.tokenize = xr;
3262
3267
  }
3263
3268
  equals(e, t, n) {
3264
3269
  return n.ignoreWhitespace ? ((!n.newlineIsToken || !e.includes("\n")) && (e = e.trim()), (!n.newlineIsToken || !t.includes("\n")) && (t = t.trim())) : n.ignoreNewlineAtEof && !n.newlineIsToken && (e.endsWith("\n") && (e = e.slice(0, -1)), t.endsWith("\n") && (t = t.slice(0, -1))), super.equals(e, t, n);
3265
3270
  }
3266
3271
  }();
3267
- function br(e, t) {
3272
+ function xr(e, t) {
3268
3273
  t.stripTrailingCr && (e = e.replace(/\r\n/g, "\n"));
3269
3274
  let n = [], r = e.split(/(\n|\r\n)/);
3270
3275
  r[r.length - 1] || r.pop();
@@ -3276,10 +3281,10 @@ function br(e, t) {
3276
3281
  }
3277
3282
  //#endregion
3278
3283
  //#region node_modules/diff/libesm/diff/sentence.js
3279
- function xr(e) {
3284
+ function Sr(e) {
3280
3285
  return e == "." || e == "!" || e == "?";
3281
3286
  }
3282
- new class extends nr {
3287
+ new class extends rr {
3283
3288
  tokenize(e) {
3284
3289
  let t = [], n = 0;
3285
3290
  for (let r = 0; r < e.length; r++) {
@@ -3287,39 +3292,39 @@ new class extends nr {
3287
3292
  t.push(e.slice(n));
3288
3293
  break;
3289
3294
  }
3290
- if (xr(e[r]) && e[r + 1].match(/\s/)) {
3295
+ if (Sr(e[r]) && e[r + 1].match(/\s/)) {
3291
3296
  for (t.push(e.slice(n, r + 1)), r = n = r + 1; e[r + 1]?.match(/\s/);) r++;
3292
3297
  t.push(e.slice(n, r + 1)), n = r + 1;
3293
3298
  }
3294
3299
  }
3295
3300
  return t;
3296
3301
  }
3297
- }(), new class extends nr {
3302
+ }(), new class extends rr {
3298
3303
  tokenize(e) {
3299
3304
  return e.split(/([{}:;,]|\s+)/);
3300
3305
  }
3301
- }(), new class extends nr {
3306
+ }(), new class extends rr {
3302
3307
  constructor() {
3303
- super(...arguments), this.tokenize = br;
3308
+ super(...arguments), this.tokenize = xr;
3304
3309
  }
3305
3310
  get useLongestToken() {
3306
3311
  return !0;
3307
3312
  }
3308
3313
  castInput(e, t) {
3309
3314
  let { undefinedReplacement: n, stringifyReplacer: r = (e, t) => t === void 0 ? n : t } = t;
3310
- return typeof e == "string" ? e : JSON.stringify(Sr(e, null, null, r), null, " ");
3315
+ return typeof e == "string" ? e : JSON.stringify(Cr(e, null, null, r), null, " ");
3311
3316
  }
3312
3317
  equals(e, t, n) {
3313
3318
  return super.equals(e.replace(/,([\r\n])/g, "$1"), t.replace(/,([\r\n])/g, "$1"), n);
3314
3319
  }
3315
3320
  }();
3316
- function Sr(e, t, n, r, i) {
3321
+ function Cr(e, t, n, r, i) {
3317
3322
  t ||= [], n ||= [], r && (e = r(i === void 0 ? "" : i, e));
3318
3323
  let a = 0;
3319
3324
  for (; a < t.length; a += 1) if (t[a] === e) return n[a];
3320
3325
  let o;
3321
3326
  if (Object.prototype.toString.call(e) === "[object Array]") {
3322
- for (t.push(e), o = Array(e.length), n.push(o), a = 0; a < e.length; a += 1) o[a] = Sr(e[a], t, n, r, String(a));
3327
+ for (t.push(e), o = Array(e.length), n.push(o), a = 0; a < e.length; a += 1) o[a] = Cr(e[a], t, n, r, String(a));
3323
3328
  return t.pop(), n.pop(), o;
3324
3329
  }
3325
3330
  if (e && e.toJSON && (e = e.toJSON()), typeof e == "object" && e) {
@@ -3328,12 +3333,12 @@ function Sr(e, t, n, r, i) {
3328
3333
  for (s in e)
3329
3334
  /* istanbul ignore else */
3330
3335
  Object.prototype.hasOwnProperty.call(e, s) && i.push(s);
3331
- for (i.sort(), a = 0; a < i.length; a += 1) s = i[a], o[s] = Sr(e[s], t, n, r, s);
3336
+ for (i.sort(), a = 0; a < i.length; a += 1) s = i[a], o[s] = Cr(e[s], t, n, r, s);
3332
3337
  t.pop(), n.pop();
3333
3338
  } else o = e;
3334
3339
  return o;
3335
3340
  }
3336
- new class extends nr {
3341
+ new class extends rr {
3337
3342
  tokenize(e) {
3338
3343
  return e.slice();
3339
3344
  }
@@ -3346,7 +3351,7 @@ new class extends nr {
3346
3351
  }();
3347
3352
  //#endregion
3348
3353
  //#region src/utils/UndoRedoManager.js
3349
- var Cr = class {
3354
+ var wr = class {
3350
3355
  constructor(e) {
3351
3356
  this.editor = e, this.textarea = e.usertextarea, this.undoStack = [], this.redoStack = [], this.lastValue = this.textarea.value, this.lastSelection = {
3352
3357
  selectionStart: this.textarea.selectionStart,
@@ -3380,7 +3385,7 @@ var Cr = class {
3380
3385
  let e = this.textarea.value || "";
3381
3386
  if (e === this.lastValue) return;
3382
3387
  clearTimeout(this._debounceTimer);
3383
- let t = ir(this.lastValue, e);
3388
+ let t = ar(this.lastValue, e);
3384
3389
  this.undoStack.push({
3385
3390
  diff: t,
3386
3391
  selection: { ...this.lastSelection }
@@ -3420,7 +3425,7 @@ var Cr = class {
3420
3425
  _restoreState(e, t) {
3421
3426
  this.textarea.value = e, this.textarea.setSelectionRange(t.selectionStart, t.selectionEnd), this.lastValue = e, this.lastSelection = { ...t }, this.editor.render && this.editor.render(), this.editor.notifyChange(), this.textarea.focus();
3422
3427
  }
3423
- }, wr = class {
3428
+ }, Tr = class {
3424
3429
  constructor(e, t) {
3425
3430
  this.editor = e, this.textarea = e.usertextarea, this.renderCallback = t, this.pairs = {
3426
3431
  "{": "}",
@@ -3513,7 +3518,7 @@ var Cr = class {
3513
3518
  _applyChange(e, t, n) {
3514
3519
  this.textarea.value = e, this.textarea.setSelectionRange(t, n);
3515
3520
  }
3516
- }, Tr = class {
3521
+ }, Er = class {
3517
3522
  constructor(e) {
3518
3523
  this.editor = e, this.textarea = e.usertextarea, this._keydownHandler = (e) => {
3519
3524
  e.key === "Enter" && this.handleEnter(e);
@@ -3539,7 +3544,7 @@ var Cr = class {
3539
3544
  this.textarea.setSelectionRange(o, o), this.editor.render(), this.editor.notifyChange();
3540
3545
  }
3541
3546
  }
3542
- }, Er = [
3547
+ }, Dr = [
3543
3548
  {
3544
3549
  key: "b",
3545
3550
  ctrl: !0,
@@ -3560,7 +3565,7 @@ var Cr = class {
3560
3565
  key: "k",
3561
3566
  ctrl: !0,
3562
3567
  shift: !1,
3563
- ToolClass: $,
3568
+ ToolClass: Ln,
3564
3569
  label: "Ctrl+K",
3565
3570
  btnClass: "link-btn"
3566
3571
  },
@@ -3568,7 +3573,7 @@ var Cr = class {
3568
3573
  key: "`",
3569
3574
  ctrl: !0,
3570
3575
  shift: !1,
3571
- ToolClass: Wn,
3576
+ ToolClass: Gn,
3572
3577
  label: "Ctrl+`",
3573
3578
  btnClass: "code-btn"
3574
3579
  },
@@ -3589,7 +3594,7 @@ var Cr = class {
3589
3594
  btnClass: "ul-btn"
3590
3595
  }
3591
3596
  ];
3592
- function Dr(e) {
3597
+ function Or(e) {
3593
3598
  let t = String(e).split("+").map((e) => e.trim().toLowerCase()), n = t.pop();
3594
3599
  return n ? {
3595
3600
  key: n,
@@ -3598,11 +3603,11 @@ function Dr(e) {
3598
3603
  alt: t.includes("alt")
3599
3604
  } : null;
3600
3605
  }
3601
- var Or = class {
3606
+ var kr = class {
3602
3607
  constructor(e) {
3603
3608
  this.editor = e, this.toolShortcuts = (e.toolbarInstance?.tools ?? []).filter((e) => e.shortcut).map((e) => ({
3604
3609
  tool: e,
3605
- combo: Dr(e.shortcut)
3610
+ combo: Or(e.shortcut)
3606
3611
  })).filter((e) => e.combo), this._handler = this._onKeyDown.bind(this), this._docHandler = this._onDocKeyDown.bind(this), e.usertextarea.addEventListener("keydown", this._handler), document.addEventListener("keydown", this._docHandler), this._updateTooltips();
3607
3612
  }
3608
3613
  _onKeyDown(e) {
@@ -3616,14 +3621,14 @@ var Or = class {
3616
3621
  "2",
3617
3622
  "3"
3618
3623
  ].includes(e.key)) {
3619
- e.preventDefault(), new Ln(this.editor).applyHeading(parseInt(e.key));
3624
+ e.preventDefault(), new Rn(this.editor).applyHeading(parseInt(e.key));
3620
3625
  return;
3621
3626
  }
3622
3627
  for (let { tool: i, combo: a } of this.toolShortcuts) if (r === a.key && t === a.ctrl && n === a.shift && e.altKey === a.alt) {
3623
3628
  e.preventDefault(), i.applySyntax(e);
3624
3629
  return;
3625
3630
  }
3626
- for (let i of Er) if (r === i.key && t === i.ctrl && n === i.shift) {
3631
+ for (let i of Dr) if (r === i.key && t === i.ctrl && n === i.shift) {
3627
3632
  e.preventDefault(), new i.ToolClass(this.editor).applySyntax(e);
3628
3633
  return;
3629
3634
  }
@@ -3635,7 +3640,7 @@ var Or = class {
3635
3640
  }
3636
3641
  }
3637
3642
  _updateTooltips() {
3638
- for (let { btnClass: e, label: t } of Er) {
3643
+ for (let { btnClass: e, label: t } of Dr) {
3639
3644
  let n = this.editor.editorContainer.querySelector(`.${e}`);
3640
3645
  n && (n.title += ` (${t})`);
3641
3646
  }
@@ -3648,7 +3653,7 @@ var Or = class {
3648
3653
  destroy() {
3649
3654
  this.editor.usertextarea.removeEventListener("keydown", this._handler), document.removeEventListener("keydown", this._docHandler);
3650
3655
  }
3651
- }, kr = class {
3656
+ }, Ar = class {
3652
3657
  constructor(e) {
3653
3658
  this.editor = e, this._matches = [], this._currentIndex = -1, this._caseSensitive = !1, this._panel = null, this._findInput = null, this._replaceInput = null, this._countEl = null, this._replaceRow = null, this._caseSensitiveBtn = null, this._highlightEl = null, this._matchTop = null, this._matchHeight = 0, this._scrollHandler = null, this._taHandler = this._onTextareaKeyDown.bind(this), e.usertextarea.addEventListener("keydown", this._taHandler);
3654
3659
  }
@@ -3803,7 +3808,7 @@ var Or = class {
3803
3808
  destroy() {
3804
3809
  this.editor.usertextarea.removeEventListener("keydown", this._taHandler), this._scrollHandler && this.editor.usertextarea.removeEventListener("scroll", this._scrollHandler), this._clearMatchHighlight(), this._panel?.remove();
3805
3810
  }
3806
- }, Ar = /^https?:\/\/\S+$/i, jr = class {
3811
+ }, jr = /^https?:\/\/\S+$/i, Mr = class {
3807
3812
  constructor(e) {
3808
3813
  this.editor = e, this.textarea = e.usertextarea, this._pasteHandler = (e) => this._onPaste(e), this._dropHandler = (e) => this._onDrop(e), this._dragOverHandler = (e) => {
3809
3814
  this._carriesFiles(e.dataTransfer) && e.preventDefault();
@@ -3829,7 +3834,7 @@ var Or = class {
3829
3834
  return;
3830
3835
  }
3831
3836
  let n = e.clipboardData?.getData("text/plain")?.trim(), { selectionStart: r, selectionEnd: i } = this.textarea;
3832
- if (n && i > r && Ar.test(n)) {
3837
+ if (n && i > r && jr.test(n)) {
3833
3838
  e.preventDefault();
3834
3839
  let t = `[${this.textarea.value.slice(r, i)}](${n})`;
3835
3840
  this.editor.insertText(t, t.length, 0);
@@ -3852,7 +3857,7 @@ var Or = class {
3852
3857
  let e = `![${this.editor.label("Uploading...")}]()`;
3853
3858
  this.editor.insertText(e, e.length, 0);
3854
3859
  try {
3855
- let { path: n, alt: r } = await Rn(t, this.editor.imageUpload);
3860
+ let { path: n, alt: r } = await zn(t, this.editor.imageUpload);
3856
3861
  this._replace(e, `![${r}](${n})`);
3857
3862
  } catch (t) {
3858
3863
  this._replace(e, `![${this.editor.label("Upload failed")}]()`), console.error("[MarkdownEditor] Image upload failed.", t);
@@ -3866,9 +3871,9 @@ var Or = class {
3866
3871
  let i = r + t.length;
3867
3872
  n.setSelectionRange(i, i), this.editor.render(), this.editor.notifyChange();
3868
3873
  }
3869
- }, Mr = new ot({ breaks: !0 }), Nr = class {
3874
+ }, Nr = new ot({ breaks: !0 }), Pr = class {
3870
3875
  constructor(e, t = {}) {
3871
- this.usertextarea = typeof e == "string" ? document.querySelector(e) : e, this.options = t, this.mode = t.mode || "plain", this.preview = !this.options.toolbar || this.options.toolbar.includes("preview"), this.footerOptions = this._parseFooterOptions(t.footer), this.variables = this._parseVariables(t.toolbar), this.imageUpload = this._parseImageUpload(t.toolbar), this.previewTimer = null, this.init(), this.undoRedoManager = new Cr(this), this.listManager = new Tr(this), this.indentManager = new wr(this), this.shortcutManager = new Or(this), this.findReplace = new kr(this), this.pasteManager = new jr(this);
3876
+ this.usertextarea = typeof e == "string" ? document.querySelector(e) : e, this.options = t, this.mode = t.mode || "plain", this.preview = !this.options.toolbar || this.options.toolbar.includes("preview"), this.footerOptions = this._parseFooterOptions(t.footer), this.variables = this._parseVariables(t.toolbar), this.imageUpload = this._parseImageUpload(t.toolbar), this.previewTimer = null, this.init(), this.undoRedoManager = new wr(this), this.listManager = new Er(this), this.indentManager = new Tr(this), this.shortcutManager = new kr(this), this.findReplace = new Ar(this), this.pasteManager = new Mr(this);
3872
3877
  }
3873
3878
  label(e) {
3874
3879
  return this.options.labels?.[e] ?? e;
@@ -3913,7 +3918,7 @@ var Or = class {
3913
3918
  e.className = "\n textarea-wrapper\n not-prose\n fj:me-surface\n fj:h-full\n fj:min-h-0\n fj:relative\n fj:grid\n ", this.mode == "hybrid" && (this.displayLayer = document.createElement("div"), this.displayLayer.setAttribute("data-placeholder", this.usertextarea.placeholder), this.displayLayer.setAttribute("aria-hidden", !0), this.displayLayer.className = "\n display-layer\n fj:px-4\n fj:py-2\n fj:whitespace-pre-wrap fj:wrap-break-word\n fj:pointer-events-none\n fj:absolute\n fj:inset-0\n fj:m-0\n fj:box-border\n fj:z-0\n fj:overflow-y-auto\n fj:empty:after:content-[attr(data-placeholder)]\n fj:empty:after:absolute\n fj:empty:after:inset-0\n fj:empty:after:px-4\n fj:empty:after:py-2\n fj:empty:after:text-[CanvasText]\n fj:empty:after:opacity-50\n ", this.usertextarea.className += "\n fj:text-transparent\n fj:caret-primary\n fj:outline-none\n fj:m-0\n fj:box-border\n fj:relative\n fj:z-10\n ", e.appendChild(this.displayLayer)), e.appendChild(this.usertextarea), this.markdownEditorDiv.appendChild(e);
3914
3919
  }
3915
3920
  addPreviewWrapper() {
3916
- let e = new er(this.markdownEditorDiv);
3921
+ let e = new tr(this.markdownEditorDiv);
3917
3922
  this.previewContent = e.getPreviewContent();
3918
3923
  }
3919
3924
  addInputListener() {
@@ -3950,10 +3955,10 @@ var Or = class {
3950
3955
  return n.usertextarea = e, n.render = () => {}, n.notifyChange = () => {}, n.insertText = (t, n = 0, r = 0) => {
3951
3956
  let { selectionStart: i, selectionEnd: a, value: o } = e, s = e.scrollTop;
3952
3957
  e.value = o.slice(0, i) + t + o.slice(a), e.focus(), e.setSelectionRange(i + n, i + t.length - r), e.scrollTop = s;
3953
- }, new $n(n, t, { standalone: !0 }).toolbar;
3958
+ }, new er(n, t, { standalone: !0 }).toolbar;
3954
3959
  }
3955
3960
  _renderMarkdown(e) {
3956
- let t = this.options.renderer ?? ((e) => Mr.parse(e)), n = this.options.sanitizer ?? ((e) => On.sanitize(e)), r = Yn(e, this.variables), i = t(r);
3961
+ let t = this.options.renderer ?? ((e) => Nr.parse(e)), n = this.options.sanitizer ?? ((e) => On.sanitize(e)), r = Xn(e, this.variables), i = t(r);
3957
3962
  return this.options.renderer && !this._taskListWarned && /^\s*[-*] \[[ xX]\] /m.test(r) && !/type=["']?checkbox/.test(i) && (this._taskListWarned = !0, console.warn("[MarkdownEditor] Task list syntax found, but the custom renderer emitted no checkboxes. Clickable checkboxes in the preview need a task-list plugin, e.g. markdown-it-task-lists.")), n(i);
3958
3963
  }
3959
3964
  wirePreviewCheckboxes() {
@@ -3975,10 +3980,10 @@ var Or = class {
3975
3980
  addFooter() {
3976
3981
  if (!this.footerOptions) return;
3977
3982
  let { line: e, col: t, chars: n, words: r } = this.footerOptions;
3978
- (e || t || n || r) && (this.footer = new tr(this.editorContainer, this.footerOptions), this.footer.update(this.usertextarea), this._footerUpdate = () => this.footer.update(this.usertextarea), this.usertextarea.addEventListener("input", this._footerUpdate), this.usertextarea.addEventListener("click", this._footerUpdate), this.usertextarea.addEventListener("keyup", this._footerUpdate), this.usertextarea.addEventListener("focus", this._footerUpdate));
3983
+ (e || t || n || r) && (this.footer = new nr(this.editorContainer, this.footerOptions), this.footer.update(this.usertextarea), this._footerUpdate = () => this.footer.update(this.usertextarea), this.usertextarea.addEventListener("input", this._footerUpdate), this.usertextarea.addEventListener("click", this._footerUpdate), this.usertextarea.addEventListener("keyup", this._footerUpdate), this.usertextarea.addEventListener("focus", this._footerUpdate));
3979
3984
  }
3980
3985
  addToolbar() {
3981
- this.toolbarInstance = new $n(this, this.options.toolbar || [
3986
+ this.toolbarInstance = new er(this, this.options.toolbar || [
3982
3987
  "undo",
3983
3988
  "redo",
3984
3989
  "heading",
@@ -4071,8 +4076,8 @@ var Or = class {
4071
4076
  ].forEach((e) => this.usertextarea.classList.remove(e)), this._addedAriaLabel && this.usertextarea.removeAttribute("aria-label"), this.usertextarea.style.height = "", e.insertBefore(this.usertextarea, this.editorContainer), this.editorContainer.remove());
4072
4077
  }
4073
4078
  };
4074
- Nr.Tool = Z, Nr.modal = In;
4079
+ Pr.Tool = Z, Pr.modal = $;
4075
4080
  //#endregion
4076
- export { Nr as default };
4081
+ export { Pr as default };
4077
4082
 
4078
4083
  //# sourceMappingURL=markdown-text-editor.es.js.map