567 lines
16 KiB
JavaScript
567 lines
16 KiB
JavaScript
var e;
|
|
(e =
|
|
"function" == typeof Symbol && "symbol" == typeof Symbol.iterator
|
|
? function (e) {
|
|
return typeof e;
|
|
}
|
|
: function (e) {
|
|
return e &&
|
|
"function" == typeof Symbol &&
|
|
e.constructor === Symbol &&
|
|
e !== Symbol.prototype
|
|
? "symbol"
|
|
: typeof e;
|
|
}),
|
|
(function (n) {
|
|
var t =
|
|
("object" == ("undefined" == typeof window ? "undefined" : e(window)) &&
|
|
window) ||
|
|
("object" == ("undefined" == typeof self ? "undefined" : e(self)) &&
|
|
self);
|
|
"undefined" != typeof exports
|
|
? n(exports)
|
|
: t &&
|
|
((t.hljs = n({})),
|
|
"function" == typeof define &&
|
|
define.amd &&
|
|
define([], function () {
|
|
return t.hljs;
|
|
}));
|
|
})(function (e) {
|
|
function n(e) {
|
|
return e
|
|
.replace(/&/g, "&")
|
|
.replace(/</g, "<")
|
|
.replace(/>/g, ">");
|
|
}
|
|
function t(e) {
|
|
return e.nodeName.toLowerCase();
|
|
}
|
|
function r(e, n) {
|
|
var t = e && e.exec(n);
|
|
return t && 0 === t.index;
|
|
}
|
|
function a(e) {
|
|
return _.test(e);
|
|
}
|
|
function i(e) {
|
|
var n,
|
|
t = {},
|
|
r = Array.prototype.slice.call(arguments, 1);
|
|
for (n in e) t[n] = e[n];
|
|
return (
|
|
r.forEach(function (e) {
|
|
for (n in e) t[n] = e[n];
|
|
}),
|
|
t
|
|
);
|
|
}
|
|
function o(e) {
|
|
var n = [];
|
|
return (
|
|
(function e(r, a) {
|
|
for (var i = r.firstChild; i; i = i.nextSibling)
|
|
3 === i.nodeType
|
|
? (a += i.nodeValue.length)
|
|
: 1 === i.nodeType &&
|
|
(n.push({ event: "start", offset: a, node: i }),
|
|
(a = e(i, a)),
|
|
t(i).match(/br|hr|img|input/) ||
|
|
n.push({ event: "stop", offset: a, node: i }));
|
|
return a;
|
|
})(e, 0),
|
|
n
|
|
);
|
|
}
|
|
function s(e, r, a) {
|
|
function i() {
|
|
return e.length && r.length
|
|
? e[0].offset !== r[0].offset
|
|
? e[0].offset < r[0].offset
|
|
? e
|
|
: r
|
|
: "start" === r[0].event
|
|
? e
|
|
: r
|
|
: e.length
|
|
? e
|
|
: r;
|
|
}
|
|
function o(e) {
|
|
c +=
|
|
"<" +
|
|
t(e) +
|
|
v.map
|
|
.call(e.attributes, function (e) {
|
|
return (
|
|
" " +
|
|
e.nodeName +
|
|
'="' +
|
|
n(e.value).replace('"', """) +
|
|
'"'
|
|
);
|
|
})
|
|
.join("") +
|
|
">";
|
|
}
|
|
function s(e) {
|
|
c += "</" + t(e) + ">";
|
|
}
|
|
function l(e) {
|
|
("start" === e.event ? o : s)(e.node);
|
|
}
|
|
for (var u = 0, c = "", g = []; e.length || r.length; ) {
|
|
var f = i();
|
|
if (
|
|
((c += n(a.substring(u, f[0].offset))), (u = f[0].offset), f === e)
|
|
) {
|
|
g.reverse().forEach(s);
|
|
do {
|
|
l(f.splice(0, 1)[0]), (f = i());
|
|
} while (f === e && f.length && f[0].offset === u);
|
|
g.reverse().forEach(o);
|
|
} else
|
|
"start" === f[0].event ? g.push(f[0].node) : g.pop(),
|
|
l(f.splice(0, 1)[0]);
|
|
}
|
|
return c + n(a.substr(u));
|
|
}
|
|
function l(e) {
|
|
return (
|
|
e.variants &&
|
|
!e.cached_variants &&
|
|
(e.cached_variants = e.variants.map(function (n) {
|
|
return i(e, { variants: null }, n);
|
|
})),
|
|
e.cached_variants || (e.endsWithParent && [i(e)]) || [e]
|
|
);
|
|
}
|
|
function u(e) {
|
|
function n(e) {
|
|
return (e && e.source) || e;
|
|
}
|
|
function t(t, r) {
|
|
return new RegExp(
|
|
n(t),
|
|
"m" + (e.case_insensitive ? "i" : "") + (r ? "g" : "")
|
|
);
|
|
}
|
|
!(function r(a, i) {
|
|
if (!a.compiled) {
|
|
if (
|
|
((a.compiled = !0),
|
|
(a.keywords = a.keywords || a.beginKeywords),
|
|
a.keywords)
|
|
) {
|
|
var o = {},
|
|
s = function (n, t) {
|
|
e.case_insensitive && (t = t.toLowerCase()),
|
|
t.split(" ").forEach(function (e) {
|
|
var t = e.split("|");
|
|
o[t[0]] = [n, t[1] ? Number(t[1]) : 1];
|
|
});
|
|
};
|
|
"string" == typeof a.keywords
|
|
? s("keyword", a.keywords)
|
|
: m(a.keywords).forEach(function (e) {
|
|
s(e, a.keywords[e]);
|
|
}),
|
|
(a.keywords = o);
|
|
}
|
|
(a.lexemesRe = t(a.lexemes || /\w+/, !0)),
|
|
i &&
|
|
(a.beginKeywords &&
|
|
(a.begin =
|
|
"\\b(" + a.beginKeywords.split(" ").join("|") + ")\\b"),
|
|
a.begin || (a.begin = /\B|\b/),
|
|
(a.beginRe = t(a.begin)),
|
|
a.end || a.endsWithParent || (a.end = /\B|\b/),
|
|
a.end && (a.endRe = t(a.end)),
|
|
(a.terminator_end = n(a.end) || ""),
|
|
a.endsWithParent &&
|
|
i.terminator_end &&
|
|
(a.terminator_end += (a.end ? "|" : "") + i.terminator_end)),
|
|
a.illegal && (a.illegalRe = t(a.illegal)),
|
|
null == a.relevance && (a.relevance = 1),
|
|
a.contains || (a.contains = []),
|
|
(a.contains = Array.prototype.concat.apply(
|
|
[],
|
|
a.contains.map(function (e) {
|
|
return l("self" === e ? a : e);
|
|
})
|
|
)),
|
|
a.contains.forEach(function (e) {
|
|
r(e, a);
|
|
}),
|
|
a.starts && r(a.starts, i);
|
|
var u = a.contains
|
|
.map(function (e) {
|
|
return e.beginKeywords ? "\\.?(" + e.begin + ")\\.?" : e.begin;
|
|
})
|
|
.concat([a.terminator_end, a.illegal])
|
|
.map(n)
|
|
.filter(Boolean);
|
|
a.terminators = u.length
|
|
? t(u.join("|"), !0)
|
|
: {
|
|
exec: function () {
|
|
return null;
|
|
},
|
|
};
|
|
}
|
|
})(e);
|
|
}
|
|
function c(e, t, a, i) {
|
|
function o(e, n) {
|
|
var t, a;
|
|
for (t = 0, a = n.contains.length; t < a; t++)
|
|
if (r(n.contains[t].beginRe, e)) return n.contains[t];
|
|
}
|
|
function s(e, n) {
|
|
if (r(e.endRe, n)) {
|
|
for (; e.endsParent && e.parent; ) e = e.parent;
|
|
return e;
|
|
}
|
|
if (e.endsWithParent) return s(e.parent, n);
|
|
}
|
|
function l(e, n) {
|
|
return !a && r(n.illegalRe, e);
|
|
}
|
|
function f(e, n) {
|
|
var t = h.case_insensitive ? n[0].toLowerCase() : n[0];
|
|
return e.keywords.hasOwnProperty(t) && e.keywords[t];
|
|
}
|
|
function d(e, n, t, r) {
|
|
var a = '<span class="' + (r ? "" : y.classPrefix);
|
|
return (a += e + '">') + n + (t ? "" : w);
|
|
}
|
|
function E() {
|
|
(M +=
|
|
null != R.subLanguage
|
|
? (function () {
|
|
var e = "string" == typeof R.subLanguage;
|
|
if (e && !b[R.subLanguage]) return n(x);
|
|
var t = e
|
|
? c(R.subLanguage, x, !0, N[R.subLanguage])
|
|
: g(x, R.subLanguage.length ? R.subLanguage : void 0);
|
|
return (
|
|
R.relevance > 0 && (O += t.relevance),
|
|
e && (N[R.subLanguage] = t.top),
|
|
d(t.language, t.value, !1, !0)
|
|
);
|
|
})()
|
|
: (function () {
|
|
var e, t, r, a;
|
|
if (!R.keywords) return n(x);
|
|
for (
|
|
a = "",
|
|
t = 0,
|
|
R.lexemesRe.lastIndex = 0,
|
|
r = R.lexemesRe.exec(x);
|
|
r;
|
|
|
|
)
|
|
(a += n(x.substring(t, r.index))),
|
|
(e = f(R, r))
|
|
? ((O += e[1]), (a += d(e[0], n(r[0]))))
|
|
: (a += n(r[0])),
|
|
(t = R.lexemesRe.lastIndex),
|
|
(r = R.lexemesRe.exec(x));
|
|
return a + n(x.substr(t));
|
|
})()),
|
|
(x = "");
|
|
}
|
|
function v(e) {
|
|
(M += e.className ? d(e.className, "", !0) : ""),
|
|
(R = Object.create(e, { parent: { value: R } }));
|
|
}
|
|
function m(e, n) {
|
|
if (((x += e), null == n)) return E(), 0;
|
|
var t = o(n, R);
|
|
if (t)
|
|
return (
|
|
t.skip
|
|
? (x += n)
|
|
: (t.excludeBegin && (x += n),
|
|
E(),
|
|
t.returnBegin || t.excludeBegin || (x = n)),
|
|
v(t),
|
|
t.returnBegin ? 0 : n.length
|
|
);
|
|
var r = s(R, n);
|
|
if (r) {
|
|
var a = R;
|
|
a.skip
|
|
? (x += n)
|
|
: (a.returnEnd || a.excludeEnd || (x += n),
|
|
E(),
|
|
a.excludeEnd && (x = n));
|
|
do {
|
|
R.className && (M += w),
|
|
R.skip || (O += R.relevance),
|
|
(R = R.parent);
|
|
} while (R !== r.parent);
|
|
return r.starts && v(r.starts), a.returnEnd ? 0 : n.length;
|
|
}
|
|
if (l(n, R))
|
|
throw new Error(
|
|
'Illegal lexeme "' +
|
|
n +
|
|
'" for mode "' +
|
|
(R.className || "<unnamed>") +
|
|
'"'
|
|
);
|
|
return (x += n), n.length || 1;
|
|
}
|
|
var h = p(e);
|
|
if (!h) throw new Error('Unknown language: "' + e + '"');
|
|
u(h);
|
|
var _,
|
|
R = i || h,
|
|
N = {},
|
|
M = "";
|
|
for (_ = R; _ !== h; _ = _.parent)
|
|
_.className && (M = d(_.className, "", !0) + M);
|
|
var x = "",
|
|
O = 0;
|
|
try {
|
|
for (
|
|
var S, C, L = 0;
|
|
(R.terminators.lastIndex = L), (S = R.terminators.exec(t));
|
|
|
|
)
|
|
(C = m(t.substring(L, S.index), S[0])), (L = S.index + C);
|
|
for (m(t.substr(L)), _ = R; _.parent; _ = _.parent)
|
|
_.className && (M += w);
|
|
return { relevance: O, value: M, language: e, top: R };
|
|
} catch (e) {
|
|
if (e.message && -1 !== e.message.indexOf("Illegal"))
|
|
return { relevance: 0, value: n(t) };
|
|
throw e;
|
|
}
|
|
}
|
|
function g(e, t) {
|
|
t = t || y.languages || m(b);
|
|
var r = { relevance: 0, value: n(e) },
|
|
a = r;
|
|
return (
|
|
t.filter(p).forEach(function (n) {
|
|
var t = c(n, e, !1);
|
|
(t.language = n),
|
|
t.relevance > a.relevance && (a = t),
|
|
t.relevance > r.relevance && ((a = r), (r = t));
|
|
}),
|
|
a.language && (r.second_best = a),
|
|
r
|
|
);
|
|
}
|
|
function f(e) {
|
|
return y.tabReplace || y.useBR
|
|
? e.replace(N, function (e, n) {
|
|
return y.useBR && "\n" === e
|
|
? "<br>"
|
|
: y.tabReplace
|
|
? n.replace(/\t/g, y.tabReplace)
|
|
: "";
|
|
})
|
|
: e;
|
|
}
|
|
function d(e) {
|
|
var n,
|
|
t,
|
|
r,
|
|
i,
|
|
l,
|
|
u = (function (e) {
|
|
var n,
|
|
t,
|
|
r,
|
|
i,
|
|
o = e.className + " ";
|
|
if (
|
|
((o += e.parentNode ? e.parentNode.className : ""), (t = R.exec(o)))
|
|
)
|
|
return p(t[1]) ? t[1] : "no-highlight";
|
|
for (n = 0, r = (o = o.split(/\s+/)).length; n < r; n++)
|
|
if (a((i = o[n])) || p(i)) return i;
|
|
})(e);
|
|
a(u) ||
|
|
(y.useBR
|
|
? ((n = document.createElementNS(
|
|
"http://www.w3.org/1999/xhtml",
|
|
"div"
|
|
)).innerHTML = e.innerHTML
|
|
.replace(/\n/g, "")
|
|
.replace(/<br[ \/]*>/g, "\n"))
|
|
: (n = e),
|
|
(l = n.textContent),
|
|
(r = u ? c(u, l, !0) : g(l)),
|
|
(t = o(n)).length &&
|
|
(((i = document.createElementNS(
|
|
"http://www.w3.org/1999/xhtml",
|
|
"div"
|
|
)).innerHTML = r.value),
|
|
(r.value = s(t, o(i), l))),
|
|
(r.value = f(r.value)),
|
|
(e.innerHTML = r.value),
|
|
(e.className = (function (e, n, t) {
|
|
var r = n ? h[n] : t,
|
|
a = [e.trim()];
|
|
return (
|
|
e.match(/\bhljs\b/) || a.push("hljs"),
|
|
-1 === e.indexOf(r) && a.push(r),
|
|
a.join(" ").trim()
|
|
);
|
|
})(e.className, u, r.language)),
|
|
(e.result = { language: r.language, re: r.relevance }),
|
|
r.second_best &&
|
|
(e.second_best = {
|
|
language: r.second_best.language,
|
|
re: r.second_best.relevance,
|
|
}));
|
|
}
|
|
function E() {
|
|
if (!E.called) {
|
|
E.called = !0;
|
|
var e = document.querySelectorAll("pre code");
|
|
v.forEach.call(e, d);
|
|
}
|
|
}
|
|
function p(e) {
|
|
return (e = (e || "").toLowerCase()), b[e] || b[h[e]];
|
|
}
|
|
var v = [],
|
|
m = Object.keys,
|
|
b = {},
|
|
h = {},
|
|
_ = /^(no-?highlight|plain|text)$/i,
|
|
R = /\blang(?:uage)?-([\w-]+)\b/i,
|
|
N = /((^(<[^>]+>|\t|)+|(?:\n)))/gm,
|
|
w = "</span>",
|
|
y = {
|
|
classPrefix: "hljs-",
|
|
tabReplace: null,
|
|
useBR: !1,
|
|
languages: void 0,
|
|
};
|
|
return (
|
|
(e.highlight = c),
|
|
(e.highlightAuto = g),
|
|
(e.fixMarkup = f),
|
|
(e.highlightBlock = d),
|
|
(e.configure = function (e) {
|
|
y = i(y, e);
|
|
}),
|
|
(e.initHighlighting = E),
|
|
(e.initHighlightingOnLoad = function () {
|
|
addEventListener("DOMContentLoaded", E, !1),
|
|
addEventListener("load", E, !1);
|
|
}),
|
|
(e.registerLanguage = function (n, t) {
|
|
var r = (b[n] = t(e));
|
|
r.aliases &&
|
|
r.aliases.forEach(function (e) {
|
|
h[e] = n;
|
|
});
|
|
}),
|
|
(e.listLanguages = function () {
|
|
return m(b);
|
|
}),
|
|
(e.getLanguage = p),
|
|
(e.inherit = i),
|
|
(e.IDENT_RE = "[a-zA-Z]\\w*"),
|
|
(e.UNDERSCORE_IDENT_RE = "[a-zA-Z_]\\w*"),
|
|
(e.NUMBER_RE = "\\b\\d+(\\.\\d+)?"),
|
|
(e.C_NUMBER_RE =
|
|
"(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)"),
|
|
(e.BINARY_NUMBER_RE = "\\b(0b[01]+)"),
|
|
(e.RE_STARTERS_RE =
|
|
"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~"),
|
|
(e.BACKSLASH_ESCAPE = { begin: "\\\\[\\s\\S]", relevance: 0 }),
|
|
(e.APOS_STRING_MODE = {
|
|
className: "string",
|
|
begin: "'",
|
|
end: "'",
|
|
illegal: "\\n",
|
|
contains: [e.BACKSLASH_ESCAPE],
|
|
}),
|
|
(e.QUOTE_STRING_MODE = {
|
|
className: "string",
|
|
begin: '"',
|
|
end: '"',
|
|
illegal: "\\n",
|
|
contains: [e.BACKSLASH_ESCAPE],
|
|
}),
|
|
(e.PHRASAL_WORDS_MODE = {
|
|
begin:
|
|
/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/,
|
|
}),
|
|
(e.COMMENT = function (n, t, r) {
|
|
var a = e.inherit(
|
|
{ className: "comment", begin: n, end: t, contains: [] },
|
|
r || {}
|
|
);
|
|
return (
|
|
a.contains.push(e.PHRASAL_WORDS_MODE),
|
|
a.contains.push({
|
|
className: "doctag",
|
|
begin: "(?:TODO|FIXME|NOTE|BUG|XXX):",
|
|
relevance: 0,
|
|
}),
|
|
a
|
|
);
|
|
}),
|
|
(e.C_LINE_COMMENT_MODE = e.COMMENT("//", "$")),
|
|
(e.C_BLOCK_COMMENT_MODE = e.COMMENT("/\\*", "\\*/")),
|
|
(e.HASH_COMMENT_MODE = e.COMMENT("#", "$")),
|
|
(e.NUMBER_MODE = {
|
|
className: "number",
|
|
begin: e.NUMBER_RE,
|
|
relevance: 0,
|
|
}),
|
|
(e.C_NUMBER_MODE = {
|
|
className: "number",
|
|
begin: e.C_NUMBER_RE,
|
|
relevance: 0,
|
|
}),
|
|
(e.BINARY_NUMBER_MODE = {
|
|
className: "number",
|
|
begin: e.BINARY_NUMBER_RE,
|
|
relevance: 0,
|
|
}),
|
|
(e.CSS_NUMBER_MODE = {
|
|
className: "number",
|
|
begin:
|
|
e.NUMBER_RE +
|
|
"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",
|
|
relevance: 0,
|
|
}),
|
|
(e.REGEXP_MODE = {
|
|
className: "regexp",
|
|
begin: /\//,
|
|
end: /\/[gimuy]*/,
|
|
illegal: /\n/,
|
|
contains: [
|
|
e.BACKSLASH_ESCAPE,
|
|
{
|
|
begin: /\[/,
|
|
end: /\]/,
|
|
relevance: 0,
|
|
contains: [e.BACKSLASH_ESCAPE],
|
|
},
|
|
],
|
|
}),
|
|
(e.TITLE_MODE = { className: "title", begin: e.IDENT_RE, relevance: 0 }),
|
|
(e.UNDERSCORE_TITLE_MODE = {
|
|
className: "title",
|
|
begin: e.UNDERSCORE_IDENT_RE,
|
|
relevance: 0,
|
|
}),
|
|
(e.METHOD_GUARD = {
|
|
begin: "\\.\\s*" + e.UNDERSCORE_IDENT_RE,
|
|
relevance: 0,
|
|
}),
|
|
e
|
|
);
|
|
});
|