All Downloads are FREE. Search and download functionalities are using the official Maven repository.

frontend.src.prism.js Maven / Gradle / Ivy

There is a newer version: 3.0.0-alpha-29
Show newest version
/* eslint-disable */
/* PrismJS 1.16.0
https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+markdown */
var _self = "undefined" != typeof window ? window : "undefined" != typeof WorkerGlobalScope && self instanceof WorkerGlobalScope ? self : {},
    Prism = function (g) {
        var c = /\blang(?:uage)?-([\w-]+)\b/i,
            a = 0,
            C = {
                manual: g.Prism && g.Prism.manual,
                disableWorkerMessageHandler: g.Prism && g.Prism.disableWorkerMessageHandler,
                util: {
                    encode: function (e) {
                        return e instanceof M ? new M(e.type, C.util.encode(e.content), e.alias) : Array.isArray(e) ? e.map(C.util.encode) : e.replace(/&/g, "&").replace(/ e.length) return;
                                    if (!(k instanceof M)) {
                                        if (f && y != a.length - 1) {
                                            if (c.lastIndex = v, !(x = c.exec(e))) break;
                                            for (var b = x.index + (h ? x[1].length : 0), w = x.index + x[0].length, A = y, P = v, O = a.length; A < O && (P < w || !a[A].type && !a[A - 1].greedy); ++A) (P += a[A].length) <= b && (++y, v = P);
                                            if (a[y] instanceof M) continue;
                                            N = A - y, k = e.slice(v, P), x.index -= v
                                        } else {
                                            c.lastIndex = 0;
                                            var x = c.exec(k),
                                                N = 1
                                        }
                                        if (x) {
                                            h && (d = x[1] ? x[1].length : 0);
                                            w = (b = x.index + d) + (x = x[0].slice(d)).length;
                                            var j = k.slice(0, b),
                                                S = k.slice(w),
                                                E = [y, N];
                                            j && (++y, v += j.length, E.push(j));
                                            var _ = new M(o, u ? C.tokenize(x, u) : x, m, x, f);
                                            if (E.push(_), S && E.push(S), Array.prototype.splice.apply(a, E), 1 != N && C.matchGrammar(e, a, t, y, v, !0, o), i) break
                                        } else if (i) break
                                    }
                                }
                            }
                        }
                },
                tokenize: function (e, a) {
                    var t = [e],
                        n = a.rest;
                    if (n) {
                        for (var r in n) a[r] = n[r];
                        delete a.rest
                    }
                    return C.matchGrammar(e, t, a, 0, 0, !1), t
                },
                hooks: {
                    all: {},
                    add: function (e, a) {
                        var t = C.hooks.all;
                        t[e] = t[e] || [], t[e].push(a)
                    },
                    run: function (e, a) {
                        var t = C.hooks.all[e];
                        if (t && t.length)
                            for (var n, r = 0; n = t[r++];) n(a)
                    }
                },
                Token: M
            };

        function M(e, a, t, n, r) {
            this.type = e, this.content = a, this.alias = t, this.length = 0 | (n || "").length, this.greedy = !!r
        }

        if (g.Prism = C, M.stringify = function (e, a) {
            if ("string" == typeof e) return e;
            if (Array.isArray(e)) return e.map(function (e) {
                return M.stringify(e, a)
            }).join("");
            var t = {
                type: e.type,
                content: M.stringify(e.content, a),
                tag: "span",
                classes: ["token", e.type],
                attributes: {},
                language: a
            };
            if (e.alias) {
                var n = Array.isArray(e.alias) ? e.alias : [e.alias];
                Array.prototype.push.apply(t.classes, n)
            }
            C.hooks.run("wrap", t);
            var r = Object.keys(t.attributes).map(function (e) {
                return e + '="' + (t.attributes[e] || "").replace(/"/g, """) + '"'
            }).join(" ");
            return "<" + t.tag + ' class="' + t.classes.join(" ") + '"' + (r ? " " + r : "") + ">" + t.content + ""
        }, !g.document) return g.addEventListener && (C.disableWorkerMessageHandler || g.addEventListener("message", function (e) {
            var a = JSON.parse(e.data),
                t = a.language,
                n = a.code,
                r = a.immediateClose;
            g.postMessage(C.highlight(n, C.languages[t], t)), r && g.close()
        }, !1)), C;
        var e = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop();
        return e && (C.filename = e.src, C.manual || e.hasAttribute("data-manual") || ("loading" !== document.readyState ? window.requestAnimationFrame ? window.requestAnimationFrame(C.highlightAll) : window.setTimeout(C.highlightAll, 16) : document.addEventListener("DOMContentLoaded", C.highlightAll))), C
    }(_self);
"undefined" != typeof module && module.exports && (module.exports = Prism), "undefined" != typeof global && (global.Prism = Prism);
Prism.languages.markup = {
    comment: //,
    prolog: /<\?[\s\S]+?\?>/,
    doctype: //i,
    cdata: //i,
    tag: {
        pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/i,
        greedy: !0,
        inside: {
            tag: {
                pattern: /^<\/?[^\s>\/]+/i,
                inside: {
                    punctuation: /^<\/?/,
                    namespace: /^[^\s>\/:]+:/
                }
            },
            "attr-value": {
                pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/i,
                inside: {
                    punctuation: [/^=/, {
                        pattern: /^(\s*)["']|["']$/,
                        lookbehind: !0
                    }]
                }
            },
            punctuation: /\/?>/,
            "attr-name": {
                pattern: /[^\s>\/]+/,
                inside: {
                    namespace: /^[^\s>\/:]+:/
                }
            }
        }
    },
    entity: /&#?[\da-z]{1,8};/i
}, Prism.languages.markup.tag.inside["attr-value"].inside.entity = Prism.languages.markup.entity, Prism.hooks.add("wrap", function (a) {
    "entity" === a.type && (a.attributes.title = a.content.replace(/&/, "&"))
}), Object.defineProperty(Prism.languages.markup.tag, "addInlined", {
    value: function (a, e) {
        var s = {};
        s["language-" + e] = {
            pattern: /(^$)/i,
            lookbehind: !0,
            inside: Prism.languages[e]
        }, s.cdata = /^$/i;
        var n = {
            "included-cdata": {
                pattern: //i,
                inside: s
            }
        };
        n["language-" + e] = {
            pattern: /[\s\S]+/,
            inside: Prism.languages[e]
        };
        var i = {};
        i[a] = {
            pattern: RegExp("(<__[\\s\\S]*?>)(?:\\s*|[\\s\\S])*?(?=<\\/__>)".replace(/__/g, a), "i"),
            lookbehind: !0,
            greedy: !0,
            inside: n
        }, Prism.languages.insertBefore("markup", "cdata", i)
    }
}), Prism.languages.xml = Prism.languages.extend("markup", {}), Prism.languages.html = Prism.languages.markup, Prism.languages.mathml = Prism.languages.markup, Prism.languages.svg = Prism.languages.markup;
!function (s) {
    var e = /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;
    s.languages.css = {
        comment: /\/\*[\s\S]*?\*\//,
        atrule: {
            pattern: /@[\w-]+?[\s\S]*?(?:;|(?=\s*\{))/i,
            inside: {
                rule: /@[\w-]+/
            }
        },
        url: RegExp("url\\((?:" + e.source + "|.*?)\\)", "i"),
        selector: RegExp("[^{}\\s](?:[^{};\"']|" + e.source + ")*?(?=\\s*\\{)"),
        string: {
            pattern: e,
            greedy: !0
        },
        property: /[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,
        important: /!important\b/i,
        function: /[-a-z0-9]+(?=\()/i,
        punctuation: /[(){};:,]/
    }, s.languages.css.atrule.inside.rest = s.languages.css;
    var a = s.languages.markup;
    a && (a.tag.addInlined("style", "css"), s.languages.insertBefore("inside", "attr-value", {
        "style-attr": {
            pattern: /\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,
            inside: {
                "attr-name": {
                    pattern: /^\s*style/i,
                    inside: a.tag.inside
                },
                punctuation: /^\s*=\s*['"]|['"]\s*$/,
                "attr-value": {
                    pattern: /.+/i,
                    inside: s.languages.css
                }
            },
            alias: "language-css"
        }
    }, a.tag))
}(Prism);
Prism.languages.clike = {
    comment: [{
        pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
        lookbehind: !0
    }, {
        pattern: /(^|[^\\:])\/\/.*/,
        lookbehind: !0,
        greedy: !0
    }],
    string: {
        pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
        greedy: !0
    },
    "class-name": {
        pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,
        lookbehind: !0,
        inside: {
            punctuation: /[.\\]/
        }
    },
    keyword: /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
    boolean: /\b(?:true|false)\b/,
    function: /\w+(?=\()/,
    number: /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,
    operator: /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,
    punctuation: /[{}[\];(),.:]/
};

Prism.languages.markdown = Prism.languages.extend("markup", {}), Prism.languages.insertBefore("markdown", "prolog", {
    blockquote: {
        pattern: /^>(?:[\t ]*>)*/m,
        alias: "punctuation"
    },
    code: [{
        pattern: /^(?: {4}|\t).+/m,
        alias: "keyword"
    }, {
        pattern: /``.+?``|`[^`\n]+`/,
        alias: "keyword"
    }, {
        pattern: /^```[\s\S]*?^```$/m,
        greedy: !0,
        inside: {
            "code-block": {
                pattern: /^(```.*(?:\r?\n|\r))[\s\S]+?(?=(?:\r?\n|\r)^```$)/m,
                lookbehind: !0
            },
            "code-language": {
                pattern: /^(```).+/,
                lookbehind: !0
            },
            punctuation: /```/
        }
    }],
    title: [{
        pattern: /\S.*(?:\r?\n|\r)(?:==+|--+)/,
        alias: "important",
        inside: {
            punctuation: /==+$|--+$/
        }
    }, {
        pattern: /(^\s*)#+.+/m,
        lookbehind: !0,
        alias: "important",
        inside: {
            punctuation: /^#+|#+$/
        }
    }],
    hr: {
        pattern: /(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,
        lookbehind: !0,
        alias: "punctuation"
    },
    list: {
        pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,
        lookbehind: !0,
        alias: "punctuation"
    },
    "url-reference": {
        pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,
        inside: {
            variable: {
                pattern: /^(!?\[)[^\]]+/,
                lookbehind: !0
            },
            string: /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,
            punctuation: /^[\[\]!:]|[<>]/
        },
        alias: "url"
    },
    bold: {
        pattern: /(^|[^\\])(\*\*|__)(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/,
        lookbehind: !0,
        greedy: !0,
        inside: {
            punctuation: /^\*\*|^__|\*\*$|__$/
        }
    },
    italic: {
        pattern: /(^|[^\\])([*_])(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/,
        lookbehind: !0,
        greedy: !0,
        inside: {
            punctuation: /^[*_]|[*_]$/
        }
    },
    strike: {
        pattern: /(^|[^\\])(~~?)(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/,
        lookbehind: !0,
        greedy: !0,
        inside: {
            punctuation: /^~~?|~~?$/
        }
    },
    url: {
        pattern: /!?\[[^\]]+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)| ?\[[^\]\n]*\])/,
        inside: {
            variable: {
                pattern: /(!?\[)[^\]]+(?=\]$)/,
                lookbehind: !0
            },
            string: {
                pattern: /"(?:\\.|[^"\\])*"(?=\)$)/
            }
        }
    }
}), ["bold", "italic", "strike"].forEach(function (a) {
    ["url", "bold", "italic", "strike"].forEach(function (n) {
        a !== n && (Prism.languages.markdown[a].inside[n] = Prism.languages.markdown[n])
    })
}), Prism.hooks.add("after-tokenize", function (n) {
    "markdown" !== n.language && "md" !== n.language || !function n(a) {
        if (a && "string" != typeof a)
            for (var t = 0, e = a.length; t < e; t++) {
                var r = a[t];
                if ("code" === r.type) {
                    var i = r.content[1],
                        o = r.content[3];
                    if (i && o && "code-language" === i.type && "code-block" === o.type && "string" == typeof i.content) {
                        var s = "language-" + i.content.trim().split(/\s+/)[0].toLowerCase();
                        o.alias ? "string" == typeof o.alias ? o.alias = [o.alias, s] : o.alias.push(s) : o.alias = [s]
                    }
                } else n(r.content)
            }
    }(n.tokens)
}), Prism.hooks.add("wrap", function (n) {
    if ("code-block" === n.type) {
        for (var a = "", t = 0, e = n.classes.length; t < e; t++) {
            var r = n.classes[t],
                i = /language-(.+)/.exec(r);
            if (i) {
                a = i[1];
                break
            }
        }
        var o = Prism.languages[a];
        if (o) {
            var s = n.content.replace(/</g, "<").replace(/&/g, "&");
            n.content = Prism.highlight(s, o, a)
        }
    }
}),
    Prism.languages.md = Prism.languages.markdown;



export default Prism;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy