Branch :
(() => {
var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
// node_modules/jquery/dist/jquery.js
var require_jquery = __commonJS({
"node_modules/jquery/dist/jquery.js"(exports, module) {
(function(global3, factory) {
"use strict";
if (typeof module === "object" && typeof module.exports === "object") {
module.exports = global3.document ? factory(global3, true) : function(w) {
if (!w.document) {
throw new Error("jQuery requires a window with a document");
}
return factory(w);
};
} else {
factory(global3);
}
})(typeof window !== "undefined" ? window : exports, function(window2, noGlobal) {
"use strict";
var arr = [];
var getProto = Object.getPrototypeOf;
var slice = arr.slice;
var flat = arr.flat ? function(array) {
return arr.flat.call(array);
} : function(array) {
return arr.concat.apply([], array);
};
var push = arr.push;
var indexOf = arr.indexOf;
var class2type = {};
var toString = class2type.toString;
var hasOwn = class2type.hasOwnProperty;
var fnToString = hasOwn.toString;
var ObjectFunctionString = fnToString.call(Object);
var support = {};
var isFunction = function isFunction2(obj) {
return typeof obj === "function" && typeof obj.nodeType !== "number" && typeof obj.item !== "function";
};
var isWindow = function isWindow2(obj) {
return obj != null && obj === obj.window;
};
var document2 = window2.document;
var preservedScriptAttributes = {
type: true,
src: true,
nonce: true,
noModule: true
};
function DOMEval(code, node, doc2) {
doc2 = doc2 || document2;
var i, val, script = doc2.createElement("script");
script.text = code;
if (node) {
for (i in preservedScriptAttributes) {
val = node[i] || node.getAttribute && node.getAttribute(i);
if (val) {
script.setAttribute(i, val);
}
}
}
doc2.head.appendChild(script).parentNode.removeChild(script);
}
function toType2(obj) {
if (obj == null) {
return obj + "";
}
return typeof obj === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj;
}
var version = "3.7.1", rhtmlSuffix = /HTML$/i, jQuery = function(selector, context) {
return new jQuery.fn.init(selector, context);
};
jQuery.fn = jQuery.prototype = {
// The current version of jQuery being used
jquery: version,
constructor: jQuery,
// The default length of a jQuery object is 0
length: 0,
toArray: function() {
return slice.call(this);
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function(num) {
if (num == null) {
return slice.call(this);
}
return num < 0 ? this[num + this.length] : this[num];
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function(elems) {
var ret = jQuery.merge(this.constructor(), elems);
ret.prevObject = this;
return ret;
},
// Execute a callback for every element in the matched set.
each: function(callback) {
return jQuery.each(this, callback);
},
map: function(callback) {
return this.pushStack(jQuery.map(this, function(elem, i) {
return callback.call(elem, i, elem);
}));
},
slice: function() {
return this.pushStack(slice.apply(this, arguments));
},
first: function() {
return this.eq(0);
},
last: function() {
return this.eq(-1);
},
even: function() {
return this.pushStack(jQuery.grep(this, function(_elem, i) {
return (i + 1) % 2;
}));
},
odd: function() {
return this.pushStack(jQuery.grep(this, function(_elem, i) {
return i % 2;
}));
},
eq: function(i) {
var len = this.length, j = +i + (i < 0 ? len : 0);
return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
},
end: function() {
return this.prevObject || this.constructor();
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push,
sort: arr.sort,
splice: arr.splice
};
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone2, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false;
if (typeof target === "boolean") {
deep = target;
target = arguments[i] || {};
i++;
}
if (typeof target !== "object" && !isFunction(target)) {
target = {};
}
if (i === length) {
target = this;
i--;
}
for (; i < length; i++) {
if ((options = arguments[i]) != null) {
for (name in options) {
copy = options[name];
if (name === "__proto__" || target === copy) {
continue;
}
if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
src = target[name];
if (copyIsArray && !Array.isArray(src)) {
clone2 = [];
} else if (!copyIsArray && !jQuery.isPlainObject(src)) {
clone2 = {};
} else {
clone2 = src;
}
copyIsArray = false;
target[name] = jQuery.extend(deep, clone2, copy);
} else if (copy !== void 0) {
target[name] = copy;
}
}
}
}
return target;
};
jQuery.extend({
// Unique for each copy of jQuery on the page
expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
// Assume jQuery is ready without the ready module
isReady: true,
error: function(msg) {
throw new Error(msg);
},
noop: function() {
},
isPlainObject: function(obj) {
var proto, Ctor;
if (!obj || toString.call(obj) !== "[object Object]") {
return false;
}
proto = getProto(obj);
if (!proto) {
return true;
}
Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
},
isEmptyObject: function(obj) {
var name;
for (name in obj) {
return false;
}
return true;
},
// Evaluates a script in a provided context; falls back to the global one
// if not specified.
globalEval: function(code, options, doc2) {
DOMEval(code, { nonce: options && options.nonce }, doc2);
},
each: function(obj, callback) {
var length, i = 0;
if (isArrayLike(obj)) {
length = obj.length;
for (; i < length; i++) {
if (callback.call(obj[i], i, obj[i]) === false) {
break;
}
}
} else {
for (i in obj) {
if (callback.call(obj[i], i, obj[i]) === false) {
break;
}
}
}
return obj;
},
// Retrieve the text value of an array of DOM nodes
text: function(elem) {
var node, ret = "", i = 0, nodeType = elem.nodeType;
if (!nodeType) {
while (node = elem[i++]) {
ret += jQuery.text(node);
}
}
if (nodeType === 1 || nodeType === 11) {
return elem.textContent;
}
if (nodeType === 9) {
return elem.documentElement.textContent;
}
if (nodeType === 3 || nodeType === 4) {
return elem.nodeValue;
}
return ret;
},
// results is for internal usage only
makeArray: function(arr2, results) {
var ret = results || [];
if (arr2 != null) {
if (isArrayLike(Object(arr2))) {
jQuery.merge(
ret,
typeof arr2 === "string" ? [arr2] : arr2
);
} else {
push.call(ret, arr2);
}
}
return ret;
},
inArray: function(elem, arr2, i) {
return arr2 == null ? -1 : indexOf.call(arr2, elem, i);
},
isXMLDoc: function(elem) {
var namespace = elem && elem.namespaceURI, docElem = elem && (elem.ownerDocument || elem).documentElement;
return !rhtmlSuffix.test(namespace || docElem && docElem.nodeName || "HTML");
},
// Support: Android <=4.0 only, PhantomJS 1 only
// push.apply(_, arraylike) throws on ancient WebKit
merge: function(first, second) {
var len = +second.length, j = 0, i = first.length;
for (; j < len; j++) {
first[i++] = second[j];
}
first.length = i;
return first;
},
grep: function(elems, callback, invert) {
var callbackInverse, matches = [], i = 0, length = elems.length, callbackExpect = !invert;
for (; i < length; i++) {
callbackInverse = !callback(elems[i], i);
if (callbackInverse !== callbackExpect) {
matches.push(elems[i]);
}
}
return matches;
},
// arg is for internal usage only
map: function(elems, callback, arg) {
var length, value, i = 0, ret = [];
if (isArrayLike(elems)) {
length = elems.length;
for (; i < length; i++) {
value = callback(elems[i], i, arg);
if (value != null) {
ret.push(value);
}
}
} else {
for (i in elems) {
value = callback(elems[i], i, arg);
if (value != null) {
ret.push(value);
}
}
}
return flat(ret);
},
// A global GUID counter for objects
guid: 1,
// jQuery.support is not used in Core but other projects attach their
// properties to it so it needs to exist.
support
});
if (typeof Symbol === "function") {
jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
}
jQuery.each(
"Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),
function(_i, name) {
class2type["[object " + name + "]"] = name.toLowerCase();
}
);
function isArrayLike(obj) {
var length = !!obj && "length" in obj && obj.length, type = toType2(obj);
if (isFunction(obj) || isWindow(obj)) {
return false;
}
return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
}
function nodeName(elem, name) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
}
var pop = arr.pop;
var sort = arr.sort;
var splice = arr.splice;
var whitespace = "[\\x20\\t\\r\\n\\f]";
var rtrimCSS = new RegExp(
"^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$",
"g"
);
jQuery.contains = function(a, b) {
var bup = b && b.parentNode;
return a === bup || !!(bup && bup.nodeType === 1 && // Support: IE 9 - 11+
// IE doesn't have `contains` on SVG.
(a.contains ? a.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
};
var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
function fcssescape(ch, asCodePoint) {
if (asCodePoint) {
if (ch === "\0") {
return "\uFFFD";
}
return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
}
return "\\" + ch;
}
jQuery.escapeSelector = function(sel) {
return (sel + "").replace(rcssescape, fcssescape);
};
var preferredDoc = document2, pushNative = push;
(function() {
var i, Expr, outermostContext, sortInput, hasDuplicate, push2 = pushNative, document3, documentElement2, documentIsHTML, rbuggyQSA, matches, expando = jQuery.expando, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), nonnativeSelectorCache = createCache(), sortOrder = function(a, b) {
if (a === b) {
hasDuplicate = true;
}
return 0;
}, booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + // Operator (capture 2)
"*([*^$|!~]?=)" + whitespace + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
`*(?:'((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)"|(` + identifier + "))|)" + whitespace + "*\\]", pseudos = ":(" + identifier + `)(?:\\((('((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)")|((?:\\\\.|[^\\\\()[\\]]|` + attributes + ")*)|.*)\\)|)", rwhitespace = new RegExp(whitespace + "+", "g"), rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"), rleadingCombinator = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"), rdescend = new RegExp(whitespace + "|>"), rpseudo = new RegExp(pseudos), ridentifier = new RegExp("^" + identifier + "$"), matchExpr = {
ID: new RegExp("^#(" + identifier + ")"),
CLASS: new RegExp("^\\.(" + identifier + ")"),
TAG: new RegExp("^(" + identifier + "|[*])"),
ATTR: new RegExp("^" + attributes),
PSEUDO: new RegExp("^" + pseudos),
CHILD: new RegExp(
"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)",
"i"
),
bool: new RegExp("^(?:" + booleans + ")$", "i"),
// For use in libraries implementing .is()
// We use this for POS matching in `select`
needsContext: new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
}, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rquickExpr2 = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, runescape = new RegExp("\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g"), funescape = function(escape, nonHex) {
var high = "0x" + escape.slice(1) - 65536;
if (nonHex) {
return nonHex;
}
return high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320);
}, unloadHandler = function() {
setDocument();
}, inDisabledFieldset = addCombinator(
function(elem) {
return elem.disabled === true && nodeName(elem, "fieldset");
},
{ dir: "parentNode", next: "legend" }
);
function safeActiveElement() {
try {
return document3.activeElement;
} catch (err) {
}
}
try {
push2.apply(
arr = slice.call(preferredDoc.childNodes),
preferredDoc.childNodes
);
arr[preferredDoc.childNodes.length].nodeType;
} catch (e) {
push2 = {
apply: function(target, els) {
pushNative.apply(target, slice.call(els));
},
call: function(target) {
pushNative.apply(target, slice.call(arguments, 1));
}
};
}
function find(selector, context, results, seed) {
var m, i2, elem, nid, match, groups, newSelector, newContext = context && context.ownerDocument, nodeType = context ? context.nodeType : 9;
results = results || [];
if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
return results;
}
if (!seed) {
setDocument(context);
context = context || document3;
if (documentIsHTML) {
if (nodeType !== 11 && (match = rquickExpr2.exec(selector))) {
if (m = match[1]) {
if (nodeType === 9) {
if (elem = context.getElementById(m)) {
if (elem.id === m) {
push2.call(results, elem);
return results;
}
} else {
return results;
}
} else {
if (newContext && (elem = newContext.getElementById(m)) && find.contains(context, elem) && elem.id === m) {
push2.call(results, elem);
return results;
}
}
} else if (match[2]) {
push2.apply(results, context.getElementsByTagName(selector));
return results;
} else if ((m = match[3]) && context.getElementsByClassName) {
push2.apply(results, context.getElementsByClassName(m));
return results;
}
}
if (!nonnativeSelectorCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
newSelector = selector;
newContext = context;
if (nodeType === 1 && (rdescend.test(selector) || rleadingCombinator.test(selector))) {
newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
if (newContext != context || !support.scope) {
if (nid = context.getAttribute("id")) {
nid = jQuery.escapeSelector(nid);
} else {
context.setAttribute("id", nid = expando);
}
}
groups = tokenize(selector);
i2 = groups.length;
while (i2--) {
groups[i2] = (nid ? "#" + nid : ":scope") + " " + toSelector(groups[i2]);
}
newSelector = groups.join(",");
}
try {
push2.apply(
results,
newContext.querySelectorAll(newSelector)
);
return results;
} catch (qsaError) {
nonnativeSelectorCache(selector, true);
} finally {
if (nid === expando) {
context.removeAttribute("id");
}
}
}
}
}
return select(selector.replace(rtrimCSS, "$1"), context, results, seed);
}
function createCache() {
var keys = [];
function cache(key, value) {
if (keys.push(key + " ") > Expr.cacheLength) {
delete cache[keys.shift()];
}
return cache[key + " "] = value;
}
return cache;
}
function markFunction(fn2) {
fn2[expando] = true;
return fn2;
}
function assert(fn2) {
var el = document3.createElement("fieldset");
try {
return !!fn2(el);
} catch (e) {
return false;
} finally {
if (el.parentNode) {
el.parentNode.removeChild(el);
}
el = null;
}
}
function createInputPseudo(type) {
return function(elem) {
return nodeName(elem, "input") && elem.type === type;
};
}
function createButtonPseudo(type) {
return function(elem) {
return (nodeName(elem, "input") || nodeName(elem, "button")) && elem.type === type;
};
}
function createDisabledPseudo(disabled) {
return function(elem) {
if ("form" in elem) {
if (elem.parentNode && elem.disabled === false) {
if ("label" in elem) {
if ("label" in elem.parentNode) {
return elem.parentNode.disabled === disabled;
} else {
return elem.disabled === disabled;
}
}
return elem.isDisabled === disabled || // Where there is no isDisabled, check manually
elem.isDisabled !== !disabled && inDisabledFieldset(elem) === disabled;
}
return elem.disabled === disabled;
} else if ("label" in elem) {
return elem.disabled === disabled;
}
return false;
};
}
function createPositionalPseudo(fn2) {
return markFunction(function(argument) {
argument = +argument;
return markFunction(function(seed, matches2) {
var j, matchIndexes = fn2([], seed.length, argument), i2 = matchIndexes.length;
while (i2--) {
if (seed[j = matchIndexes[i2]]) {
seed[j] = !(matches2[j] = seed[j]);
}
}
});
});
}
function testContext(context) {
return context && typeof context.getElementsByTagName !== "undefined" && context;
}
function setDocument(node) {
var subWindow, doc2 = node ? node.ownerDocument || node : preferredDoc;
if (doc2 == document3 || doc2.nodeType !== 9 || !doc2.documentElement) {
return document3;
}
document3 = doc2;
documentElement2 = document3.documentElement;
documentIsHTML = !jQuery.isXMLDoc(document3);
matches = documentElement2.matches || documentElement2.webkitMatchesSelector || documentElement2.msMatchesSelector;
if (documentElement2.msMatchesSelector && // Support: IE 11+, Edge 17 - 18+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
// two documents; shallow comparisons work.
// eslint-disable-next-line eqeqeq
preferredDoc != document3 && (subWindow = document3.defaultView) && subWindow.top !== subWindow) {
subWindow.addEventListener("unload", unloadHandler);
}
support.getById = assert(function(el) {
documentElement2.appendChild(el).id = jQuery.expando;
return !document3.getElementsByName || !document3.getElementsByName(jQuery.expando).length;
});
support.disconnectedMatch = assert(function(el) {
return matches.call(el, "*");
});
support.scope = assert(function() {
return document3.querySelectorAll(":scope");
});
support.cssHas = assert(function() {
try {
document3.querySelector(":has(*,:jqfake)");
return false;
} catch (e) {
return true;
}
});
if (support.getById) {
Expr.filter.ID = function(id) {
var attrId = id.replace(runescape, funescape);
return function(elem) {
return elem.getAttribute("id") === attrId;
};
};
Expr.find.ID = function(id, context) {
if (typeof context.getElementById !== "undefined" && documentIsHTML) {
var elem = context.getElementById(id);
return elem ? [elem] : [];
}
};
} else {
Expr.filter.ID = function(id) {
var attrId = id.replace(runescape, funescape);
return function(elem) {
var node2 = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
return node2 && node2.value === attrId;
};
};
Expr.find.ID = function(id, context) {
if (typeof context.getElementById !== "undefined" && documentIsHTML) {
var node2, i2, elems, elem = context.getElementById(id);
if (elem) {
node2 = elem.getAttributeNode("id");
if (node2 && node2.value === id) {
return [elem];
}
elems = context.getElementsByName(id);
i2 = 0;
while (elem = elems[i2++]) {
node2 = elem.getAttributeNode("id");
if (node2 && node2.value === id) {
return [elem];
}
}
}
return [];
}
};
}
Expr.find.TAG = function(tag, context) {
if (typeof context.getElementsByTagName !== "undefined") {
return context.getElementsByTagName(tag);
} else {
return context.querySelectorAll(tag);
}
};
Expr.find.CLASS = function(className, context) {
if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
return context.getElementsByClassName(className);
}
};
rbuggyQSA = [];
assert(function(el) {
var input;
documentElement2.appendChild(el).innerHTML = "<a id='" + expando + "' href='' disabled='disabled'></a><select id='" + expando + "-\r\\' disabled='disabled'><option selected=''></option></select>";
if (!el.querySelectorAll("[selected]").length) {
rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
}
if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
rbuggyQSA.push("~=");
}
if (!el.querySelectorAll("a#" + expando + "+*").length) {
rbuggyQSA.push(".#.+[+~]");
}
if (!el.querySelectorAll(":checked").length) {
rbuggyQSA.push(":checked");
}
input = document3.createElement("input");
input.setAttribute("type", "hidden");
el.appendChild(input).setAttribute("name", "D");
documentElement2.appendChild(el).disabled = true;
if (el.querySelectorAll(":disabled").length !== 2) {
rbuggyQSA.push(":enabled", ":disabled");
}
input = document3.createElement("input");
input.setAttribute("name", "");
el.appendChild(input);
if (!el.querySelectorAll("[name='']").length) {
rbuggyQSA.push("\\[" + whitespace + "*name" + whitespace + "*=" + whitespace + `*(?:''|"")`);
}
});
if (!support.cssHas) {
rbuggyQSA.push(":has");
}
rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
sortOrder = function(a, b) {
if (a === b) {
hasDuplicate = true;
return 0;
}
var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
if (compare) {
return compare;
}
compare = (a.ownerDocument || a) == (b.ownerDocument || b) ? a.compareDocumentPosition(b) : (
// Otherwise we know they are disconnected
1
);
if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {
if (a === document3 || a.ownerDocument == preferredDoc && find.contains(preferredDoc, a)) {
return -1;
}
if (b === document3 || b.ownerDocument == preferredDoc && find.contains(preferredDoc, b)) {
return 1;
}
return sortInput ? indexOf.call(sortInput, a) - indexOf.call(sortInput, b) : 0;
}
return compare & 4 ? -1 : 1;
};
return document3;
}
find.matches = function(expr, elements) {
return find(expr, null, null, elements);
};
find.matchesSelector = function(elem, expr) {
setDocument(elem);
if (documentIsHTML && !nonnativeSelectorCache[expr + " "] && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
try {
var ret = matches.call(elem, expr);
if (ret || support.disconnectedMatch || // As well, disconnected nodes are said to be in a document
// fragment in IE 9
elem.document && elem.document.nodeType !== 11) {
return ret;
}
} catch (e) {
nonnativeSelectorCache(expr, true);
}
}
return find(expr, document3, null, [elem]).length > 0;
};
find.contains = function(context, elem) {
if ((context.ownerDocument || context) != document3) {
setDocument(context);
}
return jQuery.contains(context, elem);
};
find.attr = function(elem, name) {
if ((elem.ownerDocument || elem) != document3) {
setDocument(elem);
}
var fn2 = Expr.attrHandle[name.toLowerCase()], val = fn2 && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn2(elem, name, !documentIsHTML) : void 0;
if (val !== void 0) {
return val;
}
return elem.getAttribute(name);
};
find.error = function(msg) {
throw new Error("Syntax error, unrecognized expression: " + msg);
};
jQuery.uniqueSort = function(results) {
var elem, duplicates = [], j = 0, i2 = 0;
hasDuplicate = !support.sortStable;
sortInput = !support.sortStable && slice.call(results, 0);
sort.call(results, sortOrder);
if (hasDuplicate) {
while (elem = results[i2++]) {
if (elem === results[i2]) {
j = duplicates.push(i2);
}
}
while (j--) {
splice.call(results, duplicates[j], 1);
}
}
sortInput = null;
return results;
};
jQuery.fn.uniqueSort = function() {
return this.pushStack(jQuery.uniqueSort(slice.apply(this)));
};
Expr = jQuery.expr = {
// Can be adjusted by the user
cacheLength: 50,
createPseudo: markFunction,
match: matchExpr,
attrHandle: {},
find: {},
relative: {
">": { dir: "parentNode", first: true },
" ": { dir: "parentNode" },
"+": { dir: "previousSibling", first: true },
"~": { dir: "previousSibling" }
},
preFilter: {
ATTR: function(match) {
match[1] = match[1].replace(runescape, funescape);
match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
if (match[2] === "~=") {
match[3] = " " + match[3] + " ";
}
return match.slice(0, 4);
},
CHILD: function(match) {
match[1] = match[1].toLowerCase();
if (match[1].slice(0, 3) === "nth") {
if (!match[3]) {
find.error(match[0]);
}
match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
match[5] = +(match[7] + match[8] || match[3] === "odd");
} else if (match[3]) {
find.error(match[0]);
}
return match;
},
PSEUDO: function(match) {
var excess, unquoted = !match[6] && match[2];
if (matchExpr.CHILD.test(match[0])) {
return null;
}
if (match[3]) {
match[2] = match[4] || match[5] || "";
} else if (unquoted && rpseudo.test(unquoted) && // Get excess from tokenize (recursively)
(excess = tokenize(unquoted, true)) && // advance to the next closing parenthesis
(excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
match[0] = match[0].slice(0, excess);
match[2] = unquoted.slice(0, excess);
}
return match.slice(0, 3);
}
},
filter: {
TAG: function(nodeNameSelector) {
var expectedNodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
return nodeNameSelector === "*" ? function() {
return true;
} : function(elem) {
return nodeName(elem, expectedNodeName);
};
},
CLASS: function(className) {
var pattern = classCache[className + " "];
return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function(elem) {
return pattern.test(
typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || ""
);
});
},
ATTR: function(name, operator, check) {
return function(elem) {
var result = find.attr(elem, name);
if (result == null) {
return operator === "!=";
}
if (!operator) {
return true;
}
result += "";
if (operator === "=") {
return result === check;
}
if (operator === "!=") {
return result !== check;
}
if (operator === "^=") {
return check && result.indexOf(check) === 0;
}
if (operator === "*=") {
return check && result.indexOf(check) > -1;
}
if (operator === "$=") {
return check && result.slice(-check.length) === check;
}
if (operator === "~=") {
return (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1;
}
if (operator === "|=") {
return result === check || result.slice(0, check.length + 1) === check + "-";
}
return false;
};
},
CHILD: function(type, what, _argument, first, last) {
var simple = type.slice(0, 3) !== "nth", forward = type.slice(-4) !== "last", ofType = what === "of-type";
return first === 1 && last === 0 ? (
// Shortcut for :nth-*(n)
function(elem) {
return !!elem.parentNode;
}
) : function(elem, _context, xml) {
var cache, outerCache, node, nodeIndex, start2, dir2 = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType, diff = false;
if (parent) {
if (simple) {
while (dir2) {
node = elem;
while (node = node[dir2]) {
if (ofType ? nodeName(node, name) : node.nodeType === 1) {
return false;
}
}
start2 = dir2 = type === "only" && !start2 && "nextSibling";
}
return true;
}
start2 = [forward ? parent.firstChild : parent.lastChild];
if (forward && useCache) {
outerCache = parent[expando] || (parent[expando] = {});
cache = outerCache[type] || [];
nodeIndex = cache[0] === dirruns && cache[1];
diff = nodeIndex && cache[2];
node = nodeIndex && parent.childNodes[nodeIndex];
while (node = ++nodeIndex && node && node[dir2] || // Fallback to seeking `elem` from the start
(diff = nodeIndex = 0) || start2.pop()) {
if (node.nodeType === 1 && ++diff && node === elem) {
outerCache[type] = [dirruns, nodeIndex, diff];
break;
}
}
} else {
if (useCache) {
outerCache = elem[expando] || (elem[expando] = {});
cache = outerCache[type] || [];
nodeIndex = cache[0] === dirruns && cache[1];
diff = nodeIndex;
}
if (diff === false) {
while (node = ++nodeIndex && node && node[dir2] || (diff = nodeIndex = 0) || start2.pop()) {
if ((ofType ? nodeName(node, name) : node.nodeType === 1) && ++diff) {
if (useCache) {
outerCache = node[expando] || (node[expando] = {});
outerCache[type] = [dirruns, diff];
}
if (node === elem) {
break;
}
}
}
}
}
diff -= last;
return diff === first || diff % first === 0 && diff / first >= 0;
}
};
},
PSEUDO: function(pseudo, argument) {
var args, fn2 = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || find.error("unsupported pseudo: " + pseudo);
if (fn2[expando]) {
return fn2(argument);
}
if (fn2.length > 1) {
args = [pseudo, pseudo, "", argument];
return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function(seed, matches2) {
var idx, matched = fn2(seed, argument), i2 = matched.length;
while (i2--) {
idx = indexOf.call(seed, matched[i2]);
seed[idx] = !(matches2[idx] = matched[i2]);
}
}) : function(elem) {
return fn2(elem, 0, args);
};
}
return fn2;
}
},
pseudos: {
// Potentially complex pseudos
not: markFunction(function(selector) {
var input = [], results = [], matcher = compile(selector.replace(rtrimCSS, "$1"));
return matcher[expando] ? markFunction(function(seed, matches2, _context, xml) {
var elem, unmatched = matcher(seed, null, xml, []), i2 = seed.length;
while (i2--) {
if (elem = unmatched[i2]) {
seed[i2] = !(matches2[i2] = elem);
}
}
}) : function(elem, _context, xml) {
input[0] = elem;
matcher(input, null, xml, results);
input[0] = null;
return !results.pop();
};
}),
has: markFunction(function(selector) {
return function(elem) {
return find(selector, elem).length > 0;
};
}),
contains: markFunction(function(text) {
text = text.replace(runescape, funescape);
return function(elem) {
return (elem.textContent || jQuery.text(elem)).indexOf(text) > -1;
};
}),
// "Whether an element is represented by a :lang() selector
// is based solely on the element's language value
// being equal to the identifier C,
// or beginning with the identifier C immediately followed by "-".
// The matching of C against the element's language value is performed case-insensitively.
// The identifier C does not have to be a valid language name."
// https://www.w3.org/TR/selectors/#lang-pseudo
lang: markFunction(function(lang) {
if (!ridentifier.test(lang || "")) {
find.error("unsupported lang: " + lang);
}
lang = lang.replace(runescape, funescape).toLowerCase();
return function(elem) {
var elemLang;
do {
if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) {
elemLang = elemLang.toLowerCase();
return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
}
} while ((elem = elem.parentNode) && elem.nodeType === 1);
return false;
};
}),
// Miscellaneous
target: function(elem) {
var hash3 = window2.location && window2.location.hash;
return hash3 && hash3.slice(1) === elem.id;
},
root: function(elem) {
return elem === documentElement2;
},
focus: function(elem) {
return elem === safeActiveElement() && document3.hasFocus() && !!(elem.type || elem.href || ~elem.tabIndex);
},
// Boolean properties
enabled: createDisabledPseudo(false),
disabled: createDisabledPseudo(true),
checked: function(elem) {
return nodeName(elem, "input") && !!elem.checked || nodeName(elem, "option") && !!elem.selected;
},
selected: function(elem) {
if (elem.parentNode) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
// Contents
empty: function(elem) {
for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
if (elem.nodeType < 6) {
return false;
}
}
return true;
},
parent: function(elem) {
return !Expr.pseudos.empty(elem);
},
// Element/input types
header: function(elem) {
return rheader.test(elem.nodeName);
},
input: function(elem) {
return rinputs.test(elem.nodeName);
},
button: function(elem) {
return nodeName(elem, "input") && elem.type === "button" || nodeName(elem, "button");
},
text: function(elem) {
var attr;
return nodeName(elem, "input") && elem.type === "text" && // Support: IE <10 only
// New HTML5 attribute values (e.g., "search") appear
// with elem.type === "text"
((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
},
// Position-in-collection
first: createPositionalPseudo(function() {
return [0];
}),
last: createPositionalPseudo(function(_matchIndexes, length) {
return [length - 1];
}),
eq: createPositionalPseudo(function(_matchIndexes, length, argument) {
return [argument < 0 ? argument + length : argument];
}),
even: createPositionalPseudo(function(matchIndexes, length) {
var i2 = 0;
for (; i2 < length; i2 += 2) {
matchIndexes.push(i2);
}
return matchIndexes;
}),
odd: createPositionalPseudo(function(matchIndexes, length) {
var i2 = 1;
for (; i2 < length; i2 += 2) {
matchIndexes.push(i2);
}
return matchIndexes;
}),
lt: createPositionalPseudo(function(matchIndexes, length, argument) {
var i2;
if (argument < 0) {
i2 = argument + length;
} else if (argument > length) {
i2 = length;
} else {
i2 = argument;
}
for (; --i2 >= 0; ) {
matchIndexes.push(i2);
}
return matchIndexes;
}),
gt: createPositionalPseudo(function(matchIndexes, length, argument) {
var i2 = argument < 0 ? argument + length : argument;
for (; ++i2 < length; ) {
matchIndexes.push(i2);
}
return matchIndexes;
})
}
};
Expr.pseudos.nth = Expr.pseudos.eq;
for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) {
Expr.pseudos[i] = createInputPseudo(i);
}
for (i in { submit: true, reset: true }) {
Expr.pseudos[i] = createButtonPseudo(i);
}
function setFilters() {
}
setFilters.prototype = Expr.filters = Expr.pseudos;
Expr.setFilters = new setFilters();
function tokenize(selector, parseOnly) {
var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[selector + " "];
if (cached) {
return parseOnly ? 0 : cached.slice(0);
}
soFar = selector;
groups = [];
preFilters = Expr.preFilter;
while (soFar) {
if (!matched || (match = rcomma.exec(soFar))) {
if (match) {
soFar = soFar.slice(match[0].length) || soFar;
}
groups.push(tokens = []);
}
matched = false;
if (match = rleadingCombinator.exec(soFar)) {
matched = match.shift();
tokens.push({
value: matched,
// Cast descendant combinators to space
type: match[0].replace(rtrimCSS, " ")
});
soFar = soFar.slice(matched.length);
}
for (type in Expr.filter) {
if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
matched = match.shift();
tokens.push({
value: matched,
type,
matches: match
});
soFar = soFar.slice(matched.length);
}
}
if (!matched) {
break;
}
}
if (parseOnly) {
return soFar.length;
}
return soFar ? find.error(selector) : (
// Cache the tokens
tokenCache(selector, groups).slice(0)
);
}
function toSelector(tokens) {
var i2 = 0, len = tokens.length, selector = "";
for (; i2 < len; i2++) {
selector += tokens[i2].value;
}
return selector;
}
function addCombinator(matcher, combinator, base) {
var dir2 = combinator.dir, skip = combinator.next, key = skip || dir2, checkNonElements = base && key === "parentNode", doneName = done++;
return combinator.first ? (
// Check against closest ancestor/preceding element
function(elem, context, xml) {
while (elem = elem[dir2]) {
if (elem.nodeType === 1 || checkNonElements) {
return matcher(elem, context, xml);
}
}
return false;
}
) : (
// Check against all ancestor/preceding elements
function(elem, context, xml) {
var oldCache, outerCache, newCache = [dirruns, doneName];
if (xml) {
while (elem = elem[dir2]) {
if (elem.nodeType === 1 || checkNonElements) {
if (matcher(elem, context, xml)) {
return true;
}
}
}
} else {
while (elem = elem[dir2]) {
if (elem.nodeType === 1 || checkNonElements) {
outerCache = elem[expando] || (elem[expando] = {});
if (skip && nodeName(elem, skip)) {
elem = elem[dir2] || elem;
} else if ((oldCache = outerCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
return newCache[2] = oldCache[2];
} else {
outerCache[key] = newCache;
if (newCache[2] = matcher(elem, context, xml)) {
return true;
}
}
}
}
}
return false;
}
);
}
function elementMatcher(matchers) {
return matchers.length > 1 ? function(elem, context, xml) {
var i2 = matchers.length;
while (i2--) {
if (!matchers[i2](elem, context, xml)) {
return false;
}
}
return true;
} : matchers[0];
}
function multipleContexts(selector, contexts, results) {
var i2 = 0, len = contexts.length;
for (; i2 < len; i2++) {
find(selector, contexts[i2], results);
}
return results;
}
function condense(unmatched, map, filter, context, xml) {
var elem, newUnmatched = [], i2 = 0, len = unmatched.length, mapped = map != null;
for (; i2 < len; i2++) {
if (elem = unmatched[i2]) {
if (!filter || filter(elem, context, xml)) {
newUnmatched.push(elem);
if (mapped) {
map.push(i2);
}
}
}
}
return newUnmatched;
}
function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
if (postFilter && !postFilter[expando]) {
postFilter = setMatcher(postFilter);
}
if (postFinder && !postFinder[expando]) {
postFinder = setMatcher(postFinder, postSelector);
}
return markFunction(function(seed, results, context, xml) {
var temp, i2, elem, matcherOut, preMap = [], postMap = [], preexisting = results.length, elems = seed || multipleContexts(
selector || "*",
context.nodeType ? [context] : context,
[]
), matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems;
if (matcher) {
matcherOut = postFinder || (seed ? preFilter : preexisting || postFilter) ? (
// ...intermediate processing is necessary
[]
) : (
// ...otherwise use results directly
results
);
matcher(matcherIn, matcherOut, context, xml);
} else {
matcherOut = matcherIn;
}
if (postFilter) {
temp = condense(matcherOut, postMap);
postFilter(temp, [], context, xml);
i2 = temp.length;
while (i2--) {
if (elem = temp[i2]) {
matcherOut[postMap[i2]] = !(matcherIn[postMap[i2]] = elem);
}
}
}
if (seed) {
if (postFinder || preFilter) {
if (postFinder) {
temp = [];
i2 = matcherOut.length;
while (i2--) {
if (elem = matcherOut[i2]) {
temp.push(matcherIn[i2] = elem);
}
}
postFinder(null, matcherOut = [], temp, xml);
}
i2 = matcherOut.length;
while (i2--) {
if ((elem = matcherOut[i2]) && (temp = postFinder ? indexOf.call(seed, elem) : preMap[i2]) > -1) {
seed[temp] = !(results[temp] = elem);
}
}
}
} else {
matcherOut = condense(
matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut
);
if (postFinder) {
postFinder(null, results, matcherOut, xml);
} else {
push2.apply(results, matcherOut);
}
}
});
}
function matcherFromTokens(tokens) {
var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[tokens[0].type], implicitRelative = leadingRelative || Expr.relative[" "], i2 = leadingRelative ? 1 : 0, matchContext = addCombinator(function(elem) {
return elem === checkContext;
}, implicitRelative, true), matchAnyContext = addCombinator(function(elem) {
return indexOf.call(checkContext, elem) > -1;
}, implicitRelative, true), matchers = [function(elem, context, xml) {
var ret = !leadingRelative && (xml || context != outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
checkContext = null;
return ret;
}];
for (; i2 < len; i2++) {
if (matcher = Expr.relative[tokens[i2].type]) {
matchers = [addCombinator(elementMatcher(matchers), matcher)];
} else {
matcher = Expr.filter[tokens[i2].type].apply(null, tokens[i2].matches);
if (matcher[expando]) {
j = ++i2;
for (; j < len; j++) {
if (Expr.relative[tokens[j].type]) {
break;
}
}
return setMatcher(
i2 > 1 && elementMatcher(matchers),
i2 > 1 && toSelector(
// If the preceding token was a descendant combinator, insert an implicit any-element `*`
tokens.slice(0, i2 - 1).concat({ value: tokens[i2 - 2].type === " " ? "*" : "" })
).replace(rtrimCSS, "$1"),
matcher,
i2 < j && matcherFromTokens(tokens.slice(i2, j)),
j < len && matcherFromTokens(tokens = tokens.slice(j)),
j < len && toSelector(tokens)
);
}
matchers.push(matcher);
}
}
return elementMatcher(matchers);
}
function matcherFromGroupMatchers(elementMatchers, setMatchers) {
var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function(seed, context, xml, results, outermost) {
var elem, j, matcher, matchedCount = 0, i2 = "0", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, elems = seed || byElement && Expr.find.TAG("*", outermost), dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1, len = elems.length;
if (outermost) {
outermostContext = context == document3 || context || outermost;
}
for (; i2 !== len && (elem = elems[i2]) != null; i2++) {
if (byElement && elem) {
j = 0;
if (!context && elem.ownerDocument != document3) {
setDocument(elem);
xml = !documentIsHTML;
}
while (matcher = elementMatchers[j++]) {
if (matcher(elem, context || document3, xml)) {
push2.call(results, elem);
break;
}
}
if (outermost) {
dirruns = dirrunsUnique;
}
}
if (bySet) {
if (elem = !matcher && elem) {
matchedCount--;
}
if (seed) {
unmatched.push(elem);
}
}
}
matchedCount += i2;
if (bySet && i2 !== matchedCount) {
j = 0;
while (matcher = setMatchers[j++]) {
matcher(unmatched, setMatched, context, xml);
}
if (seed) {
if (matchedCount > 0) {
while (i2--) {
if (!(unmatched[i2] || setMatched[i2])) {
setMatched[i2] = pop.call(results);
}
}
}
setMatched = condense(setMatched);
}
push2.apply(results, setMatched);
if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {
jQuery.uniqueSort(results);
}
}
if (outermost) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
};
return bySet ? markFunction(superMatcher) : superMatcher;
}
function compile(selector, match) {
var i2, setMatchers = [], elementMatchers = [], cached = compilerCache[selector + " "];
if (!cached) {
if (!match) {
match = tokenize(selector);
}
i2 = match.length;
while (i2--) {
cached = matcherFromTokens(match[i2]);
if (cached[expando]) {
setMatchers.push(cached);
} else {
elementMatchers.push(cached);
}
}
cached = compilerCache(
selector,
matcherFromGroupMatchers(elementMatchers, setMatchers)
);
cached.selector = selector;
}
return cached;
}
function select(selector, context, results, seed) {
var i2, tokens, token, type, find2, compiled = typeof selector === "function" && selector, match = !seed && tokenize(selector = compiled.selector || selector);
results = results || [];
if (match.length === 1) {
tokens = match[0] = match[0].slice(0);
if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
context = (Expr.find.ID(
token.matches[0].replace(runescape, funescape),
context
) || [])[0];
if (!context) {
return results;
} else if (compiled) {
context = context.parentNode;
}
selector = selector.slice(tokens.shift().value.length);
}
i2 = matchExpr.needsContext.test(selector) ? 0 : tokens.length;
while (i2--) {
token = tokens[i2];
if (Expr.relative[type = token.type]) {
break;
}
if (find2 = Expr.find[type]) {
if (seed = find2(
token.matches[0].replace(runescape, funescape),
rsibling.test(tokens[0].type) && testContext(context.parentNode) || context
)) {
tokens.splice(i2, 1);
selector = seed.length && toSelector(tokens);
if (!selector) {
push2.apply(results, seed);
return results;
}
break;
}
}
}
}
(compiled || compile(selector, match))(
seed,
context,
!documentIsHTML,
results,
!context || rsibling.test(selector) && testContext(context.parentNode) || context
);
return results;
}
support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
setDocument();
support.sortDetached = assert(function(el) {
return el.compareDocumentPosition(document3.createElement("fieldset")) & 1;
});
jQuery.find = find;
jQuery.expr[":"] = jQuery.expr.pseudos;
jQuery.unique = jQuery.uniqueSort;
find.compile = compile;
find.select = select;
find.setDocument = setDocument;
find.tokenize = tokenize;
find.escape = jQuery.escapeSelector;
find.getText = jQuery.text;
find.isXML = jQuery.isXMLDoc;
find.selectors = jQuery.expr;
find.support = jQuery.support;
find.uniqueSort = jQuery.uniqueSort;
})();
var dir = function(elem, dir2, until) {
var matched = [], truncate = until !== void 0;
while ((elem = elem[dir2]) && elem.nodeType !== 9) {
if (elem.nodeType === 1) {
if (truncate && jQuery(elem).is(until)) {
break;
}
matched.push(elem);
}
}
return matched;
};
var siblings = function(n, elem) {
var matched = [];
for (; n; n = n.nextSibling) {
if (n.nodeType === 1 && n !== elem) {
matched.push(n);
}
}
return matched;
};
var rneedsContext = jQuery.expr.match.needsContext;
var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;
function winnow(elements, qualifier, not) {
if (isFunction(qualifier)) {
return jQuery.grep(elements, function(elem, i) {
return !!qualifier.call(elem, i, elem) !== not;
});
}
if (qualifier.nodeType) {
return jQuery.grep(elements, function(elem) {
return elem === qualifier !== not;
});
}
if (typeof qualifier !== "string") {
return jQuery.grep(elements, function(elem) {
return indexOf.call(qualifier, elem) > -1 !== not;
});
}
return jQuery.filter(qualifier, elements, not);
}
jQuery.filter = function(expr, elems, not) {
var elem = elems[0];
if (not) {
expr = ":not(" + expr + ")";
}
if (elems.length === 1 && elem.nodeType === 1) {
return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
}
return jQuery.find.matches(expr, jQuery.grep(elems, function(elem2) {
return elem2.nodeType === 1;
}));
};
jQuery.fn.extend({
find: function(selector) {
var i, ret, len = this.length, self2 = this;
if (typeof selector !== "string") {
return this.pushStack(jQuery(selector).filter(function() {
for (i = 0; i < len; i++) {
if (jQuery.contains(self2[i], this)) {
return true;
}
}
}));
}
ret = this.pushStack([]);
for (i = 0; i < len; i++) {
jQuery.find(selector, self2[i], ret);
}
return len > 1 ? jQuery.uniqueSort(ret) : ret;
},
filter: function(selector) {
return this.pushStack(winnow(this, selector || [], false));
},
not: function(selector) {
return this.pushStack(winnow(this, selector || [], true));
},
is: function(selector) {
return !!winnow(
this,
// If this is a positional/relative selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [],
false
).length;
}
});
var rootjQuery, rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, init = jQuery.fn.init = function(selector, context, root) {
var match, elem;
if (!selector) {
return this;
}
root = root || rootjQuery;
if (typeof selector === "string") {
if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {
match = [null, selector, null];
} else {
match = rquickExpr.exec(selector);
}
if (match && (match[1] || !context)) {
if (match[1]) {
context = context instanceof jQuery ? context[0] : context;
jQuery.merge(this, jQuery.parseHTML(
match[1],
context && context.nodeType ? context.ownerDocument || context : document2,
true
));
if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
for (match in context) {
if (isFunction(this[match])) {
this[match](context[match]);
} else {
this.attr(match, context[match]);
}
}
}
return this;
} else {
elem = document2.getElementById(match[2]);
if (elem) {
this[0] = elem;
this.length = 1;
}
return this;
}
} else if (!context || context.jquery) {
return (context || root).find(selector);
} else {
return this.constructor(context).find(selector);
}
} else if (selector.nodeType) {
this[0] = selector;
this.length = 1;
return this;
} else if (isFunction(selector)) {
return root.ready !== void 0 ? root.ready(selector) : (
// Execute immediately if ready is not present
selector(jQuery)
);
}
return jQuery.makeArray(selector, this);
};
init.prototype = jQuery.fn;
rootjQuery = jQuery(document2);
var rparentsprev = /^(?:parents|prev(?:Until|All))/, guaranteedUnique = {
children: true,
contents: true,
next: true,
prev: true
};
jQuery.fn.extend({
has: function(target) {
var targets = jQuery(target, this), l = targets.length;
return this.filter(function() {
var i = 0;
for (; i < l; i++) {
if (jQuery.contains(this, targets[i])) {
return true;
}
}
});
},
closest: function(selectors, context) {
var cur, i = 0, l = this.length, matched = [], targets = typeof selectors !== "string" && jQuery(selectors);
if (!rneedsContext.test(selectors)) {
for (; i < l; i++) {
for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 : (
// Don't pass non-elements to jQuery#find
cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors)
))) {
matched.push(cur);
break;
}
}
}
}
return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
},
// Determine the position of an element within the set
index: function(elem) {
if (!elem) {
return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
}
if (typeof elem === "string") {
return indexOf.call(jQuery(elem), this[0]);
}
return indexOf.call(
this,
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[0] : elem
);
},
add: function(selector, context) {
return this.pushStack(
jQuery.uniqueSort(
jQuery.merge(this.get(), jQuery(selector, context))
)
);
},
addBack: function(selector) {
return this.add(
selector == null ? this.prevObject : this.prevObject.filter(selector)
);
}
});
function sibling(cur, dir2) {
while ((cur = cur[dir2]) && cur.nodeType !== 1) {
}
return cur;
}
jQuery.each({
parent: function(elem) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function(elem) {
return dir(elem, "parentNode");
},
parentsUntil: function(elem, _i, until) {
return dir(elem, "parentNode", until);
},
next: function(elem) {
return sibling(elem, "nextSibling");
},
prev: function(elem) {
return sibling(elem, "previousSibling");
},
nextAll: function(elem) {
return dir(elem, "nextSibling");
},
prevAll: function(elem) {
return dir(elem, "previousSibling");
},
nextUntil: function(elem, _i, until) {
return dir(elem, "nextSibling", until);
},
prevUntil: function(elem, _i, until) {
return dir(elem, "previousSibling", until);
},
siblings: function(elem) {
return siblings((elem.parentNode || {}).firstChild, elem);
},
children: function(elem) {
return siblings(elem.firstChild);
},
contents: function(elem) {
if (elem.contentDocument != null && // Support: IE 11+
// <object> elements with no `data` attribute has an object
// `contentDocument` with a `null` prototype.
getProto(elem.contentDocument)) {
return elem.contentDocument;
}
if (nodeName(elem, "template")) {
elem = elem.content || elem;
}
return jQuery.merge([], elem.childNodes);
}
}, function(name, fn2) {
jQuery.fn[name] = function(until, selector) {
var matched = jQuery.map(this, fn2, until);
if (name.slice(-5) !== "Until") {
selector = until;
}
if (selector && typeof selector === "string") {
matched = jQuery.filter(selector, matched);
}
if (this.length > 1) {
if (!guaranteedUnique[name]) {
jQuery.uniqueSort(matched);
}
if (rparentsprev.test(name)) {
matched.reverse();
}
}
return this.pushStack(matched);
};
});
var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
function createOptions(options) {
var object = {};
jQuery.each(options.match(rnothtmlwhite) || [], function(_, flag) {
object[flag] = true;
});
return object;
}
jQuery.Callbacks = function(options) {
options = typeof options === "string" ? createOptions(options) : jQuery.extend({}, options);
var firing, memory, fired, locked, list = [], queue = [], firingIndex = -1, fire = function() {
locked = locked || options.once;
fired = firing = true;
for (; queue.length; firingIndex = -1) {
memory = queue.shift();
while (++firingIndex < list.length) {
if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) {
firingIndex = list.length;
memory = false;
}
}
}
if (!options.memory) {
memory = false;
}
firing = false;
if (locked) {
if (memory) {
list = [];
} else {
list = "";
}
}
}, self2 = {
// Add a callback or a collection of callbacks to the list
add: function() {
if (list) {
if (memory && !firing) {
firingIndex = list.length - 1;
queue.push(memory);
}
(function add(args) {
jQuery.each(args, function(_, arg) {
if (isFunction(arg)) {
if (!options.unique || !self2.has(arg)) {
list.push(arg);
}
} else if (arg && arg.length && toType2(arg) !== "string") {
add(arg);
}
});
})(arguments);
if (memory && !firing) {
fire();
}
}
return this;
},
// Remove a callback from the list
remove: function() {
jQuery.each(arguments, function(_, arg) {
var index;
while ((index = jQuery.inArray(arg, list, index)) > -1) {
list.splice(index, 1);
if (index <= firingIndex) {
firingIndex--;
}
}
});
return this;
},
// Check if a given callback is in the list.
// If no argument is given, return whether or not list has callbacks attached.
has: function(fn2) {
return fn2 ? jQuery.inArray(fn2, list) > -1 : list.length > 0;
},
// Remove all callbacks from the list
empty: function() {
if (list) {
list = [];
}
return this;
},
// Disable .fire and .add
// Abort any current/pending executions
// Clear all callbacks and values
disable: function() {
locked = queue = [];
list = memory = "";
return this;
},
disabled: function() {
return !list;
},
// Disable .fire
// Also disable .add unless we have memory (since it would have no effect)
// Abort any pending executions
lock: function() {
locked = queue = [];
if (!memory && !firing) {
list = memory = "";
}
return this;
},
locked: function() {
return !!locked;
},
// Call all callbacks with the given context and arguments
fireWith: function(context, args) {
if (!locked) {
args = args || [];
args = [context, args.slice ? args.slice() : args];
queue.push(args);
if (!firing) {
fire();
}
}
return this;
},
// Call all the callbacks with the given arguments
fire: function() {
self2.fireWith(this, arguments);
return this;
},
// To know if the callbacks have already been called at least once
fired: function() {
return !!fired;
}
};
return self2;
};
function Identity(v) {
return v;
}
function Thrower(ex) {
throw ex;
}
function adoptValue(value, resolve, reject, noValue) {
var method;
try {
if (value && isFunction(method = value.promise)) {
method.call(value).done(resolve).fail(reject);
} else if (value && isFunction(method = value.then)) {
method.call(value, resolve, reject);
} else {
resolve.apply(void 0, [value].slice(noValue));
}
} catch (value2) {
reject.apply(void 0, [value2]);
}
}
jQuery.extend({
Deferred: function(func) {
var tuples = [
// action, add listener, callbacks,
// ... .then handlers, argument index, [final state]
[
"notify",
"progress",
jQuery.Callbacks("memory"),
jQuery.Callbacks("memory"),
2
],
[
"resolve",
"done",
jQuery.Callbacks("once memory"),
jQuery.Callbacks("once memory"),
0,
"resolved"
],
[
"reject",
"fail",
jQuery.Callbacks("once memory"),
jQuery.Callbacks("once memory"),
1,
"rejected"
]
], state = "pending", promise = {
state: function() {
return state;
},
always: function() {
deferred.done(arguments).fail(arguments);
return this;
},
"catch": function(fn2) {
return promise.then(null, fn2);
},
// Keep pipe for back-compat
pipe: function() {
var fns = arguments;
return jQuery.Deferred(function(newDefer) {
jQuery.each(tuples, function(_i, tuple) {
var fn2 = isFunction(fns[tuple[4]]) && fns[tuple[4]];
deferred[tuple[1]](function() {
var returned = fn2 && fn2.apply(this, arguments);
if (returned && isFunction(returned.promise)) {
returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);
} else {
newDefer[tuple[0] + "With"](
this,
fn2 ? [returned] : arguments
);
}
});
});
fns = null;
}).promise();
},
then: function(onFulfilled, onRejected, onProgress) {
var maxDepth = 0;
function resolve(depth, deferred2, handler, special) {
return function() {
var that = this, args = arguments, mightThrow = function() {
var returned, then;
if (depth < maxDepth) {
return;
}
returned = handler.apply(that, args);
if (returned === deferred2.promise()) {
throw new TypeError("Thenable self-resolution");
}
then = returned && // Support: Promises/A+ section 2.3.4
// https://promisesaplus.com/#point-64
// Only check objects and functions for thenability
(typeof returned === "object" || typeof returned === "function") && returned.then;
if (isFunction(then)) {
if (special) {
then.call(
returned,
resolve(maxDepth, deferred2, Identity, special),
resolve(maxDepth, deferred2, Thrower, special)
);
} else {
maxDepth++;
then.call(
returned,
resolve(maxDepth, deferred2, Identity, special),
resolve(maxDepth, deferred2, Thrower, special),
resolve(
maxDepth,
deferred2,
Identity,
deferred2.notifyWith
)
);
}
} else {
if (handler !== Identity) {
that = void 0;
args = [returned];
}
(special || deferred2.resolveWith)(that, args);
}
}, process = special ? mightThrow : function() {
try {
mightThrow();
} catch (e) {
if (jQuery.Deferred.exceptionHook) {
jQuery.Deferred.exceptionHook(
e,
process.error
);
}
if (depth + 1 >= maxDepth) {
if (handler !== Thrower) {
that = void 0;
args = [e];
}
deferred2.rejectWith(that, args);
}
}
};
if (depth) {
process();
} else {
if (jQuery.Deferred.getErrorHook) {
process.error = jQuery.Deferred.getErrorHook();
} else if (jQuery.Deferred.getStackHook) {
process.error = jQuery.Deferred.getStackHook();
}
window2.setTimeout(process);
}
};
}
return jQuery.Deferred(function(newDefer) {
tuples[0][3].add(
resolve(
0,
newDefer,
isFunction(onProgress) ? onProgress : Identity,
newDefer.notifyWith
)
);
tuples[1][3].add(
resolve(
0,
newDefer,
isFunction(onFulfilled) ? onFulfilled : Identity
)
);
tuples[2][3].add(
resolve(
0,
newDefer,
isFunction(onRejected) ? onRejected : Thrower
)
);
}).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function(obj) {
return obj != null ? jQuery.extend(obj, promise) : promise;
}
}, deferred = {};
jQuery.each(tuples, function(i, tuple) {
var list = tuple[2], stateString = tuple[5];
promise[tuple[1]] = list.add;
if (stateString) {
list.add(
function() {
state = stateString;
},
// rejected_callbacks.disable
// fulfilled_callbacks.disable
tuples[3 - i][2].disable,
// rejected_handlers.disable
// fulfilled_handlers.disable
tuples[3 - i][3].disable,
// progress_callbacks.lock
tuples[0][2].lock,
// progress_handlers.lock
tuples[0][3].lock
);
}
list.add(tuple[3].fire);
deferred[tuple[0]] = function() {
deferred[tuple[0] + "With"](this === deferred ? void 0 : this, arguments);
return this;
};
deferred[tuple[0] + "With"] = list.fireWith;
});
promise.promise(deferred);
if (func) {
func.call(deferred, deferred);
}
return deferred;
},
// Deferred helper
when: function(singleValue) {
var remaining = arguments.length, i = remaining, resolveContexts = Array(i), resolveValues = slice.call(arguments), primary = jQuery.Deferred(), updateFunc = function(i2) {
return function(value) {
resolveContexts[i2] = this;
resolveValues[i2] = arguments.length > 1 ? slice.call(arguments) : value;
if (!--remaining) {
primary.resolveWith(resolveContexts, resolveValues);
}
};
};
if (remaining <= 1) {
adoptValue(
singleValue,
primary.done(updateFunc(i)).resolve,
primary.reject,
!remaining
);
if (primary.state() === "pending" || isFunction(resolveValues[i] && resolveValues[i].then)) {
return primary.then();
}
}
while (i--) {
adoptValue(resolveValues[i], updateFunc(i), primary.reject);
}
return primary.promise();
}
});
var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
jQuery.Deferred.exceptionHook = function(error, asyncError) {
if (window2.console && window2.console.warn && error && rerrorNames.test(error.name)) {
window2.console.warn(
"jQuery.Deferred exception: " + error.message,
error.stack,
asyncError
);
}
};
jQuery.readyException = function(error) {
window2.setTimeout(function() {
throw error;
});
};
var readyList = jQuery.Deferred();
jQuery.fn.ready = function(fn2) {
readyList.then(fn2).catch(function(error) {
jQuery.readyException(error);
});
return this;
};
jQuery.extend({
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
// A counter to track how many items to wait for before
// the ready event fires. See trac-6781
readyWait: 1,
// Handle when the DOM is ready
ready: function(wait) {
if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
return;
}
jQuery.isReady = true;
if (wait !== true && --jQuery.readyWait > 0) {
return;
}
readyList.resolveWith(document2, [jQuery]);
}
});
jQuery.ready.then = readyList.then;
function completed() {
document2.removeEventListener("DOMContentLoaded", completed);
window2.removeEventListener("load", completed);
jQuery.ready();
}
if (document2.readyState === "complete" || document2.readyState !== "loading" && !document2.documentElement.doScroll) {
window2.setTimeout(jQuery.ready);
} else {
document2.addEventListener("DOMContentLoaded", completed);
window2.addEventListener("load", completed);
}
var access = function(elems, fn2, key, value, chainable, emptyGet, raw) {
var i = 0, len = elems.length, bulk = key == null;
if (toType2(key) === "object") {
chainable = true;
for (i in key) {
access(elems, fn2, i, key[i], true, emptyGet, raw);
}
} else if (value !== void 0) {
chainable = true;
if (!isFunction(value)) {
raw = true;
}
if (bulk) {
if (raw) {
fn2.call(elems, value);
fn2 = null;
} else {
bulk = fn2;
fn2 = function(elem, _key, value2) {
return bulk.call(jQuery(elem), value2);
};
}
}
if (fn2) {
for (; i < len; i++) {
fn2(
elems[i],
key,
raw ? value : value.call(elems[i], i, fn2(elems[i], key))
);
}
}
}
if (chainable) {
return elems;
}
if (bulk) {
return fn2.call(elems);
}
return len ? fn2(elems[0], key) : emptyGet;
};
var rmsPrefix = /^-ms-/, rdashAlpha = /-([a-z])/g;
function fcamelCase(_all, letter) {
return letter.toUpperCase();
}
function camelCase(string) {
return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
}
var acceptData = function(owner) {
return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;
};
function Data2() {
this.expando = jQuery.expando + Data2.uid++;
}
Data2.uid = 1;
Data2.prototype = {
cache: function(owner) {
var value = owner[this.expando];
if (!value) {
value = {};
if (acceptData(owner)) {
if (owner.nodeType) {
owner[this.expando] = value;
} else {
Object.defineProperty(owner, this.expando, {
value,
configurable: true
});
}
}
}
return value;
},
set: function(owner, data, value) {
var prop, cache = this.cache(owner);
if (typeof data === "string") {
cache[camelCase(data)] = value;
} else {
for (prop in data) {
cache[camelCase(prop)] = data[prop];
}
}
return cache;
},
get: function(owner, key) {
return key === void 0 ? this.cache(owner) : (
// Always use camelCase key (gh-2257)
owner[this.expando] && owner[this.expando][camelCase(key)]
);
},
access: function(owner, key, value) {
if (key === void 0 || key && typeof key === "string" && value === void 0) {
return this.get(owner, key);
}
this.set(owner, key, value);
return value !== void 0 ? value : key;
},
remove: function(owner, key) {
var i, cache = owner[this.expando];
if (cache === void 0) {
return;
}
if (key !== void 0) {
if (Array.isArray(key)) {
key = key.map(camelCase);
} else {
key = camelCase(key);
key = key in cache ? [key] : key.match(rnothtmlwhite) || [];
}
i = key.length;
while (i--) {
delete cache[key[i]];
}
}
if (key === void 0 || jQuery.isEmptyObject(cache)) {
if (owner.nodeType) {
owner[this.expando] = void 0;
} else {
delete owner[this.expando];
}
}
},
hasData: function(owner) {
var cache = owner[this.expando];
return cache !== void 0 && !jQuery.isEmptyObject(cache);
}
};
var dataPriv = new Data2();
var dataUser = new Data2();
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /[A-Z]/g;
function getData(data) {
if (data === "true") {
return true;
}
if (data === "false") {
return false;
}
if (data === "null") {
return null;
}
if (data === +data + "") {
return +data;
}
if (rbrace.test(data)) {
return JSON.parse(data);
}
return data;
}
function dataAttr(elem, key, data) {
var name;
if (data === void 0 && elem.nodeType === 1) {
name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
data = elem.getAttribute(name);
if (typeof data === "string") {
try {
data = getData(data);
} catch (e) {
}
dataUser.set(elem, key, data);
} else {
data = void 0;
}
}
return data;
}
jQuery.extend({
hasData: function(elem) {
return dataUser.hasData(elem) || dataPriv.hasData(elem);
},
data: function(elem, name, data) {
return dataUser.access(elem, name, data);
},
removeData: function(elem, name) {
dataUser.remove(elem, name);
},
// TODO: Now that all calls to _data and _removeData have been replaced
// with direct calls to dataPriv methods, these can be deprecated.
_data: function(elem, name, data) {
return dataPriv.access(elem, name, data);
},
_removeData: function(elem, name) {
dataPriv.remove(elem, name);
}
});
jQuery.fn.extend({
data: function(key, value) {
var i, name, data, elem = this[0], attrs = elem && elem.attributes;
if (key === void 0) {
if (this.length) {
data = dataUser.get(elem);
if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
i = attrs.length;
while (i--) {
if (attrs[i]) {
name = attrs[i].name;
if (name.indexOf("data-") === 0) {
name = camelCase(name.slice(5));
dataAttr(elem, name, data[name]);
}
}
}
dataPriv.set(elem, "hasDataAttrs", true);
}
}
return data;
}
if (typeof key === "object") {
return this.each(function() {
dataUser.set(this, key);
});
}
return access(this, function(value2) {
var data2;
if (elem && value2 === void 0) {
data2 = dataUser.get(elem, key);
if (data2 !== void 0) {
return data2;
}
data2 = dataAttr(elem, key);
if (data2 !== void 0) {
return data2;
}
return;
}
this.each(function() {
dataUser.set(this, key, value2);
});
}, null, value, arguments.length > 1, null, true);
},
removeData: function(key) {
return this.each(function() {
dataUser.remove(this, key);
});
}
});
jQuery.extend({
queue: function(elem, type, data) {
var queue;
if (elem) {
type = (type || "fx") + "queue";
queue = dataPriv.get(elem, type);
if (data) {
if (!queue || Array.isArray(data)) {
queue = dataPriv.access(elem, type, jQuery.makeArray(data));
} else {
queue.push(data);
}
}
return queue || [];
}
},
dequeue: function(elem, type) {
type = type || "fx";
var queue = jQuery.queue(elem, type), startLength = queue.length, fn2 = queue.shift(), hooks = jQuery._queueHooks(elem, type), next = function() {
jQuery.dequeue(elem, type);
};
if (fn2 === "inprogress") {
fn2 = queue.shift();
startLength--;
}
if (fn2) {
if (type === "fx") {
queue.unshift("inprogress");
}
delete hooks.stop;
fn2.call(elem, next, hooks);
}
if (!startLength && hooks) {
hooks.empty.fire();
}
},
// Not public - generate a queueHooks object, or return the current one
_queueHooks: function(elem, type) {
var key = type + "queueHooks";
return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
empty: jQuery.Callbacks("once memory").add(function() {
dataPriv.remove(elem, [type + "queue", key]);
})
});
}
});
jQuery.fn.extend({
queue: function(type, data) {
var setter = 2;
if (typeof type !== "string") {
data = type;
type = "fx";
setter--;
}
if (arguments.length < setter) {
return jQuery.queue(this[0], type);
}
return data === void 0 ? this : this.each(function() {
var queue = jQuery.queue(this, type, data);
jQuery._queueHooks(this, type);
if (type === "fx" && queue[0] !== "inprogress") {
jQuery.dequeue(this, type);
}
});
},
dequeue: function(type) {
return this.each(function() {
jQuery.dequeue(this, type);
});
},
clearQueue: function(type) {
return this.queue(type || "fx", []);
},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function(type, obj) {
var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function() {
if (!--count) {
defer.resolveWith(elements, [elements]);
}
};
if (typeof type !== "string") {
obj = type;
type = void 0;
}
type = type || "fx";
while (i--) {
tmp = dataPriv.get(elements[i], type + "queueHooks");
if (tmp && tmp.empty) {
count++;
tmp.empty.add(resolve);
}
}
resolve();
return defer.promise(obj);
}
});
var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");
var cssExpand = ["Top", "Right", "Bottom", "Left"];
var documentElement = document2.documentElement;
var isAttached = function(elem) {
return jQuery.contains(elem.ownerDocument, elem);
}, composed = { composed: true };
if (documentElement.getRootNode) {
isAttached = function(elem) {
return jQuery.contains(elem.ownerDocument, elem) || elem.getRootNode(composed) === elem.ownerDocument;
};
}
var isHiddenWithinTree = function(elem, el) {
elem = el || elem;
return elem.style.display === "none" || elem.style.display === "" && // Otherwise, check computed style
// Support: Firefox <=43 - 45
// Disconnected elements can have computed display: none, so first confirm that elem is
// in the document.
isAttached(elem) && jQuery.css(elem, "display") === "none";
};
function adjustCSS(elem, prop, valueParts, tween) {
var adjusted, scale, maxIterations = 20, currentValue = tween ? function() {
return tween.cur();
} : function() {
return jQuery.css(elem, prop, "");
}, initial = currentValue(), unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"), initialInUnit = elem.nodeType && (jQuery.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery.css(elem, prop));
if (initialInUnit && initialInUnit[3] !== unit) {
initial = initial / 2;
unit = unit || initialInUnit[3];
initialInUnit = +initial || 1;
while (maxIterations--) {
jQuery.style(elem, prop, initialInUnit + unit);
if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {
maxIterations = 0;
}
initialInUnit = initialInUnit / scale;
}
initialInUnit = initialInUnit * 2;
jQuery.style(elem, prop, initialInUnit + unit);
valueParts = valueParts || [];
}
if (valueParts) {
initialInUnit = +initialInUnit || +initial || 0;
adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];
if (tween) {
tween.unit = unit;
tween.start = initialInUnit;
tween.end = adjusted;
}
}
return adjusted;
}
var defaultDisplayMap = {};
function getDefaultDisplay(elem) {
var temp, doc2 = elem.ownerDocument, nodeName2 = elem.nodeName, display = defaultDisplayMap[nodeName2];
if (display) {
return display;
}
temp = doc2.body.appendChild(doc2.createElement(nodeName2));
display = jQuery.css(temp, "display");
temp.parentNode.removeChild(temp);
if (display === "none") {
display = "block";
}
defaultDisplayMap[nodeName2] = display;
return display;
}
function showHide(elements, show) {
var display, elem, values = [], index = 0, length = elements.length;
for (; index < length; index++) {
elem = elements[index];
if (!elem.style) {
continue;
}
display = elem.style.display;
if (show) {
if (display === "none") {
values[index] = dataPriv.get(elem, "display") || null;
if (!values[index]) {
elem.style.display = "";
}
}
if (elem.style.display === "" && isHiddenWithinTree(elem)) {
values[index] = getDefaultDisplay(elem);
}
} else {
if (display !== "none") {
values[index] = "none";
dataPriv.set(elem, "display", display);
}
}
}
for (index = 0; index < length; index++) {
if (values[index] != null) {
elements[index].style.display = values[index];
}
}
return elements;
}
jQuery.fn.extend({
show: function() {
return showHide(this, true);
},
hide: function() {
return showHide(this);
},
toggle: function(state) {
if (typeof state === "boolean") {
return state ? this.show() : this.hide();
}
return this.each(function() {
if (isHiddenWithinTree(this)) {
jQuery(this).show();
} else {
jQuery(this).hide();
}
});
}
});
var rcheckableType = /^(?:checkbox|radio)$/i;
var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]*)/i;
var rscriptType = /^$|^module$|\/(?:java|ecma)script/i;
(function() {
var fragment = document2.createDocumentFragment(), div = fragment.appendChild(document2.createElement("div")), input = document2.createElement("input");
input.setAttribute("type", "radio");
input.setAttribute("checked", "checked");
input.setAttribute("name", "t");
div.appendChild(input);
support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
div.innerHTML = "<textarea>x</textarea>";
support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
div.innerHTML = "<option></option>";
support.option = !!div.lastChild;
})();
var wrapMap = {
// XHTML parsers do not magically insert elements in the
// same way that tag soup parsers do. So we cannot shorten
// this by omitting <tbody> or other required elements.
thead: [1, "<table>", "</table>"],
col: [2, "<table><colgroup>", "</colgroup></table>"],
tr: [2, "<table><tbody>", "</tbody></table>"],
td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
_default: [0, "", ""]
};
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
if (!support.option) {
wrapMap.optgroup = wrapMap.option = [1, "<select multiple='multiple'>", "</select>"];
}
function getAll(context, tag) {
var ret;
if (typeof context.getElementsByTagName !== "undefined") {
ret = context.getElementsByTagName(tag || "*");
} else if (typeof context.querySelectorAll !== "undefined") {
ret = context.querySelectorAll(tag || "*");
} else {
ret = [];
}
if (tag === void 0 || tag && nodeName(context, tag)) {
return jQuery.merge([context], ret);
}
return ret;
}
function setGlobalEval(elems, refElements) {
var i = 0, l = elems.length;
for (; i < l; i++) {
dataPriv.set(
elems[i],
"globalEval",
!refElements || dataPriv.get(refElements[i], "globalEval")
);
}
}
var rhtml = /<|&#?\w+;/;
function buildFragment(elems, context, scripts, selection, ignored) {
var elem, tmp, tag, wrap, attached, j, fragment = context.createDocumentFragment(), nodes = [], i = 0, l = elems.length;
for (; i < l; i++) {
elem = elems[i];
if (elem || elem === 0) {
if (toType2(elem) === "object") {
jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
} else if (!rhtml.test(elem)) {
nodes.push(context.createTextNode(elem));
} else {
tmp = tmp || fragment.appendChild(context.createElement("div"));
tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
wrap = wrapMap[tag] || wrapMap._default;
tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];
j = wrap[0];
while (j--) {
tmp = tmp.lastChild;
}
jQuery.merge(nodes, tmp.childNodes);
tmp = fragment.firstChild;
tmp.textContent = "";
}
}
}
fragment.textContent = "";
i = 0;
while (elem = nodes[i++]) {
if (selection && jQuery.inArray(elem, selection) > -1) {
if (ignored) {
ignored.push(elem);
}
continue;
}
attached = isAttached(elem);
tmp = getAll(fragment.appendChild(elem), "script");
if (attached) {
setGlobalEval(tmp);
}
if (scripts) {
j = 0;
while (elem = tmp[j++]) {
if (rscriptType.test(elem.type || "")) {
scripts.push(elem);
}
}
}
}
return fragment;
}
var rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
function returnTrue() {
return true;
}
function returnFalse() {
return false;
}
function on(elem, types, selector, data, fn2, one) {
var origFn, type;
if (typeof types === "object") {
if (typeof selector !== "string") {
data = data || selector;
selector = void 0;
}
for (type in types) {
on(elem, type, selector, data, types[type], one);
}
return elem;
}
if (data == null && fn2 == null) {
fn2 = selector;
data = selector = void 0;
} else if (fn2 == null) {
if (typeof selector === "string") {
fn2 = data;
data = void 0;
} else {
fn2 = data;
data = selector;
selector = void 0;
}
}
if (fn2 === false) {
fn2 = returnFalse;
} else if (!fn2) {
return elem;
}
if (one === 1) {
origFn = fn2;
fn2 = function(event) {
jQuery().off(event);
return origFn.apply(this, arguments);
};
fn2.guid = origFn.guid || (origFn.guid = jQuery.guid++);
}
return elem.each(function() {
jQuery.event.add(this, types, fn2, data, selector);
});
}
jQuery.event = {
global: {},
add: function(elem, types, handler, data, selector) {
var handleObjIn, eventHandle, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.get(elem);
if (!acceptData(elem)) {
return;
}
if (handler.handler) {
handleObjIn = handler;
handler = handleObjIn.handler;
selector = handleObjIn.selector;
}
if (selector) {
jQuery.find.matchesSelector(documentElement, selector);
}
if (!handler.guid) {
handler.guid = jQuery.guid++;
}
if (!(events = elemData.events)) {
events = elemData.events = /* @__PURE__ */ Object.create(null);
}
if (!(eventHandle = elemData.handle)) {
eventHandle = elemData.handle = function(e) {
return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : void 0;
};
}
types = (types || "").match(rnothtmlwhite) || [""];
t = types.length;
while (t--) {
tmp = rtypenamespace.exec(types[t]) || [];
type = origType = tmp[1];
namespaces = (tmp[2] || "").split(".").sort();
if (!type) {
continue;
}
special = jQuery.event.special[type] || {};
type = (selector ? special.delegateType : special.bindType) || type;
special = jQuery.event.special[type] || {};
handleObj = jQuery.extend({
type,
origType,
data,
handler,
guid: handler.guid,
selector,
needsContext: selector && jQuery.expr.match.needsContext.test(selector),
namespace: namespaces.join(".")
}, handleObjIn);
if (!(handlers = events[type])) {
handlers = events[type] = [];
handlers.delegateCount = 0;
if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
if (elem.addEventListener) {
elem.addEventListener(type, eventHandle);
}
}
}
if (special.add) {
special.add.call(elem, handleObj);
if (!handleObj.handler.guid) {
handleObj.handler.guid = handler.guid;
}
}
if (selector) {
handlers.splice(handlers.delegateCount++, 0, handleObj);
} else {
handlers.push(handleObj);
}
jQuery.event.global[type] = true;
}
},
// Detach an event or set of events from an element
remove: function(elem, types, handler, selector, mappedTypes) {
var j, origCount, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
if (!elemData || !(events = elemData.events)) {
return;
}
types = (types || "").match(rnothtmlwhite) || [""];
t = types.length;
while (t--) {
tmp = rtypenamespace.exec(types[t]) || [];
type = origType = tmp[1];
namespaces = (tmp[2] || "").split(".").sort();
if (!type) {
for (type in events) {
jQuery.event.remove(elem, type + types[t], handler, selector, true);
}
continue;
}
special = jQuery.event.special[type] || {};
type = (selector ? special.delegateType : special.bindType) || type;
handlers = events[type] || [];
tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
origCount = j = handlers.length;
while (j--) {
handleObj = handlers[j];
if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
handlers.splice(j, 1);
if (handleObj.selector) {
handlers.delegateCount--;
}
if (special.remove) {
special.remove.call(elem, handleObj);
}
}
}
if (origCount && !handlers.length) {
if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
jQuery.removeEvent(elem, type, elemData.handle);
}
delete events[type];
}
}
if (jQuery.isEmptyObject(events)) {
dataPriv.remove(elem, "handle events");
}
},
dispatch: function(nativeEvent) {
var i, j, ret, matched, handleObj, handlerQueue, args = new Array(arguments.length), event = jQuery.event.fix(nativeEvent), handlers = (dataPriv.get(this, "events") || /* @__PURE__ */ Object.create(null))[event.type] || [], special = jQuery.event.special[event.type] || {};
args[0] = event;
for (i = 1; i < arguments.length; i++) {
args[i] = arguments[i];
}
event.delegateTarget = this;
if (special.preDispatch && special.preDispatch.call(this, event) === false) {
return;
}
handlerQueue = jQuery.event.handlers.call(this, event, handlers);
i = 0;
while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
event.currentTarget = matched.elem;
j = 0;
while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
if (!event.rnamespace || handleObj.namespace === false || event.rnamespace.test(handleObj.namespace)) {
event.handleObj = handleObj;
event.data = handleObj.data;
ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
if (ret !== void 0) {
if ((event.result = ret) === false) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
if (special.postDispatch) {
special.postDispatch.call(this, event);
}
return event.result;
},
handlers: function(event, handlers) {
var i, handleObj, sel, matchedHandlers, matchedSelectors, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target;
if (delegateCount && // Support: IE <=9
// Black-hole SVG <use> instance trees (trac-13180)
cur.nodeType && // Support: Firefox <=42
// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
// Support: IE 11 only
// ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
!(event.type === "click" && event.button >= 1)) {
for (; cur !== this; cur = cur.parentNode || this) {
if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) {
matchedHandlers = [];
matchedSelectors = {};
for (i = 0; i < delegateCount; i++) {
handleObj = handlers[i];
sel = handleObj.selector + " ";
if (matchedSelectors[sel] === void 0) {
matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;
}
if (matchedSelectors[sel]) {
matchedHandlers.push(handleObj);
}
}
if (matchedHandlers.length) {
handlerQueue.push({ elem: cur, handlers: matchedHandlers });
}
}
}
}
cur = this;
if (delegateCount < handlers.length) {
handlerQueue.push({ elem: cur, handlers: handlers.slice(delegateCount) });
}
return handlerQueue;
},
addProp: function(name, hook) {
Object.defineProperty(jQuery.Event.prototype, name, {
enumerable: true,
configurable: true,
get: isFunction(hook) ? function() {
if (this.originalEvent) {
return hook(this.originalEvent);
}
} : function() {
if (this.originalEvent) {
return this.originalEvent[name];
}
},
set: function(value) {
Object.defineProperty(this, name, {
enumerable: true,
configurable: true,
writable: true,
value
});
}
});
},
fix: function(originalEvent) {
return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);
},
special: {
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
click: {
// Utilize native event to ensure correct state for checkable inputs
setup: function(data) {
var el = this || data;
if (rcheckableType.test(el.type) && el.click && nodeName(el, "input")) {
leverageNative(el, "click", true);
}
return false;
},
trigger: function(data) {
var el = this || data;
if (rcheckableType.test(el.type) && el.click && nodeName(el, "input")) {
leverageNative(el, "click");
}
return true;
},
// For cross-browser consistency, suppress native .click() on links
// Also prevent it if we're currently inside a leveraged native-event stack
_default: function(event) {
var target = event.target;
return rcheckableType.test(target.type) && target.click && nodeName(target, "input") && dataPriv.get(target, "click") || nodeName(target, "a");
}
},
beforeunload: {
postDispatch: function(event) {
if (event.result !== void 0 && event.originalEvent) {
event.originalEvent.returnValue = event.result;
}
}
}
}
};
function leverageNative(el, type, isSetup) {
if (!isSetup) {
if (dataPriv.get(el, type) === void 0) {
jQuery.event.add(el, type, returnTrue);
}
return;
}
dataPriv.set(el, type, false);
jQuery.event.add(el, type, {
namespace: false,
handler: function(event) {
var result, saved = dataPriv.get(this, type);
if (event.isTrigger & 1 && this[type]) {
if (!saved) {
saved = slice.call(arguments);
dataPriv.set(this, type, saved);
this[type]();
result = dataPriv.get(this, type);
dataPriv.set(this, type, false);
if (saved !== result) {
event.stopImmediatePropagation();
event.preventDefault();
return result;
}
} else if ((jQuery.event.special[type] || {}).delegateType) {
event.stopPropagation();
}
} else if (saved) {
dataPriv.set(this, type, jQuery.event.trigger(
saved[0],
saved.slice(1),
this
));
event.stopPropagation();
event.isImmediatePropagationStopped = returnTrue;
}
}
});
}
jQuery.removeEvent = function(elem, type, handle) {
if (elem.removeEventListener) {
elem.removeEventListener(type, handle);
}
};
jQuery.Event = function(src, props) {
if (!(this instanceof jQuery.Event)) {
return new jQuery.Event(src, props);
}
if (src && src.type) {
this.originalEvent = src;
this.type = src.type;
this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === void 0 && // Support: Android <=2.3 only
src.returnValue === false ? returnTrue : returnFalse;
this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;
this.currentTarget = src.currentTarget;
this.relatedTarget = src.relatedTarget;
} else {
this.type = src;
}
if (props) {
jQuery.extend(this, props);
}
this.timeStamp = src && src.timeStamp || Date.now();
this[jQuery.expando] = true;
};
jQuery.Event.prototype = {
constructor: jQuery.Event,
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse,
isSimulated: false,
preventDefault: function() {
var e = this.originalEvent;
this.isDefaultPrevented = returnTrue;
if (e && !this.isSimulated) {
e.preventDefault();
}
},
stopPropagation: function() {
var e = this.originalEvent;
this.isPropagationStopped = returnTrue;
if (e && !this.isSimulated) {
e.stopPropagation();
}
},
stopImmediatePropagation: function() {
var e = this.originalEvent;
this.isImmediatePropagationStopped = returnTrue;
if (e && !this.isSimulated) {
e.stopImmediatePropagation();
}
this.stopPropagation();
}
};
jQuery.each({
altKey: true,
bubbles: true,
cancelable: true,
changedTouches: true,
ctrlKey: true,
detail: true,
eventPhase: true,
metaKey: true,
pageX: true,
pageY: true,
shiftKey: true,
view: true,
"char": true,
code: true,
charCode: true,
key: true,
keyCode: true,
button: true,
buttons: true,
clientX: true,
clientY: true,
offsetX: true,
offsetY: true,
pointerId: true,
pointerType: true,
screenX: true,
screenY: true,
targetTouches: true,
toElement: true,
touches: true,
which: true
}, jQuery.event.addProp);
jQuery.each({ focus: "focusin", blur: "focusout" }, function(type, delegateType) {
function focusMappedHandler(nativeEvent) {
if (document2.documentMode) {
var handle = dataPriv.get(this, "handle"), event = jQuery.event.fix(nativeEvent);
event.type = nativeEvent.type === "focusin" ? "focus" : "blur";
event.isSimulated = true;
handle(nativeEvent);
if (event.target === event.currentTarget) {
handle(event);
}
} else {
jQuery.event.simulate(
delegateType,
nativeEvent.target,
jQuery.event.fix(nativeEvent)
);
}
}
jQuery.event.special[type] = {
// Utilize native event if possible so blur/focus sequence is correct
setup: function() {
var attaches;
leverageNative(this, type, true);
if (document2.documentMode) {
attaches = dataPriv.get(this, delegateType);
if (!attaches) {
this.addEventListener(delegateType, focusMappedHandler);
}
dataPriv.set(this, delegateType, (attaches || 0) + 1);
} else {
return false;
}
},
trigger: function() {
leverageNative(this, type);
return true;
},
teardown: function() {
var attaches;
if (document2.documentMode) {
attaches = dataPriv.get(this, delegateType) - 1;
if (!attaches) {
this.removeEventListener(delegateType, focusMappedHandler);
dataPriv.remove(this, delegateType);
} else {
dataPriv.set(this, delegateType, attaches);
}
} else {
return false;
}
},
// Suppress native focus or blur if we're currently inside
// a leveraged native-event stack
_default: function(event) {
return dataPriv.get(event.target, type);
},
delegateType
};
jQuery.event.special[delegateType] = {
setup: function() {
var doc2 = this.ownerDocument || this.document || this, dataHolder = document2.documentMode ? this : doc2, attaches = dataPriv.get(dataHolder, delegateType);
if (!attaches) {
if (document2.documentMode) {
this.addEventListener(delegateType, focusMappedHandler);
} else {
doc2.addEventListener(type, focusMappedHandler, true);
}
}
dataPriv.set(dataHolder, delegateType, (attaches || 0) + 1);
},
teardown: function() {
var doc2 = this.ownerDocument || this.document || this, dataHolder = document2.documentMode ? this : doc2, attaches = dataPriv.get(dataHolder, delegateType) - 1;
if (!attaches) {
if (document2.documentMode) {
this.removeEventListener(delegateType, focusMappedHandler);
} else {
doc2.removeEventListener(type, focusMappedHandler, true);
}
dataPriv.remove(dataHolder, delegateType);
} else {
dataPriv.set(dataHolder, delegateType, attaches);
}
}
};
});
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout",
pointerenter: "pointerover",
pointerleave: "pointerout"
}, function(orig, fix) {
jQuery.event.special[orig] = {
delegateType: fix,
bindType: fix,
handle: function(event) {
var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj;
if (!related || related !== target && !jQuery.contains(target, related)) {
event.type = handleObj.origType;
ret = handleObj.handler.apply(this, arguments);
event.type = fix;
}
return ret;
}
};
});
jQuery.fn.extend({
on: function(types, selector, data, fn2) {
return on(this, types, selector, data, fn2);
},
one: function(types, selector, data, fn2) {
return on(this, types, selector, data, fn2, 1);
},
off: function(types, selector, fn2) {
var handleObj, type;
if (types && types.preventDefault && types.handleObj) {
handleObj = types.handleObj;
jQuery(types.delegateTarget).off(
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
handleObj.selector,
handleObj.handler
);
return this;
}
if (typeof types === "object") {
for (type in types) {
this.off(type, selector, types[type]);
}
return this;
}
if (selector === false || typeof selector === "function") {
fn2 = selector;
selector = void 0;
}
if (fn2 === false) {
fn2 = returnFalse;
}
return this.each(function() {
jQuery.event.remove(this, types, fn2, selector);
});
}
});
var rnoInnerhtml = /<script|<style|<link/i, rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g;
function manipulationTarget(elem, content) {
if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) {
return jQuery(elem).children("tbody")[0] || elem;
}
return elem;
}
function disableScript(elem) {
elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
return elem;
}
function restoreScript(elem) {
if ((elem.type || "").slice(0, 5) === "true/") {
elem.type = elem.type.slice(5);
} else {
elem.removeAttribute("type");
}
return elem;
}
function cloneCopyEvent(src, dest) {
var i, l, type, pdataOld, udataOld, udataCur, events;
if (dest.nodeType !== 1) {
return;
}
if (dataPriv.hasData(src)) {
pdataOld = dataPriv.get(src);
events = pdataOld.events;
if (events) {
dataPriv.remove(dest, "handle events");
for (type in events) {
for (i = 0, l = events[type].length; i < l; i++) {
jQuery.event.add(dest, type, events[type][i]);
}
}
}
}
if (dataUser.hasData(src)) {
udataOld = dataUser.access(src);
udataCur = jQuery.extend({}, udataOld);
dataUser.set(dest, udataCur);
}
}
function fixInput(src, dest) {
var nodeName2 = dest.nodeName.toLowerCase();
if (nodeName2 === "input" && rcheckableType.test(src.type)) {
dest.checked = src.checked;
} else if (nodeName2 === "input" || nodeName2 === "textarea") {
dest.defaultValue = src.defaultValue;
}
}
function domManip(collection, args, callback, ignored) {
args = flat(args);
var fragment, first, scripts, hasScripts, node, doc2, i = 0, l = collection.length, iNoClone = l - 1, value = args[0], valueIsFunction = isFunction(value);
if (valueIsFunction || l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) {
return collection.each(function(index) {
var self2 = collection.eq(index);
if (valueIsFunction) {
args[0] = value.call(this, index, self2.html());
}
domManip(self2, args, callback, ignored);
});
}
if (l) {
fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);
first = fragment.firstChild;
if (fragment.childNodes.length === 1) {
fragment = first;
}
if (first || ignored) {
scripts = jQuery.map(getAll(fragment, "script"), disableScript);
hasScripts = scripts.length;
for (; i < l; i++) {
node = fragment;
if (i !== iNoClone) {
node = jQuery.clone(node, true, true);
if (hasScripts) {
jQuery.merge(scripts, getAll(node, "script"));
}
}
callback.call(collection[i], node, i);
}
if (hasScripts) {
doc2 = scripts[scripts.length - 1].ownerDocument;
jQuery.map(scripts, restoreScript);
for (i = 0; i < hasScripts; i++) {
node = scripts[i];
if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc2, node)) {
if (node.src && (node.type || "").toLowerCase() !== "module") {
if (jQuery._evalUrl && !node.noModule) {
jQuery._evalUrl(node.src, {
nonce: node.nonce || node.getAttribute("nonce")
}, doc2);
}
} else {
DOMEval(node.textContent.replace(rcleanScript, ""), node, doc2);
}
}
}
}
}
}
return collection;
}
function remove(elem, selector, keepData) {
var node, nodes = selector ? jQuery.filter(selector, elem) : elem, i = 0;
for (; (node = nodes[i]) != null; i++) {
if (!keepData && node.nodeType === 1) {
jQuery.cleanData(getAll(node));
}
if (node.parentNode) {
if (keepData && isAttached(node)) {
setGlobalEval(getAll(node, "script"));
}
node.parentNode.removeChild(node);
}
}
return elem;
}
jQuery.extend({
htmlPrefilter: function(html) {
return html;
},
clone: function(elem, dataAndEvents, deepDataAndEvents) {
var i, l, srcElements, destElements, clone2 = elem.cloneNode(true), inPage = isAttached(elem);
if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
destElements = getAll(clone2);
srcElements = getAll(elem);
for (i = 0, l = srcElements.length; i < l; i++) {
fixInput(srcElements[i], destElements[i]);
}
}
if (dataAndEvents) {
if (deepDataAndEvents) {
srcElements = srcElements || getAll(elem);
destElements = destElements || getAll(clone2);
for (i = 0, l = srcElements.length; i < l; i++) {
cloneCopyEvent(srcElements[i], destElements[i]);
}
} else {
cloneCopyEvent(elem, clone2);
}
}
destElements = getAll(clone2, "script");
if (destElements.length > 0) {
setGlobalEval(destElements, !inPage && getAll(elem, "script"));
}
return clone2;
},
cleanData: function(elems) {
var data, elem, type, special = jQuery.event.special, i = 0;
for (; (elem = elems[i]) !== void 0; i++) {
if (acceptData(elem)) {
if (data = elem[dataPriv.expando]) {
if (data.events) {
for (type in data.events) {
if (special[type]) {
jQuery.event.remove(elem, type);
} else {
jQuery.removeEvent(elem, type, data.handle);
}
}
}
elem[dataPriv.expando] = void 0;
}
if (elem[dataUser.expando]) {
elem[dataUser.expando] = void 0;
}
}
}
}
});
jQuery.fn.extend({
detach: function(selector) {
return remove(this, selector, true);
},
remove: function(selector) {
return remove(this, selector);
},
text: function(value) {
return access(this, function(value2) {
return value2 === void 0 ? jQuery.text(this) : this.empty().each(function() {
if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
this.textContent = value2;
}
});
}, null, value, arguments.length);
},
append: function() {
return domManip(this, arguments, function(elem) {
if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
var target = manipulationTarget(this, elem);
target.appendChild(elem);
}
});
},
prepend: function() {
return domManip(this, arguments, function(elem) {
if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
var target = manipulationTarget(this, elem);
target.insertBefore(elem, target.firstChild);
}
});
},
before: function() {
return domManip(this, arguments, function(elem) {
if (this.parentNode) {
this.parentNode.insertBefore(elem, this);
}
});
},
after: function() {
return domManip(this, arguments, function(elem) {
if (this.parentNode) {
this.parentNode.insertBefore(elem, this.nextSibling);
}
});
},
empty: function() {
var elem, i = 0;
for (; (elem = this[i]) != null; i++) {
if (elem.nodeType === 1) {
jQuery.cleanData(getAll(elem, false));
elem.textContent = "";
}
}
return this;
},
clone: function(dataAndEvents, deepDataAndEvents) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map(function() {
return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
});
},
html: function(value) {
return access(this, function(value2) {
var elem = this[0] || {}, i = 0, l = this.length;
if (value2 === void 0 && elem.nodeType === 1) {
return elem.innerHTML;
}
if (typeof value2 === "string" && !rnoInnerhtml.test(value2) && !wrapMap[(rtagName.exec(value2) || ["", ""])[1].toLowerCase()]) {
value2 = jQuery.htmlPrefilter(value2);
try {
for (; i < l; i++) {
elem = this[i] || {};
if (elem.nodeType === 1) {
jQuery.cleanData(getAll(elem, false));
elem.innerHTML = value2;
}
}
elem = 0;
} catch (e) {
}
}
if (elem) {
this.empty().append(value2);
}
}, null, value, arguments.length);
},
replaceWith: function() {
var ignored = [];
return domManip(this, arguments, function(elem) {
var parent = this.parentNode;
if (jQuery.inArray(this, ignored) < 0) {
jQuery.cleanData(getAll(this));
if (parent) {
parent.replaceChild(elem, this);
}
}
}, ignored);
}
});
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function(name, original) {
jQuery.fn[name] = function(selector) {
var elems, ret = [], insert = jQuery(selector), last = insert.length - 1, i = 0;
for (; i <= last; i++) {
elems = i === last ? this : this.clone(true);
jQuery(insert[i])[original](elems);
push.apply(ret, elems.get());
}
return this.pushStack(ret);
};
});
var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
var rcustomProp = /^--/;
var getStyles = function(elem) {
var view = elem.ownerDocument.defaultView;
if (!view || !view.opener) {
view = window2;
}
return view.getComputedStyle(elem);
};
var swap = function(elem, options, callback) {
var ret, name, old = {};
for (name in options) {
old[name] = elem.style[name];
elem.style[name] = options[name];
}
ret = callback.call(elem);
for (name in options) {
elem.style[name] = old[name];
}
return ret;
};
var rboxStyle = new RegExp(cssExpand.join("|"), "i");
(function() {
function computeStyleTests() {
if (!div) {
return;
}
container.style.cssText = "position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0";
div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%";
documentElement.appendChild(container).appendChild(div);
var divStyle = window2.getComputedStyle(div);
pixelPositionVal = divStyle.top !== "1%";
reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;
div.style.right = "60%";
pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;
boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;
div.style.position = "absolute";
scrollboxSizeVal = roundPixelMeasures(div.offsetWidth / 3) === 12;
documentElement.removeChild(container);
div = null;
}
function roundPixelMeasures(measure) {
return Math.round(parseFloat(measure));
}
var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, reliableTrDimensionsVal, reliableMarginLeftVal, container = document2.createElement("div"), div = document2.createElement("div");
if (!div.style) {
return;
}
div.style.backgroundClip = "content-box";
div.cloneNode(true).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box";
jQuery.extend(support, {
boxSizingReliable: function() {
computeStyleTests();
return boxSizingReliableVal;
},
pixelBoxStyles: function() {
computeStyleTests();
return pixelBoxStylesVal;
},
pixelPosition: function() {
computeStyleTests();
return pixelPositionVal;
},
reliableMarginLeft: function() {
computeStyleTests();
return reliableMarginLeftVal;
},
scrollboxSize: function() {
computeStyleTests();
return scrollboxSizeVal;
},
// Support: IE 9 - 11+, Edge 15 - 18+
// IE/Edge misreport `getComputedStyle` of table rows with width/height
// set in CSS while `offset*` properties report correct values.
// Behavior in IE 9 is more subtle than in newer versions & it passes
// some versions of this test; make sure not to make it pass there!
//
// Support: Firefox 70+
// Only Firefox includes border widths
// in computed dimensions. (gh-4529)
reliableTrDimensions: function() {
var table, tr, trChild, trStyle;
if (reliableTrDimensionsVal == null) {
table = document2.createElement("table");
tr = document2.createElement("tr");
trChild = document2.createElement("div");
table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate";
tr.style.cssText = "box-sizing:content-box;border:1px solid";
tr.style.height = "1px";
trChild.style.height = "9px";
trChild.style.display = "block";
documentElement.appendChild(table).appendChild(tr).appendChild(trChild);
trStyle = window2.getComputedStyle(tr);
reliableTrDimensionsVal = parseInt(trStyle.height, 10) + parseInt(trStyle.borderTopWidth, 10) + parseInt(trStyle.borderBottomWidth, 10) === tr.offsetHeight;
documentElement.removeChild(table);
}
return reliableTrDimensionsVal;
}
});
})();
function curCSS(elem, name, computed) {
var width, minWidth, maxWidth, ret, isCustomProp = rcustomProp.test(name), style = elem.style;
computed = computed || getStyles(elem);
if (computed) {
ret = computed.getPropertyValue(name) || computed[name];
if (isCustomProp && ret) {
ret = ret.replace(rtrimCSS, "$1") || void 0;
}
if (ret === "" && !isAttached(elem)) {
ret = jQuery.style(elem, name);
}
if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {
width = style.width;
minWidth = style.minWidth;
maxWidth = style.maxWidth;
style.minWidth = style.maxWidth = style.width = ret;
ret = computed.width;
style.width = width;
style.minWidth = minWidth;
style.maxWidth = maxWidth;
}
}
return ret !== void 0 ? (
// Support: IE <=9 - 11 only
// IE returns zIndex value as an integer.
ret + ""
) : ret;
}
function addGetHookIf(conditionFn, hookFn) {
return {
get: function() {
if (conditionFn()) {
delete this.get;
return;
}
return (this.get = hookFn).apply(this, arguments);
}
};
}
var cssPrefixes = ["Webkit", "Moz", "ms"], emptyStyle = document2.createElement("div").style, vendorProps = {};
function vendorPropName(name) {
var capName = name[0].toUpperCase() + name.slice(1), i = cssPrefixes.length;
while (i--) {
name = cssPrefixes[i] + capName;
if (name in emptyStyle) {
return name;
}
}
}
function finalPropName(name) {
var final = jQuery.cssProps[name] || vendorProps[name];
if (final) {
return final;
}
if (name in emptyStyle) {
return name;
}
return vendorProps[name] = vendorPropName(name) || name;
}
var rdisplayswap = /^(none|table(?!-c[ea]).+)/, cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssNormalTransform = {
letterSpacing: "0",
fontWeight: "400"
};
function setPositiveNumber(_elem, value, subtract) {
var matches = rcssNum.exec(value);
return matches ? (
// Guard against undefined "subtract", e.g., when used as in cssHooks
Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px")
) : value;
}
function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {
var i = dimension === "width" ? 1 : 0, extra = 0, delta = 0, marginDelta = 0;
if (box === (isBorderBox ? "border" : "content")) {
return 0;
}
for (; i < 4; i += 2) {
if (box === "margin") {
marginDelta += jQuery.css(elem, box + cssExpand[i], true, styles);
}
if (!isBorderBox) {
delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
if (box !== "padding") {
delta += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
} else {
extra += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
}
} else {
if (box === "content") {
delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles);
}
if (box !== "margin") {
delta -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
}
}
}
if (!isBorderBox && computedVal >= 0) {
delta += Math.max(0, Math.ceil(
elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5
// If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
// Use an explicit zero to avoid NaN (gh-3964)
)) || 0;
}
return delta + marginDelta;
}
function getWidthOrHeight(elem, dimension, extra) {
var styles = getStyles(elem), boxSizingNeeded = !support.boxSizingReliable() || extra, isBorderBox = boxSizingNeeded && jQuery.css(elem, "boxSizing", false, styles) === "border-box", valueIsBorderBox = isBorderBox, val = curCSS(elem, dimension, styles), offsetProp = "offset" + dimension[0].toUpperCase() + dimension.slice(1);
if (rnumnonpx.test(val)) {
if (!extra) {
return val;
}
val = "auto";
}
if ((!support.boxSizingReliable() && isBorderBox || // Support: IE 10 - 11+, Edge 15 - 18+
// IE/Edge misreport `getComputedStyle` of table rows with width/height
// set in CSS while `offset*` properties report correct values.
// Interestingly, in some cases IE 9 doesn't suffer from this issue.
!support.reliableTrDimensions() && nodeName(elem, "tr") || // Fall back to offsetWidth/offsetHeight when value is "auto"
// This happens for inline elements with no explicit setting (gh-3571)
val === "auto" || // Support: Android <=4.1 - 4.3 only
// Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
!parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") && // Make sure the element is visible & connected
elem.getClientRects().length) {
isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box";
valueIsBorderBox = offsetProp in elem;
if (valueIsBorderBox) {
val = elem[offsetProp];
}
}
val = parseFloat(val) || 0;
return val + boxModelAdjustment(
elem,
dimension,
extra || (isBorderBox ? "border" : "content"),
valueIsBorderBox,
styles,
// Provide the current computed size to request scroll gutter calculation (gh-3589)
val
) + "px";
}
jQuery.extend({
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks: {
opacity: {
get: function(elem, computed) {
if (computed) {
var ret = curCSS(elem, "opacity");
return ret === "" ? "1" : ret;
}
}
}
},
// Don't automatically add "px" to these possibly-unitless properties
cssNumber: {
animationIterationCount: true,
aspectRatio: true,
borderImageSlice: true,
columnCount: true,
flexGrow: true,
flexShrink: true,
fontWeight: true,
gridArea: true,
gridColumn: true,
gridColumnEnd: true,
gridColumnStart: true,
gridRow: true,
gridRowEnd: true,
gridRowStart: true,
lineHeight: true,
opacity: true,
order: true,
orphans: true,
scale: true,
widows: true,
zIndex: true,
zoom: true,
// SVG-related
fillOpacity: true,
floodOpacity: true,
stopOpacity: true,
strokeMiterlimit: true,
strokeOpacity: true
},
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {},
// Get and set the style property on a DOM Node
style: function(elem, name, value, extra) {
if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
return;
}
var ret, type, hooks, origName = camelCase(name), isCustomProp = rcustomProp.test(name), style = elem.style;
if (!isCustomProp) {
name = finalPropName(origName);
}
hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
if (value !== void 0) {
type = typeof value;
if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) {
value = adjustCSS(elem, name, ret);
type = "number";
}
if (value == null || value !== value) {
return;
}
if (type === "number" && !isCustomProp) {
value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px");
}
if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
style[name] = "inherit";
}
if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== void 0) {
if (isCustomProp) {
style.setProperty(name, value);
} else {
style[name] = value;
}
}
} else {
if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== void 0) {
return ret;
}
return style[name];
}
},
css: function(elem, name, extra, styles) {
var val, num, hooks, origName = camelCase(name), isCustomProp = rcustomProp.test(name);
if (!isCustomProp) {
name = finalPropName(origName);
}
hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
if (hooks && "get" in hooks) {
val = hooks.get(elem, true, extra);
}
if (val === void 0) {
val = curCSS(elem, name, styles);
}
if (val === "normal" && name in cssNormalTransform) {
val = cssNormalTransform[name];
}
if (extra === "" || extra) {
num = parseFloat(val);
return extra === true || isFinite(num) ? num || 0 : val;
}
return val;
}
});
jQuery.each(["height", "width"], function(_i, dimension) {
jQuery.cssHooks[dimension] = {
get: function(elem, computed, extra) {
if (computed) {
return rdisplayswap.test(jQuery.css(elem, "display")) && // Support: Safari 8+
// Table columns in Safari have non-zero offsetWidth & zero
// getBoundingClientRect().width unless display is changed.
// Support: IE <=11 only
// Running getBoundingClientRect on a disconnected node
// in IE throws an error.
(!elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function() {
return getWidthOrHeight(elem, dimension, extra);
}) : getWidthOrHeight(elem, dimension, extra);
}
},
set: function(elem, value, extra) {
var matches, styles = getStyles(elem), scrollboxSizeBuggy = !support.scrollboxSize() && styles.position === "absolute", boxSizingNeeded = scrollboxSizeBuggy || extra, isBorderBox = boxSizingNeeded && jQuery.css(elem, "boxSizing", false, styles) === "border-box", subtract = extra ? boxModelAdjustment(
elem,
dimension,
extra,
isBorderBox,
styles
) : 0;
if (isBorderBox && scrollboxSizeBuggy) {
subtract -= Math.ceil(
elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5
);
}
if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") {
elem.style[dimension] = value;
value = jQuery.css(elem, dimension);
}
return setPositiveNumber(elem, value, subtract);
}
};
});
jQuery.cssHooks.marginLeft = addGetHookIf(
support.reliableMarginLeft,
function(elem, computed) {
if (computed) {
return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function() {
return elem.getBoundingClientRect().left;
})) + "px";
}
}
);
jQuery.each({
margin: "",
padding: "",
border: "Width"
}, function(prefix, suffix) {
jQuery.cssHooks[prefix + suffix] = {
expand: function(value) {
var i = 0, expanded = {}, parts = typeof value === "string" ? value.split(" ") : [value];
for (; i < 4; i++) {
expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0];
}
return expanded;
}
};
if (prefix !== "margin") {
jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
}
});
jQuery.fn.extend({
css: function(name, value) {
return access(this, function(elem, name2, value2) {
var styles, len, map = {}, i = 0;
if (Array.isArray(name2)) {
styles = getStyles(elem);
len = name2.length;
for (; i < len; i++) {
map[name2[i]] = jQuery.css(elem, name2[i], false, styles);
}
return map;
}
return value2 !== void 0 ? jQuery.style(elem, name2, value2) : jQuery.css(elem, name2);
}, name, value, arguments.length > 1);
}
});
function Tween(elem, options, prop, end2, easing) {
return new Tween.prototype.init(elem, options, prop, end2, easing);
}
jQuery.Tween = Tween;
Tween.prototype = {
constructor: Tween,
init: function(elem, options, prop, end2, easing, unit) {
this.elem = elem;
this.prop = prop;
this.easing = easing || jQuery.easing._default;
this.options = options;
this.start = this.now = this.cur();
this.end = end2;
this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
},
cur: function() {
var hooks = Tween.propHooks[this.prop];
return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this);
},
run: function(percent) {
var eased, hooks = Tween.propHooks[this.prop];
if (this.options.duration) {
this.pos = eased = jQuery.easing[this.easing](
percent,
this.options.duration * percent,
0,
1,
this.options.duration
);
} else {
this.pos = eased = percent;
}
this.now = (this.end - this.start) * eased + this.start;
if (this.options.step) {
this.options.step.call(this.elem, this.now, this);
}
if (hooks && hooks.set) {
hooks.set(this);
} else {
Tween.propHooks._default.set(this);
}
return this;
}
};
Tween.prototype.init.prototype = Tween.prototype;
Tween.propHooks = {
_default: {
get: function(tween) {
var result;
if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {
return tween.elem[tween.prop];
}
result = jQuery.css(tween.elem, tween.prop, "");
return !result || result === "auto" ? 0 : result;
},
set: function(tween) {
if (jQuery.fx.step[tween.prop]) {
jQuery.fx.step[tween.prop](tween);
} else if (tween.elem.nodeType === 1 && (jQuery.cssHooks[tween.prop] || tween.elem.style[finalPropName(tween.prop)] != null)) {
jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
} else {
tween.elem[tween.prop] = tween.now;
}
}
}
};
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
set: function(tween) {
if (tween.elem.nodeType && tween.elem.parentNode) {
tween.elem[tween.prop] = tween.now;
}
}
};
jQuery.easing = {
linear: function(p) {
return p;
},
swing: function(p) {
return 0.5 - Math.cos(p * Math.PI) / 2;
},
_default: "swing"
};
jQuery.fx = Tween.prototype.init;
jQuery.fx.step = {};
var fxNow, inProgress, rfxtypes = /^(?:toggle|show|hide)$/, rrun = /queueHooks$/;
function schedule() {
if (inProgress) {
if (document2.hidden === false && window2.requestAnimationFrame) {
window2.requestAnimationFrame(schedule);
} else {
window2.setTimeout(schedule, jQuery.fx.interval);
}
jQuery.fx.tick();
}
}
function createFxNow() {
window2.setTimeout(function() {
fxNow = void 0;
});
return fxNow = Date.now();
}
function genFx(type, includeWidth) {
var which, i = 0, attrs = { height: type };
includeWidth = includeWidth ? 1 : 0;
for (; i < 4; i += 2 - includeWidth) {
which = cssExpand[i];
attrs["margin" + which] = attrs["padding" + which] = type;
}
if (includeWidth) {
attrs.opacity = attrs.width = type;
}
return attrs;
}
function createTween(value, prop, animation) {
var tween, collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]), index = 0, length = collection.length;
for (; index < length; index++) {
if (tween = collection[index].call(animation, prop, value)) {
return tween;
}
}
}
function defaultPrefilter(elem, props, opts) {
var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, isBox = "width" in props || "height" in props, anim = this, orig = {}, style = elem.style, hidden = elem.nodeType && isHiddenWithinTree(elem), dataShow = dataPriv.get(elem, "fxshow");
if (!opts.queue) {
hooks = jQuery._queueHooks(elem, "fx");
if (hooks.unqueued == null) {
hooks.unqueued = 0;
oldfire = hooks.empty.fire;
hooks.empty.fire = function() {
if (!hooks.unqueued) {
oldfire();
}
};
}
hooks.unqueued++;
anim.always(function() {
anim.always(function() {
hooks.unqueued--;
if (!jQuery.queue(elem, "fx").length) {
hooks.empty.fire();
}
});
});
}
for (prop in props) {
value = props[prop];
if (rfxtypes.test(value)) {
delete props[prop];
toggle = toggle || value === "toggle";
if (value === (hidden ? "hide" : "show")) {
if (value === "show" && dataShow && dataShow[prop] !== void 0) {
hidden = true;
} else {
continue;
}
}
orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
}
}
propTween = !jQuery.isEmptyObject(props);
if (!propTween && jQuery.isEmptyObject(orig)) {
return;
}
if (isBox && elem.nodeType === 1) {
opts.overflow = [style.overflow, style.overflowX, style.overflowY];
restoreDisplay = dataShow && dataShow.display;
if (restoreDisplay == null) {
restoreDisplay = dataPriv.get(elem, "display");
}
display = jQuery.css(elem, "display");
if (display === "none") {
if (restoreDisplay) {
display = restoreDisplay;
} else {
showHide([elem], true);
restoreDisplay = elem.style.display || restoreDisplay;
display = jQuery.css(elem, "display");
showHide([elem]);
}
}
if (display === "inline" || display === "inline-block" && restoreDisplay != null) {
if (jQuery.css(elem, "float") === "none") {
if (!propTween) {
anim.done(function() {
style.display = restoreDisplay;
});
if (restoreDisplay == null) {
display = style.display;
restoreDisplay = display === "none" ? "" : display;
}
}
style.display = "inline-block";
}
}
}
if (opts.overflow) {
style.overflow = "hidden";
anim.always(function() {
style.overflow = opts.overflow[0];
style.overflowX = opts.overflow[1];
style.overflowY = opts.overflow[2];
});
}
propTween = false;
for (prop in orig) {
if (!propTween) {
if (dataShow) {
if ("hidden" in dataShow) {
hidden = dataShow.hidden;
}
} else {
dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay });
}
if (toggle) {
dataShow.hidden = !hidden;
}
if (hidden) {
showHide([elem], true);
}
anim.done(function() {
if (!hidden) {
showHide([elem]);
}
dataPriv.remove(elem, "fxshow");
for (prop in orig) {
jQuery.style(elem, prop, orig[prop]);
}
});
}
propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
if (!(prop in dataShow)) {
dataShow[prop] = propTween.start;
if (hidden) {
propTween.end = propTween.start;
propTween.start = 0;
}
}
}
}
function propFilter(props, specialEasing) {
var index, name, easing, value, hooks;
for (index in props) {
name = camelCase(index);
easing = specialEasing[name];
value = props[index];
if (Array.isArray(value)) {
easing = value[1];
value = props[index] = value[0];
}
if (index !== name) {
props[name] = value;
delete props[index];
}
hooks = jQuery.cssHooks[name];
if (hooks && "expand" in hooks) {
value = hooks.expand(value);
delete props[name];
for (index in value) {
if (!(index in props)) {
props[index] = value[index];
specialEasing[index] = easing;
}
}
} else {
specialEasing[name] = easing;
}
}
}
function Animation(elem, properties, options) {
var result, stopped, index = 0, length = Animation.prefilters.length, deferred = jQuery.Deferred().always(function() {
delete tick.elem;
}), tick = function() {
if (stopped) {
return false;
}
var currentTime = fxNow || createFxNow(), remaining = Math.max(0, animation.startTime + animation.duration - currentTime), temp = remaining / animation.duration || 0, percent = 1 - temp, index2 = 0, length2 = animation.tweens.length;
for (; index2 < length2; index2++) {
animation.tweens[index2].run(percent);
}
deferred.notifyWith(elem, [animation, percent, remaining]);
if (percent < 1 && length2) {
return remaining;
}
if (!length2) {
deferred.notifyWith(elem, [animation, 1, 0]);
}
deferred.resolveWith(elem, [animation]);
return false;
}, animation = deferred.promise({
elem,
props: jQuery.extend({}, properties),
opts: jQuery.extend(true, {
specialEasing: {},
easing: jQuery.easing._default
}, options),
originalProperties: properties,
originalOptions: options,
startTime: fxNow || createFxNow(),
duration: options.duration,
tweens: [],
createTween: function(prop, end2) {
var tween = jQuery.Tween(
elem,
animation.opts,
prop,
end2,
animation.opts.specialEasing[prop] || animation.opts.easing
);
animation.tweens.push(tween);
return tween;
},
stop: function(gotoEnd) {
var index2 = 0, length2 = gotoEnd ? animation.tweens.length : 0;
if (stopped) {
return this;
}
stopped = true;
for (; index2 < length2; index2++) {
animation.tweens[index2].run(1);
}
if (gotoEnd) {
deferred.notifyWith(elem, [animation, 1, 0]);
deferred.resolveWith(elem, [animation, gotoEnd]);
} else {
deferred.rejectWith(elem, [animation, gotoEnd]);
}
return this;
}
}), props = animation.props;
propFilter(props, animation.opts.specialEasing);
for (; index < length; index++) {
result = Animation.prefilters[index].call(animation, elem, props, animation.opts);
if (result) {
if (isFunction(result.stop)) {
jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result);
}
return result;
}
}
jQuery.map(props, createTween, animation);
if (isFunction(animation.opts.start)) {
animation.opts.start.call(elem, animation);
}
animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);
jQuery.fx.timer(
jQuery.extend(tick, {
elem,
anim: animation,
queue: animation.opts.queue
})
);
return animation;
}
jQuery.Animation = jQuery.extend(Animation, {
tweeners: {
"*": [function(prop, value) {
var tween = this.createTween(prop, value);
adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
return tween;
}]
},
tweener: function(props, callback) {
if (isFunction(props)) {
callback = props;
props = ["*"];
} else {
props = props.match(rnothtmlwhite);
}
var prop, index = 0, length = props.length;
for (; index < length; index++) {
prop = props[index];
Animation.tweeners[prop] = Animation.tweeners[prop] || [];
Animation.tweeners[prop].unshift(callback);
}
},
prefilters: [defaultPrefilter],
prefilter: function(callback, prepend) {
if (prepend) {
Animation.prefilters.unshift(callback);
} else {
Animation.prefilters.push(callback);
}
}
});
jQuery.speed = function(speed, easing, fn2) {
var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
complete: fn2 || !fn2 && easing || isFunction(speed) && speed,
duration: speed,
easing: fn2 && easing || easing && !isFunction(easing) && easing
};
if (jQuery.fx.off) {
opt.duration = 0;
} else {
if (typeof opt.duration !== "number") {
if (opt.duration in jQuery.fx.speeds) {
opt.duration = jQuery.fx.speeds[opt.duration];
} else {
opt.duration = jQuery.fx.speeds._default;
}
}
}
if (opt.queue == null || opt.queue === true) {
opt.queue = "fx";
}
opt.old = opt.complete;
opt.complete = function() {
if (isFunction(opt.old)) {
opt.old.call(this);
}
if (opt.queue) {
jQuery.dequeue(this, opt.queue);
}
};
return opt;
};
jQuery.fn.extend({
fadeTo: function(speed, to, easing, callback) {
return this.filter(isHiddenWithinTree).css("opacity", 0).show().end().animate({ opacity: to }, speed, easing, callback);
},
animate: function(prop, speed, easing, callback) {
var empty = jQuery.isEmptyObject(prop), optall = jQuery.speed(speed, easing, callback), doAnimation = function() {
var anim = Animation(this, jQuery.extend({}, prop), optall);
if (empty || dataPriv.get(this, "finish")) {
anim.stop(true);
}
};
doAnimation.finish = doAnimation;
return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation);
},
stop: function(type, clearQueue, gotoEnd) {
var stopQueue = function(hooks) {
var stop = hooks.stop;
delete hooks.stop;
stop(gotoEnd);
};
if (typeof type !== "string") {
gotoEnd = clearQueue;
clearQueue = type;
type = void 0;
}
if (clearQueue) {
this.queue(type || "fx", []);
}
return this.each(function() {
var dequeue = true, index = type != null && type + "queueHooks", timers = jQuery.timers, data = dataPriv.get(this);
if (index) {
if (data[index] && data[index].stop) {
stopQueue(data[index]);
}
} else {
for (index in data) {
if (data[index] && data[index].stop && rrun.test(index)) {
stopQueue(data[index]);
}
}
}
for (index = timers.length; index--; ) {
if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
timers[index].anim.stop(gotoEnd);
dequeue = false;
timers.splice(index, 1);
}
}
if (dequeue || !gotoEnd) {
jQuery.dequeue(this, type);
}
});
},
finish: function(type) {
if (type !== false) {
type = type || "fx";
}
return this.each(function() {
var index, data = dataPriv.get(this), queue = data[type + "queue"], hooks = data[type + "queueHooks"], timers = jQuery.timers, length = queue ? queue.length : 0;
data.finish = true;
jQuery.queue(this, type, []);
if (hooks && hooks.stop) {
hooks.stop.call(this, true);
}
for (index = timers.length; index--; ) {
if (timers[index].elem === this && timers[index].queue === type) {
timers[index].anim.stop(true);
timers.splice(index, 1);
}
}
for (index = 0; index < length; index++) {
if (queue[index] && queue[index].finish) {
queue[index].finish.call(this);
}
}
delete data.finish;
});
}
});
jQuery.each(["toggle", "show", "hide"], function(_i, name) {
var cssFn = jQuery.fn[name];
jQuery.fn[name] = function(speed, easing, callback) {
return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback);
};
});
jQuery.each({
slideDown: genFx("show"),
slideUp: genFx("hide"),
slideToggle: genFx("toggle"),
fadeIn: { opacity: "show" },
fadeOut: { opacity: "hide" },
fadeToggle: { opacity: "toggle" }
}, function(name, props) {
jQuery.fn[name] = function(speed, easing, callback) {
return this.animate(props, speed, easing, callback);
};
});
jQuery.timers = [];
jQuery.fx.tick = function() {
var timer, i = 0, timers = jQuery.timers;
fxNow = Date.now();
for (; i < timers.length; i++) {
timer = timers[i];
if (!timer() && timers[i] === timer) {
timers.splice(i--, 1);
}
}
if (!timers.length) {
jQuery.fx.stop();
}
fxNow = void 0;
};
jQuery.fx.timer = function(timer) {
jQuery.timers.push(timer);
jQuery.fx.start();
};
jQuery.fx.interval = 13;
jQuery.fx.start = function() {
if (inProgress) {
return;
}
inProgress = true;
schedule();
};
jQuery.fx.stop = function() {
inProgress = null;
};
jQuery.fx.speeds = {
slow: 600,
fast: 200,
// Default speed
_default: 400
};
jQuery.fn.delay = function(time, type) {
time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
type = type || "fx";
return this.queue(type, function(next, hooks) {
var timeout = window2.setTimeout(next, time);
hooks.stop = function() {
window2.clearTimeout(timeout);
};
});
};
(function() {
var input = document2.createElement("input"), select = document2.createElement("select"), opt = select.appendChild(document2.createElement("option"));
input.type = "checkbox";
support.checkOn = input.value !== "";
support.optSelected = opt.selected;
input = document2.createElement("input");
input.value = "t";
input.type = "radio";
support.radioValue = input.value === "t";
})();
var boolHook, attrHandle = jQuery.expr.attrHandle;
jQuery.fn.extend({
attr: function(name, value) {
return access(this, jQuery.attr, name, value, arguments.length > 1);
},
removeAttr: function(name) {
return this.each(function() {
jQuery.removeAttr(this, name);
});
}
});
jQuery.extend({
attr: function(elem, name, value) {
var ret, hooks, nType = elem.nodeType;
if (nType === 3 || nType === 8 || nType === 2) {
return;
}
if (typeof elem.getAttribute === "undefined") {
return jQuery.prop(elem, name, value);
}
if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
hooks = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : void 0);
}
if (value !== void 0) {
if (value === null) {
jQuery.removeAttr(elem, name);
return;
}
if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== void 0) {
return ret;
}
elem.setAttribute(name, value + "");
return value;
}
if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
return ret;
}
ret = jQuery.find.attr(elem, name);
return ret == null ? void 0 : ret;
},
attrHooks: {
type: {
set: function(elem, value) {
if (!support.radioValue && value === "radio" && nodeName(elem, "input")) {
var val = elem.value;
elem.setAttribute("type", value);
if (val) {
elem.value = val;
}
return value;
}
}
}
},
removeAttr: function(elem, value) {
var name, i = 0, attrNames = value && value.match(rnothtmlwhite);
if (attrNames && elem.nodeType === 1) {
while (name = attrNames[i++]) {
elem.removeAttribute(name);
}
}
}
});
boolHook = {
set: function(elem, value, name) {
if (value === false) {
jQuery.removeAttr(elem, name);
} else {
elem.setAttribute(name, name);
}
return name;
}
};
jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function(_i, name) {
var getter = attrHandle[name] || jQuery.find.attr;
attrHandle[name] = function(elem, name2, isXML) {
var ret, handle, lowercaseName = name2.toLowerCase();
if (!isXML) {
handle = attrHandle[lowercaseName];
attrHandle[lowercaseName] = ret;
ret = getter(elem, name2, isXML) != null ? lowercaseName : null;
attrHandle[lowercaseName] = handle;
}
return ret;
};
});
var rfocusable = /^(?:input|select|textarea|button)$/i, rclickable = /^(?:a|area)$/i;
jQuery.fn.extend({
prop: function(name, value) {
return access(this, jQuery.prop, name, value, arguments.length > 1);
},
removeProp: function(name) {
return this.each(function() {
delete this[jQuery.propFix[name] || name];
});
}
});
jQuery.extend({
prop: function(elem, name, value) {
var ret, hooks, nType = elem.nodeType;
if (nType === 3 || nType === 8 || nType === 2) {
return;
}
if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
name = jQuery.propFix[name] || name;
hooks = jQuery.propHooks[name];
}
if (value !== void 0) {
if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== void 0) {
return ret;
}
return elem[name] = value;
}
if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
return ret;
}
return elem[name];
},
propHooks: {
tabIndex: {
get: function(elem) {
var tabindex = jQuery.find.attr(elem, "tabindex");
if (tabindex) {
return parseInt(tabindex, 10);
}
if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) {
return 0;
}
return -1;
}
}
},
propFix: {
"for": "htmlFor",
"class": "className"
}
});
if (!support.optSelected) {
jQuery.propHooks.selected = {
get: function(elem) {
var parent = elem.parentNode;
if (parent && parent.parentNode) {
parent.parentNode.selectedIndex;
}
return null;
},
set: function(elem) {
var parent = elem.parentNode;
if (parent) {
parent.selectedIndex;
if (parent.parentNode) {
parent.parentNode.selectedIndex;
}
}
}
};
}
jQuery.each([
"tabIndex",
"readOnly",
"maxLength",
"cellSpacing",
"cellPadding",
"rowSpan",
"colSpan",
"useMap",
"frameBorder",
"contentEditable"
], function() {
jQuery.propFix[this.toLowerCase()] = this;
});
function stripAndCollapse(value) {
var tokens = value.match(rnothtmlwhite) || [];
return tokens.join(" ");
}
function getClass(elem) {
return elem.getAttribute && elem.getAttribute("class") || "";
}
function classesToArray(value) {
if (Array.isArray(value)) {
return value;
}
if (typeof value === "string") {
return value.match(rnothtmlwhite) || [];
}
return [];
}
jQuery.fn.extend({
addClass: function(value) {
var classNames, cur, curValue, className, i, finalValue;
if (isFunction(value)) {
return this.each(function(j) {
jQuery(this).addClass(value.call(this, j, getClass(this)));
});
}
classNames = classesToArray(value);
if (classNames.length) {
return this.each(function() {
curValue = getClass(this);
cur = this.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
if (cur) {
for (i = 0; i < classNames.length; i++) {
className = classNames[i];
if (cur.indexOf(" " + className + " ") < 0) {
cur += className + " ";
}
}
finalValue = stripAndCollapse(cur);
if (curValue !== finalValue) {
this.setAttribute("class", finalValue);
}
}
});
}
return this;
},
removeClass: function(value) {
var classNames, cur, curValue, className, i, finalValue;
if (isFunction(value)) {
return this.each(function(j) {
jQuery(this).removeClass(value.call(this, j, getClass(this)));
});
}
if (!arguments.length) {
return this.attr("class", "");
}
classNames = classesToArray(value);
if (classNames.length) {
return this.each(function() {
curValue = getClass(this);
cur = this.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
if (cur) {
for (i = 0; i < classNames.length; i++) {
className = classNames[i];
while (cur.indexOf(" " + className + " ") > -1) {
cur = cur.replace(" " + className + " ", " ");
}
}
finalValue = stripAndCollapse(cur);
if (curValue !== finalValue) {
this.setAttribute("class", finalValue);
}
}
});
}
return this;
},
toggleClass: function(value, stateVal) {
var classNames, className, i, self2, type = typeof value, isValidValue = type === "string" || Array.isArray(value);
if (isFunction(value)) {
return this.each(function(i2) {
jQuery(this).toggleClass(
value.call(this, i2, getClass(this), stateVal),
stateVal
);
});
}
if (typeof stateVal === "boolean" && isValidValue) {
return stateVal ? this.addClass(value) : this.removeClass(value);
}
classNames = classesToArray(value);
return this.each(function() {
if (isValidValue) {
self2 = jQuery(this);
for (i = 0; i < classNames.length; i++) {
className = classNames[i];
if (self2.hasClass(className)) {
self2.removeClass(className);
} else {
self2.addClass(className);
}
}
} else if (value === void 0 || type === "boolean") {
className = getClass(this);
if (className) {
dataPriv.set(this, "__className__", className);
}
if (this.setAttribute) {
this.setAttribute(
"class",
className || value === false ? "" : dataPriv.get(this, "__className__") || ""
);
}
}
});
},
hasClass: function(selector) {
var className, elem, i = 0;
className = " " + selector + " ";
while (elem = this[i++]) {
if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) {
return true;
}
}
return false;
}
});
var rreturn = /\r/g;
jQuery.fn.extend({
val: function(value) {
var hooks, ret, valueIsFunction, elem = this[0];
if (!arguments.length) {
if (elem) {
hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== void 0) {
return ret;
}
ret = elem.value;
if (typeof ret === "string") {
return ret.replace(rreturn, "");
}
return ret == null ? "" : ret;
}
return;
}
valueIsFunction = isFunction(value);
return this.each(function(i) {
var val;
if (this.nodeType !== 1) {
return;
}
if (valueIsFunction) {
val = value.call(this, i, jQuery(this).val());
} else {
val = value;
}
if (val == null) {
val = "";
} else if (typeof val === "number") {
val += "";
} else if (Array.isArray(val)) {
val = jQuery.map(val, function(value2) {
return value2 == null ? "" : value2 + "";
});
}
hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === void 0) {
this.value = val;
}
});
}
});
jQuery.extend({
valHooks: {
option: {
get: function(elem) {
var val = jQuery.find.attr(elem, "value");
return val != null ? val : (
// Support: IE <=10 - 11 only
// option.text throws exceptions (trac-14686, trac-14858)
// Strip and collapse whitespace
// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
stripAndCollapse(jQuery.text(elem))
);
}
},
select: {
get: function(elem) {
var value, option, i, options = elem.options, index = elem.selectedIndex, one = elem.type === "select-one", values = one ? null : [], max2 = one ? index + 1 : options.length;
if (index < 0) {
i = max2;
} else {
i = one ? index : 0;
}
for (; i < max2; i++) {
option = options[i];
if ((option.selected || i === index) && // Don't return options that are disabled or in a disabled optgroup
!option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) {
value = jQuery(option).val();
if (one) {
return value;
}
values.push(value);
}
}
return values;
},
set: function(elem, value) {
var optionSet, option, options = elem.options, values = jQuery.makeArray(value), i = options.length;
while (i--) {
option = options[i];
if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) {
optionSet = true;
}
}
if (!optionSet) {
elem.selectedIndex = -1;
}
return values;
}
}
}
});
jQuery.each(["radio", "checkbox"], function() {
jQuery.valHooks[this] = {
set: function(elem, value) {
if (Array.isArray(value)) {
return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1;
}
}
};
if (!support.checkOn) {
jQuery.valHooks[this].get = function(elem) {
return elem.getAttribute("value") === null ? "on" : elem.value;
};
}
});
var location2 = window2.location;
var nonce = { guid: Date.now() };
var rquery = /\?/;
jQuery.parseXML = function(data) {
var xml, parserErrorElem;
if (!data || typeof data !== "string") {
return null;
}
try {
xml = new window2.DOMParser().parseFromString(data, "text/xml");
} catch (e) {
}
parserErrorElem = xml && xml.getElementsByTagName("parsererror")[0];
if (!xml || parserErrorElem) {
jQuery.error("Invalid XML: " + (parserErrorElem ? jQuery.map(parserErrorElem.childNodes, function(el) {
return el.textContent;
}).join("\n") : data));
}
return xml;
};
var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, stopPropagationCallback = function(e) {
e.stopPropagation();
};
jQuery.extend(jQuery.event, {
trigger: function(event, data, elem, onlyHandlers) {
var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, eventPath = [elem || document2], type = hasOwn.call(event, "type") ? event.type : event, namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
cur = lastElement = tmp = elem = elem || document2;
if (elem.nodeType === 3 || elem.nodeType === 8) {
return;
}
if (rfocusMorph.test(type + jQuery.event.triggered)) {
return;
}
if (type.indexOf(".") > -1) {
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
ontype = type.indexOf(":") < 0 && "on" + type;
event = event[jQuery.expando] ? event : new jQuery.Event(type, typeof event === "object" && event);
event.isTrigger = onlyHandlers ? 2 : 3;
event.namespace = namespaces.join(".");
event.rnamespace = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
event.result = void 0;
if (!event.target) {
event.target = elem;
}
data = data == null ? [event] : jQuery.makeArray(data, [event]);
special = jQuery.event.special[type] || {};
if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
return;
}
if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {
bubbleType = special.delegateType || type;
if (!rfocusMorph.test(bubbleType + type)) {
cur = cur.parentNode;
}
for (; cur; cur = cur.parentNode) {
eventPath.push(cur);
tmp = cur;
}
if (tmp === (elem.ownerDocument || document2)) {
eventPath.push(tmp.defaultView || tmp.parentWindow || window2);
}
}
i = 0;
while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
lastElement = cur;
event.type = i > 1 ? bubbleType : special.bindType || type;
handle = (dataPriv.get(cur, "events") || /* @__PURE__ */ Object.create(null))[event.type] && dataPriv.get(cur, "handle");
if (handle) {
handle.apply(cur, data);
}
handle = ontype && cur[ontype];
if (handle && handle.apply && acceptData(cur)) {
event.result = handle.apply(cur, data);
if (event.result === false) {
event.preventDefault();
}
}
}
event.type = type;
if (!onlyHandlers && !event.isDefaultPrevented()) {
if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {
if (ontype && isFunction(elem[type]) && !isWindow(elem)) {
tmp = elem[ontype];
if (tmp) {
elem[ontype] = null;
}
jQuery.event.triggered = type;
if (event.isPropagationStopped()) {
lastElement.addEventListener(type, stopPropagationCallback);
}
elem[type]();
if (event.isPropagationStopped()) {
lastElement.removeEventListener(type, stopPropagationCallback);
}
jQuery.event.triggered = void 0;
if (tmp) {
elem[ontype] = tmp;
}
}
}
}
return event.result;
},
// Piggyback on a donor event to simulate a different one
// Used only for `focus(in | out)` events
simulate: function(type, elem, event) {
var e = jQuery.extend(
new jQuery.Event(),
event,
{
type,
isSimulated: true
}
);
jQuery.event.trigger(e, null, elem);
}
});
jQuery.fn.extend({
trigger: function(type, data) {
return this.each(function() {
jQuery.event.trigger(type, data, this);
});
},
triggerHandler: function(type, data) {
var elem = this[0];
if (elem) {
return jQuery.event.trigger(type, data, elem, true);
}
}
});
var rbracket = /\[\]$/, rCRLF = /\r?\n/g, rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, rsubmittable = /^(?:input|select|textarea|keygen)/i;
function buildParams(prefix, obj, traditional, add) {
var name;
if (Array.isArray(obj)) {
jQuery.each(obj, function(i, v) {
if (traditional || rbracket.test(prefix)) {
add(prefix, v);
} else {
buildParams(
prefix + "[" + (typeof v === "object" && v != null ? i : "") + "]",
v,
traditional,
add
);
}
});
} else if (!traditional && toType2(obj) === "object") {
for (name in obj) {
buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
}
} else {
add(prefix, obj);
}
}
jQuery.param = function(a, traditional) {
var prefix, s = [], add = function(key, valueOrFunction) {
var value = isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction;
s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value);
};
if (a == null) {
return "";
}
if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) {
jQuery.each(a, function() {
add(this.name, this.value);
});
} else {
for (prefix in a) {
buildParams(prefix, a[prefix], traditional, add);
}
}
return s.join("&");
};
jQuery.fn.extend({
serialize: function() {
return jQuery.param(this.serializeArray());
},
serializeArray: function() {
return this.map(function() {
var elements = jQuery.prop(this, "elements");
return elements ? jQuery.makeArray(elements) : this;
}).filter(function() {
var type = this.type;
return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type));
}).map(function(_i, elem) {
var val = jQuery(this).val();
if (val == null) {
return null;
}
if (Array.isArray(val)) {
return jQuery.map(val, function(val2) {
return { name: elem.name, value: val2.replace(rCRLF, "\r\n") };
});
}
return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
}).get();
}
});
var r20 = /%20/g, rhash = /#.*$/, rantiCache = /([?&])_=[^&]*/, rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, prefilters = {}, transports = {}, allTypes = "*/".concat("*"), originAnchor = document2.createElement("a");
originAnchor.href = location2.href;
function addToPrefiltersOrTransports(structure) {
return function(dataTypeExpression, func) {
if (typeof dataTypeExpression !== "string") {
func = dataTypeExpression;
dataTypeExpression = "*";
}
var dataType, i = 0, dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];
if (isFunction(func)) {
while (dataType = dataTypes[i++]) {
if (dataType[0] === "+") {
dataType = dataType.slice(1) || "*";
(structure[dataType] = structure[dataType] || []).unshift(func);
} else {
(structure[dataType] = structure[dataType] || []).push(func);
}
}
}
};
}
function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
var inspected = {}, seekingTransport = structure === transports;
function inspect(dataType) {
var selected;
inspected[dataType] = true;
jQuery.each(structure[dataType] || [], function(_, prefilterOrFactory) {
var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
options.dataTypes.unshift(dataTypeOrTransport);
inspect(dataTypeOrTransport);
return false;
} else if (seekingTransport) {
return !(selected = dataTypeOrTransport);
}
});
return selected;
}
return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*");
}
function ajaxExtend(target, src) {
var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {};
for (key in src) {
if (src[key] !== void 0) {
(flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];
}
}
if (deep) {
jQuery.extend(true, target, deep);
}
return target;
}
function ajaxHandleResponses(s, jqXHR, responses) {
var ct, type, finalDataType, firstDataType, contents = s.contents, dataTypes = s.dataTypes;
while (dataTypes[0] === "*") {
dataTypes.shift();
if (ct === void 0) {
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
}
}
if (ct) {
for (type in contents) {
if (contents[type] && contents[type].test(ct)) {
dataTypes.unshift(type);
break;
}
}
}
if (dataTypes[0] in responses) {
finalDataType = dataTypes[0];
} else {
for (type in responses) {
if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
finalDataType = type;
break;
}
if (!firstDataType) {
firstDataType = type;
}
}
finalDataType = finalDataType || firstDataType;
}
if (finalDataType) {
if (finalDataType !== dataTypes[0]) {
dataTypes.unshift(finalDataType);
}
return responses[finalDataType];
}
}
function ajaxConvert(s, response, jqXHR, isSuccess) {
var conv2, current, conv, tmp, prev, converters = {}, dataTypes = s.dataTypes.slice();
if (dataTypes[1]) {
for (conv in s.converters) {
converters[conv.toLowerCase()] = s.converters[conv];
}
}
current = dataTypes.shift();
while (current) {
if (s.responseFields[current]) {
jqXHR[s.responseFields[current]] = response;
}
if (!prev && isSuccess && s.dataFilter) {
response = s.dataFilter(response, s.dataType);
}
prev = current;
current = dataTypes.shift();
if (current) {
if (current === "*") {
current = prev;
} else if (prev !== "*" && prev !== current) {
conv = converters[prev + " " + current] || converters["* " + current];
if (!conv) {
for (conv2 in converters) {
tmp = conv2.split(" ");
if (tmp[1] === current) {
conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
if (conv) {
if (conv === true) {
conv = converters[conv2];
} else if (converters[conv2] !== true) {
current = tmp[0];
dataTypes.unshift(tmp[1]);
}
break;
}
}
}
}
if (conv !== true) {
if (conv && s.throws) {
response = conv(response);
} else {
try {
response = conv(response);
} catch (e) {
return {
state: "parsererror",
error: conv ? e : "No conversion from " + prev + " to " + current
};
}
}
}
}
}
}
return { state: "success", data: response };
}
jQuery.extend({
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {},
ajaxSettings: {
url: location2.href,
type: "GET",
isLocal: rlocalProtocol.test(location2.protocol),
global: true,
processData: true,
async: true,
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
throws: false,
traditional: false,
headers: {},
*/
accepts: {
"*": allTypes,
text: "text/plain",
html: "text/html",
xml: "application/xml, text/xml",
json: "application/json, text/javascript"
},
contents: {
xml: /\bxml\b/,
html: /\bhtml/,
json: /\bjson\b/
},
responseFields: {
xml: "responseXML",
text: "responseText",
json: "responseJSON"
},
// Data converters
// Keys separate source (or catchall "*") and destination types with a single space
converters: {
// Convert anything to text
"* text": String,
// Text to html (true = no transformation)
"text html": true,
// Evaluate text as a json expression
"text json": JSON.parse,
// Parse text as xml
"text xml": jQuery.parseXML
},
// For options that shouldn't be deep extended:
// you can add your own custom options here if
// and when you create one that shouldn't be
// deep extended (see ajaxExtend)
flatOptions: {
url: true,
context: true
}
},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function(target, settings) {
return settings ? (
// Building a settings object
ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings)
) : (
// Extending ajaxSettings
ajaxExtend(jQuery.ajaxSettings, target)
);
},
ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
ajaxTransport: addToPrefiltersOrTransports(transports),
// Main method
ajax: function(url, options) {
if (typeof url === "object") {
options = url;
url = void 0;
}
options = options || {};
var transport, cacheURL, responseHeadersString, responseHeaders, timeoutTimer, urlAnchor, completed2, fireGlobals, i, uncached, s = jQuery.ajaxSetup({}, options), callbackContext = s.context || s, globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event, deferred = jQuery.Deferred(), completeDeferred = jQuery.Callbacks("once memory"), statusCode = s.statusCode || {}, requestHeaders = {}, requestHeadersNames = {}, strAbort = "canceled", jqXHR = {
readyState: 0,
// Builds headers hashtable if needed
getResponseHeader: function(key) {
var match;
if (completed2) {
if (!responseHeaders) {
responseHeaders = {};
while (match = rheaders.exec(responseHeadersString)) {
responseHeaders[match[1].toLowerCase() + " "] = (responseHeaders[match[1].toLowerCase() + " "] || []).concat(match[2]);
}
}
match = responseHeaders[key.toLowerCase() + " "];
}
return match == null ? null : match.join(", ");
},
// Raw string
getAllResponseHeaders: function() {
return completed2 ? responseHeadersString : null;
},
// Caches the header
setRequestHeader: function(name, value) {
if (completed2 == null) {
name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name;
requestHeaders[name] = value;
}
return this;
},
// Overrides response content-type header
overrideMimeType: function(type) {
if (completed2 == null) {
s.mimeType = type;
}
return this;
},
// Status-dependent callbacks
statusCode: function(map) {
var code;
if (map) {
if (completed2) {
jqXHR.always(map[jqXHR.status]);
} else {
for (code in map) {
statusCode[code] = [statusCode[code], map[code]];
}
}
}
return this;
},
// Cancel the request
abort: function(statusText) {
var finalText = statusText || strAbort;
if (transport) {
transport.abort(finalText);
}
done(0, finalText);
return this;
}
};
deferred.promise(jqXHR);
s.url = ((url || s.url || location2.href) + "").replace(rprotocol, location2.protocol + "//");
s.type = options.method || options.type || s.method || s.type;
s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""];
if (s.crossDomain == null) {
urlAnchor = document2.createElement("a");
try {
urlAnchor.href = s.url;
urlAnchor.href = urlAnchor.href;
s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host;
} catch (e) {
s.crossDomain = true;
}
}
if (s.data && s.processData && typeof s.data !== "string") {
s.data = jQuery.param(s.data, s.traditional);
}
inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
if (completed2) {
return jqXHR;
}
fireGlobals = jQuery.event && s.global;
if (fireGlobals && jQuery.active++ === 0) {
jQuery.event.trigger("ajaxStart");
}
s.type = s.type.toUpperCase();
s.hasContent = !rnoContent.test(s.type);
cacheURL = s.url.replace(rhash, "");
if (!s.hasContent) {
uncached = s.url.slice(cacheURL.length);
if (s.data && (s.processData || typeof s.data === "string")) {
cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data;
delete s.data;
}
if (s.cache === false) {
cacheURL = cacheURL.replace(rantiCache, "$1");
uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce.guid++ + uncached;
}
s.url = cacheURL + uncached;
} else if (s.data && s.processData && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) {
s.data = s.data.replace(r20, "+");
}
if (s.ifModified) {
if (jQuery.lastModified[cacheURL]) {
jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
}
if (jQuery.etag[cacheURL]) {
jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
}
}
if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
jqXHR.setRequestHeader("Content-Type", s.contentType);
}
jqXHR.setRequestHeader(
"Accept",
s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : s.accepts["*"]
);
for (i in s.headers) {
jqXHR.setRequestHeader(i, s.headers[i]);
}
if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed2)) {
return jqXHR.abort();
}
strAbort = "abort";
completeDeferred.add(s.complete);
jqXHR.done(s.success);
jqXHR.fail(s.error);
transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
if (!transport) {
done(-1, "No Transport");
} else {
jqXHR.readyState = 1;
if (fireGlobals) {
globalEventContext.trigger("ajaxSend", [jqXHR, s]);
}
if (completed2) {
return jqXHR;
}
if (s.async && s.timeout > 0) {
timeoutTimer = window2.setTimeout(function() {
jqXHR.abort("timeout");
}, s.timeout);
}
try {
completed2 = false;
transport.send(requestHeaders, done);
} catch (e) {
if (completed2) {
throw e;
}
done(-1, e);
}
}
function done(status, nativeStatusText, responses, headers) {
var isSuccess, success, error, response, modified, statusText = nativeStatusText;
if (completed2) {
return;
}
completed2 = true;
if (timeoutTimer) {
window2.clearTimeout(timeoutTimer);
}
transport = void 0;
responseHeadersString = headers || "";
jqXHR.readyState = status > 0 ? 4 : 0;
isSuccess = status >= 200 && status < 300 || status === 304;
if (responses) {
response = ajaxHandleResponses(s, jqXHR, responses);
}
if (!isSuccess && jQuery.inArray("script", s.dataTypes) > -1 && jQuery.inArray("json", s.dataTypes) < 0) {
s.converters["text script"] = function() {
};
}
response = ajaxConvert(s, response, jqXHR, isSuccess);
if (isSuccess) {
if (s.ifModified) {
modified = jqXHR.getResponseHeader("Last-Modified");
if (modified) {
jQuery.lastModified[cacheURL] = modified;
}
modified = jqXHR.getResponseHeader("etag");
if (modified) {
jQuery.etag[cacheURL] = modified;
}
}
if (status === 204 || s.type === "HEAD") {
statusText = "nocontent";
} else if (status === 304) {
statusText = "notmodified";
} else {
statusText = response.state;
success = response.data;
error = response.error;
isSuccess = !error;
}
} else {
error = statusText;
if (status || !statusText) {
statusText = "error";
if (status < 0) {
status = 0;
}
}
}
jqXHR.status = status;
jqXHR.statusText = (nativeStatusText || statusText) + "";
if (isSuccess) {
deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
} else {
deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
}
jqXHR.statusCode(statusCode);
statusCode = void 0;
if (fireGlobals) {
globalEventContext.trigger(
isSuccess ? "ajaxSuccess" : "ajaxError",
[jqXHR, s, isSuccess ? success : error]
);
}
completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
if (fireGlobals) {
globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
if (!--jQuery.active) {
jQuery.event.trigger("ajaxStop");
}
}
}
return jqXHR;
},
getJSON: function(url, data, callback) {
return jQuery.get(url, data, callback, "json");
},
getScript: function(url, callback) {
return jQuery.get(url, void 0, callback, "script");
}
});
jQuery.each(["get", "post"], function(_i, method) {
jQuery[method] = function(url, data, callback, type) {
if (isFunction(data)) {
type = type || callback;
callback = data;
data = void 0;
}
return jQuery.ajax(jQuery.extend({
url,
type: method,
dataType: type,
data,
success: callback
}, jQuery.isPlainObject(url) && url));
};
});
jQuery.ajaxPrefilter(function(s) {
var i;
for (i in s.headers) {
if (i.toLowerCase() === "content-type") {
s.contentType = s.headers[i] || "";
}
}
});
jQuery._evalUrl = function(url, options, doc2) {
return jQuery.ajax({
url,
// Make this explicit, since user can override this through ajaxSetup (trac-11264)
type: "GET",
dataType: "script",
cache: true,
async: false,
global: false,
// Only evaluate the response if it is successful (gh-4126)
// dataFilter is not invoked for failure responses, so using it instead
// of the default converter is kludgy but it works.
converters: {
"text script": function() {
}
},
dataFilter: function(response) {
jQuery.globalEval(response, options, doc2);
}
});
};
jQuery.fn.extend({
wrapAll: function(html) {
var wrap;
if (this[0]) {
if (isFunction(html)) {
html = html.call(this[0]);
}
wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
if (this[0].parentNode) {
wrap.insertBefore(this[0]);
}
wrap.map(function() {
var elem = this;
while (elem.firstElementChild) {
elem = elem.firstElementChild;
}
return elem;
}).append(this);
}
return this;
},
wrapInner: function(html) {
if (isFunction(html)) {
return this.each(function(i) {
jQuery(this).wrapInner(html.call(this, i));
});
}
return this.each(function() {
var self2 = jQuery(this), contents = self2.contents();
if (contents.length) {
contents.wrapAll(html);
} else {
self2.append(html);
}
});
},
wrap: function(html) {
var htmlIsFunction = isFunction(html);
return this.each(function(i) {
jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);
});
},
unwrap: function(selector) {
this.parent(selector).not("body").each(function() {
jQuery(this).replaceWith(this.childNodes);
});
return this;
}
});
jQuery.expr.pseudos.hidden = function(elem) {
return !jQuery.expr.pseudos.visible(elem);
};
jQuery.expr.pseudos.visible = function(elem) {
return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
};
jQuery.ajaxSettings.xhr = function() {
try {
return new window2.XMLHttpRequest();
} catch (e) {
}
};
var xhrSuccessStatus = {
// File protocol always yields status code 0, assume 200
0: 200,
// Support: IE <=9 only
// trac-1450: sometimes IE returns 1223 when it should be 204
1223: 204
}, xhrSupported = jQuery.ajaxSettings.xhr();
support.cors = !!xhrSupported && "withCredentials" in xhrSupported;
support.ajax = xhrSupported = !!xhrSupported;
jQuery.ajaxTransport(function(options) {
var callback, errorCallback;
if (support.cors || xhrSupported && !options.crossDomain) {
return {
send: function(headers, complete) {
var i, xhr = options.xhr();
xhr.open(
options.type,
options.url,
options.async,
options.username,
options.password
);
if (options.xhrFields) {
for (i in options.xhrFields) {
xhr[i] = options.xhrFields[i];
}
}
if (options.mimeType && xhr.overrideMimeType) {
xhr.overrideMimeType(options.mimeType);
}
if (!options.crossDomain && !headers["X-Requested-With"]) {
headers["X-Requested-With"] = "XMLHttpRequest";
}
for (i in headers) {
xhr.setRequestHeader(i, headers[i]);
}
callback = function(type) {
return function() {
if (callback) {
callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null;
if (type === "abort") {
xhr.abort();
} else if (type === "error") {
if (typeof xhr.status !== "number") {
complete(0, "error");
} else {
complete(
// File: protocol always yields status 0; see trac-8605, trac-14207
xhr.status,
xhr.statusText
);
}
} else {
complete(
xhrSuccessStatus[xhr.status] || xhr.status,
xhr.statusText,
// Support: IE <=9 only
// IE9 has no XHR2 but throws on binary (trac-11426)
// For XHR2 non-text, let the caller handle it (gh-2498)
(xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText },
xhr.getAllResponseHeaders()
);
}
}
};
};
xhr.onload = callback();
errorCallback = xhr.onerror = xhr.ontimeout = callback("error");
if (xhr.onabort !== void 0) {
xhr.onabort = errorCallback;
} else {
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
window2.setTimeout(function() {
if (callback) {
errorCallback();
}
});
}
};
}
callback = callback("abort");
try {
xhr.send(options.hasContent && options.data || null);
} catch (e) {
if (callback) {
throw e;
}
}
},
abort: function() {
if (callback) {
callback();
}
}
};
}
});
jQuery.ajaxPrefilter(function(s) {
if (s.crossDomain) {
s.contents.script = false;
}
});
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /\b(?:java|ecma)script\b/
},
converters: {
"text script": function(text) {
jQuery.globalEval(text);
return text;
}
}
});
jQuery.ajaxPrefilter("script", function(s) {
if (s.cache === void 0) {
s.cache = false;
}
if (s.crossDomain) {
s.type = "GET";
}
});
jQuery.ajaxTransport("script", function(s) {
if (s.crossDomain || s.scriptAttrs) {
var script, callback;
return {
send: function(_, complete) {
script = jQuery("<script>").attr(s.scriptAttrs || {}).prop({ charset: s.scriptCharset, src: s.url }).on("load error", callback = function(evt) {
script.remove();
callback = null;
if (evt) {
complete(evt.type === "error" ? 404 : 200, evt.type);
}
});
document2.head.appendChild(script[0]);
},
abort: function() {
if (callback) {
callback();
}
}
};
}
});
var oldCallbacks = [], rjsonp = /(=)\?(?=&|$)|\?\?/;
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
var callback = oldCallbacks.pop() || jQuery.expando + "_" + nonce.guid++;
this[callback] = true;
return callback;
}
});
jQuery.ajaxPrefilter("json jsonp", function(s, originalSettings, jqXHR) {
var callbackName, overwritten, responseContainer, jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ? "url" : typeof s.data === "string" && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0 && rjsonp.test(s.data) && "data");
if (jsonProp || s.dataTypes[0] === "jsonp") {
callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
if (jsonProp) {
s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
} else if (s.jsonp !== false) {
s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
}
s.converters["script json"] = function() {
if (!responseContainer) {
jQuery.error(callbackName + " was not called");
}
return responseContainer[0];
};
s.dataTypes[0] = "json";
overwritten = window2[callbackName];
window2[callbackName] = function() {
responseContainer = arguments;
};
jqXHR.always(function() {
if (overwritten === void 0) {
jQuery(window2).removeProp(callbackName);
} else {
window2[callbackName] = overwritten;
}
if (s[callbackName]) {
s.jsonpCallback = originalSettings.jsonpCallback;
oldCallbacks.push(callbackName);
}
if (responseContainer && isFunction(overwritten)) {
overwritten(responseContainer[0]);
}
responseContainer = overwritten = void 0;
});
return "script";
}
});
support.createHTMLDocument = function() {
var body = document2.implementation.createHTMLDocument("").body;
body.innerHTML = "<form></form><form></form>";
return body.childNodes.length === 2;
}();
jQuery.parseHTML = function(data, context, keepScripts) {
if (typeof data !== "string") {
return [];
}
if (typeof context === "boolean") {
keepScripts = context;
context = false;
}
var base, parsed, scripts;
if (!context) {
if (support.createHTMLDocument) {
context = document2.implementation.createHTMLDocument("");
base = context.createElement("base");
base.href = document2.location.href;
context.head.appendChild(base);
} else {
context = document2;
}
}
parsed = rsingleTag.exec(data);
scripts = !keepScripts && [];
if (parsed) {
return [context.createElement(parsed[1])];
}
parsed = buildFragment([data], context, scripts);
if (scripts && scripts.length) {
jQuery(scripts).remove();
}
return jQuery.merge([], parsed.childNodes);
};
jQuery.fn.load = function(url, params, callback) {
var selector, type, response, self2 = this, off = url.indexOf(" ");
if (off > -1) {
selector = stripAndCollapse(url.slice(off));
url = url.slice(0, off);
}
if (isFunction(params)) {
callback = params;
params = void 0;
} else if (params && typeof params === "object") {
type = "POST";
}
if (self2.length > 0) {
jQuery.ajax({
url,
// If "type" variable is undefined, then "GET" method will be used.
// Make value of this field explicit since
// user can override it through ajaxSetup method
type: type || "GET",
dataType: "html",
data: params
}).done(function(responseText) {
response = arguments;
self2.html(selector ? (
// If a selector was specified, locate the right elements in a dummy div
// Exclude scripts to avoid IE 'Permission Denied' errors
jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector)
) : (
// Otherwise use the full result
responseText
));
}).always(callback && function(jqXHR, status) {
self2.each(function() {
callback.apply(this, response || [jqXHR.responseText, status, jqXHR]);
});
});
}
return this;
};
jQuery.expr.pseudos.animated = function(elem) {
return jQuery.grep(jQuery.timers, function(fn2) {
return elem === fn2.elem;
}).length;
};
jQuery.offset = {
setOffset: function(elem, options, i) {
var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, position = jQuery.css(elem, "position"), curElem = jQuery(elem), props = {};
if (position === "static") {
elem.style.position = "relative";
}
curOffset = curElem.offset();
curCSSTop = jQuery.css(elem, "top");
curCSSLeft = jQuery.css(elem, "left");
calculatePosition = (position === "absolute" || position === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1;
if (calculatePosition) {
curPosition = curElem.position();
curTop = curPosition.top;
curLeft = curPosition.left;
} else {
curTop = parseFloat(curCSSTop) || 0;
curLeft = parseFloat(curCSSLeft) || 0;
}
if (isFunction(options)) {
options = options.call(elem, i, jQuery.extend({}, curOffset));
}
if (options.top != null) {
props.top = options.top - curOffset.top + curTop;
}
if (options.left != null) {
props.left = options.left - curOffset.left + curLeft;
}
if ("using" in options) {
options.using.call(elem, props);
} else {
curElem.css(props);
}
}
};
jQuery.fn.extend({
// offset() relates an element's border box to the document origin
offset: function(options) {
if (arguments.length) {
return options === void 0 ? this : this.each(function(i) {
jQuery.offset.setOffset(this, options, i);
});
}
var rect, win, elem = this[0];
if (!elem) {
return;
}
if (!elem.getClientRects().length) {
return { top: 0, left: 0 };
}
rect = elem.getBoundingClientRect();
win = elem.ownerDocument.defaultView;
return {
top: rect.top + win.pageYOffset,
left: rect.left + win.pageXOffset
};
},
// position() relates an element's margin box to its offset parent's padding box
// This corresponds to the behavior of CSS absolute positioning
position: function() {
if (!this[0]) {
return;
}
var offsetParent, offset2, doc2, elem = this[0], parentOffset = { top: 0, left: 0 };
if (jQuery.css(elem, "position") === "fixed") {
offset2 = elem.getBoundingClientRect();
} else {
offset2 = this.offset();
doc2 = elem.ownerDocument;
offsetParent = elem.offsetParent || doc2.documentElement;
while (offsetParent && (offsetParent === doc2.body || offsetParent === doc2.documentElement) && jQuery.css(offsetParent, "position") === "static") {
offsetParent = offsetParent.parentNode;
}
if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
parentOffset = jQuery(offsetParent).offset();
parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true);
parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true);
}
}
return {
top: offset2.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
left: offset2.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
};
},
// This method will return documentElement in the following cases:
// 1) For the element inside the iframe without offsetParent, this method will return
// documentElement of the parent window
// 2) For the hidden or detached element
// 3) For body or html element, i.e. in case of the html node - it will return itself
//
// but those exceptions were never presented as a real life use-cases
// and might be considered as more preferable results.
//
// This logic, however, is not guaranteed and can change at any point in the future
offsetParent: function() {
return this.map(function() {
var offsetParent = this.offsetParent;
while (offsetParent && jQuery.css(offsetParent, "position") === "static") {
offsetParent = offsetParent.offsetParent;
}
return offsetParent || documentElement;
});
}
});
jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(method, prop) {
var top2 = "pageYOffset" === prop;
jQuery.fn[method] = function(val) {
return access(this, function(elem, method2, val2) {
var win;
if (isWindow(elem)) {
win = elem;
} else if (elem.nodeType === 9) {
win = elem.defaultView;
}
if (val2 === void 0) {
return win ? win[prop] : elem[method2];
}
if (win) {
win.scrollTo(
!top2 ? val2 : win.pageXOffset,
top2 ? val2 : win.pageYOffset
);
} else {
elem[method2] = val2;
}
}, method, val, arguments.length);
};
});
jQuery.each(["top", "left"], function(_i, prop) {
jQuery.cssHooks[prop] = addGetHookIf(
support.pixelPosition,
function(elem, computed) {
if (computed) {
computed = curCSS(elem, prop);
return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed;
}
}
);
});
jQuery.each({ Height: "height", Width: "width" }, function(name, type) {
jQuery.each({
padding: "inner" + name,
content: type,
"": "outer" + name
}, function(defaultExtra, funcName) {
jQuery.fn[funcName] = function(margin, value) {
var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"), extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
return access(this, function(elem, type2, value2) {
var doc2;
if (isWindow(elem)) {
return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name];
}
if (elem.nodeType === 9) {
doc2 = elem.documentElement;
return Math.max(
elem.body["scroll" + name],
doc2["scroll" + name],
elem.body["offset" + name],
doc2["offset" + name],
doc2["client" + name]
);
}
return value2 === void 0 ? (
// Get width or height on the element, requesting but not forcing parseFloat
jQuery.css(elem, type2, extra)
) : (
// Set width or height on the element
jQuery.style(elem, type2, value2, extra)
);
}, type, chainable ? margin : void 0, chainable);
};
});
});
jQuery.each([
"ajaxStart",
"ajaxStop",
"ajaxComplete",
"ajaxError",
"ajaxSuccess",
"ajaxSend"
], function(_i, type) {
jQuery.fn[type] = function(fn2) {
return this.on(type, fn2);
};
});
jQuery.fn.extend({
bind: function(types, data, fn2) {
return this.on(types, null, data, fn2);
},
unbind: function(types, fn2) {
return this.off(types, null, fn2);
},
delegate: function(selector, types, data, fn2) {
return this.on(types, selector, data, fn2);
},
undelegate: function(selector, types, fn2) {
return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn2);
},
hover: function(fnOver, fnOut) {
return this.on("mouseenter", fnOver).on("mouseleave", fnOut || fnOver);
}
});
jQuery.each(
"blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),
function(_i, name) {
jQuery.fn[name] = function(data, fn2) {
return arguments.length > 0 ? this.on(name, null, data, fn2) : this.trigger(name);
};
}
);
var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;
jQuery.proxy = function(fn2, context) {
var tmp, args, proxy;
if (typeof context === "string") {
tmp = fn2[context];
context = fn2;
fn2 = tmp;
}
if (!isFunction(fn2)) {
return void 0;
}
args = slice.call(arguments, 2);
proxy = function() {
return fn2.apply(context || this, args.concat(slice.call(arguments)));
};
proxy.guid = fn2.guid = fn2.guid || jQuery.guid++;
return proxy;
};
jQuery.holdReady = function(hold) {
if (hold) {
jQuery.readyWait++;
} else {
jQuery.ready(true);
}
};
jQuery.isArray = Array.isArray;
jQuery.parseJSON = JSON.parse;
jQuery.nodeName = nodeName;
jQuery.isFunction = isFunction;
jQuery.isWindow = isWindow;
jQuery.camelCase = camelCase;
jQuery.type = toType2;
jQuery.now = Date.now;
jQuery.isNumeric = function(obj) {
var type = jQuery.type(obj);
return (type === "number" || type === "string") && // parseFloat NaNs numeric-cast false positives ("")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to NaN
!isNaN(obj - parseFloat(obj));
};
jQuery.trim = function(text) {
return text == null ? "" : (text + "").replace(rtrim, "$1");
};
if (typeof define === "function" && define.amd) {
define("jquery", [], function() {
return jQuery;
});
}
var _jQuery = window2.jQuery, _$ = window2.$;
jQuery.noConflict = function(deep) {
if (window2.$ === jQuery) {
window2.$ = _$;
}
if (deep && window2.jQuery === jQuery) {
window2.jQuery = _jQuery;
}
return jQuery;
};
if (typeof noGlobal === "undefined") {
window2.jQuery = window2.$ = jQuery;
}
return jQuery;
});
}
});
// vendor/prism.js
var require_prism = __commonJS({
"vendor/prism.js"(exports, module) {
var _self = typeof window !== "undefined" ? window : typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope ? self : {};
var Prism = function(_self2) {
var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
var uniqueId = 0;
var plainTextGrammar = {};
var _ = {
/**
* By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
* current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
* additional languages or plugins yourself.
*
* By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
*
* You obviously have to change this value before the automatic highlighting started. To do this, you can add an
* empty Prism object into the global scope before loading the Prism script like this:
*
* ```js
* window.Prism = window.Prism || {};
* Prism.manual = true;
* // add a new <script> to load Prism's script
* ```
*
* @default false
* @type {boolean}
* @memberof Prism
* @public
*/
manual: _self2.Prism && _self2.Prism.manual,
/**
* By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
* `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
* own worker, you don't want it to do this.
*
* By setting this value to `true`, Prism will not add its own listeners to the worker.
*
* You obviously have to change this value before Prism executes. To do this, you can add an
* empty Prism object into the global scope before loading the Prism script like this:
*
* ```js
* window.Prism = window.Prism || {};
* Prism.disableWorkerMessageHandler = true;
* // Load Prism's script
* ```
*
* @default false
* @type {boolean}
* @memberof Prism
* @public
*/
disableWorkerMessageHandler: _self2.Prism && _self2.Prism.disableWorkerMessageHandler,
/**
* A namespace for utility methods.
*
* All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
* change or disappear at any time.
*
* @namespace
* @memberof Prism
*/
util: {
encode: function encode(tokens) {
if (tokens instanceof Token) {
return new Token(tokens.type, encode(tokens.content), tokens.alias);
} else if (Array.isArray(tokens)) {
return tokens.map(encode);
} else {
return tokens.replace(/&/g, "&").replace(/</g, "<").replace(/\u00a0/g, " ");
}
},
/**
* Returns the name of the type of the given value.
*
* @param {any} o
* @returns {string}
* @example
* type(null) === 'Null'
* type(undefined) === 'Undefined'
* type(123) === 'Number'
* type('foo') === 'String'
* type(true) === 'Boolean'
* type([1, 2]) === 'Array'
* type({}) === 'Object'
* type(String) === 'Function'
* type(/abc+/) === 'RegExp'
*/
type: function(o) {
return Object.prototype.toString.call(o).slice(8, -1);
},
/**
* Returns a unique number for the given object. Later calls will still return the same number.
*
* @param {Object} obj
* @returns {number}
*/
objId: function(obj) {
if (!obj["__id"]) {
Object.defineProperty(obj, "__id", { value: ++uniqueId });
}
return obj["__id"];
},
/**
* Creates a deep clone of the given object.
*
* The main intended use of this function is to clone language definitions.
*
* @param {T} o
* @param {Record<number, any>} [visited]
* @returns {T}
* @template T
*/
clone: function deepClone(o, visited) {
visited = visited || {};
var clone2;
var id;
switch (_.util.type(o)) {
case "Object":
id = _.util.objId(o);
if (visited[id]) {
return visited[id];
}
clone2 = /** @type {Record<string, any>} */
{};
visited[id] = clone2;
for (var key in o) {
if (o.hasOwnProperty(key)) {
clone2[key] = deepClone(o[key], visited);
}
}
return (
/** @type {any} */
clone2
);
case "Array":
id = _.util.objId(o);
if (visited[id]) {
return visited[id];
}
clone2 = [];
visited[id] = clone2;
/** @type {Array} */
/** @type {any} */
o.forEach(function(v, i) {
clone2[i] = deepClone(v, visited);
});
return (
/** @type {any} */
clone2
);
default:
return o;
}
},
/**
* Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
*
* If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
*
* @param {Element} element
* @returns {string}
*/
getLanguage: function(element) {
while (element) {
var m = lang.exec(element.className);
if (m) {
return m[1].toLowerCase();
}
element = element.parentElement;
}
return "none";
},
/**
* Sets the Prism `language-xxxx` class of the given element.
*
* @param {Element} element
* @param {string} language
* @returns {void}
*/
setLanguage: function(element, language) {
element.className = element.className.replace(RegExp(lang, "gi"), "");
element.classList.add("language-" + language);
},
/**
* Returns the script element that is currently executing.
*
* This does __not__ work for line script element.
*
* @returns {HTMLScriptElement | null}
*/
currentScript: function() {
if (typeof document === "undefined") {
return null;
}
if ("currentScript" in document && 1 < 2) {
return (
/** @type {any} */
document.currentScript
);
}
try {
throw new Error();
} catch (err) {
var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
if (src) {
var scripts = document.getElementsByTagName("script");
for (var i in scripts) {
if (scripts[i].src == src) {
return scripts[i];
}
}
}
return null;
}
},
/**
* Returns whether a given class is active for `element`.
*
* The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
* if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
* given class is just the given class with a `no-` prefix.
*
* Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
* closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
* ancestors have the given class or the negated version of it, then the default activation will be returned.
*
* In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
* version of it, the class is considered active.
*
* @param {Element} element
* @param {string} className
* @param {boolean} [defaultActivation=false]
* @returns {boolean}
*/
isActive: function(element, className, defaultActivation) {
var no = "no-" + className;
while (element) {
var classList = element.classList;
if (classList.contains(className)) {
return true;
}
if (classList.contains(no)) {
return false;
}
element = element.parentElement;
}
return !!defaultActivation;
}
},
/**
* This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
*
* @namespace
* @memberof Prism
* @public
*/
languages: {
/**
* The grammar for plain, unformatted text.
*/
plain: plainTextGrammar,
plaintext: plainTextGrammar,
text: plainTextGrammar,
txt: plainTextGrammar,
/**
* Creates a deep copy of the language with the given id and appends the given tokens.
*
* If a token in `redef` also appears in the copied language, then the existing token in the copied language
* will be overwritten at its original position.
*
* ## Best practices
*
* Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
* doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
* understand the language definition because, normally, the order of tokens matters in Prism grammars.
*
* Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
* Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
*
* @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
* @param {Grammar} redef The new tokens to append.
* @returns {Grammar} The new language created.
* @public
* @example
* Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
* // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
* // at its original position
* 'comment': { ... },
* // CSS doesn't have a 'color' token, so this token will be appended
* 'color': /\b(?:red|green|blue)\b/
* });
*/
extend: function(id, redef) {
var lang2 = _.util.clone(_.languages[id]);
for (var key in redef) {
lang2[key] = redef[key];
}
return lang2;
},
/**
* Inserts tokens _before_ another token in a language definition or any other grammar.
*
* ## Usage
*
* This helper method makes it easy to modify existing languages. For example, the CSS language definition
* not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
* in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
* appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
* this:
*
* ```js
* Prism.languages.markup.style = {
* // token
* };
* ```
*
* then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
* before existing tokens. For the CSS example above, you would use it like this:
*
* ```js
* Prism.languages.insertBefore('markup', 'cdata', {
* 'style': {
* // token
* }
* });
* ```
*
* ## Special cases
*
* If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
* will be ignored.
*
* This behavior can be used to insert tokens after `before`:
*
* ```js
* Prism.languages.insertBefore('markup', 'comment', {
* 'comment': Prism.languages.markup.comment,
* // tokens after 'comment'
* });
* ```
*
* ## Limitations
*
* The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
* properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
* differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
* deleting properties which is necessary to insert at arbitrary positions.
*
* To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
* Instead, it will create a new object and replace all references to the target object with the new one. This
* can be done without temporarily deleting properties, so the iteration order is well-defined.
*
* However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
* you hold the target object in a variable, then the value of the variable will not change.
*
* ```js
* var oldMarkup = Prism.languages.markup;
* var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
*
* assert(oldMarkup !== Prism.languages.markup);
* assert(newMarkup === Prism.languages.markup);
* ```
*
* @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
* object to be modified.
* @param {string} before The key to insert before.
* @param {Grammar} insert An object containing the key-value pairs to be inserted.
* @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
* object to be modified.
*
* Defaults to `Prism.languages`.
* @returns {Grammar} The new grammar object.
* @public
*/
insertBefore: function(inside, before, insert, root) {
root = root || /** @type {any} */
_.languages;
var grammar = root[inside];
var ret = {};
for (var token in grammar) {
if (grammar.hasOwnProperty(token)) {
if (token == before) {
for (var newToken in insert) {
if (insert.hasOwnProperty(newToken)) {
ret[newToken] = insert[newToken];
}
}
}
if (!insert.hasOwnProperty(token)) {
ret[token] = grammar[token];
}
}
}
var old = root[inside];
root[inside] = ret;
_.languages.DFS(_.languages, function(key, value) {
if (value === old && key != inside) {
this[key] = ret;
}
});
return ret;
},
// Traverse a language definition with Depth First Search
DFS: function DFS(o, callback, type, visited) {
visited = visited || {};
var objId = _.util.objId;
for (var i in o) {
if (o.hasOwnProperty(i)) {
callback.call(o, i, o[i], type || i);
var property = o[i];
var propertyType = _.util.type(property);
if (propertyType === "Object" && !visited[objId(property)]) {
visited[objId(property)] = true;
DFS(property, callback, null, visited);
} else if (propertyType === "Array" && !visited[objId(property)]) {
visited[objId(property)] = true;
DFS(property, callback, i, visited);
}
}
}
}
},
plugins: {},
/**
* This is the most high-level function in Prism’s API.
* It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
* each one of them.
*
* This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
*
* @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
* @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
* @memberof Prism
* @public
*/
highlightAll: function(async, callback) {
_.highlightAllUnder(document, async, callback);
},
/**
* Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
* {@link Prism.highlightElement} on each one of them.
*
* The following hooks will be run:
* 1. `before-highlightall`
* 2. `before-all-elements-highlight`
* 3. All hooks of {@link Prism.highlightElement} for each element.
*
* @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
* @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
* @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
* @memberof Prism
* @public
*/
highlightAllUnder: function(container, async, callback) {
var env = {
callback,
container,
selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
};
_.hooks.run("before-highlightall", env);
env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
_.hooks.run("before-all-elements-highlight", env);
for (var i = 0, element; element = env.elements[i++]; ) {
_.highlightElement(element, async === true, env.callback);
}
},
/**
* Highlights the code inside a single element.
*
* The following hooks will be run:
* 1. `before-sanity-check`
* 2. `before-highlight`
* 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
* 4. `before-insert`
* 5. `after-highlight`
* 6. `complete`
*
* Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
* the element's language.
*
* @param {Element} element The element containing the code.
* It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
* @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
* to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
* [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
*
* Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
* asynchronous highlighting to work. You can build your own bundle on the
* [Download page](https://prismjs.com/download.html).
* @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
* Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
* @memberof Prism
* @public
*/
highlightElement: function(element, async, callback) {
var language = _.util.getLanguage(element);
var grammar = _.languages[language];
_.util.setLanguage(element, language);
var parent = element.parentElement;
if (parent && parent.nodeName.toLowerCase() === "pre") {
_.util.setLanguage(parent, language);
}
var code = element.textContent;
var env = {
element,
language,
grammar,
code
};
function insertHighlightedCode(highlightedCode) {
env.highlightedCode = highlightedCode;
_.hooks.run("before-insert", env);
env.element.innerHTML = env.highlightedCode;
_.hooks.run("after-highlight", env);
_.hooks.run("complete", env);
callback && callback.call(env.element);
}
_.hooks.run("before-sanity-check", env);
parent = env.element.parentElement;
if (parent && parent.nodeName.toLowerCase() === "pre" && !parent.hasAttribute("tabindex")) {
parent.setAttribute("tabindex", "0");
}
if (!env.code) {
_.hooks.run("complete", env);
callback && callback.call(env.element);
return;
}
_.hooks.run("before-highlight", env);
if (!env.grammar) {
insertHighlightedCode(_.util.encode(env.code));
return;
}
if (async && _self2.Worker) {
var worker = new Worker(_.filename);
worker.onmessage = function(evt) {
insertHighlightedCode(evt.data);
};
worker.postMessage(JSON.stringify({
language: env.language,
code: env.code,
immediateClose: true
}));
} else {
insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
}
},
/**
* Low-level function, only use if you know what you’re doing. It accepts a string of text as input
* and the language definitions to use, and returns a string with the HTML produced.
*
* The following hooks will be run:
* 1. `before-tokenize`
* 2. `after-tokenize`
* 3. `wrap`: On each {@link Token}.
*
* @param {string} text A string with the code to be highlighted.
* @param {Grammar} grammar An object containing the tokens to use.
*
* Usually a language definition like `Prism.languages.markup`.
* @param {string} language The name of the language definition passed to `grammar`.
* @returns {string} The highlighted HTML.
* @memberof Prism
* @public
* @example
* Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
*/
highlight: function(text, grammar, language) {
var env = {
code: text,
grammar,
language
};
_.hooks.run("before-tokenize", env);
if (!env.grammar) {
throw new Error('The language "' + env.language + '" has no grammar.');
}
env.tokens = _.tokenize(env.code, env.grammar);
_.hooks.run("after-tokenize", env);
return Token.stringify(_.util.encode(env.tokens), env.language);
},
/**
* This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
* and the language definitions to use, and returns an array with the tokenized code.
*
* When the language definition includes nested tokens, the function is called recursively on each of these tokens.
*
* This method could be useful in other contexts as well, as a very crude parser.
*
* @param {string} text A string with the code to be highlighted.
* @param {Grammar} grammar An object containing the tokens to use.
*
* Usually a language definition like `Prism.languages.markup`.
* @returns {TokenStream} An array of strings and tokens, a token stream.
* @memberof Prism
* @public
* @example
* let code = `var foo = 0;`;
* let tokens = Prism.tokenize(code, Prism.languages.javascript);
* tokens.forEach(token => {
* if (token instanceof Prism.Token && token.type === 'number') {
* console.log(`Found numeric literal: ${token.content}`);
* }
* });
*/
tokenize: function(text, grammar) {
var rest = grammar.rest;
if (rest) {
for (var token in rest) {
grammar[token] = rest[token];
}
delete grammar.rest;
}
var tokenList = new LinkedList();
addAfter(tokenList, tokenList.head, text);
matchGrammar(text, tokenList, grammar, tokenList.head, 0);
return toArray(tokenList);
},
/**
* @namespace
* @memberof Prism
* @public
*/
hooks: {
all: {},
/**
* Adds the given callback to the list of callbacks for the given hook.
*
* The callback will be invoked when the hook it is registered for is run.
* Hooks are usually directly run by a highlight function but you can also run hooks yourself.
*
* One callback function can be registered to multiple hooks and the same hook multiple times.
*
* @param {string} name The name of the hook.
* @param {HookCallback} callback The callback function which is given environment variables.
* @public
*/
add: function(name, callback) {
var hooks = _.hooks.all;
hooks[name] = hooks[name] || [];
hooks[name].push(callback);
},
/**
* Runs a hook invoking all registered callbacks with the given environment variables.
*
* Callbacks will be invoked synchronously and in the order in which they were registered.
*
* @param {string} name The name of the hook.
* @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
* @public
*/
run: function(name, env) {
var callbacks = _.hooks.all[name];
if (!callbacks || !callbacks.length) {
return;
}
for (var i = 0, callback; callback = callbacks[i++]; ) {
callback(env);
}
}
},
Token
};
_self2.Prism = _;
function Token(type, content, alias, matchedStr) {
this.type = type;
this.content = content;
this.alias = alias;
this.length = (matchedStr || "").length | 0;
}
Token.stringify = function stringify(o, language) {
if (typeof o == "string") {
return o;
}
if (Array.isArray(o)) {
var s = "";
o.forEach(function(e) {
s += stringify(e, language);
});
return s;
}
var env = {
type: o.type,
content: stringify(o.content, language),
tag: "span",
classes: ["token", o.type],
attributes: {},
language
};
var aliases = o.alias;
if (aliases) {
if (Array.isArray(aliases)) {
Array.prototype.push.apply(env.classes, aliases);
} else {
env.classes.push(aliases);
}
}
_.hooks.run("wrap", env);
var attributes = "";
for (var name in env.attributes) {
attributes += " " + name + '="' + (env.attributes[name] || "").replace(/"/g, """) + '"';
}
return "<" + env.tag + ' class="' + env.classes.join(" ") + '"' + attributes + ">" + env.content + "</" + env.tag + ">";
};
function matchPattern(pattern, pos, text, lookbehind) {
pattern.lastIndex = pos;
var match = pattern.exec(text);
if (match && lookbehind && match[1]) {
var lookbehindLength = match[1].length;
match.index += lookbehindLength;
match[0] = match[0].slice(lookbehindLength);
}
return match;
}
function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
for (var token in grammar) {
if (!grammar.hasOwnProperty(token) || !grammar[token]) {
continue;
}
var patterns = grammar[token];
patterns = Array.isArray(patterns) ? patterns : [patterns];
for (var j = 0; j < patterns.length; ++j) {
if (rematch && rematch.cause == token + "," + j) {
return;
}
var patternObj = patterns[j];
var inside = patternObj.inside;
var lookbehind = !!patternObj.lookbehind;
var greedy = !!patternObj.greedy;
var alias = patternObj.alias;
if (greedy && !patternObj.pattern.global) {
var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
patternObj.pattern = RegExp(patternObj.pattern.source, flags + "g");
}
var pattern = patternObj.pattern || patternObj;
for (var currentNode = startNode.next, pos = startPos; currentNode !== tokenList.tail; pos += currentNode.value.length, currentNode = currentNode.next) {
if (rematch && pos >= rematch.reach) {
break;
}
var str = currentNode.value;
if (tokenList.length > text.length) {
return;
}
if (str instanceof Token) {
continue;
}
var removeCount = 1;
var match;
if (greedy) {
match = matchPattern(pattern, pos, text, lookbehind);
if (!match || match.index >= text.length) {
break;
}
var from = match.index;
var to = match.index + match[0].length;
var p = pos;
p += currentNode.value.length;
while (from >= p) {
currentNode = currentNode.next;
p += currentNode.value.length;
}
p -= currentNode.value.length;
pos = p;
if (currentNode.value instanceof Token) {
continue;
}
for (var k = currentNode; k !== tokenList.tail && (p < to || typeof k.value === "string"); k = k.next) {
removeCount++;
p += k.value.length;
}
removeCount--;
str = text.slice(pos, p);
match.index -= pos;
} else {
match = matchPattern(pattern, 0, str, lookbehind);
if (!match) {
continue;
}
}
var from = match.index;
var matchStr = match[0];
var before = str.slice(0, from);
var after = str.slice(from + matchStr.length);
var reach = pos + str.length;
if (rematch && reach > rematch.reach) {
rematch.reach = reach;
}
var removeFrom = currentNode.prev;
if (before) {
removeFrom = addAfter(tokenList, removeFrom, before);
pos += before.length;
}
removeRange(tokenList, removeFrom, removeCount);
var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
currentNode = addAfter(tokenList, removeFrom, wrapped);
if (after) {
addAfter(tokenList, currentNode, after);
}
if (removeCount > 1) {
var nestedRematch = {
cause: token + "," + j,
reach
};
matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
if (rematch && nestedRematch.reach > rematch.reach) {
rematch.reach = nestedRematch.reach;
}
}
}
}
}
}
function LinkedList() {
var head = { value: null, prev: null, next: null };
var tail = { value: null, prev: head, next: null };
head.next = tail;
this.head = head;
this.tail = tail;
this.length = 0;
}
function addAfter(list, node, value) {
var next = node.next;
var newNode = { value, prev: node, next };
node.next = newNode;
next.prev = newNode;
list.length++;
return newNode;
}
function removeRange(list, node, count) {
var next = node.next;
for (var i = 0; i < count && next !== list.tail; i++) {
next = next.next;
}
node.next = next;
next.prev = node;
list.length -= i;
}
function toArray(list) {
var array = [];
var node = list.head.next;
while (node !== list.tail) {
array.push(node.value);
node = node.next;
}
return array;
}
if (!_self2.document) {
if (!_self2.addEventListener) {
return _;
}
if (!_.disableWorkerMessageHandler) {
_self2.addEventListener("message", function(evt) {
var message = JSON.parse(evt.data);
var lang2 = message.language;
var code = message.code;
var immediateClose = message.immediateClose;
_self2.postMessage(_.highlight(code, _.languages[lang2], lang2));
if (immediateClose) {
_self2.close();
}
}, false);
}
return _;
}
var script = _.util.currentScript();
if (script) {
_.filename = script.src;
if (script.hasAttribute("data-manual")) {
_.manual = true;
}
}
function highlightAutomaticallyCallback() {
if (!_.manual) {
_.highlightAll();
}
}
if (!_.manual) {
var readyState = document.readyState;
if (readyState === "loading" || readyState === "interactive" && script && script.defer) {
document.addEventListener("DOMContentLoaded", highlightAutomaticallyCallback);
} else {
if (window.requestAnimationFrame) {
window.requestAnimationFrame(highlightAutomaticallyCallback);
} else {
window.setTimeout(highlightAutomaticallyCallback, 16);
}
}
}
return _;
}(_self);
if (typeof module !== "undefined" && module.exports) {
module.exports = Prism;
}
if (typeof global !== "undefined") {
global.Prism = Prism;
}
Prism.languages.markup = {
"comment": {
pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
greedy: true
},
"prolog": {
pattern: /<\?[\s\S]+?\?>/,
greedy: true
},
"doctype": {
// https://www.w3.org/TR/xml/#NT-doctypedecl
pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
greedy: true,
inside: {
"internal-subset": {
pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
lookbehind: true,
greedy: true,
inside: null
// see below
},
"string": {
pattern: /"[^"]*"|'[^']*'/,
greedy: true
},
"punctuation": /^<!|>$|[[\]]/,
"doctype-tag": /^DOCTYPE/i,
"name": /[^\s<>'"]+/
}
},
"cdata": {
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
greedy: true
},
"tag": {
pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
greedy: true,
inside: {
"tag": {
pattern: /^<\/?[^\s>\/]+/,
inside: {
"punctuation": /^<\/?/,
"namespace": /^[^\s>\/:]+:/
}
},
"special-attr": [],
"attr-value": {
pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
inside: {
"punctuation": [
{
pattern: /^=/,
alias: "attr-equals"
},
{
pattern: /^(\s*)["']|["']$/,
lookbehind: true
}
]
}
},
"punctuation": /\/?>/,
"attr-name": {
pattern: /[^\s>\/]+/,
inside: {
"namespace": /^[^\s>\/:]+:/
}
}
}
},
"entity": [
{
pattern: /&[\da-z]{1,8};/i,
alias: "named-entity"
},
/&#x?[\da-f]{1,8};/i
]
};
Prism.languages.markup["tag"].inside["attr-value"].inside["entity"] = Prism.languages.markup["entity"];
Prism.languages.markup["doctype"].inside["internal-subset"].inside = Prism.languages.markup;
Prism.hooks.add("wrap", function(env) {
if (env.type === "entity") {
env.attributes["title"] = env.content.replace(/&/, "&");
}
});
Object.defineProperty(Prism.languages.markup.tag, "addInlined", {
/**
* Adds an inlined language to markup.
*
* An example of an inlined language is CSS with `<style>` tags.
*
* @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
* case insensitive.
* @param {string} lang The language key.
* @example
* addInlined('style', 'css');
*/
value: function addInlined(tagName, lang) {
var includedCdataInside = {};
includedCdataInside["language-" + lang] = {
pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
lookbehind: true,
inside: Prism.languages[lang]
};
includedCdataInside["cdata"] = /^<!\[CDATA\[|\]\]>$/i;
var inside = {
"included-cdata": {
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
inside: includedCdataInside
}
};
inside["language-" + lang] = {
pattern: /[\s\S]+/,
inside: Prism.languages[lang]
};
var def = {};
def[tagName] = {
pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
return tagName;
}), "i"),
lookbehind: true,
greedy: true,
inside
};
Prism.languages.insertBefore("markup", "cdata", def);
}
});
Object.defineProperty(Prism.languages.markup.tag, "addAttribute", {
/**
* Adds an pattern to highlight languages embedded in HTML attributes.
*
* An example of an inlined language is CSS with `style` attributes.
*
* @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
* case insensitive.
* @param {string} lang The language key.
* @example
* addAttribute('style', 'css');
*/
value: function(attrName, lang) {
Prism.languages.markup.tag.inside["special-attr"].push({
pattern: RegExp(
/(^|["'\s])/.source + "(?:" + attrName + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
"i"
),
lookbehind: true,
inside: {
"attr-name": /^[^\s=]+/,
"attr-value": {
pattern: /=[\s\S]+/,
inside: {
"value": {
pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
lookbehind: true,
alias: [lang, "language-" + lang],
inside: Prism.languages[lang]
},
"punctuation": [
{
pattern: /^=/,
alias: "attr-equals"
},
/"|'/
]
}
}
}
});
}
});
Prism.languages.html = Prism.languages.markup;
Prism.languages.mathml = Prism.languages.markup;
Prism.languages.svg = Prism.languages.markup;
Prism.languages.xml = Prism.languages.extend("markup", {});
Prism.languages.ssml = Prism.languages.xml;
Prism.languages.atom = Prism.languages.xml;
Prism.languages.rss = Prism.languages.xml;
(function(Prism2) {
var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
Prism2.languages.css = {
"comment": /\/\*[\s\S]*?\*\//,
"atrule": {
pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + string.source + ")*?" + /(?:;|(?=\s*\{))/.source),
inside: {
"rule": /^@[\w-]+/,
"selector-function-argument": {
pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
lookbehind: true,
alias: "selector"
},
"keyword": {
pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
lookbehind: true
}
// See rest below
}
},
"url": {
// https://drafts.csswg.org/css-values-3/#urls
pattern: RegExp("\\burl\\((?:" + string.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
greedy: true,
inside: {
"function": /^url/i,
"punctuation": /^\(|\)$/,
"string": {
pattern: RegExp("^" + string.source + "$"),
alias: "url"
}
}
},
"selector": {
pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` + string.source + ")*(?=\\s*\\{)"),
lookbehind: true
},
"string": {
pattern: string,
greedy: true
},
"property": {
pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
lookbehind: true
},
"important": /!important\b/i,
"function": {
pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
lookbehind: true
},
"punctuation": /[(){};:,]/
};
Prism2.languages.css["atrule"].inside.rest = Prism2.languages.css;
var markup = Prism2.languages.markup;
if (markup) {
markup.tag.addInlined("style", "css");
markup.tag.addAttribute("style", "css");
}
})(Prism);
Prism.languages.clike = {
"comment": [
{
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
lookbehind: true,
greedy: true
},
{
pattern: /(^|[^\\:])\/\/.*/,
lookbehind: true,
greedy: true
}
],
"string": {
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
greedy: true
},
"class-name": {
pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
lookbehind: true,
inside: {
"punctuation": /[.\\]/
}
},
"keyword": /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
"boolean": /\b(?:false|true)\b/,
"function": /\b\w+(?=\()/,
"number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
"operator": /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
"punctuation": /[{}[\];(),.:]/
};
Prism.languages.javascript = Prism.languages.extend("clike", {
"class-name": [
Prism.languages.clike["class-name"],
{
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
lookbehind: true
}
],
"keyword": [
{
pattern: /((?:^|\})\s*)catch\b/,
lookbehind: true
},
{
pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
lookbehind: true
}
],
// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
"function": /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
"number": {
pattern: RegExp(
/(^|[^\w$])/.source + "(?:" + // constant
(/NaN|Infinity/.source + "|" + // binary integer
/0[bB][01]+(?:_[01]+)*n?/.source + "|" + // octal integer
/0[oO][0-7]+(?:_[0-7]+)*n?/.source + "|" + // hexadecimal integer
/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + "|" + // decimal bigint
/\d+(?:_\d+)*n/.source + "|" + // decimal number (integer or float) but no bigint
/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ")" + /(?![\w$])/.source
),
lookbehind: true
},
"operator": /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
});
Prism.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
Prism.languages.insertBefore("javascript", "keyword", {
"regex": {
pattern: RegExp(
// lookbehind
// eslint-disable-next-line regexp/no-dupe-characters-character-class
/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source + // Regex pattern:
// There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
// classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
// with the only syntax, so we have to define 2 different regex patterns.
/\//.source + "(?:" + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + "|" + // `v` flag syntax. This supports 3 levels of nested character classes.
/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ")" + // lookahead
/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
),
lookbehind: true,
greedy: true,
inside: {
"regex-source": {
pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
lookbehind: true,
alias: "language-regex",
inside: Prism.languages.regex
},
"regex-delimiter": /^\/|\/$/,
"regex-flags": /^[a-z]+$/
}
},
// This must be declared before keyword because we use "function" inside the look-forward
"function-variable": {
pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
alias: "function"
},
"parameter": [
{
pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
lookbehind: true,
inside: Prism.languages.javascript
},
{
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
lookbehind: true,
inside: Prism.languages.javascript
},
{
pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
lookbehind: true,
inside: Prism.languages.javascript
},
{
pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
lookbehind: true,
inside: Prism.languages.javascript
}
],
"constant": /\b[A-Z](?:[A-Z_]|\dx?)*\b/
});
Prism.languages.insertBefore("javascript", "string", {
"hashbang": {
pattern: /^#!.*/,
greedy: true,
alias: "comment"
},
"template-string": {
pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
greedy: true,
inside: {
"template-punctuation": {
pattern: /^`|`$/,
alias: "string"
},
"interpolation": {
pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
lookbehind: true,
inside: {
"interpolation-punctuation": {
pattern: /^\$\{|\}$/,
alias: "punctuation"
},
rest: Prism.languages.javascript
}
},
"string": /[\s\S]+/
}
},
"string-property": {
pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
lookbehind: true,
greedy: true,
alias: "property"
}
});
Prism.languages.insertBefore("javascript", "operator", {
"literal-property": {
pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
lookbehind: true,
alias: "property"
}
});
if (Prism.languages.markup) {
Prism.languages.markup.tag.addInlined("script", "javascript");
Prism.languages.markup.tag.addAttribute(
/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,
"javascript"
);
}
Prism.languages.js = Prism.languages.javascript;
Prism.languages.abap = {
"comment": /^\*.*/m,
"string": /(`|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
"string-template": {
pattern: /([|}])(?:\\.|[^\\|{\r\n])*(?=[|{])/,
lookbehind: true,
alias: "string"
},
/* End Of Line comments should not interfere with strings when the
quote character occurs within them. We assume a string being highlighted
inside an EOL comment is more acceptable than the opposite.
*/
"eol-comment": {
pattern: /(^|\s)".*/m,
lookbehind: true,
alias: "comment"
},
"keyword": {
pattern: /(\s|\.|^)(?:\*-INPUT|\?TO|ABAP-SOURCE|ABBREVIATED|ABS|ABSTRACT|ACCEPT|ACCEPTING|ACCESSPOLICY|ACCORDING|ACOS|ACTIVATION|ACTUAL|ADD|ADD-CORRESPONDING|ADJACENT|AFTER|ALIAS|ALIASES|ALIGN|ALL|ALLOCATE|ALPHA|ANALYSIS|ANALYZER|AND|ANY|APPEND|APPENDAGE|APPENDING|APPLICATION|ARCHIVE|AREA|ARITHMETIC|AS|ASCENDING|ASIN|ASPECT|ASSERT|ASSIGN|ASSIGNED|ASSIGNING|ASSOCIATION|ASYNCHRONOUS|AT|ATAN|ATTRIBUTES|AUTHORITY|AUTHORITY-CHECK|AVG|BACK|BACKGROUND|BACKUP|BACKWARD|BADI|BASE|BEFORE|BEGIN|BETWEEN|BIG|BINARY|BINDING|BIT|BIT-AND|BIT-NOT|BIT-OR|BIT-XOR|BLACK|BLANK|BLANKS|BLOB|BLOCK|BLOCKS|BLUE|BOUND|BOUNDARIES|BOUNDS|BOXED|BREAK-POINT|BT|BUFFER|BY|BYPASSING|BYTE|BYTE-CA|BYTE-CN|BYTE-CO|BYTE-CS|BYTE-NA|BYTE-NS|BYTE-ORDER|C|CA|CALL|CALLING|CASE|CAST|CASTING|CATCH|CEIL|CENTER|CENTERED|CHAIN|CHAIN-INPUT|CHAIN-REQUEST|CHANGE|CHANGING|CHANNELS|CHAR-TO-HEX|CHARACTER|CHARLEN|CHECK|CHECKBOX|CIRCULAR|CI_|CLASS|CLASS-CODING|CLASS-DATA|CLASS-EVENTS|CLASS-METHODS|CLASS-POOL|CLEANUP|CLEAR|CLIENT|CLOB|CLOCK|CLOSE|CN|CNT|CO|COALESCE|CODE|CODING|COLLECT|COLOR|COLUMN|COLUMNS|COL_BACKGROUND|COL_GROUP|COL_HEADING|COL_KEY|COL_NEGATIVE|COL_NORMAL|COL_POSITIVE|COL_TOTAL|COMMENT|COMMENTS|COMMIT|COMMON|COMMUNICATION|COMPARING|COMPONENT|COMPONENTS|COMPRESSION|COMPUTE|CONCAT|CONCATENATE|COND|CONDENSE|CONDITION|CONNECT|CONNECTION|CONSTANTS|CONTEXT|CONTEXTS|CONTINUE|CONTROL|CONTROLS|CONV|CONVERSION|CONVERT|COPIES|COPY|CORRESPONDING|COS|COSH|COUNT|COUNTRY|COVER|CP|CPI|CREATE|CREATING|CRITICAL|CS|CURRENCY|CURRENCY_CONVERSION|CURRENT|CURSOR|CURSOR-SELECTION|CUSTOMER|CUSTOMER-FUNCTION|DANGEROUS|DATA|DATABASE|DATAINFO|DATASET|DATE|DAYLIGHT|DBMAXLEN|DD\/MM\/YY|DD\/MM\/YYYY|DDMMYY|DEALLOCATE|DECIMALS|DECIMAL_SHIFT|DECLARATIONS|DEEP|DEFAULT|DEFERRED|DEFINE|DEFINING|DEFINITION|DELETE|DELETING|DEMAND|DEPARTMENT|DESCENDING|DESCRIBE|DESTINATION|DETAIL|DIALOG|DIRECTORY|DISCONNECT|DISPLAY|DISPLAY-MODE|DISTANCE|DISTINCT|DIV|DIVIDE|DIVIDE-CORRESPONDING|DIVISION|DO|DUMMY|DUPLICATE|DUPLICATES|DURATION|DURING|DYNAMIC|DYNPRO|E|EACH|EDIT|EDITOR-CALL|ELSE|ELSEIF|EMPTY|ENABLED|ENABLING|ENCODING|END|END-ENHANCEMENT-SECTION|END-LINES|END-OF-DEFINITION|END-OF-FILE|END-OF-PAGE|END-OF-SELECTION|ENDAT|ENDCASE|ENDCATCH|ENDCHAIN|ENDCLASS|ENDDO|ENDENHANCEMENT|ENDEXEC|ENDFOR|ENDFORM|ENDFUNCTION|ENDIAN|ENDIF|ENDING|ENDINTERFACE|ENDLOOP|ENDMETHOD|ENDMODULE|ENDON|ENDPROVIDE|ENDSELECT|ENDTRY|ENDWHILE|ENGINEERING|ENHANCEMENT|ENHANCEMENT-POINT|ENHANCEMENT-SECTION|ENHANCEMENTS|ENTRIES|ENTRY|ENVIRONMENT|EQ|EQUAL|EQUIV|ERRORMESSAGE|ERRORS|ESCAPE|ESCAPING|EVENT|EVENTS|EXACT|EXCEPT|EXCEPTION|EXCEPTION-TABLE|EXCEPTIONS|EXCLUDE|EXCLUDING|EXEC|EXECUTE|EXISTS|EXIT|EXIT-COMMAND|EXP|EXPAND|EXPANDING|EXPIRATION|EXPLICIT|EXPONENT|EXPORT|EXPORTING|EXTEND|EXTENDED|EXTENSION|EXTRACT|FAIL|FETCH|FIELD|FIELD-GROUPS|FIELD-SYMBOL|FIELD-SYMBOLS|FIELDS|FILE|FILTER|FILTER-TABLE|FILTERS|FINAL|FIND|FIRST|FIRST-LINE|FIXED-POINT|FKEQ|FKGE|FLOOR|FLUSH|FONT|FOR|FORM|FORMAT|FORWARD|FOUND|FRAC|FRAME|FRAMES|FREE|FRIENDS|FROM|FUNCTION|FUNCTION-POOL|FUNCTIONALITY|FURTHER|GAPS|GE|GENERATE|GET|GIVING|GKEQ|GKGE|GLOBAL|GRANT|GREATER|GREEN|GROUP|GROUPS|GT|HANDLE|HANDLER|HARMLESS|HASHED|HAVING|HDB|HEAD-LINES|HEADER|HEADERS|HEADING|HELP-ID|HELP-REQUEST|HIDE|HIGH|HINT|HOLD|HOTSPOT|I|ICON|ID|IDENTIFICATION|IDENTIFIER|IDS|IF|IGNORE|IGNORING|IMMEDIATELY|IMPLEMENTATION|IMPLEMENTATIONS|IMPLEMENTED|IMPLICIT|IMPORT|IMPORTING|IN|INACTIVE|INCL|INCLUDE|INCLUDES|INCLUDING|INCREMENT|INDEX|INDEX-LINE|INFOTYPES|INHERITING|INIT|INITIAL|INITIALIZATION|INNER|INOUT|INPUT|INSERT|INSTANCES|INTENSIFIED|INTERFACE|INTERFACE-POOL|INTERFACES|INTERNAL|INTERVALS|INTO|INVERSE|INVERTED-DATE|IS|ISO|ITERATOR|ITNO|JOB|JOIN|KEEP|KEEPING|KERNEL|KEY|KEYS|KEYWORDS|KIND|LANGUAGE|LAST|LATE|LAYOUT|LE|LEADING|LEAVE|LEFT|LEFT-JUSTIFIED|LEFTPLUS|LEFTSPACE|LEGACY|LENGTH|LESS|LET|LEVEL|LEVELS|LIKE|LINE|LINE-COUNT|LINE-SELECTION|LINE-SIZE|LINEFEED|LINES|LIST|LIST-PROCESSING|LISTBOX|LITTLE|LLANG|LOAD|LOAD-OF-PROGRAM|LOB|LOCAL|LOCALE|LOCATOR|LOG|LOG-POINT|LOG10|LOGFILE|LOGICAL|LONG|LOOP|LOW|LOWER|LPAD|LPI|LT|M|MAIL|MAIN|MAJOR-ID|MAPPING|MARGIN|MARK|MASK|MATCH|MATCHCODE|MAX|MAXIMUM|MEDIUM|MEMBERS|MEMORY|MESH|MESSAGE|MESSAGE-ID|MESSAGES|MESSAGING|METHOD|METHODS|MIN|MINIMUM|MINOR-ID|MM\/DD\/YY|MM\/DD\/YYYY|MMDDYY|MOD|MODE|MODIF|MODIFIER|MODIFY|MODULE|MOVE|MOVE-CORRESPONDING|MULTIPLY|MULTIPLY-CORRESPONDING|NA|NAME|NAMETAB|NATIVE|NB|NE|NESTED|NESTING|NEW|NEW-LINE|NEW-PAGE|NEW-SECTION|NEXT|NO|NO-DISPLAY|NO-EXTENSION|NO-GAP|NO-GAPS|NO-GROUPING|NO-HEADING|NO-SCROLLING|NO-SIGN|NO-TITLE|NO-TOPOFPAGE|NO-ZERO|NODE|NODES|NON-UNICODE|NON-UNIQUE|NOT|NP|NS|NULL|NUMBER|NUMOFCHAR|O|OBJECT|OBJECTS|OBLIGATORY|OCCURRENCE|OCCURRENCES|OCCURS|OF|OFF|OFFSET|OLE|ON|ONLY|OPEN|OPTION|OPTIONAL|OPTIONS|OR|ORDER|OTHER|OTHERS|OUT|OUTER|OUTPUT|OUTPUT-LENGTH|OVERFLOW|OVERLAY|PACK|PACKAGE|PAD|PADDING|PAGE|PAGES|PARAMETER|PARAMETER-TABLE|PARAMETERS|PART|PARTIALLY|PATTERN|PERCENTAGE|PERFORM|PERFORMING|PERSON|PF|PF-STATUS|PINK|PLACES|POOL|POSITION|POS_HIGH|POS_LOW|PRAGMAS|PRECOMPILED|PREFERRED|PRESERVING|PRIMARY|PRINT|PRINT-CONTROL|PRIORITY|PRIVATE|PROCEDURE|PROCESS|PROGRAM|PROPERTY|PROTECTED|PROVIDE|PUBLIC|PUSHBUTTON|PUT|QUEUE-ONLY|QUICKINFO|RADIOBUTTON|RAISE|RAISING|RANGE|RANGES|RAW|READ|READ-ONLY|READER|RECEIVE|RECEIVED|RECEIVER|RECEIVING|RED|REDEFINITION|REDUCE|REDUCED|REF|REFERENCE|REFRESH|REGEX|REJECT|REMOTE|RENAMING|REPLACE|REPLACEMENT|REPLACING|REPORT|REQUEST|REQUESTED|RESERVE|RESET|RESOLUTION|RESPECTING|RESPONSIBLE|RESULT|RESULTS|RESUMABLE|RESUME|RETRY|RETURN|RETURNCODE|RETURNING|RIGHT|RIGHT-JUSTIFIED|RIGHTPLUS|RIGHTSPACE|RISK|RMC_COMMUNICATION_FAILURE|RMC_INVALID_STATUS|RMC_SYSTEM_FAILURE|ROLE|ROLLBACK|ROUND|ROWS|RTTI|RUN|SAP|SAP-SPOOL|SAVING|SCALE_PRESERVING|SCALE_PRESERVING_SCIENTIFIC|SCAN|SCIENTIFIC|SCIENTIFIC_WITH_LEADING_ZERO|SCREEN|SCROLL|SCROLL-BOUNDARY|SCROLLING|SEARCH|SECONDARY|SECONDS|SECTION|SELECT|SELECT-OPTIONS|SELECTION|SELECTION-SCREEN|SELECTION-SET|SELECTION-SETS|SELECTION-TABLE|SELECTIONS|SELECTOR|SEND|SEPARATE|SEPARATED|SET|SHARED|SHIFT|SHORT|SHORTDUMP-ID|SIGN|SIGN_AS_POSTFIX|SIMPLE|SIN|SINGLE|SINH|SIZE|SKIP|SKIPPING|SMART|SOME|SORT|SORTABLE|SORTED|SOURCE|SPACE|SPECIFIED|SPLIT|SPOOL|SPOTS|SQL|SQLSCRIPT|SQRT|STABLE|STAMP|STANDARD|START-OF-SELECTION|STARTING|STATE|STATEMENT|STATEMENTS|STATIC|STATICS|STATUSINFO|STEP-LOOP|STOP|STRLEN|STRUCTURE|STRUCTURES|STYLE|SUBKEY|SUBMATCHES|SUBMIT|SUBROUTINE|SUBSCREEN|SUBSTRING|SUBTRACT|SUBTRACT-CORRESPONDING|SUFFIX|SUM|SUMMARY|SUMMING|SUPPLIED|SUPPLY|SUPPRESS|SWITCH|SWITCHSTATES|SYMBOL|SYNCPOINTS|SYNTAX|SYNTAX-CHECK|SYNTAX-TRACE|SYSTEM-CALL|SYSTEM-EXCEPTIONS|SYSTEM-EXIT|TAB|TABBED|TABLE|TABLES|TABLEVIEW|TABSTRIP|TAN|TANH|TARGET|TASK|TASKS|TEST|TESTING|TEXT|TEXTPOOL|THEN|THROW|TIME|TIMES|TIMESTAMP|TIMEZONE|TITLE|TITLE-LINES|TITLEBAR|TO|TOKENIZATION|TOKENS|TOP-LINES|TOP-OF-PAGE|TRACE-FILE|TRACE-TABLE|TRAILING|TRANSACTION|TRANSFER|TRANSFORMATION|TRANSLATE|TRANSPORTING|TRMAC|TRUNC|TRUNCATE|TRUNCATION|TRY|TYPE|TYPE-POOL|TYPE-POOLS|TYPES|ULINE|UNASSIGN|UNDER|UNICODE|UNION|UNIQUE|UNIT|UNIT_CONVERSION|UNIX|UNPACK|UNTIL|UNWIND|UP|UPDATE|UPPER|USER|USER-COMMAND|USING|UTF-8|VALID|VALUE|VALUE-REQUEST|VALUES|VARY|VARYING|VERIFICATION-MESSAGE|VERSION|VIA|VIEW|VISIBLE|WAIT|WARNING|WHEN|WHENEVER|WHERE|WHILE|WIDTH|WINDOW|WINDOWS|WITH|WITH-HEADING|WITH-TITLE|WITHOUT|WORD|WORK|WRITE|WRITER|X|XML|XOR|XSD|XSTRLEN|YELLOW|YES|YYMMDD|Z|ZERO|ZONE)(?![\w-])/i,
lookbehind: true
},
/* Numbers can be only integers. Decimal or Hex appear only as strings */
"number": /\b\d+\b/,
/* Operators must always be surrounded by whitespace, they cannot be put
adjacent to operands.
*/
"operator": {
pattern: /(\s)(?:\*\*?|<[=>]?|>=?|\?=|[-+\/=])(?=\s)/,
lookbehind: true
},
"string-operator": {
pattern: /(\s)&&?(?=\s)/,
lookbehind: true,
/* The official editor highlights */
alias: "keyword"
},
"token-operator": [{
/* Special operators used to access structure components, class methods/attributes, etc. */
pattern: /(\w)(?:->?|=>|[~|{}])(?=\w)/,
lookbehind: true,
alias: "punctuation"
}, {
/* Special tokens used do delimit string templates */
pattern: /[|{}]/,
alias: "punctuation"
}],
"punctuation": /[,.:()]/
};
(function(Prism2) {
var coreRules = "(?:ALPHA|BIT|CHAR|CR|CRLF|CTL|DIGIT|DQUOTE|HEXDIG|HTAB|LF|LWSP|OCTET|SP|VCHAR|WSP)";
Prism2.languages.abnf = {
"comment": /;.*/,
"string": {
pattern: /(?:%[is])?"[^"\n\r]*"/,
greedy: true,
inside: {
"punctuation": /^%[is]/
}
},
"range": {
pattern: /%(?:b[01]+-[01]+|d\d+-\d+|x[A-F\d]+-[A-F\d]+)/i,
alias: "number"
},
"terminal": {
pattern: /%(?:b[01]+(?:\.[01]+)*|d\d+(?:\.\d+)*|x[A-F\d]+(?:\.[A-F\d]+)*)/i,
alias: "number"
},
"repetition": {
pattern: /(^|[^\w-])(?:\d*\*\d*|\d+)/,
lookbehind: true,
alias: "operator"
},
"definition": {
pattern: /(^[ \t]*)(?:[a-z][\w-]*|<[^<>\r\n]*>)(?=\s*=)/m,
lookbehind: true,
alias: "keyword",
inside: {
"punctuation": /<|>/
}
},
"core-rule": {
pattern: RegExp("(?:(^|[^<\\w-])" + coreRules + "|<" + coreRules + ">)(?![\\w-])", "i"),
lookbehind: true,
alias: ["rule", "constant"],
inside: {
"punctuation": /<|>/
}
},
"rule": {
pattern: /(^|[^<\w-])[a-z][\w-]*|<[^<>\r\n]*>/i,
lookbehind: true,
inside: {
"punctuation": /<|>/
}
},
"operator": /=\/?|\//,
"punctuation": /[()\[\]]/
};
})(Prism);
Prism.languages.actionscript = Prism.languages.extend("javascript", {
"keyword": /\b(?:as|break|case|catch|class|const|default|delete|do|dynamic|each|else|extends|final|finally|for|function|get|if|implements|import|in|include|instanceof|interface|internal|is|namespace|native|new|null|override|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/,
"operator": /\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/
});
Prism.languages.actionscript["class-name"].alias = "function";
delete Prism.languages.actionscript["parameter"];
delete Prism.languages.actionscript["literal-property"];
if (Prism.languages.markup) {
Prism.languages.insertBefore("actionscript", "string", {
"xml": {
pattern: /(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/,
lookbehind: true,
inside: Prism.languages.markup
}
});
}
Prism.languages.ada = {
"comment": /--.*/,
"string": /"(?:""|[^"\r\f\n])*"/,
"number": [
{
pattern: /\b\d(?:_?\d)*#[\dA-F](?:_?[\dA-F])*(?:\.[\dA-F](?:_?[\dA-F])*)?#(?:E[+-]?\d(?:_?\d)*)?/i
},
{
pattern: /\b\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:E[+-]?\d(?:_?\d)*)?\b/i
}
],
"attribute": {
pattern: /\b'\w+/,
alias: "attr-name"
},
"keyword": /\b(?:abort|abs|abstract|accept|access|aliased|all|and|array|at|begin|body|case|constant|declare|delay|delta|digits|do|else|elsif|end|entry|exception|exit|for|function|generic|goto|if|in|interface|is|limited|loop|mod|new|not|null|of|or|others|out|overriding|package|pragma|private|procedure|protected|raise|range|record|rem|renames|requeue|return|reverse|select|separate|some|subtype|synchronized|tagged|task|terminate|then|type|until|use|when|while|with|xor)\b/i,
"boolean": /\b(?:false|true)\b/i,
"operator": /<[=>]?|>=?|=>?|:=|\/=?|\*\*?|[&+-]/,
"punctuation": /\.\.?|[,;():]/,
"char": /'.'/,
"variable": /\b[a-z](?:\w)*\b/i
};
(function(Prism2) {
Prism2.languages.agda = {
"comment": /\{-[\s\S]*?(?:-\}|$)|--.*/,
"string": {
pattern: /"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,
greedy: true
},
"punctuation": /[(){}⦃⦄.;@]/,
"class-name": {
pattern: /((?:data|record) +)\S+/,
lookbehind: true
},
"function": {
pattern: /(^[ \t]*)(?!\s)[^:\r\n]+(?=:)/m,
lookbehind: true
},
"operator": {
pattern: /(^\s*|\s)(?:[=|:∀→λ\\?_]|->)(?=\s)/,
lookbehind: true
},
"keyword": /\b(?:Set|abstract|constructor|data|eta-equality|field|forall|hiding|import|in|inductive|infix|infixl|infixr|instance|let|macro|module|mutual|no-eta-equality|open|overlap|pattern|postulate|primitive|private|public|quote|quoteContext|quoteGoal|quoteTerm|record|renaming|rewrite|syntax|tactic|unquote|unquoteDecl|unquoteDef|using|variable|where|with)\b/
};
})(Prism);
Prism.languages.al = {
"comment": /\/\/.*|\/\*[\s\S]*?\*\//,
"string": {
pattern: /'(?:''|[^'\r\n])*'(?!')|"(?:""|[^"\r\n])*"(?!")/,
greedy: true
},
"function": {
pattern: /(\b(?:event|procedure|trigger)\s+|(?:^|[^.])\.\s*)[a-z_]\w*(?=\s*\()/i,
lookbehind: true
},
"keyword": [
// keywords
/\b(?:array|asserterror|begin|break|case|do|downto|else|end|event|exit|for|foreach|function|if|implements|in|indataset|interface|internal|local|of|procedure|program|protected|repeat|runonclient|securityfiltering|suppressdispose|temporary|then|to|trigger|until|var|while|with|withevents)\b/i,
// objects and metadata that are used like keywords
/\b(?:action|actions|addafter|addbefore|addfirst|addlast|area|assembly|chartpart|codeunit|column|controladdin|cuegroup|customizes|dataitem|dataset|dotnet|elements|enum|enumextension|extends|field|fieldattribute|fieldelement|fieldgroup|fieldgroups|fields|filter|fixed|grid|group|key|keys|label|labels|layout|modify|moveafter|movebefore|movefirst|movelast|page|pagecustomization|pageextension|part|profile|query|repeater|report|requestpage|schema|separator|systempart|table|tableelement|tableextension|textattribute|textelement|type|usercontrol|value|xmlport)\b/i
],
"number": /\b(?:0x[\da-f]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)(?:F|LL?|U(?:LL?)?)?\b/i,
"boolean": /\b(?:false|true)\b/i,
"variable": /\b(?:Curr(?:FieldNo|Page|Report)|x?Rec|RequestOptionsPage)\b/,
"class-name": /\b(?:automation|biginteger|bigtext|blob|boolean|byte|char|clienttype|code|completiontriggererrorlevel|connectiontype|database|dataclassification|datascope|date|dateformula|datetime|decimal|defaultlayout|dialog|dictionary|dotnetassembly|dotnettypedeclaration|duration|errorinfo|errortype|executioncontext|executionmode|fieldclass|fieldref|fieldtype|file|filterpagebuilder|guid|httpclient|httpcontent|httpheaders|httprequestmessage|httpresponsemessage|instream|integer|joker|jsonarray|jsonobject|jsontoken|jsonvalue|keyref|list|moduledependencyinfo|moduleinfo|none|notification|notificationscope|objecttype|option|outstream|pageresult|record|recordid|recordref|reportformat|securityfilter|sessionsettings|tableconnectiontype|tablefilter|testaction|testfield|testfilterfield|testpage|testpermissions|testrequestpage|text|textbuilder|textconst|textencoding|time|transactionmodel|transactiontype|variant|verbosity|version|view|views|webserviceactioncontext|webserviceactionresultcode|xmlattribute|xmlattributecollection|xmlcdata|xmlcomment|xmldeclaration|xmldocument|xmldocumenttype|xmlelement|xmlnamespacemanager|xmlnametable|xmlnode|xmlnodelist|xmlprocessinginstruction|xmlreadoptions|xmltext|xmlwriteoptions)\b/i,
"operator": /\.\.|:[=:]|[-+*/]=?|<>|[<>]=?|=|\b(?:and|div|mod|not|or|xor)\b/i,
"punctuation": /[()\[\]{}:.;,]/
};
Prism.languages.antlr4 = {
"comment": /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
"string": {
pattern: /'(?:\\.|[^\\'\r\n])*'/,
greedy: true
},
"character-class": {
pattern: /\[(?:\\.|[^\\\]\r\n])*\]/,
greedy: true,
alias: "regex",
inside: {
"range": {
pattern: /([^[]|(?:^|[^\\])(?:\\\\)*\\\[)-(?!\])/,
lookbehind: true,
alias: "punctuation"
},
"escape": /\\(?:u(?:[a-fA-F\d]{4}|\{[a-fA-F\d]+\})|[pP]\{[=\w-]+\}|[^\r\nupP])/,
"punctuation": /[\[\]]/
}
},
"action": {
pattern: /\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*\})*\}/,
greedy: true,
inside: {
"content": {
// this might be C, C++, Python, Java, C#, or any other language ANTLR4 compiles to
pattern: /(\{)[\s\S]+(?=\})/,
lookbehind: true
},
"punctuation": /[{}]/
}
},
"command": {
pattern: /(->\s*(?!\s))(?:\s*(?:,\s*)?\b[a-z]\w*(?:\s*\([^()\r\n]*\))?)+(?=\s*;)/i,
lookbehind: true,
inside: {
"function": /\b\w+(?=\s*(?:[,(]|$))/,
"punctuation": /[,()]/
}
},
"annotation": {
pattern: /@\w+(?:::\w+)*/,
alias: "keyword"
},
"label": {
pattern: /#[ \t]*\w+/,
alias: "punctuation"
},
"keyword": /\b(?:catch|channels|finally|fragment|grammar|import|lexer|locals|mode|options|parser|returns|throws|tokens)\b/,
"definition": [
{
pattern: /\b[a-z]\w*(?=\s*:)/,
alias: ["rule", "class-name"]
},
{
pattern: /\b[A-Z]\w*(?=\s*:)/,
alias: ["token", "constant"]
}
],
"constant": /\b[A-Z][A-Z_]*\b/,
"operator": /\.\.|->|[|~]|[*+?]\??/,
"punctuation": /[;:()=]/
};
Prism.languages.g4 = Prism.languages.antlr4;
Prism.languages.apacheconf = {
"comment": /#.*/,
"directive-inline": {
pattern: /(^[\t ]*)\b(?:AcceptFilter|AcceptPathInfo|AccessFileName|Action|Add(?:Alt|AltByEncoding|AltByType|Charset|DefaultCharset|Description|Encoding|Handler|Icon|IconByEncoding|IconByType|InputFilter|Language|ModuleInfo|OutputFilter|OutputFilterByType|Type)|Alias|AliasMatch|Allow(?:CONNECT|EncodedSlashes|Methods|Override|OverrideList)?|Anonymous(?:_LogEmail|_MustGiveEmail|_NoUserID|_VerifyEmail)?|AsyncRequestWorkerFactor|Auth(?:BasicAuthoritative|BasicFake|BasicProvider|BasicUseDigestAlgorithm|DBDUserPWQuery|DBDUserRealmQuery|DBMGroupFile|DBMType|DBMUserFile|Digest(?:Algorithm|Domain|NonceLifetime|Provider|Qop|ShmemSize)|Form(?:Authoritative|Body|DisableNoStore|FakeBasicAuth|Location|LoginRequiredLocation|LoginSuccessLocation|LogoutLocation|Method|Mimetype|Password|Provider|SitePassphrase|Size|Username)|GroupFile|LDAP(?:AuthorizePrefix|BindAuthoritative|BindDN|BindPassword|CharsetConfig|CompareAsUser|CompareDNOnServer|DereferenceAliases|GroupAttribute|GroupAttributeIsDN|InitialBindAsUser|InitialBindPattern|MaxSubGroupDepth|RemoteUserAttribute|RemoteUserIsDN|SearchAsUser|SubGroupAttribute|SubGroupClass|Url)|Merging|Name|nCache(?:Context|Enable|ProvideFor|SOCache|Timeout)|nzFcgiCheckAuthnProvider|nzFcgiDefineProvider|Type|UserFile|zDBDLoginToReferer|zDBDQuery|zDBDRedirectQuery|zDBMType|zSendForbiddenOnFailure)|BalancerGrowth|BalancerInherit|BalancerMember|BalancerPersist|BrowserMatch|BrowserMatchNoCase|BufferedLogs|BufferSize|Cache(?:DefaultExpire|DetailHeader|DirLength|DirLevels|Disable|Enable|File|Header|IgnoreCacheControl|IgnoreHeaders|IgnoreNoLastMod|IgnoreQueryString|IgnoreURLSessionIdentifiers|KeyBaseURL|LastModifiedFactor|Lock|LockMaxAge|LockPath|MaxExpire|MaxFileSize|MinExpire|MinFileSize|NegotiatedDocs|QuickHandler|ReadSize|ReadTime|Root|Socache(?:MaxSize|MaxTime|MinTime|ReadSize|ReadTime)?|StaleOnError|StoreExpired|StoreNoStore|StorePrivate)|CGIDScriptTimeout|CGIMapExtension|CharsetDefault|CharsetOptions|CharsetSourceEnc|CheckCaseOnly|CheckSpelling|ChrootDir|ContentDigest|CookieDomain|CookieExpires|CookieName|CookieStyle|CookieTracking|CoreDumpDirectory|CustomLog|Dav|DavDepthInfinity|DavGenericLockDB|DavLockDB|DavMinTimeout|DBDExptime|DBDInitSQL|DBDKeep|DBDMax|DBDMin|DBDParams|DBDPersist|DBDPrepareSQL|DBDriver|DefaultIcon|DefaultLanguage|DefaultRuntimeDir|DefaultType|Define|Deflate(?:BufferSize|CompressionLevel|FilterNote|InflateLimitRequestBody|InflateRatio(?:Burst|Limit)|MemLevel|WindowSize)|Deny|DirectoryCheckHandler|DirectoryIndex|DirectoryIndexRedirect|DirectorySlash|DocumentRoot|DTracePrivileges|DumpIOInput|DumpIOOutput|EnableExceptionHook|EnableMMAP|EnableSendfile|Error|ErrorDocument|ErrorLog|ErrorLogFormat|Example|ExpiresActive|ExpiresByType|ExpiresDefault|ExtendedStatus|ExtFilterDefine|ExtFilterOptions|FallbackResource|FileETag|FilterChain|FilterDeclare|FilterProtocol|FilterProvider|FilterTrace|ForceLanguagePriority|ForceType|ForensicLog|GprofDir|GracefulShutdownTimeout|Group|Header|HeaderName|Heartbeat(?:Address|Listen|MaxServers|Storage)|HostnameLookups|IdentityCheck|IdentityCheckTimeout|ImapBase|ImapDefault|ImapMenu|Include|IncludeOptional|Index(?:HeadInsert|Ignore|IgnoreReset|Options|OrderDefault|StyleSheet)|InputSed|ISAPI(?:AppendLogToErrors|AppendLogToQuery|CacheFile|FakeAsync|LogNotSupported|ReadAheadBuffer)|KeepAlive|KeepAliveTimeout|KeptBodySize|LanguagePriority|LDAP(?:CacheEntries|CacheTTL|ConnectionPoolTTL|ConnectionTimeout|LibraryDebug|OpCacheEntries|OpCacheTTL|ReferralHopLimit|Referrals|Retries|RetryDelay|SharedCacheFile|SharedCacheSize|Timeout|TrustedClientCert|TrustedGlobalCert|TrustedMode|VerifyServerCert)|Limit(?:InternalRecursion|Request(?:Body|Fields|FieldSize|Line)|XMLRequestBody)|Listen|ListenBackLog|LoadFile|LoadModule|LogFormat|LogLevel|LogMessage|LuaAuthzProvider|LuaCodeCache|Lua(?:Hook(?:AccessChecker|AuthChecker|CheckUserID|Fixups|InsertFilter|Log|MapToStorage|TranslateName|TypeChecker)|Inherit|InputFilter|MapHandler|OutputFilter|PackageCPath|PackagePath|QuickHandler|Root|Scope)|Max(?:ConnectionsPerChild|KeepAliveRequests|MemFree|RangeOverlaps|RangeReversals|Ranges|RequestWorkers|SpareServers|SpareThreads|Threads)|MergeTrailers|MetaDir|MetaFiles|MetaSuffix|MimeMagicFile|MinSpareServers|MinSpareThreads|MMapFile|ModemStandard|ModMimeUsePathInfo|MultiviewsMatch|Mutex|NameVirtualHost|NoProxy|NWSSLTrustedCerts|NWSSLUpgradeable|Options|Order|OutputSed|PassEnv|PidFile|PrivilegesMode|Protocol|ProtocolEcho|Proxy(?:AddHeaders|BadHeader|Block|Domain|ErrorOverride|ExpressDBMFile|ExpressDBMType|ExpressEnable|FtpDirCharset|FtpEscapeWildcards|FtpListOnWildcard|HTML(?:BufSize|CharsetOut|DocType|Enable|Events|Extended|Fixups|Interp|Links|Meta|StripComments|URLMap)|IOBufferSize|MaxForwards|Pass(?:Inherit|InterpolateEnv|Match|Reverse|ReverseCookieDomain|ReverseCookiePath)?|PreserveHost|ReceiveBufferSize|Remote|RemoteMatch|Requests|SCGIInternalRedirect|SCGISendfile|Set|SourceAddress|Status|Timeout|Via)|ReadmeName|ReceiveBufferSize|Redirect|RedirectMatch|RedirectPermanent|RedirectTemp|ReflectorHeader|RemoteIP(?:Header|InternalProxy|InternalProxyList|ProxiesHeader|TrustedProxy|TrustedProxyList)|RemoveCharset|RemoveEncoding|RemoveHandler|RemoveInputFilter|RemoveLanguage|RemoveOutputFilter|RemoveType|RequestHeader|RequestReadTimeout|Require|Rewrite(?:Base|Cond|Engine|Map|Options|Rule)|RLimitCPU|RLimitMEM|RLimitNPROC|Satisfy|ScoreBoardFile|Script(?:Alias|AliasMatch|InterpreterSource|Log|LogBuffer|LogLength|Sock)?|SecureListen|SeeRequestTail|SendBufferSize|Server(?:Admin|Alias|Limit|Name|Path|Root|Signature|Tokens)|Session(?:Cookie(?:Name|Name2|Remove)|Crypto(?:Cipher|Driver|Passphrase|PassphraseFile)|DBD(?:CookieName|CookieName2|CookieRemove|DeleteLabel|InsertLabel|PerUser|SelectLabel|UpdateLabel)|Env|Exclude|Header|Include|MaxAge)?|SetEnv|SetEnvIf|SetEnvIfExpr|SetEnvIfNoCase|SetHandler|SetInputFilter|SetOutputFilter|SSIEndTag|SSIErrorMsg|SSIETag|SSILastModified|SSILegacyExprParser|SSIStartTag|SSITimeFormat|SSIUndefinedEcho|SSL(?:CACertificateFile|CACertificatePath|CADNRequestFile|CADNRequestPath|CARevocationCheck|CARevocationFile|CARevocationPath|CertificateChainFile|CertificateFile|CertificateKeyFile|CipherSuite|Compression|CryptoDevice|Engine|FIPS|HonorCipherOrder|InsecureRenegotiation|OCSP(?:DefaultResponder|Enable|OverrideResponder|ResponderTimeout|ResponseMaxAge|ResponseTimeSkew|UseRequestNonce)|OpenSSLConfCmd|Options|PassPhraseDialog|Protocol|Proxy(?:CACertificateFile|CACertificatePath|CARevocation(?:Check|File|Path)|CheckPeer(?:CN|Expire|Name)|CipherSuite|Engine|MachineCertificate(?:ChainFile|File|Path)|Protocol|Verify|VerifyDepth)|RandomSeed|RenegBufferSize|Require|RequireSSL|Session(?:Cache|CacheTimeout|TicketKeyFile|Tickets)|SRPUnknownUserSeed|SRPVerifierFile|Stapling(?:Cache|ErrorCacheTimeout|FakeTryLater|ForceURL|ResponderTimeout|ResponseMaxAge|ResponseTimeSkew|ReturnResponderErrors|StandardCacheTimeout)|StrictSNIVHostCheck|UserName|UseStapling|VerifyClient|VerifyDepth)|StartServers|StartThreads|Substitute|Suexec|SuexecUserGroup|ThreadLimit|ThreadsPerChild|ThreadStackSize|TimeOut|TraceEnable|TransferLog|TypesConfig|UnDefine|UndefMacro|UnsetEnv|Use|UseCanonicalName|UseCanonicalPhysicalPort|User|UserDir|VHostCGIMode|VHostCGIPrivs|VHostGroup|VHostPrivs|VHostSecure|VHostUser|Virtual(?:DocumentRoot|ScriptAlias)(?:IP)?|WatchdogInterval|XBitHack|xml2EncAlias|xml2EncDefault|xml2StartParse)\b/im,
lookbehind: true,
alias: "property"
},
"directive-block": {
pattern: /<\/?\b(?:Auth[nz]ProviderAlias|Directory|DirectoryMatch|Else|ElseIf|Files|FilesMatch|If|IfDefine|IfModule|IfVersion|Limit|LimitExcept|Location|LocationMatch|Macro|Proxy|Require(?:All|Any|None)|VirtualHost)\b.*>/i,
inside: {
"directive-block": {
pattern: /^<\/?\w+/,
inside: {
"punctuation": /^<\/?/
},
alias: "tag"
},
"directive-block-parameter": {
pattern: /.*[^>]/,
inside: {
"punctuation": /:/,
"string": {
pattern: /("|').*\1/,
inside: {
"variable": /[$%]\{?(?:\w\.?[-+:]?)+\}?/
}
}
},
alias: "attr-value"
},
"punctuation": />/
},
alias: "tag"
},
"directive-flags": {
pattern: /\[(?:[\w=],?)+\]/,
alias: "keyword"
},
"string": {
pattern: /("|').*\1/,
inside: {
"variable": /[$%]\{?(?:\w\.?[-+:]?)+\}?/
}
},
"variable": /[$%]\{?(?:\w\.?[-+:]?)+\}?/,
"regex": /\^?.*\$|\^.*\$?/
};
Prism.languages.sql = {
"comment": {
pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
lookbehind: true
},
"variable": [
{
pattern: /@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,
greedy: true
},
/@[\w.$]+/
],
"string": {
pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,
greedy: true,
lookbehind: true
},
"identifier": {
pattern: /(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,
greedy: true,
lookbehind: true,
inside: {
"punctuation": /^`|`$/
}
},
"function": /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,
// Should we highlight user defined functions too?
"keyword": /\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,
"boolean": /\b(?:FALSE|NULL|TRUE)\b/i,
"number": /\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,
"operator": /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,
"punctuation": /[;[\]()`,.]/
};
(function(Prism2) {
var keywords = /\b(?:(?:after|before)(?=\s+[a-z])|abstract|activate|and|any|array|as|asc|autonomous|begin|bigdecimal|blob|boolean|break|bulk|by|byte|case|cast|catch|char|class|collect|commit|const|continue|currency|date|datetime|decimal|default|delete|desc|do|double|else|end|enum|exception|exit|export|extends|final|finally|float|for|from|get(?=\s*[{};])|global|goto|group|having|hint|if|implements|import|in|inner|insert|instanceof|int|integer|interface|into|join|like|limit|list|long|loop|map|merge|new|not|null|nulls|number|object|of|on|or|outer|override|package|parallel|pragma|private|protected|public|retrieve|return|rollback|select|set|short|sObject|sort|static|string|super|switch|synchronized|system|testmethod|then|this|throw|time|transaction|transient|trigger|try|undelete|update|upsert|using|virtual|void|webservice|when|where|while|(?:inherited|with|without)\s+sharing)\b/i;
var className = /\b(?:(?=[a-z_]\w*\s*[<\[])|(?!<keyword>))[A-Z_]\w*(?:\s*\.\s*[A-Z_]\w*)*\b(?:\s*(?:\[\s*\]|<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>))*/.source.replace(/<keyword>/g, function() {
return keywords.source;
});
function insertClassName(pattern) {
return RegExp(pattern.replace(/<CLASS-NAME>/g, function() {
return className;
}), "i");
}
var classNameInside = {
"keyword": keywords,
"punctuation": /[()\[\]{};,:.<>]/
};
Prism2.languages.apex = {
"comment": Prism2.languages.clike.comment,
"string": Prism2.languages.clike.string,
"sql": {
pattern: /((?:[=,({:]|\breturn)\s*)\[[^\[\]]*\]/i,
lookbehind: true,
greedy: true,
alias: "language-sql",
inside: Prism2.languages.sql
},
"annotation": {
pattern: /@\w+\b/,
alias: "punctuation"
},
"class-name": [
{
pattern: insertClassName(/(\b(?:class|enum|extends|implements|instanceof|interface|new|trigger\s+\w+\s+on)\s+)<CLASS-NAME>/.source),
lookbehind: true,
inside: classNameInside
},
{
// cast
pattern: insertClassName(/(\(\s*)<CLASS-NAME>(?=\s*\)\s*[\w(])/.source),
lookbehind: true,
inside: classNameInside
},
{
// variable/parameter declaration and return types
pattern: insertClassName(/<CLASS-NAME>(?=\s*\w+\s*[;=,(){:])/.source),
inside: classNameInside
}
],
"trigger": {
pattern: /(\btrigger\s+)\w+\b/i,
lookbehind: true,
alias: "class-name"
},
"keyword": keywords,
"function": /\b[a-z_]\w*(?=\s*\()/i,
"boolean": /\b(?:false|true)\b/i,
"number": /(?:\B\.\d+|\b\d+(?:\.\d+|L)?)\b/i,
"operator": /[!=](?:==?)?|\?\.?|&&|\|\||--|\+\+|[-+*/^&|]=?|:|<<?=?|>{1,3}=?/,
"punctuation": /[()\[\]{};,.]/
};
})(Prism);
Prism.languages.apl = {
"comment": /(?:⍝|#[! ]).*$/m,
"string": {
pattern: /'(?:[^'\r\n]|'')*'/,
greedy: true
},
"number": /¯?(?:\d*\.?\b\d+(?:e[+¯]?\d+)?|¯|∞)(?:j¯?(?:(?:\d+(?:\.\d+)?|\.\d+)(?:e[+¯]?\d+)?|¯|∞))?/i,
"statement": /:[A-Z][a-z][A-Za-z]*\b/,
"system-function": {
pattern: /⎕[A-Z]+/i,
alias: "function"
},
"constant": /[⍬⌾#⎕⍞]/,
"function": /[-+×÷⌈⌊∣|⍳⍸?*⍟○!⌹<≤=>≥≠≡≢∊⍷∪∩~∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⊆⊇⌷⍋⍒⊤⊥⍕⍎⊣⊢⍁⍂≈⍯↗¤→]/,
"monadic-operator": {
pattern: /[\\\/⌿⍀¨⍨⌶&∥]/,
alias: "operator"
},
"dyadic-operator": {
pattern: /[.⍣⍠⍤∘⌸@⌺⍥]/,
alias: "operator"
},
"assignment": {
pattern: /←/,
alias: "keyword"
},
"punctuation": /[\[;\]()◇⋄]/,
"dfn": {
pattern: /[{}⍺⍵⍶⍹∇⍫:]/,
alias: "builtin"
}
};
Prism.languages.applescript = {
"comment": [
// Allow one level of nesting
/\(\*(?:\(\*(?:[^*]|\*(?!\)))*\*\)|(?!\(\*)[\s\S])*?\*\)/,
/--.+/,
/#.+/
],
"string": /"(?:\\.|[^"\\\r\n])*"/,
"number": /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e-?\d+)?\b/i,
"operator": [
/[&=≠≤≥*+\-\/÷^]|[<>]=?/,
/\b(?:(?:begin|end|start)s? with|(?:contains?|(?:does not|doesn't) contain)|(?:is|isn't|is not) (?:contained by|in)|(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?|(?:comes|(?:does not|doesn't) come) (?:after|before)|(?:is|isn't|is not) equal(?: to)?|(?:(?:does not|doesn't) equal|equal to|equals|is not|isn't)|(?:a )?(?:ref(?: to)?|reference to)|(?:and|as|div|mod|not|or))\b/
],
"keyword": /\b(?:about|above|after|against|apart from|around|aside from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|continue|copy|does|eighth|else|end|equal|error|every|exit|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead of|into|is|it|its|last|local|me|middle|my|ninth|of|on|onto|out of|over|prop|property|put|repeat|return|returning|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b/,
"class-name": /\b(?:POSIX file|RGB color|alias|application|boolean|centimeters|centimetres|class|constant|cubic centimeters|cubic centimetres|cubic feet|cubic inches|cubic meters|cubic metres|cubic yards|date|degrees Celsius|degrees Fahrenheit|degrees Kelvin|feet|file|gallons|grams|inches|integer|kilograms|kilometers|kilometres|list|liters|litres|meters|metres|miles|number|ounces|pounds|quarts|real|record|reference|script|square feet|square kilometers|square kilometres|square meters|square metres|square miles|square yards|text|yards)\b/,
"punctuation": /[{}():,¬«»《》]/
};
Prism.languages.aql = {
"comment": /\/\/.*|\/\*[\s\S]*?\*\//,
"property": {
pattern: /([{,]\s*)(?:(?!\d)\w+|(["'´`])(?:(?!\2)[^\\\r\n]|\\.)*\2)(?=\s*:)/,
lookbehind: true,
greedy: true
},
"string": {
pattern: /(["'])(?:(?!\1)[^\\\r\n]|\\.)*\1/,
greedy: true
},
"identifier": {
pattern: /([´`])(?:(?!\1)[^\\\r\n]|\\.)*\1/,
greedy: true
},
"variable": /@@?\w+/,
"keyword": [
{
pattern: /(\bWITH\s+)COUNT(?=\s+INTO\b)/i,
lookbehind: true
},
/\b(?:AGGREGATE|ALL|AND|ANY|ASC|COLLECT|DESC|DISTINCT|FILTER|FOR|GRAPH|IN|INBOUND|INSERT|INTO|K_PATHS|K_SHORTEST_PATHS|LET|LIKE|LIMIT|NONE|NOT|NULL|OR|OUTBOUND|REMOVE|REPLACE|RETURN|SHORTEST_PATH|SORT|UPDATE|UPSERT|WINDOW|WITH)\b/i,
// pseudo keywords get a lookbehind to avoid false positives
{
pattern: /(^|[^\w.[])(?:KEEP|PRUNE|SEARCH|TO)\b/i,
lookbehind: true
},
{
pattern: /(^|[^\w.[])(?:CURRENT|NEW|OLD)\b/,
lookbehind: true
},
{
pattern: /\bOPTIONS(?=\s*\{)/i
}
],
"function": /\b(?!\d)\w+(?=\s*\()/,
"boolean": /\b(?:false|true)\b/i,
"range": {
pattern: /\.\./,
alias: "operator"
},
"number": [
/\b0b[01]+/i,
/\b0x[0-9a-f]+/i,
/(?:\B\.\d+|\b(?:0|[1-9]\d*)(?:\.\d+)?)(?:e[+-]?\d+)?/i
],
"operator": /\*{2,}|[=!]~|[!=<>]=?|&&|\|\||[-+*/%]/,
"punctuation": /::|[?.:,;()[\]{}]/
};
Prism.languages.c = Prism.languages.extend("clike", {
"comment": {
pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,
greedy: true
},
"string": {
// https://en.cppreference.com/w/c/language/string_literal
pattern: /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
greedy: true
},
"class-name": {
pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
lookbehind: true
},
"keyword": /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,
"function": /\b[a-z_]\w*(?=\s*\()/i,
"number": /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
"operator": />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/
});
Prism.languages.insertBefore("c", "string", {
"char": {
// https://en.cppreference.com/w/c/language/character_constant
pattern: /'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,
greedy: true
}
});
Prism.languages.insertBefore("c", "string", {
"macro": {
// allow for multiline macro definitions
// spaces after the # character compile fine with gcc
pattern: /(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,
lookbehind: true,
greedy: true,
alias: "property",
inside: {
"string": [
{
// highlight the path of the include statement as a string
pattern: /^(#\s*include\s*)<[^>]+>/,
lookbehind: true
},
Prism.languages.c["string"]
],
"char": Prism.languages.c["char"],
"comment": Prism.languages.c["comment"],
"macro-name": [
{
pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
lookbehind: true
},
{
pattern: /(^#\s*define\s+)\w+\b(?=\()/i,
lookbehind: true,
alias: "function"
}
],
// highlight macro directives as keywords
"directive": {
pattern: /^(#\s*)[a-z]+/,
lookbehind: true,
alias: "keyword"
},
"directive-hash": /^#/,
"punctuation": /##|\\(?=[\r\n])/,
"expression": {
pattern: /\S[\s\S]*/,
inside: Prism.languages.c
}
}
}
});
Prism.languages.insertBefore("c", "function", {
// highlight predefined macros as constants
"constant": /\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/
});
delete Prism.languages.c["boolean"];
(function(Prism2) {
var keyword = /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/;
var modName = /\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g, function() {
return keyword.source;
});
Prism2.languages.cpp = Prism2.languages.extend("c", {
"class-name": [
{
pattern: RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g, function() {
return keyword.source;
})),
lookbehind: true
},
// This is intended to capture the class name of method implementations like:
// void foo::bar() const {}
// However! The `foo` in the above example could also be a namespace, so we only capture the class name if
// it starts with an uppercase letter. This approximation should give decent results.
/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,
// This will capture the class name before destructors like:
// Foo::~Foo() {}
/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,
// This also intends to capture the class name of method implementations but here the class has template
// parameters, so it can't be a namespace (until C++ adds generic namespaces).
/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/
],
"keyword": keyword,
"number": {
pattern: /(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,
greedy: true
},
"operator": />>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,
"boolean": /\b(?:false|true)\b/
});
Prism2.languages.insertBefore("cpp", "string", {
"module": {
// https://en.cppreference.com/w/cpp/language/modules
pattern: RegExp(
/(\b(?:import|module)\s+)/.source + "(?:" + // header-name
/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source + "|" + // module name or partition or both
/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g, function() {
return modName;
}) + ")"
),
lookbehind: true,
greedy: true,
inside: {
"string": /^[<"][\s\S]+/,
"operator": /:/,
"punctuation": /\./
}
},
"raw-string": {
pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,
alias: "string",
greedy: true
}
});
Prism2.languages.insertBefore("cpp", "keyword", {
"generic-function": {
pattern: /\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,
inside: {
"function": /^\w+/,
"generic": {
pattern: /<[\s\S]+/,
alias: "class-name",
inside: Prism2.languages.cpp
}
}
}
});
Prism2.languages.insertBefore("cpp", "operator", {
"double-colon": {
pattern: /::/,
alias: "punctuation"
}
});
Prism2.languages.insertBefore("cpp", "class-name", {
// the base clause is an optional list of parent classes
// https://en.cppreference.com/w/cpp/language/class
"base-clause": {
pattern: /(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,
lookbehind: true,
greedy: true,
inside: Prism2.languages.extend("cpp", {})
}
});
Prism2.languages.insertBefore("inside", "double-colon", {
// All untokenized words that are not namespaces should be class names
"class-name": /\b[a-z_]\w*\b(?!\s*::)/i
}, Prism2.languages.cpp["base-clause"]);
})(Prism);
Prism.languages.arduino = Prism.languages.extend("cpp", {
"keyword": /\b(?:String|array|bool|boolean|break|byte|case|catch|continue|default|do|double|else|finally|for|function|goto|if|in|instanceof|int|integer|long|loop|new|null|return|setup|string|switch|throw|try|void|while|word)\b/,
"constant": /\b(?:ANALOG_MESSAGE|DEFAULT|DIGITAL_MESSAGE|EXTERNAL|FIRMATA_STRING|HIGH|INPUT|INPUT_PULLUP|INTERNAL|INTERNAL1V1|INTERNAL2V56|LED_BUILTIN|LOW|OUTPUT|REPORT_ANALOG|REPORT_DIGITAL|SET_PIN_MODE|SYSEX_START|SYSTEM_RESET)\b/,
"builtin": /\b(?:Audio|BSSID|Bridge|Client|Console|EEPROM|Esplora|EsploraTFT|Ethernet|EthernetClient|EthernetServer|EthernetUDP|File|FileIO|FileSystem|Firmata|GPRS|GSM|GSMBand|GSMClient|GSMModem|GSMPIN|GSMScanner|GSMServer|GSMVoiceCall|GSM_SMS|HttpClient|IPAddress|IRread|Keyboard|KeyboardController|LiquidCrystal|LiquidCrystal_I2C|Mailbox|Mouse|MouseController|PImage|Process|RSSI|RobotControl|RobotMotor|SD|SPI|SSID|Scheduler|Serial|Server|Servo|SoftwareSerial|Stepper|Stream|TFT|Task|USBHost|WiFi|WiFiClient|WiFiServer|WiFiUDP|Wire|YunClient|YunServer|abs|addParameter|analogRead|analogReadResolution|analogReference|analogWrite|analogWriteResolution|answerCall|attach|attachGPRS|attachInterrupt|attached|autoscroll|available|background|beep|begin|beginPacket|beginSD|beginSMS|beginSpeaker|beginTFT|beginTransmission|beginWrite|bit|bitClear|bitRead|bitSet|bitWrite|blink|blinkVersion|buffer|changePIN|checkPIN|checkPUK|checkReg|circle|cityNameRead|cityNameWrite|clear|clearScreen|click|close|compassRead|config|connect|connected|constrain|cos|countryNameRead|countryNameWrite|createChar|cursor|debugPrint|delay|delayMicroseconds|detach|detachInterrupt|digitalRead|digitalWrite|disconnect|display|displayLogos|drawBMP|drawCompass|encryptionType|end|endPacket|endSMS|endTransmission|endWrite|exists|exitValue|fill|find|findUntil|flush|gatewayIP|get|getAsynchronously|getBand|getButton|getCurrentCarrier|getIMEI|getKey|getModifiers|getOemKey|getPINUsed|getResult|getSignalStrength|getSocket|getVoiceCallStatus|getXChange|getYChange|hangCall|height|highByte|home|image|interrupts|isActionDone|isDirectory|isListening|isPIN|isPressed|isValid|keyPressed|keyReleased|keyboardRead|knobRead|leftToRight|line|lineFollowConfig|listen|listenOnLocalhost|loadImage|localIP|lowByte|macAddress|maintain|map|max|messageAvailable|micros|millis|min|mkdir|motorsStop|motorsWrite|mouseDragged|mouseMoved|mousePressed|mouseReleased|move|noAutoscroll|noBlink|noBuffer|noCursor|noDisplay|noFill|noInterrupts|noListenOnLocalhost|noStroke|noTone|onReceive|onRequest|open|openNextFile|overflow|parseCommand|parseFloat|parseInt|parsePacket|pauseMode|peek|pinMode|playFile|playMelody|point|pointTo|position|pow|prepare|press|print|printFirmwareVersion|printVersion|println|process|processInput|pulseIn|put|random|randomSeed|read|readAccelerometer|readBlue|readButton|readBytes|readBytesUntil|readGreen|readJoystickButton|readJoystickSwitch|readJoystickX|readJoystickY|readLightSensor|readMessage|readMicrophone|readNetworks|readRed|readSlider|readString|readStringUntil|readTemperature|ready|rect|release|releaseAll|remoteIP|remoteNumber|remotePort|remove|requestFrom|retrieveCallingNumber|rewindDirectory|rightToLeft|rmdir|robotNameRead|robotNameWrite|run|runAsynchronously|runShellCommand|runShellCommandAsynchronously|running|scanNetworks|scrollDisplayLeft|scrollDisplayRight|seek|sendAnalog|sendDigitalPortPair|sendDigitalPorts|sendString|sendSysex|serialEvent|setBand|setBitOrder|setClockDivider|setCursor|setDNS|setDataMode|setFirmwareVersion|setMode|setPINUsed|setSpeed|setTextSize|setTimeout|shiftIn|shiftOut|shutdown|sin|size|sqrt|startLoop|step|stop|stroke|subnetMask|switchPIN|tan|tempoWrite|text|tone|transfer|tuneWrite|turn|updateIR|userNameRead|userNameWrite|voiceCall|waitContinue|width|write|writeBlue|writeGreen|writeJSON|writeMessage|writeMicroseconds|writeRGB|writeRed|yield)\b/
});
Prism.languages.ino = Prism.languages.arduino;
Prism.languages.arff = {
"comment": /%.*/,
"string": {
pattern: /(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,
greedy: true
},
"keyword": /@(?:attribute|data|end|relation)\b/i,
"number": /\b\d+(?:\.\d+)?\b/,
"punctuation": /[{},]/
};
Prism.languages.armasm = {
"comment": {
pattern: /;.*/,
greedy: true
},
"string": {
pattern: /"(?:[^"\r\n]|"")*"/,
greedy: true,
inside: {
"variable": {
pattern: /((?:^|[^$])(?:\${2})*)\$\w+/,
lookbehind: true
}
}
},
"char": {
pattern: /'(?:[^'\r\n]{0,4}|'')'/,
greedy: true
},
"version-symbol": {
pattern: /\|[\w@]+\|/,
greedy: true,
alias: "property"
},
"boolean": /\b(?:FALSE|TRUE)\b/,
"directive": {
pattern: /\b(?:ALIAS|ALIGN|AREA|ARM|ASSERT|ATTR|CN|CODE|CODE16|CODE32|COMMON|CP|DATA|DCB|DCD|DCDO|DCDU|DCFD|DCFDU|DCI|DCQ|DCQU|DCW|DCWU|DN|ELIF|ELSE|END|ENDFUNC|ENDIF|ENDP|ENTRY|EQU|EXPORT|EXPORTAS|EXTERN|FIELD|FILL|FN|FUNCTION|GBLA|GBLL|GBLS|GET|GLOBAL|IF|IMPORT|INCBIN|INCLUDE|INFO|KEEP|LCLA|LCLL|LCLS|LTORG|MACRO|MAP|MEND|MEXIT|NOFP|OPT|PRESERVE8|PROC|QN|READONLY|RELOC|REQUIRE|REQUIRE8|RLIST|ROUT|SETA|SETL|SETS|SN|SPACE|SUBT|THUMB|THUMBX|TTL|WEND|WHILE)\b/,
alias: "property"
},
"instruction": {
pattern: /((?:^|(?:^|[^\\])(?:\r\n?|\n))[ \t]*(?:(?:[A-Z][A-Z0-9_]*[a-z]\w*|[a-z]\w*|\d+)[ \t]+)?)\b[A-Z.]+\b/,
lookbehind: true,
alias: "keyword"
},
"variable": /\$\w+/,
"number": /(?:\b[2-9]_\d+|(?:\b\d+(?:\.\d+)?|\B\.\d+)(?:e-?\d+)?|\b0(?:[fd]_|x)[0-9a-f]+|&[0-9a-f]+)\b/i,
"register": {
pattern: /\b(?:r\d|lr)\b/,
alias: "symbol"
},
"operator": /<>|<<|>>|&&|\|\||[=!<>/]=?|[+\-*%#?&|^]|:[A-Z]+:/,
"punctuation": /[()[\],]/
};
Prism.languages["arm-asm"] = Prism.languages.armasm;
(function(Prism2) {
var createLanguageString = function(lang, pattern) {
return {
pattern: RegExp(/\{!/.source + "(?:" + (pattern || lang) + ")" + /$[\s\S]*\}/.source, "m"),
greedy: true,
inside: {
"embedded": {
pattern: /(^\{!\w+\b)[\s\S]+(?=\}$)/,
lookbehind: true,
alias: "language-" + lang,
inside: Prism2.languages[lang]
},
"string": /[\s\S]+/
}
};
};
Prism2.languages.arturo = {
"comment": {
pattern: /;.*/,
greedy: true
},
"character": {
pattern: /`.`/,
alias: "char",
greedy: true
},
"number": {
pattern: /\b\d+(?:\.\d+(?:\.\d+(?:-[\w+-]+)?)?)?\b/
},
"string": {
pattern: /"(?:[^"\\\r\n]|\\.)*"/,
greedy: true
},
"regex": {
pattern: /\{\/.*?\/\}/,
greedy: true
},
"html-string": createLanguageString("html"),
"css-string": createLanguageString("css"),
"js-string": createLanguageString("js"),
"md-string": createLanguageString("md"),
"sql-string": createLanguageString("sql"),
"sh-string": createLanguageString("shell", "sh"),
"multistring": {
pattern: /».*|\{:[\s\S]*?:\}|\{[\s\S]*?\}|^-{6}$[\s\S]*/m,
alias: "string",
greedy: true
},
"label": {
pattern: /\w+\b\??:/,
alias: "property"
},
"literal": {
pattern: /'(?:\w+\b\??:?)/,
alias: "constant"
},
"type": {
pattern: /:(?:\w+\b\??:?)/,
alias: "class-name"
},
"color": /#\w+/,
"predicate": {
pattern: /\b(?:all|and|any|ascii|attr|attribute|attributeLabel|binary|block|char|contains|database|date|dictionary|empty|equal|even|every|exists|false|floating|function|greater|greaterOrEqual|if|in|inline|integer|is|key|label|leap|less|lessOrEqual|literal|logical|lower|nand|negative|nor|not|notEqual|null|numeric|odd|or|path|pathLabel|positive|prefix|prime|regex|same|set|some|sorted|standalone|string|subset|suffix|superset|symbol|symbolLiteral|true|try|type|unless|upper|when|whitespace|word|xnor|xor|zero)\?/,
alias: "keyword"
},
"builtin-function": {
pattern: /\b(?:abs|acos|acosh|acsec|acsech|actan|actanh|add|after|alert|alias|and|angle|append|arg|args|arity|array|as|asec|asech|asin|asinh|atan|atan2|atanh|attr|attrs|average|before|benchmark|blend|break|call|capitalize|case|ceil|chop|clear|clip|close|color|combine|conj|continue|copy|cos|cosh|crc|csec|csech|ctan|ctanh|cursor|darken|dec|decode|define|delete|desaturate|deviation|dialog|dictionary|difference|digest|digits|div|do|download|drop|dup|e|else|empty|encode|ensure|env|escape|execute|exit|exp|extend|extract|factors|fdiv|filter|first|flatten|floor|fold|from|function|gamma|gcd|get|goto|hash|hypot|if|inc|indent|index|infinity|info|input|insert|inspect|intersection|invert|jaro|join|keys|kurtosis|last|let|levenshtein|lighten|list|ln|log|loop|lower|mail|map|match|max|median|min|mod|module|mul|nand|neg|new|nor|normalize|not|now|null|open|or|outdent|pad|palette|panic|path|pause|permissions|permutate|pi|pop|popup|pow|powerset|powmod|prefix|print|prints|process|product|query|random|range|read|relative|remove|rename|render|repeat|replace|request|return|reverse|round|sample|saturate|script|sec|sech|select|serve|set|shl|shr|shuffle|sin|sinh|size|skewness|slice|sort|spin|split|sqrt|squeeze|stack|strip|sub|suffix|sum|switch|symbols|symlink|sys|take|tan|tanh|terminal|terminate|to|truncate|try|type|unclip|union|unique|unless|until|unzip|upper|values|var|variance|volume|webview|while|with|wordwrap|write|xnor|xor|zip)\b/,
alias: "keyword"
},
"sugar": {
pattern: /->|=>|\||::/,
alias: "operator"
},
"punctuation": /[()[\],]/,
"symbol": {
pattern: /<:|-:|ø|@|#|\+|\||\*|\$|---|-|%|\/|\.\.|\^|~|=|<|>|\\/
},
"boolean": {
pattern: /\b(?:false|maybe|true)\b/
}
};
Prism2.languages.art = Prism2.languages["arturo"];
})(Prism);
(function(Prism2) {
var attributes = {
pattern: /(^[ \t]*)\[(?!\[)(?:(["'$`])(?:(?!\2)[^\\]|\\.)*\2|\[(?:[^\[\]\\]|\\.)*\]|[^\[\]\\"'$`]|\\.)*\]/m,
lookbehind: true,
inside: {
"quoted": {
pattern: /([$`])(?:(?!\1)[^\\]|\\.)*\1/,
inside: {
"punctuation": /^[$`]|[$`]$/
}
},
"interpreted": {
pattern: /'(?:[^'\\]|\\.)*'/,
inside: {
"punctuation": /^'|'$/
// See rest below
}
},
"string": /"(?:[^"\\]|\\.)*"/,
"variable": /\w+(?==)/,
"punctuation": /^\[|\]$|,/,
"operator": /=/,
// The negative look-ahead prevents blank matches
"attr-value": /(?!^\s+$).+/
}
};
var asciidoc = Prism2.languages.asciidoc = {
"comment-block": {
pattern: /^(\/{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1/m,
alias: "comment"
},
"table": {
pattern: /^\|={3,}(?:(?:\r?\n|\r(?!\n)).*)*?(?:\r?\n|\r)\|={3,}$/m,
inside: {
"specifiers": {
pattern: /(?:(?:(?:\d+(?:\.\d+)?|\.\d+)[+*](?:[<^>](?:\.[<^>])?|\.[<^>])?|[<^>](?:\.[<^>])?|\.[<^>])[a-z]*|[a-z]+)(?=\|)/,
alias: "attr-value"
},
"punctuation": {
pattern: /(^|[^\\])[|!]=*/,
lookbehind: true
}
// See rest below
}
},
"passthrough-block": {
pattern: /^(\+{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m,
inside: {
"punctuation": /^\++|\++$/
// See rest below
}
},
// Literal blocks and listing blocks
"literal-block": {
pattern: /^(-{4,}|\.{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m,
inside: {
"punctuation": /^(?:-+|\.+)|(?:-+|\.+)$/
// See rest below
}
},
// Sidebar blocks, quote blocks, example blocks and open blocks
"other-block": {
pattern: /^(--|\*{4,}|_{4,}|={4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m,
inside: {
"punctuation": /^(?:-+|\*+|_+|=+)|(?:-+|\*+|_+|=+)$/
// See rest below
}
},
// list-punctuation and list-label must appear before indented-block
"list-punctuation": {
pattern: /(^[ \t]*)(?:-|\*{1,5}|\.{1,5}|(?:[a-z]|\d+)\.|[xvi]+\))(?= )/im,
lookbehind: true,
alias: "punctuation"
},
"list-label": {
pattern: /(^[ \t]*)[a-z\d].+(?::{2,4}|;;)(?=\s)/im,
lookbehind: true,
alias: "symbol"
},
"indented-block": {
pattern: /((\r?\n|\r)\2)([ \t]+)\S.*(?:(?:\r?\n|\r)\3.+)*(?=\2{2}|$)/,
lookbehind: true
},
"comment": /^\/\/.*/m,
"title": {
pattern: /^.+(?:\r?\n|\r)(?:={3,}|-{3,}|~{3,}|\^{3,}|\+{3,})$|^={1,5} .+|^\.(?![\s.]).*/m,
alias: "important",
inside: {
"punctuation": /^(?:\.|=+)|(?:=+|-+|~+|\^+|\++)$/
// See rest below
}
},
"attribute-entry": {
pattern: /^:[^:\r\n]+:(?: .*?(?: \+(?:\r?\n|\r).*?)*)?$/m,
alias: "tag"
},
"attributes": attributes,
"hr": {
pattern: /^'{3,}$/m,
alias: "punctuation"
},
"page-break": {
pattern: /^<{3,}$/m,
alias: "punctuation"
},
"admonition": {
pattern: /^(?:CAUTION|IMPORTANT|NOTE|TIP|WARNING):/m,
alias: "keyword"
},
"callout": [
{
pattern: /(^[ \t]*)<?\d*>/m,
lookbehind: true,
alias: "symbol"
},
{
pattern: /<\d+>/,
alias: "symbol"
}
],
"macro": {
pattern: /\b[a-z\d][a-z\d-]*::?(?:[^\s\[\]]*\[(?:[^\]\\"']|(["'])(?:(?!\1)[^\\]|\\.)*\1|\\.)*\])/,
inside: {
"function": /^[a-z\d-]+(?=:)/,
"punctuation": /^::?/,
"attributes": {
pattern: /(?:\[(?:[^\]\\"']|(["'])(?:(?!\1)[^\\]|\\.)*\1|\\.)*\])/,
inside: attributes.inside
}
}
},
"inline": {
/*
The initial look-behind prevents the highlighting of escaped quoted text.
Quoted text can be multi-line but cannot span an empty line.
All quoted text can have attributes before [foobar, 'foobar', baz="bar"].
First, we handle the constrained quotes.
Those must be bounded by non-word chars and cannot have spaces between the delimiter and the first char.
They are, in order: _emphasis_, ``double quotes'', `single quotes', `monospace`, 'emphasis', *strong*, +monospace+ and #unquoted#
Then we handle the unconstrained quotes.
Those do not have the restrictions of the constrained quotes.
They are, in order: __emphasis__, **strong**, ++monospace++, +++passthrough+++, ##unquoted##, $$passthrough$$, ~subscript~, ^superscript^, {attribute-reference}, [[anchor]], [[[bibliography anchor]]], <<xref>>, (((indexes))) and ((indexes))
*/
pattern: /(^|[^\\])(?:(?:\B\[(?:[^\]\\"']|(["'])(?:(?!\2)[^\\]|\\.)*\2|\\.)*\])?(?:\b_(?!\s)(?: _|[^_\\\r\n]|\\.)+(?:(?:\r?\n|\r)(?: _|[^_\\\r\n]|\\.)+)*_\b|\B``(?!\s).+?(?:(?:\r?\n|\r).+?)*''\B|\B`(?!\s)(?:[^`'\s]|\s+\S)+['`]\B|\B(['*+#])(?!\s)(?: \3|(?!\3)[^\\\r\n]|\\.)+(?:(?:\r?\n|\r)(?: \3|(?!\3)[^\\\r\n]|\\.)+)*\3\B)|(?:\[(?:[^\]\\"']|(["'])(?:(?!\4)[^\\]|\\.)*\4|\\.)*\])?(?:(__|\*\*|\+\+\+?|##|\$\$|[~^]).+?(?:(?:\r?\n|\r).+?)*\5|\{[^}\r\n]+\}|\[\[\[?.+?(?:(?:\r?\n|\r).+?)*\]?\]\]|<<.+?(?:(?:\r?\n|\r).+?)*>>|\(\(\(?.+?(?:(?:\r?\n|\r).+?)*\)?\)\)))/m,
lookbehind: true,
inside: {
"attributes": attributes,
"url": {
pattern: /^(?:\[\[\[?.+?\]?\]\]|<<.+?>>)$/,
inside: {
"punctuation": /^(?:\[\[\[?|<<)|(?:\]\]\]?|>>)$/
}
},
"attribute-ref": {
pattern: /^\{.+\}$/,
inside: {
"variable": {
pattern: /(^\{)[a-z\d,+_-]+/,
lookbehind: true
},
"operator": /^[=?!#%@$]|!(?=[:}])/,
"punctuation": /^\{|\}$|::?/
}
},
"italic": {
pattern: /^(['_])[\s\S]+\1$/,
inside: {
"punctuation": /^(?:''?|__?)|(?:''?|__?)$/
}
},
"bold": {
pattern: /^\*[\s\S]+\*$/,
inside: {
punctuation: /^\*\*?|\*\*?$/
}
},
"punctuation": /^(?:``?|\+{1,3}|##?|\$\$|[~^]|\(\(\(?)|(?:''?|\+{1,3}|##?|\$\$|[~^`]|\)?\)\))$/
}
},
"replacement": {
pattern: /\((?:C|R|TM)\)/,
alias: "builtin"
},
"entity": /&#?[\da-z]{1,8};/i,
"line-continuation": {
pattern: /(^| )\+$/m,
lookbehind: true,
alias: "punctuation"
}
};
function copyFromAsciiDoc(keys) {
keys = keys.split(" ");
var o = {};
for (var i = 0, l = keys.length; i < l; i++) {
o[keys[i]] = asciidoc[keys[i]];
}
return o;
}
attributes.inside["interpreted"].inside.rest = copyFromAsciiDoc("macro inline replacement entity");
asciidoc["passthrough-block"].inside.rest = copyFromAsciiDoc("macro");
asciidoc["literal-block"].inside.rest = copyFromAsciiDoc("callout");
asciidoc["table"].inside.rest = copyFromAsciiDoc("comment-block passthrough-block literal-block other-block list-punctuation indented-block comment title attribute-entry attributes hr page-break admonition list-label callout macro inline replacement entity line-continuation");
asciidoc["other-block"].inside.rest = copyFromAsciiDoc("table list-punctuation indented-block comment attribute-entry attributes hr page-break admonition list-label macro inline replacement entity line-continuation");
asciidoc["title"].inside.rest = copyFromAsciiDoc("macro inline replacement entity");
Prism2.hooks.add("wrap", function(env) {
if (env.type === "entity") {
env.attributes["title"] = env.content.replace(/&/, "&");
}
});
Prism2.languages.adoc = Prism2.languages.asciidoc;
})(Prism);
(function(Prism2) {
function replace(pattern, replacements) {
return pattern.replace(/<<(\d+)>>/g, function(m, index) {
return "(?:" + replacements[+index] + ")";
});
}
function re(pattern, replacements, flags) {
return RegExp(replace(pattern, replacements), flags || "");
}
function nested(pattern, depthLog2) {
for (var i = 0; i < depthLog2; i++) {
pattern = pattern.replace(/<<self>>/g, function() {
return "(?:" + pattern + ")";
});
}
return pattern.replace(/<<self>>/g, "[^\\s\\S]");
}
var keywordKinds = {
// keywords which represent a return or variable type
type: "bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",
// keywords which are used to declare a type
typeDeclaration: "class enum interface record struct",
// contextual keywords
// ("var" and "dynamic" are missing because they are used like types)
contextual: "add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)",
// all other keywords
other: "abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield"
};
function keywordsToPattern(words) {
return "\\b(?:" + words.trim().replace(/ /g, "|") + ")\\b";
}
var typeDeclarationKeywords = keywordsToPattern(keywordKinds.typeDeclaration);
var keywords = RegExp(keywordsToPattern(keywordKinds.type + " " + keywordKinds.typeDeclaration + " " + keywordKinds.contextual + " " + keywordKinds.other));
var nonTypeKeywords = keywordsToPattern(keywordKinds.typeDeclaration + " " + keywordKinds.contextual + " " + keywordKinds.other);
var nonContextualKeywords = keywordsToPattern(keywordKinds.type + " " + keywordKinds.typeDeclaration + " " + keywordKinds.other);
var generic = nested(/<(?:[^<>;=+\-*/%&|^]|<<self>>)*>/.source, 2);
var nestedRound = nested(/\((?:[^()]|<<self>>)*\)/.source, 2);
var name = /@?\b[A-Za-z_]\w*\b/.source;
var genericName = replace(/<<0>>(?:\s*<<1>>)?/.source, [name, generic]);
var identifier = replace(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source, [nonTypeKeywords, genericName]);
var array = /\[\s*(?:,\s*)*\]/.source;
var typeExpressionWithoutTuple = replace(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source, [identifier, array]);
var tupleElement = replace(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source, [generic, nestedRound, array]);
var tuple = replace(/\(<<0>>+(?:,<<0>>+)+\)/.source, [tupleElement]);
var typeExpression = replace(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source, [tuple, identifier, array]);
var typeInside = {
"keyword": keywords,
"punctuation": /[<>()?,.:[\]]/
};
var character = /'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source;
var regularString = /"(?:\\.|[^\\"\r\n])*"/.source;
var verbatimString = /@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;
Prism2.languages.csharp = Prism2.languages.extend("clike", {
"string": [
{
pattern: re(/(^|[^$\\])<<0>>/.source, [verbatimString]),
lookbehind: true,
greedy: true
},
{
pattern: re(/(^|[^@$\\])<<0>>/.source, [regularString]),
lookbehind: true,
greedy: true
}
],
"class-name": [
{
// Using static
// using static System.Math;
pattern: re(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source, [identifier]),
lookbehind: true,
inside: typeInside
},
{
// Using alias (type)
// using Project = PC.MyCompany.Project;
pattern: re(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source, [name, typeExpression]),
lookbehind: true,
inside: typeInside
},
{
// Using alias (alias)
// using Project = PC.MyCompany.Project;
pattern: re(/(\busing\s+)<<0>>(?=\s*=)/.source, [name]),
lookbehind: true
},
{
// Type declarations
// class Foo<A, B>
// interface Foo<out A, B>
pattern: re(/(\b<<0>>\s+)<<1>>/.source, [typeDeclarationKeywords, genericName]),
lookbehind: true,
inside: typeInside
},
{
// Single catch exception declaration
// catch(Foo)
// (things like catch(Foo e) is covered by variable declaration)
pattern: re(/(\bcatch\s*\(\s*)<<0>>/.source, [identifier]),
lookbehind: true,
inside: typeInside
},
{
// Name of the type parameter of generic constraints
// where Foo : class
pattern: re(/(\bwhere\s+)<<0>>/.source, [name]),
lookbehind: true
},
{
// Casts and checks via as and is.
// as Foo<A>, is Bar<B>
// (things like if(a is Foo b) is covered by variable declaration)
pattern: re(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source, [typeExpressionWithoutTuple]),
lookbehind: true,
inside: typeInside
},
{
// Variable, field and parameter declaration
// (Foo bar, Bar baz, Foo[,,] bay, Foo<Bar, FooBar<Bar>> bax)
pattern: re(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source, [typeExpression, nonContextualKeywords, name]),
inside: typeInside
}
],
"keyword": keywords,
// https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure#literals
"number": /(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,
"operator": />>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,
"punctuation": /\?\.?|::|[{}[\];(),.:]/
});
Prism2.languages.insertBefore("csharp", "number", {
"range": {
pattern: /\.\./,
alias: "operator"
}
});
Prism2.languages.insertBefore("csharp", "punctuation", {
"named-parameter": {
pattern: re(/([(,]\s*)<<0>>(?=\s*:)/.source, [name]),
lookbehind: true,
alias: "punctuation"
}
});
Prism2.languages.insertBefore("csharp", "class-name", {
"namespace": {
// namespace Foo.Bar {}
// using Foo.Bar;
pattern: re(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source, [name]),
lookbehind: true,
inside: {
"punctuation": /\./
}
},
"type-expression": {
// default(Foo), typeof(Foo<Bar>), sizeof(int)
pattern: re(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source, [nestedRound]),
lookbehind: true,
alias: "class-name",
inside: typeInside
},
"return-type": {
// Foo<Bar> ForBar(); Foo IFoo.Bar() => 0
// int this[int index] => 0; T IReadOnlyList<T>.this[int index] => this[index];
// int Foo => 0; int Foo { get; set } = 0;
pattern: re(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source, [typeExpression, identifier]),
inside: typeInside,
alias: "class-name"
},
"constructor-invocation": {
// new List<Foo<Bar[]>> { }
pattern: re(/(\bnew\s+)<<0>>(?=\s*[[({])/.source, [typeExpression]),
lookbehind: true,
inside: typeInside,
alias: "class-name"
},
/*'explicit-implementation': {
// int IFoo<Foo>.Bar => 0; void IFoo<Foo<Foo>>.Foo<T>();
pattern: replace(/\b<<0>>(?=\.<<1>>)/, className, methodOrPropertyDeclaration),
inside: classNameInside,
alias: 'class-name'
},*/
"generic-method": {
// foo<Bar>()
pattern: re(/<<0>>\s*<<1>>(?=\s*\()/.source, [name, generic]),
inside: {
"function": re(/^<<0>>/.source, [name]),
"generic": {
pattern: RegExp(generic),
alias: "class-name",
inside: typeInside
}
}
},
"type-list": {
// The list of types inherited or of generic constraints
// class Foo<F> : Bar, IList<FooBar>
// where F : Bar, IList<int>
pattern: re(
/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,
[typeDeclarationKeywords, genericName, name, typeExpression, keywords.source, nestedRound, /\bnew\s*\(\s*\)/.source]
),
lookbehind: true,
inside: {
"record-arguments": {
pattern: re(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source, [genericName, nestedRound]),
lookbehind: true,
greedy: true,
inside: Prism2.languages.csharp
},
"keyword": keywords,
"class-name": {
pattern: RegExp(typeExpression),
greedy: true,
inside: typeInside
},
"punctuation": /[,()]/
}
},
"preprocessor": {
pattern: /(^[\t ]*)#.*/m,
lookbehind: true,
alias: "property",
inside: {
// highlight preprocessor directives as keywords
"directive": {
pattern: /(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,
lookbehind: true,
alias: "keyword"
}
}
}
});
var regularStringOrCharacter = regularString + "|" + character;
var regularStringCharacterOrComment = replace(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source, [regularStringOrCharacter]);
var roundExpression = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2);
var attrTarget = /\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source;
var attr = replace(/<<0>>(?:\s*\(<<1>>*\))?/.source, [identifier, roundExpression]);
Prism2.languages.insertBefore("csharp", "class-name", {
"attribute": {
// Attributes
// [Foo], [Foo(1), Bar(2, Prop = "foo")], [return: Foo(1), Bar(2)], [assembly: Foo(Bar)]
pattern: re(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source, [attrTarget, attr]),
lookbehind: true,
greedy: true,
inside: {
"target": {
pattern: re(/^<<0>>(?=\s*:)/.source, [attrTarget]),
alias: "keyword"
},
"attribute-arguments": {
pattern: re(/\(<<0>>*\)/.source, [roundExpression]),
inside: Prism2.languages.csharp
},
"class-name": {
pattern: RegExp(identifier),
inside: {
"punctuation": /\./
}
},
"punctuation": /[:,]/
}
}
});
var formatString = /:[^}\r\n]+/.source;
var mInterpolationRound = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2);
var mInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [mInterpolationRound, formatString]);
var sInterpolationRound = nested(replace(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<<self>>*\)/.source, [regularStringOrCharacter]), 2);
var sInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [sInterpolationRound, formatString]);
function createInterpolationInside(interpolation, interpolationRound) {
return {
"interpolation": {
pattern: re(/((?:^|[^{])(?:\{\{)*)<<0>>/.source, [interpolation]),
lookbehind: true,
inside: {
"format-string": {
pattern: re(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source, [interpolationRound, formatString]),
lookbehind: true,
inside: {
"punctuation": /^:/
}
},
"punctuation": /^\{|\}$/,
"expression": {
pattern: /[\s\S]+/,
alias: "language-csharp",
inside: Prism2.languages.csharp
}
}
},
"string": /[\s\S]+/
};
}
Prism2.languages.insertBefore("csharp", "string", {
"interpolation-string": [
{
pattern: re(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source, [mInterpolation]),
lookbehind: true,
greedy: true,
inside: createInterpolationInside(mInterpolation, mInterpolationRound)
},
{
pattern: re(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source, [sInterpolation]),
lookbehind: true,
greedy: true,
inside: createInterpolationInside(sInterpolation, sInterpolationRound)
}
],
"char": {
pattern: RegExp(character),
greedy: true
}
});
Prism2.languages.dotnet = Prism2.languages.cs = Prism2.languages.csharp;
})(Prism);
Prism.languages.aspnet = Prism.languages.extend("markup", {
"page-directive": {
pattern: /<%\s*@.*%>/,
alias: "tag",
inside: {
"page-directive": {
pattern: /<%\s*@\s*(?:Assembly|Control|Implements|Import|Master(?:Type)?|OutputCache|Page|PreviousPageType|Reference|Register)?|%>/i,
alias: "tag"
},
rest: Prism.languages.markup.tag.inside
}
},
"directive": {
pattern: /<%.*%>/,
alias: "tag",
inside: {
"directive": {
pattern: /<%\s*?[$=%#:]{0,2}|%>/,
alias: "tag"
},
rest: Prism.languages.csharp
}
}
});
Prism.languages.aspnet.tag.pattern = /<(?!%)\/?[^\s>\/]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/;
Prism.languages.insertBefore("inside", "punctuation", {
"directive": Prism.languages.aspnet["directive"]
}, Prism.languages.aspnet.tag.inside["attr-value"]);
Prism.languages.insertBefore("aspnet", "comment", {
"asp-comment": {
pattern: /<%--[\s\S]*?--%>/,
alias: ["asp", "comment"]
}
});
Prism.languages.insertBefore("aspnet", Prism.languages.javascript ? "script" : "tag", {
"asp-script": {
pattern: /(<script(?=.*runat=['"]?server\b)[^>]*>)[\s\S]*?(?=<\/script>)/i,
lookbehind: true,
alias: ["asp", "script"],
inside: Prism.languages.csharp || {}
}
});
Prism.languages.asm6502 = {
"comment": /;.*/,
"directive": {
pattern: /\.\w+(?= )/,
alias: "property"
},
"string": /(["'`])(?:\\.|(?!\1)[^\\\r\n])*\1/,
"op-code": {
pattern: /\b(?:ADC|AND|ASL|BCC|BCS|BEQ|BIT|BMI|BNE|BPL|BRK|BVC|BVS|CLC|CLD|CLI|CLV|CMP|CPX|CPY|DEC|DEX|DEY|EOR|INC|INX|INY|JMP|JSR|LDA|LDX|LDY|LSR|NOP|ORA|PHA|PHP|PLA|PLP|ROL|ROR|RTI|RTS|SBC|SEC|SED|SEI|STA|STX|STY|TAX|TAY|TSX|TXA|TXS|TYA|adc|and|asl|bcc|bcs|beq|bit|bmi|bne|bpl|brk|bvc|bvs|clc|cld|cli|clv|cmp|cpx|cpy|dec|dex|dey|eor|inc|inx|iny|jmp|jsr|lda|ldx|ldy|lsr|nop|ora|pha|php|pla|plp|rol|ror|rti|rts|sbc|sec|sed|sei|sta|stx|sty|tax|tay|tsx|txa|txs|tya)\b/,
alias: "keyword"
},
"hex-number": {
pattern: /#?\$[\da-f]{1,4}\b/i,
alias: "number"
},
"binary-number": {
pattern: /#?%[01]+\b/,
alias: "number"
},
"decimal-number": {
pattern: /#?\b\d+\b/,
alias: "number"
},
"register": {
pattern: /\b[xya]\b/i,
alias: "variable"
},
"punctuation": /[(),:]/
};
Prism.languages.asmatmel = {
"comment": {
pattern: /;.*/,
greedy: true
},
"string": {
pattern: /(["'`])(?:\\.|(?!\1)[^\\\r\n])*\1/,
greedy: true
},
"constant": /\b(?:PORT[A-Z]|DDR[A-Z]|(?:DD|P)[A-Z](?:\d|[0-2]\d|3[01]))\b/,
"directive": {
pattern: /\.\w+(?= )/,
alias: "property"
},
"r-register": {
pattern: /\br(?:\d|[12]\d|3[01])\b/,
alias: "variable"
},
"op-code": {
pattern: /\b(?:ADC|ADD|ADIW|AND|ANDI|ASR|BCLR|BLD|BRBC|BRBS|BRCC|BRCS|BREAK|BREQ|BRGE|BRHC|BRHS|BRID|BRIE|BRLO|BRLT|BRMI|BRNE|BRPL|BRSH|BRTC|BRTS|BRVC|BRVS|BSET|BST|CALL|CBI|CBR|CLC|CLH|CLI|CLN|CLR|CLS|CLT|CLV|CLZ|COM|CP|CPC|CPI|CPSE|DEC|DES|EICALL|EIJMP|ELPM|EOR|FMUL|FMULS|FMULSU|ICALL|IJMP|IN|INC|JMP|LAC|LAS|LAT|LD|LD[A-Za-z0-9]|LPM|LSL|LSR|MOV|MOVW|MUL|MULS|MULSU|NEG|NOP|OR|ORI|OUT|POP|PUSH|RCALL|RET|RETI|RJMP|ROL|ROR|SBC|SBCI|SBI|SBIC|SBIS|SBIW|SBR|SBRC|SBRS|SEC|SEH|SEI|SEN|SER|SES|SET|SEV|SEZ|SLEEP|SPM|ST|ST[A-Z0-9]|SUB|SUBI|SWAP|TST|WDR|XCH|adc|add|adiw|and|andi|asr|bclr|bld|brbc|brbs|brcc|brcs|break|breq|brge|brhc|brhs|brid|brie|brlo|brlt|brmi|brne|brpl|brsh|brtc|brts|brvc|brvs|bset|bst|call|cbi|cbr|clc|clh|cli|cln|clr|cls|clt|clv|clz|com|cp|cpc|cpi|cpse|dec|des|eicall|eijmp|elpm|eor|fmul|fmuls|fmulsu|icall|ijmp|in|inc|jmp|lac|las|lat|ld|ld[a-z0-9]|lpm|lsl|lsr|mov|movw|mul|muls|mulsu|neg|nop|or|ori|out|pop|push|rcall|ret|reti|rjmp|rol|ror|sbc|sbci|sbi|sbic|sbis|sbiw|sbr|sbrc|sbrs|sec|seh|sei|sen|ser|ses|set|sev|sez|sleep|spm|st|st[a-zA-Z0-9]|sub|subi|swap|tst|wdr|xch)\b/,
alias: "keyword"
},
"hex-number": {
pattern: /#?\$[\da-f]{2,4}\b/i,
alias: "number"
},
"binary-number": {
pattern: /#?%[01]+\b/,
alias: "number"
},
"decimal-number": {
pattern: /#?\b\d+\b/,
alias: "number"
},
"register": {
pattern: /\b[acznvshtixy]\b/i,
alias: "variable"
},
"operator": />>=?|<<=?|&[&=]?|\|[\|=]?|[-+*/%^!=<>?]=?/,
"punctuation": /[(),:]/
};
Prism.languages.autohotkey = {
"comment": [
{
pattern: /(^|\s);.*/,
lookbehind: true
},
{
pattern: /(^[\t ]*)\/\*(?:[\r\n](?![ \t]*\*\/)|[^\r\n])*(?:[\r\n][ \t]*\*\/)?/m,
lookbehind: true,
greedy: true
}
],
"tag": {
// labels
pattern: /^([ \t]*)[^\s,`":]+(?=:[ \t]*$)/m,
lookbehind: true
},
"string": /"(?:[^"\n\r]|"")*"/,
"variable": /%\w+%/,
"number": /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
"operator": /\?|\/\/?=?|:=|\|[=|]?|&[=&]?|\+[=+]?|-[=-]?|\*[=*]?|<(?:<=?|>|=)?|>>?=?|[.^!=~]=?|\b(?:AND|NOT|OR)\b/,
"boolean": /\b(?:false|true)\b/,
"command": {
pattern: /\b(?:AutoTrim|BlockInput|Break|Click|ClipWait|Continue|Control|ControlClick|ControlFocus|ControlGet|ControlGetFocus|ControlGetPos|ControlGetText|ControlMove|ControlSend|ControlSendRaw|ControlSetText|CoordMode|Critical|DetectHiddenText|DetectHiddenWindows|Drive|DriveGet|DriveSpaceFree|EnvAdd|EnvDiv|EnvGet|EnvMult|EnvSet|EnvSub|EnvUpdate|Exit|ExitApp|FileAppend|FileCopy|FileCopyDir|FileCreateDir|FileCreateShortcut|FileDelete|FileEncoding|FileGetAttrib|FileGetShortcut|FileGetSize|FileGetTime|FileGetVersion|FileInstall|FileMove|FileMoveDir|FileRead|FileReadLine|FileRecycle|FileRecycleEmpty|FileRemoveDir|FileSelectFile|FileSelectFolder|FileSetAttrib|FileSetTime|FormatTime|GetKeyState|Gosub|Goto|GroupActivate|GroupAdd|GroupClose|GroupDeactivate|Gui|GuiControl|GuiControlGet|Hotkey|ImageSearch|IniDelete|IniRead|IniWrite|Input|InputBox|KeyWait|ListHotkeys|ListLines|ListVars|Loop|Menu|MouseClick|MouseClickDrag|MouseGetPos|MouseMove|MsgBox|OnExit|OutputDebug|Pause|PixelGetColor|PixelSearch|PostMessage|Process|Progress|Random|RegDelete|RegRead|RegWrite|Reload|Repeat|Return|Run|RunAs|RunWait|Send|SendEvent|SendInput|SendMessage|SendMode|SendPlay|SendRaw|SetBatchLines|SetCapslockState|SetControlDelay|SetDefaultMouseSpeed|SetEnv|SetFormat|SetKeyDelay|SetMouseDelay|SetNumlockState|SetRegView|SetScrollLockState|SetStoreCapslockMode|SetTimer|SetTitleMatchMode|SetWinDelay|SetWorkingDir|Shutdown|Sleep|Sort|SoundBeep|SoundGet|SoundGetWaveVolume|SoundPlay|SoundSet|SoundSetWaveVolume|SplashImage|SplashTextOff|SplashTextOn|SplitPath|StatusBarGetText|StatusBarWait|StringCaseSense|StringGetPos|StringLeft|StringLen|StringLower|StringMid|StringReplace|StringRight|StringSplit|StringTrimLeft|StringTrimRight|StringUpper|Suspend|SysGet|Thread|ToolTip|Transform|TrayTip|URLDownloadToFile|WinActivate|WinActivateBottom|WinClose|WinGet|WinGetActiveStats|WinGetActiveTitle|WinGetClass|WinGetPos|WinGetText|WinGetTitle|WinHide|WinKill|WinMaximize|WinMenuSelectItem|WinMinimize|WinMinimizeAll|WinMinimizeAllUndo|WinMove|WinRestore|WinSet|WinSetTitle|WinShow|WinWait|WinWaitActive|WinWaitClose|WinWaitNotActive)\b/i,
alias: "selector"
},
"constant": /\b(?:a_ahkpath|a_ahkversion|a_appdata|a_appdatacommon|a_autotrim|a_batchlines|a_caretx|a_carety|a_computername|a_controldelay|a_cursor|a_dd|a_ddd|a_dddd|a_defaultmousespeed|a_desktop|a_desktopcommon|a_detecthiddentext|a_detecthiddenwindows|a_endchar|a_eventinfo|a_exitreason|a_fileencoding|a_formatfloat|a_formatinteger|a_gui|a_guicontrol|a_guicontrolevent|a_guievent|a_guiheight|a_guiwidth|a_guix|a_guiy|a_hour|a_iconfile|a_iconhidden|a_iconnumber|a_icontip|a_index|a_ipaddress1|a_ipaddress2|a_ipaddress3|a_ipaddress4|a_is64bitos|a_isadmin|a_iscompiled|a_iscritical|a_ispaused|a_issuspended|a_isunicode|a_keydelay|a_language|a_lasterror|a_linefile|a_linenumber|a_loopfield|a_loopfileattrib|a_loopfiledir|a_loopfileext|a_loopfilefullpath|a_loopfilelongpath|a_loopfilename|a_loopfileshortname|a_loopfileshortpath|a_loopfilesize|a_loopfilesizekb|a_loopfilesizemb|a_loopfiletimeaccessed|a_loopfiletimecreated|a_loopfiletimemodified|a_loopreadline|a_loopregkey|a_loopregname|a_loopregsubkey|a_loopregtimemodified|a_loopregtype|a_mday|a_min|a_mm|a_mmm|a_mmmm|a_mon|a_mousedelay|a_msec|a_mydocuments|a_now|a_nowutc|a_numbatchlines|a_ostype|a_osversion|a_priorhotkey|a_priorkey|a_programfiles|a_programs|a_programscommon|a_ptrsize|a_regview|a_screendpi|a_screenheight|a_screenwidth|a_scriptdir|a_scriptfullpath|a_scripthwnd|a_scriptname|a_sec|a_space|a_startmenu|a_startmenucommon|a_startup|a_startupcommon|a_stringcasesense|a_tab|a_temp|a_thisfunc|a_thishotkey|a_thislabel|a_thismenu|a_thismenuitem|a_thismenuitempos|a_tickcount|a_timeidle|a_timeidlephysical|a_timesincepriorhotkey|a_timesincethishotkey|a_titlematchmode|a_titlematchmodespeed|a_username|a_wday|a_windelay|a_windir|a_workingdir|a_yday|a_year|a_yweek|a_yyyy|clipboard|clipboardall|comspec|errorlevel|programfiles)\b/i,
"builtin": /\b(?:abs|acos|asc|asin|atan|ceil|chr|class|comobjactive|comobjarray|comobjconnect|comobjcreate|comobjerror|comobjflags|comobjget|comobjquery|comobjtype|comobjvalue|cos|dllcall|exp|fileexist|Fileopen|floor|format|il_add|il_create|il_destroy|instr|isfunc|islabel|IsObject|ln|log|ltrim|lv_add|lv_delete|lv_deletecol|lv_getcount|lv_getnext|lv_gettext|lv_insert|lv_insertcol|lv_modify|lv_modifycol|lv_setimagelist|mod|numget|numput|onmessage|regexmatch|regexreplace|registercallback|round|rtrim|sb_seticon|sb_setparts|sb_settext|sin|sqrt|strlen|strreplace|strsplit|substr|tan|tv_add|tv_delete|tv_get|tv_getchild|tv_getcount|tv_getnext|tv_getparent|tv_getprev|tv_getselection|tv_gettext|tv_modify|varsetcapacity|winactive|winexist|__Call|__Get|__New|__Set)\b/i,
"symbol": /\b(?:alt|altdown|altup|appskey|backspace|browser_back|browser_favorites|browser_forward|browser_home|browser_refresh|browser_search|browser_stop|bs|capslock|ctrl|ctrlbreak|ctrldown|ctrlup|del|delete|down|end|enter|esc|escape|f1|f10|f11|f12|f13|f14|f15|f16|f17|f18|f19|f2|f20|f21|f22|f23|f24|f3|f4|f5|f6|f7|f8|f9|home|ins|insert|joy1|joy10|joy11|joy12|joy13|joy14|joy15|joy16|joy17|joy18|joy19|joy2|joy20|joy21|joy22|joy23|joy24|joy25|joy26|joy27|joy28|joy29|joy3|joy30|joy31|joy32|joy4|joy5|joy6|joy7|joy8|joy9|joyaxes|joybuttons|joyinfo|joyname|joypov|joyr|joyu|joyv|joyx|joyy|joyz|lalt|launch_app1|launch_app2|launch_mail|launch_media|lbutton|lcontrol|lctrl|left|lshift|lwin|lwindown|lwinup|mbutton|media_next|media_play_pause|media_prev|media_stop|numlock|numpad0|numpad1|numpad2|numpad3|numpad4|numpad5|numpad6|numpad7|numpad8|numpad9|numpadadd|numpadclear|numpaddel|numpaddiv|numpaddot|numpaddown|numpadend|numpadenter|numpadhome|numpadins|numpadleft|numpadmult|numpadpgdn|numpadpgup|numpadright|numpadsub|numpadup|pgdn|pgup|printscreen|ralt|rbutton|rcontrol|rctrl|right|rshift|rwin|rwindown|rwinup|scrolllock|shift|shiftdown|shiftup|space|tab|up|volume_down|volume_mute|volume_up|wheeldown|wheelleft|wheelright|wheelup|xbutton1|xbutton2)\b/i,
"directive": {
pattern: /#[a-z]+\b/i,
alias: "important"
},
"keyword": /\b(?:Abort|AboveNormal|Add|ahk_class|ahk_exe|ahk_group|ahk_id|ahk_pid|All|Alnum|Alpha|AltSubmit|AltTab|AltTabAndMenu|AltTabMenu|AltTabMenuDismiss|AlwaysOnTop|AutoSize|Background|BackgroundTrans|BelowNormal|between|BitAnd|BitNot|BitOr|BitShiftLeft|BitShiftRight|BitXOr|Bold|Border|Button|ByRef|Catch|Checkbox|Checked|CheckedGray|Choose|ChooseString|Close|Color|ComboBox|Contains|ControlList|Count|Date|DateTime|Days|DDL|Default|DeleteAll|Delimiter|Deref|Destroy|Digit|Disable|Disabled|DropDownList|Edit|Eject|Else|Enable|Enabled|Error|Exist|Expand|ExStyle|FileSystem|Finally|First|Flash|Float|FloatFast|Focus|Font|for|global|Grid|Group|GroupBox|GuiClose|GuiContextMenu|GuiDropFiles|GuiEscape|GuiSize|Hdr|Hidden|Hide|High|HKCC|HKCR|HKCU|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_LOCAL_MACHINE|HKEY_USERS|HKLM|HKU|Hours|HScroll|Icon|IconSmall|ID|IDLast|If|IfEqual|IfExist|IfGreater|IfGreaterOrEqual|IfInString|IfLess|IfLessOrEqual|IfMsgBox|IfNotEqual|IfNotExist|IfNotInString|IfWinActive|IfWinExist|IfWinNotActive|IfWinNotExist|Ignore|ImageList|in|Integer|IntegerFast|Interrupt|is|italic|Join|Label|LastFound|LastFoundExist|Limit|Lines|List|ListBox|ListView|local|Lock|Logoff|Low|Lower|Lowercase|MainWindow|Margin|Maximize|MaximizeBox|MaxSize|Minimize|MinimizeBox|MinMax|MinSize|Minutes|MonthCal|Mouse|Move|Multi|NA|No|NoActivate|NoDefault|NoHide|NoIcon|NoMainWindow|norm|Normal|NoSort|NoSortHdr|NoStandard|Not|NoTab|NoTimers|Number|Off|Ok|On|OwnDialogs|Owner|Parse|Password|Picture|Pixel|Pos|Pow|Priority|ProcessName|Radio|Range|Read|ReadOnly|Realtime|Redraw|Region|REG_BINARY|REG_DWORD|REG_EXPAND_SZ|REG_MULTI_SZ|REG_SZ|Relative|Rename|Report|Resize|Restore|Retry|RGB|Screen|Seconds|Section|Serial|SetLabel|ShiftAltTab|Show|Single|Slider|SortDesc|Standard|static|Status|StatusBar|StatusCD|strike|Style|Submit|SysMenu|Tab2|TabStop|Text|Theme|Throw|Tile|ToggleCheck|ToggleEnable|ToolWindow|Top|Topmost|TransColor|Transparent|Tray|TreeView|Try|TryAgain|Type|UnCheck|underline|Unicode|Unlock|Until|UpDown|Upper|Uppercase|UseErrorLevel|Vis|VisFirst|Visible|VScroll|Wait|WaitClose|WantCtrlA|WantF2|WantReturn|While|Wrap|Xdigit|xm|xp|xs|Yes|ym|yp|ys)\b/i,
"function": /[^(); \t,\n+*\-=?>:\\\/<&%\[\]]+(?=\()/,
"punctuation": /[{}[\]():,]/
};
Prism.languages.autoit = {
"comment": [
/;.*/,
{
// The multi-line comments delimiters can actually be commented out with ";"
pattern: /(^[\t ]*)#(?:comments-start|cs)[\s\S]*?^[ \t]*#(?:ce|comments-end)/m,
lookbehind: true
}
],
"url": {
pattern: /(^[\t ]*#include\s+)(?:<[^\r\n>]+>|"[^\r\n"]+")/m,
lookbehind: true
},
"string": {
pattern: /(["'])(?:\1\1|(?!\1)[^\r\n])*\1/,
greedy: true,
inside: {
"variable": /([%$@])\w+\1/
}
},
"directive": {
pattern: /(^[\t ]*)#[\w-]+/m,
lookbehind: true,
alias: "keyword"
},
"function": /\b\w+(?=\()/,
// Variables and macros
"variable": /[$@]\w+/,
"keyword": /\b(?:Case|Const|Continue(?:Case|Loop)|Default|Dim|Do|Else(?:If)?|End(?:Func|If|Select|Switch|With)|Enum|Exit(?:Loop)?|For|Func|Global|If|In|Local|Next|Null|ReDim|Select|Static|Step|Switch|Then|To|Until|Volatile|WEnd|While|With)\b/i,
"number": /\b(?:0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)\b/i,
"boolean": /\b(?:False|True)\b/i,
"operator": /<[=>]?|[-+*\/=&>]=?|[?^]|\b(?:And|Not|Or)\b/i,
"punctuation": /[\[\]().,:]/
};
(function(Prism2) {
function replace(pattern, replacements) {
return pattern.replace(/<<(\d+)>>/g, function(m, index) {
return replacements[+index];
});
}
function re(pattern, replacements, flags) {
return RegExp(replace(pattern, replacements), flags || "");
}
var types = /bool|clip|float|int|string|val/.source;
var internals = [
// bools
/is(?:bool|clip|float|int|string)|defined|(?:(?:internal)?function|var)?exists?/.source,
// control
/apply|assert|default|eval|import|nop|select|undefined/.source,
// global
/opt_(?:allowfloataudio|avipadscanlines|dwchannelmask|enable_(?:b64a|planartopackedrgb|v210|y3_10_10|y3_10_16)|usewaveextensible|vdubplanarhack)|set(?:cachemode|maxcpu|memorymax|planarlegacyalignment|workingdir)/.source,
// conv
/hex(?:value)?|value/.source,
// numeric
/abs|ceil|continued(?:denominator|numerator)?|exp|floor|fmod|frac|log(?:10)?|max|min|muldiv|pi|pow|rand|round|sign|spline|sqrt/.source,
// trig
/a?sinh?|a?cosh?|a?tan[2h]?/.source,
// bit
/(?:bit(?:and|not|x?or|[lr]?shift[aslu]?|sh[lr]|sa[lr]|[lr]rotatel?|ro[rl]|te?st|set(?:count)?|cl(?:ea)?r|ch(?:an)?ge?))/.source,
// runtime
/average(?:[bgr]|chroma[uv]|luma)|(?:[rgb]|chroma[uv]|luma|rgb|[yuv](?=difference(?:fromprevious|tonext)))difference(?:fromprevious|tonext)?|[yuvrgb]plane(?:median|min|max|minmaxdifference)/.source,
// script
/getprocessinfo|logmsg|script(?:dir(?:utf8)?|file(?:utf8)?|name(?:utf8)?)|setlogparams/.source,
// string
/chr|(?:fill|find|left|mid|replace|rev|right)str|format|[lu]case|ord|str(?:cmpi?|fromutf8|len|toutf8)|time|trim(?:all|left|right)/.source,
// version
/isversionorgreater|version(?:number|string)/.source,
// helper
/buildpixeltype|colorspacenametopixeltype/.source,
// avsplus
/addautoloaddir|on(?:cpu|cuda)|prefetch|setfiltermtmode/.source
].join("|");
var properties = [
// content
/has(?:audio|video)/.source,
// resolution
/height|width/.source,
// framerate
/frame(?:count|rate)|framerate(?:denominator|numerator)/.source,
// interlacing
/getparity|is(?:field|frame)based/.source,
// color format
/bitspercomponent|componentsize|hasalpha|is(?:planar(?:rgba?)?|interleaved|rgb(?:24|32|48|64)?|y(?:8|u(?:va?|y2))?|yv(?:12|16|24|411)|420|422|444|packedrgb)|numcomponents|pixeltype/.source,
// audio
/audio(?:bits|channels|duration|length(?:[fs]|hi|lo)?|rate)|isaudio(?:float|int)/.source
].join("|");
var filters = [
// source
/avi(?:file)?source|directshowsource|image(?:reader|source|sourceanim)|opendmlsource|segmented(?:avisource|directshowsource)|wavsource/.source,
// color
/coloryuv|convertbacktoyuy2|convertto(?:RGB(?:24|32|48|64)|(?:planar)?RGBA?|Y8?|YV(?:12|16|24|411)|YUVA?(?:411|420|422|444)|YUY2)|fixluminance|gr[ae]yscale|invert|levels|limiter|mergea?rgb|merge(?:chroma|luma)|rgbadjust|show(?:alpha|blue|green|red)|swapuv|tweak|[uv]toy8?|ytouv/.source,
// overlay
/(?:colorkey|reset)mask|layer|mask(?:hs)?|merge|overlay|subtract/.source,
// geometry
/addborders|(?:bicubic|bilinear|blackman|gauss|lanczos4|lanczos|point|sinc|spline(?:16|36|64))resize|crop(?:bottom)?|flip(?:horizontal|vertical)|(?:horizontal|vertical)?reduceby2|letterbox|skewrows|turn(?:180|left|right)/.source,
// pixel
/blur|fixbrokenchromaupsampling|generalconvolution|(?:spatial|temporal)soften|sharpen/.source,
// timeline
/trim|(?:un)?alignedsplice|(?:assume|assumescaled|change|convert)FPS|(?:delete|duplicate)frame|dissolve|fade(?:in|io|out)[02]?|freezeframe|interleave|loop|reverse|select(?:even|odd|(?:range)?every)/.source,
// interlace
/assume[bt]ff|assume(?:field|frame)based|bob|complementparity|doubleweave|peculiarblend|pulldown|separate(?:columns|fields|rows)|swapfields|weave(?:columns|rows)?/.source,
// audio
/amplify(?:db)?|assumesamplerate|audiodub(?:ex)?|audiotrim|convertaudioto(?:(?:8|16|24|32)bit|float)|converttomono|delayaudio|ensurevbrmp3sync|get(?:left|right)?channel|kill(?:audio|video)|mergechannels|mixaudio|monotostereo|normalize|resampleaudio|ssrc|supereq|timestretch/.source,
// conditional
/animate|applyrange|conditional(?:filter|reader|select)|frameevaluate|scriptclip|tcp(?:server|source)|writefile(?:end|if|start)?/.source,
// export
/imagewriter/.source,
// debug
/blackness|blankclip|colorbars(?:hd)?|compare|dumpfiltergraph|echo|histogram|info|messageclip|preroll|setgraphanalysis|show(?:framenumber|smpte|time)|showfiveversions|stack(?:horizontal|vertical)|subtitle|tone|version/.source
].join("|");
var allinternals = [internals, properties, filters].join("|");
Prism2.languages.avisynth = {
"comment": [
{
// Matches [* *] nestable block comments, but only supports 1 level of nested comments
// /\[\*(?:[^\[*]|\[(?!\*)|\*(?!\])|<self>)*\*\]/
pattern: /(^|[^\\])\[\*(?:[^\[*]|\[(?!\*)|\*(?!\])|\[\*(?:[^\[*]|\[(?!\*)|\*(?!\]))*\*\])*\*\]/,
lookbehind: true,
greedy: true
},
{
// Matches /* */ block comments
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
lookbehind: true,
greedy: true
},
{
// Matches # comments
pattern: /(^|[^\\$])#.*/,
lookbehind: true,
greedy: true
}
],
// Handle before strings because optional arguments are surrounded by double quotes
"argument": {
pattern: re(/\b(?:<<0>>)\s+("?)\w+\1/.source, [types], "i"),
inside: {
"keyword": /^\w+/
}
},
// Optional argument assignment
"argument-label": {
pattern: /([,(][\s\\]*)\w+\s*=(?!=)/,
lookbehind: true,
inside: {
"argument-name": {
pattern: /^\w+/,
alias: "punctuation"
},
"punctuation": /=$/
}
},
"string": [
{
// triple double-quoted
pattern: /"""[\s\S]*?"""/,
greedy: true
},
{
// single double-quoted
pattern: /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
greedy: true,
inside: {
"constant": {
// These *are* case-sensitive!
pattern: /\b(?:DEFAULT_MT_MODE|(?:MAINSCRIPT|PROGRAM|SCRIPT)DIR|(?:MACHINE|USER)_(?:CLASSIC|PLUS)_PLUGINS)\b/
}
}
}
],
// The special "last" variable that takes the value of the last implicitly returned clip
"variable": /\b(?:last)\b/i,
"boolean": /\b(?:false|no|true|yes)\b/i,
"keyword": /\b(?:catch|else|for|function|global|if|return|try|while|__END__)\b/i,
"constant": /\bMT_(?:MULTI_INSTANCE|NICE_FILTER|SERIALIZED|SPECIAL_MT)\b/,
// AviSynth's internal functions, filters, and properties
"builtin-function": {
pattern: re(/\b(?:<<0>>)\b/.source, [allinternals], "i"),
alias: "function"
},
"type-cast": {
pattern: re(/\b(?:<<0>>)(?=\s*\()/.source, [types], "i"),
alias: "keyword"
},
// External/user-defined filters
"function": {
pattern: /\b[a-z_]\w*(?=\s*\()|(\.)[a-z_]\w*\b/i,
lookbehind: true
},
// Matches a \ as the first or last character on a line
"line-continuation": {
pattern: /(^[ \t]*)\\|\\(?=[ \t]*$)/m,
lookbehind: true,
alias: "punctuation"
},
"number": /\B\$(?:[\da-f]{6}|[\da-f]{8})\b|(?:(?:\b|\B-)\d+(?:\.\d*)?\b|\B\.\d+\b)/i,
"operator": /\+\+?|[!=<>]=?|&&|\|\||[?:*/%-]/,
"punctuation": /[{}\[\]();,.]/
};
Prism2.languages.avs = Prism2.languages.avisynth;
})(Prism);
Prism.languages["avro-idl"] = {
"comment": {
pattern: /\/\/.*|\/\*[\s\S]*?\*\//,
greedy: true
},
"string": {
pattern: /(^|[^\\])"(?:[^\r\n"\\]|\\.)*"/,
lookbehind: true,
greedy: true
},
"annotation": {
pattern: /@(?:[$\w.-]|`[^\r\n`]+`)+/,
greedy: true,
alias: "function"
},
"function-identifier": {
pattern: /`[^\r\n`]+`(?=\s*\()/,
greedy: true,
alias: "function"
},
"identifier": {
pattern: /`[^\r\n`]+`/,
greedy: true
},
"class-name": {
pattern: /(\b(?:enum|error|protocol|record|throws)\b\s+)[$\w]+/,
lookbehind: true,
greedy: true
},
"keyword": /\b(?:array|boolean|bytes|date|decimal|double|enum|error|false|fixed|float|idl|import|int|local_timestamp_ms|long|map|null|oneway|protocol|record|schema|string|throws|time_ms|timestamp_ms|true|union|uuid|void)\b/,
"function": /\b[a-z_]\w*(?=\s*\()/i,
"number": [
{
pattern: /(^|[^\w.])-?(?:(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|0x(?:[a-f0-9]+(?:\.[a-f0-9]*)?|\.[a-f0-9]+)(?:p[+-]?\d+)?)[dfl]?(?![\w.])/i,
lookbehind: true
},
/-?\b(?:Infinity|NaN)\b/
],
"operator": /=/,
"punctuation": /[()\[\]{}<>.:,;-]/
};
Prism.languages.avdl = Prism.languages["avro-idl"];
Prism.languages.awk = {
"hashbang": {
pattern: /^#!.*/,
greedy: true,
alias: "comment"
},
"comment": {
pattern: /#.*/,
greedy: true
},
"string": {
pattern: /(^|[^\\])"(?:[^\\"\r\n]|\\.)*"/,
lookbehind: true,
greedy: true
},
"regex": {
pattern: /((?:^|[^\w\s)])\s*)\/(?:[^\/\\\r\n]|\\.)*\//,
lookbehind: true,
greedy: true
},
"variable": /\$\w+/,
"keyword": /\b(?:BEGIN|BEGINFILE|END|ENDFILE|break|case|continue|default|delete|do|else|exit|for|function|getline|if|in|next|nextfile|printf?|return|switch|while)\b|@(?:include|load)\b/,
"function": /\b[a-z_]\w*(?=\s*\()/i,
"number": /\b(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?|0x[a-fA-F0-9]+)\b/,
"operator": /--|\+\+|!?~|>&|>>|<<|(?:\*\*|[<>!=+\-*/%^])=?|&&|\|[|&]|[?:]/,
"punctuation": /[()[\]{},;]/
};
Prism.languages.gawk = Prism.languages.awk;
(function(Prism2) {
var envVars = "\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b";
var commandAfterHeredoc = {
pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
lookbehind: true,
alias: "punctuation",
// this looks reasonably well in all themes
inside: null
// see below
};
var insideString = {
"bash": commandAfterHeredoc,
"environment": {
pattern: RegExp("\\$" + envVars),
alias: "constant"
},
"variable": [
// [0]: Arithmetic Environment
{
pattern: /\$?\(\([\s\S]+?\)\)/,
greedy: true,
inside: {
// If there is a $ sign at the beginning highlight $(( and )) as variable
"variable": [
{
pattern: /(^\$\(\([\s\S]+)\)\)/,
lookbehind: true
},
/^\$\(\(/
],
"number": /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
// Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
"operator": /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
// If there is no $ sign at the beginning highlight (( and )) as punctuation
"punctuation": /\(\(?|\)\)?|,|;/
}
},
// [1]: Command Substitution
{
pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
greedy: true,
inside: {
"variable": /^\$\(|^`|\)$|`$/
}
},
// [2]: Brace expansion
{
pattern: /\$\{[^}]+\}/,
greedy: true,
inside: {
"operator": /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
"punctuation": /[\[\]]/,
"environment": {
pattern: RegExp("(\\{)" + envVars),
lookbehind: true,
alias: "constant"
}
}
},
/\$(?:\w+|[#?*!@$])/
],
// Escape sequences from echo and printf's manuals, and escaped quotes.
"entity": /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/
};
Prism2.languages.bash = {
"shebang": {
pattern: /^#!\s*\/.*/,
alias: "important"
},
"comment": {
pattern: /(^|[^"{\\$])#.*/,
lookbehind: true
},
"function-name": [
// a) function foo {
// b) foo() {
// c) function foo() {
// but not “foo {”
{
// a) and c)
pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
lookbehind: true,
alias: "function"
},
{
// b)
pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
alias: "function"
}
],
// Highlight variable names as variables in for and select beginnings.
"for-or-select": {
pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
alias: "variable",
lookbehind: true
},
// Highlight variable names as variables in the left-hand part
// of assignments (“=” and “+=”).
"assign-left": {
pattern: /(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,
inside: {
"environment": {
pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + envVars),
lookbehind: true,
alias: "constant"
}
},
alias: "variable",
lookbehind: true
},
"string": [
// Support for Here-documents https://en.wikipedia.org/wiki/Here_document
{
pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
lookbehind: true,
greedy: true,
inside: insideString
},
// Here-document with quotes around the tag
// → No expansion (so no “inside”).
{
pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
lookbehind: true,
greedy: true,
inside: {
"bash": commandAfterHeredoc
}
},
// “Normal” string
{
// https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
lookbehind: true,
greedy: true,
inside: insideString
},
{
// https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
pattern: /(^|[^$\\])'[^']*'/,
lookbehind: true,
greedy: true
},
{
// https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html
pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
greedy: true,
inside: {
"entity": insideString.entity
}
}
],
"environment": {
pattern: RegExp("\\$?" + envVars),
alias: "constant"
},
"variable": insideString.variable,
"function": {
pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
lookbehind: true
},
"keyword": {
pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
lookbehind: true
},
// https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
"builtin": {
pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,
lookbehind: true,
// Alias added to make those easier to distinguish from strings.
alias: "class-name"
},
"boolean": {
pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
lookbehind: true
},
"file-descriptor": {
pattern: /\B&\d\b/,
alias: "important"
},
"operator": {
// Lots of redirections here, but not just that.
pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
inside: {
"file-descriptor": {
pattern: /^\d/,
alias: "important"
}
}
},
"punctuation": /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
"number": {
pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
lookbehind: true
}
};
commandAfterHeredoc.inside = Prism2.languages.bash;
var toBeCopied = [
"comment",
"function-name",
"for-or-select",
"assign-left",
"string",
"environment",
"function",
"keyword",
"builtin",
"boolean",
"file-descriptor",
"operator",
"punctuation",
"number"
];
var inside = insideString.variable[1].inside;
for (var i = 0; i < toBeCopied.length; i++) {
inside[toBeCopied[i]] = Prism2.languages.bash[toBeCopied[i]];
}
Prism2.languages.shell = Prism2.languages.bash;
})(Prism);
Prism.languages.basic = {
"comment": {
pattern: /(?:!|REM\b).+/i,
inside: {
"keyword": /^REM/i
}
},
"string": {
pattern: /"(?:""|[!#$%&'()*,\/:;<=>?^\w +\-.])*"/,
greedy: true
},
"number": /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,
"keyword": /\b(?:AS|BEEP|BLOAD|BSAVE|CALL(?: ABSOLUTE)?|CASE|CHAIN|CHDIR|CLEAR|CLOSE|CLS|COM|COMMON|CONST|DATA|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DIM|DO|DOUBLE|ELSE|ELSEIF|END|ENVIRON|ERASE|ERROR|EXIT|FIELD|FILES|FOR|FUNCTION|GET|GOSUB|GOTO|IF|INPUT|INTEGER|IOCTL|KEY|KILL|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|MKDIR|NAME|NEXT|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPTION BASE|OUT|POKE|PUT|READ|REDIM|REM|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SELECT CASE|SHARED|SHELL|SINGLE|SLEEP|STATIC|STEP|STOP|STRING|SUB|SWAP|SYSTEM|THEN|TIMER|TO|TROFF|TRON|TYPE|UNLOCK|UNTIL|USING|VIEW PRINT|WAIT|WEND|WHILE|WRITE)(?:\$|\b)/i,
"function": /\b(?:ABS|ACCESS|ACOS|ANGLE|AREA|ARITHMETIC|ARRAY|ASIN|ASK|AT|ATN|BASE|BEGIN|BREAK|CAUSE|CEIL|CHR|CLIP|COLLATE|COLOR|CON|COS|COSH|COT|CSC|DATE|DATUM|DEBUG|DECIMAL|DEF|DEG|DEGREES|DELETE|DET|DEVICE|DISPLAY|DOT|ELAPSED|EPS|ERASABLE|EXLINE|EXP|EXTERNAL|EXTYPE|FILETYPE|FIXED|FP|GO|GRAPH|HANDLER|IDN|IMAGE|IN|INT|INTERNAL|IP|IS|KEYED|LBOUND|LCASE|LEFT|LEN|LENGTH|LET|LINE|LINES|LOG|LOG10|LOG2|LTRIM|MARGIN|MAT|MAX|MAXNUM|MID|MIN|MISSING|MOD|NATIVE|NUL|NUMERIC|OF|OPTION|ORD|ORGANIZATION|OUTIN|OUTPUT|PI|POINT|POINTER|POINTS|POS|PRINT|PROGRAM|PROMPT|RAD|RADIANS|RANDOMIZE|RECORD|RECSIZE|RECTYPE|RELATIVE|REMAINDER|REPEAT|REST|RETRY|REWRITE|RIGHT|RND|ROUND|RTRIM|SAME|SEC|SELECT|SEQUENTIAL|SET|SETTER|SGN|SIN|SINH|SIZE|SKIP|SQR|STANDARD|STATUS|STR|STREAM|STYLE|TAB|TAN|TANH|TEMPLATE|TEXT|THERE|TIME|TIMEOUT|TRACE|TRANSFORM|TRUNCATE|UBOUND|UCASE|USE|VAL|VARIABLE|VIEWPORT|WHEN|WINDOW|WITH|ZER|ZONEWIDTH)(?:\$|\b)/i,
"operator": /<[=>]?|>=?|[+\-*\/^=&]|\b(?:AND|EQV|IMP|NOT|OR|XOR)\b/i,
"punctuation": /[,;:()]/
};
(function(Prism2) {
var variable = /%%?[~:\w]+%?|!\S+!/;
var parameter = {
pattern: /\/[a-z?]+(?=[ :]|$):?|-[a-z]\b|--[a-z-]+\b/im,
alias: "attr-name",
inside: {
"punctuation": /:/
}
};
var string = /"(?:[\\"]"|[^"])*"(?!")/;
var number = /(?:\b|-)\d+\b/;
Prism2.languages.batch = {
"comment": [
/^::.*/m,
{
pattern: /((?:^|[&(])[ \t]*)rem\b(?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,
lookbehind: true
}
],
"label": {
pattern: /^:.*/m,
alias: "property"
},
"command": [
{
// FOR command
pattern: /((?:^|[&(])[ \t]*)for(?: \/[a-z?](?:[ :](?:"[^"]*"|[^\s"/]\S*))?)* \S+ in \([^)]+\) do/im,
lookbehind: true,
inside: {
"keyword": /\b(?:do|in)\b|^for\b/i,
"string": string,
"parameter": parameter,
"variable": variable,
"number": number,
"punctuation": /[()',]/
}
},
{
// IF command
pattern: /((?:^|[&(])[ \t]*)if(?: \/[a-z?](?:[ :](?:"[^"]*"|[^\s"/]\S*))?)* (?:not )?(?:cmdextversion \d+|defined \w+|errorlevel \d+|exist \S+|(?:"[^"]*"|(?!")(?:(?!==)\S)+)?(?:==| (?:equ|geq|gtr|leq|lss|neq) )(?:"[^"]*"|[^\s"]\S*))/im,
lookbehind: true,
inside: {
"keyword": /\b(?:cmdextversion|defined|errorlevel|exist|not)\b|^if\b/i,
"string": string,
"parameter": parameter,
"variable": variable,
"number": number,
"operator": /\^|==|\b(?:equ|geq|gtr|leq|lss|neq)\b/i
}
},
{
// ELSE command
pattern: /((?:^|[&()])[ \t]*)else\b/im,
lookbehind: true,
inside: {
"keyword": /^else\b/i
}
},
{
// SET command
pattern: /((?:^|[&(])[ \t]*)set(?: \/[a-z](?:[ :](?:"[^"]*"|[^\s"/]\S*))?)* (?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,
lookbehind: true,
inside: {
"keyword": /^set\b/i,
"string": string,
"parameter": parameter,
"variable": [
variable,
/\w+(?=(?:[*\/%+\-&^|]|<<|>>)?=)/
],
"number": number,
"operator": /[*\/%+\-&^|]=?|<<=?|>>=?|[!~_=]/,
"punctuation": /[()',]/
}
},
{
// Other commands
pattern: /((?:^|[&(])[ \t]*@?)\w+\b(?:"(?:[\\"]"|[^"])*"(?!")|[^"^&)\r\n]|\^(?:\r\n|[\s\S]))*/m,
lookbehind: true,
inside: {
"keyword": /^\w+\b/,
"string": string,
"parameter": parameter,
"label": {
pattern: /(^\s*):\S+/m,
lookbehind: true,
alias: "property"
},
"variable": variable,
"number": number,
"operator": /\^/
}
}
],
"operator": /[&@]/,
"punctuation": /[()']/
};
})(Prism);
Prism.languages.bbcode = {
"tag": {
pattern: /\[\/?[^\s=\]]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'"\]=]+))?(?:\s+[^\s=\]]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'"\]=]+))*\s*\]/,
inside: {
"tag": {
pattern: /^\[\/?[^\s=\]]+/,
inside: {
"punctuation": /^\[\/?/
}
},
"attr-value": {
pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'"\]=]+)/,
inside: {
"punctuation": [
/^=/,
{
pattern: /^(\s*)["']|["']$/,
lookbehind: true
}
]
}
},
"punctuation": /\]/,
"attr-name": /[^\s=\]]+/
}
}
};
Prism.languages.shortcode = Prism.languages.bbcode;
Prism.languages.bicep = {
"comment": [
{
// multiline comments eg /* ASDF */
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
lookbehind: true,
greedy: true
},
{
// singleline comments eg // ASDF
pattern: /(^|[^\\:])\/\/.*/,
lookbehind: true,
greedy: true
}
],
"property": [
{
pattern: /([\r\n][ \t]*)[a-z_]\w*(?=[ \t]*:)/i,
lookbehind: true
},
{
pattern: /([\r\n][ \t]*)'(?:\\.|\$(?!\{)|[^'\\\r\n$])*'(?=[ \t]*:)/,
lookbehind: true,
greedy: true
}
],
"string": [
{
pattern: /'''[^'][\s\S]*?'''/,
greedy: true
},
{
pattern: /(^|[^\\'])'(?:\\.|\$(?!\{)|[^'\\\r\n$])*'/,
lookbehind: true,
greedy: true
}
],
"interpolated-string": {
pattern: /(^|[^\\'])'(?:\\.|\$(?:(?!\{)|\{[^{}\r\n]*\})|[^'\\\r\n$])*'/,
lookbehind: true,
greedy: true,
inside: {
"interpolation": {
pattern: /\$\{[^{}\r\n]*\}/,
inside: {
"expression": {
pattern: /(^\$\{)[\s\S]+(?=\}$)/,
lookbehind: true
},
"punctuation": /^\$\{|\}$/
}
},
"string": /[\s\S]+/
}
},
"datatype": {
pattern: /(\b(?:output|param)\b[ \t]+\w+[ \t]+)\w+\b/,
lookbehind: true,
alias: "class-name"
},
"boolean": /\b(?:false|true)\b/,
// https://github.com/Azure/bicep/blob/114a3251b4e6e30082a58729f19a8cc4e374ffa6/src/textmate/bicep.tmlanguage#L184
"keyword": /\b(?:existing|for|if|in|module|null|output|param|resource|targetScope|var)\b/,
"decorator": /@\w+\b/,
"function": /\b[a-z_]\w*(?=[ \t]*\()/i,
"number": /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,
"operator": /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/,
"punctuation": /[{}[\];(),.:]/
};
Prism.languages.bicep["interpolated-string"].inside["interpolation"].inside["expression"].inside = Prism.languages.bicep;
Prism.languages.birb = Prism.languages.extend("clike", {
"string": {
pattern: /r?("|')(?:\\.|(?!\1)[^\\])*\1/,
greedy: true
},
"class-name": [
/\b[A-Z](?:[\d_]*[a-zA-Z]\w*)?\b/,
// matches variable and function return types (parameters as well).
/\b(?:[A-Z]\w*|(?!(?:var|void)\b)[a-z]\w*)(?=\s+\w+\s*[;,=()])/
],
"keyword": /\b(?:assert|break|case|class|const|default|else|enum|final|follows|for|grab|if|nest|new|next|noSeeb|return|static|switch|throw|var|void|while)\b/,
"operator": /\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?|:/,
"variable": /\b[a-z_]\w*\b/
});
Prism.languages.insertBefore("birb", "function", {
"metadata": {
pattern: /<\w+>/,
greedy: true,
alias: "symbol"
}
});
Prism.languages.bison = Prism.languages.extend("c", {});
Prism.languages.insertBefore("bison", "comment", {
"bison": {
// This should match all the beginning of the file
// including the prologue(s), the bison declarations and
// the grammar rules.
pattern: /^(?:[^%]|%(?!%))*%%[\s\S]*?%%/,
inside: {
"c": {
// Allow for one level of nested braces
pattern: /%\{[\s\S]*?%\}|\{(?:\{[^}]*\}|[^{}])*\}/,
inside: {
"delimiter": {
pattern: /^%?\{|%?\}$/,
alias: "punctuation"
},
"bison-variable": {
pattern: /[$@](?:<[^\s>]+>)?[\w$]+/,
alias: "variable",
inside: {
"punctuation": /<|>/
}
},
rest: Prism.languages.c
}
},
"comment": Prism.languages.c.comment,
"string": Prism.languages.c.string,
"property": /\S+(?=:)/,
"keyword": /%\w+/,
"number": {
pattern: /(^|[^@])\b(?:0x[\da-f]+|\d+)/i,
lookbehind: true
},
"punctuation": /%[%?]|[|:;\[\]<>]/
}
}
});
Prism.languages.bnf = {
"string": {
pattern: /"[^\r\n"]*"|'[^\r\n']*'/
},
"definition": {
pattern: /<[^<>\r\n\t]+>(?=\s*::=)/,
alias: ["rule", "keyword"],
inside: {
"punctuation": /^<|>$/
}
},
"rule": {
pattern: /<[^<>\r\n\t]+>/,
inside: {
"punctuation": /^<|>$/
}
},
"operator": /::=|[|()[\]{}*+?]|\.{3}/
};
Prism.languages.rbnf = Prism.languages.bnf;
Prism.languages.brainfuck = {
"pointer": {
pattern: /<|>/,
alias: "keyword"
},
"increment": {
pattern: /\+/,
alias: "inserted"
},
"decrement": {
pattern: /-/,
alias: "deleted"
},
"branching": {
pattern: /\[|\]/,
alias: "important"
},
"operator": /[.,]/,
"comment": /\S+/
};
Prism.languages.brightscript = {
"comment": /(?:\brem|').*/i,
"directive-statement": {
pattern: /(^[\t ]*)#(?:const|else(?:[\t ]+if)?|end[\t ]+if|error|if).*/im,
lookbehind: true,
alias: "property",
inside: {
"error-message": {
pattern: /(^#error).+/,
lookbehind: true
},
"directive": {
pattern: /^#(?:const|else(?:[\t ]+if)?|end[\t ]+if|error|if)/,
alias: "keyword"
},
"expression": {
pattern: /[\s\S]+/,
inside: null
// see below
}
}
},
"property": {
pattern: /([\r\n{,][\t ]*)(?:(?!\d)\w+|"(?:[^"\r\n]|"")*"(?!"))(?=[ \t]*:)/,
lookbehind: true,
greedy: true
},
"string": {
pattern: /"(?:[^"\r\n]|"")*"(?!")/,
greedy: true
},
"class-name": {
pattern: /(\bAs[\t ]+)\w+/i,
lookbehind: true
},
"keyword": /\b(?:As|Dim|Each|Else|Elseif|End|Exit|For|Function|Goto|If|In|Print|Return|Step|Stop|Sub|Then|To|While)\b/i,
"boolean": /\b(?:false|true)\b/i,
"function": /\b(?!\d)\w+(?=[\t ]*\()/,
"number": /(?:\b\d+(?:\.\d+)?(?:[ed][+-]\d+)?|&h[a-f\d]+)\b[%&!#]?/i,
"operator": /--|\+\+|>>=?|<<=?|<>|[-+*/\\<>]=?|[:^=?]|\b(?:and|mod|not|or)\b/i,
"punctuation": /[.,;()[\]{}]/,
"constant": /\b(?:LINE_NUM)\b/i
};
Prism.languages.brightscript["directive-statement"].inside.expression.inside = Prism.languages.brightscript;
Prism.languages.bro = {
"comment": {
pattern: /(^|[^\\$])#.*/,
lookbehind: true,
inside: {
"italic": /\b(?:FIXME|TODO|XXX)\b/
}
},
"string": {
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
greedy: true
},
"boolean": /\b[TF]\b/,
"function": {
pattern: /(\b(?:event|function|hook)[ \t]+)\w+(?:::\w+)?/,
lookbehind: true
},
"builtin": /(?:@(?:load(?:-(?:plugin|sigs))?|unload|prefixes|ifn?def|else|(?:end)?if|DIR|FILENAME))|(?:&?(?:add_func|create_expire|default|delete_func|encrypt|error_handler|expire_func|group|log|mergeable|optional|persistent|priority|raw_output|read_expire|redef|rotate_interval|rotate_size|synchronized|type_column|write_expire))/,
"constant": {
pattern: /(\bconst[ \t]+)\w+/i,
lookbehind: true
},
"keyword": /\b(?:add|addr|alarm|any|bool|break|const|continue|count|delete|double|else|enum|event|export|file|for|function|global|hook|if|in|int|interval|local|module|next|of|opaque|pattern|port|print|record|return|schedule|set|string|subnet|table|time|timeout|using|vector|when)\b/,
"operator": /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&|\|\|?|\?|\*|\/|~|\^|%/,
"number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
"punctuation": /[{}[\];(),.:]/
};
Prism.languages.bsl = {
"comment": /\/\/.*/,
"string": [
// Строки
// Strings
{
pattern: /"(?:[^"]|"")*"(?!")/,
greedy: true
},
// Дата и время
// Date & time
{
pattern: /'(?:[^'\r\n\\]|\\.)*'/
}
],
"keyword": [
{
// RU
pattern: /(^|[^\w\u0400-\u0484\u0487-\u052f\u1d2b\u1d78\u2de0-\u2dff\ua640-\ua69f\ufe2e\ufe2f])(?:пока|для|новый|прервать|попытка|исключение|вызватьисключение|иначе|конецпопытки|неопределено|функция|перем|возврат|конецфункции|если|иначеесли|процедура|конецпроцедуры|тогда|знач|экспорт|конецесли|из|каждого|истина|ложь|по|цикл|конеццикла|выполнить)(?![\w\u0400-\u0484\u0487-\u052f\u1d2b\u1d78\u2de0-\u2dff\ua640-\ua69f\ufe2e\ufe2f])/i,
lookbehind: true
},
{
// EN
pattern: /\b(?:break|do|each|else|elseif|enddo|endfunction|endif|endprocedure|endtry|except|execute|export|false|for|function|if|in|new|null|procedure|raise|return|then|to|true|try|undefined|val|var|while)\b/i
}
],
"number": {
pattern: /(^(?=\d)|[^\w\u0400-\u0484\u0487-\u052f\u1d2b\u1d78\u2de0-\u2dff\ua640-\ua69f\ufe2e\ufe2f])(?:\d+(?:\.\d*)?|\.\d+)(?:E[+-]?\d+)?/i,
lookbehind: true
},
"operator": [
/[<>+\-*/]=?|[%=]/,
// RU
{
pattern: /(^|[^\w\u0400-\u0484\u0487-\u052f\u1d2b\u1d78\u2de0-\u2dff\ua640-\ua69f\ufe2e\ufe2f])(?:и|или|не)(?![\w\u0400-\u0484\u0487-\u052f\u1d2b\u1d78\u2de0-\u2dff\ua640-\ua69f\ufe2e\ufe2f])/i,
lookbehind: true
},
// EN
{
pattern: /\b(?:and|not|or)\b/i
}
],
"punctuation": /\(\.|\.\)|[()\[\]:;,.]/,
"directive": [
// Теги препроцессора вида &Клиент, &Сервер, ...
// Preprocessor tags of the type &Client, &Server, ...
{
pattern: /^([ \t]*)&.*/m,
lookbehind: true,
greedy: true,
alias: "important"
},
// Инструкции препроцессора вида:
// #Если Сервер Тогда
// ...
// #КонецЕсли
// Preprocessor instructions of the form:
// #If Server Then
// ...
// #EndIf
{
pattern: /^([ \t]*)#.*/gm,
lookbehind: true,
greedy: true,
alias: "important"
}
]
};
Prism.languages.oscript = Prism.languages["bsl"];
Prism.languages.cfscript = Prism.languages.extend("clike", {
"comment": [
{
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
lookbehind: true,
inside: {
"annotation": {
pattern: /(?:^|[^.])@[\w\.]+/,
alias: "punctuation"
}
}
},
{
pattern: /(^|[^\\:])\/\/.*/,
lookbehind: true,
greedy: true
}
],
"keyword": /\b(?:abstract|break|catch|component|continue|default|do|else|extends|final|finally|for|function|if|in|include|package|private|property|public|remote|required|rethrow|return|static|switch|throw|try|var|while|xml)\b(?!\s*=)/,
"operator": [
/\+\+|--|&&|\|\||::|=>|[!=]==|[-+*/%&|^!=<>]=?|\?(?:\.|:)?|:/,
/\b(?:and|contains|eq|equal|eqv|gt|gte|imp|is|lt|lte|mod|not|or|xor)\b/
],
"scope": {
pattern: /\b(?:application|arguments|cgi|client|cookie|local|session|super|this|variables)\b/,
alias: "global"
},
"type": {
pattern: /\b(?:any|array|binary|boolean|date|guid|numeric|query|string|struct|uuid|void|xml)\b/,
alias: "builtin"
}
});
Prism.languages.insertBefore("cfscript", "keyword", {
// This must be declared before keyword because we use "function" inside the lookahead
"function-variable": {
pattern: /[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
alias: "function"
}
});
delete Prism.languages.cfscript["class-name"];
Prism.languages.cfc = Prism.languages["cfscript"];
Prism.languages.chaiscript = Prism.languages.extend("clike", {
"string": {
pattern: /(^|[^\\])'(?:[^'\\]|\\[\s\S])*'/,
lookbehind: true,
greedy: true
},
"class-name": [
{
// e.g. class Rectangle { ... }
pattern: /(\bclass\s+)\w+/,
lookbehind: true
},
{
// e.g. attr Rectangle::height, def Rectangle::area() { ... }
pattern: /(\b(?:attr|def)\s+)\w+(?=\s*::)/,
lookbehind: true
}
],
"keyword": /\b(?:attr|auto|break|case|catch|class|continue|def|default|else|finally|for|fun|global|if|return|switch|this|try|var|while)\b/,
"number": [
Prism.languages.cpp.number,
/\b(?:Infinity|NaN)\b/
],
"operator": />>=?|<<=?|\|\||&&|:[:=]?|--|\+\+|[=!<>+\-*/%|&^]=?|[?~]|`[^`\r\n]{1,4}`/
});
Prism.languages.insertBefore("chaiscript", "operator", {
"parameter-type": {
// e.g. def foo(int x, Vector y) {...}
pattern: /([,(]\s*)\w+(?=\s+\w)/,
lookbehind: true,
alias: "class-name"
}
});
Prism.languages.insertBefore("chaiscript", "string", {
"string-interpolation": {
pattern: /(^|[^\\])"(?:[^"$\\]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*\})*"/,
lookbehind: true,
greedy: true,
inside: {
"interpolation": {
pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*\}/,
lookbehind: true,
inside: {
"interpolation-expression": {
pattern: /(^\$\{)[\s\S]+(?=\}$)/,
lookbehind: true,
inside: Prism.languages.chaiscript
},
"interpolation-punctuation": {
pattern: /^\$\{|\}$/,
alias: "punctuation"
}
}
},
"string": /[\s\S]+/
}
}
});
Prism.languages.cil = {
"comment": /\/\/.*/,
"string": {
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
greedy: true
},
"directive": {
pattern: /(^|\W)\.[a-z]+(?=\s)/,
lookbehind: true,
alias: "class-name"
},
// Actually an assembly reference
"variable": /\[[\w\.]+\]/,
"keyword": /\b(?:abstract|ansi|assembly|auto|autochar|beforefieldinit|bool|bstr|byvalstr|catch|char|cil|class|currency|date|decimal|default|enum|error|explicit|extends|extern|famandassem|family|famorassem|final(?:ly)?|float32|float64|hidebysig|u?int(?:8|16|32|64)?|iant|idispatch|implements|import|initonly|instance|interface|iunknown|literal|lpstr|lpstruct|lptstr|lpwstr|managed|method|native(?:Type)?|nested|newslot|object(?:ref)?|pinvokeimpl|private|privatescope|public|reqsecobj|rtspecialname|runtime|sealed|sequential|serializable|specialname|static|string|struct|syschar|tbstr|unicode|unmanagedexp|unsigned|value(?:type)?|variant|virtual|void)\b/,
"function": /\b(?:(?:constrained|no|readonly|tail|unaligned|volatile)\.)?(?:conv\.(?:[iu][1248]?|ovf\.[iu][1248]?(?:\.un)?|r\.un|r4|r8)|ldc\.(?:i4(?:\.\d+|\.[mM]1|\.s)?|i8|r4|r8)|ldelem(?:\.[iu][1248]?|\.r[48]|\.ref|a)?|ldind\.(?:[iu][1248]?|r[48]|ref)|stelem\.?(?:i[1248]?|r[48]|ref)?|stind\.(?:i[1248]?|r[48]|ref)?|end(?:fault|filter|finally)|ldarg(?:\.[0-3s]|a(?:\.s)?)?|ldloc(?:\.\d+|\.s)?|sub(?:\.ovf(?:\.un)?)?|mul(?:\.ovf(?:\.un)?)?|add(?:\.ovf(?:\.un)?)?|stloc(?:\.[0-3s])?|refany(?:type|val)|blt(?:\.un)?(?:\.s)?|ble(?:\.un)?(?:\.s)?|bgt(?:\.un)?(?:\.s)?|bge(?:\.un)?(?:\.s)?|unbox(?:\.any)?|init(?:blk|obj)|call(?:i|virt)?|brfalse(?:\.s)?|bne\.un(?:\.s)?|ldloca(?:\.s)?|brzero(?:\.s)?|brtrue(?:\.s)?|brnull(?:\.s)?|brinst(?:\.s)?|starg(?:\.s)?|leave(?:\.s)?|shr(?:\.un)?|rem(?:\.un)?|div(?:\.un)?|clt(?:\.un)?|alignment|castclass|ldvirtftn|beq(?:\.s)?|ckfinite|ldsflda|ldtoken|localloc|mkrefany|rethrow|cgt\.un|arglist|switch|stsfld|sizeof|newobj|newarr|ldsfld|ldnull|ldflda|isinst|throw|stobj|stfld|ldstr|ldobj|ldlen|ldftn|ldfld|cpobj|cpblk|break|br\.s|xor|shl|ret|pop|not|nop|neg|jmp|dup|cgt|ceq|box|and|or|br)\b/,
"boolean": /\b(?:false|true)\b/,
"number": /\b-?(?:0x[0-9a-f]+|\d+)(?:\.[0-9a-f]+)?\b/i,
"punctuation": /[{}[\];(),:=]|IL_[0-9A-Za-z]+/
};
Prism.languages.clojure = {
"comment": {
pattern: /;.*/,
greedy: true
},
"string": {
pattern: /"(?:[^"\\]|\\.)*"/,
greedy: true
},
"char": /\\\w+/,
"symbol": {
pattern: /(^|[\s()\[\]{},])::?[\w*+!?'<>=/.-]+/,
lookbehind: true
},
"keyword": {
pattern: /(\()(?:-|->|->>|\.|\.\.|\*|\/|\+|<|<=|=|==|>|>=|accessor|agent|agent-errors|aget|alength|all-ns|alter|and|append-child|apply|array-map|aset|aset-boolean|aset-byte|aset-char|aset-double|aset-float|aset-int|aset-long|aset-short|assert|assoc|await|await-for|bean|binding|bit-and|bit-not|bit-or|bit-shift-left|bit-shift-right|bit-xor|boolean|branch\?|butlast|byte|cast|char|children|class|clear-agent-errors|comment|commute|comp|comparator|complement|concat|cond|conj|cons|constantly|construct-proxy|contains\?|count|create-ns|create-struct|cycle|dec|declare|def|def-|definline|definterface|defmacro|defmethod|defmulti|defn|defn-|defonce|defproject|defprotocol|defrecord|defstruct|deftype|deref|difference|disj|dissoc|distinct|do|doall|doc|dorun|doseq|dosync|dotimes|doto|double|down|drop|drop-while|edit|end\?|ensure|eval|every\?|false\?|ffirst|file-seq|filter|find|find-doc|find-ns|find-var|first|float|flush|fn|fnseq|for|frest|gensym|get|get-proxy-class|hash-map|hash-set|identical\?|identity|if|if-let|if-not|import|in-ns|inc|index|insert-child|insert-left|insert-right|inspect-table|inspect-tree|instance\?|int|interleave|intersection|into|into-array|iterate|join|key|keys|keyword|keyword\?|last|lazy-cat|lazy-cons|left|lefts|let|line-seq|list|list\*|load|load-file|locking|long|loop|macroexpand|macroexpand-1|make-array|make-node|map|map-invert|map\?|mapcat|max|max-key|memfn|merge|merge-with|meta|min|min-key|monitor-enter|name|namespace|neg\?|new|newline|next|nil\?|node|not|not-any\?|not-every\?|not=|ns|ns-imports|ns-interns|ns-map|ns-name|ns-publics|ns-refers|ns-resolve|ns-unmap|nth|nthrest|or|parse|partial|path|peek|pop|pos\?|pr|pr-str|print|print-str|println|println-str|prn|prn-str|project|proxy|proxy-mappings|quot|quote|rand|rand-int|range|re-find|re-groups|re-matcher|re-matches|re-pattern|re-seq|read|read-line|recur|reduce|ref|ref-set|refer|rem|remove|remove-method|remove-ns|rename|rename-keys|repeat|replace|replicate|resolve|rest|resultset-seq|reverse|rfirst|right|rights|root|rrest|rseq|second|select|select-keys|send|send-off|seq|seq-zip|seq\?|set|set!|short|slurp|some|sort|sort-by|sorted-map|sorted-map-by|sorted-set|special-symbol\?|split-at|split-with|str|string\?|struct|struct-map|subs|subvec|symbol|symbol\?|sync|take|take-nth|take-while|test|throw|time|to-array|to-array-2d|tree-seq|true\?|try|union|up|update-proxy|val|vals|var|var-get|var-set|var\?|vector|vector-zip|vector\?|when|when-first|when-let|when-not|with-local-vars|with-meta|with-open|with-out-str|xml-seq|xml-zip|zero\?|zipmap|zipper)(?=[\s)]|$)/,
lookbehind: true
},
"boolean": /\b(?:false|nil|true)\b/,
"number": {
pattern: /(^|[^\w$@])(?:\d+(?:[/.]\d+)?(?:e[+-]?\d+)?|0x[a-f0-9]+|[1-9]\d?r[a-z0-9]+)[lmn]?(?![\w$@])/i,
lookbehind: true
},
"function": {
pattern: /((?:^|[^'])\()[\w*+!?'<>=/.-]+(?=[\s)]|$)/,
lookbehind: true
},
"operator": /[#@^`~]/,
"punctuation": /[{}\[\](),]/
};
Prism.languages.cmake = {
"comment": /#.*/,
"string": {
pattern: /"(?:[^\\"]|\\.)*"/,
greedy: true,
inside: {
"interpolation": {
pattern: /\$\{(?:[^{}$]|\$\{[^{}$]*\})*\}/,
inside: {
"punctuation": /\$\{|\}/,
"variable": /\w+/
}
}
}
},
"variable": /\b(?:CMAKE_\w+|\w+_(?:(?:BINARY|SOURCE)_DIR|DESCRIPTION|HOMEPAGE_URL|ROOT|VERSION(?:_MAJOR|_MINOR|_PATCH|_TWEAK)?)|(?:ANDROID|APPLE|BORLAND|BUILD_SHARED_LIBS|CACHE|CPACK_(?:ABSOLUTE_DESTINATION_FILES|COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY|ERROR_ON_ABSOLUTE_INSTALL_DESTINATION|INCLUDE_TOPLEVEL_DIRECTORY|INSTALL_DEFAULT_DIRECTORY_PERMISSIONS|INSTALL_SCRIPT|PACKAGING_INSTALL_PREFIX|SET_DESTDIR|WARN_ON_ABSOLUTE_INSTALL_DESTINATION)|CTEST_(?:BINARY_DIRECTORY|BUILD_COMMAND|BUILD_NAME|BZR_COMMAND|BZR_UPDATE_OPTIONS|CHANGE_ID|CHECKOUT_COMMAND|CONFIGURATION_TYPE|CONFIGURE_COMMAND|COVERAGE_COMMAND|COVERAGE_EXTRA_FLAGS|CURL_OPTIONS|CUSTOM_(?:COVERAGE_EXCLUDE|ERROR_EXCEPTION|ERROR_MATCH|ERROR_POST_CONTEXT|ERROR_PRE_CONTEXT|MAXIMUM_FAILED_TEST_OUTPUT_SIZE|MAXIMUM_NUMBER_OF_(?:ERRORS|WARNINGS)|MAXIMUM_PASSED_TEST_OUTPUT_SIZE|MEMCHECK_IGNORE|POST_MEMCHECK|POST_TEST|PRE_MEMCHECK|PRE_TEST|TESTS_IGNORE|WARNING_EXCEPTION|WARNING_MATCH)|CVS_CHECKOUT|CVS_COMMAND|CVS_UPDATE_OPTIONS|DROP_LOCATION|DROP_METHOD|DROP_SITE|DROP_SITE_CDASH|DROP_SITE_PASSWORD|DROP_SITE_USER|EXTRA_COVERAGE_GLOB|GIT_COMMAND|GIT_INIT_SUBMODULES|GIT_UPDATE_CUSTOM|GIT_UPDATE_OPTIONS|HG_COMMAND|HG_UPDATE_OPTIONS|LABELS_FOR_SUBPROJECTS|MEMORYCHECK_(?:COMMAND|COMMAND_OPTIONS|SANITIZER_OPTIONS|SUPPRESSIONS_FILE|TYPE)|NIGHTLY_START_TIME|P4_CLIENT|P4_COMMAND|P4_OPTIONS|P4_UPDATE_OPTIONS|RUN_CURRENT_SCRIPT|SCP_COMMAND|SITE|SOURCE_DIRECTORY|SUBMIT_URL|SVN_COMMAND|SVN_OPTIONS|SVN_UPDATE_OPTIONS|TEST_LOAD|TEST_TIMEOUT|TRIGGER_SITE|UPDATE_COMMAND|UPDATE_OPTIONS|UPDATE_VERSION_ONLY|USE_LAUNCHERS)|CYGWIN|ENV|EXECUTABLE_OUTPUT_PATH|GHS-MULTI|IOS|LIBRARY_OUTPUT_PATH|MINGW|MSVC(?:10|11|12|14|60|70|71|80|90|_IDE|_TOOLSET_VERSION|_VERSION)?|MSYS|PROJECT_NAME|UNIX|WIN32|WINCE|WINDOWS_PHONE|WINDOWS_STORE|XCODE))\b/,
"property": /\b(?:cxx_\w+|(?:ARCHIVE_OUTPUT_(?:DIRECTORY|NAME)|COMPILE_DEFINITIONS|COMPILE_PDB_NAME|COMPILE_PDB_OUTPUT_DIRECTORY|EXCLUDE_FROM_DEFAULT_BUILD|IMPORTED_(?:IMPLIB|LIBNAME|LINK_DEPENDENT_LIBRARIES|LINK_INTERFACE_LANGUAGES|LINK_INTERFACE_LIBRARIES|LINK_INTERFACE_MULTIPLICITY|LOCATION|NO_SONAME|OBJECTS|SONAME)|INTERPROCEDURAL_OPTIMIZATION|LIBRARY_OUTPUT_DIRECTORY|LIBRARY_OUTPUT_NAME|LINK_FLAGS|LINK_INTERFACE_LIBRARIES|LINK_INTERFACE_MULTIPLICITY|LOCATION|MAP_IMPORTED_CONFIG|OSX_ARCHITECTURES|OUTPUT_NAME|PDB_NAME|PDB_OUTPUT_DIRECTORY|RUNTIME_OUTPUT_DIRECTORY|RUNTIME_OUTPUT_NAME|STATIC_LIBRARY_FLAGS|VS_CSHARP|VS_DOTNET_REFERENCEPROP|VS_DOTNET_REFERENCE|VS_GLOBAL_SECTION_POST|VS_GLOBAL_SECTION_PRE|VS_GLOBAL|XCODE_ATTRIBUTE)_\w+|\w+_(?:CLANG_TIDY|COMPILER_LAUNCHER|CPPCHECK|CPPLINT|INCLUDE_WHAT_YOU_USE|OUTPUT_NAME|POSTFIX|VISIBILITY_PRESET)|ABSTRACT|ADDITIONAL_MAKE_CLEAN_FILES|ADVANCED|ALIASED_TARGET|ALLOW_DUPLICATE_CUSTOM_TARGETS|ANDROID_(?:ANT_ADDITIONAL_OPTIONS|API|API_MIN|ARCH|ASSETS_DIRECTORIES|GUI|JAR_DEPENDENCIES|NATIVE_LIB_DEPENDENCIES|NATIVE_LIB_DIRECTORIES|PROCESS_MAX|PROGUARD|PROGUARD_CONFIG_PATH|SECURE_PROPS_PATH|SKIP_ANT_STEP|STL_TYPE)|ARCHIVE_OUTPUT_DIRECTORY|ATTACHED_FILES|ATTACHED_FILES_ON_FAIL|AUTOGEN_(?:BUILD_DIR|ORIGIN_DEPENDS|PARALLEL|SOURCE_GROUP|TARGETS_FOLDER|TARGET_DEPENDS)|AUTOMOC|AUTOMOC_(?:COMPILER_PREDEFINES|DEPEND_FILTERS|EXECUTABLE|MACRO_NAMES|MOC_OPTIONS|SOURCE_GROUP|TARGETS_FOLDER)|AUTORCC|AUTORCC_EXECUTABLE|AUTORCC_OPTIONS|AUTORCC_SOURCE_GROUP|AUTOUIC|AUTOUIC_EXECUTABLE|AUTOUIC_OPTIONS|AUTOUIC_SEARCH_PATHS|BINARY_DIR|BUILDSYSTEM_TARGETS|BUILD_RPATH|BUILD_RPATH_USE_ORIGIN|BUILD_WITH_INSTALL_NAME_DIR|BUILD_WITH_INSTALL_RPATH|BUNDLE|BUNDLE_EXTENSION|CACHE_VARIABLES|CLEAN_NO_CUSTOM|COMMON_LANGUAGE_RUNTIME|COMPATIBLE_INTERFACE_(?:BOOL|NUMBER_MAX|NUMBER_MIN|STRING)|COMPILE_(?:DEFINITIONS|FEATURES|FLAGS|OPTIONS|PDB_NAME|PDB_OUTPUT_DIRECTORY)|COST|CPACK_DESKTOP_SHORTCUTS|CPACK_NEVER_OVERWRITE|CPACK_PERMANENT|CPACK_STARTUP_SHORTCUTS|CPACK_START_MENU_SHORTCUTS|CPACK_WIX_ACL|CROSSCOMPILING_EMULATOR|CUDA_EXTENSIONS|CUDA_PTX_COMPILATION|CUDA_RESOLVE_DEVICE_SYMBOLS|CUDA_SEPARABLE_COMPILATION|CUDA_STANDARD|CUDA_STANDARD_REQUIRED|CXX_EXTENSIONS|CXX_STANDARD|CXX_STANDARD_REQUIRED|C_EXTENSIONS|C_STANDARD|C_STANDARD_REQUIRED|DEBUG_CONFIGURATIONS|DEFINE_SYMBOL|DEFINITIONS|DEPENDS|DEPLOYMENT_ADDITIONAL_FILES|DEPLOYMENT_REMOTE_DIRECTORY|DISABLED|DISABLED_FEATURES|ECLIPSE_EXTRA_CPROJECT_CONTENTS|ECLIPSE_EXTRA_NATURES|ENABLED_FEATURES|ENABLED_LANGUAGES|ENABLE_EXPORTS|ENVIRONMENT|EXCLUDE_FROM_ALL|EXCLUDE_FROM_DEFAULT_BUILD|EXPORT_NAME|EXPORT_PROPERTIES|EXTERNAL_OBJECT|EchoString|FAIL_REGULAR_EXPRESSION|FIND_LIBRARY_USE_LIB32_PATHS|FIND_LIBRARY_USE_LIB64_PATHS|FIND_LIBRARY_USE_LIBX32_PATHS|FIND_LIBRARY_USE_OPENBSD_VERSIONING|FIXTURES_CLEANUP|FIXTURES_REQUIRED|FIXTURES_SETUP|FOLDER|FRAMEWORK|Fortran_FORMAT|Fortran_MODULE_DIRECTORY|GENERATED|GENERATOR_FILE_NAME|GENERATOR_IS_MULTI_CONFIG|GHS_INTEGRITY_APP|GHS_NO_SOURCE_GROUP_FILE|GLOBAL_DEPENDS_DEBUG_MODE|GLOBAL_DEPENDS_NO_CYCLES|GNUtoMS|HAS_CXX|HEADER_FILE_ONLY|HELPSTRING|IMPLICIT_DEPENDS_INCLUDE_TRANSFORM|IMPORTED|IMPORTED_(?:COMMON_LANGUAGE_RUNTIME|CONFIGURATIONS|GLOBAL|IMPLIB|LIBNAME|LINK_DEPENDENT_LIBRARIES|LINK_INTERFACE_(?:LANGUAGES|LIBRARIES|MULTIPLICITY)|LOCATION|NO_SONAME|OBJECTS|SONAME)|IMPORT_PREFIX|IMPORT_SUFFIX|INCLUDE_DIRECTORIES|INCLUDE_REGULAR_EXPRESSION|INSTALL_NAME_DIR|INSTALL_RPATH|INSTALL_RPATH_USE_LINK_PATH|INTERFACE_(?:AUTOUIC_OPTIONS|COMPILE_DEFINITIONS|COMPILE_FEATURES|COMPILE_OPTIONS|INCLUDE_DIRECTORIES|LINK_DEPENDS|LINK_DIRECTORIES|LINK_LIBRARIES|LINK_OPTIONS|POSITION_INDEPENDENT_CODE|SOURCES|SYSTEM_INCLUDE_DIRECTORIES)|INTERPROCEDURAL_OPTIMIZATION|IN_TRY_COMPILE|IOS_INSTALL_COMBINED|JOB_POOLS|JOB_POOL_COMPILE|JOB_POOL_LINK|KEEP_EXTENSION|LABELS|LANGUAGE|LIBRARY_OUTPUT_DIRECTORY|LINKER_LANGUAGE|LINK_(?:DEPENDS|DEPENDS_NO_SHARED|DIRECTORIES|FLAGS|INTERFACE_LIBRARIES|INTERFACE_MULTIPLICITY|LIBRARIES|OPTIONS|SEARCH_END_STATIC|SEARCH_START_STATIC|WHAT_YOU_USE)|LISTFILE_STACK|LOCATION|MACOSX_BUNDLE|MACOSX_BUNDLE_INFO_PLIST|MACOSX_FRAMEWORK_INFO_PLIST|MACOSX_PACKAGE_LOCATION|MACOSX_RPATH|MACROS|MANUALLY_ADDED_DEPENDENCIES|MEASUREMENT|MODIFIED|NAME|NO_SONAME|NO_SYSTEM_FROM_IMPORTED|OBJECT_DEPENDS|OBJECT_OUTPUTS|OSX_ARCHITECTURES|OUTPUT_NAME|PACKAGES_FOUND|PACKAGES_NOT_FOUND|PARENT_DIRECTORY|PASS_REGULAR_EXPRESSION|PDB_NAME|PDB_OUTPUT_DIRECTORY|POSITION_INDEPENDENT_CODE|POST_INSTALL_SCRIPT|PREDEFINED_TARGETS_FOLDER|PREFIX|PRE_INSTALL_SCRIPT|PRIVATE_HEADER|PROCESSORS|PROCESSOR_AFFINITY|PROJECT_LABEL|PUBLIC_HEADER|REPORT_UNDEFINED_PROPERTIES|REQUIRED_FILES|RESOURCE|RESOURCE_LOCK|RULE_LAUNCH_COMPILE|RULE_LAUNCH_CUSTOM|RULE_LAUNCH_LINK|RULE_MESSAGES|RUNTIME_OUTPUT_DIRECTORY|RUN_SERIAL|SKIP_AUTOGEN|SKIP_AUTOMOC|SKIP_AUTORCC|SKIP_AUTOUIC|SKIP_BUILD_RPATH|SKIP_RETURN_CODE|SOURCES|SOURCE_DIR|SOVERSION|STATIC_LIBRARY_FLAGS|STATIC_LIBRARY_OPTIONS|STRINGS|SUBDIRECTORIES|SUFFIX|SYMBOLIC|TARGET_ARCHIVES_MAY_BE_SHARED_LIBS|TARGET_MESSAGES|TARGET_SUPPORTS_SHARED_LIBS|TESTS|TEST_INCLUDE_FILE|TEST_INCLUDE_FILES|TIMEOUT|TIMEOUT_AFTER_MATCH|TYPE|USE_FOLDERS|VALUE|VARIABLES|VERSION|VISIBILITY_INLINES_HIDDEN|VS_(?:CONFIGURATION_TYPE|COPY_TO_OUT_DIR|DEBUGGER_(?:COMMAND|COMMAND_ARGUMENTS|ENVIRONMENT|WORKING_DIRECTORY)|DEPLOYMENT_CONTENT|DEPLOYMENT_LOCATION|DOTNET_REFERENCES|DOTNET_REFERENCES_COPY_LOCAL|INCLUDE_IN_VSIX|IOT_STARTUP_TASK|KEYWORD|RESOURCE_GENERATOR|SCC_AUXPATH|SCC_LOCALPATH|SCC_PROJECTNAME|SCC_PROVIDER|SDK_REFERENCES|SHADER_(?:DISABLE_OPTIMIZATIONS|ENABLE_DEBUG|ENTRYPOINT|FLAGS|MODEL|OBJECT_FILE_NAME|OUTPUT_HEADER_FILE|TYPE|VARIABLE_NAME)|STARTUP_PROJECT|TOOL_OVERRIDE|USER_PROPS|WINRT_COMPONENT|WINRT_EXTENSIONS|WINRT_REFERENCES|XAML_TYPE)|WILL_FAIL|WIN32_EXECUTABLE|WINDOWS_EXPORT_ALL_SYMBOLS|WORKING_DIRECTORY|WRAP_EXCLUDE|XCODE_(?:EMIT_EFFECTIVE_PLATFORM_NAME|EXPLICIT_FILE_TYPE|FILE_ATTRIBUTES|LAST_KNOWN_FILE_TYPE|PRODUCT_TYPE|SCHEME_(?:ADDRESS_SANITIZER|ADDRESS_SANITIZER_USE_AFTER_RETURN|ARGUMENTS|DISABLE_MAIN_THREAD_CHECKER|DYNAMIC_LIBRARY_LOADS|DYNAMIC_LINKER_API_USAGE|ENVIRONMENT|EXECUTABLE|GUARD_MALLOC|MAIN_THREAD_CHECKER_STOP|MALLOC_GUARD_EDGES|MALLOC_SCRIBBLE|MALLOC_STACK|THREAD_SANITIZER(?:_STOP)?|UNDEFINED_BEHAVIOUR_SANITIZER(?:_STOP)?|ZOMBIE_OBJECTS))|XCTEST)\b/,
"keyword": /\b(?:add_compile_definitions|add_compile_options|add_custom_command|add_custom_target|add_definitions|add_dependencies|add_executable|add_library|add_link_options|add_subdirectory|add_test|aux_source_directory|break|build_command|build_name|cmake_host_system_information|cmake_minimum_required|cmake_parse_arguments|cmake_policy|configure_file|continue|create_test_sourcelist|ctest_build|ctest_configure|ctest_coverage|ctest_empty_binary_directory|ctest_memcheck|ctest_read_custom_files|ctest_run_script|ctest_sleep|ctest_start|ctest_submit|ctest_test|ctest_update|ctest_upload|define_property|else|elseif|enable_language|enable_testing|endforeach|endfunction|endif|endmacro|endwhile|exec_program|execute_process|export|export_library_dependencies|file|find_file|find_library|find_package|find_path|find_program|fltk_wrap_ui|foreach|function|get_cmake_property|get_directory_property|get_filename_component|get_property|get_source_file_property|get_target_property|get_test_property|if|include|include_directories|include_external_msproject|include_guard|include_regular_expression|install|install_files|install_programs|install_targets|link_directories|link_libraries|list|load_cache|load_command|macro|make_directory|mark_as_advanced|math|message|option|output_required_files|project|qt_wrap_cpp|qt_wrap_ui|remove|remove_definitions|return|separate_arguments|set|set_directory_properties|set_property|set_source_files_properties|set_target_properties|set_tests_properties|site_name|source_group|string|subdir_depends|subdirs|target_compile_definitions|target_compile_features|target_compile_options|target_include_directories|target_link_directories|target_link_libraries|target_link_options|target_sources|try_compile|try_run|unset|use_mangled_mesa|utility_source|variable_requires|variable_watch|while|write_file)(?=\s*\()\b/,
"boolean": /\b(?:FALSE|OFF|ON|TRUE)\b/,
"namespace": /\b(?:INTERFACE|PRIVATE|PROPERTIES|PUBLIC|SHARED|STATIC|TARGET_OBJECTS)\b/,
"operator": /\b(?:AND|DEFINED|EQUAL|GREATER|LESS|MATCHES|NOT|OR|STREQUAL|STRGREATER|STRLESS|VERSION_EQUAL|VERSION_GREATER|VERSION_LESS)\b/,
"inserted": {
pattern: /\b\w+::\w+\b/,
alias: "class-name"
},
"number": /\b\d+(?:\.\d+)*\b/,
"function": /\b[a-z_]\w*(?=\s*\()\b/i,
"punctuation": /[()>}]|\$[<{]/
};
Prism.languages.cobol = {
"comment": {
pattern: /\*>.*|(^[ \t]*)\*.*/m,
lookbehind: true,
greedy: true
},
"string": {
pattern: /[xzgn]?(?:"(?:[^\r\n"]|"")*"(?!")|'(?:[^\r\n']|'')*'(?!'))/i,
greedy: true
},
"level": {
pattern: /(^[ \t]*)\d+\b/m,
lookbehind: true,
greedy: true,
alias: "number"
},
"class-name": {
// https://github.com/antlr/grammars-v4/blob/42edd5b687d183b5fa679e858a82297bd27141e7/cobol85/Cobol85.g4#L1015
pattern: /(\bpic(?:ture)?\s+)(?:(?:[-\w$/,:*+<>]|\.(?!\s|$))(?:\(\d+\))?)+/i,
lookbehind: true,
inside: {
"number": {
pattern: /(\()\d+/,
lookbehind: true
},
"punctuation": /[()]/
}
},
"keyword": {
pattern: /(^|[^\w-])(?:ABORT|ACCEPT|ACCESS|ADD|ADDRESS|ADVANCING|AFTER|ALIGNED|ALL|ALPHABET|ALPHABETIC|ALPHABETIC-LOWER|ALPHABETIC-UPPER|ALPHANUMERIC|ALPHANUMERIC-EDITED|ALSO|ALTER|ALTERNATE|ANY|ARE|AREA|AREAS|AS|ASCENDING|ASCII|ASSIGN|ASSOCIATED-DATA|ASSOCIATED-DATA-LENGTH|AT|ATTRIBUTE|AUTHOR|AUTO|AUTO-SKIP|BACKGROUND-COLOR|BACKGROUND-COLOUR|BASIS|BEEP|BEFORE|BEGINNING|BELL|BINARY|BIT|BLANK|BLINK|BLOCK|BOTTOM|BOUNDS|BY|BYFUNCTION|BYTITLE|CALL|CANCEL|CAPABLE|CCSVERSION|CD|CF|CH|CHAINING|CHANGED|CHANNEL|CHARACTER|CHARACTERS|CLASS|CLASS-ID|CLOCK-UNITS|CLOSE|CLOSE-DISPOSITION|COBOL|CODE|CODE-SET|COL|COLLATING|COLUMN|COM-REG|COMMA|COMMITMENT|COMMON|COMMUNICATION|COMP|COMP-1|COMP-2|COMP-3|COMP-4|COMP-5|COMPUTATIONAL|COMPUTATIONAL-1|COMPUTATIONAL-2|COMPUTATIONAL-3|COMPUTATIONAL-4|COMPUTATIONAL-5|COMPUTE|CONFIGURATION|CONTAINS|CONTENT|CONTINUE|CONTROL|CONTROL-POINT|CONTROLS|CONVENTION|CONVERTING|COPY|CORR|CORRESPONDING|COUNT|CRUNCH|CURRENCY|CURSOR|DATA|DATA-BASE|DATE|DATE-COMPILED|DATE-WRITTEN|DAY|DAY-OF-WEEK|DBCS|DE|DEBUG-CONTENTS|DEBUG-ITEM|DEBUG-LINE|DEBUG-NAME|DEBUG-SUB-1|DEBUG-SUB-2|DEBUG-SUB-3|DEBUGGING|DECIMAL-POINT|DECLARATIVES|DEFAULT|DEFAULT-DISPLAY|DEFINITION|DELETE|DELIMITED|DELIMITER|DEPENDING|DESCENDING|DESTINATION|DETAIL|DFHRESP|DFHVALUE|DISABLE|DISK|DISPLAY|DISPLAY-1|DIVIDE|DIVISION|DONTCARE|DOUBLE|DOWN|DUPLICATES|DYNAMIC|EBCDIC|EGCS|EGI|ELSE|EMI|EMPTY-CHECK|ENABLE|END|END-ACCEPT|END-ADD|END-CALL|END-COMPUTE|END-DELETE|END-DIVIDE|END-EVALUATE|END-IF|END-MULTIPLY|END-OF-PAGE|END-PERFORM|END-READ|END-RECEIVE|END-RETURN|END-REWRITE|END-SEARCH|END-START|END-STRING|END-SUBTRACT|END-UNSTRING|END-WRITE|ENDING|ENTER|ENTRY|ENTRY-PROCEDURE|ENVIRONMENT|EOL|EOP|EOS|ERASE|ERROR|ESCAPE|ESI|EVALUATE|EVENT|EVERY|EXCEPTION|EXCLUSIVE|EXHIBIT|EXIT|EXPORT|EXTEND|EXTENDED|EXTERNAL|FD|FILE|FILE-CONTROL|FILLER|FINAL|FIRST|FOOTING|FOR|FOREGROUND-COLOR|FOREGROUND-COLOUR|FROM|FULL|FUNCTION|FUNCTION-POINTER|FUNCTIONNAME|GENERATE|GIVING|GLOBAL|GO|GOBACK|GRID|GROUP|HEADING|HIGH-VALUE|HIGH-VALUES|HIGHLIGHT|I-O|I-O-CONTROL|ID|IDENTIFICATION|IF|IMPLICIT|IMPORT|IN|INDEX|INDEXED|INDICATE|INITIAL|INITIALIZE|INITIATE|INPUT|INPUT-OUTPUT|INSPECT|INSTALLATION|INTEGER|INTO|INVALID|INVOKE|IS|JUST|JUSTIFIED|KANJI|KEPT|KEY|KEYBOARD|LABEL|LANGUAGE|LAST|LB|LD|LEADING|LEFT|LEFTLINE|LENGTH|LENGTH-CHECK|LIBACCESS|LIBPARAMETER|LIBRARY|LIMIT|LIMITS|LINAGE|LINAGE-COUNTER|LINE|LINE-COUNTER|LINES|LINKAGE|LIST|LOCAL|LOCAL-STORAGE|LOCK|LONG-DATE|LONG-TIME|LOW-VALUE|LOW-VALUES|LOWER|LOWLIGHT|MEMORY|MERGE|MESSAGE|MMDDYYYY|MODE|MODULES|MORE-LABELS|MOVE|MULTIPLE|MULTIPLY|NAMED|NATIONAL|NATIONAL-EDITED|NATIVE|NEGATIVE|NETWORK|NEXT|NO|NO-ECHO|NULL|NULLS|NUMBER|NUMERIC|NUMERIC-DATE|NUMERIC-EDITED|NUMERIC-TIME|OBJECT-COMPUTER|OCCURS|ODT|OF|OFF|OMITTED|ON|OPEN|OPTIONAL|ORDER|ORDERLY|ORGANIZATION|OTHER|OUTPUT|OVERFLOW|OVERLINE|OWN|PACKED-DECIMAL|PADDING|PAGE|PAGE-COUNTER|PASSWORD|PERFORM|PF|PH|PIC|PICTURE|PLUS|POINTER|PORT|POSITION|POSITIVE|PRINTER|PRINTING|PRIVATE|PROCEDURE|PROCEDURE-POINTER|PROCEDURES|PROCEED|PROCESS|PROGRAM|PROGRAM-ID|PROGRAM-LIBRARY|PROMPT|PURGE|QUEUE|QUOTE|QUOTES|RANDOM|RD|READ|READER|REAL|RECEIVE|RECEIVED|RECORD|RECORDING|RECORDS|RECURSIVE|REDEFINES|REEL|REF|REFERENCE|REFERENCES|RELATIVE|RELEASE|REMAINDER|REMARKS|REMOTE|REMOVAL|REMOVE|RENAMES|REPLACE|REPLACING|REPORT|REPORTING|REPORTS|REQUIRED|RERUN|RESERVE|RESET|RETURN|RETURN-CODE|RETURNING|REVERSE-VIDEO|REVERSED|REWIND|REWRITE|RF|RH|RIGHT|ROUNDED|RUN|SAME|SAVE|SCREEN|SD|SEARCH|SECTION|SECURE|SECURITY|SEGMENT|SEGMENT-LIMIT|SELECT|SEND|SENTENCE|SEPARATE|SEQUENCE|SEQUENTIAL|SET|SHARED|SHAREDBYALL|SHAREDBYRUNUNIT|SHARING|SHIFT-IN|SHIFT-OUT|SHORT-DATE|SIGN|SIZE|SORT|SORT-CONTROL|SORT-CORE-SIZE|SORT-FILE-SIZE|SORT-MERGE|SORT-MESSAGE|SORT-MODE-SIZE|SORT-RETURN|SOURCE|SOURCE-COMPUTER|SPACE|SPACES|SPECIAL-NAMES|STANDARD|STANDARD-1|STANDARD-2|START|STATUS|STOP|STRING|SUB-QUEUE-1|SUB-QUEUE-2|SUB-QUEUE-3|SUBTRACT|SUM|SUPPRESS|SYMBOL|SYMBOLIC|SYNC|SYNCHRONIZED|TABLE|TALLY|TALLYING|TAPE|TASK|TERMINAL|TERMINATE|TEST|TEXT|THEN|THREAD|THREAD-LOCAL|THROUGH|THRU|TIME|TIMER|TIMES|TITLE|TO|TODAYS-DATE|TODAYS-NAME|TOP|TRAILING|TRUNCATED|TYPE|TYPEDEF|UNDERLINE|UNIT|UNSTRING|UNTIL|UP|UPON|USAGE|USE|USING|VALUE|VALUES|VARYING|VIRTUAL|WAIT|WHEN|WHEN-COMPILED|WITH|WORDS|WORKING-STORAGE|WRITE|YEAR|YYYYDDD|YYYYMMDD|ZERO-FILL|ZEROES|ZEROS)(?![\w-])/i,
lookbehind: true
},
"boolean": {
pattern: /(^|[^\w-])(?:false|true)(?![\w-])/i,
lookbehind: true
},
"number": {
pattern: /(^|[^\w-])(?:[+-]?(?:(?:\d+(?:[.,]\d+)?|[.,]\d+)(?:e[+-]?\d+)?|zero))(?![\w-])/i,
lookbehind: true
},
"operator": [
/<>|[<>]=?|[=+*/&]/,
{
pattern: /(^|[^\w-])(?:-|and|equal|greater|less|not|or|than)(?![\w-])/i,
lookbehind: true
}
],
"punctuation": /[.:,()]/
};
(function(Prism2) {
var comment = /#(?!\{).+/;
var interpolation = {
pattern: /#\{[^}]+\}/,
alias: "variable"
};
Prism2.languages.coffeescript = Prism2.languages.extend("javascript", {
"comment": comment,
"string": [
// Strings are multiline
{
pattern: /'(?:\\[\s\S]|[^\\'])*'/,
greedy: true
},
{
// Strings are multiline
pattern: /"(?:\\[\s\S]|[^\\"])*"/,
greedy: true,
inside: {
"interpolation": interpolation
}
}
],
"keyword": /\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,
"class-member": {
pattern: /@(?!\d)\w+/,
alias: "variable"
}
});
Prism2.languages.insertBefore("coffeescript", "comment", {
"multiline-comment": {
pattern: /###[\s\S]+?###/,
alias: "comment"
},
// Block regexp can contain comments and interpolation
"block-regex": {
pattern: /\/{3}[\s\S]*?\/{3}/,
alias: "regex",
inside: {
"comment": comment,
"interpolation": interpolation
}
}
});
Prism2.languages.insertBefore("coffeescript", "string", {
"inline-javascript": {
pattern: /`(?:\\[\s\S]|[^\\`])*`/,
inside: {
"delimiter": {
pattern: /^`|`$/,
alias: "punctuation"
},
"script": {
pattern: /[\s\S]+/,
alias: "language-javascript",
inside: Prism2.languages.javascript
}
}
},
// Block strings
"multiline-string": [
{
pattern: /'''[\s\S]*?'''/,
greedy: true,
alias: "string"
},
{
pattern: /"""[\s\S]*?"""/,
greedy: true,
alias: "string",
inside: {
interpolation
}
}
]
});
Prism2.languages.insertBefore("coffeescript", "keyword", {
// Object property
"property": /(?!\d)\w+(?=\s*:(?!:))/
});
delete Prism2.languages.coffeescript["template-string"];
Prism2.languages.coffee = Prism2.languages.coffeescript;
})(Prism);
Prism.languages.concurnas = {
"comment": {
pattern: /(^|[^\\])(?:\/\*[\s\S]*?(?:\*\/|$)|\/\/.*)/,
lookbehind: true,
greedy: true
},
"langext": {
pattern: /\b\w+\s*\|\|[\s\S]+?\|\|/,
greedy: true,
inside: {
"class-name": /^\w+/,
"string": {
pattern: /(^\s*\|\|)[\s\S]+(?=\|\|$)/,
lookbehind: true
},
"punctuation": /\|\|/
}
},
"function": {
pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/,
lookbehind: true
},
"keyword": /\b(?:abstract|actor|also|annotation|assert|async|await|bool|boolean|break|byte|case|catch|changed|char|class|closed|constant|continue|def|default|del|double|elif|else|enum|every|extends|false|finally|float|for|from|global|gpudef|gpukernel|if|import|in|init|inject|int|lambda|local|long|loop|match|new|nodefault|null|of|onchange|open|out|override|package|parfor|parforsync|post|pre|private|protected|provide|provider|public|return|shared|short|single|size_t|sizeof|super|sync|this|throw|trait|trans|transient|true|try|typedef|unchecked|using|val|var|void|while|with)\b/,
"boolean": /\b(?:false|true)\b/,
"number": /\b0b[01][01_]*L?\b|\b0x(?:[\da-f_]*\.)?[\da-f_p+-]+\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfls]?/i,
"punctuation": /[{}[\];(),.:]/,
"operator": /<==|>==|=>|->|<-|<>|&==|&<>|\?:?|\.\?|\+\+|--|[-+*/=<>]=?|[!^~]|\b(?:and|as|band|bor|bxor|comp|is|isnot|mod|or)\b=?/,
"annotation": {
pattern: /@(?:\w+:)?(?:\w+|\[[^\]]+\])?/,
alias: "builtin"
}
};
Prism.languages.insertBefore("concurnas", "langext", {
"regex-literal": {
pattern: /\br("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
greedy: true,
inside: {
"interpolation": {
pattern: /((?:^|[^\\])(?:\\{2})*)\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
lookbehind: true,
inside: Prism.languages.concurnas
},
"regex": /[\s\S]+/
}
},
"string-literal": {
pattern: /(?:\B|\bs)("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
greedy: true,
inside: {
"interpolation": {
pattern: /((?:^|[^\\])(?:\\{2})*)\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
lookbehind: true,
inside: Prism.languages.concurnas
},
"string": /[\s\S]+/
}
}
});
Prism.languages.conc = Prism.languages.concurnas;
(function(Prism2) {
function value(source) {
return RegExp(/([ \t])/.source + "(?:" + source + ")" + /(?=[\s;]|$)/.source, "i");
}
Prism2.languages.csp = {
"directive": {
pattern: /(^|[\s;])(?:base-uri|block-all-mixed-content|(?:child|connect|default|font|frame|img|manifest|media|object|prefetch|script|style|worker)-src|disown-opener|form-action|frame-(?:ancestors|options)|input-protection(?:-(?:clip|selectors))?|navigate-to|plugin-types|policy-uri|referrer|reflected-xss|report-(?:to|uri)|require-sri-for|sandbox|(?:script|style)-src-(?:attr|elem)|upgrade-insecure-requests)(?=[\s;]|$)/i,
lookbehind: true,
alias: "property"
},
"scheme": {
pattern: value(/[a-z][a-z0-9.+-]*:/.source),
lookbehind: true
},
"none": {
pattern: value(/'none'/.source),
lookbehind: true,
alias: "keyword"
},
"nonce": {
pattern: value(/'nonce-[-+/\w=]+'/.source),
lookbehind: true,
alias: "number"
},
"hash": {
pattern: value(/'sha(?:256|384|512)-[-+/\w=]+'/.source),
lookbehind: true,
alias: "number"
},
"host": {
pattern: value(
/[a-z][a-z0-9.+-]*:\/\/[^\s;,']*/.source + "|" + /\*[^\s;,']*/.source + "|" + /[a-z0-9-]+(?:\.[a-z0-9-]+)+(?::[\d*]+)?(?:\/[^\s;,']*)?/.source
),
lookbehind: true,
alias: "url",
inside: {
"important": /\*/
}
},
"keyword": [
{
pattern: value(/'unsafe-[a-z-]+'/.source),
lookbehind: true,
alias: "unsafe"
},
{
pattern: value(/'[a-z-]+'/.source),
lookbehind: true,
alias: "safe"
}
],
"punctuation": /;/
};
})(Prism);
(function(Prism2) {
var single_token_suffix = /(?:(?!\s)[\d$+<=a-zA-Z\x80-\uFFFF])+/.source;
var multi_token_infix = /[^{}@#]+/.source;
var multi_token_suffix = /\{[^}#@]*\}/.source;
var multi_token = multi_token_infix + multi_token_suffix;
var timer_units = /(?:h|hours|hrs|m|min|minutes)/.source;
var amount_group_impl = {
pattern: /\{[^{}]*\}/,
inside: {
"amount": {
pattern: /([\{|])[^{}|*%]+/,
lookbehind: true,
alias: "number"
},
"unit": {
pattern: /(%)[^}]+/,
lookbehind: true,
alias: "symbol"
},
"servings-scaler": {
pattern: /\*/,
alias: "operator"
},
"servings-alternative-separator": {
pattern: /\|/,
alias: "operator"
},
"unit-separator": {
pattern: /(?:%|(\*)%)/,
lookbehind: true,
alias: "operator"
},
"punctuation": /[{}]/
}
};
Prism2.languages.cooklang = {
"comment": {
// [- comment -]
// -- comment
pattern: /\[-[\s\S]*?-\]|--.*/,
greedy: true
},
"meta": {
// >> key: value
pattern: />>.*:.*/,
inside: {
"property": {
// key:
pattern: /(>>\s*)[^\s:](?:[^:]*[^\s:])?/,
lookbehind: true
}
}
},
"cookware-group": {
// #...{...}, #...
pattern: new RegExp(
"#(?:" + multi_token + "|" + single_token_suffix + ")"
),
inside: {
"cookware": {
pattern: new RegExp(
"(^#)(?:" + multi_token_infix + ")"
),
lookbehind: true,
alias: "variable"
},
"cookware-keyword": {
pattern: /^#/,
alias: "keyword"
},
"quantity-group": {
pattern: new RegExp(/\{[^{}@#]*\}/),
inside: {
"quantity": {
pattern: new RegExp(/(^\{)/.source + multi_token_infix),
lookbehind: true,
alias: "number"
},
"punctuation": /[{}]/
}
}
}
},
"ingredient-group": {
// @...{...}, @...
pattern: new RegExp("@(?:" + multi_token + "|" + single_token_suffix + ")"),
inside: {
"ingredient": {
pattern: new RegExp("(^@)(?:" + multi_token_infix + ")"),
lookbehind: true,
alias: "variable"
},
"ingredient-keyword": {
pattern: /^@/,
alias: "keyword"
},
"amount-group": amount_group_impl
}
},
"timer-group": {
// ~timer{...}
// eslint-disable-next-line regexp/sort-alternatives
pattern: /~(?!\s)[^@#~{}]*\{[^{}]*\}/,
inside: {
"timer": {
pattern: /(^~)[^{]+/,
lookbehind: true,
alias: "variable"
},
"duration-group": {
// {...}
pattern: /\{[^{}]*\}/,
inside: {
"punctuation": /[{}]/,
"unit": {
pattern: new RegExp(/(%\s*)/.source + timer_units + /\b/.source),
lookbehind: true,
alias: "symbol"
},
"operator": /%/,
"duration": {
pattern: /\d+/,
alias: "number"
}
}
},
"timer-keyword": {
pattern: /^~/,
alias: "keyword"
}
}
}
};
})(Prism);
(function(Prism2) {
var commentSource = /\(\*(?:[^(*]|\((?!\*)|\*(?!\))|<self>)*\*\)/.source;
for (var i = 0; i < 2; i++) {
commentSource = commentSource.replace(/<self>/g, function() {
return commentSource;
});
}
commentSource = commentSource.replace(/<self>/g, "[]");
Prism2.languages.coq = {
"comment": RegExp(commentSource),
"string": {
pattern: /"(?:[^"]|"")*"(?!")/,
greedy: true
},
"attribute": [
{
pattern: RegExp(
/#\[(?:[^\[\]("]|"(?:[^"]|"")*"(?!")|\((?!\*)|<comment>)*\]/.source.replace(/<comment>/g, function() {
return commentSource;
})
),
greedy: true,
alias: "attr-name",
inside: {
"comment": RegExp(commentSource),
"string": {
pattern: /"(?:[^"]|"")*"(?!")/,
greedy: true
},
"operator": /=/,
"punctuation": /^#\[|\]$|[,()]/
}
},
{
pattern: /\b(?:Cumulative|Global|Local|Monomorphic|NonCumulative|Polymorphic|Private|Program)\b/,
alias: "attr-name"
}
],
"keyword": /\b(?:Abort|About|Add|Admit|Admitted|All|Arguments|As|Assumptions|Axiom|Axioms|Back|BackTo|Backtrace|BinOp|BinOpSpec|BinRel|Bind|Blacklist|Canonical|Case|Cd|Check|Class|Classes|Close|CoFixpoint|CoInductive|Coercion|Coercions|Collection|Combined|Compute|Conjecture|Conjectures|Constant|Constants|Constraint|Constructors|Context|Corollary|Create|CstOp|Custom|Cut|Debug|Declare|Defined|Definition|Delimit|Dependencies|Dependent|Derive|Diffs|Drop|Elimination|End|Entry|Equality|Eval|Example|Existential|Existentials|Existing|Export|Extern|Extraction|Fact|Fail|Field|File|Firstorder|Fixpoint|Flags|Focus|From|Funclass|Function|Functional|GC|Generalizable|Goal|Grab|Grammar|Graph|Guarded|Haskell|Heap|Hide|Hint|HintDb|Hints|Hypotheses|Hypothesis|IF|Identity|Immediate|Implicit|Implicits|Import|Include|Induction|Inductive|Infix|Info|Initial|InjTyp|Inline|Inspect|Instance|Instances|Intro|Intros|Inversion|Inversion_clear|JSON|Language|Left|Lemma|Let|Lia|Libraries|Library|Load|LoadPath|Locate|Ltac|Ltac2|ML|Match|Method|Minimality|Module|Modules|Morphism|Next|NoInline|Notation|Number|OCaml|Obligation|Obligations|Opaque|Open|Optimize|Parameter|Parameters|Parametric|Path|Paths|Prenex|Preterm|Primitive|Print|Profile|Projections|Proof|Prop|PropBinOp|PropOp|PropUOp|Property|Proposition|Pwd|Qed|Quit|Rec|Record|Recursive|Redirect|Reduction|Register|Relation|Remark|Remove|Require|Reserved|Reset|Resolve|Restart|Rewrite|Right|Ring|Rings|SProp|Saturate|Save|Scheme|Scope|Scopes|Search|SearchHead|SearchPattern|SearchRewrite|Section|Separate|Set|Setoid|Show|Signatures|Solve|Solver|Sort|Sortclass|Sorted|Spec|Step|Strategies|Strategy|String|Structure|SubClass|Subgraph|SuchThat|Tactic|Term|TestCompile|Theorem|Time|Timeout|To|Transparent|Type|Typeclasses|Types|Typing|UnOp|UnOpSpec|Undelimit|Undo|Unfocus|Unfocused|Unfold|Universe|Universes|Unshelve|Variable|Variables|Variant|Verbose|View|Visibility|Zify|_|apply|as|at|by|cofix|else|end|exists|exists2|fix|for|forall|fun|if|in|let|match|measure|move|removed|return|struct|then|using|wf|where|with)\b/,
"number": /\b(?:0x[a-f0-9][a-f0-9_]*(?:\.[a-f0-9_]+)?(?:p[+-]?\d[\d_]*)?|\d[\d_]*(?:\.[\d_]+)?(?:e[+-]?\d[\d_]*)?)\b/i,
"punct": {
pattern: /@\{|\{\||\[=|:>/,
alias: "punctuation"
},
"operator": /\/\\|\\\/|\.{2,3}|:{1,2}=|\*\*|[-=]>|<(?:->?|[+:=>]|<:)|>(?:=|->)|\|[-|]?|[-!%&*+/<=>?@^~']/,
"punctuation": /\.\(|`\(|@\{|`\{|\{\||\[=|:>|[:.,;(){}\[\]]/
};
})(Prism);
(function(Prism2) {
Prism2.languages.ruby = Prism2.languages.extend("clike", {
"comment": {
pattern: /#.*|^=begin\s[\s\S]*?^=end/m,
greedy: true
},
"class-name": {
pattern: /(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,
lookbehind: true,
inside: {
"punctuation": /[.\\]/
}
},
"keyword": /\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,
"operator": /\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,
"punctuation": /[(){}[\].,;]/
});
Prism2.languages.insertBefore("ruby", "operator", {
"double-colon": {
pattern: /::/,
alias: "punctuation"
}
});
var interpolation = {
pattern: /((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,
lookbehind: true,
inside: {
"content": {
pattern: /^(#\{)[\s\S]+(?=\}$)/,
lookbehind: true,
inside: Prism2.languages.ruby
},
"delimiter": {
pattern: /^#\{|\}$/,
alias: "punctuation"
}
}
};
delete Prism2.languages.ruby.function;
var percentExpression = "(?:" + [
/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,
/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,
/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,
/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,
/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source
].join("|") + ")";
var symbolName = /(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;
Prism2.languages.insertBefore("ruby", "keyword", {
"regex-literal": [
{
pattern: RegExp(/%r/.source + percentExpression + /[egimnosux]{0,6}/.source),
greedy: true,
inside: {
"interpolation": interpolation,
"regex": /[\s\S]+/
}
},
{
pattern: /(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,
lookbehind: true,
greedy: true,
inside: {
"interpolation": interpolation,
"regex": /[\s\S]+/
}
}
],
"variable": /[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,
"symbol": [
{
pattern: RegExp(/(^|[^:]):/.source + symbolName),
lookbehind: true,
greedy: true
},
{
pattern: RegExp(/([\r\n{(,][ \t]*)/.source + symbolName + /(?=:(?!:))/.source),
lookbehind: true,
greedy: true
}
],
"method-definition": {
pattern: /(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,
lookbehind: true,
inside: {
"function": /\b\w+$/,
"keyword": /^self\b/,
"class-name": /^\w+/,
"punctuation": /\./
}
}
});
Prism2.languages.insertBefore("ruby", "string", {
"string-literal": [
{
pattern: RegExp(/%[qQiIwWs]?/.source + percentExpression),
greedy: true,
inside: {
"interpolation": interpolation,
"string": /[\s\S]+/
}
},
{
pattern: /("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,
greedy: true,
inside: {
"interpolation": interpolation,
"string": /[\s\S]+/
}
},
{
pattern: /<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,
alias: "heredoc-string",
greedy: true,
inside: {
"delimiter": {
pattern: /^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,
inside: {
"symbol": /\b\w+/,
"punctuation": /^<<[-~]?/
}
},
"interpolation": interpolation,
"string": /[\s\S]+/
}
},
{
pattern: /<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,
alias: "heredoc-string",
greedy: true,
inside: {
"delimiter": {
pattern: /^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,
inside: {
"symbol": /\b\w+/,
"punctuation": /^<<[-~]?'|'$/
}
},
"string": /[\s\S]+/
}
}
],
"command-literal": [
{
pattern: RegExp(/%x/.source + percentExpression),
greedy: true,
inside: {
"interpolation": interpolation,
"command": {
pattern: /[\s\S]+/,
alias: "string"
}
}
},
{
pattern: /`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,
greedy: true,
inside: {
"interpolation": interpolation,
"command": {
pattern: /[\s\S]+/,
alias: "string"
}
}
}
]
});
delete Prism2.languages.ruby.string;
Prism2.languages.insertBefore("ruby", "number", {
"builtin": /\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,
"constant": /\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/
});
Prism2.languages.rb = Prism2.languages.ruby;
})(Prism);
(function(Prism2) {
Prism2.languages.crystal = Prism2.languages.extend("ruby", {
"keyword": [
/\b(?:__DIR__|__END_LINE__|__FILE__|__LINE__|abstract|alias|annotation|as|asm|begin|break|case|class|def|do|else|elsif|end|ensure|enum|extend|for|fun|if|ifdef|include|instance_sizeof|lib|macro|module|next|of|out|pointerof|private|protected|ptr|require|rescue|return|select|self|sizeof|struct|super|then|type|typeof|undef|uninitialized|union|unless|until|when|while|with|yield)\b/,
{
pattern: /(\.\s*)(?:is_a|responds_to)\?/,
lookbehind: true
}
],
"number": /\b(?:0b[01_]*[01]|0o[0-7_]*[0-7]|0x[\da-fA-F_]*[\da-fA-F]|(?:\d(?:[\d_]*\d)?)(?:\.[\d_]*\d)?(?:[eE][+-]?[\d_]*\d)?)(?:_(?:[uif](?:8|16|32|64))?)?\b/,
"operator": [
/->/,
Prism2.languages.ruby.operator
],
"punctuation": /[(){}[\].,;\\]/
});
Prism2.languages.insertBefore("crystal", "string-literal", {
"attribute": {
pattern: /@\[.*?\]/,
inside: {
"delimiter": {
pattern: /^@\[|\]$/,
alias: "punctuation"
},
"attribute": {
pattern: /^(\s*)\w+/,
lookbehind: true,
alias: "class-name"
},
"args": {
pattern: /\S(?:[\s\S]*\S)?/,
inside: Prism2.languages.crystal
}
}
},
"expansion": {
pattern: /\{(?:\{.*?\}|%.*?%)\}/,
inside: {
"content": {
pattern: /^(\{.)[\s\S]+(?=.\}$)/,
lookbehind: true,
inside: Prism2.languages.crystal
},
"delimiter": {
pattern: /^\{[\{%]|[\}%]\}$/,
alias: "operator"
}
}
},
"char": {
pattern: /'(?:[^\\\r\n]{1,2}|\\(?:.|u(?:[A-Fa-f0-9]{1,4}|\{[A-Fa-f0-9]{1,6}\})))'/,
greedy: true
}
});
})(Prism);
(function(Prism2) {
var string = /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;
var selectorInside;
Prism2.languages.css.selector = {
pattern: Prism2.languages.css.selector.pattern,
lookbehind: true,
inside: selectorInside = {
"pseudo-element": /:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,
"pseudo-class": /:[-\w]+/,
"class": /\.[-\w]+/,
"id": /#[-\w]+/,
"attribute": {
pattern: RegExp(`\\[(?:[^[\\]"']|` + string.source + ")*\\]"),
greedy: true,
inside: {
"punctuation": /^\[|\]$/,
"case-sensitivity": {
pattern: /(\s)[si]$/i,
lookbehind: true,
alias: "keyword"
},
"namespace": {
pattern: /^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,
lookbehind: true,
inside: {
"punctuation": /\|$/
}
},
"attr-name": {
pattern: /^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,
lookbehind: true
},
"attr-value": [
string,
{
pattern: /(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,
lookbehind: true
}
],
"operator": /[|~*^$]?=/
}
},
"n-th": [
{
pattern: /(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,
lookbehind: true,
inside: {
"number": /[\dn]+/,
"operator": /[+-]/
}
},
{
pattern: /(\(\s*)(?:even|odd)(?=\s*\))/i,
lookbehind: true
}
],
"combinator": />|\+|~|\|\|/,
// the `tag` token has been existed and removed.
// because we can't find a perfect tokenize to match it.
// if you want to add it, please read https://github.com/PrismJS/prism/pull/2373 first.
"punctuation": /[(),]/
}
};
Prism2.languages.css["atrule"].inside["selector-function-argument"].inside = selectorInside;
Prism2.languages.insertBefore("css", "property", {
"variable": {
pattern: /(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,
lookbehind: true
}
});
var unit = {
pattern: /(\b\d+)(?:%|[a-z]+(?![\w-]))/,
lookbehind: true
};
var number = {
pattern: /(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,
lookbehind: true
};
Prism2.languages.insertBefore("css", "function", {
"operator": {
pattern: /(\s)[+\-*\/](?=\s)/,
lookbehind: true
},
// CAREFUL!
// Previewers and Inline color use hexcode and color.
"hexcode": {
pattern: /\B#[\da-f]{3,8}\b/i,
alias: "color"
},
"color": [
{
pattern: /(^|[^\w-])(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|RebeccaPurple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)(?![\w-])/i,
lookbehind: true
},
{
pattern: /\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,
inside: {
"unit": unit,
"number": number,
"function": /[\w-]+(?=\()/,
"punctuation": /[(),]/
}
}
],
// it's important that there is no boundary assertion after the hex digits
"entity": /\\[\da-f]{1,8}/i,
"unit": unit,
"number": number
});
})(Prism);
Prism.languages.csv = {
"value": /[^\r\n,"]+|"(?:[^"]|"")*"(?!")/,
"punctuation": /,/
};
(function(Prism2) {
var stringEscape = /\\(?:(?!\2)|\2(?:[^()\r\n]|\([^()]*\)))/.source;
var stringTypes = /"""(?:[^\\"]|"(?!""\2)|<esc>)*"""/.source + // eslint-disable-next-line regexp/strict
"|" + /'''(?:[^\\']|'(?!''\2)|<esc>)*'''/.source + // eslint-disable-next-line regexp/strict
"|" + /"(?:[^\\\r\n"]|"(?!\2)|<esc>)*"/.source + // eslint-disable-next-line regexp/strict
"|" + /'(?:[^\\\r\n']|'(?!\2)|<esc>)*'/.source;
var stringLiteral = "(?:" + stringTypes.replace(/<esc>/g, stringEscape) + ")";
Prism2.languages.cue = {
"comment": {
pattern: /\/\/.*/,
greedy: true
},
"string-literal": {
// eslint-disable-next-line regexp/strict
pattern: RegExp(/(^|[^#"'\\])(#*)/.source + stringLiteral + /(?!["'])\2/.source),
lookbehind: true,
greedy: true,
inside: {
// I'm using dirty hack here. We have to know the number hashes at the start of the string somehow,
// but we can't look back. So instead, we will use a lookahead, go to the end of the string, and
// capture the hashes at the end of the string.
"escape": {
pattern: /(?=[\s\S]*["'](#*)$)\\\1(?:U[a-fA-F0-9]{1,8}|u[a-fA-F0-9]{1,4}|x[a-fA-F0-9]{1,2}|\d{2,3}|[^(])/,
greedy: true,
alias: "string"
},
"interpolation": {
pattern: /(?=[\s\S]*["'](#*)$)\\\1\([^()]*\)/,
greedy: true,
inside: {
"punctuation": /^\\#*\(|\)$/,
"expression": {
pattern: /[\s\S]+/,
inside: null
}
}
},
"string": /[\s\S]+/
}
},
"keyword": {
pattern: /(^|[^\w$])(?:for|if|import|in|let|null|package)(?![\w$])/,
lookbehind: true
},
"boolean": {
pattern: /(^|[^\w$])(?:false|true)(?![\w$])/,
lookbehind: true
},
"builtin": {
pattern: /(^|[^\w$])(?:bool|bytes|float|float(?:32|64)|u?int(?:8|16|32|64|128)?|number|rune|string)(?![\w$])/,
lookbehind: true
},
"attribute": {
pattern: /@[\w$]+(?=\s*\()/,
alias: "function"
},
"function": {
pattern: /(^|[^\w$])[a-z_$][\w$]*(?=\s*\()/i,
lookbehind: true
},
"number": {
pattern: /(^|[^\w$.])(?:0b[01]+(?:_[01]+)*|0o[0-7]+(?:_[0-7]+)*|0[xX][0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*|(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[eE][+-]?\d+(?:_\d+)*)?(?:[KMGTP]i?)?)(?![\w$])/,
lookbehind: true
},
"operator": /\.{3}|_\|_|&&?|\|\|?|[=!]~|[<>=!]=?|[+\-*/?]/,
"punctuation": /[()[\]{},.:]/
};
Prism2.languages.cue["string-literal"].inside.interpolation.inside.expression.inside = Prism2.languages.cue;
})(Prism);
Prism.languages.cypher = {
// https://neo4j.com/docs/cypher-manual/current/syntax/comments/
"comment": /\/\/.*/,
"string": {
pattern: /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/,
greedy: true
},
"class-name": {
pattern: /(:\s*)(?:\w+|`(?:[^`\\\r\n])*`)(?=\s*[{):])/,
lookbehind: true,
greedy: true
},
"relationship": {
pattern: /(-\[\s*(?:\w+\s*|`(?:[^`\\\r\n])*`\s*)?:\s*|\|\s*:\s*)(?:\w+|`(?:[^`\\\r\n])*`)/,
lookbehind: true,
greedy: true,
alias: "property"
},
"identifier": {
pattern: /`(?:[^`\\\r\n])*`/,
greedy: true
},
"variable": /\$\w+/,
// https://neo4j.com/docs/cypher-manual/current/syntax/reserved/
"keyword": /\b(?:ADD|ALL|AND|AS|ASC|ASCENDING|ASSERT|BY|CALL|CASE|COMMIT|CONSTRAINT|CONTAINS|CREATE|CSV|DELETE|DESC|DESCENDING|DETACH|DISTINCT|DO|DROP|ELSE|END|ENDS|EXISTS|FOR|FOREACH|IN|INDEX|IS|JOIN|KEY|LIMIT|LOAD|MANDATORY|MATCH|MERGE|NODE|NOT|OF|ON|OPTIONAL|OR|ORDER(?=\s+BY)|PERIODIC|REMOVE|REQUIRE|RETURN|SCALAR|SCAN|SET|SKIP|START|STARTS|THEN|UNION|UNIQUE|UNWIND|USING|WHEN|WHERE|WITH|XOR|YIELD)\b/i,
"function": /\b\w+\b(?=\s*\()/,
"boolean": /\b(?:false|null|true)\b/i,
"number": /\b(?:0x[\da-fA-F]+|\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)\b/,
// https://neo4j.com/docs/cypher-manual/current/syntax/operators/
"operator": /:|<--?|--?>?|<>|=~?|[<>]=?|[+*/%^|]|\.\.\.?/,
"punctuation": /[()[\]{},;.]/
};
Prism.languages.d = Prism.languages.extend("clike", {
"comment": [
{
// Shebang
pattern: /^\s*#!.+/,
greedy: true
},
{
pattern: RegExp(/(^|[^\\])/.source + "(?:" + [
// /+ comment +/
// Allow one level of nesting
/\/\+(?:\/\+(?:[^+]|\+(?!\/))*\+\/|(?!\/\+)[\s\S])*?\+\//.source,
// // comment
/\/\/.*/.source,
// /* comment */
/\/\*[\s\S]*?\*\//.source
].join("|") + ")"),
lookbehind: true,
greedy: true
}
],
"string": [
{
pattern: RegExp([
// r"", x""
/\b[rx]"(?:\\[\s\S]|[^\\"])*"[cwd]?/.source,
// q"[]", q"()", q"<>", q"{}"
/\bq"(?:\[[\s\S]*?\]|\([\s\S]*?\)|<[\s\S]*?>|\{[\s\S]*?\})"/.source,
// q"IDENT
// ...
// IDENT"
/\bq"((?!\d)\w+)$[\s\S]*?^\1"/.source,
// q"//", q"||", etc.
// eslint-disable-next-line regexp/strict
/\bq"(.)[\s\S]*?\2"/.source,
// eslint-disable-next-line regexp/strict
/(["`])(?:\\[\s\S]|(?!\3)[^\\])*\3[cwd]?/.source
].join("|"), "m"),
greedy: true
},
{
pattern: /\bq\{(?:\{[^{}]*\}|[^{}])*\}/,
greedy: true,
alias: "token-string"
}
],
// In order: $, keywords and special tokens, globally defined symbols
"keyword": /\$|\b(?:__(?:(?:DATE|EOF|FILE|FUNCTION|LINE|MODULE|PRETTY_FUNCTION|TIMESTAMP|TIME|VENDOR|VERSION)__|gshared|parameters|traits|vector)|abstract|alias|align|asm|assert|auto|body|bool|break|byte|case|cast|catch|cdouble|cent|cfloat|char|class|const|continue|creal|dchar|debug|default|delegate|delete|deprecated|do|double|dstring|else|enum|export|extern|false|final|finally|float|for|foreach|foreach_reverse|function|goto|idouble|if|ifloat|immutable|import|inout|int|interface|invariant|ireal|lazy|long|macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|ptrdiff_t|public|pure|real|ref|return|scope|shared|short|size_t|static|string|struct|super|switch|synchronized|template|this|throw|true|try|typedef|typeid|typeof|ubyte|ucent|uint|ulong|union|unittest|ushort|version|void|volatile|wchar|while|with|wstring)\b/,
"number": [
// The lookbehind and the negative look-ahead try to prevent bad highlighting of the .. operator
// Hexadecimal numbers must be handled separately to avoid problems with exponent "e"
/\b0x\.?[a-f\d_]+(?:(?!\.\.)\.[a-f\d_]*)?(?:p[+-]?[a-f\d_]+)?[ulfi]{0,4}/i,
{
pattern: /((?:\.\.)?)(?:\b0b\.?|\b|\.)\d[\d_]*(?:(?!\.\.)\.[\d_]*)?(?:e[+-]?\d[\d_]*)?[ulfi]{0,4}/i,
lookbehind: true
}
],
"operator": /\|[|=]?|&[&=]?|\+[+=]?|-[-=]?|\.?\.\.|=[>=]?|!(?:i[ns]\b|<>?=?|>=?|=)?|\bi[ns]\b|(?:<[<>]?|>>?>?|\^\^|[*\/%^~])=?/
});
Prism.languages.insertBefore("d", "string", {
// Characters
// 'a', '\\', '\n', '\xFF', '\377', '\uFFFF', '\U0010FFFF', '\quot'
"char": /'(?:\\(?:\W|\w+)|[^\\])'/
});
Prism.languages.insertBefore("d", "keyword", {
"property": /\B@\w*/
});
Prism.languages.insertBefore("d", "function", {
"register": {
// Iasm registers
pattern: /\b(?:[ABCD][LHX]|E?(?:BP|DI|SI|SP)|[BS]PL|[ECSDGF]S|CR[0234]|[DS]IL|DR[012367]|E[ABCD]X|X?MM[0-7]|R(?:1[0-5]|[89])[BWD]?|R[ABCD]X|R[BS]P|R[DS]I|TR[3-7]|XMM(?:1[0-5]|[89])|YMM(?:1[0-5]|\d))\b|\bST(?:\([0-7]\)|\b)/,
alias: "variable"
}
});
(function(Prism2) {
var keywords = [
/\b(?:async|sync|yield)\*/,
/\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|covariant|default|deferred|do|dynamic|else|enum|export|extends|extension|external|factory|final|finally|for|get|hide|if|implements|import|in|interface|library|mixin|new|null|on|operator|part|rethrow|return|set|show|static|super|switch|sync|this|throw|try|typedef|var|void|while|with|yield)\b/
];
var packagePrefix = /(^|[^\w.])(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source;
var className = {
pattern: RegExp(packagePrefix + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),
lookbehind: true,
inside: {
"namespace": {
pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
inside: {
"punctuation": /\./
}
}
}
};
Prism2.languages.dart = Prism2.languages.extend("clike", {
"class-name": [
className,
{
// variables and parameters
// this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
pattern: RegExp(packagePrefix + /[A-Z]\w*(?=\s+\w+\s*[;,=()])/.source),
lookbehind: true,
inside: className.inside
}
],
"keyword": keywords,
"operator": /\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/
});
Prism2.languages.insertBefore("dart", "string", {
"string-literal": {
pattern: /r?(?:("""|''')[\s\S]*?\1|(["'])(?:\\.|(?!\2)[^\\\r\n])*\2(?!\2))/,
greedy: true,
inside: {
"interpolation": {
pattern: /((?:^|[^\\])(?:\\{2})*)\$(?:\w+|\{(?:[^{}]|\{[^{}]*\})*\})/,
lookbehind: true,
inside: {
"punctuation": /^\$\{?|\}$/,
"expression": {
pattern: /[\s\S]+/,
inside: Prism2.languages.dart
}
}
},
"string": /[\s\S]+/
}
},
"string": void 0
});
Prism2.languages.insertBefore("dart", "class-name", {
"metadata": {
pattern: /@\w+/,
alias: "function"
}
});
Prism2.languages.insertBefore("dart", "class-name", {
"generics": {
pattern: /<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<[\w\s,.&?]*>)*>)*>)*>/,
inside: {
"class-name": className,
"keyword": keywords,
"punctuation": /[<>(),.:]/,
"operator": /[?&|]/
}
}
});
})(Prism);
(function(Prism2) {
Prism2.languages.dataweave = {
"url": /\b[A-Za-z]+:\/\/[\w/:.?=&-]+|\burn:[\w:.?=&-]+/,
"property": {
pattern: /(?:\b\w+#)?(?:"(?:\\.|[^\\"\r\n])*"|\b\w+)(?=\s*[:@])/,
greedy: true
},
"string": {
pattern: /(["'`])(?:\\[\s\S]|(?!\1)[^\\])*\1/,
greedy: true
},
"mime-type": /\b(?:application|audio|image|multipart|text|video)\/[\w+-]+/,
"date": {
pattern: /\|[\w:+-]+\|/,
greedy: true
},
"comment": [
{
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
lookbehind: true,
greedy: true
},
{
pattern: /(^|[^\\:])\/\/.*/,
lookbehind: true,
greedy: true
}
],
"regex": {
pattern: /\/(?:[^\\\/\r\n]|\\[^\r\n])+\//,
greedy: true
},
"keyword": /\b(?:and|as|at|case|do|else|fun|if|input|is|match|not|ns|null|or|output|type|unless|update|using|var)\b/,
"function": /\b[A-Z_]\w*(?=\s*\()/i,
"number": /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
"punctuation": /[{}[\];(),.:@]/,
"operator": /<<|>>|->|[<>~=]=?|!=|--?-?|\+\+?|!|\?/,
"boolean": /\b(?:false|true)\b/
};
})(Prism);
Prism.languages.dax = {
"comment": {
pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/).*)/,
lookbehind: true
},
"data-field": {
pattern: /'(?:[^']|'')*'(?!')(?:\[[ \w\xA0-\uFFFF]+\])?|\w+\[[ \w\xA0-\uFFFF]+\]/,
alias: "symbol"
},
"measure": {
pattern: /\[[ \w\xA0-\uFFFF]+\]/,
alias: "constant"
},
"string": {
pattern: /"(?:[^"]|"")*"(?!")/,
greedy: true
},
"function": /\b(?:ABS|ACOS|ACOSH|ACOT|ACOTH|ADDCOLUMNS|ADDMISSINGITEMS|ALL|ALLCROSSFILTERED|ALLEXCEPT|ALLNOBLANKROW|ALLSELECTED|AND|APPROXIMATEDISTINCTCOUNT|ASIN|ASINH|ATAN|ATANH|AVERAGE|AVERAGEA|AVERAGEX|BETA\.DIST|BETA\.INV|BLANK|CALCULATE|CALCULATETABLE|CALENDAR|CALENDARAUTO|CEILING|CHISQ\.DIST|CHISQ\.DIST\.RT|CHISQ\.INV|CHISQ\.INV\.RT|CLOSINGBALANCEMONTH|CLOSINGBALANCEQUARTER|CLOSINGBALANCEYEAR|COALESCE|COMBIN|COMBINA|COMBINEVALUES|CONCATENATE|CONCATENATEX|CONFIDENCE\.NORM|CONFIDENCE\.T|CONTAINS|CONTAINSROW|CONTAINSSTRING|CONTAINSSTRINGEXACT|CONVERT|COS|COSH|COT|COTH|COUNT|COUNTA|COUNTAX|COUNTBLANK|COUNTROWS|COUNTX|CROSSFILTER|CROSSJOIN|CURRENCY|CURRENTGROUP|CUSTOMDATA|DATATABLE|DATE|DATEADD|DATEDIFF|DATESBETWEEN|DATESINPERIOD|DATESMTD|DATESQTD|DATESYTD|DATEVALUE|DAY|DEGREES|DETAILROWS|DISTINCT|DISTINCTCOUNT|DISTINCTCOUNTNOBLANK|DIVIDE|EARLIER|EARLIEST|EDATE|ENDOFMONTH|ENDOFQUARTER|ENDOFYEAR|EOMONTH|ERROR|EVEN|EXACT|EXCEPT|EXP|EXPON\.DIST|FACT|FALSE|FILTER|FILTERS|FIND|FIRSTDATE|FIRSTNONBLANK|FIRSTNONBLANKVALUE|FIXED|FLOOR|FORMAT|GCD|GENERATE|GENERATEALL|GENERATESERIES|GEOMEAN|GEOMEANX|GROUPBY|HASONEFILTER|HASONEVALUE|HOUR|IF|IF\.EAGER|IFERROR|IGNORE|INT|INTERSECT|ISBLANK|ISCROSSFILTERED|ISEMPTY|ISERROR|ISEVEN|ISFILTERED|ISINSCOPE|ISLOGICAL|ISNONTEXT|ISNUMBER|ISO\.CEILING|ISODD|ISONORAFTER|ISSELECTEDMEASURE|ISSUBTOTAL|ISTEXT|KEEPFILTERS|KEYWORDMATCH|LASTDATE|LASTNONBLANK|LASTNONBLANKVALUE|LCM|LEFT|LEN|LN|LOG|LOG10|LOOKUPVALUE|LOWER|MAX|MAXA|MAXX|MEDIAN|MEDIANX|MID|MIN|MINA|MINUTE|MINX|MOD|MONTH|MROUND|NATURALINNERJOIN|NATURALLEFTOUTERJOIN|NEXTDAY|NEXTMONTH|NEXTQUARTER|NEXTYEAR|NONVISUAL|NORM\.DIST|NORM\.INV|NORM\.S\.DIST|NORM\.S\.INV|NOT|NOW|ODD|OPENINGBALANCEMONTH|OPENINGBALANCEQUARTER|OPENINGBALANCEYEAR|OR|PARALLELPERIOD|PATH|PATHCONTAINS|PATHITEM|PATHITEMREVERSE|PATHLENGTH|PERCENTILE\.EXC|PERCENTILE\.INC|PERCENTILEX\.EXC|PERCENTILEX\.INC|PERMUT|PI|POISSON\.DIST|POWER|PREVIOUSDAY|PREVIOUSMONTH|PREVIOUSQUARTER|PREVIOUSYEAR|PRODUCT|PRODUCTX|QUARTER|QUOTIENT|RADIANS|RAND|RANDBETWEEN|RANK\.EQ|RANKX|RELATED|RELATEDTABLE|REMOVEFILTERS|REPLACE|REPT|RIGHT|ROLLUP|ROLLUPADDISSUBTOTAL|ROLLUPGROUP|ROLLUPISSUBTOTAL|ROUND|ROUNDDOWN|ROUNDUP|ROW|SAMEPERIODLASTYEAR|SAMPLE|SEARCH|SECOND|SELECTCOLUMNS|SELECTEDMEASURE|SELECTEDMEASUREFORMATSTRING|SELECTEDMEASURENAME|SELECTEDVALUE|SIGN|SIN|SINH|SQRT|SQRTPI|STARTOFMONTH|STARTOFQUARTER|STARTOFYEAR|STDEV\.P|STDEV\.S|STDEVX\.P|STDEVX\.S|SUBSTITUTE|SUBSTITUTEWITHINDEX|SUM|SUMMARIZE|SUMMARIZECOLUMNS|SUMX|SWITCH|T\.DIST|T\.DIST\.2T|T\.DIST\.RT|T\.INV|T\.INV\.2T|TAN|TANH|TIME|TIMEVALUE|TODAY|TOPN|TOPNPERLEVEL|TOPNSKIP|TOTALMTD|TOTALQTD|TOTALYTD|TREATAS|TRIM|TRUE|TRUNC|UNICHAR|UNICODE|UNION|UPPER|USERELATIONSHIP|USERNAME|USEROBJECTID|USERPRINCIPALNAME|UTCNOW|UTCTODAY|VALUE|VALUES|VAR\.P|VAR\.S|VARX\.P|VARX\.S|WEEKDAY|WEEKNUM|XIRR|XNPV|YEAR|YEARFRAC)(?=\s*\()/i,
"keyword": /\b(?:DEFINE|EVALUATE|MEASURE|ORDER\s+BY|RETURN|VAR|START\s+AT|ASC|DESC)\b/i,
"boolean": {
pattern: /\b(?:FALSE|NULL|TRUE)\b/i,
alias: "constant"
},
"number": /\b\d+(?:\.\d*)?|\B\.\d+\b/,
"operator": /:=|[-+*\/=^]|&&?|\|\||<(?:=>?|<|>)?|>[>=]?|\b(?:IN|NOT)\b/i,
"punctuation": /[;\[\](){}`,.]/
};
Prism.languages.dhall = {
// Multi-line comments can be nested. E.g. {- foo {- bar -} -}
// The multi-line pattern is essentially this:
// \{-(?:[^-{]|-(?!\})|\{(?!-)|<SELF>)*-\}
"comment": /--.*|\{-(?:[^-{]|-(?!\})|\{(?!-)|\{-(?:[^-{]|-(?!\})|\{(?!-))*-\})*-\}/,
"string": {
pattern: /"(?:[^"\\]|\\.)*"|''(?:[^']|'(?!')|'''|''\$\{)*''(?!'|\$)/,
greedy: true,
inside: {
"interpolation": {
pattern: /\$\{[^{}]*\}/,
inside: {
"expression": {
pattern: /(^\$\{)[\s\S]+(?=\}$)/,
lookbehind: true,
alias: "language-dhall",
inside: null
// see blow
},
"punctuation": /\$\{|\}/
}
}
}
},
"label": {
pattern: /`[^`]*`/,
greedy: true
},
"url": {
// https://github.com/dhall-lang/dhall-lang/blob/5fde8ef1bead6fb4e999d3c1ffe7044cd019d63a/standard/dhall.abnf#L596
pattern: /\bhttps?:\/\/[\w.:%!$&'*+;=@~-]+(?:\/[\w.:%!$&'*+;=@~-]*)*(?:\?[/?\w.:%!$&'*+;=@~-]*)?/,
greedy: true
},
"env": {
// https://github.com/dhall-lang/dhall-lang/blob/5fde8ef1bead6fb4e999d3c1ffe7044cd019d63a/standard/dhall.abnf#L661
pattern: /\benv:(?:(?!\d)\w+|"(?:[^"\\=]|\\.)*")/,
greedy: true,
inside: {
"function": /^env/,
"operator": /^:/,
"variable": /[\s\S]+/
}
},
"hash": {
// https://github.com/dhall-lang/dhall-lang/blob/5fde8ef1bead6fb4e999d3c1ffe7044cd019d63a/standard/dhall.abnf#L725
pattern: /\bsha256:[\da-fA-F]{64}\b/,
inside: {
"function": /sha256/,
"operator": /:/,
"number": /[\da-fA-F]{64}/
}
},
// https://github.com/dhall-lang/dhall-lang/blob/5fde8ef1bead6fb4e999d3c1ffe7044cd019d63a/standard/dhall.abnf#L359
"keyword": /\b(?:as|assert|else|forall|if|in|let|merge|missing|then|toMap|using|with)\b|\u2200/,
"builtin": /\b(?:None|Some)\b/,
"boolean": /\b(?:False|True)\b/,
"number": /\bNaN\b|-?\bInfinity\b|[+-]?\b(?:0x[\da-fA-F]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)\b/,
"operator": /\/\\|\/\/\\\\|&&|\|\||===|[!=]=|\/\/|->|\+\+|::|[+*#@=:?<>|\\\u2227\u2a53\u2261\u2afd\u03bb\u2192]/,
"punctuation": /\.\.|[{}\[\](),./]/,
// we'll just assume that every capital word left is a type name
"class-name": /\b[A-Z]\w*\b/
};
Prism.languages.dhall.string.inside.interpolation.inside.expression.inside = Prism.languages.dhall;
(function(Prism2) {
Prism2.languages.diff = {
"coord": [
// Match all kinds of coord lines (prefixed by "+++", "---" or "***").
/^(?:\*{3}|-{3}|\+{3}).*$/m,
// Match "@@ ... @@" coord lines in unified diff.
/^@@.*@@$/m,
// Match coord lines in normal diff (starts with a number).
/^\d.*$/m
]
// deleted, inserted, unchanged, diff
};
var PREFIXES = {
"deleted-sign": "-",
"deleted-arrow": "<",
"inserted-sign": "+",
"inserted-arrow": ">",
"unchanged": " ",
"diff": "!"
};
Object.keys(PREFIXES).forEach(function(name) {
var prefix = PREFIXES[name];
var alias = [];
if (!/^\w+$/.test(name)) {
alias.push(/\w+/.exec(name)[0]);
}
if (name === "diff") {
alias.push("bold");
}
Prism2.languages.diff[name] = {
pattern: RegExp("^(?:[" + prefix + "].*(?:\r\n?|\n|(?![\\s\\S])))+", "m"),
alias,
inside: {
"line": {
pattern: /(.)(?=[\s\S]).*(?:\r\n?|\n)?/,
lookbehind: true
},
"prefix": {
pattern: /[\s\S]/,
alias: /\w+/.exec(name)[0]
}
}
};
});
Object.defineProperty(Prism2.languages.diff, "PREFIXES", {
value: PREFIXES
});
})(Prism);
(function(Prism2) {
function getPlaceholder(language, index) {
return "___" + language.toUpperCase() + index + "___";
}
Object.defineProperties(Prism2.languages["markup-templating"] = {}, {
buildPlaceholders: {
/**
* Tokenize all inline templating expressions matching `placeholderPattern`.
*
* If `replaceFilter` is provided, only matches of `placeholderPattern` for which `replaceFilter` returns
* `true` will be replaced.
*
* @param {object} env The environment of the `before-tokenize` hook.
* @param {string} language The language id.
* @param {RegExp} placeholderPattern The matches of this pattern will be replaced by placeholders.
* @param {(match: string) => boolean} [replaceFilter]
*/
value: function(env, language, placeholderPattern, replaceFilter) {
if (env.language !== language) {
return;
}
var tokenStack = env.tokenStack = [];
env.code = env.code.replace(placeholderPattern, function(match) {
if (typeof replaceFilter === "function" && !replaceFilter(match)) {
return match;
}
var i = tokenStack.length;
var placeholder;
while (env.code.indexOf(placeholder = getPlaceholder(language, i)) !== -1) {
++i;
}
tokenStack[i] = match;
return placeholder;
});
env.grammar = Prism2.languages.markup;
}
},
tokenizePlaceholders: {
/**
* Replace placeholders with proper tokens after tokenizing.
*
* @param {object} env The environment of the `after-tokenize` hook.
* @param {string} language The language id.
*/
value: function(env, language) {
if (env.language !== language || !env.tokenStack) {
return;
}
env.grammar = Prism2.languages[language];
var j = 0;
var keys = Object.keys(env.tokenStack);
function walkTokens(tokens) {
for (var i = 0; i < tokens.length; i++) {
if (j >= keys.length) {
break;
}
var token = tokens[i];
if (typeof token === "string" || token.content && typeof token.content === "string") {
var k = keys[j];
var t = env.tokenStack[k];
var s = typeof token === "string" ? token : token.content;
var placeholder = getPlaceholder(language, k);
var index = s.indexOf(placeholder);
if (index > -1) {
++j;
var before = s.substring(0, index);
var middle = new Prism2.Token(language, Prism2.tokenize(t, env.grammar), "language-" + language, t);
var after = s.substring(index + placeholder.length);
var replacement = [];
if (before) {
replacement.push.apply(replacement, walkTokens([before]));
}
replacement.push(middle);
if (after) {
replacement.push.apply(replacement, walkTokens([after]));
}
if (typeof token === "string") {
tokens.splice.apply(tokens, [i, 1].concat(replacement));
} else {
token.content = replacement;
}
}
} else if (token.content) {
walkTokens(token.content);
}
}
return tokens;
}
walkTokens(env.tokens);
}
}
});
})(Prism);
(function(Prism2) {
Prism2.languages.django = {
"comment": /^\{#[\s\S]*?#\}$/,
"tag": {
pattern: /(^\{%[+-]?\s*)\w+/,
lookbehind: true,
alias: "keyword"
},
"delimiter": {
pattern: /^\{[{%][+-]?|[+-]?[}%]\}$/,
alias: "punctuation"
},
"string": {
pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
greedy: true
},
"filter": {
pattern: /(\|)\w+/,
lookbehind: true,
alias: "function"
},
"test": {
pattern: /(\bis\s+(?:not\s+)?)(?!not\b)\w+/,
lookbehind: true,
alias: "function"
},
"function": /\b[a-z_]\w+(?=\s*\()/i,
"keyword": /\b(?:and|as|by|else|for|if|import|in|is|loop|not|or|recursive|with|without)\b/,
"operator": /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
"number": /\b\d+(?:\.\d+)?\b/,
"boolean": /[Ff]alse|[Nn]one|[Tt]rue/,
"variable": /\b\w+\b/,
"punctuation": /[{}[\](),.:;]/
};
var pattern = /\{\{[\s\S]*?\}\}|\{%[\s\S]*?%\}|\{#[\s\S]*?#\}/g;
var markupTemplating = Prism2.languages["markup-templating"];
Prism2.hooks.add("before-tokenize", function(env) {
markupTemplating.buildPlaceholders(env, "django", pattern);
});
Prism2.hooks.add("after-tokenize", function(env) {
markupTemplating.tokenizePlaceholders(env, "django");
});
Prism2.languages.jinja2 = Prism2.languages.django;
Prism2.hooks.add("before-tokenize", function(env) {
markupTemplating.buildPlaceholders(env, "jinja2", pattern);
});
Prism2.hooks.add("after-tokenize", function(env) {
markupTemplating.tokenizePlaceholders(env, "jinja2");
});
})(Prism);
Prism.languages["dns-zone-file"] = {
"comment": /;.*/,
"string": {
pattern: /"(?:\\.|[^"\\\r\n])*"/,
greedy: true
},
"variable": [
{
pattern: /(^\$ORIGIN[ \t]+)\S+/m,
lookbehind: true
},
{
pattern: /(^|\s)@(?=\s|$)/,
lookbehind: true
}
],
"keyword": /^\$(?:INCLUDE|ORIGIN|TTL)(?=\s|$)/m,
"class": {
// https://tools.ietf.org/html/rfc1035#page-13
pattern: /(^|\s)(?:CH|CS|HS|IN)(?=\s|$)/,
lookbehind: true,
alias: "keyword"
},
"type": {
// https://en.wikipedia.org/wiki/List_of_DNS_record_types
pattern: /(^|\s)(?:A|A6|AAAA|AFSDB|APL|ATMA|CAA|CDNSKEY|CDS|CERT|CNAME|DHCID|DLV|DNAME|DNSKEY|DS|EID|GID|GPOS|HINFO|HIP|IPSECKEY|ISDN|KEY|KX|LOC|MAILA|MAILB|MB|MD|MF|MG|MINFO|MR|MX|NAPTR|NB|NBSTAT|NIMLOC|NINFO|NS|NSAP|NSAP-PTR|NSEC|NSEC3|NSEC3PARAM|NULL|NXT|OPENPGPKEY|PTR|PX|RKEY|RP|RRSIG|RT|SIG|SINK|SMIMEA|SOA|SPF|SRV|SSHFP|TA|TKEY|TLSA|TSIG|TXT|UID|UINFO|UNSPEC|URI|WKS|X25)(?=\s|$)/,
lookbehind: true,
alias: "keyword"
},
"punctuation": /[()]/
};
Prism.languages["dns-zone"] = Prism.languages["dns-zone-file"];
(function(Prism2) {
var spaceAfterBackSlash = /\\[\r\n](?:\s|\\[\r\n]|#.*(?!.))*(?![\s#]|\\[\r\n])/.source;
var space = /(?:[ \t]+(?![ \t])(?:<SP_BS>)?|<SP_BS>)/.source.replace(/<SP_BS>/g, function() {
return spaceAfterBackSlash;
});
var string = /"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"|'(?:[^'\\\r\n]|\\(?:\r\n|[\s\S]))*'/.source;
var option = /--[\w-]+=(?:<STR>|(?!["'])(?:[^\s\\]|\\.)+)/.source.replace(/<STR>/g, function() {
return string;
});
var stringRule = {
pattern: RegExp(string),
greedy: true
};
var commentRule = {
pattern: /(^[ \t]*)#.*/m,
lookbehind: true,
greedy: true
};
function re(source, flags) {
source = source.replace(/<OPT>/g, function() {
return option;
}).replace(/<SP>/g, function() {
return space;
});
return RegExp(source, flags);
}
Prism2.languages.docker = {
"instruction": {
pattern: /(^[ \t]*)(?:ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|ONBUILD|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)(?=\s)(?:\\.|[^\r\n\\])*(?:\\$(?:\s|#.*$)*(?![\s#])(?:\\.|[^\r\n\\])*)*/im,
lookbehind: true,
greedy: true,
inside: {
"options": {
pattern: re(/(^(?:ONBUILD<SP>)?\w+<SP>)<OPT>(?:<SP><OPT>)*/.source, "i"),
lookbehind: true,
greedy: true,
inside: {
"property": {
pattern: /(^|\s)--[\w-]+/,
lookbehind: true
},
"string": [
stringRule,
{
pattern: /(=)(?!["'])(?:[^\s\\]|\\.)+/,
lookbehind: true
}
],
"operator": /\\$/m,
"punctuation": /=/
}
},
"keyword": [
{
// https://docs.docker.com/engine/reference/builder/#healthcheck
pattern: re(/(^(?:ONBUILD<SP>)?HEALTHCHECK<SP>(?:<OPT><SP>)*)(?:CMD|NONE)\b/.source, "i"),
lookbehind: true,
greedy: true
},
{
// https://docs.docker.com/engine/reference/builder/#from
pattern: re(/(^(?:ONBUILD<SP>)?FROM<SP>(?:<OPT><SP>)*(?!--)[^ \t\\]+<SP>)AS/.source, "i"),
lookbehind: true,
greedy: true
},
{
// https://docs.docker.com/engine/reference/builder/#onbuild
pattern: re(/(^ONBUILD<SP>)\w+/.source, "i"),
lookbehind: true,
greedy: true
},
{
pattern: /^\w+/,
greedy: true
}
],
"comment": commentRule,
"string": stringRule,
"variable": /\$(?:\w+|\{[^{}"'\\]*\})/,
"operator": /\\$/m
}
},
"comment": commentRule
};
Prism2.languages.dockerfile = Prism2.languages.docker;
})(Prism);
(function(Prism2) {
var ID = "(?:" + [
// an identifier
/[a-zA-Z_\x80-\uFFFF][\w\x80-\uFFFF]*/.source,
// a number
/-?(?:\.\d+|\d+(?:\.\d*)?)/.source,
// a double-quoted string
/"[^"\\]*(?:\\[\s\S][^"\\]*)*"/.source,
// HTML-like string
/<(?:[^<>]|(?!<!--)<(?:[^<>"']|"[^"]*"|'[^']*')+>|<!--(?:[^-]|-(?!->))*-->)*>/.source
].join("|") + ")";
var IDInside = {
"markup": {
pattern: /(^<)[\s\S]+(?=>$)/,
lookbehind: true,
alias: ["language-markup", "language-html", "language-xml"],
inside: Prism2.languages.markup
}
};
function withID(source, flags) {
return RegExp(source.replace(/<ID>/g, function() {
return ID;
}), flags);
}
Prism2.languages.dot = {
"comment": {
pattern: /\/\/.*|\/\*[\s\S]*?\*\/|^#.*/m,
greedy: true
},
"graph-name": {
pattern: withID(/(\b(?:digraph|graph|subgraph)[ \t\r\n]+)<ID>/.source, "i"),
lookbehind: true,
greedy: true,
alias: "class-name",
inside: IDInside
},
"attr-value": {
pattern: withID(/(=[ \t\r\n]*)<ID>/.source),
lookbehind: true,
greedy: true,
inside: IDInside
},
"attr-name": {
pattern: withID(/([\[;, \t\r\n])<ID>(?=[ \t\r\n]*=)/.source),
lookbehind: true,
greedy: true,
inside: IDInside
},
"keyword": /\b(?:digraph|edge|graph|node|strict|subgraph)\b/i,
"compass-point": {
pattern: /(:[ \t\r\n]*)(?:[ewc_]|[ns][ew]?)(?![\w\x80-\uFFFF])/,
lookbehind: true,
alias: "builtin"
},
"node": {
pattern: withID(/(^|[^-.\w\x80-\uFFFF\\])<ID>/.source),
lookbehind: true,
greedy: true,
inside: IDInside
},
"operator": /[=:]|-[->]/,
"punctuation": /[\[\]{};,]/
};
Prism2.languages.gv = Prism2.languages.dot;
})(Prism);
Prism.languages.ebnf = {
"comment": /\(\*[\s\S]*?\*\)/,
"string": {
pattern: /"[^"\r\n]*"|'[^'\r\n]*'/,
greedy: true
},
"special": {
pattern: /\?[^?\r\n]*\?/,
greedy: true,
alias: "class-name"
},
"definition": {
pattern: /^([\t ]*)[a-z]\w*(?:[ \t]+[a-z]\w*)*(?=\s*=)/im,
lookbehind: true,
alias: ["rule", "keyword"]
},
"rule": /\b[a-z]\w*(?:[ \t]+[a-z]\w*)*\b/i,
"punctuation": /\([:/]|[:/]\)|[.,;()[\]{}]/,
"operator": /[-=|*/!]/
};
Prism.languages.editorconfig = {
// https://editorconfig-specification.readthedocs.io
"comment": /[;#].*/,
"section": {
pattern: /(^[ \t]*)\[.+\]/m,
lookbehind: true,
alias: "selector",
inside: {
"regex": /\\\\[\[\]{},!?.*]/,
// Escape special characters with '\\'
"operator": /[!?]|\.\.|\*{1,2}/,
"punctuation": /[\[\]{},]/
}
},
"key": {
pattern: /(^[ \t]*)[^\s=]+(?=[ \t]*=)/m,
lookbehind: true,
alias: "attr-name"
},
"value": {
pattern: /=.*/,
alias: "attr-value",
inside: {
"punctuation": /^=/
}
}
};
Prism.languages.eiffel = {
"comment": /--.*/,
"string": [
// Aligned-verbatim-strings
{
pattern: /"([^[]*)\[[\s\S]*?\]\1"/,
greedy: true
},
// Non-aligned-verbatim-strings
{
pattern: /"([^{]*)\{[\s\S]*?\}\1"/,
greedy: true
},
// Single-line string
{
pattern: /"(?:%(?:(?!\n)\s)*\n\s*%|%\S|[^%"\r\n])*"/,
greedy: true
}
],
// normal char | special char | char code
"char": /'(?:%.|[^%'\r\n])+'/,
"keyword": /\b(?:across|agent|alias|all|and|as|assign|attached|attribute|check|class|convert|create|Current|debug|deferred|detachable|do|else|elseif|end|ensure|expanded|export|external|feature|from|frozen|if|implies|inherit|inspect|invariant|like|local|loop|not|note|obsolete|old|once|or|Precursor|redefine|rename|require|rescue|Result|retry|select|separate|some|then|undefine|until|variant|Void|when|xor)\b/i,
"boolean": /\b(?:False|True)\b/i,
// Convention: class-names are always all upper-case characters
"class-name": /\b[A-Z][\dA-Z_]*\b/,
"number": [
// hexa | octal | bin
/\b0[xcb][\da-f](?:_*[\da-f])*\b/i,
// Decimal
/(?:\b\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?e[+-]?)?\d(?:_*\d)*\b|\b\d(?:_*\d)*\b\.?/i
],
"punctuation": /:=|<<|>>|\(\||\|\)|->|\.(?=\w)|[{}[\];(),:?]/,
"operator": /\\\\|\|\.\.\||\.\.|\/[~\/=]?|[><]=?|[-+*^=~]/
};
(function(Prism2) {
Prism2.languages.ejs = {
"delimiter": {
pattern: /^<%[-_=]?|[-_]?%>$/,
alias: "punctuation"
},
"comment": /^#[\s\S]*/,
"language-javascript": {
pattern: /[\s\S]+/,
inside: Prism2.languages.javascript
}
};
Prism2.hooks.add("before-tokenize", function(env) {
var ejsPattern = /<%(?!%)[\s\S]+?%>/g;
Prism2.languages["markup-templating"].buildPlaceholders(env, "ejs", ejsPattern);
});
Prism2.hooks.add("after-tokenize", function(env) {
Prism2.languages["markup-templating"].tokenizePlaceholders(env, "ejs");
});
Prism2.languages.eta = Prism2.languages.ejs;
})(Prism);
Prism.languages.elixir = {
"doc": {
pattern: /@(?:doc|moduledoc)\s+(?:("""|''')[\s\S]*?\1|("|')(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2)/,
inside: {
"attribute": /^@\w+/,
"string": /['"][\s\S]+/
}
},
"comment": {
pattern: /#.*/,
greedy: true
},
// ~r"""foo""" (multi-line), ~r'''foo''' (multi-line), ~r/foo/, ~r|foo|, ~r"foo", ~r'foo', ~r(foo), ~r[foo], ~r{foo}, ~r<foo>
"regex": {
pattern: /~[rR](?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|([\/|"'])(?:\\.|(?!\2)[^\\\r\n])+\2|\((?:\\.|[^\\)\r\n])+\)|\[(?:\\.|[^\\\]\r\n])+\]|\{(?:\\.|[^\\}\r\n])+\}|<(?:\\.|[^\\>\r\n])+>)[uismxfr]*/,
greedy: true
},
"string": [
{
// ~s"""foo""" (multi-line), ~s'''foo''' (multi-line), ~s/foo/, ~s|foo|, ~s"foo", ~s'foo', ~s(foo), ~s[foo], ~s{foo} (with interpolation care), ~s<foo>
pattern: /~[cCsSwW](?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|([\/|"'])(?:\\.|(?!\2)[^\\\r\n])+\2|\((?:\\.|[^\\)\r\n])+\)|\[(?:\\.|[^\\\]\r\n])+\]|\{(?:\\.|#\{[^}]+\}|#(?!\{)|[^#\\}\r\n])+\}|<(?:\\.|[^\\>\r\n])+>)[csa]?/,
greedy: true,
inside: {
// See interpolation below
}
},
{
pattern: /("""|''')[\s\S]*?\1/,
greedy: true,
inside: {
// See interpolation below
}
},
{
// Multi-line strings are allowed
pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
greedy: true,
inside: {
// See interpolation below
}
}
],
"atom": {
// Look-behind prevents bad highlighting of the :: operator
pattern: /(^|[^:]):\w+/,
lookbehind: true,
alias: "symbol"
},
"module": {
pattern: /\b[A-Z]\w*\b/,
alias: "class-name"
},
// Look-ahead prevents bad highlighting of the :: operator
"attr-name": /\b\w+\??:(?!:)/,
"argument": {
// Look-behind prevents bad highlighting of the && operator
pattern: /(^|[^&])&\d+/,
lookbehind: true,
alias: "variable"
},
"attribute": {
pattern: /@\w+/,
alias: "variable"
},
"function": /\b[_a-zA-Z]\w*[?!]?(?:(?=\s*(?:\.\s*)?\()|(?=\/\d))/,
"number": /\b(?:0[box][a-f\d_]+|\d[\d_]*)(?:\.[\d_]+)?(?:e[+-]?[\d_]+)?\b/i,
"keyword": /\b(?:after|alias|and|case|catch|cond|def(?:callback|delegate|exception|impl|macro|module|n|np|p|protocol|struct)?|do|else|end|fn|for|if|import|not|or|quote|raise|require|rescue|try|unless|unquote|use|when)\b/,
"boolean": /\b(?:false|nil|true)\b/,
"operator": [
/\bin\b|&&?|\|[|>]?|\\\\|::|\.\.\.?|\+\+?|-[->]?|<[-=>]|>=|!==?|\B!|=(?:==?|[>~])?|[*\/^]/,
{
// We don't want to match <<
pattern: /([^<])<(?!<)/,
lookbehind: true
},
{
// We don't want to match >>
pattern: /([^>])>(?!>)/,
lookbehind: true
}
],
"punctuation": /<<|>>|[.,%\[\]{}()]/
};
Prism.languages.elixir.string.forEach(function(o) {
o.inside = {
"interpolation": {
pattern: /#\{[^}]+\}/,
inside: {
"delimiter": {
pattern: /^#\{|\}$/,
alias: "punctuation"
},
rest: Prism.languages.elixir
}
}
};
});
Prism.languages.elm = {
"comment": /--.*|\{-[\s\S]*?-\}/,
"char": {
pattern: /'(?:[^\\'\r\n]|\\(?:[abfnrtv\\']|\d+|x[0-9a-fA-F]+|u\{[0-9a-fA-F]+\}))'/,
greedy: true
},
"string": [
{
// Multiline strings are wrapped in triple ". Quotes may appear unescaped.
pattern: /"""[\s\S]*?"""/,
greedy: true
},
{
pattern: /"(?:[^\\"\r\n]|\\.)*"/,
greedy: true
}
],
"import-statement": {
// The imported or hidden names are not included in this import
// statement. This is because we want to highlight those exactly like
// we do for the names in the program.
pattern: /(^[\t ]*)import\s+[A-Z]\w*(?:\.[A-Z]\w*)*(?:\s+as\s+(?:[A-Z]\w*)(?:\.[A-Z]\w*)*)?(?:\s+exposing\s+)?/m,
lookbehind: true,
inside: {
"keyword": /\b(?:as|exposing|import)\b/
}
},
"keyword": /\b(?:alias|as|case|else|exposing|if|in|infixl|infixr|let|module|of|then|type)\b/,
// These are builtin variables only. Constructors are highlighted later as a constant.
"builtin": /\b(?:abs|acos|always|asin|atan|atan2|ceiling|clamp|compare|cos|curry|degrees|e|flip|floor|fromPolar|identity|isInfinite|isNaN|logBase|max|min|negate|never|not|pi|radians|rem|round|sin|sqrt|tan|toFloat|toPolar|toString|truncate|turns|uncurry|xor)\b/,
// decimal integers and floating point numbers | hexadecimal integers
"number": /\b(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?|0x[0-9a-f]+)\b/i,
// Most of this is needed because of the meaning of a single '.'.
// If it stands alone freely, it is the function composition.
// It may also be a separator between a module name and an identifier => no
// operator. If it comes together with other special characters it is an
// operator too.
// Valid operator characters in 0.18: +-/*=.$<>:&|^?%#@~!
// Ref: https://groups.google.com/forum/#!msg/elm-dev/0AHSnDdkSkQ/E0SVU70JEQAJ
"operator": /\s\.\s|[+\-/*=.$<>:&|^?%#@~!]{2,}|[+\-/*=$<>:&|^?%#@~!]/,
// In Elm, nearly everything is a variable, do not highlight these.
"hvariable": /\b(?:[A-Z]\w*\.)*[a-z]\w*\b/,
"constant": /\b(?:[A-Z]\w*\.)*[A-Z]\w*\b/,
"punctuation": /[{}[\]|(),.:]/
};
Prism.languages.lua = {
"comment": /^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,
// \z may be used to skip the following space
"string": {
pattern: /(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[^z]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,
greedy: true
},
"number": /\b0x[a-f\d]+(?:\.[a-f\d]*)?(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|(?:\.\d*)?(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,
"keyword": /\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,
"function": /(?!\d)\w+(?=\s*(?:[({]))/,
"operator": [
/[-+*%^&|#]|\/\/?|<[<=]?|>[>=]?|[=~]=?/,
{
// Match ".." but don't break "..."
pattern: /(^|[^.])\.\.(?!\.)/,
lookbehind: true
}
],
"punctuation": /[\[\](){},;]|\.+|:+/
};
(function(Prism2) {
Prism2.languages.etlua = {
"delimiter": {
pattern: /^<%[-=]?|-?%>$/,
alias: "punctuation"
},
"language-lua": {
pattern: /[\s\S]+/,
inside: Prism2.languages.lua
}
};
Prism2.hooks.add("before-tokenize", function(env) {
var pattern = /<%[\s\S]+?%>/g;
Prism2.languages["markup-templating"].buildPlaceholders(env, "etlua", pattern);
});
Prism2.hooks.add("after-tokenize", function(env) {
Prism2.languages["markup-templating"].tokenizePlaceholders(env, "etlua");
});
})(Prism);
(function(Prism2) {
Prism2.languages.erb = {
"delimiter": {
pattern: /^(\s*)<%=?|%>(?=\s*$)/,
lookbehind: true,
alias: "punctuation"
},
"ruby": {
pattern: /\s*\S[\s\S]*/,
alias: "language-ruby",
inside: Prism2.languages.ruby
}
};
Prism2.hooks.add("before-tokenize", function(env) {
var erbPattern = /<%=?(?:[^\r\n]|[\r\n](?!=begin)|[\r\n]=begin\s(?:[^\r\n]|[\r\n](?!=end))*[\r\n]=end)+?%>/g;
Prism2.languages["markup-templating"].buildPlaceholders(env, "erb", erbPattern);
});
Prism2.hooks.add("after-tokenize", function(env) {
Prism2.languages["markup-templating"].tokenizePlaceholders(env, "erb");
});
})(Prism);
Prism.languages.erlang = {
"comment": /%.+/,
"string": {
pattern: /"(?:\\.|[^\\"\r\n])*"/,
greedy: true
},
"quoted-function": {
pattern: /'(?:\\.|[^\\'\r\n])+'(?=\()/,
alias: "function"
},
"quoted-atom": {
pattern: /'(?:\\.|[^\\'\r\n])+'/,
alias: "atom"
},
"boolean": /\b(?:false|true)\b/,
"keyword": /\b(?:after|begin|case|catch|end|fun|if|of|receive|try|when)\b/,
"number": [
/\$\\?./,
/\b\d+#[a-z0-9]+/i,
/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i
],
"function": /\b[a-z][\w@]*(?=\()/,
"variable": {
// Look-behind is used to prevent wrong highlighting of atoms containing "@"
pattern: /(^|[^@])(?:\b|\?)[A-Z_][\w@]*/,
lookbehind: true
},
"operator": [
/[=\/<>:]=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:and|andalso|band|bnot|bor|bsl|bsr|bxor|div|not|or|orelse|rem|xor)\b/,
{
// We don't want to match <<
pattern: /(^|[^<])<(?!<)/,
lookbehind: true
},
{
// We don't want to match >>
pattern: /(^|[^>])>(?!>)/,
lookbehind: true
}
],
"atom": /\b[a-z][\w@]*/,
"punctuation": /[()[\]{}:;,.#|]|<<|>>/
};
Prism.languages["excel-formula"] = {
"comment": {
pattern: /(\bN\(\s*)"(?:[^"]|"")*"(?=\s*\))/i,
lookbehind: true,
greedy: true
},
"string": {
pattern: /"(?:[^"]|"")*"(?!")/,
greedy: true
},
"reference": {
// https://www.ablebits.com/office-addins-blog/2015/12/08/excel-reference-another-sheet-workbook/
// Sales!B2
// 'Winter sales'!B2
// [Sales.xlsx]Jan!B2:B5
// D:\Reports\[Sales.xlsx]Jan!B2:B5
// '[Sales.xlsx]Jan sales'!B2:B5
// 'D:\Reports\[Sales.xlsx]Jan sales'!B2:B5
pattern: /(?:'[^']*'|(?:[^\s()[\]{}<>*?"';,$&]*\[[^^\s()[\]{}<>*?"']+\])?\w+)!/,
greedy: true,
alias: "string",
inside: {
"operator": /!$/,
"punctuation": /'/,
"sheet": {
pattern: /[^[\]]+$/,
alias: "function"
},
"file": {
pattern: /\[[^[\]]+\]$/,
inside: {
"punctuation": /[[\]]/
}
},
"path": /[\s\S]+/
}
},
"function-name": {
pattern: /\b[A-Z]\w*(?=\()/i,
alias: "builtin"
},
"range": {
pattern: /\$?\b(?:[A-Z]+\$?\d+:\$?[A-Z]+\$?\d+|[A-Z]+:\$?[A-Z]+|\d+:\$?\d+)\b/i,
alias: "selector",
inside: {
"operator": /:/,
"cell": /\$?[A-Z]+\$?\d+/i,
"column": /\$?[A-Z]+/i,
"row": /\$?\d+/
}
},
"cell": {
// Excel is case insensitive, so the string "foo1" could be either a variable or a cell.
// To combat this, we match cells case insensitive, if the contain at least one "$", and case sensitive otherwise.
pattern: /\b[A-Z]+\d+\b|\$[A-Za-z]+\$?\d+\b|\b[A-Za-z]+\$\d+\b/,
alias: "selector"
},
"number": /(?:\b\d+(?:\.\d+)?|\B\.\d+)(?:e[+-]?\d+)?\b/i,
"boolean": /\b(?:FALSE|TRUE)\b/i,
"operator": /[-+*/^%=&,]|<[=>]?|>=?/,
"punctuation": /[[\]();{}|]/
};
Prism.languages["xlsx"] = Prism.languages["xls"] = Prism.languages["excel-formula"];
Prism.languages.fsharp = Prism.languages.extend("clike", {
"comment": [
{
pattern: /(^|[^\\])\(\*(?!\))[\s\S]*?\*\)/,
lookbehind: true,
greedy: true
},
{
pattern: /(^|[^\\:])\/\/.*/,
lookbehind: true,
greedy: true
}
],
"string": {
pattern: /(?:"""[\s\S]*?"""|@"(?:""|[^"])*"|"(?:\\[\s\S]|[^\\"])*")B?/,
greedy: true
},
"class-name": {
pattern: /(\b(?:exception|inherit|interface|new|of|type)\s+|\w\s*:\s*|\s:\??>\s*)[.\w]+\b(?:\s*(?:->|\*)\s*[.\w]+\b)*(?!\s*[:.])/,
lookbehind: true,
inside: {
"operator": /->|\*/,
"punctuation": /\./
}
},
"keyword": /\b(?:let|return|use|yield)(?:!\B|\b)|\b(?:abstract|and|as|asr|assert|atomic|base|begin|break|checked|class|component|const|constraint|constructor|continue|default|delegate|do|done|downcast|downto|eager|elif|else|end|event|exception|extern|external|false|finally|fixed|for|fun|function|functor|global|if|in|include|inherit|inline|interface|internal|land|lazy|lor|lsl|lsr|lxor|match|member|method|mixin|mod|module|mutable|namespace|new|not|null|object|of|open|or|override|parallel|private|process|protected|public|pure|rec|sealed|select|sig|static|struct|tailcall|then|to|trait|true|try|type|upcast|val|virtual|void|volatile|when|while|with)\b/,
"number": [
/\b0x[\da-fA-F]+(?:LF|lf|un)?\b/,
/\b0b[01]+(?:uy|y)?\b/,
/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[fm]|e[+-]?\d+)?\b/i,
/\b\d+(?:[IlLsy]|UL|u[lsy]?)?\b/
],
"operator": /([<>~&^])\1\1|([*.:<>&])\2|<-|->|[!=:]=|<?\|{1,3}>?|\??(?:<=|>=|<>|[-+*/%=<>])\??|[!?^&]|~[+~-]|:>|:\?>?/
});
Prism.languages.insertBefore("fsharp", "keyword", {
"preprocessor": {
pattern: /(^[\t ]*)#.*/m,
lookbehind: true,
alias: "property",
inside: {
"directive": {
pattern: /(^#)\b(?:else|endif|if|light|line|nowarn)\b/,
lookbehind: true,
alias: "keyword"
}
}
}
});
Prism.languages.insertBefore("fsharp", "punctuation", {
"computation-expression": {
pattern: /\b[_a-z]\w*(?=\s*\{)/i,
alias: "keyword"
}
});
Prism.languages.insertBefore("fsharp", "string", {
"annotation": {
pattern: /\[<.+?>\]/,
greedy: true,
inside: {
"punctuation": /^\[<|>\]$/,
"class-name": {
pattern: /^\w+$|(^|;\s*)[A-Z]\w*(?=\()/,
lookbehind: true
},
"annotation-content": {
pattern: /[\s\S]+/,
inside: Prism.languages.fsharp
}
}
},
"char": {
pattern: /'(?:[^\\']|\\(?:.|\d{3}|x[a-fA-F\d]{2}|u[a-fA-F\d]{4}|U[a-fA-F\d]{8}))'B?/,
greedy: true
}
});
(function(Prism2) {
var comment_inside = {
"function": /\b(?:BUGS?|FIX(?:MES?)?|NOTES?|TODOS?|XX+|HACKS?|WARN(?:ING)?|\?{2,}|!{2,})\b/
};
var string_inside = {
"number": /\\[^\s']|%\w/
};
var factor = {
"comment": [
{
// ! single-line exclamation point comments with whitespace after/around the !
pattern: /(^|\s)(?:! .*|!$)/,
lookbehind: true,
inside: comment_inside
},
/* from basis/multiline: */
{
// /* comment */, /* comment*/
pattern: /(^|\s)\/\*\s[\s\S]*?\*\/(?=\s|$)/,
lookbehind: true,
greedy: true,
inside: comment_inside
},
{
// ![[ comment ]] , ![===[ comment]===]
pattern: /(^|\s)!\[(={0,6})\[\s[\s\S]*?\]\2\](?=\s|$)/,
lookbehind: true,
greedy: true,
inside: comment_inside
}
],
"number": [
{
// basic base 10 integers 9, -9
pattern: /(^|\s)[+-]?\d+(?=\s|$)/,
lookbehind: true
},
{
// base prefix integers 0b010 0o70 0xad 0d10 0XAD -0xa9
pattern: /(^|\s)[+-]?0(?:b[01]+|o[0-7]+|d\d+|x[\dA-F]+)(?=\s|$)/i,
lookbehind: true
},
{
// fractional ratios 1/5 -1/5 and the literal float approximations 1/5. -1/5.
pattern: /(^|\s)[+-]?\d+\/\d+\.?(?=\s|$)/,
lookbehind: true
},
{
// positive mixed numbers 23+1/5 +23+1/5
pattern: /(^|\s)\+?\d+\+\d+\/\d+(?=\s|$)/,
lookbehind: true
},
{
// negative mixed numbers -23-1/5
pattern: /(^|\s)-\d+-\d+\/\d+(?=\s|$)/,
lookbehind: true
},
{
// basic decimal floats -0.01 0. .0 .1 -.1 -1. -12.13 +12.13
// and scientific notation with base 10 exponents 3e4 3e-4 .3e-4
pattern: /(^|\s)[+-]?(?:\d*\.\d+|\d+\.\d*|\d+)(?:e[+-]?\d+)?(?=\s|$)/i,
lookbehind: true
},
{
// NAN literal syntax NAN: 80000deadbeef, NAN: a
pattern: /(^|\s)NAN:\s+[\da-fA-F]+(?=\s|$)/,
lookbehind: true
},
{
/*
base prefix floats 0x1.0p3 (8.0) 0b1.010p2 (5.0) 0x1.p1 0b1.11111111p11111...
"The normalized hex form ±0x1.MMMMMMMMMMMMM[pP]±EEEE allows any floating-point number to be specified precisely.
The values of MMMMMMMMMMMMM and EEEE map directly to the mantissa and exponent fields of the binary IEEE 754 representation."
<https://docs.factorcode.org/content/article-syntax-floats.html>
*/
pattern: /(^|\s)[+-]?0(?:b1\.[01]*|o1\.[0-7]*|d1\.\d*|x1\.[\dA-F]*)p\d+(?=\s|$)/i,
lookbehind: true
}
],
// R/ regexp?\/\\/
"regexp": {
pattern: /(^|\s)R\/\s(?:\\\S|[^\\/])*\/(?:[idmsr]*|[idmsr]+-[idmsr]+)(?=\s|$)/,
lookbehind: true,
alias: "number",
inside: {
"variable": /\\\S/,
"keyword": /[+?*\[\]^$(){}.|]/,
"operator": {
pattern: /(\/)[idmsr]+(?:-[idmsr]+)?/,
lookbehind: true
}
}
},
"boolean": {
pattern: /(^|\s)[tf](?=\s|$)/,
lookbehind: true
},
// SBUF" asd", URL" ://...", P" /etc/"
"custom-string": {
pattern: /(^|\s)[A-Z0-9\-]+"\s(?:\\\S|[^"\\])*"/,
lookbehind: true,
greedy: true,
alias: "string",
inside: {
"number": /\\\S|%\w|\//
}
},
"multiline-string": [
{
// STRING: name \n content \n ; -> CONSTANT: name "content" (symbol)
pattern: /(^|\s)STRING:\s+\S+(?:\n|\r\n).*(?:\n|\r\n)\s*;(?=\s|$)/,
lookbehind: true,
greedy: true,
alias: "string",
inside: {
"number": string_inside.number,
// trailing semicolon on its own line
"semicolon-or-setlocal": {
pattern: /([\r\n][ \t]*);(?=\s|$)/,
lookbehind: true,
alias: "function"
}
}
},
{
// HEREDOC: marker \n content \n marker ; -> "content" (immediate)
pattern: /(^|\s)HEREDOC:\s+\S+(?:\n|\r\n).*(?:\n|\r\n)\s*\S+(?=\s|$)/,
lookbehind: true,
greedy: true,
alias: "string",
inside: string_inside
},
{
// [[ string ]], [==[ string]==]
pattern: /(^|\s)\[(={0,6})\[\s[\s\S]*?\]\2\](?=\s|$)/,
lookbehind: true,
greedy: true,
alias: "string",
inside: string_inside
}
],
"special-using": {
pattern: /(^|\s)USING:(?:\s\S+)*(?=\s+;(?:\s|$))/,
lookbehind: true,
alias: "function",
inside: {
// this is essentially a regex for vocab names, which i don't want to specify
// but the USING: gets picked up as a vocab name
"string": {
pattern: /(\s)[^:\s]+/,
lookbehind: true
}
}
},
/* this description of stack effect literal syntax is not complete and not as specific as theoretically possible
trying to do better is more work and regex-computation-time than it's worth though.
- we'd like to have the "delimiter" parts of the stack effect [ (, --, and ) ] be a different (less-important or comment-like) colour to the stack effect contents
- we'd like if nested stack effects were treated as such rather than just appearing flat (with `inside`)
- we'd like if the following variable name conventions were recognised specifically:
special row variables = ..a b..
type and stack effect annotations end with a colon = ( quot: ( a: ( -- ) -- b ) -- x ), ( x: number -- )
word throws unconditional error = *
any other word-like variable name = a ? q' etc
https://docs.factorcode.org/content/article-effects.html
these are pretty complicated to highlight properly without a real parser, and therefore out of scope
the old pattern, which may be later useful, was: (^|\s)(?:call|execute|eval)?\((?:\s+[^"\r\n\t ]\S*)*?\s+--(?:\s+[^"\n\t ]\S*)*?\s+\)(?=\s|$)
*/
// current solution is not great
"stack-effect-delimiter": [
{
// opening parenthesis
pattern: /(^|\s)(?:call|eval|execute)?\((?=\s)/,
lookbehind: true,
alias: "operator"
},
{
// middle --
pattern: /(\s)--(?=\s)/,
lookbehind: true,
alias: "operator"
},
{
// closing parenthesis
pattern: /(\s)\)(?=\s|$)/,
lookbehind: true,
alias: "operator"
}
],
"combinators": {
pattern: null,
lookbehind: true,
alias: "keyword"
},
"kernel-builtin": {
pattern: null,
lookbehind: true,
alias: "variable"
},
"sequences-builtin": {
pattern: null,
lookbehind: true,
alias: "variable"
},
"math-builtin": {
pattern: null,
lookbehind: true,
alias: "variable"
},
"constructor-word": {
// <array> but not <=>
pattern: /(^|\s)<(?!=+>|-+>)\S+>(?=\s|$)/,
lookbehind: true,
alias: "keyword"
},
"other-builtin-syntax": {
pattern: null,
lookbehind: true,
alias: "operator"
},
/*
full list of supported word naming conventions: (the convention appears outside of the [brackets])
set-[x]
change-[x]
with-[x]
new-[x]
>[string]
[base]>
[string]>[number]
+[symbol]+
[boolean-word]?
?[of]
[slot-reader]>>
>>[slot-setter]
[slot-writer]<<
([implementation-detail])
[mutater]!
[variant]*
[prettyprint].
$[help-markup]
<constructors>, SYNTAX:, etc are supported by their own patterns.
`with` and `new` from `kernel` are their own builtins.
see <https://docs.factorcode.org/content/article-conventions.html>
*/
"conventionally-named-word": {
pattern: /(^|\s)(?!")(?:(?:change|new|set|with)-\S+|\$\S+|>[^>\s]+|[^:>\s]+>|[^>\s]+>[^>\s]+|\+[^+\s]+\+|[^?\s]+\?|\?[^?\s]+|[^>\s]+>>|>>[^>\s]+|[^<\s]+<<|\([^()\s]+\)|[^!\s]+!|[^*\s]\S*\*|[^.\s]\S*\.)(?=\s|$)/,
lookbehind: true,
alias: "keyword"
},
"colon-syntax": {
pattern: /(^|\s)(?:[A-Z0-9\-]+#?)?:{1,2}\s+(?:;\S+|(?!;)\S+)(?=\s|$)/,
lookbehind: true,
greedy: true,
alias: "function"
},
"semicolon-or-setlocal": {
pattern: /(\s)(?:;|:>)(?=\s|$)/,
lookbehind: true,
alias: "function"
},
// do not highlight leading } or trailing X{ at the begin/end of the file as it's invalid syntax
"curly-brace-literal-delimiter": [
{
// opening
pattern: /(^|\s)[a-z]*\{(?=\s)/i,
lookbehind: true,
alias: "operator"
},
{
// closing
pattern: /(\s)\}(?=\s|$)/,
lookbehind: true,
alias: "operator"
}
],
// do not highlight leading ] or trailing [ at the begin/end of the file as it's invalid syntax
"quotation-delimiter": [
{
// opening
pattern: /(^|\s)\[(?=\s)/,
lookbehind: true,
alias: "operator"
},
{
// closing
pattern: /(\s)\](?=\s|$)/,
lookbehind: true,
alias: "operator"
}
],
"normal-word": {
pattern: /(^|\s)[^"\s]\S*(?=\s|$)/,
lookbehind: true
},
/*
basic first-class string "a"
with escaped double-quote "a\""
escaped backslash "\\"
and general escapes since Factor has so many "\N"
syntax that works in the reference implementation that isn't fully
supported because it's an implementation detail:
"string 1""string 2" -> 2 strings (works anyway)
"string"5 -> string, 5
"string"[ ] -> string, quotation
{ "a"} -> array<string>
the rest of those examples all properly recognise the string, but not
the other object (number, quotation, etc)
this is fine for a regex-only implementation.
*/
"string": {
pattern: /"(?:\\\S|[^"\\])*"/,
greedy: true,
inside: string_inside
}
};
var escape = function(str) {
return (str + "").replace(/([.?*+\^$\[\]\\(){}|\-])/g, "\\$1");
};
var arrToWordsRegExp = function(arr) {
return new RegExp(
"(^|\\s)(?:" + arr.map(escape).join("|") + ")(?=\\s|$)"
);
};
var builtins = {
"kernel-builtin": [
"or",
"2nipd",
"4drop",
"tuck",
"wrapper",
"nip",
"wrapper?",
"callstack>array",
"die",
"dupd",
"callstack",
"callstack?",
"3dup",
"hashcode",
"pick",
"4nip",
"build",
">boolean",
"nipd",
"clone",
"5nip",
"eq?",
"?",
"=",
"swapd",
"2over",
"clear",
"2dup",
"get-retainstack",
"not",
"tuple?",
"dup",
"3nipd",
"call",
"-rotd",
"object",
"drop",
"assert=",
"assert?",
"-rot",
"execute",
"boa",
"get-callstack",
"curried?",
"3drop",
"pickd",
"overd",
"over",
"roll",
"3nip",
"swap",
"and",
"2nip",
"rotd",
"throw",
"(clone)",
"hashcode*",
"spin",
"reach",
"4dup",
"equal?",
"get-datastack",
"assert",
"2drop",
"<wrapper>",
"boolean?",
"identity-hashcode",
"identity-tuple?",
"null",
"composed?",
"new",
"5drop",
"rot",
"-roll",
"xor",
"identity-tuple",
"boolean"
],
"other-builtin-syntax": [
// syntax
"=======",
"recursive",
"flushable",
">>",
"<<<<<<",
"M\\",
"B",
"PRIVATE>",
"\\",
"======",
"final",
"inline",
"delimiter",
"deprecated",
"<PRIVATE",
">>>>>>",
"<<<<<<<",
"parse-complex",
"malformed-complex",
"read-only",
">>>>>>>",
"call-next-method",
"<<",
"foldable",
// literals
"$",
"$[",
"${"
],
"sequences-builtin": [
"member-eq?",
"mismatch",
"append",
"assert-sequence=",
"longer",
"repetition",
"clone-like",
"3sequence",
"assert-sequence?",
"last-index-from",
"reversed",
"index-from",
"cut*",
"pad-tail",
"join-as",
"remove-eq!",
"concat-as",
"but-last",
"snip",
"nths",
"nth",
"sequence",
"longest",
"slice?",
"<slice>",
"remove-nth",
"tail-slice",
"empty?",
"tail*",
"member?",
"virtual-sequence?",
"set-length",
"drop-prefix",
"iota",
"unclip",
"bounds-error?",
"unclip-last-slice",
"non-negative-integer-expected",
"non-negative-integer-expected?",
"midpoint@",
"longer?",
"?set-nth",
"?first",
"rest-slice",
"prepend-as",
"prepend",
"fourth",
"sift",
"subseq-start",
"new-sequence",
"?last",
"like",
"first4",
"1sequence",
"reverse",
"slice",
"virtual@",
"repetition?",
"set-last",
"index",
"4sequence",
"max-length",
"set-second",
"immutable-sequence",
"first2",
"first3",
"supremum",
"unclip-slice",
"suffix!",
"insert-nth",
"tail",
"3append",
"short",
"suffix",
"concat",
"flip",
"immutable?",
"reverse!",
"2sequence",
"sum",
"delete-all",
"indices",
"snip-slice",
"<iota>",
"check-slice",
"sequence?",
"head",
"append-as",
"halves",
"sequence=",
"collapse-slice",
"?second",
"slice-error?",
"product",
"bounds-check?",
"bounds-check",
"immutable",
"virtual-exemplar",
"harvest",
"remove",
"pad-head",
"last",
"set-fourth",
"cartesian-product",
"remove-eq",
"shorten",
"shorter",
"reversed?",
"shorter?",
"shortest",
"head-slice",
"pop*",
"tail-slice*",
"but-last-slice",
"iota?",
"append!",
"cut-slice",
"new-resizable",
"head-slice*",
"sequence-hashcode",
"pop",
"set-nth",
"?nth",
"second",
"join",
"immutable-sequence?",
"<reversed>",
"3append-as",
"virtual-sequence",
"subseq?",
"remove-nth!",
"length",
"last-index",
"lengthen",
"assert-sequence",
"copy",
"move",
"third",
"first",
"tail?",
"set-first",
"prefix",
"bounds-error",
"<repetition>",
"exchange",
"surround",
"cut",
"min-length",
"set-third",
"push-all",
"head?",
"subseq-start-from",
"delete-slice",
"rest",
"sum-lengths",
"head*",
"infimum",
"remove!",
"glue",
"slice-error",
"subseq",
"push",
"replace-slice",
"subseq-as",
"unclip-last"
],
"math-builtin": [
"number=",
"next-power-of-2",
"?1+",
"fp-special?",
"imaginary-part",
"float>bits",
"number?",
"fp-infinity?",
"bignum?",
"fp-snan?",
"denominator",
"gcd",
"*",
"+",
"fp-bitwise=",
"-",
"u>=",
"/",
">=",
"bitand",
"power-of-2?",
"log2-expects-positive",
"neg?",
"<",
"log2",
">",
"integer?",
"number",
"bits>double",
"2/",
"zero?",
"bits>float",
"float?",
"shift",
"ratio?",
"rect>",
"even?",
"ratio",
"fp-sign",
"bitnot",
">fixnum",
"complex?",
"/i",
"integer>fixnum",
"/f",
"sgn",
">bignum",
"next-float",
"u<",
"u>",
"mod",
"recip",
"rational",
">float",
"2^",
"integer",
"fixnum?",
"neg",
"fixnum",
"sq",
"bignum",
">rect",
"bit?",
"fp-qnan?",
"simple-gcd",
"complex",
"<fp-nan>",
"real",
">fraction",
"double>bits",
"bitor",
"rem",
"fp-nan-payload",
"real-part",
"log2-expects-positive?",
"prev-float",
"align",
"unordered?",
"float",
"fp-nan?",
"abs",
"bitxor",
"integer>fixnum-strict",
"u<=",
"odd?",
"<=",
"/mod",
">integer",
"real?",
"rational?",
"numerator"
]
// that's all for now
};
Object.keys(builtins).forEach(function(k) {
factor[k].pattern = arrToWordsRegExp(builtins[k]);
});
var combinators = [
// kernel
"2bi",
"while",
"2tri",
"bi*",
"4dip",
"both?",
"same?",
"tri@",
"curry",
"prepose",
"3bi",
"?if",
"tri*",
"2keep",
"3keep",
"curried",
"2keepd",
"when",
"2bi*",
"2tri*",
"4keep",
"bi@",
"keepdd",
"do",
"unless*",
"tri-curry",
"if*",
"loop",
"bi-curry*",
"when*",
"2bi@",
"2tri@",
"with",
"2with",
"either?",
"bi",
"until",
"3dip",
"3curry",
"tri-curry*",
"tri-curry@",
"bi-curry",
"keepd",
"compose",
"2dip",
"if",
"3tri",
"unless",
"tuple",
"keep",
"2curry",
"tri",
"most",
"while*",
"dip",
"composed",
"bi-curry@",
// sequences
"find-last-from",
"trim-head-slice",
"map-as",
"each-from",
"none?",
"trim-tail",
"partition",
"if-empty",
"accumulate*",
"reject!",
"find-from",
"accumulate-as",
"collector-for-as",
"reject",
"map",
"map-sum",
"accumulate!",
"2each-from",
"follow",
"supremum-by",
"map!",
"unless-empty",
"collector",
"padding",
"reduce-index",
"replicate-as",
"infimum-by",
"trim-tail-slice",
"count",
"find-index",
"filter",
"accumulate*!",
"reject-as",
"map-integers",
"map-find",
"reduce",
"selector",
"interleave",
"2map",
"filter-as",
"binary-reduce",
"map-index-as",
"find",
"produce",
"filter!",
"replicate",
"cartesian-map",
"cartesian-each",
"find-index-from",
"map-find-last",
"3map-as",
"3map",
"find-last",
"selector-as",
"2map-as",
"2map-reduce",
"accumulate",
"each",
"each-index",
"accumulate*-as",
"when-empty",
"all?",
"collector-as",
"push-either",
"new-like",
"collector-for",
"2selector",
"push-if",
"2all?",
"map-reduce",
"3each",
"any?",
"trim-slice",
"2reduce",
"change-nth",
"produce-as",
"2each",
"trim",
"trim-head",
"cartesian-find",
"map-index",
// math
"if-zero",
"each-integer",
"unless-zero",
"(find-integer)",
"when-zero",
"find-last-integer",
"(all-integers?)",
"times",
"(each-integer)",
"find-integer",
"all-integers?",
// math.combinators
"unless-negative",
"if-positive",
"when-positive",
"when-negative",
"unless-positive",
"if-negative",
// combinators
"case",
"2cleave",
"cond>quot",
"case>quot",
"3cleave",
"wrong-values",
"to-fixed-point",
"alist>quot",
"cond",
"cleave",
"call-effect",
"recursive-hashcode",
"spread",
"deep-spread>quot",
// combinators.short-circuit
"2||",
"0||",
"n||",
"0&&",
"2&&",
"3||",
"1||",
"1&&",
"n&&",
"3&&",
// combinators.smart
"smart-unless*",
"keep-inputs",
"reduce-outputs",
"smart-when*",
"cleave>array",
"smart-with",
"smart-apply",
"smart-if",
"inputs/outputs",
"output>sequence-n",
"map-outputs",
"map-reduce-outputs",
"dropping",
"output>array",
"smart-map-reduce",
"smart-2map-reduce",
"output>array-n",
"nullary",
"input<sequence",
"append-outputs",
"drop-inputs",
"inputs",
"smart-2reduce",
"drop-outputs",
"smart-reduce",
"preserving",
"smart-when",
"outputs",
"append-outputs-as",
"smart-unless",
"smart-if*",
"sum-outputs",
"input<sequence-unsafe",
"output>sequence"
// tafn
];
factor.combinators.pattern = arrToWordsRegExp(combinators);
Prism2.languages.factor = factor;
})(Prism);
(function(Prism2) {
Prism2.languages["false"] = {
"comment": {
pattern: /\{[^}]*\}/
},
"string": {
pattern: /"[^"]*"/,
greedy: true
},
"character-code": {
pattern: /'(?:[^\r]|\r\n?)/,
alias: "number"
},
"assembler-code": {
pattern: /\d+`/,
alias: "important"
},
"number": /\d+/,
"operator": /[-!#$%&'*+,./:;=>?@\\^_`|~ßø]/,
"punctuation": /\[|\]/,
"variable": /[a-z]/,
"non-standard": {
pattern: /[()<BDO®]/,
alias: "bold"
}
};
})(Prism);
Prism.languages["firestore-security-rules"] = Prism.languages.extend("clike", {
"comment": /\/\/.*/,
"keyword": /\b(?:allow|function|if|match|null|return|rules_version|service)\b/,
"operator": /&&|\|\||[<>!=]=?|[-+*/%]|\b(?:in|is)\b/
});
delete Prism.languages["firestore-security-rules"]["class-name"];
Prism.languages.insertBefore("firestore-security-rules", "keyword", {
"path": {
pattern: /(^|[\s(),])(?:\/(?:[\w\xA0-\uFFFF]+|\{[\w\xA0-\uFFFF]+(?:=\*\*)?\}|\$\([\w\xA0-\uFFFF.]+\)))+/,
lookbehind: true,
greedy: true,
inside: {
"variable": {
pattern: /\{[\w\xA0-\uFFFF]+(?:=\*\*)?\}|\$\([\w\xA0-\uFFFF.]+\)/,
inside: {
"operator": /=/,
"keyword": /\*\*/,
"punctuation": /[.$(){}]/
}
},
"punctuation": /\//
}
},
"method": {
// to make the pattern shorter, the actual method names are omitted
pattern: /(\ballow\s+)[a-z]+(?:\s*,\s*[a-z]+)*(?=\s*[:;])/,
lookbehind: true,
alias: "builtin",
inside: {
"punctuation": /,/
}
}
});
(function(Prism2) {
Prism2.languages.flow = Prism2.languages.extend("javascript", {});
Prism2.languages.insertBefore("flow", "keyword", {
"type": [
{
pattern: /\b(?:[Bb]oolean|Function|[Nn]umber|[Ss]tring|[Ss]ymbol|any|mixed|null|void)\b/,
alias: "class-name"
}
]
});
Prism2.languages.flow["function-variable"].pattern = /(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=\s*(?:function\b|(?:\([^()]*\)(?:\s*:\s*\w+)?|(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/i;
delete Prism2.languages.flow["parameter"];
Prism2.languages.insertBefore("flow", "operator", {
"flow-punctuation": {
pattern: /\{\||\|\}/,
alias: "punctuation"
}
});
if (!Array.isArray(Prism2.languages.flow.keyword)) {
Prism2.languages.flow.keyword = [Prism2.languages.flow.keyword];
}
Prism2.languages.flow.keyword.unshift(
{
pattern: /(^|[^$]\b)(?:Class|declare|opaque|type)\b(?!\$)/,
lookbehind: true
},
{
pattern: /(^|[^$]\B)\$(?:Diff|Enum|Exact|Keys|ObjMap|PropertyType|Record|Shape|Subtype|Supertype|await)\b(?!\$)/,
lookbehind: true
}
);
})(Prism);
Prism.languages.fortran = {
"quoted-number": {
pattern: /[BOZ](['"])[A-F0-9]+\1/i,
alias: "number"
},
"string": {
pattern: /(?:\b\w+_)?(['"])(?:\1\1|&(?:\r\n?|\n)(?:[ \t]*!.*(?:\r\n?|\n)|(?![ \t]*!))|(?!\1).)*(?:\1|&)/,
inside: {
"comment": {
pattern: /(&(?:\r\n?|\n)\s*)!.*/,
lookbehind: true
}
}
},
"comment": {
pattern: /!.*/,
greedy: true
},
"boolean": /\.(?:FALSE|TRUE)\.(?:_\w+)?/i,
"number": /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[ED][+-]?\d+)?(?:_\w+)?/i,
"keyword": [
// Types
/\b(?:CHARACTER|COMPLEX|DOUBLE ?PRECISION|INTEGER|LOGICAL|REAL)\b/i,
// END statements
/\b(?:END ?)?(?:BLOCK ?DATA|DO|FILE|FORALL|FUNCTION|IF|INTERFACE|MODULE(?! PROCEDURE)|PROGRAM|SELECT|SUBROUTINE|TYPE|WHERE)\b/i,
// Statements
/\b(?:ALLOCATABLE|ALLOCATE|BACKSPACE|CALL|CASE|CLOSE|COMMON|CONTAINS|CONTINUE|CYCLE|DATA|DEALLOCATE|DIMENSION|DO|END|EQUIVALENCE|EXIT|EXTERNAL|FORMAT|GO ?TO|IMPLICIT(?: NONE)?|INQUIRE|INTENT|INTRINSIC|MODULE PROCEDURE|NAMELIST|NULLIFY|OPEN|OPTIONAL|PARAMETER|POINTER|PRINT|PRIVATE|PUBLIC|READ|RETURN|REWIND|SAVE|SELECT|STOP|TARGET|WHILE|WRITE)\b/i,
// Others
/\b(?:ASSIGNMENT|DEFAULT|ELEMENTAL|ELSE|ELSEIF|ELSEWHERE|ENTRY|IN|INCLUDE|INOUT|KIND|NULL|ONLY|OPERATOR|OUT|PURE|RECURSIVE|RESULT|SEQUENCE|STAT|THEN|USE)\b/i
],
"operator": [
/\*\*|\/\/|=>|[=\/]=|[<>]=?|::|[+\-*=%]|\.[A-Z]+\./i,
{
// Use lookbehind to prevent confusion with (/ /)
pattern: /(^|(?!\().)\/(?!\))/,
lookbehind: true
}
],
"punctuation": /\(\/|\/\)|[(),;:&]/
};
(function(Prism2) {
var FTL_EXPR = /[^<()"']|\((?:<expr>)*\)|<(?!#--)|<#--(?:[^-]|-(?!->))*-->|"(?:[^\\"]|\\.)*"|'(?:[^\\']|\\.)*'/.source;
for (var i = 0; i < 2; i++) {
FTL_EXPR = FTL_EXPR.replace(/<expr>/g, function() {
return FTL_EXPR;
});
}
FTL_EXPR = FTL_EXPR.replace(/<expr>/g, /[^\s\S]/.source);
var ftl = {
"comment": /<#--[\s\S]*?-->/,
"string": [
{
// raw string
pattern: /\br("|')(?:(?!\1)[^\\]|\\.)*\1/,
greedy: true
},
{
pattern: RegExp(/("|')(?:(?!\1|\$\{)[^\\]|\\.|\$\{(?:(?!\})(?:<expr>))*\})*\1/.source.replace(/<expr>/g, function() {
return FTL_EXPR;
})),
greedy: true,
inside: {
"interpolation": {
pattern: RegExp(/((?:^|[^\\])(?:\\\\)*)\$\{(?:(?!\})(?:<expr>))*\}/.source.replace(/<expr>/g, function() {
return FTL_EXPR;
})),
lookbehind: true,
inside: {
"interpolation-punctuation": {
pattern: /^\$\{|\}$/,
alias: "punctuation"
},
rest: null
}
}
}
}
],
"keyword": /\b(?:as)\b/,
"boolean": /\b(?:false|true)\b/,
"builtin-function": {
pattern: /((?:^|[^?])\?\s*)\w+/,
lookbehind: true,
alias: "function"
},
"function": /\b\w+(?=\s*\()/,
"number": /\b\d+(?:\.\d+)?\b/,
"operator": /\.\.[<*!]?|->|--|\+\+|&&|\|\||\?{1,2}|[-+*/%!=<>]=?|\b(?:gt|gte|lt|lte)\b/,
"punctuation": /[,;.:()[\]{}]/
};
ftl.string[1].inside.interpolation.inside.rest = ftl;
Prism2.languages.ftl = {
"ftl-comment": {
// the pattern is shortened to be more efficient
pattern: /^<#--[\s\S]*/,
alias: "comment"
},
"ftl-directive": {
pattern: /^<[\s\S]+>$/,
inside: {
"directive": {
pattern: /(^<\/?)[#@][a-z]\w*/i,
lookbehind: true,
alias: "keyword"
},
"punctuation": /^<\/?|\/?>$/,
"content": {
pattern: /\s*\S[\s\S]*/,
alias: "ftl",
inside: ftl
}
}
},
"ftl-interpolation": {
pattern: /^\$\{[\s\S]*\}$/,
inside: {
"punctuation": /^\$\{|\}$/,
"content": {
pattern: /\s*\S[\s\S]*/,
alias: "ftl",
inside: ftl
}
}
}
};
Prism2.hooks.add("before-tokenize", function(env) {
var pattern = RegExp(/<#--[\s\S]*?-->|<\/?[#@][a-zA-Z](?:<expr>)*?>|\$\{(?:<expr>)*?\}/.source.replace(/<expr>/g, function() {
return FTL_EXPR;
}), "gi");
Prism2.languages["markup-templating"].buildPlaceholders(env, "ftl", pattern);
});
Prism2.hooks.add("after-tokenize", function(env) {
Prism2.languages["markup-templating"].tokenizePlaceholders(env, "ftl");
});
})(Prism);
Prism.languages.gamemakerlanguage = Prism.languages.gml = Prism.languages.extend("clike", {
"keyword": /\b(?:break|case|continue|default|do|else|enum|exit|for|globalvar|if|repeat|return|switch|until|var|while)\b/,
"number": /(?:\b0x[\da-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ulf]{0,4}/i,
"operator": /--|\+\+|[-+%/=]=?|!=|\*\*?=?|<[<=>]?|>[=>]?|&&?|\^\^?|\|\|?|~|\b(?:and|at|not|or|with|xor)\b/,
"constant": /\b(?:GM_build_date|GM_version|action_(?:continue|restart|reverse|stop)|all|gamespeed_(?:fps|microseconds)|global|local|noone|other|pi|pointer_(?:invalid|null)|self|timezone_(?:local|utc)|undefined|ev_(?:create|destroy|step|alarm|keyboard|mouse|collision|other|draw|draw_(?:begin|end|post|pre)|keypress|keyrelease|trigger|(?:left|middle|no|right)_button|(?:left|middle|right)_press|(?:left|middle|right)_release|mouse_(?:enter|leave|wheel_down|wheel_up)|global_(?:left|middle|right)_button|global_(?:left|middle|right)_press|global_(?:left|middle|right)_release|joystick(?:1|2)_(?:button1|button2|button3|button4|button5|button6|button7|button8|down|left|right|up)|outside|boundary|game_start|game_end|room_start|room_end|no_more_lives|animation_end|end_of_path|no_more_health|user\d|gui|gui_begin|gui_end|step_(?:begin|end|normal))|vk_(?:alt|anykey|backspace|control|delete|down|end|enter|escape|home|insert|left|nokey|pagedown|pageup|pause|printscreen|return|right|shift|space|tab|up|f\d|numpad\d|add|decimal|divide|lalt|lcontrol|lshift|multiply|ralt|rcontrol|rshift|subtract)|achievement_(?:filter_(?:all_players|favorites_only|friends_only)|friends_info|info|leaderboard_info|our_info|pic_loaded|show_(?:achievement|bank|friend_picker|leaderboard|profile|purchase_prompt|ui)|type_challenge|type_score_challenge)|asset_(?:font|object|path|room|script|shader|sound|sprite|tiles|timeline|unknown)|audio_(?:3d|falloff_(?:exponent_distance|exponent_distance_clamped|inverse_distance|inverse_distance_clamped|linear_distance|linear_distance_clamped|none)|mono|new_system|old_system|stereo)|bm_(?:add|complex|dest_alpha|dest_color|dest_colour|inv_dest_alpha|inv_dest_color|inv_dest_colour|inv_src_alpha|inv_src_color|inv_src_colour|max|normal|one|src_alpha|src_alpha_sat|src_color|src_colour|subtract|zero)|browser_(?:chrome|firefox|ie|ie_mobile|not_a_browser|opera|safari|safari_mobile|tizen|unknown|windows_store)|buffer_(?:bool|f16|f32|f64|fast|fixed|generalerror|grow|invalidtype|network|outofbounds|outofspace|s16|s32|s8|seek_end|seek_relative|seek_start|string|text|u16|u32|u64|u8|vbuffer|wrap)|c_(?:aqua|black|blue|dkgray|fuchsia|gray|green|lime|ltgray|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow)|cmpfunc_(?:always|equal|greater|greaterequal|less|lessequal|never|notequal)|cr_(?:appstart|arrow|beam|cross|default|drag|handpoint|hourglass|none|size_all|size_nesw|size_ns|size_nwse|size_we|uparrow)|cull_(?:clockwise|counterclockwise|noculling)|device_(?:emulator|tablet)|device_ios_(?:ipad|ipad_retina|iphone|iphone5|iphone6|iphone6plus|iphone_retina|unknown)|display_(?:landscape|landscape_flipped|portrait|portrait_flipped)|dll_(?:cdecl|cdel|stdcall)|ds_type_(?:grid|list|map|priority|queue|stack)|ef_(?:cloud|ellipse|explosion|firework|flare|rain|ring|smoke|smokeup|snow|spark|star)|fa_(?:archive|bottom|center|directory|hidden|left|middle|readonly|right|sysfile|top|volumeid)|fb_login_(?:default|fallback_to_webview|forcing_safari|forcing_webview|no_fallback_to_webview|use_system_account)|iap_(?:available|canceled|ev_consume|ev_product|ev_purchase|ev_restore|ev_storeload|failed|purchased|refunded|status_available|status_loading|status_processing|status_restoring|status_unavailable|status_uninitialised|storeload_failed|storeload_ok|unavailable)|leaderboard_type_(?:number|time_mins_secs)|lighttype_(?:dir|point)|matrix_(?:projection|view|world)|mb_(?:any|left|middle|none|right)|network_(?:config_(?:connect_timeout|disable_reliable_udp|enable_reliable_udp|use_non_blocking_socket)|socket_(?:bluetooth|tcp|udp)|type_(?:connect|data|disconnect|non_blocking_connect))|of_challenge_(?:lose|tie|win)|os_(?:android|ios|linux|macosx|ps3|ps4|psvita|unknown|uwp|win32|win8native|windows|winphone|xboxone)|phy_debug_render_(?:aabb|collision_pairs|coms|core_shapes|joints|obb|shapes)|phy_joint_(?:anchor_1_x|anchor_1_y|anchor_2_x|anchor_2_y|angle|angle_limits|damping_ratio|frequency|length_1|length_2|lower_angle_limit|max_force|max_length|max_motor_force|max_motor_torque|max_torque|motor_force|motor_speed|motor_torque|reaction_force_x|reaction_force_y|reaction_torque|speed|translation|upper_angle_limit)|phy_particle_data_flag_(?:category|color|colour|position|typeflags|velocity)|phy_particle_flag_(?:colormixing|colourmixing|elastic|powder|spring|tensile|viscous|wall|water|zombie)|phy_particle_group_flag_(?:rigid|solid)|pr_(?:linelist|linestrip|pointlist|trianglefan|trianglelist|trianglestrip)|ps_(?:distr|shape)_(?:diamond|ellipse|gaussian|invgaussian|line|linear|rectangle)|pt_shape_(?:circle|cloud|disk|explosion|flare|line|pixel|ring|smoke|snow|spark|sphere|square|star)|ty_(?:real|string)|gp_(?:face\d|axislh|axislv|axisrh|axisrv|padd|padl|padr|padu|select|shoulderl|shoulderlb|shoulderr|shoulderrb|start|stickl|stickr)|lb_disp_(?:none|numeric|time_ms|time_sec)|lb_sort_(?:ascending|descending|none)|ov_(?:achievements|community|friends|gamegroup|players|settings)|ugc_(?:filetype_(?:community|microtrans)|list_(?:Favorited|Followed|Published|Subscribed|UsedOrPlayed|VotedDown|VotedOn|VotedUp|WillVoteLater)|match_(?:AllGuides|Artwork|Collections|ControllerBindings|IntegratedGuides|Items|Items_Mtx|Items_ReadyToUse|Screenshots|UsableInGame|Videos|WebGuides)|query_(?:AcceptedForGameRankedByAcceptanceDate|CreatedByFriendsRankedByPublicationDate|FavoritedByFriendsRankedByPublicationDate|NotYetRated)|query_RankedBy(?:NumTimesReported|PublicationDate|TextSearch|TotalVotesAsc|Trend|Vote|VotesUp)|result_success|sortorder_CreationOrder(?:Asc|Desc)|sortorder_(?:ForModeration|LastUpdatedDesc|SubscriptionDateDesc|TitleAsc|VoteScoreDesc)|visibility_(?:friends_only|private|public))|vertex_usage_(?:binormal|blendindices|blendweight|color|colour|depth|fog|normal|position|psize|sample|tangent|texcoord|textcoord)|vertex_type_(?:float\d|color|colour|ubyte4)|input_type|layerelementtype_(?:background|instance|oldtilemap|particlesystem|sprite|tile|tilemap|undefined)|se_(?:chorus|compressor|echo|equalizer|flanger|gargle|none|reverb)|text_type|tile_(?:flip|index_mask|mirror|rotate)|(?:obj|rm|scr|spr)\w+)\b/,
"variable": /\b(?:alarm|application_surface|async_load|background_(?:alpha|blend|color|colour|foreground|height|hspeed|htiled|index|showcolor|showcolour|visible|vspeed|vtiled|width|x|xscale|y|yscale)|bbox_(?:bottom|left|right|top)|browser_(?:height|width)|caption_(?:health|lives|score)|current_(?:day|hour|minute|month|second|time|weekday|year)|cursor_sprite|debug_mode|delta_time|direction|display_aa|error_(?:last|occurred)|event_(?:action|number|object|type)|fps|fps_real|friction|game_(?:display|project|save)_(?:id|name)|gamemaker_(?:pro|registered|version)|gravity|gravity_direction|(?:h|v)speed|health|iap_data|id|image_(?:alpha|angle|blend|depth|index|number|speed|xscale|yscale)|instance_(?:count|id)|keyboard_(?:key|lastchar|lastkey|string)|layer|lives|mask_index|mouse_(?:button|lastbutton|x|y)|object_index|os_(?:browser|device|type|version)|path_(?:endaction|index|orientation|position|positionprevious|scale|speed)|persistent|phy_(?:rotation|(?:col_normal|collision|com|linear_velocity|position|speed)_(?:x|y)|angular_(?:damping|velocity)|position_(?:x|y)previous|speed|linear_damping|bullet|fixed_rotation|active|mass|inertia|dynamic|kinematic|sleeping|collision_points)|pointer_(?:invalid|null)|room|room_(?:caption|first|height|last|persistent|speed|width)|score|secure_mode|show_(?:health|lives|score)|solid|speed|sprite_(?:height|index|width|xoffset|yoffset)|temp_directory|timeline_(?:index|loop|position|running|speed)|transition_(?:color|kind|steps)|undefined|view_(?:angle|current|enabled|(?:h|v)(?:border|speed)|(?:h|w|x|y)port|(?:h|w|x|y)view|object|surface_id|visible)|visible|webgl_enabled|working_directory|(?:x|y)(?:previous|start)|x|y|argument(?:_relitive|_count|\d)|argument|global|local|other|self)\b/
});
Prism.languages.gap = {
"shell": {
pattern: /^gap>[\s\S]*?(?=^gap>|$(?![\s\S]))/m,
greedy: true,
inside: {
"gap": {
pattern: /^(gap>).+(?:(?:\r(?:\n|(?!\n))|\n)>.*)*/,
lookbehind: true,
inside: null
// see below
},
"punctuation": /^gap>/
}
},
"comment": {
pattern: /#.*/,
greedy: true
},
"string": {
pattern: /(^|[^\\'"])(?:'(?:[^\r\n\\']|\\.){1,10}'|"(?:[^\r\n\\"]|\\.)*"(?!")|"""[\s\S]*?""")/,
lookbehind: true,
greedy: true,
inside: {
"continuation": {
pattern: /([\r\n])>/,
lookbehind: true,
alias: "punctuation"
}
}
},
"keyword": /\b(?:Assert|Info|IsBound|QUIT|TryNextMethod|Unbind|and|atomic|break|continue|do|elif|else|end|fi|for|function|if|in|local|mod|not|od|or|quit|readonly|readwrite|rec|repeat|return|then|until|while)\b/,
"boolean": /\b(?:false|true)\b/,
"function": /\b[a-z_]\w*(?=\s*\()/i,
"number": {
pattern: /(^|[^\w.]|\.\.)(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?(?:_[a-z]?)?(?=$|[^\w.]|\.\.)/,
lookbehind: true
},
"continuation": {
pattern: /([\r\n])>/,
lookbehind: true,
alias: "punctuation"
},
"operator": /->|[-+*/^~=!]|<>|[<>]=?|:=|\.\./,
"punctuation": /[()[\]{},;.:]/
};
Prism.languages.gap.shell.inside.gap.inside = Prism.languages.gap;
Prism.languages.gcode = {
"comment": /;.*|\B\(.*?\)\B/,
"string": {
pattern: /"(?:""|[^"])*"/,
greedy: true
},
"keyword": /\b[GM]\d+(?:\.\d+)?\b/,
"property": /\b[A-Z]/,
"checksum": {
pattern: /(\*)\d+/,
lookbehind: true,
alias: "number"
},
// T0:0:0
"punctuation": /[:*]/
};
Prism.languages.gdscript = {
"comment": /#.*/,
"string": {
pattern: /@?(?:("|')(?:(?!\1)[^\n\\]|\\[\s\S])*\1(?!"|')|"""(?:[^\\]|\\[\s\S])*?""")/,
greedy: true
},
"class-name": {
// class_name Foo, extends Bar, class InnerClass
// export(int) var baz, export(int, 0) var i
// as Node
// const FOO: int = 9, var bar: bool = true
// func add(reference: Item, amount: int) -> Item:
pattern: /(^(?:class|class_name|extends)[ \t]+|^export\([ \t]*|\bas[ \t]+|(?:\b(?:const|var)[ \t]|[,(])[ \t]*\w+[ \t]*:[ \t]*|->[ \t]*)[a-zA-Z_]\w*/m,
lookbehind: true
},
"keyword": /\b(?:and|as|assert|break|breakpoint|class|class_name|const|continue|elif|else|enum|export|extends|for|func|if|in|is|master|mastersync|match|not|null|onready|or|pass|preload|puppet|puppetsync|remote|remotesync|return|self|setget|signal|static|tool|var|while|yield)\b/,
"function": /\b[a-z_]\w*(?=[ \t]*\()/i,
"variable": /\$\w+/,
"number": [
/\b0b[01_]+\b|\b0x[\da-fA-F_]+\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.[\d_]+)(?:e[+-]?[\d_]+)?\b/,
/\b(?:INF|NAN|PI|TAU)\b/
],
"constant": /\b[A-Z][A-Z_\d]*\b/,
"boolean": /\b(?:false|true)\b/,
"operator": /->|:=|&&|\|\||<<|>>|[-+*/%&|!<>=]=?|[~^]/,
"punctuation": /[.:,;()[\]{}]/
};
Prism.languages.gedcom = {
"line-value": {
// Preceded by level, optional pointer, and tag
pattern: /(^[\t ]*\d+ +(?:@\w[\w!"$%&'()*+,\-./:;<=>?[\\\]^`{|}~\x80-\xfe #]*@ +)?\w+ ).+/m,
lookbehind: true,
inside: {
"pointer": {
pattern: /^@\w[\w!"$%&'()*+,\-./:;<=>?[\\\]^`{|}~\x80-\xfe #]*@$/,
alias: "variable"
}
}
},
"record": {
// Preceded by level and optional pointer
pattern: /(^[\t ]*\d+ +(?:@\w[\w!"$%&'()*+,\-./:;<=>?[\\\]^`{|}~\x80-\xfe #]*@ +)?)\w+/m,
lookbehind: true,
alias: "tag"
},
"level": {
pattern: /(^[\t ]*)\d+/m,
lookbehind: true,
alias: "number"
},
"pointer": {
pattern: /@\w[\w!"$%&'()*+,\-./:;<=>?[\\\]^`{|}~\x80-\xfe #]*@/,
alias: "variable"
}
};
Prism.languages.gettext = {
"comment": [
{
pattern: /# .*/,
greedy: true,
alias: "translator-comment"
},
{
pattern: /#\..*/,
greedy: true,
alias: "extracted-comment"
},
{
pattern: /#:.*/,
greedy: true,
alias: "reference-comment"
},
{
pattern: /#,.*/,
greedy: true,
alias: "flag-comment"
},
{
pattern: /#\|.*/,
greedy: true,
alias: "previously-untranslated-comment"
},
{
pattern: /#.*/,
greedy: true
}
],
"string": {
pattern: /(^|[^\\])"(?:[^"\\]|\\.)*"/,
lookbehind: true,
greedy: true
},
"keyword": /^msg(?:ctxt|id|id_plural|str)\b/m,
"number": /\b\d+\b/,
"punctuation": /[\[\]]/
};
Prism.languages.po = Prism.languages.gettext;
(function(Prism2) {
var tableRow = /(?:\r?\n|\r)[ \t]*\|.+\|(?:(?!\|).)*/.source;
Prism2.languages.gherkin = {
"pystring": {
pattern: /("""|''')[\s\S]+?\1/,
alias: "string"
},
"comment": {
pattern: /(^[ \t]*)#.*/m,
lookbehind: true
},
"tag": {
pattern: /(^[ \t]*)@\S*/m,
lookbehind: true
},
"feature": {
pattern: /((?:^|\r?\n|\r)[ \t]*)(?:Ability|Ahoy matey!|Arwedd|Aspekt|Besigheid Behoefte|Business Need|Caracteristica|Característica|Egenskab|Egenskap|Eiginleiki|Feature|Fīča|Fitur|Fonctionnalité|Fonksyonalite|Funcionalidade|Funcionalitat|Functionalitate|Funcţionalitate|Funcționalitate|Functionaliteit|Fungsi|Funkcia|Funkcija|Funkcionalitāte|Funkcionalnost|Funkcja|Funksie|Funktionalität|Funktionalitéit|Funzionalità|Hwaet|Hwæt|Jellemző|Karakteristik|Lastnost|Mak|Mogucnost|laH|Mogućnost|Moznosti|Možnosti|OH HAI|Omadus|Ominaisuus|Osobina|Özellik|Potrzeba biznesowa|perbogh|poQbogh malja'|Požadavek|Požiadavka|Pretty much|Qap|Qu'meH 'ut|Savybė|Tính năng|Trajto|Vermoë|Vlastnosť|Właściwość|Značilnost|Δυνατότητα|Λειτουργία|Могућност|Мөмкинлек|Особина|Свойство|Үзенчәлеклелек|Функционал|Функционалност|Функция|Функціонал|תכונה|خاصية|خصوصیت|صلاحیت|کاروبار کی ضرورت|وِیژگی|रूप लेख|ਖਾਸੀਅਤ|ਨਕਸ਼ ਨੁਹਾਰ|ਮੁਹਾਂਦਰਾ|గుణము|ಹೆಚ್ಚಳ|ความต้องการทางธุรกิจ|ความสามารถ|โครงหลัก|기능|フィーチャ|功能|機能):(?:[^:\r\n]+(?:\r?\n|\r|$))*/,
lookbehind: true,
inside: {
"important": {
pattern: /(:)[^\r\n]+/,
lookbehind: true
},
"keyword": /[^:\r\n]+:/
}
},
"scenario": {
pattern: /(^[ \t]*)(?:Abstract Scenario|Abstrakt Scenario|Achtergrond|Aer|Ær|Agtergrond|All y'all|Antecedentes|Antecedents|Atburðarás|Atburðarásir|Awww, look mate|B4|Background|Baggrund|Bakgrund|Bakgrunn|Bakgrunnur|Beispiele|Beispiller|Bối cảnh|Cefndir|Cenario|Cenário|Cenario de Fundo|Cenário de Fundo|Cenarios|Cenários|Contesto|Context|Contexte|Contexto|Conto|Contoh|Contone|Dæmi|Dasar|Dead men tell no tales|Delineacao do Cenario|Delineação do Cenário|Dis is what went down|Dữ liệu|Dyagram Senaryo|Dyagram senaryo|Egzanp|Ejemplos|Eksempler|Ekzemploj|Enghreifftiau|Esbozo do escenario|Escenari|Escenario|Esempi|Esquema de l'escenari|Esquema del escenario|Esquema do Cenario|Esquema do Cenário|EXAMPLZ|Examples|Exempel|Exemple|Exemples|Exemplos|First off|Fono|Forgatókönyv|Forgatókönyv vázlat|Fundo|Geçmiş|Grundlage|Hannergrond|ghantoH|Háttér|Heave to|Istorik|Juhtumid|Keadaan|Khung kịch bản|Khung tình huống|Kịch bản|Koncept|Konsep skenario|Kontèks|Kontekst|Kontekstas|Konteksts|Kontext|Konturo de la scenaro|Latar Belakang|lut chovnatlh|lut|lutmey|Lýsing Atburðarásar|Lýsing Dæma|MISHUN SRSLY|MISHUN|Menggariskan Senario|mo'|Náčrt Scenára|Náčrt Scénáře|Náčrt Scenáru|Oris scenarija|Örnekler|Osnova|Osnova Scenára|Osnova scénáře|Osnutek|Ozadje|Paraugs|Pavyzdžiai|Példák|Piemēri|Plan du scénario|Plan du Scénario|Plan Senaryo|Plan senaryo|Plang vum Szenario|Pozadí|Pozadie|Pozadina|Príklady|Příklady|Primer|Primeri|Primjeri|Przykłady|Raamstsenaarium|Reckon it's like|Rerefons|Scenár|Scénář|Scenarie|Scenarij|Scenarijai|Scenarijaus šablonas|Scenariji|Scenārijs|Scenārijs pēc parauga|Scenarijus|Scenario|Scénario|Scenario Amlinellol|Scenario Outline|Scenario Template|Scenariomal|Scenariomall|Scenarios|Scenariu|Scenariusz|Scenaro|Schema dello scenario|Se ðe|Se the|Se þe|Senario|Senaryo Deskripsyon|Senaryo deskripsyon|Senaryo|Senaryo taslağı|Shiver me timbers|Situācija|Situai|Situasie Uiteensetting|Situasie|Skenario konsep|Skenario|Skica|Structura scenariu|Structură scenariu|Struktura scenarija|Stsenaarium|Swa hwaer swa|Swa|Swa hwær swa|Szablon scenariusza|Szenario|Szenariogrundriss|Tapaukset|Tapaus|Tapausaihio|Taust|Tausta|Template Keadaan|Template Senario|Template Situai|The thing of it is|Tình huống|Variantai|Voorbeelde|Voorbeelden|Wharrimean is|Yo-ho-ho|You'll wanna|Założenia|Παραδείγματα|Περιγραφή Σεναρίου|Σενάρια|Σενάριο|Υπόβαθρο|Кереш|Контекст|Концепт|Мисаллар|Мисоллар|Основа|Передумова|Позадина|Предистория|Предыстория|Приклади|Пример|Примери|Примеры|Рамка на сценарий|Скица|Структура сценарија|Структура сценария|Структура сценарію|Сценарий|Сценарий структураси|Сценарийның төзелеше|Сценарији|Сценарио|Сценарій|Тарих|Үрнәкләр|דוגמאות|רקע|תבנית תרחיש|תרחיש|الخلفية|الگوی سناریو|امثلة|پس منظر|زمینه|سناریو|سيناريو|سيناريو مخطط|مثالیں|منظر نامے کا خاکہ|منظرنامہ|نمونه ها|उदाहरण|परिदृश्य|परिदृश्य रूपरेखा|पृष्ठभूमि|ਉਦਾਹਰਨਾਂ|ਪਟਕਥਾ|ਪਟਕਥਾ ਢਾਂਚਾ|ਪਟਕਥਾ ਰੂਪ ਰੇਖਾ|ਪਿਛੋਕੜ|ఉదాహరణలు|కథనం|నేపథ్యం|సన్నివేశం|ಉದಾಹರಣೆಗಳು|ಕಥಾಸಾರಾಂಶ|ವಿವರಣೆ|ಹಿನ್ನೆಲೆ|โครงสร้างของเหตุการณ์|ชุดของตัวอย่าง|ชุดของเหตุการณ์|แนวคิด|สรุปเหตุการณ์|เหตุการณ์|배경|시나리오|시나리오 개요|예|サンプル|シナリオ|シナリオアウトライン|シナリオテンプレ|シナリオテンプレート|テンプレ|例|例子|剧本|剧本大纲|劇本|劇本大綱|场景|场景大纲|場景|場景大綱|背景):[^:\r\n]*/m,
lookbehind: true,
inside: {
"important": {
pattern: /(:)[^\r\n]*/,
lookbehind: true
},
"keyword": /[^:\r\n]+:/
}
},
"table-body": {
// Look-behind is used to skip the table head, which has the same format as any table row
pattern: RegExp("(" + tableRow + ")(?:" + tableRow + ")+"),
lookbehind: true,
inside: {
"outline": {
pattern: /<[^>]+>/,
alias: "variable"
},
"td": {
pattern: /\s*[^\s|][^|]*/,
alias: "string"
},
"punctuation": /\|/
}
},
"table-head": {
pattern: RegExp(tableRow),
inside: {
"th": {
pattern: /\s*[^\s|][^|]*/,
alias: "variable"
},
"punctuation": /\|/
}
},
"atrule": {
pattern: /(^[ \t]+)(?:'a|'ach|'ej|7|a|A také|A taktiež|A tiež|A zároveň|Aber|Ac|Adott|Akkor|Ak|Aleshores|Ale|Ali|Allora|Alors|Als|Ama|Amennyiben|Amikor|Ampak|an|AN|Ananging|And y'all|And|Angenommen|Anrhegedig a|An|Apabila|Atès|Atesa|Atunci|Avast!|Aye|A|awer|Bagi|Banjur|Bet|Biết|Blimey!|Buh|But at the end of the day I reckon|But y'all|But|BUT|Cal|Când|Cand|Cando|Ce|Cuando|Če|Ða ðe|Ða|Dadas|Dada|Dados|Dado|DaH ghu' bejlu'|dann|Dann|Dano|Dan|Dar|Dat fiind|Data|Date fiind|Date|Dati fiind|Dati|Daţi fiind|Dați fiind|DEN|Dato|De|Den youse gotta|Dengan|Diberi|Diyelim ki|Donada|Donat|Donitaĵo|Do|Dun|Duota|Ðurh|Eeldades|Ef|Eğer ki|Entao|Então|Entón|E|En|Entonces|Epi|És|Etant donnée|Etant donné|Et|Étant données|Étant donnée|Étant donné|Etant données|Etant donnés|Étant donnés|Fakat|Gangway!|Gdy|Gegeben seien|Gegeben sei|Gegeven|Gegewe|ghu' noblu'|Gitt|Given y'all|Given|Givet|Givun|Ha|Cho|I CAN HAZ|In|Ir|It's just unbelievable|I|Ja|Jeśli|Jeżeli|Kad|Kada|Kadar|Kai|Kaj|Když|Keď|Kemudian|Ketika|Khi|Kiedy|Ko|Kuid|Kui|Kun|Lan|latlh|Le sa a|Let go and haul|Le|Lè sa a|Lè|Logo|Lorsqu'<|Lorsque|mä|Maar|Mais|Mając|Ma|Majd|Maka|Manawa|Mas|Men|Menawa|Mutta|Nalika|Nalikaning|Nanging|Når|När|Nato|Nhưng|Niin|Njuk|O zaman|Och|Og|Oletetaan|Ond|Onda|Oraz|Pak|Pero|Però|Podano|Pokiaľ|Pokud|Potem|Potom|Privzeto|Pryd|Quan|Quand|Quando|qaSDI'|Så|Sed|Se|Siis|Sipoze ke|Sipoze Ke|Sipoze|Si|Şi|Și|Soit|Stel|Tada|Tad|Takrat|Tak|Tapi|Ter|Tetapi|Tha the|Tha|Then y'all|Then|Thì|Thurh|Toda|Too right|Un|Und|ugeholl|Và|vaj|Vendar|Ve|wann|Wanneer|WEN|Wenn|When y'all|When|Wtedy|Wun|Y'know|Yeah nah|Yna|Youse know like when|Youse know when youse got|Y|Za predpokladu|Za předpokladu|Zadan|Zadani|Zadano|Zadate|Zadato|Zakładając|Zaradi|Zatati|Þa þe|Þa|Þá|Þegar|Þurh|Αλλά|Δεδομένου|Και|Όταν|Τότε|А також|Агар|Але|Али|Аммо|А|Әгәр|Әйтик|Әмма|Бирок|Ва|Вә|Дадено|Дано|Допустим|Если|Задате|Задати|Задато|И|І|К тому же|Када|Кад|Когато|Когда|Коли|Ләкин|Лекин|Нәтиҗәдә|Нехай|Но|Онда|Припустимо, що|Припустимо|Пусть|Также|Та|Тогда|Тоді|То|Унда|Һәм|Якщо|אבל|אזי|אז|בהינתן|וגם|כאשר|آنگاه|اذاً|اگر|اما|اور|با فرض|بالفرض|بفرض|پھر|تب|ثم|جب|عندما|فرض کیا|لكن|لیکن|متى|هنگامی|و|अगर|और|कदा|किन्तु|चूंकि|जब|तथा|तदा|तब|परन्तु|पर|यदि|ਅਤੇ|ਜਦੋਂ|ਜਿਵੇਂ ਕਿ|ਜੇਕਰ|ਤਦ|ਪਰ|అప్పుడు|ఈ పరిస్థితిలో|కాని|చెప్పబడినది|మరియు|ಆದರೆ|ನಂತರ|ನೀಡಿದ|ಮತ್ತು|ಸ್ಥಿತಿಯನ್ನು|กำหนดให้|ดังนั้น|แต่|เมื่อ|และ|그러면<|그리고<|단<|만약<|만일<|먼저<|조건<|하지만<|かつ<|しかし<|ただし<|ならば<|もし<|並且<|但し<|但是<|假如<|假定<|假設<|假设<|前提<|同时<|同時<|并且<|当<|當<|而且<|那么<|那麼<)(?=[ \t])/m,
lookbehind: true
},
"string": {
pattern: /"(?:\\.|[^"\\\r\n])*"|'(?:\\.|[^'\\\r\n])*'/,
inside: {
"outline": {
pattern: /<[^>]+>/,
alias: "variable"
}
}
},
"outline": {
pattern: /<[^>]+>/,
alias: "variable"
}
};
})(Prism);
Prism.languages.git = {
/*
* A simple one line comment like in a git status command
* For instance:
* $ git status
* # On branch infinite-scroll
* # Your branch and 'origin/sharedBranches/frontendTeam/infinite-scroll' have diverged,
* # and have 1 and 2 different commits each, respectively.
* nothing to commit (working directory clean)
*/
"comment": /^#.*/m,
/*
* Regexp to match the changed lines in a git diff output. Check the example below.
*/
"deleted": /^[-–].*/m,
"inserted": /^\+.*/m,
/*
* a string (double and simple quote)
*/
"string": /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
/*
* a git command. It starts with a random prompt finishing by a $, then "git" then some other parameters
* For instance:
* $ git add file.txt
*/
"command": {
pattern: /^.*\$ git .*$/m,
inside: {
/*
* A git command can contain a parameter starting by a single or a double dash followed by a string
* For instance:
* $ git diff --cached
* $ git log -p
*/
"parameter": /\s--?\w+/
}
},
/*
* Coordinates displayed in a git diff command
* For instance:
* $ git diff
* diff --git file.txt file.txt
* index 6214953..1d54a52 100644
* --- file.txt
* +++ file.txt
* @@ -1 +1,2 @@
* -Here's my tetx file
* +Here's my text file
* +And this is the second line
*/
"coord": /^@@.*@@$/m,
/*
* Match a "commit [SHA1]" line in a git log output.
* For instance:
* $ git log
* commit a11a14ef7e26f2ca62d4b35eac455ce636d0dc09
* Author: lgiraudel
* Date: Mon Feb 17 11:18:34 2014 +0100
*
* Add of a new line
*/
"commit-sha1": /^commit \w{40}$/m
};
Prism.languages.glsl = Prism.languages.extend("c", {
"keyword": /\b(?:active|asm|atomic_uint|attribute|[ibdu]?vec[234]|bool|break|buffer|case|cast|centroid|class|coherent|common|const|continue|d?mat[234](?:x[234])?|default|discard|do|double|else|enum|extern|external|false|filter|fixed|flat|float|for|fvec[234]|goto|half|highp|hvec[234]|[iu]?sampler2DMS(?:Array)?|[iu]?sampler2DRect|[iu]?samplerBuffer|[iu]?samplerCube|[iu]?samplerCubeArray|[iu]?sampler[123]D|[iu]?sampler[12]DArray|[iu]?image2DMS(?:Array)?|[iu]?image2DRect|[iu]?imageBuffer|[iu]?imageCube|[iu]?imageCubeArray|[iu]?image[123]D|[iu]?image[12]DArray|if|in|inline|inout|input|int|interface|invariant|layout|long|lowp|mediump|namespace|noinline|noperspective|out|output|partition|patch|precise|precision|public|readonly|resource|restrict|return|sample|sampler[12]DArrayShadow|sampler[12]DShadow|sampler2DRectShadow|sampler3DRect|samplerCubeArrayShadow|samplerCubeShadow|shared|short|sizeof|smooth|static|struct|subroutine|superp|switch|template|this|true|typedef|uint|uniform|union|unsigned|using|varying|void|volatile|while|writeonly)\b/
});
Prism.languages.gn = {
"comment": {
pattern: /#.*/,
greedy: true
},
"string-literal": {
pattern: /(^|[^\\"])"(?:[^\r\n"\\]|\\.)*"/,
lookbehind: true,
greedy: true,
inside: {
"interpolation": {
pattern: /((?:^|[^\\])(?:\\{2})*)\$(?:\{[\s\S]*?\}|[a-zA-Z_]\w*|0x[a-fA-F0-9]{2})/,
lookbehind: true,
inside: {
"number": /^\$0x[\s\S]{2}$/,
"variable": /^\$\w+$/,
"interpolation-punctuation": {
pattern: /^\$\{|\}$/,
alias: "punctuation"
},
"expression": {
pattern: /[\s\S]+/,
inside: null
// see below
}
}
},
"string": /[\s\S]+/
}
},
"keyword": /\b(?:else|if)\b/,
"boolean": /\b(?:false|true)\b/,
"builtin-function": {
// a few functions get special highlighting to improve readability
pattern: /\b(?:assert|defined|foreach|import|pool|print|template|tool|toolchain)(?=\s*\()/i,
alias: "keyword"
},
"function": /\b[a-z_]\w*(?=\s*\()/i,
"constant": /\b(?:current_cpu|current_os|current_toolchain|default_toolchain|host_cpu|host_os|root_build_dir|root_gen_dir|root_out_dir|target_cpu|target_gen_dir|target_os|target_out_dir)\b/,
"number": /-?\b\d+\b/,
"operator": /[-+!=<>]=?|&&|\|\|/,
"punctuation": /[(){}[\],.]/
};
Prism.languages.gn["string-literal"].inside["interpolation"].inside["expression"].inside = Prism.languages.gn;
Prism.languages.gni = Prism.languages.gn;
Prism.languages["linker-script"] = {
"comment": {
pattern: /(^|\s)\/\*[\s\S]*?(?:$|\*\/)/,
lookbehind: true,
greedy: true
},
"identifier": {
pattern: /"[^"\r\n]*"/,
greedy: true
},
"location-counter": {
pattern: /\B\.\B/,
alias: "important"
},
"section": {
pattern: /(^|[^\w*])\.\w+\b/,
lookbehind: true,
alias: "keyword"
},
"function": /\b[A-Z][A-Z_]*(?=\s*\()/,
"number": /\b(?:0[xX][a-fA-F0-9]+|\d+)[KM]?\b/,
"operator": />>=?|<<=?|->|\+\+|--|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?/,
"punctuation": /[(){},;]/
};
Prism.languages["ld"] = Prism.languages["linker-script"];
Prism.languages.go = Prism.languages.extend("clike", {
"string": {
pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,
lookbehind: true,
greedy: true
},
"keyword": /\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,
"boolean": /\b(?:_|false|iota|nil|true)\b/,
"number": [
// binary and octal integers
/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,
// hexadecimal integers and floats
/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,
// decimal integers and floats
/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i
],
"operator": /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
"builtin": /\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/
});
Prism.languages.insertBefore("go", "string", {
"char": {
pattern: /'(?:\\.|[^'\\\r\n]){0,10}'/,
greedy: true
}
});
delete Prism.languages.go["class-name"];
Prism.languages["go-mod"] = Prism.languages["go-module"] = {
"comment": {
pattern: /\/\/.*/,
greedy: true
},
"version": {
pattern: /(^|[\s()[\],])v\d+\.\d+\.\d+(?:[+-][-+.\w]*)?(?![^\s()[\],])/,
lookbehind: true,
alias: "number"
},
"go-version": {
pattern: /((?:^|\s)go\s+)\d+(?:\.\d+){1,2}/,
lookbehind: true,
alias: "number"
},
"keyword": {
pattern: /^([ \t]*)(?:exclude|go|module|replace|require|retract)\b/m,
lookbehind: true
},
"operator": /=>/,
"punctuation": /[()[\],]/
};
(function(Prism2) {
var interpolation = {
pattern: /((?:^|[^\\$])(?:\\{2})*)\$(?:\w+|\{[^{}]*\})/,
lookbehind: true,
inside: {
"interpolation-punctuation": {
pattern: /^\$\{?|\}$/,
alias: "punctuation"
},
"expression": {
pattern: /[\s\S]+/,
inside: null
}
}
};
Prism2.languages.gradle = Prism2.languages.extend("clike", {
"string": {
pattern: /'''(?:[^\\]|\\[\s\S])*?'''|'(?:\\.|[^\\'\r\n])*'/,
greedy: true
},
"keyword": /\b(?:apply|def|dependencies|else|if|implementation|import|plugin|plugins|project|repositories|repository|sourceSets|tasks|val)\b/,
"number": /\b(?:0b[01_]+|0x[\da-f_]+(?:\.[\da-f_p\-]+)?|[\d_]+(?:\.[\d_]+)?(?:e[+-]?\d+)?)[glidf]?\b/i,
"operator": {
pattern: /(^|[^.])(?:~|==?~?|\?[.:]?|\*(?:[.=]|\*=?)?|\.[@&]|\.\.<|\.\.(?!\.)|-[-=>]?|\+[+=]?|!=?|<(?:<=?|=>?)?|>(?:>>?=?|=)?|&[&=]?|\|[|=]?|\/=?|\^=?|%=?)/,
lookbehind: true
},
"punctuation": /\.+|[{}[\];(),:$]/
});
Prism2.languages.insertBefore("gradle", "string", {
"shebang": {
pattern: /#!.+/,
alias: "comment",
greedy: true
},
"interpolation-string": {
pattern: /"""(?:[^\\]|\\[\s\S])*?"""|(["/])(?:\\.|(?!\1)[^\\\r\n])*\1|\$\/(?:[^/$]|\$(?:[/$]|(?![/$]))|\/(?!\$))*\/\$/,
greedy: true,
inside: {
"interpolation": interpolation,
"string": /[\s\S]+/
}
}
});
Prism2.languages.insertBefore("gradle", "punctuation", {
"spock-block": /\b(?:and|cleanup|expect|given|setup|then|when|where):/
});
Prism2.languages.insertBefore("gradle", "function", {
"annotation": {
pattern: /(^|[^.])@\w+/,
lookbehind: true,
alias: "punctuation"
}
});
interpolation.inside.expression.inside = Prism2.languages.gradle;
})(Prism);
Prism.languages.graphql = {
"comment": /#.*/,
"description": {
pattern: /(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,
greedy: true,
alias: "string",
inside: {
"language-markdown": {
pattern: /(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,
lookbehind: true,
inside: Prism.languages.markdown
}
}
},
"string": {
pattern: /"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,
greedy: true
},
"number": /(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
"boolean": /\b(?:false|true)\b/,
"variable": /\$[a-z_]\w*/i,
"directive": {
pattern: /@[a-z_]\w*/i,
alias: "function"
},
"attr-name": {
pattern: /\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,
greedy: true
},
"atom-input": {
pattern: /\b[A-Z]\w*Input\b/,
alias: "class-name"
},
"scalar": /\b(?:Boolean|Float|ID|Int|String)\b/,
"constant": /\b[A-Z][A-Z_\d]*\b/,
"class-name": {
pattern: /(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,
lookbehind: true
},
"fragment": {
pattern: /(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,
lookbehind: true,
alias: "function"
},
"definition-mutation": {
pattern: /(\bmutation\s+)[a-zA-Z_]\w*/,
lookbehind: true,
alias: "function"
},
"definition-query": {
pattern: /(\bquery\s+)[a-zA-Z_]\w*/,
lookbehind: true,
alias: "function"
},
"keyword": /\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,
"operator": /[!=|&]|\.{3}/,
"property-query": /\w+(?=\s*\()/,
"object": /\w+(?=\s*\{)/,
"punctuation": /[!(){}\[\]:=,]/,
"property": /\w+/
};
Prism.hooks.add("after-tokenize", function afterTokenizeGraphql(env) {
if (env.language !== "graphql") {
return;
}
var validTokens = env.tokens.filter(function(token) {
return typeof token !== "string" && token.type !== "comment" && token.type !== "scalar";
});
var currentIndex = 0;
function getToken(offset2) {
return validTokens[currentIndex + offset2];
}
function isTokenType(types, offset2) {
offset2 = offset2 || 0;
for (var i2 = 0; i2 < types.length; i2++) {
var token = getToken(i2 + offset2);
if (!token || token.type !== types[i2]) {
return false;
}
}
return true;
}
function findClosingBracket(open, close) {
var stackHeight = 1;
for (var i2 = currentIndex; i2 < validTokens.length; i2++) {
var token = validTokens[i2];
var content = token.content;
if (token.type === "punctuation" && typeof content === "string") {
if (open.test(content)) {
stackHeight++;
} else if (close.test(content)) {
stackHeight--;
if (stackHeight === 0) {
return i2;
}
}
}
}
return -1;
}
function addAlias(token, alias) {
var aliases = token.alias;
if (!aliases) {
token.alias = aliases = [];
} else if (!Array.isArray(aliases)) {
token.alias = aliases = [aliases];
}
aliases.push(alias);
}
for (; currentIndex < validTokens.length; ) {
var startToken = validTokens[currentIndex++];
if (startToken.type === "keyword" && startToken.content === "mutation") {
var inputVariables = [];
if (isTokenType(["definition-mutation", "punctuation"]) && getToken(1).content === "(") {
currentIndex += 2;
var definitionEnd = findClosingBracket(/^\($/, /^\)$/);
if (definitionEnd === -1) {
continue;
}
for (; currentIndex < definitionEnd; currentIndex++) {
var t = getToken(0);
if (t.type === "variable") {
addAlias(t, "variable-input");
inputVariables.push(t.content);
}
}
currentIndex = definitionEnd + 1;
}
if (isTokenType(["punctuation", "property-query"]) && getToken(0).content === "{") {
currentIndex++;
addAlias(getToken(0), "property-mutation");
if (inputVariables.length > 0) {
var mutationEnd = findClosingBracket(/^\{$/, /^\}$/);
if (mutationEnd === -1) {
continue;
}
for (var i = currentIndex; i < mutationEnd; i++) {
var varToken = validTokens[i];
if (varToken.type === "variable" && inputVariables.indexOf(varToken.content) >= 0) {
addAlias(varToken, "variable-input");
}
}
}
}
}
}
});
(function(Prism2) {
var interpolation = {
pattern: /((?:^|[^\\$])(?:\\{2})*)\$(?:\w+|\{[^{}]*\})/,
lookbehind: true,
inside: {
"interpolation-punctuation": {
pattern: /^\$\{?|\}$/,
alias: "punctuation"
},
"expression": {
pattern: /[\s\S]+/,
inside: null
// see below
}
}
};
Prism2.languages.groovy = Prism2.languages.extend("clike", {
"string": {
// https://groovy-lang.org/syntax.html#_dollar_slashy_string
pattern: /'''(?:[^\\]|\\[\s\S])*?'''|'(?:\\.|[^\\'\r\n])*'/,
greedy: true
},
"keyword": /\b(?:abstract|as|assert|boolean|break|byte|case|catch|char|class|const|continue|def|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|in|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|trait|transient|try|void|volatile|while)\b/,
"number": /\b(?:0b[01_]+|0x[\da-f_]+(?:\.[\da-f_p\-]+)?|[\d_]+(?:\.[\d_]+)?(?:e[+-]?\d+)?)[glidf]?\b/i,
"operator": {
pattern: /(^|[^.])(?:~|==?~?|\?[.:]?|\*(?:[.=]|\*=?)?|\.[@&]|\.\.<|\.\.(?!\.)|-[-=>]?|\+[+=]?|!=?|<(?:<=?|=>?)?|>(?:>>?=?|=)?|&[&=]?|\|[|=]?|\/=?|\^=?|%=?)/,
lookbehind: true
},
"punctuation": /\.+|[{}[\];(),:$]/
});
Prism2.languages.insertBefore("groovy", "string", {
"shebang": {
pattern: /#!.+/,
alias: "comment",
greedy: true
},
"interpolation-string": {
// TODO: Slash strings (e.g. /foo/) can contain line breaks but this will cause a lot of trouble with
// simple division (see JS regex), so find a fix maybe?
pattern: /"""(?:[^\\]|\\[\s\S])*?"""|(["/])(?:\\.|(?!\1)[^\\\r\n])*\1|\$\/(?:[^/$]|\$(?:[/$]|(?![/$]))|\/(?!\$))*\/\$/,
greedy: true,
inside: {
"interpolation": interpolation,
"string": /[\s\S]+/
}
}
});
Prism2.languages.insertBefore("groovy", "punctuation", {
"spock-block": /\b(?:and|cleanup|expect|given|setup|then|when|where):/
});
Prism2.languages.insertBefore("groovy", "function", {
"annotation": {
pattern: /(^|[^.])@\w+/,
lookbehind: true,
alias: "punctuation"
}
});
interpolation.inside.expression.inside = Prism2.languages.groovy;
})(Prism);
(function(Prism2) {
Prism2.languages.haml = {
// Multiline stuff should appear before the rest
"multiline-comment": {
pattern: /((?:^|\r?\n|\r)([\t ]*))(?:\/|-#).*(?:(?:\r?\n|\r)\2[\t ].+)*/,
lookbehind: true,
alias: "comment"
},
"multiline-code": [
{
pattern: /((?:^|\r?\n|\r)([\t ]*)(?:[~-]|[&!]?=)).*,[\t ]*(?:(?:\r?\n|\r)\2[\t ].*,[\t ]*)*(?:(?:\r?\n|\r)\2[\t ].+)/,
lookbehind: true,
inside: Prism2.languages.ruby
},
{
pattern: /((?:^|\r?\n|\r)([\t ]*)(?:[~-]|[&!]?=)).*\|[\t ]*(?:(?:\r?\n|\r)\2[\t ].*\|[\t ]*)*/,
lookbehind: true,
inside: Prism2.languages.ruby
}
],
// See at the end of the file for known filters
"filter": {
pattern: /((?:^|\r?\n|\r)([\t ]*)):[\w-]+(?:(?:\r?\n|\r)(?:\2[\t ].+|\s*?(?=\r?\n|\r)))+/,
lookbehind: true,
inside: {
"filter-name": {
pattern: /^:[\w-]+/,
alias: "symbol"
}
}
},
"markup": {
pattern: /((?:^|\r?\n|\r)[\t ]*)<.+/,
lookbehind: true,
inside: Prism2.languages.markup
},
"doctype": {
pattern: /((?:^|\r?\n|\r)[\t ]*)!!!(?: .+)?/,
lookbehind: true
},
"tag": {
// Allows for one nested group of braces
pattern: /((?:^|\r?\n|\r)[\t ]*)[%.#][\w\-#.]*[\w\-](?:\([^)]+\)|\{(?:\{[^}]+\}|[^{}])+\}|\[[^\]]+\])*[\/<>]*/,
lookbehind: true,
inside: {
"attributes": [
{
// Lookbehind tries to prevent interpolations from breaking it all
// Allows for one nested group of braces
pattern: /(^|[^#])\{(?:\{[^}]+\}|[^{}])+\}/,
lookbehind: true,
inside: Prism2.languages.ruby
},
{
pattern: /\([^)]+\)/,
inside: {
"attr-value": {
pattern: /(=\s*)(?:"(?:\\.|[^\\"\r\n])*"|[^)\s]+)/,
lookbehind: true
},
"attr-name": /[\w:-]+(?=\s*!?=|\s*[,)])/,
"punctuation": /[=(),]/
}
},
{
pattern: /\[[^\]]+\]/,
inside: Prism2.languages.ruby
}
],
"punctuation": /[<>]/
}
},
"code": {
pattern: /((?:^|\r?\n|\r)[\t ]*(?:[~-]|[&!]?=)).+/,
lookbehind: true,
inside: Prism2.languages.ruby
},
// Interpolations in plain text
"interpolation": {
pattern: /#\{[^}]+\}/,
inside: {
"delimiter": {
pattern: /^#\{|\}$/,
alias: "punctuation"
},
"ruby": {
pattern: /[\s\S]+/,
inside: Prism2.languages.ruby
}
}
},
"punctuation": {
pattern: /((?:^|\r?\n|\r)[\t ]*)[~=\-&!]+/,
lookbehind: true
}
};
var filter_pattern = "((?:^|\\r?\\n|\\r)([\\t ]*)):{{filter_name}}(?:(?:\\r?\\n|\\r)(?:\\2[\\t ].+|\\s*?(?=\\r?\\n|\\r)))+";
var filters = [
"css",
{ filter: "coffee", language: "coffeescript" },
"erb",
"javascript",
"less",
"markdown",
"ruby",
"scss",
"textile"
];
var all_filters = {};
for (var i = 0, l = filters.length; i < l; i++) {
var filter = filters[i];
filter = typeof filter === "string" ? { filter, language: filter } : filter;
if (Prism2.languages[filter.language]) {
all_filters["filter-" + filter.filter] = {
pattern: RegExp(filter_pattern.replace("{{filter_name}}", function() {
return filter.filter;
})),
lookbehind: true,
inside: {
"filter-name": {
pattern: /^:[\w-]+/,
alias: "symbol"
},
"text": {
pattern: /[\s\S]+/,
alias: [filter.language, "language-" + filter.language],
inside: Prism2.languages[filter.language]
}
}
};
}
}
Prism2.languages.insertBefore("haml", "filter", all_filters);
})(Prism);
(function(Prism2) {
Prism2.languages.handlebars = {
"comment": /\{\{![\s\S]*?\}\}/,
"delimiter": {
pattern: /^\{\{\{?|\}\}\}?$/,
alias: "punctuation"
},
"string": /(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,
"number": /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][+-]?\d+)?/,
"boolean": /\b(?:false|true)\b/,
"block": {
pattern: /^(\s*(?:~\s*)?)[#\/]\S+?(?=\s*(?:~\s*)?$|\s)/,
lookbehind: true,
alias: "keyword"
},
"brackets": {
pattern: /\[[^\]]+\]/,
inside: {
punctuation: /\[|\]/,
variable: /[\s\S]+/
}
},
"punctuation": /[!"#%&':()*+,.\/;<=>@\[\\\]^`{|}~]/,
"variable": /[^!"#%&'()*+,\/;<=>@\[\\\]^`{|}~\s]+/
};
Prism2.hooks.add("before-tokenize", function(env) {
var handlebarsPattern = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/g;
Prism2.languages["markup-templating"].buildPlaceholders(env, "handlebars", handlebarsPattern);
});
Prism2.hooks.add("after-tokenize", function(env) {
Prism2.languages["markup-templating"].tokenizePlaceholders(env, "handlebars");
});
Prism2.languages.hbs = Prism2.languages.handlebars;
Prism2.languages.mustache = Prism2.languages.handlebars;
})(Prism);
Prism.languages.haskell = {
"comment": {
pattern: /(^|[^-!#$%*+=?&@|~.:<>^\\\/])(?:--(?:(?=.)[^-!#$%*+=?&@|~.:<>^\\\/].*|$)|\{-[\s\S]*?-\})/m,
lookbehind: true
},
"char": {
pattern: /'(?:[^\\']|\\(?:[abfnrtv\\"'&]|\^[A-Z@[\]^_]|ACK|BEL|BS|CAN|CR|DC1|DC2|DC3|DC4|DEL|DLE|EM|ENQ|EOT|ESC|ETB|ETX|FF|FS|GS|HT|LF|NAK|NUL|RS|SI|SO|SOH|SP|STX|SUB|SYN|US|VT|\d+|o[0-7]+|x[0-9a-fA-F]+))'/,
alias: "string"
},
"string": {
pattern: /"(?:[^\\"]|\\(?:\S|\s+\\))*"/,
greedy: true
},
"keyword": /\b(?:case|class|data|deriving|do|else|if|in|infixl|infixr|instance|let|module|newtype|of|primitive|then|type|where)\b/,
"import-statement": {
// The imported or hidden names are not included in this import
// statement. This is because we want to highlight those exactly like
// we do for the names in the program.
pattern: /(^[\t ]*)import\s+(?:qualified\s+)?(?:[A-Z][\w']*)(?:\.[A-Z][\w']*)*(?:\s+as\s+(?:[A-Z][\w']*)(?:\.[A-Z][\w']*)*)?(?:\s+hiding\b)?/m,
lookbehind: true,
inside: {
"keyword": /\b(?:as|hiding|import|qualified)\b/,
"punctuation": /\./
}
},
// These are builtin variables only. Constructors are highlighted later as a constant.
"builtin": /\b(?:abs|acos|acosh|all|and|any|appendFile|approxRational|asTypeOf|asin|asinh|atan|atan2|atanh|basicIORun|break|catch|ceiling|chr|compare|concat|concatMap|const|cos|cosh|curry|cycle|decodeFloat|denominator|digitToInt|div|divMod|drop|dropWhile|either|elem|encodeFloat|enumFrom|enumFromThen|enumFromThenTo|enumFromTo|error|even|exp|exponent|fail|filter|flip|floatDigits|floatRadix|floatRange|floor|fmap|foldl|foldl1|foldr|foldr1|fromDouble|fromEnum|fromInt|fromInteger|fromIntegral|fromRational|fst|gcd|getChar|getContents|getLine|group|head|id|inRange|index|init|intToDigit|interact|ioError|isAlpha|isAlphaNum|isAscii|isControl|isDenormalized|isDigit|isHexDigit|isIEEE|isInfinite|isLower|isNaN|isNegativeZero|isOctDigit|isPrint|isSpace|isUpper|iterate|last|lcm|length|lex|lexDigits|lexLitChar|lines|log|logBase|lookup|map|mapM|mapM_|max|maxBound|maximum|maybe|min|minBound|minimum|mod|negate|not|notElem|null|numerator|odd|or|ord|otherwise|pack|pi|pred|primExitWith|print|product|properFraction|putChar|putStr|putStrLn|quot|quotRem|range|rangeSize|read|readDec|readFile|readFloat|readHex|readIO|readInt|readList|readLitChar|readLn|readOct|readParen|readSigned|reads|readsPrec|realToFrac|recip|rem|repeat|replicate|return|reverse|round|scaleFloat|scanl|scanl1|scanr|scanr1|seq|sequence|sequence_|show|showChar|showInt|showList|showLitChar|showParen|showSigned|showString|shows|showsPrec|significand|signum|sin|sinh|snd|sort|span|splitAt|sqrt|subtract|succ|sum|tail|take|takeWhile|tan|tanh|threadToIOResult|toEnum|toInt|toInteger|toLower|toRational|toUpper|truncate|uncurry|undefined|unlines|until|unwords|unzip|unzip3|userError|words|writeFile|zip|zip3|zipWith|zipWith3)\b/,
// decimal integers and floating point numbers | octal integers | hexadecimal integers
"number": /\b(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?|0o[0-7]+|0x[0-9a-f]+)\b/i,
"operator": [
{
// infix operator
pattern: /`(?:[A-Z][\w']*\.)*[_a-z][\w']*`/,
greedy: true
},
{
// function composition
pattern: /(\s)\.(?=\s)/,
lookbehind: true
},
// Most of this is needed because of the meaning of a single '.'.
// If it stands alone freely, it is the function composition.
// It may also be a separator between a module name and an identifier => no
// operator. If it comes together with other special characters it is an
// operator too.
//
// This regex means: /[-!#$%*+=?&@|~.:<>^\\\/]+/ without /\./.
/[-!#$%*+=?&@|~:<>^\\\/][-!#$%*+=?&@|~.:<>^\\\/]*|\.[-!#$%*+=?&@|~.:<>^\\\/]+/
],
// In Haskell, nearly everything is a variable, do not highlight these.
"hvariable": {
pattern: /\b(?:[A-Z][\w']*\.)*[_a-z][\w']*/,
inside: {
"punctuation": /\./
}
},
"constant": {
pattern: /\b(?:[A-Z][\w']*\.)*[A-Z][\w']*/,
inside: {
"punctuation": /\./
}
},
"punctuation": /[{}[\];(),.:]/
};
Prism.languages.hs = Prism.languages.haskell;
Prism.languages.haxe = Prism.languages.extend("clike", {
"string": {
// Strings can be multi-line
pattern: /"(?:[^"\\]|\\[\s\S])*"/,
greedy: true
},
"class-name": [
{
pattern: /(\b(?:abstract|class|enum|extends|implements|interface|new|typedef)\s+)[A-Z_]\w*/,
lookbehind: true
},
// based on naming convention
/\b[A-Z]\w*/
],
// The final look-ahead prevents highlighting of keywords if expressions such as "haxe.macro.Expr"
"keyword": /\bthis\b|\b(?:abstract|as|break|case|cast|catch|class|continue|default|do|dynamic|else|enum|extends|extern|final|for|from|function|if|implements|import|in|inline|interface|macro|new|null|operator|overload|override|package|private|public|return|static|super|switch|throw|to|try|typedef|untyped|using|var|while)(?!\.)\b/,
"function": {
pattern: /\b[a-z_]\w*(?=\s*(?:<[^<>]*>\s*)?\()/i,
greedy: true
},
"operator": /\.{3}|\+\+|--|&&|\|\||->|=>|(?:<<?|>{1,3}|[-+*/%!=&|^])=?|[?:~]/
});
Prism.languages.insertBefore("haxe", "string", {
"string-interpolation": {
pattern: /'(?:[^'\\]|\\[\s\S])*'/,
greedy: true,
inside: {
"interpolation": {
pattern: /(^|[^\\])\$(?:\w+|\{[^{}]+\})/,
lookbehind: true,
inside: {
"interpolation-punctuation": {
pattern: /^\$\{?|\}$/,
alias: "punctuation"
},
"expression": {
pattern: /[\s\S]+/,
inside: Prism.languages.haxe
}
}
},
"string": /[\s\S]+/
}
}
});
Prism.languages.insertBefore("haxe", "class-name", {
"regex": {
pattern: /~\/(?:[^\/\\\r\n]|\\.)+\/[a-z]*/,
greedy: true,
inside: {
"regex-flags": /\b[a-z]+$/,
"regex-source": {
pattern: /^(~\/)[\s\S]+(?=\/$)/,
lookbehind: true,
alias: "language-regex",
inside: Prism.languages.regex
},
"regex-delimiter": /^~\/|\/$/
}
}
});
Prism.languages.insertBefore("haxe", "keyword", {
"preprocessor": {
pattern: /#(?:else|elseif|end|if)\b.*/,
alias: "property"
},
"metadata": {
pattern: /@:?[\w.]+/,
alias: "symbol"
},
"reification": {
pattern: /\$(?:\w+|(?=\{))/,
alias: "important"
}
});
Prism.languages.hcl = {
"comment": /(?:\/\/|#).*|\/\*[\s\S]*?(?:\*\/|$)/,
"heredoc": {
pattern: /<<-?(\w+\b)[\s\S]*?^[ \t]*\1/m,
greedy: true,
alias: "string"
},
"keyword": [
{
pattern: /(?:data|resource)\s+(?:"(?:\\[\s\S]|[^\\"])*")(?=\s+"[\w-]+"\s+\{)/i,
inside: {
"type": {
pattern: /(resource|data|\s+)(?:"(?:\\[\s\S]|[^\\"])*")/i,
lookbehind: true,
alias: "variable"
}
}
},
{
pattern: /(?:backend|module|output|provider|provisioner|variable)\s+(?:[\w-]+|"(?:\\[\s\S]|[^\\"])*")\s+(?=\{)/i,
inside: {
"type": {
pattern: /(backend|module|output|provider|provisioner|variable)\s+(?:[\w-]+|"(?:\\[\s\S]|[^\\"])*")\s+/i,
lookbehind: true,
alias: "variable"
}
}
},
/[\w-]+(?=\s+\{)/
],
"property": [
/[-\w\.]+(?=\s*=(?!=))/,
/"(?:\\[\s\S]|[^\\"])+"(?=\s*[:=])/
],
"string": {
pattern: /"(?:[^\\$"]|\\[\s\S]|\$(?:(?=")|\$+(?!\$)|[^"${])|\$\{(?:[^{}"]|"(?:[^\\"]|\\[\s\S])*")*\})*"/,
greedy: true,
inside: {
"interpolation": {
pattern: /(^|[^$])\$\{(?:[^{}"]|"(?:[^\\"]|\\[\s\S])*")*\}/,
lookbehind: true,
inside: {
"type": {
pattern: /(\b(?:count|data|local|module|path|self|terraform|var)\b\.)[\w\*]+/i,
lookbehind: true,
alias: "variable"
},
"keyword": /\b(?:count|data|local|module|path|self|terraform|var)\b/i,
"function": /\w+(?=\()/,
"string": {
pattern: /"(?:\\[\s\S]|[^\\"])*"/,
greedy: true
},
"number": /\b0x[\da-f]+\b|\b\d+(?:\.\d*)?(?:e[+-]?\d+)?/i,
"punctuation": /[!\$#%&'()*+,.\/;<=>@\[\\\]^`{|}~?:]/
}
}
}
},
"number": /\b0x[\da-f]+\b|\b\d+(?:\.\d*)?(?:e[+-]?\d+)?/i,
"boolean": /\b(?:false|true)\b/i,
"punctuation": /[=\[\]{}]/
};
Prism.languages.hlsl = Prism.languages.extend("c", {
// Regarding keywords and class names:
// The list of all keywords was split into 'keyword' and 'class-name' tokens based on whether they are capitalized.
// https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-keywords
// https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-reserved-words
"class-name": [
Prism.languages.c["class-name"],
/\b(?:AppendStructuredBuffer|BlendState|Buffer|ByteAddressBuffer|CompileShader|ComputeShader|ConsumeStructuredBuffer|DepthStencilState|DepthStencilView|DomainShader|GeometryShader|Hullshader|InputPatch|LineStream|OutputPatch|PixelShader|PointStream|RWBuffer|RWByteAddressBuffer|RWStructuredBuffer|RWTexture(?:1D|1DArray|2D|2DArray|3D)|RasterizerState|RenderTargetView|SamplerComparisonState|SamplerState|StructuredBuffer|Texture(?:1D|1DArray|2D|2DArray|2DMS|2DMSArray|3D|Cube|CubeArray)|TriangleStream|VertexShader)\b/
],
"keyword": [
// HLSL keyword
/\b(?:asm|asm_fragment|auto|break|case|catch|cbuffer|centroid|char|class|column_major|compile|compile_fragment|const|const_cast|continue|default|delete|discard|do|dynamic_cast|else|enum|explicit|export|extern|for|friend|fxgroup|goto|groupshared|if|in|inline|inout|interface|line|lineadj|linear|long|matrix|mutable|namespace|new|nointerpolation|noperspective|operator|out|packoffset|pass|pixelfragment|point|precise|private|protected|public|register|reinterpret_cast|return|row_major|sample|sampler|shared|short|signed|sizeof|snorm|stateblock|stateblock_state|static|static_cast|string|struct|switch|tbuffer|technique|technique10|technique11|template|texture|this|throw|triangle|triangleadj|try|typedef|typename|uniform|union|unorm|unsigned|using|vector|vertexfragment|virtual|void|volatile|while)\b/,
// scalar, vector, and matrix types
/\b(?:bool|double|dword|float|half|int|min(?:10float|12int|16(?:float|int|uint))|uint)(?:[1-4](?:x[1-4])?)?\b/
],
// https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-grammar#floating-point-numbers
"number": /(?:(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[eE][+-]?\d+)?|\b0x[\da-fA-F]+)[fFhHlLuU]?\b/,
"boolean": /\b(?:false|true)\b/
});
Prism.languages.hoon = {
"comment": {
pattern: /::.*/,
greedy: true
},
"string": {
pattern: /"[^"]*"|'[^']*'/,
greedy: true
},
"constant": /%(?:\.[ny]|[\w-]+)/,
"class-name": /@(?:[a-z0-9-]*[a-z0-9])?|\*/i,
"function": /(?:\+[-+] {2})?(?:[a-z](?:[a-z0-9-]*[a-z0-9])?)/,
"keyword": /\.[\^\+\*=\?]|![><:\.=\?!]|=[>|:,\.\-\^<+;/~\*\?]|\?[>|:\.\-\^<\+&~=@!]|\|[\$_%:\.\-\^~\*=@\?]|\+[|\$\+\*]|:[_\-\^\+~\*]|%[_:\.\-\^\+~\*=]|\^[|:\.\-\+&~\*=\?]|\$[|_%:<>\-\^&~@=\?]|;[:<\+;\/~\*=]|~[>|\$_%<\+\/&=\?!]|--|==/
};
(function(Prism2) {
function headerValueOf(name) {
return RegExp("(^(?:" + name + "):[ ]*(?![ ]))[^]+", "i");
}
Prism2.languages.http = {
"request-line": {
pattern: /^(?:CONNECT|DELETE|GET|HEAD|OPTIONS|PATCH|POST|PRI|PUT|SEARCH|TRACE)\s(?:https?:\/\/|\/)\S*\sHTTP\/[\d.]+/m,
inside: {
// HTTP Method
"method": {
pattern: /^[A-Z]+\b/,
alias: "property"
},
// Request Target e.g. http://example.com, /path/to/file
"request-target": {
pattern: /^(\s)(?:https?:\/\/|\/)\S*(?=\s)/,
lookbehind: true,
alias: "url",
inside: Prism2.languages.uri
},
// HTTP Version
"http-version": {
pattern: /^(\s)HTTP\/[\d.]+/,
lookbehind: true,
alias: "property"
}
}
},
"response-status": {
pattern: /^HTTP\/[\d.]+ \d+ .+/m,
inside: {
// HTTP Version
"http-version": {
pattern: /^HTTP\/[\d.]+/,
alias: "property"
},
// Status Code
"status-code": {
pattern: /^(\s)\d+(?=\s)/,
lookbehind: true,
alias: "number"
},
// Reason Phrase
"reason-phrase": {
pattern: /^(\s).+/,
lookbehind: true,
alias: "string"
}
}
},
"header": {
pattern: /^[\w-]+:.+(?:(?:\r\n?|\n)[ \t].+)*/m,
inside: {
"header-value": [
{
pattern: headerValueOf(/Content-Security-Policy/.source),
lookbehind: true,
alias: ["csp", "languages-csp"],
inside: Prism2.languages.csp
},
{
pattern: headerValueOf(/Public-Key-Pins(?:-Report-Only)?/.source),
lookbehind: true,
alias: ["hpkp", "languages-hpkp"],
inside: Prism2.languages.hpkp
},
{
pattern: headerValueOf(/Strict-Transport-Security/.source),
lookbehind: true,
alias: ["hsts", "languages-hsts"],
inside: Prism2.languages.hsts
},
{
pattern: headerValueOf(/[^:]+/.source),
lookbehind: true
}
],
"header-name": {
pattern: /^[^:]+/,
alias: "keyword"
},
"punctuation": /^:/
}
}
};
var langs = Prism2.languages;
var httpLanguages = {
"application/javascript": langs.javascript,
"application/json": langs.json || langs.javascript,
"application/xml": langs.xml,
"text/xml": langs.xml,
"text/html": langs.html,
"text/css": langs.css,
"text/plain": langs.plain
};
var suffixTypes = {
"application/json": true,
"application/xml": true
};
function getSuffixPattern(contentType2) {
var suffix = contentType2.replace(/^[a-z]+\//, "");
var suffixPattern = "\\w+/(?:[\\w.-]+\\+)+" + suffix + "(?![+\\w.-])";
return "(?:" + contentType2 + "|" + suffixPattern + ")";
}
var options;
for (var contentType in httpLanguages) {
if (httpLanguages[contentType]) {
options = options || {};
var pattern = suffixTypes[contentType] ? getSuffixPattern(contentType) : contentType;
options[contentType.replace(/\//g, "-")] = {
pattern: RegExp(
"(" + /content-type:\s*/.source + pattern + /(?:(?:\r\n?|\n)[\w-].*)*(?:\r(?:\n|(?!\n))|\n)/.source + ")" + // This is a little interesting:
// The HTTP format spec required 1 empty line before the body to make everything unambiguous.
// However, when writing code by hand (e.g. to display on a website) people can forget about this,
// so we want to be liberal here. We will allow the empty line to be omitted if the first line of
// the body does not start with a [\w-] character (as headers do).
/[^ \t\w-][\s\S]*/.source,
"i"
),
lookbehind: true,
inside: httpLanguages[contentType]
};
}
}
if (options) {
Prism2.languages.insertBefore("http", "header", options);
}
})(Prism);
Prism.languages.hpkp = {
"directive": {
pattern: /\b(?:includeSubDomains|max-age|pin-sha256|preload|report-to|report-uri|strict)(?=[\s;=]|$)/i,
alias: "property"
},
"operator": /=/,
"punctuation": /;/
};
Prism.languages.hsts = {
"directive": {
pattern: /\b(?:includeSubDomains|max-age|preload)(?=[\s;=]|$)/i,
alias: "property"
},
"operator": /=/,
"punctuation": /;/
};
Prism.languages.ichigojam = {
"comment": /(?:\B'|REM)(?:[^\n\r]*)/i,
"string": {
pattern: /"(?:""|[!#$%&'()*,\/:;<=>?^\w +\-.])*"/,
greedy: true
},
"number": /\B#[0-9A-F]+|\B`[01]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,
"keyword": /\b(?:BEEP|BPS|CASE|CLEAR|CLK|CLO|CLP|CLS|CLT|CLV|CONT|COPY|ELSE|END|FILE|FILES|FOR|GOSUB|GOTO|GSB|IF|INPUT|KBD|LED|LET|LIST|LOAD|LOCATE|LRUN|NEW|NEXT|OUT|PLAY|POKE|PRINT|PWM|REM|RENUM|RESET|RETURN|RIGHT|RTN|RUN|SAVE|SCROLL|SLEEP|SRND|STEP|STOP|SUB|TEMPO|THEN|TO|UART|VIDEO|WAIT)(?:\$|\b)/i,
"function": /\b(?:ABS|ANA|ASC|BIN|BTN|DEC|END|FREE|HELP|HEX|I2CR|I2CW|IN|INKEY|LEN|LINE|PEEK|RND|SCR|SOUND|STR|TICK|USR|VER|VPEEK|ZER)(?:\$|\b)/i,
"label": /(?:\B@\S+)/,
"operator": /<[=>]?|>=?|\|\||&&|[+\-*\/=|&^~!]|\b(?:AND|NOT|OR)\b/i,
"punctuation": /[\[,;:()\]]/
};
Prism.languages.icon = {
"comment": /#.*/,
"string": {
pattern: /(["'])(?:(?!\1)[^\\\r\n_]|\\.|_(?!\1)(?:\r\n|[\s\S]))*\1/,
greedy: true
},
"number": /\b(?:\d+r[a-z\d]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)\b|\.\d+\b/i,
"builtin-keyword": {
pattern: /&(?:allocated|ascii|clock|collections|cset|current|date|dateline|digits|dump|e|error(?:number|text|value)?|errout|fail|features|file|host|input|lcase|letters|level|line|main|null|output|phi|pi|pos|progname|random|regions|source|storage|subject|time|trace|ucase|version)\b/,
alias: "variable"
},
"directive": {
pattern: /\$\w+/,
alias: "builtin"
},
"keyword": /\b(?:break|by|case|create|default|do|else|end|every|fail|global|if|initial|invocable|link|local|next|not|of|procedure|record|repeat|return|static|suspend|then|to|until|while)\b/,
"function": /\b(?!\d)\w+(?=\s*[({]|\s*!\s*\[)/,
"operator": /[+-]:(?!=)|(?:[\/?@^%&]|\+\+?|--?|==?=?|~==?=?|\*\*?|\|\|\|?|<(?:->?|<?=?)|>>?=?)(?::=)?|:(?:=:?)?|[!.\\|~]/,
"punctuation": /[\[\](){},;]/
};
(function(Prism2) {
function nested(source, level) {
if (level <= 0) {
return /[]/.source;
} else {
return source.replace(/<SELF>/g, function() {
return nested(source, level - 1);
});
}
}
var stringPattern = /'[{}:=,](?:[^']|'')*'(?!')/;
var escape = {
pattern: /''/,
greedy: true,
alias: "operator"
};
var string = {
pattern: stringPattern,
greedy: true,
inside: {
"escape": escape
}
};
var argumentSource = nested(
/\{(?:[^{}']|'(?![{},'])|''|<STR>|<SELF>)*\}/.source.replace(/<STR>/g, function() {
return stringPattern.source;
}),
8
);
var nestedMessage = {
pattern: RegExp(argumentSource),
inside: {
"message": {
pattern: /^(\{)[\s\S]+(?=\}$)/,
lookbehind: true,
inside: null
// see below
},
"message-delimiter": {
pattern: /./,
alias: "punctuation"
}
}
};
Prism2.languages["icu-message-format"] = {
"argument": {
pattern: RegExp(argumentSource),
greedy: true,
inside: {
"content": {
pattern: /^(\{)[\s\S]+(?=\}$)/,
lookbehind: true,
inside: {
"argument-name": {
pattern: /^(\s*)[^{}:=,\s]+/,
lookbehind: true
},
"choice-style": {
// https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/classicu_1_1ChoiceFormat.html#details
pattern: /^(\s*,\s*choice\s*,\s*)\S(?:[\s\S]*\S)?/,
lookbehind: true,
inside: {
"punctuation": /\|/,
"range": {
pattern: /^(\s*)[+-]?(?:\d+(?:\.\d*)?|\u221e)\s*[<#\u2264]/,
lookbehind: true,
inside: {
"operator": /[<#\u2264]/,
"number": /\S+/
}
},
rest: null
// see below
}
},
"plural-style": {
// https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/PluralFormat.html#:~:text=Patterns%20and%20Their%20Interpretation
pattern: /^(\s*,\s*(?:plural|selectordinal)\s*,\s*)\S(?:[\s\S]*\S)?/,
lookbehind: true,
inside: {
"offset": /^offset:\s*\d+/,
"nested-message": nestedMessage,
"selector": {
pattern: /=\d+|[^{}:=,\s]+/,
inside: {
"keyword": /^(?:few|many|one|other|two|zero)$/
}
}
}
},
"select-style": {
// https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/SelectFormat.html#:~:text=Patterns%20and%20Their%20Interpretation
pattern: /^(\s*,\s*select\s*,\s*)\S(?:[\s\S]*\S)?/,
lookbehind: true,
inside: {
"nested-message": nestedMessage,
"selector": {
pattern: /[^{}:=,\s]+/,
inside: {
"keyword": /^other$/
}
}
}
},
"keyword": /\b(?:choice|plural|select|selectordinal)\b/,
"arg-type": {
pattern: /\b(?:date|duration|number|ordinal|spellout|time)\b/,
alias: "keyword"
},
"arg-skeleton": {
pattern: /(,\s*)::[^{}:=,\s]+/,
lookbehind: true
},
"arg-style": {
pattern: /(,\s*)(?:currency|full|integer|long|medium|percent|short)(?=\s*$)/,
lookbehind: true
},
"arg-style-text": {
pattern: RegExp(/(^\s*,\s*(?=\S))/.source + nested(/(?:[^{}']|'[^']*'|\{(?:<SELF>)?\})+/.source, 8) + "$"),
lookbehind: true,
alias: "string"
},
"punctuation": /,/
}
},
"argument-delimiter": {
pattern: /./,
alias: "operator"
}
}
},
"escape": escape,
"string": string
};
nestedMessage.inside.message.inside = Prism2.languages["icu-message-format"];
Prism2.languages["icu-message-format"].argument.inside.content.inside["choice-style"].inside.rest = Prism2.languages["icu-message-format"];
})(Prism);
Prism.languages.idris = Prism.languages.extend("haskell", {
"comment": {
pattern: /(?:(?:--|\|\|\|).*$|\{-[\s\S]*?-\})/m
},
"keyword": /\b(?:Type|case|class|codata|constructor|corecord|data|do|dsl|else|export|if|implementation|implicit|import|impossible|in|infix|infixl|infixr|instance|interface|let|module|mutual|namespace|of|parameters|partial|postulate|private|proof|public|quoteGoal|record|rewrite|syntax|then|total|using|where|with)\b/,
"builtin": void 0
});
Prism.languages.insertBefore("idris", "keyword", {
"import-statement": {
pattern: /(^\s*import\s+)(?:[A-Z][\w']*)(?:\.[A-Z][\w']*)*/m,
lookbehind: true,
inside: {
"punctuation": /\./
}
}
});
Prism.languages.idr = Prism.languages.idris;
(function(Prism2) {
Prism2.languages.ignore = {
// https://git-scm.com/docs/gitignore
"comment": /^#.*/m,
"entry": {
pattern: /\S(?:.*(?:(?:\\ )|\S))?/,
alias: "string",
inside: {
"operator": /^!|\*\*?|\?/,
"regex": {
pattern: /(^|[^\\])\[[^\[\]]*\]/,
lookbehind: true
},
"punctuation": /\//
}
}
};
Prism2.languages.gitignore = Prism2.languages.ignore;
Prism2.languages.hgignore = Prism2.languages.ignore;
Prism2.languages.npmignore = Prism2.languages.ignore;
})(Prism);
Prism.languages.inform7 = {
"string": {
pattern: /"[^"]*"/,
inside: {
"substitution": {
pattern: /\[[^\[\]]+\]/,
inside: {
"delimiter": {
pattern: /\[|\]/,
alias: "punctuation"
}
// See rest below
}
}
}
},
"comment": {
pattern: /\[[^\[\]]+\]/,
greedy: true
},
"title": {
pattern: /^[ \t]*(?:book|chapter|part(?! of)|section|table|volume)\b.+/im,
alias: "important"
},
"number": {
pattern: /(^|[^-])(?:\b\d+(?:\.\d+)?(?:\^\d+)?(?:(?!\d)\w+)?|\b(?:eight|eleven|five|four|nine|one|seven|six|ten|three|twelve|two))\b(?!-)/i,
lookbehind: true
},
"verb": {
pattern: /(^|[^-])\b(?:answering|applying to|are|asking|attacking|be(?:ing)?|burning|buying|called|carries|carry(?! out)|carrying|climbing|closing|conceal(?:ing|s)?|consulting|contain(?:ing|s)?|cutting|drinking|dropping|eating|enclos(?:es?|ing)|entering|examining|exiting|getting|giving|going|ha(?:s|ve|ving)|hold(?:ing|s)?|impl(?:ies|y)|incorporat(?:es?|ing)|inserting|is|jumping|kissing|listening|locking|looking|mean(?:ing|s)?|opening|provid(?:es?|ing)|pulling|pushing|putting|relat(?:es?|ing)|removing|searching|see(?:ing|s)?|setting|showing|singing|sleeping|smelling|squeezing|support(?:ing|s)?|swearing|switching|taking|tasting|telling|thinking|throwing|touching|turning|tying|unlock(?:ing|s)?|var(?:ies|y|ying)|waiting|waking|waving|wear(?:ing|s)?)\b(?!-)/i,
lookbehind: true,
alias: "operator"
},
"keyword": {
pattern: /(^|[^-])\b(?:after|before|carry out|check|continue the action|definition(?= *:)|do nothing|else|end (?:if|the story|unless)|every turn|if|include|instead(?: of)?|let|move|no|now|otherwise|repeat|report|resume the story|rule for|running through|say(?:ing)?|stop the action|test|try(?:ing)?|understand|unless|use|when|while|yes)\b(?!-)/i,
lookbehind: true
},
"property": {
pattern: /(^|[^-])\b(?:adjacent(?! to)|carried|closed|concealed|contained|dark|described|edible|empty|enclosed|enterable|even|female|fixed in place|full|handled|held|improper-named|incorporated|inedible|invisible|lighted|lit|lock(?:able|ed)|male|marked for listing|mentioned|negative|neuter|non-(?:empty|full|recurring)|odd|opaque|open(?:able)?|plural-named|portable|positive|privately-named|proper-named|provided|publically-named|pushable between rooms|recurring|related|rubbing|scenery|seen|singular-named|supported|swinging|switch(?:able|ed(?: off| on)?)|touch(?:able|ed)|transparent|unconcealed|undescribed|unlit|unlocked|unmarked for listing|unmentioned|unopenable|untouchable|unvisited|variable|visible|visited|wearable|worn)\b(?!-)/i,
lookbehind: true,
alias: "symbol"
},
"position": {
pattern: /(^|[^-])\b(?:above|adjacent to|back side of|below|between|down|east|everywhere|front side|here|in|inside(?: from)?|north(?:east|west)?|nowhere|on(?: top of)?|other side|outside(?: from)?|parts? of|regionally in|south(?:east|west)?|through|up|west|within)\b(?!-)/i,
lookbehind: true,
alias: "keyword"
},
"type": {
pattern: /(^|[^-])\b(?:actions?|activit(?:ies|y)|actors?|animals?|backdrops?|containers?|devices?|directions?|doors?|holders?|kinds?|lists?|m[ae]n|nobody|nothing|nouns?|numbers?|objects?|people|persons?|player(?:'s holdall)?|regions?|relations?|rooms?|rule(?:book)?s?|scenes?|someone|something|supporters?|tables?|texts?|things?|time|vehicles?|wom[ae]n)\b(?!-)/i,
lookbehind: true,
alias: "variable"
},
"punctuation": /[.,:;(){}]/
};
Prism.languages.inform7["string"].inside["substitution"].inside.rest = Prism.languages.inform7;
Prism.languages.inform7["string"].inside["substitution"].inside.rest.text = {
pattern: /\S(?:\s*\S)*/,
alias: "comment"
};
Prism.languages.ini = {
/**
* The component mimics the behavior of the Win32 API parser.
*
* @see {@link https://github.com/PrismJS/prism/issues/2775#issuecomment-787477723}
*/
"comment": {
pattern: /(^[ \f\t\v]*)[#;][^\n\r]*/m,
lookbehind: true
},
"section": {
pattern: /(^[ \f\t\v]*)\[[^\n\r\]]*\]?/m,
lookbehind: true,
inside: {
"section-name": {
pattern: /(^\[[ \f\t\v]*)[^ \f\t\v\]]+(?:[ \f\t\v]+[^ \f\t\v\]]+)*/,
lookbehind: true,
alias: "selector"
},
"punctuation": /\[|\]/
}
},
"key": {
pattern: /(^[ \f\t\v]*)[^ \f\n\r\t\v=]+(?:[ \f\t\v]+[^ \f\n\r\t\v=]+)*(?=[ \f\t\v]*=)/m,
lookbehind: true,
alias: "attr-name"
},
"value": {
pattern: /(=[ \f\t\v]*)[^ \f\n\r\t\v]+(?:[ \f\t\v]+[^ \f\n\r\t\v]+)*/,
lookbehind: true,
alias: "attr-value",
inside: {
"inner-value": {
pattern: /^("|').+(?=\1$)/,
lookbehind: true
}
}
},
"punctuation": /=/
};
Prism.languages.io = {
"comment": {
pattern: /(^|[^\\])(?:\/\*[\s\S]*?(?:\*\/|$)|\/\/.*|#.*)/,
lookbehind: true,
greedy: true
},
"triple-quoted-string": {
pattern: /"""(?:\\[\s\S]|(?!""")[^\\])*"""/,
greedy: true,
alias: "string"
},
"string": {
pattern: /"(?:\\.|[^\\\r\n"])*"/,
greedy: true
},
"keyword": /\b(?:activate|activeCoroCount|asString|block|break|call|catch|clone|collectGarbage|compileString|continue|do|doFile|doMessage|doString|else|elseif|exit|for|foreach|forward|getEnvironmentVariable|getSlot|hasSlot|if|ifFalse|ifNil|ifNilEval|ifTrue|isActive|isNil|isResumable|list|message|method|parent|pass|pause|perform|performWithArgList|print|println|proto|raise|raiseResumable|removeSlot|resend|resume|schedulerSleepSeconds|self|sender|setSchedulerSleepSeconds|setSlot|shallowCopy|slotNames|super|system|then|thisBlock|thisContext|try|type|uniqueId|updateSlot|wait|while|write|yield)\b/,
"builtin": /\b(?:Array|AudioDevice|AudioMixer|BigNum|Block|Box|Buffer|CFunction|CGI|Color|Curses|DBM|DNSResolver|DOConnection|DOProxy|DOServer|Date|Directory|Duration|DynLib|Error|Exception|FFT|File|Fnmatch|Font|Future|GL|GLE|GLScissor|GLU|GLUCylinder|GLUQuadric|GLUSphere|GLUT|Host|Image|Importer|LinkList|List|Lobby|Locals|MD5|MP3Decoder|MP3Encoder|Map|Message|Movie|Notification|Number|Object|OpenGL|Point|Protos|Random|Regex|SGML|SGMLElement|SGMLParser|SQLite|Sequence|Server|ShowMessage|SleepyCat|SleepyCatCursor|Socket|SocketManager|Sound|Soup|Store|String|Tree|UDPSender|UPDReceiver|URL|User|Warning|WeakLink)\b/,
"boolean": /\b(?:false|nil|true)\b/,
"number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e-?\d+)?/i,
"operator": /[=!*/%+\-^&|]=|>>?=?|<<?=?|:?:?=|\+\+?|--?|\*\*?|\/\/?|%|\|\|?|&&?|\b(?:and|not|or|return)\b|@@?|\?\??|\.\./,
"punctuation": /[{}[\];(),.:]/
};
Prism.languages.j = {
"comment": {
pattern: /\bNB\..*/,
greedy: true
},
"string": {
pattern: /'(?:''|[^'\r\n])*'/,
greedy: true
},
"keyword": /\b(?:(?:CR|LF|adverb|conjunction|def|define|dyad|monad|noun|verb)\b|(?:assert|break|case|catch[dt]?|continue|do|else|elseif|end|fcase|for|for_\w+|goto_\w+|if|label_\w+|return|select|throw|try|while|whilst)\.)/,
"verb": {
// Negative look-ahead prevents bad highlighting
// of ^: ;. =. =: !. !:
pattern: /(?!\^:|;\.|[=!][.:])(?:\{(?:\.|::?)?|p(?:\.\.?|:)|[=!\]]|[<>+*\-%$|,#][.:]?|[?^]\.?|[;\[]:?|[~}"i][.:]|[ACeEIjLor]\.|(?:[_\/\\qsux]|_?\d):)/,
alias: "keyword"
},
"number": /\b_?(?:(?!\d:)\d+(?:\.\d+)?(?:(?:ad|ar|[ejpx])_?\d+(?:\.\d+)?)*(?:b_?[\da-z]+(?:\.[\da-z]+)?)?|_\b(?!\.))/,
"adverb": {
pattern: /[~}]|[\/\\]\.?|[bfM]\.|t[.:]/,
alias: "builtin"
},
"operator": /[=a][.:]|_\./,
"conjunction": {
pattern: /&(?:\.:?|:)?|[.:@][.:]?|[!D][.:]|[;dHT]\.|`:?|[\^LS]:|"/,
alias: "variable"
},
"punctuation": /[()]/
};
(function(Prism2) {
var keywords = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/;
var classNamePrefix = /(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source;
var className = {
pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),
lookbehind: true,
inside: {
"namespace": {
pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
inside: {
"punctuation": /\./
}
},
"punctuation": /\./
}
};
Prism2.languages.java = Prism2.languages.extend("clike", {
"string": {
pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,
lookbehind: true,
greedy: true
},
"class-name": [
className,
{
// variables, parameters, and constructor references
// this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),
lookbehind: true,
inside: className.inside
},
{
// class names based on keyword
// this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
pattern: RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source + classNamePrefix + /[A-Z]\w*\b/.source),
lookbehind: true,
inside: className.inside
}
],
"keyword": keywords,
"function": [
Prism2.languages.clike.function,
{
pattern: /(::\s*)[a-z_]\w*/,
lookbehind: true
}
],
"number": /\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,
"operator": {
pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,
lookbehind: true
}
});
Prism2.languages.insertBefore("java", "string", {
"triple-quoted-string": {
// http://openjdk.java.net/jeps/355#Description
pattern: /"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,
greedy: true,
alias: "string"
},
"char": {
pattern: /'(?:\\.|[^'\\\r\n]){1,6}'/,
greedy: true
}
});
Prism2.languages.insertBefore("java", "class-name", {
"annotation": {
pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/,
lookbehind: true,
alias: "punctuation"
},
"generics": {
pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,
inside: {
"class-name": className,
"keyword": keywords,
"punctuation": /[<>(),.:]/,
"operator": /[?&|]/
}
},
"import": [
{
pattern: RegExp(/(\bimport\s+)/.source + classNamePrefix + /(?:[A-Z]\w*|\*)(?=\s*;)/.source),
lookbehind: true,
inside: {
"namespace": className.inside.namespace,
"punctuation": /\./,
"operator": /\*/,
"class-name": /\w+/
}
},
{
pattern: RegExp(/(\bimport\s+static\s+)/.source + classNamePrefix + /(?:\w+|\*)(?=\s*;)/.source),
lookbehind: true,
alias: "static",
inside: {
"namespace": className.inside.namespace,
"static": /\b\w+$/,
"punctuation": /\./,
"operator": /\*/,
"class-name": /\w+/
}
}
],
"namespace": {
pattern: RegExp(
/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g, function() {
return keywords.source;
})
),
lookbehind: true,
inside: {
"punctuation": /\./
}
}
});
})(Prism);
(function(Prism2) {
var comment = /\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/;
var constant = [
{
pattern: /\b(?:false|true)\b/i,
alias: "boolean"
},
{
pattern: /(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,
greedy: true,
lookbehind: true
},
{
pattern: /(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,
greedy: true,
lookbehind: true
},
/\b(?:null)\b/i,
/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/
];
var number = /\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i;
var operator = /<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/;
var punctuation = /[{}\[\](),:;]/;
Prism2.languages.php = {
"delimiter": {
pattern: /\?>$|^<\?(?:php(?=\s)|=)?/i,
alias: "important"
},
"comment": comment,
"variable": /\$+(?:\w+\b|(?=\{))/,
"package": {
pattern: /(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
lookbehind: true,
inside: {
"punctuation": /\\/
}
},
"class-name-definition": {
pattern: /(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,
lookbehind: true,
alias: "class-name"
},
"function-definition": {
pattern: /(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,
lookbehind: true,
alias: "function"
},
"keyword": [
{
pattern: /(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,
alias: "type-casting",
greedy: true,
lookbehind: true
},
{
pattern: /([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,
alias: "type-hint",
greedy: true,
lookbehind: true
},
{
pattern: /(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,
alias: "return-type",
greedy: true,
lookbehind: true
},
{
pattern: /\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,
alias: "type-declaration",
greedy: true
},
{
pattern: /(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,
alias: "type-declaration",
greedy: true,
lookbehind: true
},
{
pattern: /\b(?:parent|self|static)(?=\s*::)/i,
alias: "static-context",
greedy: true
},
{
// yield from
pattern: /(\byield\s+)from\b/i,
lookbehind: true
},
// `class` is always a keyword unlike other keywords
/\bclass\b/i,
{
// https://www.php.net/manual/en/reserved.keywords.php
//
// keywords cannot be preceded by "->"
// the complex lookbehind means `(?<!(?:->|::)\s*)`
pattern: /((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,
lookbehind: true
}
],
"argument-name": {
pattern: /([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,
lookbehind: true
},
"class-name": [
{
pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,
greedy: true,
lookbehind: true
},
{
pattern: /(\|\s*)\b[a-z_]\w*(?!\\)\b/i,
greedy: true,
lookbehind: true
},
{
pattern: /\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,
greedy: true
},
{
pattern: /(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,
alias: "class-name-fully-qualified",
greedy: true,
lookbehind: true,
inside: {
"punctuation": /\\/
}
},
{
pattern: /(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,
alias: "class-name-fully-qualified",
greedy: true,
inside: {
"punctuation": /\\/
}
},
{
pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
alias: "class-name-fully-qualified",
greedy: true,
lookbehind: true,
inside: {
"punctuation": /\\/
}
},
{
pattern: /\b[a-z_]\w*(?=\s*\$)/i,
alias: "type-declaration",
greedy: true
},
{
pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,
alias: ["class-name-fully-qualified", "type-declaration"],
greedy: true,
inside: {
"punctuation": /\\/
}
},
{
pattern: /\b[a-z_]\w*(?=\s*::)/i,
alias: "static-context",
greedy: true
},
{
pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,
alias: ["class-name-fully-qualified", "static-context"],
greedy: true,
inside: {
"punctuation": /\\/
}
},
{
pattern: /([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,
alias: "type-hint",
greedy: true,
lookbehind: true
},
{
pattern: /([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,
alias: ["class-name-fully-qualified", "type-hint"],
greedy: true,
lookbehind: true,
inside: {
"punctuation": /\\/
}
},
{
pattern: /(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,
alias: "return-type",
greedy: true,
lookbehind: true
},
{
pattern: /(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
alias: ["class-name-fully-qualified", "return-type"],
greedy: true,
lookbehind: true,
inside: {
"punctuation": /\\/
}
}
],
"constant": constant,
"function": {
pattern: /(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,
lookbehind: true,
inside: {
"punctuation": /\\/
}
},
"property": {
pattern: /(->\s*)\w+/,
lookbehind: true
},
"number": number,
"operator": operator,
"punctuation": punctuation
};
var string_interpolation = {
pattern: /\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,
lookbehind: true,
inside: Prism2.languages.php
};
var string = [
{
pattern: /<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,
alias: "nowdoc-string",
greedy: true,
inside: {
"delimiter": {
pattern: /^<<<'[^']+'|[a-z_]\w*;$/i,
alias: "symbol",
inside: {
"punctuation": /^<<<'?|[';]$/
}
}
}
},
{
pattern: /<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,
alias: "heredoc-string",
greedy: true,
inside: {
"delimiter": {
pattern: /^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,
alias: "symbol",
inside: {
"punctuation": /^<<<"?|[";]$/
}
},
"interpolation": string_interpolation
}
},
{
pattern: /`(?:\\[\s\S]|[^\\`])*`/,
alias: "backtick-quoted-string",
greedy: true
},
{
pattern: /'(?:\\[\s\S]|[^\\'])*'/,
alias: "single-quoted-string",
greedy: true
},
{
pattern: /"(?:\\[\s\S]|[^\\"])*"/,
alias: "double-quoted-string",
greedy: true,
inside: {
"interpolation": string_interpolation
}
}
];
Prism2.languages.insertBefore("php", "variable", {
"string": string,
"attribute": {
pattern: /#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,
greedy: true,
inside: {
"attribute-content": {
pattern: /^(#\[)[\s\S]+(?=\]$)/,
lookbehind: true,
// inside can appear subset of php
inside: {
"comment": comment,
"string": string,
"attribute-class-name": [
{
pattern: /([^:]|^)\b[a-z_]\w*(?!\\)\b/i,
alias: "class-name",
greedy: true,
lookbehind: true
},
{
pattern: /([^:]|^)(?:\\?\b[a-z_]\w*)+/i,
alias: [
"class-name",
"class-name-fully-qualified"
],
greedy: true,
lookbehind: true,
inside: {
"punctuation": /\\/
}
}
],
"constant": constant,
"number": number,
"operator": operator,
"punctuation": punctuation
}
},
"delimiter": {
pattern: /^#\[|\]$/,
alias: "punctuation"
}
}
}
});
Prism2.hooks.add("before-tokenize", function(env) {
if (!/<\?/.test(env.code)) {
return;
}
var phpPattern = /<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;
Prism2.languages["markup-templating"].buildPlaceholders(env, "php", phpPattern);
});
Prism2.hooks.add("after-tokenize", function(env) {
Prism2.languages["markup-templating"].tokenizePlaceholders(env, "php");
});
})(Prism);
(function(Prism2) {
var javaDocLike = Prism2.languages.javadoclike = {
"parameter": {
pattern: /(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*@(?:arg|arguments|param)\s+)\w+/m,
lookbehind: true
},
"keyword": {
// keywords are the first word in a line preceded be an `@` or surrounded by curly braces.
// @word, {@word}
pattern: /(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*|\{)@[a-z][a-zA-Z-]+\b/m,
lookbehind: true
},
"punctuation": /[{}]/
};
function docCommentSupport(lang, callback) {
var tokenName = "doc-comment";
var grammar = Prism2.languages[lang];
if (!grammar) {
return;
}
var token = grammar[tokenName];
if (!token) {
var definition = {};
definition[tokenName] = {
pattern: /(^|[^\\])\/\*\*[^/][\s\S]*?(?:\*\/|$)/,
lookbehind: true,
alias: "comment"
};
grammar = Prism2.languages.insertBefore(lang, "comment", definition);
token = grammar[tokenName];
}
if (token instanceof RegExp) {
token = grammar[tokenName] = { pattern: token };
}
if (Array.isArray(token)) {
for (var i = 0, l = token.length; i < l; i++) {
if (token[i] instanceof RegExp) {
token[i] = { pattern: token[i] };
}
callback(token[i]);
}
} else {
callback(token);
}
}
function addSupport(languages, docLanguage) {
if (typeof languages === "string") {
languages = [languages];
}
languages.forEach(function(lang) {
docCommentSupport(lang, function(pattern) {
if (!pattern.inside) {
pattern.inside = {};
}
pattern.inside.rest = docLanguage;
});
});
}
Object.defineProperty(javaDocLike, "addSupport", { value: addSupport });
javaDocLike.addSupport(["java", "javascript", "php"], javaDocLike);
})(Prism);
(function(Prism2) {
var codeLinePattern = /(^(?:[\t ]*(?:\*\s*)*))[^*\s].*$/m;
var memberReference = /#\s*\w+(?:\s*\([^()]*\))?/.source;
var reference2 = /(?:\b[a-zA-Z]\w+\s*\.\s*)*\b[A-Z]\w*(?:\s*<mem>)?|<mem>/.source.replace(/<mem>/g, function() {
return memberReference;
});
Prism2.languages.javadoc = Prism2.languages.extend("javadoclike", {});
Prism2.languages.insertBefore("javadoc", "keyword", {
"reference": {
pattern: RegExp(/(@(?:exception|link|linkplain|see|throws|value)\s+(?:\*\s*)?)/.source + "(?:" + reference2 + ")"),
lookbehind: true,
inside: {
"function": {
pattern: /(#\s*)\w+(?=\s*\()/,
lookbehind: true
},
"field": {
pattern: /(#\s*)\w+/,
lookbehind: true
},
"namespace": {
pattern: /\b(?:[a-z]\w*\s*\.\s*)+/,
inside: {
"punctuation": /\./
}
},
"class-name": /\b[A-Z]\w*/,
"keyword": Prism2.languages.java.keyword,
"punctuation": /[#()[\],.]/
}
},
"class-name": {
// @param <T> the first generic type parameter
pattern: /(@param\s+)<[A-Z]\w*>/,
lookbehind: true,
inside: {
"punctuation": /[.<>]/
}
},
"code-section": [
{
pattern: /(\{@code\s+(?!\s))(?:[^\s{}]|\s+(?![\s}])|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*\})*\})+(?=\s*\})/,
lookbehind: true,
inside: {
"code": {
// there can't be any HTML inside of {@code} tags
pattern: codeLinePattern,
lookbehind: true,
inside: Prism2.languages.java,
alias: "language-java"
}
}
},
{
pattern: /(<(code|pre|tt)>(?!<code>)\s*)\S(?:\S|\s+\S)*?(?=\s*<\/\2>)/,
lookbehind: true,
inside: {
"line": {
pattern: codeLinePattern,
lookbehind: true,
inside: {
// highlight HTML tags and entities
"tag": Prism2.languages.markup.tag,
"entity": Prism2.languages.markup.entity,
"code": {
// everything else is Java code
pattern: /.+/,
inside: Prism2.languages.java,
alias: "language-java"
}
}
}
}
}
],
"tag": Prism2.languages.markup.tag,
"entity": Prism2.languages.markup.entity
});
Prism2.languages.javadoclike.addSupport("java", Prism2.languages.javadoc);
})(Prism);
Prism.languages.javastacktrace = {
// java.sql.SQLException: Violation of unique constraint MY_ENTITY_UK_1: duplicate value(s) for column(s) MY_COLUMN in statement [...]
// Caused by: java.sql.SQLException: Violation of unique constraint MY_ENTITY_UK_1: duplicate value(s) for column(s) MY_COLUMN in statement [...]
// Caused by: com.example.myproject.MyProjectServletException
// Caused by: MidLevelException: LowLevelException
// Suppressed: Resource$CloseFailException: Resource ID = 0
"summary": {
pattern: /^([\t ]*)(?:(?:Caused by:|Suppressed:|Exception in thread "[^"]*")[\t ]+)?[\w$.]+(?::.*)?$/m,
lookbehind: true,
inside: {
"keyword": {
pattern: /^([\t ]*)(?:(?:Caused by|Suppressed)(?=:)|Exception in thread)/m,
lookbehind: true
},
// the current thread if the summary starts with 'Exception in thread'
"string": {
pattern: /^(\s*)"[^"]*"/,
lookbehind: true
},
"exceptions": {
pattern: /^(:?\s*)[\w$.]+(?=:|$)/,
lookbehind: true,
inside: {
"class-name": /[\w$]+$/,
"namespace": /\b[a-z]\w*\b/,
"punctuation": /\./
}
},
"message": {
pattern: /(:\s*)\S.*/,
lookbehind: true,
alias: "string"
},
"punctuation": /:/
}
},
// at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
// at org.hsqldb.jdbc.Util.throwError(Unknown Source) here could be some notes
// at java.base/java.lang.Class.forName0(Native Method)
// at Util.<init>(Unknown Source)
// at com.foo.loader/foo@9.0/com.foo.Main.run(Main.java:101)
// at com.foo.loader//com.foo.bar.App.run(App.java:12)
// at acme@2.1/org.acme.Lib.test(Lib.java:80)
// at MyClass.mash(MyClass.java:9)
//
// More information:
// https://docs.oracle.com/en/java/javase/13/docs/api/java.base/java/lang/StackTraceElement.html#toString()
//
// A valid Java module name is defined as:
// "A module name consists of one or more Java identifiers (§3.8) separated by "." tokens."
// https://docs.oracle.com/javase/specs/jls/se9/html/jls-6.html#jls-ModuleName
//
// A Java module version is defined by this class:
// https://docs.oracle.com/javase/9/docs/api/java/lang/module/ModuleDescriptor.Version.html
// This is the implementation of the `parse` method in JDK13:
// https://github.com/matcdac/jdk/blob/2305df71d1b7710266ae0956d73927a225132c0f/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java#L1108
// However, to keep this simple, a version will be matched by the pattern /@[\w$.+-]*/.
"stack-frame": {
pattern: /^([\t ]*)at (?:[\w$./]|@[\w$.+-]*\/)+(?:<init>)?\([^()]*\)/m,
lookbehind: true,
inside: {
"keyword": {
pattern: /^(\s*)at(?= )/,
lookbehind: true
},
"source": [
// (Main.java:15)
// (Main.scala:15)
{
pattern: /(\()\w+\.\w+:\d+(?=\))/,
lookbehind: true,
inside: {
"file": /^\w+\.\w+/,
"punctuation": /:/,
"line-number": {
pattern: /\b\d+\b/,
alias: "number"
}
}
},
// (Unknown Source)
// (Native Method)
// (...something...)
{
pattern: /(\()[^()]*(?=\))/,
lookbehind: true,
inside: {
"keyword": /^(?:Native Method|Unknown Source)$/
}
}
],
"class-name": /[\w$]+(?=\.(?:<init>|[\w$]+)\()/,
"function": /(?:<init>|[\w$]+)(?=\()/,
"class-loader": {
pattern: /(\s)[a-z]\w*(?:\.[a-z]\w*)*(?=\/[\w@$.]*\/)/,
lookbehind: true,
alias: "namespace",
inside: {
"punctuation": /\./
}
},
"module": {
pattern: /([\s/])[a-z]\w*(?:\.[a-z]\w*)*(?:@[\w$.+-]*)?(?=\/)/,
lookbehind: true,
inside: {
"version": {
pattern: /(@)[\s\S]+/,
lookbehind: true,
alias: "number"
},
"punctuation": /[@.]/
}
},
"namespace": {
pattern: /(?:\b[a-z]\w*\.)+/,
inside: {
"punctuation": /\./
}
},
"punctuation": /[()/.]/
}
},
// ... 32 more
// ... 32 common frames omitted
"more": {
pattern: /^([\t ]*)\.{3} \d+ [a-z]+(?: [a-z]+)*/m,
lookbehind: true,
inside: {
"punctuation": /\.{3}/,
"number": /\d+/,
"keyword": /\b[a-z]+(?: [a-z]+)*\b/
}
}
};
Prism.languages.jexl = {
"string": /(["'])(?:\\[\s\S]|(?!\1)[^\\])*\1/,
"transform": {
pattern: /(\|\s*)[a-zA-Zа-яА-Я_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF$][\wа-яА-Я\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF$]*/,
alias: "function",
lookbehind: true
},
"function": /[a-zA-Zа-яА-Я_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF$][\wа-яА-Я\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF$]*\s*(?=\()/,
"number": /\b\d+(?:\.\d+)?\b|\B\.\d+\b/,
"operator": /[<>!]=?|-|\+|&&|==|\|\|?|\/\/?|[?:*^%]/,
"boolean": /\b(?:false|true)\b/,
"keyword": /\bin\b/,
"punctuation": /[{}[\](),.]/
};
Prism.languages.jolie = Prism.languages.extend("clike", {
"string": {
pattern: /(^|[^\\])"(?:\\[\s\S]|[^"\\])*"/,
lookbehind: true,
greedy: true
},
"class-name": {
pattern: /((?:\b(?:as|courier|embed|in|inputPort|outputPort|service)\b|@)[ \t]*)\w+/,
lookbehind: true
},
"keyword": /\b(?:as|cH|comp|concurrent|constants|courier|cset|csets|default|define|else|embed|embedded|execution|exit|extender|for|foreach|forward|from|global|if|import|in|include|init|inputPort|install|instanceof|interface|is_defined|linkIn|linkOut|main|new|nullProcess|outputPort|over|private|provide|public|scope|sequential|service|single|spawn|synchronized|this|throw|throws|type|undef|until|while|with)\b/,
"function": /\b[a-z_]\w*(?=[ \t]*[@(])/i,
"number": /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?l?/i,
"operator": /-[-=>]?|\+[+=]?|<[<=]?|[>=*!]=?|&&|\|\||[?\/%^@|]/,
"punctuation": /[()[\]{},;.:]/,
"builtin": /\b(?:Byte|any|bool|char|double|enum|float|int|length|long|ranges|regex|string|undefined|void)\b/
});
Prism.languages.insertBefore("jolie", "keyword", {
"aggregates": {
pattern: /(\bAggregates\s*:\s*)(?:\w+(?:\s+with\s+\w+)?\s*,\s*)*\w+(?:\s+with\s+\w+)?/,
lookbehind: true,
inside: {
"keyword": /\bwith\b/,
"class-name": /\w+/,
"punctuation": /,/
}
},
"redirects": {
pattern: /(\bRedirects\s*:\s*)(?:\w+\s*=>\s*\w+\s*,\s*)*(?:\w+\s*=>\s*\w+)/,
lookbehind: true,
inside: {
"punctuation": /,/,
"class-name": /\w+/,
"operator": /=>/
}
},
"property": {
pattern: /\b(?:Aggregates|[Ii]nterfaces|Java|Javascript|Jolie|[Ll]ocation|OneWay|[Pp]rotocol|Redirects|RequestResponse)\b(?=[ \t]*:)/
}
});
(function(Prism2) {
var interpolation = /\\\((?:[^()]|\([^()]*\))*\)/.source;
var string = RegExp(/(^|[^\\])"(?:[^"\r\n\\]|\\[^\r\n(]|__)*"/.source.replace(/__/g, function() {
return interpolation;
}));
var stringInterpolation = {
"interpolation": {
pattern: RegExp(/((?:^|[^\\])(?:\\{2})*)/.source + interpolation),
lookbehind: true,
inside: {
"content": {
pattern: /^(\\\()[\s\S]+(?=\)$)/,
lookbehind: true,
inside: null
// see below
},
"punctuation": /^\\\(|\)$/
}
}
};
var jq = Prism2.languages.jq = {
"comment": /#.*/,
"property": {
pattern: RegExp(string.source + /(?=\s*:(?!:))/.source),
lookbehind: true,
greedy: true,
inside: stringInterpolation
},
"string": {
pattern: string,
lookbehind: true,
greedy: true,
inside: stringInterpolation
},
"function": {
pattern: /(\bdef\s+)[a-z_]\w+/i,
lookbehind: true
},
"variable": /\B\$\w+/,
"property-literal": {
pattern: /\b[a-z_]\w*(?=\s*:(?!:))/i,
alias: "property"
},
"keyword": /\b(?:as|break|catch|def|elif|else|end|foreach|if|import|include|label|module|modulemeta|null|reduce|then|try|while)\b/,
"boolean": /\b(?:false|true)\b/,
"number": /(?:\b\d+\.|\B\.)?\b\d+(?:[eE][+-]?\d+)?\b/,
"operator": [
{
pattern: /\|=?/,
alias: "pipe"
},
/\.\.|[!=<>]?=|\?\/\/|\/\/=?|[-+*/%]=?|[<>?]|\b(?:and|not|or)\b/
],
"c-style-function": {
pattern: /\b[a-z_]\w*(?=\s*\()/i,
alias: "function"
},
"punctuation": /::|[()\[\]{},:;]|\.(?=\s*[\[\w$])/,
"dot": {
pattern: /\./,
alias: "important"
}
};
stringInterpolation.interpolation.inside.content.inside = jq;
})(Prism);
(function(Prism2) {
Prism2.languages.typescript = Prism2.languages.extend("javascript", {
"class-name": {
pattern: /(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,
lookbehind: true,
greedy: true,
inside: null
// see below
},
"builtin": /\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/
});
Prism2.languages.typescript.keyword.push(
/\b(?:abstract|declare|is|keyof|readonly|require)\b/,
// keywords that have to be followed by an identifier
/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,
// This is for `import type *, {}`
/\btype\b(?=\s*(?:[\{*]|$))/
);
delete Prism2.languages.typescript["parameter"];
delete Prism2.languages.typescript["literal-property"];
var typeInside = Prism2.languages.extend("typescript", {});
delete typeInside["class-name"];
Prism2.languages.typescript["class-name"].inside = typeInside;
Prism2.languages.insertBefore("typescript", "function", {
"decorator": {
pattern: /@[$\w\xA0-\uFFFF]+/,
inside: {
"at": {
pattern: /^@/,
alias: "operator"
},
"function": /^[\s\S]+/
}
},
"generic-function": {
// e.g. foo<T extends "bar" | "baz">( ...
pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,
greedy: true,
inside: {
"function": /^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,
"generic": {
pattern: /<[\s\S]+/,
// everything after the first <
alias: "class-name",
inside: typeInside
}
}
}
});
Prism2.languages.ts = Prism2.languages.typescript;
})(Prism);
(function(Prism2) {
var javascript = Prism2.languages.javascript;
var type = /\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})+\}/.source;
var parameterPrefix = "(@(?:arg|argument|param|property)\\s+(?:" + type + "\\s+)?)";
Prism2.languages.jsdoc = Prism2.languages.extend("javadoclike", {
"parameter": {
// @param {string} foo - foo bar
pattern: RegExp(parameterPrefix + /(?:(?!\s)[$\w\xA0-\uFFFF.])+(?=\s|$)/.source),
lookbehind: true,
inside: {
"punctuation": /\./
}
}
});
Prism2.languages.insertBefore("jsdoc", "keyword", {
"optional-parameter": {
// @param {string} [baz.foo="bar"] foo bar
pattern: RegExp(parameterPrefix + /\[(?:(?!\s)[$\w\xA0-\uFFFF.])+(?:=[^[\]]+)?\](?=\s|$)/.source),
lookbehind: true,
inside: {
"parameter": {
pattern: /(^\[)[$\w\xA0-\uFFFF\.]+/,
lookbehind: true,
inside: {
"punctuation": /\./
}
},
"code": {
pattern: /(=)[\s\S]*(?=\]$)/,
lookbehind: true,
inside: javascript,
alias: "language-javascript"
},
"punctuation": /[=[\]]/
}
},
"class-name": [
{
pattern: RegExp(/(@(?:augments|class|extends|interface|memberof!?|template|this|typedef)\s+(?:<TYPE>\s+)?)[A-Z]\w*(?:\.[A-Z]\w*)*/.source.replace(/<TYPE>/g, function() {
return type;
})),
lookbehind: true,
inside: {
"punctuation": /\./
}
},
{
pattern: RegExp("(@[a-z]+\\s+)" + type),
lookbehind: true,
inside: {
"string": javascript.string,
"number": javascript.number,
"boolean": javascript.boolean,
"keyword": Prism2.languages.typescript.keyword,
"operator": /=>|\.\.\.|[&|?:*]/,
"punctuation": /[.,;=<>{}()[\]]/
}
}
],
"example": {
pattern: /(@example\s+(?!\s))(?:[^@\s]|\s+(?!\s))+?(?=\s*(?:\*\s*)?(?:@\w|\*\/))/,
lookbehind: true,
inside: {
"code": {
pattern: /^([\t ]*(?:\*\s*)?)\S.*$/m,
lookbehind: true,
inside: javascript,
alias: "language-javascript"
}
}
}
});
Prism2.languages.javadoclike.addSupport("javascript", Prism2.languages.jsdoc);
})(Prism);
(function(Prism2) {
Prism2.languages.insertBefore("javascript", "function-variable", {
"method-variable": {
pattern: RegExp("(\\.\\s*)" + Prism2.languages.javascript["function-variable"].pattern.source),
lookbehind: true,
alias: ["function-variable", "method", "function", "property-access"]
}
});
Prism2.languages.insertBefore("javascript", "function", {
"method": {
pattern: RegExp("(\\.\\s*)" + Prism2.languages.javascript["function"].source),
lookbehind: true,
alias: ["function", "property-access"]
}
});
Prism2.languages.insertBefore("javascript", "constant", {
"known-class-name": [
{
// standard built-ins
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
pattern: /\b(?:(?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|(?:Weak)?(?:Map|Set)|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|WebAssembly)\b/,
alias: "class-name"
},
{
// errors
pattern: /\b(?:[A-Z]\w*)Error\b/,
alias: "class-name"
}
]
});
function withId(source, flags) {
return RegExp(
source.replace(/<ID>/g, function() {
return /(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/.source;
}),
flags
);
}
Prism2.languages.insertBefore("javascript", "keyword", {
"imports": {
// https://tc39.es/ecma262/#sec-imports
pattern: withId(/(\bimport\b\s*)(?:<ID>(?:\s*,\s*(?:\*\s*as\s+<ID>|\{[^{}]*\}))?|\*\s*as\s+<ID>|\{[^{}]*\})(?=\s*\bfrom\b)/.source),
lookbehind: true,
inside: Prism2.languages.javascript
},
"exports": {
// https://tc39.es/ecma262/#sec-exports
pattern: withId(/(\bexport\b\s*)(?:\*(?:\s*as\s+<ID>)?(?=\s*\bfrom\b)|\{[^{}]*\})/.source),
lookbehind: true,
inside: Prism2.languages.javascript
}
});
Prism2.languages.javascript["keyword"].unshift(
{
pattern: /\b(?:as|default|export|from|import)\b/,
alias: "module"
},
{
pattern: /\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,
alias: "control-flow"
},
{
pattern: /\bnull\b/,
alias: ["null", "nil"]
},
{
pattern: /\bundefined\b/,
alias: "nil"
}
);
Prism2.languages.insertBefore("javascript", "operator", {
"spread": {
pattern: /\.{3}/,
alias: "operator"
},
"arrow": {
pattern: /=>/,
alias: "operator"
}
});
Prism2.languages.insertBefore("javascript", "punctuation", {
"property-access": {
pattern: withId(/(\.\s*)#?<ID>/.source),
lookbehind: true
},
"maybe-class-name": {
pattern: /(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,
lookbehind: true
},
"dom": {
// this contains only a few commonly used DOM variables
pattern: /\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/,
alias: "variable"
},
"console": {
pattern: /\bconsole(?=\s*\.)/,
alias: "class-name"
}
});
var maybeClassNameTokens = ["function", "function-variable", "method", "method-variable", "property-access"];
for (var i = 0; i < maybeClassNameTokens.length; i++) {
var token = maybeClassNameTokens[i];
var value = Prism2.languages.javascript[token];
if (Prism2.util.type(value) === "RegExp") {
value = Prism2.languages.javascript[token] = {
pattern: value
};
}
var inside = value.inside || {};
value.inside = inside;
inside["maybe-class-name"] = /^[A-Z][\s\S]*/;
}
})(Prism);
Prism.languages.json = {
"property": {
pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
lookbehind: true,
greedy: true
},
"string": {
pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
lookbehind: true,
greedy: true
},
"comment": {
pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
greedy: true
},
"number": /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
"punctuation": /[{}[\],]/,
"operator": /:/,
"boolean": /\b(?:false|true)\b/,
"null": {
pattern: /\bnull\b/,
alias: "keyword"
}
};
Prism.languages.webmanifest = Prism.languages.json;
(function(Prism2) {
var string = /("|')(?:\\(?:\r\n?|\n|.)|(?!\1)[^\\\r\n])*\1/;
Prism2.languages.json5 = Prism2.languages.extend("json", {
"property": [
{
pattern: RegExp(string.source + "(?=\\s*:)"),
greedy: true
},
{
pattern: /(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/,
alias: "unquoted"
}
],
"string": {
pattern: string,
greedy: true
},
"number": /[+-]?\b(?:NaN|Infinity|0x[a-fA-F\d]+)\b|[+-]?(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[eE][+-]?\d+\b)?/
});
})(Prism);
Prism.languages.jsonp = Prism.languages.extend("json", {
"punctuation": /[{}[\]();,.]/
});
Prism.languages.insertBefore("jsonp", "punctuation", {
"function": /(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*\()/
});
Prism.languages.jsstacktrace = {
"error-message": {
pattern: /^\S.*/m,
alias: "string"
},
"stack-frame": {
pattern: /(^[ \t]+)at[ \t].*/m,
lookbehind: true,
inside: {
"not-my-code": {
pattern: /^at[ \t]+(?!\s)(?:node\.js|<unknown>|.*(?:node_modules|\(<anonymous>\)|\(<unknown>|<anonymous>$|\(internal\/|\(node\.js)).*/m,
alias: "comment"
},
"filename": {
pattern: /(\bat\s+(?!\s)|\()(?:[a-zA-Z]:)?[^():]+(?=:)/,
lookbehind: true,
alias: "url"
},
"function": {
pattern: /(\bat\s+(?:new\s+)?)(?!\s)[_$a-zA-Z\xA0-\uFFFF<][.$\w\xA0-\uFFFF<>]*/,
lookbehind: true,
inside: {
"punctuation": /\./
}
},
"punctuation": /[()]/,
"keyword": /\b(?:at|new)\b/,
"alias": {
pattern: /\[(?:as\s+)?(?!\s)[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*\]/,
alias: "variable"
},
"line-number": {
pattern: /:\d+(?::\d+)?\b/,
alias: "number",
inside: {
"punctuation": /:/
}
}
}
}
};
(function(Prism2) {
var templateString = Prism2.languages.javascript["template-string"];
var templateLiteralPattern = templateString.pattern.source;
var interpolationObject = templateString.inside["interpolation"];
var interpolationPunctuationObject = interpolationObject.inside["interpolation-punctuation"];
var interpolationPattern = interpolationObject.pattern.source;
function createTemplate(language, tag) {
if (!Prism2.languages[language]) {
return void 0;
}
return {
pattern: RegExp("((?:" + tag + ")\\s*)" + templateLiteralPattern),
lookbehind: true,
greedy: true,
inside: {
"template-punctuation": {
pattern: /^`|`$/,
alias: "string"
},
"embedded-code": {
pattern: /[\s\S]+/,
alias: language
}
}
};
}
Prism2.languages.javascript["template-string"] = [
// styled-jsx:
// css`a { color: #25F; }`
// styled-components:
// styled.h1`color: red;`
createTemplate("css", /\b(?:styled(?:\([^)]*\))?(?:\s*\.\s*\w+(?:\([^)]*\))*)*|css(?:\s*\.\s*(?:global|resolve))?|createGlobalStyle|keyframes)/.source),
// html`<p></p>`
// div.innerHTML = `<p></p>`
createTemplate("html", /\bhtml|\.\s*(?:inner|outer)HTML\s*\+?=/.source),
// svg`<path fill="#fff" d="M55.37 ..."/>`
createTemplate("svg", /\bsvg/.source),
// md`# h1`, markdown`## h2`
createTemplate("markdown", /\b(?:markdown|md)/.source),
// gql`...`, graphql`...`, graphql.experimental`...`
createTemplate("graphql", /\b(?:gql|graphql(?:\s*\.\s*experimental)?)/.source),
// sql`...`
createTemplate("sql", /\bsql/.source),
// vanilla template string
templateString
].filter(Boolean);
function getPlaceholder(counter, language) {
return "___" + language.toUpperCase() + "_" + counter + "___";
}
function tokenizeWithHooks(code, grammar, language) {
var env = {
code,
grammar,
language
};
Prism2.hooks.run("before-tokenize", env);
env.tokens = Prism2.tokenize(env.code, env.grammar);
Prism2.hooks.run("after-tokenize", env);
return env.tokens;
}
function tokenizeInterpolationExpression(expression) {
var tempGrammar = {};
tempGrammar["interpolation-punctuation"] = interpolationPunctuationObject;
var tokens = Prism2.tokenize(expression, tempGrammar);
if (tokens.length === 3) {
var args = [1, 1];
args.push.apply(args, tokenizeWithHooks(tokens[1], Prism2.languages.javascript, "javascript"));
tokens.splice.apply(tokens, args);
}
return new Prism2.Token("interpolation", tokens, interpolationObject.alias, expression);
}
function tokenizeEmbedded(code, grammar, language) {
var _tokens = Prism2.tokenize(code, {
"interpolation": {
pattern: RegExp(interpolationPattern),
lookbehind: true
}
});
var placeholderCounter = 0;
var placeholderMap = {};
var embeddedCode = _tokens.map(function(token) {
if (typeof token === "string") {
return token;
} else {
var interpolationExpression = token.content;
var placeholder;
while (code.indexOf(placeholder = getPlaceholder(placeholderCounter++, language)) !== -1) {
}
placeholderMap[placeholder] = interpolationExpression;
return placeholder;
}
}).join("");
var embeddedTokens = tokenizeWithHooks(embeddedCode, grammar, language);
var placeholders = Object.keys(placeholderMap);
placeholderCounter = 0;
function walkTokens(tokens) {
for (var i = 0; i < tokens.length; i++) {
if (placeholderCounter >= placeholders.length) {
return;
}
var token = tokens[i];
if (typeof token === "string" || typeof token.content === "string") {
var placeholder = placeholders[placeholderCounter];
var s = typeof token === "string" ? token : (
/** @type {string} */
token.content
);
var index = s.indexOf(placeholder);
if (index !== -1) {
++placeholderCounter;
var before = s.substring(0, index);
var middle = tokenizeInterpolationExpression(placeholderMap[placeholder]);
var after = s.substring(index + placeholder.length);
var replacement = [];
if (before) {
replacement.push(before);
}
replacement.push(middle);
if (after) {
var afterTokens = [after];
walkTokens(afterTokens);
replacement.push.apply(replacement, afterTokens);
}
if (typeof token === "string") {
tokens.splice.apply(tokens, [i, 1].concat(replacement));
i += replacement.length - 1;
} else {
token.content = replacement;
}
}
} else {
var content = token.content;
if (Array.isArray(content)) {
walkTokens(content);
} else {
walkTokens([content]);
}
}
}
}
walkTokens(embeddedTokens);
return new Prism2.Token(language, embeddedTokens, "language-" + language, code);
}
var supportedLanguages = {
"javascript": true,
"js": true,
"typescript": true,
"ts": true,
"jsx": true,
"tsx": true
};
Prism2.hooks.add("after-tokenize", function(env) {
if (!(env.language in supportedLanguages)) {
return;
}
function findTemplateStrings(tokens) {
for (var i = 0, l = tokens.length; i < l; i++) {
var token = tokens[i];
if (typeof token === "string") {
continue;
}
var content = token.content;
if (!Array.isArray(content)) {
if (typeof content !== "string") {
findTemplateStrings([content]);
}
continue;
}
if (token.type === "template-string") {
var embedded = content[1];
if (content.length === 3 && typeof embedded !== "string" && embedded.type === "embedded-code") {
var code = stringContent(embedded);
var alias = embedded.alias;
var language = Array.isArray(alias) ? alias[0] : alias;
var grammar = Prism2.languages[language];
if (!grammar) {
continue;
}
content[1] = tokenizeEmbedded(code, grammar, language);
}
} else {
findTemplateStrings(content);
}
}
}
findTemplateStrings(env.tokens);
});
function stringContent(value) {
if (typeof value === "string") {
return value;
} else if (Array.isArray(value)) {
return value.map(stringContent).join("");
} else {
return stringContent(value.content);
}
}
})(Prism);
Prism.languages.julia = {
"comment": {
// support one level of nested comments
// https://github.com/JuliaLang/julia/pull/6128
pattern: /(^|[^\\])(?:#=(?:[^#=]|=(?!#)|#(?!=)|#=(?:[^#=]|=(?!#)|#(?!=))*=#)*=#|#.*)/,
lookbehind: true
},
"regex": {
// https://docs.julialang.org/en/v1/manual/strings/#Regular-Expressions-1
pattern: /r"(?:\\.|[^"\\\r\n])*"[imsx]{0,4}/,
greedy: true
},
"string": {
// https://docs.julialang.org/en/v1/manual/strings/#String-Basics-1
// https://docs.julialang.org/en/v1/manual/strings/#non-standard-string-literals-1
// https://docs.julialang.org/en/v1/manual/running-external-programs/#Running-External-Programs-1
pattern: /"""[\s\S]+?"""|(?:\b\w+)?"(?:\\.|[^"\\\r\n])*"|`(?:[^\\`\r\n]|\\.)*`/,
greedy: true
},
"char": {
// https://docs.julialang.org/en/v1/manual/strings/#man-characters-1
pattern: /(^|[^\w'])'(?:\\[^\r\n][^'\r\n]*|[^\\\r\n])'/,
lookbehind: true,
greedy: true
},
"keyword": /\b(?:abstract|baremodule|begin|bitstype|break|catch|ccall|const|continue|do|else|elseif|end|export|finally|for|function|global|if|immutable|import|importall|in|let|local|macro|module|print|println|quote|return|struct|try|type|typealias|using|while)\b/,
"boolean": /\b(?:false|true)\b/,
"number": /(?:\b(?=\d)|\B(?=\.))(?:0[box])?(?:[\da-f]+(?:_[\da-f]+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[efp][+-]?\d+(?:_\d+)*)?j?/i,
// https://docs.julialang.org/en/v1/manual/mathematical-operations/
// https://docs.julialang.org/en/v1/manual/mathematical-operations/#Operator-Precedence-and-Associativity-1
"operator": /&&|\|\||[-+*^%÷⊻&$\\]=?|\/[\/=]?|!=?=?|\|[=>]?|<(?:<=?|[=:|])?|>(?:=|>>?=?)?|==?=?|[~≠≤≥'√∛]/,
"punctuation": /::?|[{}[\]();,.?]/,
// https://docs.julialang.org/en/v1/base/numbers/#Base.im
"constant": /\b(?:(?:Inf|NaN)(?:16|32|64)?|im|pi)\b|[πℯ]/
};
Prism.languages.keepalived = {
"comment": {
pattern: /[#!].*/,
greedy: true
},
"string": {
pattern: /(^|[^\\])(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/,
lookbehind: true,
greedy: true
},
// support IPv4, IPv6, subnet mask
"ip": {
pattern: RegExp(
/\b(?:(?:(?:[\da-f]{1,4}:){7}[\da-f]{1,4}|(?:[\da-f]{1,4}:){6}:[\da-f]{1,4}|(?:[\da-f]{1,4}:){5}:(?:[\da-f]{1,4}:)?[\da-f]{1,4}|(?:[\da-f]{1,4}:){4}:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4}|(?:[\da-f]{1,4}:){3}:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4}|(?:[\da-f]{1,4}:){2}:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4}|(?:[\da-f]{1,4}:){6}<ipv4>|(?:[\da-f]{1,4}:){0,5}:<ipv4>|::(?:[\da-f]{1,4}:){0,5}<ipv4>|[\da-f]{1,4}::(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4}|::(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,7}:)(?:\/\d{1,3})?|<ipv4>(?:\/\d{1,2})?)\b/.source.replace(/<ipv4>/g, function() {
return /(?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d))/.source;
}),
"i"
),
alias: "number"
},
// support *nix / Windows, directory / file
"path": {
pattern: /(\s)\/(?:[^\/\s]+\/)*[^\/\s]*|\b[a-zA-Z]:\\(?:[^\\\s]+\\)*[^\\\s]*/,
lookbehind: true,
alias: "string"
},
"variable": /\$\{?\w+\}?/,
"email": {
pattern: /[\w-]+@[\w-]+(?:\.[\w-]{2,3}){1,2}/,
alias: "string"
},
"conditional-configuration": {
pattern: /@\^?[\w-]+/,
alias: "variable"
},
"operator": /=/,
"property": /\b(?:BFD_CHECK|DNS_CHECK|FILE_CHECK|HTTP_GET|MISC_CHECK|NAME|PING_CHECK|SCRIPTS|SMTP_CHECK|SSL|SSL_GET|TCP_CHECK|UDP_CHECK|accept|advert_int|alpha|auth_pass|auth_type|authentication|bfd_cpu_affinity|bfd_instance|bfd_no_swap|bfd_priority|bfd_process_name|bfd_rlimit_rttime|bfd_rt_priority|bind_if|bind_port|bindto|ca|certificate|check_unicast_src|checker|checker_cpu_affinity|checker_log_all_failures|checker_no_swap|checker_priority|checker_rlimit_rttime|checker_rt_priority|child_wait_time|connect_ip|connect_port|connect_timeout|dbus_service_name|debug|default_interface|delay|delay_before_retry|delay_loop|digest|dont_track_primary|dynamic|dynamic_interfaces|enable_(?:dbus|script_security|sni|snmp_checker|snmp_rfc|snmp_rfcv2|snmp_rfcv3|snmp_vrrp|traps)|end|fall|fast_recovery|file|flag-[123]|fork_delay|full_command|fwmark|garp_group|garp_interval|garp_lower_prio_delay|garp_lower_prio_repeat|garp_master_delay|garp_master_refresh|garp_master_refresh_repeat|garp_master_repeat|global_defs|global_tracking|gna_interval|group|ha_suspend|hashed|helo_name|higher_prio_send_advert|hoplimit|http_protocol|hysteresis|idle_tx|include|inhibit_on_failure|init_fail|init_file|instance|interface|interfaces|interval|ip_family|ipvs_process_name|keepalived.conf|kernel_rx_buf_size|key|linkbeat_interfaces|linkbeat_use_polling|log_all_failures|log_unknown_vrids|lower_prio_no_advert|lthreshold|lvs_flush|lvs_flush_onstop|lvs_method|lvs_netlink_cmd_rcv_bufs|lvs_netlink_cmd_rcv_bufs_force|lvs_netlink_monitor_rcv_bufs|lvs_netlink_monitor_rcv_bufs_force|lvs_notify_fifo|lvs_notify_fifo_script|lvs_sched|lvs_sync_daemon|max_auto_priority|max_hops|mcast_src_ip|mh-fallback|mh-port|min_auto_priority_delay|min_rx|min_tx|misc_dynamic|misc_path|misc_timeout|multiplier|name|namespace_with_ipsets|native_ipv6|neighbor_ip|net_namespace|net_namespace_ipvs|nftables|nftables_counters|nftables_ifindex|nftables_priority|no_accept|no_checker_emails|no_email_faults|nopreempt|notification_email|notification_email_from|notify|notify_backup|notify_deleted|notify_down|notify_fault|notify_fifo|notify_fifo_script|notify_master|notify_master_rx_lower_pri|notify_priority_changes|notify_stop|notify_up|old_unicast_checksum|omega|ops|param_match|passive|password|path|persistence_engine|persistence_granularity|persistence_timeout|preempt|preempt_delay|priority|process|process_monitor_rcv_bufs|process_monitor_rcv_bufs_force|process_name|process_names|promote_secondaries|protocol|proxy_arp|proxy_arp_pvlan|quorum|quorum_down|quorum_max|quorum_up|random_seed|real_server|regex|regex_max_offset|regex_min_offset|regex_no_match|regex_options|regex_stack|reload_repeat|reload_time_file|require_reply|retry|rise|router_id|rs_init_notifies|script|script_user|sh-fallback|sh-port|shutdown_script|shutdown_script_timeout|skip_check_adv_addr|smtp_alert|smtp_alert_checker|smtp_alert_vrrp|smtp_connect_timeout|smtp_helo_name|smtp_server|snmp_socket|sorry_server|sorry_server_inhibit|sorry_server_lvs_method|source_ip|start|startup_script|startup_script_timeout|state|static_ipaddress|static_routes|static_rules|status_code|step|strict_mode|sync_group_tracking_weight|terminate_delay|timeout|track_bfd|track_file|track_group|track_interface|track_process|track_script|track_src_ip|ttl|type|umask|unicast_peer|unicast_src_ip|unicast_ttl|url|use_ipvlan|use_pid_dir|use_vmac|user|uthreshold|val[123]|version|virtual_ipaddress|virtual_ipaddress_excluded|virtual_router_id|virtual_routes|virtual_rules|virtual_server|virtual_server_group|virtualhost|vmac_xmit_base|vrrp|vrrp_(?:check_unicast_src|cpu_affinity|garp_interval|garp_lower_prio_delay|garp_lower_prio_repeat|garp_master_delay|garp_master_refresh|garp_master_refresh_repeat|garp_master_repeat|gna_interval|higher_prio_send_advert|instance|ipsets|iptables|lower_prio_no_advert|mcast_group4|mcast_group6|min_garp|netlink_cmd_rcv_bufs|netlink_cmd_rcv_bufs_force|netlink_monitor_rcv_bufs|netlink_monitor_rcv_bufs_force|no_swap|notify_fifo|notify_fifo_script|notify_priority_changes|priority|process_name|rlimit_rttime|rt_priority|rx_bufs_multiplier|rx_bufs_policy|script|skip_check_adv_addr|startup_delay|strict|sync_group|track_process|version)|warmup|weight)\b/,
"constant": /\b(?:A|AAAA|AH|BACKUP|CNAME|DR|MASTER|MX|NAT|NS|PASS|SCTP|SOA|TCP|TUN|TXT|UDP|dh|fo|lblc|lblcr|lc|mh|nq|ovf|rr|sed|sh|wlc|wrr)\b/,
"number": {
pattern: /(^|[^\w.-])-?\d+(?:\.\d+)?/,
lookbehind: true
},
"boolean": /\b(?:false|no|off|on|true|yes)\b/,
"punctuation": /[\{\}]/
};
Prism.languages.keyman = {
"comment": {
pattern: /\bc .*/i,
greedy: true
},
"string": {
pattern: /"[^"\r\n]*"|'[^'\r\n]*'/,
greedy: true
},
"virtual-key": {
pattern: /\[\s*(?:(?:ALT|CAPS|CTRL|LALT|LCTRL|NCAPS|RALT|RCTRL|SHIFT)\s+)*(?:[TKU]_[\w?]+|[A-E]\d\d?|"[^"\r\n]*"|'[^'\r\n]*')\s*\]/i,
greedy: true,
alias: "function"
// alias for styles
},
// https://help.keyman.com/developer/language/guide/headers
"header-keyword": {
pattern: /&\w+/,
alias: "bold"
// alias for styles
},
"header-statement": {
pattern: /\b(?:bitmap|bitmaps|caps always off|caps on only|copyright|hotkey|language|layout|message|name|shift frees caps|version)\b/i,
alias: "bold"
// alias for styles
},
"rule-keyword": {
pattern: /\b(?:any|baselayout|beep|call|context|deadkey|dk|if|index|layer|notany|nul|outs|platform|reset|return|save|set|store|use)\b/i,
alias: "keyword"
},
"structural-keyword": {
pattern: /\b(?:ansi|begin|group|match|newcontext|nomatch|postkeystroke|readonly|unicode|using keys)\b/i,
alias: "keyword"
},
"compile-target": {
pattern: /\$(?:keyman|keymanonly|keymanweb|kmfl|weaver):/i,
alias: "property"
},
// U+####, x###, d### characters and numbers
"number": /\b(?:U\+[\dA-F]+|d\d+|x[\da-f]+|\d+)\b/i,
"operator": /[+>\\$]|\.\./,
"punctuation": /[()=,]/
};
(function(Prism2) {
Prism2.languages.kotlin = Prism2.languages.extend("clike", {
"keyword": {
// The lookbehind prevents wrong highlighting of e.g. kotlin.properties.get
pattern: /(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,
lookbehind: true
},
"function": [
{
pattern: /(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,
greedy: true
},
{
pattern: /(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,
lookbehind: true,
greedy: true
}
],
"number": /\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,
"operator": /\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/
});
delete Prism2.languages.kotlin["class-name"];
var interpolationInside = {
"interpolation-punctuation": {
pattern: /^\$\{?|\}$/,
alias: "punctuation"
},
"expression": {
pattern: /[\s\S]+/,
inside: Prism2.languages.kotlin
}
};
Prism2.languages.insertBefore("kotlin", "string", {
// https://kotlinlang.org/spec/expressions.html#string-interpolation-expressions
"string-literal": [
{
pattern: /"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,
alias: "multiline",
inside: {
"interpolation": {
pattern: /\$(?:[a-z_]\w*|\{[^{}]*\})/i,
inside: interpolationInside
},
"string": /[\s\S]+/
}
},
{
pattern: /"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,
alias: "singleline",
inside: {
"interpolation": {
pattern: /((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,
lookbehind: true,
inside: interpolationInside
},
"string": /[\s\S]+/
}
}
],
"char": {
// https://kotlinlang.org/spec/expressions.html#character-literals
pattern: /'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,
greedy: true
}
});
delete Prism2.languages.kotlin["string"];
Prism2.languages.insertBefore("kotlin", "keyword", {
"annotation": {
pattern: /\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,
alias: "builtin"
}
});
Prism2.languages.insertBefore("kotlin", "function", {
"label": {
pattern: /\b\w+@|@\w+\b/,
alias: "symbol"
}
});
Prism2.languages.kt = Prism2.languages.kotlin;
Prism2.languages.kts = Prism2.languages.kotlin;
})(Prism);
(function(Prism2) {
var nonId = /\s\x00-\x1f\x22-\x2f\x3a-\x3f\x5b-\x5e\x60\x7b-\x7e/.source;
function wrapId(pattern, flags) {
return RegExp(pattern.replace(/<nonId>/g, nonId), flags);
}
Prism2.languages.kumir = {
"comment": {
pattern: /\|.*/
},
"prolog": {
pattern: /#.*/,
greedy: true
},
"string": {
pattern: /"[^\n\r"]*"|'[^\n\r']*'/,
greedy: true
},
"boolean": {
pattern: wrapId(/(^|[<nonId>])(?:да|нет)(?=[<nonId>]|$)/.source),
lookbehind: true
},
"operator-word": {
pattern: wrapId(/(^|[<nonId>])(?:и|или|не)(?=[<nonId>]|$)/.source),
lookbehind: true,
alias: "keyword"
},
"system-variable": {
pattern: wrapId(/(^|[<nonId>])знач(?=[<nonId>]|$)/.source),
lookbehind: true,
alias: "keyword"
},
"type": [
{
pattern: wrapId(/(^|[<nonId>])(?:вещ|лит|лог|сим|цел)(?:\x20*таб)?(?=[<nonId>]|$)/.source),
lookbehind: true,
alias: "builtin"
},
{
pattern: wrapId(/(^|[<nonId>])(?:компл|сканкод|файл|цвет)(?=[<nonId>]|$)/.source),
lookbehind: true,
alias: "important"
}
],
/**
* Should be performed after searching for type names because of "таб".
* "таб" is a reserved word, but never used without a preceding type name.
* "НАЗНАЧИТЬ", "Фввод", and "Фвывод" are not reserved words.
*/
"keyword": {
pattern: wrapId(/(^|[<nonId>])(?:алг|арг(?:\x20*рез)?|ввод|ВКЛЮЧИТЬ|вс[её]|выбор|вывод|выход|дано|для|до|дс|если|иначе|исп|использовать|кон(?:(?:\x20+|_)исп)?|кц(?:(?:\x20+|_)при)?|надо|нач|нс|нц|от|пауза|пока|при|раза?|рез|стоп|таб|то|утв|шаг)(?=[<nonId>]|$)/.source),
lookbehind: true
},
/** Should be performed after searching for reserved words. */
"name": {
// eslint-disable-next-line regexp/no-super-linear-backtracking
pattern: wrapId(/(^|[<nonId>])[^\d<nonId>][^<nonId>]*(?:\x20+[^<nonId>]+)*(?=[<nonId>]|$)/.source),
lookbehind: true
},
/** Should be performed after searching for names. */
"number": {
pattern: wrapId(/(^|[<nonId>])(?:\B\$[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)(?=[<nonId>]|$)/.source, "i"),
lookbehind: true
},
/** Should be performed after searching for words. */
"punctuation": /:=|[(),:;\[\]]/,
/**
* Should be performed after searching for
* - numeric constants (because of "+" and "-");
* - punctuation marks (because of ":=" and "=").
*/
"operator-char": {
pattern: /\*\*?|<[=>]?|>=?|[-+/=]/,
alias: "operator"
}
};
Prism2.languages.kum = Prism2.languages.kumir;
})(Prism);
Prism.languages.kusto = {
"comment": {
pattern: /\/\/.*/,
greedy: true
},
"string": {
pattern: /```[\s\S]*?```|[hH]?(?:"(?:[^\r\n\\"]|\\.)*"|'(?:[^\r\n\\']|\\.)*'|@(?:"[^\r\n"]*"|'[^\r\n']*'))/,
greedy: true
},
"verb": {
pattern: /(\|\s*)[a-z][\w-]*/i,
lookbehind: true,
alias: "keyword"
},
"command": {
pattern: /\.[a-z][a-z\d-]*\b/,
alias: "keyword"
},
"class-name": /\b(?:bool|datetime|decimal|dynamic|guid|int|long|real|string|timespan)\b/,
"keyword": /\b(?:access|alias|and|anti|as|asc|auto|between|by|(?:contains|(?:ends|starts)with|has(?:perfix|suffix)?)(?:_cs)?|database|declare|desc|external|from|fullouter|has_all|in|ingestion|inline|inner|innerunique|into|(?:left|right)(?:anti(?:semi)?|inner|outer|semi)?|let|like|local|not|of|on|or|pattern|print|query_parameters|range|restrict|schema|set|step|table|tables|to|view|where|with|matches\s+regex|nulls\s+(?:first|last))(?![\w-])/,
"boolean": /\b(?:false|null|true)\b/,
"function": /\b[a-z_]\w*(?=\s*\()/,
"datetime": [
{
// RFC 822 + RFC 850
pattern: /\b(?:(?:Fri|Friday|Mon|Monday|Sat|Saturday|Sun|Sunday|Thu|Thursday|Tue|Tuesday|Wed|Wednesday)\s*,\s*)?\d{1,2}(?:\s+|-)(?:Apr|Aug|Dec|Feb|Jan|Jul|Jun|Mar|May|Nov|Oct|Sep)(?:\s+|-)\d{2}\s+\d{2}:\d{2}(?::\d{2})?(?:\s*(?:\b(?:[A-Z]|(?:[ECMT][DS]|GM|U)T)|[+-]\d{4}))?\b/,
alias: "number"
},
{
// ISO 8601
pattern: /[+-]?\b(?:\d{4}-\d{2}-\d{2}(?:[ T]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?)?|\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?)Z?/,
alias: "number"
}
],
"number": /\b(?:0x[0-9A-Fa-f]+|\d+(?:\.\d+)?(?:[Ee][+-]?\d+)?)(?:(?:min|sec|[mnµ]s|[dhms]|microsecond|tick)\b)?|[+-]?\binf\b/,
"operator": /=>|[!=]~|[!=<>]=?|[-+*/%|]|\.\./,
"punctuation": /[()\[\]{},;.:]/
};
(function(Prism2) {
var funcPattern = /\\(?:[^a-z()[\]]|[a-z*]+)/i;
var insideEqu = {
"equation-command": {
pattern: funcPattern,
alias: "regex"
}
};
Prism2.languages.latex = {
"comment": /%.*/,
// the verbatim environment prints whitespace to the document
"cdata": {
pattern: /(\\begin\{((?:lstlisting|verbatim)\*?)\})[\s\S]*?(?=\\end\{\2\})/,
lookbehind: true
},
/*
* equations can be between $$ $$ or $ $ or \( \) or \[ \]
* (all are multiline)
*/
"equation": [
{
pattern: /\$\$(?:\\[\s\S]|[^\\$])+\$\$|\$(?:\\[\s\S]|[^\\$])+\$|\\\([\s\S]*?\\\)|\\\[[\s\S]*?\\\]/,
inside: insideEqu,
alias: "string"
},
{
pattern: /(\\begin\{((?:align|eqnarray|equation|gather|math|multline)\*?)\})[\s\S]*?(?=\\end\{\2\})/,
lookbehind: true,
inside: insideEqu,
alias: "string"
}
],
/*
* arguments which are keywords or references are highlighted
* as keywords
*/
"keyword": {
pattern: /(\\(?:begin|cite|documentclass|end|label|ref|usepackage)(?:\[[^\]]+\])?\{)[^}]+(?=\})/,
lookbehind: true
},
"url": {
pattern: /(\\url\{)[^}]+(?=\})/,
lookbehind: true
},
/*
* section or chapter headlines are highlighted as bold so that
* they stand out more
*/
"headline": {
pattern: /(\\(?:chapter|frametitle|paragraph|part|section|subparagraph|subsection|subsubparagraph|subsubsection|subsubsubparagraph)\*?(?:\[[^\]]+\])?\{)[^}]+(?=\})/,
lookbehind: true,
alias: "class-name"
},
"function": {
pattern: funcPattern,
alias: "selector"
},
"punctuation": /[[\]{}&]/
};
Prism2.languages.tex = Prism2.languages.latex;
Prism2.languages.context = Prism2.languages.latex;
})(Prism);
(function(Prism2) {
Prism2.languages.latte = {
"comment": /^\{\*[\s\S]*/,
"latte-tag": {
// https://latte.nette.org/en/tags
pattern: /(^\{(?:\/(?=[a-z]))?)(?:[=_]|[a-z]\w*\b(?!\())/i,
lookbehind: true,
alias: "important"
},
"delimiter": {
pattern: /^\{\/?|\}$/,
alias: "punctuation"
},
"php": {
pattern: /\S(?:[\s\S]*\S)?/,
alias: "language-php",
inside: Prism2.languages.php
}
};
var markupLatte = Prism2.languages.extend("markup", {});
Prism2.languages.insertBefore("inside", "attr-value", {
"n-attr": {
pattern: /n:[\w-]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+))?/,
inside: {
"attr-name": {
pattern: /^[^\s=]+/,
alias: "important"
},
"attr-value": {
pattern: /=[\s\S]+/,
inside: {
"punctuation": [
/^=/,
{
pattern: /^(\s*)["']|["']$/,
lookbehind: true
}
],
"php": {
pattern: /\S(?:[\s\S]*\S)?/,
inside: Prism2.languages.php
}
}
}
}
}
}, markupLatte.tag);
Prism2.hooks.add("before-tokenize", function(env) {
if (env.language !== "latte") {
return;
}
var lattePattern = /\{\*[\s\S]*?\*\}|\{[^'"\s{}*](?:[^"'/{}]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|\/\*(?:[^*]|\*(?!\/))*\*\/)*\}/g;
Prism2.languages["markup-templating"].buildPlaceholders(env, "latte", lattePattern);
env.grammar = markupLatte;
});
Prism2.hooks.add("after-tokenize", function(env) {
Prism2.languages["markup-templating"].tokenizePlaceholders(env, "latte");
});
})(Prism);
Prism.languages.less = Prism.languages.extend("css", {
"comment": [
/\/\*[\s\S]*?\*\//,
{
pattern: /(^|[^\\])\/\/.*/,
lookbehind: true
}
],
"atrule": {
pattern: /@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,
inside: {
"punctuation": /[:()]/
}
},
// selectors and mixins are considered the same
"selector": {
pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,
inside: {
// mixin parameters
"variable": /@+[\w-]+/
}
},
"property": /(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,
"operator": /[+\-*\/]/
});
Prism.languages.insertBefore("less", "property", {
"variable": [
// Variable declaration (the colon must be consumed!)
{
pattern: /@[\w-]+\s*:/,
inside: {
"punctuation": /:/
}
},
// Variable usage
/@@?[\w-]+/
],
"mixin-usage": {
pattern: /([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,
lookbehind: true,
alias: "function"
}
});
(function(Prism2) {
Prism2.languages.scheme = {
// this supports "normal" single-line comments:
// ; comment
// and (potentially nested) multiline comments:
// #| comment #| nested |# still comment |#
// (only 1 level of nesting is supported)
"comment": /;.*|#;\s*(?:\((?:[^()]|\([^()]*\))*\)|\[(?:[^\[\]]|\[[^\[\]]*\])*\])|#\|(?:[^#|]|#(?!\|)|\|(?!#)|#\|(?:[^#|]|#(?!\|)|\|(?!#))*\|#)*\|#/,
"string": {
pattern: /"(?:[^"\\]|\\.)*"/,
greedy: true
},
"symbol": {
pattern: /'[^()\[\]#'\s]+/,
greedy: true
},
"char": {
pattern: /#\\(?:[ux][a-fA-F\d]+\b|[-a-zA-Z]+\b|[\uD800-\uDBFF][\uDC00-\uDFFF]|\S)/,
greedy: true
},
"lambda-parameter": [
// https://www.cs.cmu.edu/Groups/AI/html/r4rs/r4rs_6.html#SEC30
{
pattern: /((?:^|[^'`#])[(\[]lambda\s+)(?:[^|()\[\]'\s]+|\|(?:[^\\|]|\\.)*\|)/,
lookbehind: true
},
{
pattern: /((?:^|[^'`#])[(\[]lambda\s+[(\[])[^()\[\]']+/,
lookbehind: true
}
],
"keyword": {
pattern: /((?:^|[^'`#])[(\[])(?:begin|case(?:-lambda)?|cond(?:-expand)?|define(?:-library|-macro|-record-type|-syntax|-values)?|defmacro|delay(?:-force)?|do|else|except|export|guard|if|import|include(?:-ci|-library-declarations)?|lambda|let(?:rec)?(?:-syntax|-values|\*)?|let\*-values|only|parameterize|prefix|(?:quasi-?)?quote|rename|set!|syntax-(?:case|rules)|unless|unquote(?:-splicing)?|when)(?=[()\[\]\s]|$)/,
lookbehind: true
},
"builtin": {
// all functions of the base library of R7RS plus some of built-ins of R5Rs
pattern: /((?:^|[^'`#])[(\[])(?:abs|and|append|apply|assoc|ass[qv]|binary-port\?|boolean=?\?|bytevector(?:-append|-copy|-copy!|-length|-u8-ref|-u8-set!|\?)?|caar|cadr|call-with-(?:current-continuation|port|values)|call\/cc|car|cdar|cddr|cdr|ceiling|char(?:->integer|-ready\?|\?|<\?|<=\?|=\?|>\?|>=\?)|close-(?:input-port|output-port|port)|complex\?|cons|current-(?:error|input|output)-port|denominator|dynamic-wind|eof-object\??|eq\?|equal\?|eqv\?|error|error-object(?:-irritants|-message|\?)|eval|even\?|exact(?:-integer-sqrt|-integer\?|\?)?|expt|features|file-error\?|floor(?:-quotient|-remainder|\/)?|flush-output-port|for-each|gcd|get-output-(?:bytevector|string)|inexact\??|input-port(?:-open\?|\?)|integer(?:->char|\?)|lcm|length|list(?:->string|->vector|-copy|-ref|-set!|-tail|\?)?|make-(?:bytevector|list|parameter|string|vector)|map|max|member|memq|memv|min|modulo|negative\?|newline|not|null\?|number(?:->string|\?)|numerator|odd\?|open-(?:input|output)-(?:bytevector|string)|or|output-port(?:-open\?|\?)|pair\?|peek-char|peek-u8|port\?|positive\?|procedure\?|quotient|raise|raise-continuable|rational\?|rationalize|read-(?:bytevector|bytevector!|char|error\?|line|string|u8)|real\?|remainder|reverse|round|set-c[ad]r!|square|string(?:->list|->number|->symbol|->utf8|->vector|-append|-copy|-copy!|-fill!|-for-each|-length|-map|-ref|-set!|\?|<\?|<=\?|=\?|>\?|>=\?)?|substring|symbol(?:->string|\?|=\?)|syntax-error|textual-port\?|truncate(?:-quotient|-remainder|\/)?|u8-ready\?|utf8->string|values|vector(?:->list|->string|-append|-copy|-copy!|-fill!|-for-each|-length|-map|-ref|-set!|\?)?|with-exception-handler|write-(?:bytevector|char|string|u8)|zero\?)(?=[()\[\]\s]|$)/,
lookbehind: true
},
"operator": {
pattern: /((?:^|[^'`#])[(\[])(?:[-+*%/]|[<>]=?|=>?)(?=[()\[\]\s]|$)/,
lookbehind: true
},
"number": {
// The number pattern from [the R7RS spec](https://small.r7rs.org/attachment/r7rs.pdf).
//
// <number> := <num 2>|<num 8>|<num 10>|<num 16>
// <num R> := <prefix R><complex R>
// <complex R> := <real R>(?:@<real R>|<imaginary R>)?|<imaginary R>
// <imaginary R> := [+-](?:<ureal R>|(?:inf|nan)\.0)?i
// <real R> := [+-]?<ureal R>|[+-](?:inf|nan)\.0
// <ureal R> := <uint R>(?:\/<uint R>)?
// | <decimal R>
//
// <decimal 10> := (?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?
// <uint R> := <digit R>+
// <prefix R> := <radix R>(?:#[ei])?|(?:#[ei])?<radix R>
// <radix 2> := #b
// <radix 8> := #o
// <radix 10> := (?:#d)?
// <radix 16> := #x
// <digit 2> := [01]
// <digit 8> := [0-7]
// <digit 10> := \d
// <digit 16> := [0-9a-f]
//
// The problem with this grammar is that the resulting regex is way to complex, so we simplify by grouping all
// non-decimal bases together. This results in a decimal (dec) and combined binary, octal, and hexadecimal (box)
// pattern:
pattern: RegExp(SortedBNF({
"<ureal dec>": /\d+(?:\/\d+)|(?:\d+(?:\.\d*)?|\.\d+)(?:[esfdl][+-]?\d+)?/.source,
"<real dec>": /[+-]?<ureal dec>|[+-](?:inf|nan)\.0/.source,
"<imaginary dec>": /[+-](?:<ureal dec>|(?:inf|nan)\.0)?i/.source,
"<complex dec>": /<real dec>(?:@<real dec>|<imaginary dec>)?|<imaginary dec>/.source,
"<num dec>": /(?:#d(?:#[ei])?|#[ei](?:#d)?)?<complex dec>/.source,
"<ureal box>": /[0-9a-f]+(?:\/[0-9a-f]+)?/.source,
"<real box>": /[+-]?<ureal box>|[+-](?:inf|nan)\.0/.source,
"<imaginary box>": /[+-](?:<ureal box>|(?:inf|nan)\.0)?i/.source,
"<complex box>": /<real box>(?:@<real box>|<imaginary box>)?|<imaginary box>/.source,
"<num box>": /#[box](?:#[ei])?|(?:#[ei])?#[box]<complex box>/.source,
"<number>": /(^|[()\[\]\s])(?:<num dec>|<num box>)(?=[()\[\]\s]|$)/.source
}), "i"),
lookbehind: true
},
"boolean": {
pattern: /(^|[()\[\]\s])#(?:[ft]|false|true)(?=[()\[\]\s]|$)/,
lookbehind: true
},
"function": {
pattern: /((?:^|[^'`#])[(\[])(?:[^|()\[\]'\s]+|\|(?:[^\\|]|\\.)*\|)(?=[()\[\]\s]|$)/,
lookbehind: true
},
"identifier": {
pattern: /(^|[()\[\]\s])\|(?:[^\\|]|\\.)*\|(?=[()\[\]\s]|$)/,
lookbehind: true,
greedy: true
},
"punctuation": /[()\[\]']/
};
function SortedBNF(grammar) {
for (var key in grammar) {
grammar[key] = grammar[key].replace(/<[\w\s]+>/g, function(key2) {
return "(?:" + grammar[key2].trim() + ")";
});
}
return grammar[key];
}
})(Prism);
(function(Prism2) {
var schemeExpression = /\((?:[^();"#\\]|\\[\s\S]|;.*(?!.)|"(?:[^"\\]|\\.)*"|#(?:\{(?:(?!#\})[\s\S])*#\}|[^{])|<expr>)*\)/.source;
var recursivenessLog2 = 5;
for (var i = 0; i < recursivenessLog2; i++) {
schemeExpression = schemeExpression.replace(/<expr>/g, function() {
return schemeExpression;
});
}
schemeExpression = schemeExpression.replace(/<expr>/g, /[^\s\S]/.source);
var lilypond = Prism2.languages.lilypond = {
"comment": /%(?:(?!\{).*|\{[\s\S]*?%\})/,
"embedded-scheme": {
pattern: RegExp(/(^|[=\s])#(?:"(?:[^"\\]|\\.)*"|[^\s()"]*(?:[^\s()]|<expr>))/.source.replace(/<expr>/g, function() {
return schemeExpression;
}), "m"),
lookbehind: true,
greedy: true,
inside: {
"scheme": {
pattern: /^(#)[\s\S]+$/,
lookbehind: true,
alias: "language-scheme",
inside: {
"embedded-lilypond": {
pattern: /#\{[\s\S]*?#\}/,
greedy: true,
inside: {
"punctuation": /^#\{|#\}$/,
"lilypond": {
pattern: /[\s\S]+/,
alias: "language-lilypond",
inside: null
// see below
}
}
},
rest: Prism2.languages.scheme
}
},
"punctuation": /#/
}
},
"string": {
pattern: /"(?:[^"\\]|\\.)*"/,
greedy: true
},
"class-name": {
pattern: /(\\new\s+)[\w-]+/,
lookbehind: true
},
"keyword": {
pattern: /\\[a-z][-\w]*/i,
inside: {
"punctuation": /^\\/
}
},
"operator": /[=|]|<<|>>/,
"punctuation": {
pattern: /(^|[a-z\d])(?:'+|,+|[_^]?-[_^]?(?:[-+^!>._]|(?=\d))|[_^]\.?|[.!])|[{}()[\]<>^~]|\\[()[\]<>\\!]|--|__/,
lookbehind: true
},
"number": /\b\d+(?:\/\d+)?\b/
};
lilypond["embedded-scheme"].inside["scheme"].inside["embedded-lilypond"].inside["lilypond"].inside = lilypond;
Prism2.languages.ly = lilypond;
})(Prism);
Prism.languages.liquid = {
"comment": {
pattern: /(^\{%\s*comment\s*%\})[\s\S]+(?=\{%\s*endcomment\s*%\}$)/,
lookbehind: true
},
"delimiter": {
pattern: /^\{(?:\{\{|[%\{])-?|-?(?:\}\}|[%\}])\}$/,
alias: "punctuation"
},
"string": {
pattern: /"[^"]*"|'[^']*'/,
greedy: true
},
"keyword": /\b(?:as|assign|break|(?:end)?(?:capture|case|comment|for|form|if|paginate|raw|style|tablerow|unless)|continue|cycle|decrement|echo|else|elsif|in|include|increment|limit|liquid|offset|range|render|reversed|section|when|with)\b/,
"object": /\b(?:address|all_country_option_tags|article|block|blog|cart|checkout|collection|color|country|country_option_tags|currency|current_page|current_tags|customer|customer_address|date|discount_allocation|discount_application|external_video|filter|filter_value|font|forloop|fulfillment|generic_file|gift_card|group|handle|image|line_item|link|linklist|localization|location|measurement|media|metafield|model|model_source|order|page|page_description|page_image|page_title|part|policy|product|product_option|recommendations|request|robots|routes|rule|script|search|selling_plan|selling_plan_allocation|selling_plan_group|shipping_method|shop|shop_locale|sitemap|store_availability|tax_line|template|theme|transaction|unit_price_measurement|user_agent|variant|video|video_source)\b/,
"function": [
{
pattern: /(\|\s*)\w+/,
lookbehind: true,
alias: "filter"
},
{
// array functions
pattern: /(\.\s*)(?:first|last|size)/,
lookbehind: true
}
],
"boolean": /\b(?:false|nil|true)\b/,
"range": {
pattern: /\.\./,
alias: "operator"
},
// https://github.com/Shopify/liquid/blob/698f5e0d967423e013f6169d9111bd969bd78337/lib/liquid/lexer.rb#L21
"number": /\b\d+(?:\.\d+)?\b/,
"operator": /[!=]=|<>|[<>]=?|[|?:=-]|\b(?:and|contains(?=\s)|or)\b/,
"punctuation": /[.,\[\]()]/,
"empty": {
pattern: /\bempty\b/,
alias: "keyword"
}
};
Prism.hooks.add("before-tokenize", function(env) {
var liquidPattern = /\{%\s*comment\s*%\}[\s\S]*?\{%\s*endcomment\s*%\}|\{(?:%[\s\S]*?%|\{\{[\s\S]*?\}\}|\{[\s\S]*?\})\}/g;
var insideRaw = false;
Prism.languages["markup-templating"].buildPlaceholders(env, "liquid", liquidPattern, function(match) {
var tagMatch = /^\{%-?\s*(\w+)/.exec(match);
if (tagMatch) {
var tag = tagMatch[1];
if (tag === "raw" && !insideRaw) {
insideRaw = true;
return true;
} else if (tag === "endraw") {
insideRaw = false;
return true;
}
}
return !insideRaw;
});
});
Prism.hooks.add("after-tokenize", function(env) {
Prism.languages["markup-templating"].tokenizePlaceholders(env, "liquid");
});
(function(Prism2) {
function simple_form(name) {
return RegExp(/(\()/.source + "(?:" + name + ")" + /(?=[\s\)])/.source);
}
function primitive(pattern) {
return RegExp(/([\s([])/.source + "(?:" + pattern + ")" + /(?=[\s)])/.source);
}
var symbol = /(?!\d)[-+*/~!@$%^=<>{}\w]+/.source;
var marker = "&" + symbol;
var par = "(\\()";
var endpar = "(?=\\))";
var space = "(?=\\s)";
var nestedPar = /(?:[^()]|\((?:[^()]|\((?:[^()]|\((?:[^()]|\((?:[^()]|\([^()]*\))*\))*\))*\))*\))*/.source;
var language = {
// Three or four semicolons are considered a heading.
// See https://www.gnu.org/software/emacs/manual/html_node/elisp/Comment-Tips.html
heading: {
pattern: /;;;.*/,
alias: ["comment", "title"]
},
comment: /;.*/,
string: {
pattern: /"(?:[^"\\]|\\.)*"/,
greedy: true,
inside: {
argument: /[-A-Z]+(?=[.,\s])/,
symbol: RegExp("`" + symbol + "'")
}
},
"quoted-symbol": {
pattern: RegExp("#?'" + symbol),
alias: ["variable", "symbol"]
},
"lisp-property": {
pattern: RegExp(":" + symbol),
alias: "property"
},
splice: {
pattern: RegExp(",@?" + symbol),
alias: ["symbol", "variable"]
},
keyword: [
{
pattern: RegExp(
par + "(?:and|(?:cl-)?letf|cl-loop|cond|cons|error|if|(?:lexical-)?let\\*?|message|not|null|or|provide|require|setq|unless|use-package|when|while)" + space
),
lookbehind: true
},
{
pattern: RegExp(
par + "(?:append|by|collect|concat|do|finally|for|in|return)" + space
),
lookbehind: true
}
],
declare: {
pattern: simple_form(/declare/.source),
lookbehind: true,
alias: "keyword"
},
interactive: {
pattern: simple_form(/interactive/.source),
lookbehind: true,
alias: "keyword"
},
boolean: {
pattern: primitive(/nil|t/.source),
lookbehind: true
},
number: {
pattern: primitive(/[-+]?\d+(?:\.\d*)?/.source),
lookbehind: true
},
defvar: {
pattern: RegExp(par + "def(?:const|custom|group|var)\\s+" + symbol),
lookbehind: true,
inside: {
keyword: /^def[a-z]+/,
variable: RegExp(symbol)
}
},
defun: {
pattern: RegExp(par + /(?:cl-)?(?:defmacro|defun\*?)\s+/.source + symbol + /\s+\(/.source + nestedPar + /\)/.source),
lookbehind: true,
greedy: true,
inside: {
keyword: /^(?:cl-)?def\S+/,
// See below, this property needs to be defined later so that it can
// reference the language object.
arguments: null,
function: {
pattern: RegExp("(^\\s)" + symbol),
lookbehind: true
},
punctuation: /[()]/
}
},
lambda: {
pattern: RegExp(par + "lambda\\s+\\(\\s*(?:&?" + symbol + "(?:\\s+&?" + symbol + ")*\\s*)?\\)"),
lookbehind: true,
greedy: true,
inside: {
keyword: /^lambda/,
// See below, this property needs to be defined later so that it can
// reference the language object.
arguments: null,
punctuation: /[()]/
}
},
car: {
pattern: RegExp(par + symbol),
lookbehind: true
},
punctuation: [
// open paren, brackets, and close paren
/(?:['`,]?\(|[)\[\]])/,
// cons
{
pattern: /(\s)\.(?=\s)/,
lookbehind: true
}
]
};
var arg = {
"lisp-marker": RegExp(marker),
"varform": {
pattern: RegExp(/\(/.source + symbol + /\s+(?=\S)/.source + nestedPar + /\)/.source),
inside: language
},
"argument": {
pattern: RegExp(/(^|[\s(])/.source + symbol),
lookbehind: true,
alias: "variable"
},
rest: language
};
var forms = "\\S+(?:\\s+\\S+)*";
var arglist = {
pattern: RegExp(par + nestedPar + endpar),
lookbehind: true,
inside: {
"rest-vars": {
pattern: RegExp("&(?:body|rest)\\s+" + forms),
inside: arg
},
"other-marker-vars": {
pattern: RegExp("&(?:aux|optional)\\s+" + forms),
inside: arg
},
keys: {
pattern: RegExp("&key\\s+" + forms + "(?:\\s+&allow-other-keys)?"),
inside: arg
},
argument: {
pattern: RegExp(symbol),
alias: "variable"
},
punctuation: /[()]/
}
};
language["lambda"].inside.arguments = arglist;
language["defun"].inside.arguments = Prism2.util.clone(arglist);
language["defun"].inside.arguments.inside.sublist = arglist;
Prism2.languages.lisp = language;
Prism2.languages.elisp = language;
Prism2.languages.emacs = language;
Prism2.languages["emacs-lisp"] = language;
})(Prism);
Prism.languages.livescript = {
"comment": [
{
pattern: /(^|[^\\])\/\*[\s\S]*?\*\//,
lookbehind: true
},
{
pattern: /(^|[^\\])#.*/,
lookbehind: true
}
],
"interpolated-string": {
/* Look-behind and look-ahead prevents wrong behavior of the greedy pattern
* forcing it to match """-quoted string when it would otherwise match "-quoted first. */
pattern: /(^|[^"])("""|")(?:\\[\s\S]|(?!\2)[^\\])*\2(?!")/,
lookbehind: true,
greedy: true,
inside: {
"variable": {
pattern: /(^|[^\\])#[a-z_](?:-?[a-z]|[\d_])*/m,
lookbehind: true
},
"interpolation": {
pattern: /(^|[^\\])#\{[^}]+\}/m,
lookbehind: true,
inside: {
"interpolation-punctuation": {
pattern: /^#\{|\}$/,
alias: "variable"
}
// See rest below
}
},
"string": /[\s\S]+/
}
},
"string": [
{
pattern: /('''|')(?:\\[\s\S]|(?!\1)[^\\])*\1/,
greedy: true
},
{
pattern: /<\[[\s\S]*?\]>/,
greedy: true
},
/\\[^\s,;\])}]+/
],
"regex": [
{
pattern: /\/\/(?:\[[^\r\n\]]*\]|\\.|(?!\/\/)[^\\\[])+\/\/[gimyu]{0,5}/,
greedy: true,
inside: {
"comment": {
pattern: /(^|[^\\])#.*/,
lookbehind: true
}
}
},
{
pattern: /\/(?:\[[^\r\n\]]*\]|\\.|[^/\\\r\n\[])+\/[gimyu]{0,5}/,
greedy: true
}
],
"keyword": {
pattern: /(^|(?!-).)\b(?:break|case|catch|class|const|continue|default|do|else|extends|fallthrough|finally|for(?: ever)?|function|if|implements|it|let|loop|new|null|otherwise|own|return|super|switch|that|then|this|throw|try|unless|until|var|void|when|while|yield)(?!-)\b/m,
lookbehind: true
},
"keyword-operator": {
pattern: /(^|[^-])\b(?:(?:delete|require|typeof)!|(?:and|by|delete|export|from|import(?: all)?|in|instanceof|is(?: not|nt)?|not|of|or|til|to|typeof|with|xor)(?!-)\b)/m,
lookbehind: true,
alias: "operator"
},
"boolean": {
pattern: /(^|[^-])\b(?:false|no|off|on|true|yes)(?!-)\b/m,
lookbehind: true
},
"argument": {
// Don't match .&. nor &&
pattern: /(^|(?!\.&\.)[^&])&(?!&)\d*/m,
lookbehind: true,
alias: "variable"
},
"number": /\b(?:\d+~[\da-z]+|\d[\d_]*(?:\.\d[\d_]*)?(?:[a-z]\w*)?)/i,
"identifier": /[a-z_](?:-?[a-z]|[\d_])*/i,
"operator": [
// Spaced .
{
pattern: /( )\.(?= )/,
lookbehind: true
},
// Full list, in order:
// .= .~ .. ...
// .&. .^. .<<. .>>. .>>>.
// := :: ::=
// &&
// || |>
// < << <<< <<<<
// <- <-- <-! <--!
// <~ <~~ <~! <~~!
// <| <= <?
// > >> >= >?
// - -- -> -->
// + ++
// @ @@
// % %%
// * **
// ! != !~=
// !~> !~~>
// !-> !-->
// ~ ~> ~~> ~=
// = ==
// ^ ^^
// / ?
/\.(?:[=~]|\.\.?)|\.(?:[&|^]|<<|>>>?)\.|:(?:=|:=?)|&&|\|[|>]|<(?:<<?<?|--?!?|~~?!?|[|=?])?|>[>=?]?|-(?:->?|>)?|\+\+?|@@?|%%?|\*\*?|!(?:~?=|--?>|~?~>)?|~(?:~?>|=)?|==?|\^\^?|[\/?]/
],
"punctuation": /[(){}\[\]|.,:;`]/
};
Prism.languages.livescript["interpolated-string"].inside["interpolation"].inside.rest = Prism.languages.livescript;
(function(Prism2) {
Prism2.languages.llvm = {
"comment": /;.*/,
"string": {
pattern: /"[^"]*"/,
greedy: true
},
"boolean": /\b(?:false|true)\b/,
"variable": /[%@!#](?:(?!\d)(?:[-$.\w]|\\[a-f\d]{2})+|\d+)/i,
"label": /(?!\d)(?:[-$.\w]|\\[a-f\d]{2})+:/i,
"type": {
pattern: /\b(?:double|float|fp128|half|i[1-9]\d*|label|metadata|ppc_fp128|token|void|x86_fp80|x86_mmx)\b/,
alias: "class-name"
},
"keyword": /\b[a-z_][a-z_0-9]*\b/,
"number": /[+-]?\b\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b|\b0x[\dA-Fa-f]+\b|\b0xK[\dA-Fa-f]{20}\b|\b0x[ML][\dA-Fa-f]{32}\b|\b0xH[\dA-Fa-f]{4}\b/,
"punctuation": /[{}[\];(),.!*=<>]/
};
})(Prism);
Prism.languages.log = {
"string": {
// Single-quoted strings must not be confused with plain text. E.g. Can't isn't Susan's Chris' toy
pattern: /"(?:[^"\\\r\n]|\\.)*"|'(?![st] | \w)(?:[^'\\\r\n]|\\.)*'/,
greedy: true
},
"exception": {
pattern: /(^|[^\w.])[a-z][\w.]*(?:Error|Exception):.*(?:(?:\r\n?|\n)[ \t]*(?:at[ \t].+|\.{3}.*|Caused by:.*))+(?:(?:\r\n?|\n)[ \t]*\.\.\. .*)?/,
lookbehind: true,
greedy: true,
alias: ["javastacktrace", "language-javastacktrace"],
inside: Prism.languages["javastacktrace"] || {
"keyword": /\bat\b/,
"function": /[a-z_][\w$]*(?=\()/,
"punctuation": /[.:()]/
}
},
"level": [
{
pattern: /\b(?:ALERT|CRIT|CRITICAL|EMERG|EMERGENCY|ERR|ERROR|FAILURE|FATAL|SEVERE)\b/,
alias: ["error", "important"]
},
{
pattern: /\b(?:WARN|WARNING|WRN)\b/,
alias: ["warning", "important"]
},
{
pattern: /\b(?:DISPLAY|INF|INFO|NOTICE|STATUS)\b/,
alias: ["info", "keyword"]
},
{
pattern: /\b(?:DBG|DEBUG|FINE)\b/,
alias: ["debug", "keyword"]
},
{
pattern: /\b(?:FINER|FINEST|TRACE|TRC|VERBOSE|VRB)\b/,
alias: ["trace", "comment"]
}
],
"property": {
pattern: /((?:^|[\]|])[ \t]*)[a-z_](?:[\w-]|\b\/\b)*(?:[. ]\(?\w(?:[\w-]|\b\/\b)*\)?)*:(?=\s)/im,
lookbehind: true
},
"separator": {
pattern: /(^|[^-+])-{3,}|={3,}|\*{3,}|- - /m,
lookbehind: true,
alias: "comment"
},
"url": /\b(?:file|ftp|https?):\/\/[^\s|,;'"]*[^\s|,;'">.]/,
"email": {
pattern: /(^|\s)[-\w+.]+@[a-z][a-z0-9-]*(?:\.[a-z][a-z0-9-]*)+(?=\s)/,
lookbehind: true,
alias: "url"
},
"ip-address": {
pattern: /\b(?:\d{1,3}(?:\.\d{1,3}){3})\b/,
alias: "constant"
},
"mac-address": {
pattern: /\b[a-f0-9]{2}(?::[a-f0-9]{2}){5}\b/i,
alias: "constant"
},
"domain": {
pattern: /(^|\s)[a-z][a-z0-9-]*(?:\.[a-z][a-z0-9-]*)*\.[a-z][a-z0-9-]+(?=\s)/,
lookbehind: true,
alias: "constant"
},
"uuid": {
pattern: /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/i,
alias: "constant"
},
"hash": {
pattern: /\b(?:[a-f0-9]{32}){1,2}\b/i,
alias: "constant"
},
"file-path": {
pattern: /\b[a-z]:[\\/][^\s|,;:(){}\[\]"']+|(^|[\s:\[\](>|])\.{0,2}\/\w[^\s|,;:(){}\[\]"']*/i,
lookbehind: true,
greedy: true,
alias: "string"
},
"date": {
pattern: RegExp(
/\b\d{4}[-/]\d{2}[-/]\d{2}(?:T(?=\d{1,2}:)|(?=\s\d{1,2}:))/.source + "|" + /\b\d{1,4}[-/ ](?:\d{1,2}|Apr|Aug|Dec|Feb|Jan|Jul|Jun|Mar|May|Nov|Oct|Sep)[-/ ]\d{2,4}T?\b/.source + "|" + /\b(?:(?:Fri|Mon|Sat|Sun|Thu|Tue|Wed)(?:\s{1,2}(?:Apr|Aug|Dec|Feb|Jan|Jul|Jun|Mar|May|Nov|Oct|Sep))?|Apr|Aug|Dec|Feb|Jan|Jul|Jun|Mar|May|Nov|Oct|Sep)\s{1,2}\d{1,2}\b/.source,
"i"
),
alias: "number"
},
"time": {
pattern: /\b\d{1,2}:\d{1,2}:\d{1,2}(?:[.,:]\d+)?(?:\s?[+-]\d{2}:?\d{2}|Z)?\b/,
alias: "number"
},
"boolean": /\b(?:false|null|true)\b/i,
"number": {
pattern: /(^|[^.\w])(?:0x[a-f0-9]+|0o[0-7]+|0b[01]+|v?\d[\da-f]*(?:\.\d+)*(?:e[+-]?\d+)?[a-z]{0,3}\b)\b(?!\.\w)/i,
lookbehind: true
},
"operator": /[;:?<=>~/@!$%&+\-|^(){}*#]/,
"punctuation": /[\[\].,]/
};
Prism.languages.lolcode = {
"comment": [
/\bOBTW\s[\s\S]*?\sTLDR\b/,
/\bBTW.+/
],
"string": {
pattern: /"(?::.|[^":])*"/,
inside: {
"variable": /:\{[^}]+\}/,
"symbol": [
/:\([a-f\d]+\)/i,
/:\[[^\]]+\]/,
/:[)>o":]/
]
},
greedy: true
},
"number": /(?:\B-)?(?:\b\d+(?:\.\d*)?|\B\.\d+)/,
"symbol": {
pattern: /(^|\s)(?:A )?(?:BUKKIT|NOOB|NUMBAR|NUMBR|TROOF|YARN)(?=\s|,|$)/,
lookbehind: true,
inside: {
"keyword": /A(?=\s)/
}
},
"label": {
pattern: /((?:^|\s)(?:IM IN YR|IM OUTTA YR) )[a-zA-Z]\w*/,
lookbehind: true,
alias: "string"
},
"function": {
pattern: /((?:^|\s)(?:HOW IZ I|I IZ|IZ) )[a-zA-Z]\w*/,
lookbehind: true
},
"keyword": [
{
pattern: /(^|\s)(?:AN|FOUND YR|GIMMEH|GTFO|HAI|HAS A|HOW IZ I|I HAS A|I IZ|IF U SAY SO|IM IN YR|IM OUTTA YR|IS NOW(?: A)?|ITZ(?: A)?|IZ|KTHX|KTHXBYE|LIEK(?: A)?|MAEK|MEBBE|MKAY|NERFIN|NO WAI|O HAI IM|O RLY\?|OIC|OMG|OMGWTF|R|SMOOSH|SRS|TIL|UPPIN|VISIBLE|WILE|WTF\?|YA RLY|YR)(?=\s|,|$)/,
lookbehind: true
},
/'Z(?=\s|,|$)/
],
"boolean": {
pattern: /(^|\s)(?:FAIL|WIN)(?=\s|,|$)/,
lookbehind: true
},
"variable": {
pattern: /(^|\s)IT(?=\s|,|$)/,
lookbehind: true
},
"operator": {
pattern: /(^|\s)(?:NOT|BOTH SAEM|DIFFRINT|(?:ALL|ANY|BIGGR|BOTH|DIFF|EITHER|MOD|PRODUKT|QUOSHUNT|SMALLR|SUM|WON) OF)(?=\s|,|$)/,
lookbehind: true
},
"punctuation": /\.{3}|…|,|!/
};
Prism.languages.magma = {
"output": {
pattern: /^(>.*(?:\r(?:\n|(?!\n))|\n))(?!>)(?:.+|(?:\r(?:\n|(?!\n))|\n)(?!>).*)(?:(?:\r(?:\n|(?!\n))|\n)(?!>).*)*/m,
lookbehind: true,
greedy: true
},
"comment": {
pattern: /\/\/.*|\/\*[\s\S]*?\*\//,
greedy: true
},
"string": {
pattern: /(^|[^\\"])"(?:[^\r\n\\"]|\\.)*"/,
lookbehind: true,
greedy: true
},
// http://magma.maths.usyd.edu.au/magma/handbook/text/82
"keyword": /\b(?:_|adj|and|assert|assert2|assert3|assigned|break|by|case|cat|catch|clear|cmpeq|cmpne|continue|declare|default|delete|diff|div|do|elif|else|end|eq|error|eval|exists|exit|for|forall|forward|fprintf|freeze|function|ge|gt|if|iload|import|in|intrinsic|is|join|le|load|local|lt|meet|mod|ne|not|notadj|notin|notsubset|or|print|printf|procedure|quit|random|read|readi|repeat|require|requirege|requirerange|restore|return|save|sdiff|select|subset|then|time|to|try|until|vprint|vprintf|vtime|when|where|while|xor)\b/,
"boolean": /\b(?:false|true)\b/,
"generator": {
pattern: /\b[a-z_]\w*(?=\s*<)/i,
alias: "class-name"
},
"function": /\b[a-z_]\w*(?=\s*\()/i,
"number": {
pattern: /(^|[^\w.]|\.\.)(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?(?:_[a-z]?)?(?=$|[^\w.]|\.\.)/,
lookbehind: true
},
"operator": /->|[-+*/^~!|#=]|:=|\.\./,
"punctuation": /[()[\]{}<>,;.:]/
};
Prism.languages.makefile = {
"comment": {
pattern: /(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,
lookbehind: true
},
"string": {
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
greedy: true
},
"builtin-target": {
pattern: /\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,
alias: "builtin"
},
"target": {
pattern: /^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,
alias: "symbol",
inside: {
"variable": /\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/
}
},
"variable": /\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,
// Directives
"keyword": /-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,
"function": {
pattern: /(\()(?:abspath|addsuffix|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:list|s)?)(?=[ \t])/,
lookbehind: true
},
"operator": /(?:::|[?:+!])?=|[|@]/,
"punctuation": /[:;(){}]/
};
(function(Prism2) {
var inner = /(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;
function createInline(pattern) {
pattern = pattern.replace(/<inner>/g, function() {
return inner;
});
return RegExp(/((?:^|[^\\])(?:\\{2})*)/.source + "(?:" + pattern + ")");
}
var tableCell = /(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source;
var tableRow = /\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g, function() {
return tableCell;
});
var tableLine = /\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;
Prism2.languages.markdown = Prism2.languages.extend("markup", {});
Prism2.languages.insertBefore("markdown", "prolog", {
"front-matter-block": {
pattern: /(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,
lookbehind: true,
greedy: true,
inside: {
"punctuation": /^---|---$/,
"front-matter": {
pattern: /\S+(?:\s+\S+)*/,
alias: ["yaml", "language-yaml"],
inside: Prism2.languages.yaml
}
}
},
"blockquote": {
// > ...
pattern: /^>(?:[\t ]*>)*/m,
alias: "punctuation"
},
"table": {
pattern: RegExp("^" + tableRow + tableLine + "(?:" + tableRow + ")*", "m"),
inside: {
"table-data-rows": {
pattern: RegExp("^(" + tableRow + tableLine + ")(?:" + tableRow + ")*$"),
lookbehind: true,
inside: {
"table-data": {
pattern: RegExp(tableCell),
inside: Prism2.languages.markdown
},
"punctuation": /\|/
}
},
"table-line": {
pattern: RegExp("^(" + tableRow + ")" + tableLine + "$"),
lookbehind: true,
inside: {
"punctuation": /\||:?-{3,}:?/
}
},
"table-header-row": {
pattern: RegExp("^" + tableRow + "$"),
inside: {
"table-header": {
pattern: RegExp(tableCell),
alias: "important",
inside: Prism2.languages.markdown
},
"punctuation": /\|/
}
}
}
},
"code": [
{
// Prefixed by 4 spaces or 1 tab and preceded by an empty line
pattern: /((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,
lookbehind: true,
alias: "keyword"
},
{
// ```optional language
// code block
// ```
pattern: /^```[\s\S]*?^```$/m,
greedy: true,
inside: {
"code-block": {
pattern: /^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,
lookbehind: true
},
"code-language": {
pattern: /^(```).+/,
lookbehind: true
},
"punctuation": /```/
}
}
],
"title": [
{
// title 1
// =======
// title 2
// -------
pattern: /\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,
alias: "important",
inside: {
punctuation: /==+$|--+$/
}
},
{
// # title 1
// ###### title 6
pattern: /(^\s*)#.+/m,
lookbehind: true,
alias: "important",
inside: {
punctuation: /^#+|#+$/
}
}
],
"hr": {
// ***
// ---
// * * *
// -----------
pattern: /(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,
lookbehind: true,
alias: "punctuation"
},
"list": {
// * item
// + item
// - item
// 1. item
pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,
lookbehind: true,
alias: "punctuation"
},
"url-reference": {
// [id]: http://example.com "Optional title"
// [id]: http://example.com 'Optional title'
// [id]: http://example.com (Optional title)
// [id]: <http://example.com> "Optional title"
pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,
inside: {
"variable": {
pattern: /^(!?\[)[^\]]+/,
lookbehind: true
},
"string": /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,
"punctuation": /^[\[\]!:]|[<>]/
},
alias: "url"
},
"bold": {
// **strong**
// __strong__
// allow one nested instance of italic text using the same delimiter
pattern: createInline(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),
lookbehind: true,
greedy: true,
inside: {
"content": {
pattern: /(^..)[\s\S]+(?=..$)/,
lookbehind: true,
inside: {}
// see below
},
"punctuation": /\*\*|__/
}
},
"italic": {
// *em*
// _em_
// allow one nested instance of bold text using the same delimiter
pattern: createInline(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),
lookbehind: true,
greedy: true,
inside: {
"content": {
pattern: /(^.)[\s\S]+(?=.$)/,
lookbehind: true,
inside: {}
// see below
},
"punctuation": /[*_]/
}
},
"strike": {
// ~~strike through~~
// ~strike~
// eslint-disable-next-line regexp/strict
pattern: createInline(/(~~?)(?:(?!~)<inner>)+\2/.source),
lookbehind: true,
greedy: true,
inside: {
"content": {
pattern: /(^~~?)[\s\S]+(?=\1$)/,
lookbehind: true,
inside: {}
// see below
},
"punctuation": /~~?/
}
},
"code-snippet": {
// `code`
// ``code``
pattern: /(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,
lookbehind: true,
greedy: true,
alias: ["code", "keyword"]
},
"url": {
// [example](http://example.com "Optional title")
// [example][id]
// [example] [id]
pattern: createInline(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),
lookbehind: true,
greedy: true,
inside: {
"operator": /^!/,
"content": {
pattern: /(^\[)[^\]]+(?=\])/,
lookbehind: true,
inside: {}
// see below
},
"variable": {
pattern: /(^\][ \t]?\[)[^\]]+(?=\]$)/,
lookbehind: true
},
"url": {
pattern: /(^\]\()[^\s)]+/,
lookbehind: true
},
"string": {
pattern: /(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,
lookbehind: true
}
}
}
});
["url", "bold", "italic", "strike"].forEach(function(token) {
["url", "bold", "italic", "strike", "code-snippet"].forEach(function(inside) {
if (token !== inside) {
Prism2.languages.markdown[token].inside.content.inside[inside] = Prism2.languages.markdown[inside];
}
});
});
Prism2.hooks.add("after-tokenize", function(env) {
if (env.language !== "markdown" && env.language !== "md") {
return;
}
function walkTokens(tokens) {
if (!tokens || typeof tokens === "string") {
return;
}
for (var i = 0, l = tokens.length; i < l; i++) {
var token = tokens[i];
if (token.type !== "code") {
walkTokens(token.content);
continue;
}
var codeLang = token.content[1];
var codeBlock = token.content[3];
if (codeLang && codeBlock && codeLang.type === "code-language" && codeBlock.type === "code-block" && typeof codeLang.content === "string") {
var lang = codeLang.content.replace(/\b#/g, "sharp").replace(/\b\+\+/g, "pp");
lang = (/[a-z][\w-]*/i.exec(lang) || [""])[0].toLowerCase();
var alias = "language-" + lang;
if (!codeBlock.alias) {
codeBlock.alias = [alias];
} else if (typeof codeBlock.alias === "string") {
codeBlock.alias = [codeBlock.alias, alias];
} else {
codeBlock.alias.push(alias);
}
}
}
}
walkTokens(env.tokens);
});
Prism2.hooks.add("wrap", function(env) {
if (env.type !== "code-block") {
return;
}
var codeLang = "";
for (var i = 0, l = env.classes.length; i < l; i++) {
var cls = env.classes[i];
var match = /language-(.+)/.exec(cls);
if (match) {
codeLang = match[1];
break;
}
}
var grammar = Prism2.languages[codeLang];
if (!grammar) {
if (codeLang && codeLang !== "none" && Prism2.plugins.autoloader) {
var id = "md-" + (/* @__PURE__ */ new Date()).valueOf() + "-" + Math.floor(Math.random() * 1e16);
env.attributes["id"] = id;
Prism2.plugins.autoloader.loadLanguages(codeLang, function() {
var ele = document.getElementById(id);
if (ele) {
ele.innerHTML = Prism2.highlight(ele.textContent, Prism2.languages[codeLang], codeLang);
}
});
}
} else {
env.content = Prism2.highlight(textContent(env.content), grammar, codeLang);
}
});
var tagPattern = RegExp(Prism2.languages.markup.tag.pattern.source, "gi");
var KNOWN_ENTITY_NAMES = {
"amp": "&",
"lt": "<",
"gt": ">",
"quot": '"'
};
var fromCodePoint = String.fromCodePoint || String.fromCharCode;
function textContent(html) {
var text = html.replace(tagPattern, "");
text = text.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi, function(m, code) {
code = code.toLowerCase();
if (code[0] === "#") {
var value;
if (code[1] === "x") {
value = parseInt(code.slice(2), 16);
} else {
value = Number(code.slice(1));
}
return fromCodePoint(value);
} else {
var known = KNOWN_ENTITY_NAMES[code];
if (known) {
return known;
}
return m;
}
});
return text;
}
Prism2.languages.md = Prism2.languages.markdown;
})(Prism);
(function(Prism2) {
var orgType = /\b(?:(?:col|row)?vector|matrix|scalar)\b/.source;
var type = /\bvoid\b|<org>|\b(?:complex|numeric|pointer(?:\s*\([^()]*\))?|real|string|(?:class|struct)\s+\w+|transmorphic)(?:\s*<org>)?/.source.replace(/<org>/g, orgType);
Prism2.languages.mata = {
"comment": {
pattern: /\/\/.*|\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\//,
greedy: true
},
"string": {
pattern: /"[^"\r\n]*"|[‘`']".*?"[’`']/,
greedy: true
},
"class-name": {
pattern: /(\b(?:class|extends|struct)\s+)\w+(?=\s*(?:\{|\bextends\b))/,
lookbehind: true
},
"type": {
pattern: RegExp(type),
alias: "class-name",
inside: {
"punctuation": /[()]/,
"keyword": /\b(?:class|function|struct|void)\b/
}
},
"keyword": /\b(?:break|class|continue|do|else|end|extends|external|final|for|function|goto|if|pragma|private|protected|public|return|static|struct|unset|unused|version|virtual|while)\b/,
"constant": /\bNULL\b/,
"number": {
pattern: /(^|[^\w.])(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?|\d[a-f0-9]*(?:\.[a-f0-9]+)?x[+-]?\d+)i?(?![\w.])/i,
lookbehind: true
},
"missing": {
pattern: /(^|[^\w.])(?:\.[a-z]?)(?![\w.])/,
lookbehind: true,
alias: "symbol"
},
"function": /\b[a-z_]\w*(?=\s*\()/i,
"operator": /\.\.|\+\+|--|&&|\|\||:?(?:[!=<>]=|[+\-*/^<>&|:])|[!?=\\#’`']/,
"punctuation": /[()[\]{},;.]/
};
})(Prism);
Prism.languages.matlab = {
"comment": [
/%\{[\s\S]*?\}%/,
/%.+/
],
"string": {
pattern: /\B'(?:''|[^'\r\n])*'/,
greedy: true
},
// FIXME We could handle imaginary numbers as a whole
"number": /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[eE][+-]?\d+)?(?:[ij])?|\b[ij]\b/,
"keyword": /\b(?:NaN|break|case|catch|continue|else|elseif|end|for|function|if|inf|otherwise|parfor|pause|pi|return|switch|try|while)\b/,
"function": /\b(?!\d)\w+(?=\s*\()/,
"operator": /\.?[*^\/\\']|[+\-:@]|[<>=~]=?|&&?|\|\|?/,
"punctuation": /\.{3}|[.,;\[\](){}!]/
};
(function(Prism2) {
var keywords = /\b(?:about|and|animate|as|at|attributes|by|case|catch|collect|continue|coordsys|do|else|exit|fn|for|from|function|global|if|in|local|macroscript|mapped|max|not|of|off|on|or|parameters|persistent|plugin|rcmenu|return|rollout|set|struct|then|throw|to|tool|try|undo|utility|when|where|while|with)\b/i;
Prism2.languages.maxscript = {
"comment": {
pattern: /\/\*[\s\S]*?(?:\*\/|$)|--.*/,
greedy: true
},
"string": {
pattern: /(^|[^"\\@])(?:"(?:[^"\\]|\\[\s\S])*"|@"[^"]*")/,
lookbehind: true,
greedy: true
},
"path": {
pattern: /\$(?:[\w/\\.*?]|'[^']*')*/,
greedy: true,
alias: "string"
},
"function-call": {
pattern: RegExp(
"((?:" + // start of line
(/^/.source + "|" + // operators and other language constructs
/[;=<>+\-*/^({\[]/.source + "|" + // keywords as part of statements
/\b(?:and|by|case|catch|collect|do|else|if|in|not|or|return|then|to|try|where|while|with)\b/.source) + ")[ ]*)(?!" + keywords.source + ")" + /[a-z_]\w*\b/.source + "(?=[ ]*(?:" + // variable
("(?!" + keywords.source + ")" + /[a-z_]/.source + "|" + // number
/\d|-\.?\d/.source + "|" + // other expressions or literals
/[({'"$@#?]/.source) + "))",
"im"
),
lookbehind: true,
greedy: true,
alias: "function"
},
"function-definition": {
pattern: /(\b(?:fn|function)\s+)\w+\b/i,
lookbehind: true,
alias: "function"
},
"argument": {
pattern: /\b[a-z_]\w*(?=:)/i,
alias: "attr-name"
},
"keyword": keywords,
"boolean": /\b(?:false|true)\b/,
"time": {
pattern: /(^|[^\w.])(?:(?:(?:\d+(?:\.\d*)?|\.\d+)(?:[eEdD][+-]\d+|[LP])?[msft])+|\d+:\d+(?:\.\d*)?)(?![\w.:])/,
lookbehind: true,
alias: "number"
},
"number": [
{
pattern: /(^|[^\w.])(?:(?:\d+(?:\.\d*)?|\.\d+)(?:[eEdD][+-]\d+|[LP])?|0x[a-fA-F0-9]+)(?![\w.:])/,
lookbehind: true
},
/\b(?:e|pi)\b/
],
"constant": /\b(?:dontcollect|ok|silentValue|undefined|unsupplied)\b/,
"color": {
pattern: /\b(?:black|blue|brown|gray|green|orange|red|white|yellow)\b/i,
alias: "constant"
},
"operator": /[-+*/<>=!]=?|[&^?]|#(?!\()/,
"punctuation": /[()\[\]{}.:,;]|#(?=\()|\\$/m
};
})(Prism);
Prism.languages.mel = {
"comment": {
pattern: /\/\/.*|\/\*[\s\S]*?\*\//,
greedy: true
},
"code": {
pattern: /`(?:\\.|[^\\`])*`/,
greedy: true,
alias: "italic",
inside: {
"delimiter": {
pattern: /^`|`$/,
alias: "punctuation"
},
"statement": {
pattern: /[\s\S]+/,
inside: null
// see below
}
}
},
"string": {
pattern: /"(?:\\.|[^\\"\r\n])*"/,
greedy: true
},
"variable": /\$\w+/,
"number": /\b0x[\da-fA-F]+\b|\b\d+(?:\.\d*)?|\B\.\d+/,
"flag": {
pattern: /-[^\d\W]\w*/,
alias: "operator"
},
"keyword": /\b(?:break|case|continue|default|do|else|float|for|global|if|in|int|matrix|proc|return|string|switch|vector|while)\b/,
"function": {
pattern: /((?:^|[{;])[ \t]*)[a-z_]\w*\b(?!\s*(?:\.(?!\.)|[[{=]))|\b[a-z_]\w*(?=[ \t]*\()/im,
lookbehind: true,
greedy: true
},
"tensor-punctuation": {
pattern: /<<|>>/,
alias: "punctuation"
},
"operator": /\+[+=]?|-[-=]?|&&|\|\||[<>]=?|[*\/!=]=?|[%^]/,
"punctuation": /[.,:;?\[\](){}]/
};
Prism.languages.mel["code"].inside["statement"].inside = Prism.languages.mel;
Prism.languages.mermaid = {
"comment": {
pattern: /%%.*/,
greedy: true
},
"style": {
pattern: /^([ \t]*(?:classDef|linkStyle|style)[ \t]+[\w$-]+[ \t]+)\w.*[^\s;]/m,
lookbehind: true,
inside: {
"property": /\b\w[\w-]*(?=[ \t]*:)/,
"operator": /:/,
"punctuation": /,/
}
},
"inter-arrow-label": {
pattern: /([^<>ox.=-])(?:-[-.]|==)(?![<>ox.=-])[ \t]*(?:"[^"\r\n]*"|[^\s".=-](?:[^\r\n.=-]*[^\s.=-])?)[ \t]*(?:\.+->?|--+[->]|==+[=>])(?![<>ox.=-])/,
lookbehind: true,
greedy: true,
inside: {
"arrow": {
pattern: /(?:\.+->?|--+[->]|==+[=>])$/,
alias: "operator"
},
"label": {
pattern: /^([\s\S]{2}[ \t]*)\S(?:[\s\S]*\S)?/,
lookbehind: true,
alias: "property"
},
"arrow-head": {
pattern: /^\S+/,
alias: ["arrow", "operator"]
}
}
},
"arrow": [
// This might look complex but it really isn't.
// There are many possible arrows (see tests) and it's impossible to fit all of them into one pattern. The
// problem is that we only have one lookbehind per pattern. However, we cannot disallow too many arrow
// characters in the one lookbehind because that would create too many false negatives. So we have to split the
// arrows into different patterns.
{
// ER diagram
pattern: /(^|[^{}|o.-])[|}][|o](?:--|\.\.)[|o][|{](?![{}|o.-])/,
lookbehind: true,
alias: "operator"
},
{
// flow chart
// (?:==+|--+|-\.*-)
pattern: /(^|[^<>ox.=-])(?:[<ox](?:==+|--+|-\.*-)[>ox]?|(?:==+|--+|-\.*-)[>ox]|===+|---+|-\.+-)(?![<>ox.=-])/,
lookbehind: true,
alias: "operator"
},
{
// sequence diagram
pattern: /(^|[^<>()x-])(?:--?(?:>>|[x>)])(?![<>()x])|(?:<<|[x<(])--?(?!-))/,
lookbehind: true,
alias: "operator"
},
{
// class diagram
pattern: /(^|[^<>|*o.-])(?:[*o]--|--[*o]|<\|?(?:--|\.\.)|(?:--|\.\.)\|?>|--|\.\.)(?![<>|*o.-])/,
lookbehind: true,
alias: "operator"
}
],
"label": {
pattern: /(^|[^|<])\|(?:[^\r\n"|]|"[^"\r\n]*")+\|/,
lookbehind: true,
greedy: true,
alias: "property"
},
"text": {
pattern: /(?:[(\[{]+|\b>)(?:[^\r\n"()\[\]{}]|"[^"\r\n]*")+(?:[)\]}]+|>)/,
alias: "string"
},
"string": {
pattern: /"[^"\r\n]*"/,
greedy: true
},
"annotation": {
pattern: /<<(?:abstract|choice|enumeration|fork|interface|join|service)>>|\[\[(?:choice|fork|join)\]\]/i,
alias: "important"
},
"keyword": [
// This language has both case-sensitive and case-insensitive keywords
{
pattern: /(^[ \t]*)(?:action|callback|class|classDef|classDiagram|click|direction|erDiagram|flowchart|gantt|gitGraph|graph|journey|link|linkStyle|pie|requirementDiagram|sequenceDiagram|stateDiagram|stateDiagram-v2|style|subgraph)(?![\w$-])/m,
lookbehind: true,
greedy: true
},
{
pattern: /(^[ \t]*)(?:activate|alt|and|as|autonumber|deactivate|else|end(?:[ \t]+note)?|loop|opt|par|participant|rect|state|note[ \t]+(?:over|(?:left|right)[ \t]+of))(?![\w$-])/im,
lookbehind: true,
greedy: true
}
],
"entity": /#[a-z0-9]+;/,
"operator": {
pattern: /(\w[ \t]*)&(?=[ \t]*\w)|:::|:/,
lookbehind: true
},
"punctuation": /[(){};]/
};
Prism.languages.mizar = {
"comment": /::.+/,
"keyword": /@proof\b|\b(?:according|aggregate|all|and|antonym|are|as|associativity|assume|asymmetry|attr|be|begin|being|by|canceled|case|cases|clusters?|coherence|commutativity|compatibility|connectedness|consider|consistency|constructors|contradiction|correctness|def|deffunc|define|definitions?|defpred|do|does|end|environ|equals|ex|exactly|existence|for|from|func|given|hence|hereby|holds|idempotence|identity|iff?|implies|involutiveness|irreflexivity|is|it|let|means|mode|non|not|notations?|now|of|or|otherwise|over|per|pred|prefix|projectivity|proof|provided|qua|reconsider|redefine|reduce|reducibility|reflexivity|registrations?|requirements|reserve|sch|schemes?|section|selector|set|sethood|st|struct|such|suppose|symmetry|synonym|take|that|the|then|theorems?|thesis|thus|to|transitivity|uniqueness|vocabular(?:ies|y)|when|where|with|wrt)\b/,
"parameter": {
pattern: /\$(?:10|\d)/,
alias: "variable"
},
"variable": /\b\w+(?=:)/,
"number": /(?:\b|-)\d+\b/,
"operator": /\.\.\.|->|&|\.?=/,
"punctuation": /\(#|#\)|[,:;\[\](){}]/
};
(function(Prism2) {
var operators = [
// query and projection
"$eq",
"$gt",
"$gte",
"$in",
"$lt",
"$lte",
"$ne",
"$nin",
"$and",
"$not",
"$nor",
"$or",
"$exists",
"$type",
"$expr",
"$jsonSchema",
"$mod",
"$regex",
"$text",
"$where",
"$geoIntersects",
"$geoWithin",
"$near",
"$nearSphere",
"$all",
"$elemMatch",
"$size",
"$bitsAllClear",
"$bitsAllSet",
"$bitsAnyClear",
"$bitsAnySet",
"$comment",
"$elemMatch",
"$meta",
"$slice",
// update
"$currentDate",
"$inc",
"$min",
"$max",
"$mul",
"$rename",
"$set",
"$setOnInsert",
"$unset",
"$addToSet",
"$pop",
"$pull",
"$push",
"$pullAll",
"$each",
"$position",
"$slice",
"$sort",
"$bit",
// aggregation pipeline stages
"$addFields",
"$bucket",
"$bucketAuto",
"$collStats",
"$count",
"$currentOp",
"$facet",
"$geoNear",
"$graphLookup",
"$group",
"$indexStats",
"$limit",
"$listLocalSessions",
"$listSessions",
"$lookup",
"$match",
"$merge",
"$out",
"$planCacheStats",
"$project",
"$redact",
"$replaceRoot",
"$replaceWith",
"$sample",
"$set",
"$skip",
"$sort",
"$sortByCount",
"$unionWith",
"$unset",
"$unwind",
"$setWindowFields",
// aggregation pipeline operators
"$abs",
"$accumulator",
"$acos",
"$acosh",
"$add",
"$addToSet",
"$allElementsTrue",
"$and",
"$anyElementTrue",
"$arrayElemAt",
"$arrayToObject",
"$asin",
"$asinh",
"$atan",
"$atan2",
"$atanh",
"$avg",
"$binarySize",
"$bsonSize",
"$ceil",
"$cmp",
"$concat",
"$concatArrays",
"$cond",
"$convert",
"$cos",
"$dateFromParts",
"$dateToParts",
"$dateFromString",
"$dateToString",
"$dayOfMonth",
"$dayOfWeek",
"$dayOfYear",
"$degreesToRadians",
"$divide",
"$eq",
"$exp",
"$filter",
"$first",
"$floor",
"$function",
"$gt",
"$gte",
"$hour",
"$ifNull",
"$in",
"$indexOfArray",
"$indexOfBytes",
"$indexOfCP",
"$isArray",
"$isNumber",
"$isoDayOfWeek",
"$isoWeek",
"$isoWeekYear",
"$last",
"$last",
"$let",
"$literal",
"$ln",
"$log",
"$log10",
"$lt",
"$lte",
"$ltrim",
"$map",
"$max",
"$mergeObjects",
"$meta",
"$min",
"$millisecond",
"$minute",
"$mod",
"$month",
"$multiply",
"$ne",
"$not",
"$objectToArray",
"$or",
"$pow",
"$push",
"$radiansToDegrees",
"$range",
"$reduce",
"$regexFind",
"$regexFindAll",
"$regexMatch",
"$replaceOne",
"$replaceAll",
"$reverseArray",
"$round",
"$rtrim",
"$second",
"$setDifference",
"$setEquals",
"$setIntersection",
"$setIsSubset",
"$setUnion",
"$size",
"$sin",
"$slice",
"$split",
"$sqrt",
"$stdDevPop",
"$stdDevSamp",
"$strcasecmp",
"$strLenBytes",
"$strLenCP",
"$substr",
"$substrBytes",
"$substrCP",
"$subtract",
"$sum",
"$switch",
"$tan",
"$toBool",
"$toDate",
"$toDecimal",
"$toDouble",
"$toInt",
"$toLong",
"$toObjectId",
"$toString",
"$toLower",
"$toUpper",
"$trim",
"$trunc",
"$type",
"$week",
"$year",
"$zip",
"$count",
"$dateAdd",
"$dateDiff",
"$dateSubtract",
"$dateTrunc",
"$getField",
"$rand",
"$sampleRate",
"$setField",
"$unsetField",
// aggregation pipeline query modifiers
"$comment",
"$explain",
"$hint",
"$max",
"$maxTimeMS",
"$min",
"$orderby",
"$query",
"$returnKey",
"$showDiskLoc",
"$natural"
];
var builtinFunctions = [
"ObjectId",
"Code",
"BinData",
"DBRef",
"Timestamp",
"NumberLong",
"NumberDecimal",
"MaxKey",
"MinKey",
"RegExp",
"ISODate",
"UUID"
];
operators = operators.map(function(operator) {
return operator.replace("$", "\\$");
});
var operatorsSource = "(?:" + operators.join("|") + ")\\b";
Prism2.languages.mongodb = Prism2.languages.extend("javascript", {});
Prism2.languages.insertBefore("mongodb", "string", {
"property": {
pattern: /(?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)(?=\s*:)/,
greedy: true,
inside: {
"keyword": RegExp(`^(['"])?` + operatorsSource + "(?:\\1)?$")
}
}
});
Prism2.languages.mongodb.string.inside = {
url: {
// url pattern
pattern: /https?:\/\/[-\w@:%.+~#=]{1,256}\.[a-z0-9()]{1,6}\b[-\w()@:%+.~#?&/=]*/i,
greedy: true
},
entity: {
// ipv4
pattern: /\b(?:(?:[01]?\d\d?|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d\d?|2[0-4]\d|25[0-5])\b/,
greedy: true
}
};
Prism2.languages.insertBefore("mongodb", "constant", {
"builtin": {
pattern: RegExp("\\b(?:" + builtinFunctions.join("|") + ")\\b"),
alias: "keyword"
}
});
})(Prism);
Prism.languages.monkey = {
"comment": {
pattern: /^#Rem\s[\s\S]*?^#End|'.+/im,
greedy: true
},
"string": {
pattern: /"[^"\r\n]*"/,
greedy: true
},
"preprocessor": {
pattern: /(^[ \t]*)#.+/m,
lookbehind: true,
greedy: true,
alias: "property"
},
"function": /\b\w+(?=\()/,
"type-char": {
pattern: /\b[?%#$]/,
alias: "class-name"
},
"number": {
pattern: /((?:\.\.)?)(?:(?:\b|\B-\.?|\B\.)\d+(?:(?!\.\.)\.\d*)?|\$[\da-f]+)/i,
lookbehind: true
},
"keyword": /\b(?:Abstract|Array|Bool|Case|Catch|Class|Const|Continue|Default|Eachin|Else|ElseIf|End|EndIf|Exit|Extends|Extern|False|Field|Final|Float|For|Forever|Function|Global|If|Implements|Import|Inline|Int|Interface|Local|Method|Module|New|Next|Null|Object|Private|Property|Public|Repeat|Return|Select|Self|Step|Strict|String|Super|Then|Throw|To|True|Try|Until|Void|Wend|While)\b/i,
"operator": /\.\.|<[=>]?|>=?|:?=|(?:[+\-*\/&~|]|\b(?:Mod|Shl|Shr)\b)=?|\b(?:And|Not|Or)\b/i,
"punctuation": /[.,:;()\[\]]/
};
Prism.languages.moonscript = {
"comment": /--.*/,
"string": [
{
pattern: /'[^']*'|\[(=*)\[[\s\S]*?\]\1\]/,
greedy: true
},
{
pattern: /"[^"]*"/,
greedy: true,
inside: {
"interpolation": {
pattern: /#\{[^{}]*\}/,
inside: {
"moonscript": {
pattern: /(^#\{)[\s\S]+(?=\})/,
lookbehind: true,
inside: null
// see beow
},
"interpolation-punctuation": {
pattern: /#\{|\}/,
alias: "punctuation"
}
}
}
}
}
],
"class-name": [
{
pattern: /(\b(?:class|extends)[ \t]+)\w+/,
lookbehind: true
},
// class-like names start with a capital letter
/\b[A-Z]\w*/
],
"keyword": /\b(?:class|continue|do|else|elseif|export|extends|for|from|if|import|in|local|nil|return|self|super|switch|then|unless|using|when|while|with)\b/,
"variable": /@@?\w*/,
"property": {
pattern: /\b(?!\d)\w+(?=:)|(:)(?!\d)\w+/,
lookbehind: true
},
"function": {
pattern: /\b(?:_G|_VERSION|assert|collectgarbage|coroutine\.(?:create|resume|running|status|wrap|yield)|debug\.(?:debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue|setfenv|sethook|setlocal|setmetatable|setupvalue|traceback)|dofile|error|getfenv|getmetatable|io\.(?:close|flush|input|lines|open|output|popen|read|stderr|stdin|stdout|tmpfile|type|write)|ipairs|load|loadfile|loadstring|math\.(?:abs|acos|asin|atan|atan2|ceil|cos|cosh|deg|exp|floor|fmod|frexp|ldexp|log|log10|max|min|modf|pi|pow|rad|random|randomseed|sin|sinh|sqrt|tan|tanh)|module|next|os\.(?:clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)|package\.(?:cpath|loaded|loadlib|path|preload|seeall)|pairs|pcall|print|rawequal|rawget|rawset|require|select|setfenv|setmetatable|string\.(?:byte|char|dump|find|format|gmatch|gsub|len|lower|match|rep|reverse|sub|upper)|table\.(?:concat|insert|maxn|remove|sort)|tonumber|tostring|type|unpack|xpcall)\b/,
inside: {
"punctuation": /\./
}
},
"boolean": /\b(?:false|true)\b/,
"number": /(?:\B\.\d+|\b\d+\.\d+|\b\d+(?=[eE]))(?:[eE][-+]?\d+)?\b|\b(?:0x[a-fA-F\d]+|\d+)(?:U?LL)?\b/,
"operator": /\.{3}|[-=]>|~=|(?:[-+*/%<>!=]|\.\.)=?|[:#^]|\b(?:and|or)\b=?|\b(?:not)\b/,
"punctuation": /[.,()[\]{}\\]/
};
Prism.languages.moonscript.string[1].inside.interpolation.inside.moonscript.inside = Prism.languages.moonscript;
Prism.languages.moon = Prism.languages.moonscript;
Prism.languages.n1ql = {
"comment": {
pattern: /\/\*[\s\S]*?(?:$|\*\/)|--.*/,
greedy: true
},
"string": {
pattern: /(["'])(?:\\[\s\S]|(?!\1)[^\\]|\1\1)*\1/,
greedy: true
},
"identifier": {
pattern: /`(?:\\[\s\S]|[^\\`]|``)*`/,
greedy: true
},
"parameter": /\$[\w.]+/,
// https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/reservedwords.html#n1ql-reserved-words
"keyword": /\b(?:ADVISE|ALL|ALTER|ANALYZE|AS|ASC|AT|BEGIN|BINARY|BOOLEAN|BREAK|BUCKET|BUILD|BY|CALL|CAST|CLUSTER|COLLATE|COLLECTION|COMMIT|COMMITTED|CONNECT|CONTINUE|CORRELATE|CORRELATED|COVER|CREATE|CURRENT|DATABASE|DATASET|DATASTORE|DECLARE|DECREMENT|DELETE|DERIVED|DESC|DESCRIBE|DISTINCT|DO|DROP|EACH|ELEMENT|EXCEPT|EXCLUDE|EXECUTE|EXPLAIN|FETCH|FILTER|FLATTEN|FLUSH|FOLLOWING|FOR|FORCE|FROM|FTS|FUNCTION|GOLANG|GRANT|GROUP|GROUPS|GSI|HASH|HAVING|IF|IGNORE|ILIKE|INCLUDE|INCREMENT|INDEX|INFER|INLINE|INNER|INSERT|INTERSECT|INTO|IS|ISOLATION|JAVASCRIPT|JOIN|KEY|KEYS|KEYSPACE|KNOWN|LANGUAGE|LAST|LEFT|LET|LETTING|LEVEL|LIMIT|LSM|MAP|MAPPING|MATCHED|MATERIALIZED|MERGE|MINUS|MISSING|NAMESPACE|NEST|NL|NO|NTH_VALUE|NULL|NULLS|NUMBER|OBJECT|OFFSET|ON|OPTION|OPTIONS|ORDER|OTHERS|OUTER|OVER|PARSE|PARTITION|PASSWORD|PATH|POOL|PRECEDING|PREPARE|PRIMARY|PRIVATE|PRIVILEGE|PROBE|PROCEDURE|PUBLIC|RANGE|RAW|REALM|REDUCE|RENAME|RESPECT|RETURN|RETURNING|REVOKE|RIGHT|ROLE|ROLLBACK|ROW|ROWS|SATISFIES|SAVEPOINT|SCHEMA|SCOPE|SELECT|SELF|SEMI|SET|SHOW|SOME|START|STATISTICS|STRING|SYSTEM|TIES|TO|TRAN|TRANSACTION|TRIGGER|TRUNCATE|UNBOUNDED|UNDER|UNION|UNIQUE|UNKNOWN|UNNEST|UNSET|UPDATE|UPSERT|USE|USER|USING|VALIDATE|VALUE|VALUES|VIA|VIEW|WHERE|WHILE|WINDOW|WITH|WORK|XOR)\b/i,
"function": /\b[a-z_]\w*(?=\s*\()/i,
"boolean": /\b(?:FALSE|TRUE)\b/i,
"number": /(?:\b\d+\.|\B\.)\d+e[+\-]?\d+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,
"operator": /[-+*\/%]|!=|==?|\|\||<[>=]?|>=?|\b(?:AND|ANY|ARRAY|BETWEEN|CASE|ELSE|END|EVERY|EXISTS|FIRST|IN|LIKE|NOT|OR|THEN|VALUED|WHEN|WITHIN)\b/i,
"punctuation": /[;[\](),.{}:]/
};
Prism.languages.n4js = Prism.languages.extend("javascript", {
// Keywords from N4JS language spec: https://numberfour.github.io/n4js/spec/N4JSSpec.html
"keyword": /\b(?:Array|any|boolean|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|module|new|null|number|package|private|protected|public|return|set|static|string|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/
});
Prism.languages.insertBefore("n4js", "constant", {
// Annotations in N4JS spec: https://numberfour.github.io/n4js/spec/N4JSSpec.html#_annotations
"annotation": {
pattern: /@+\w+/,
alias: "operator"
}
});
Prism.languages.n4jsd = Prism.languages.n4js;
Prism.languages["nand2tetris-hdl"] = {
"comment": /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
"keyword": /\b(?:BUILTIN|CHIP|CLOCKED|IN|OUT|PARTS)\b/,
"boolean": /\b(?:false|true)\b/,
"function": /\b[A-Za-z][A-Za-z0-9]*(?=\()/,
"number": /\b\d+\b/,
"operator": /=|\.\./,
"punctuation": /[{}[\];(),:]/
};
(function(Prism2) {
var expressionDef = /\{[^\r\n\[\]{}]*\}/;
var params = {
"quoted-string": {
pattern: /"(?:[^"\\]|\\.)*"/,
alias: "operator"
},
"command-param-id": {
pattern: /(\s)\w+:/,
lookbehind: true,
alias: "property"
},
"command-param-value": [
{
pattern: expressionDef,
alias: "selector"
},
{
pattern: /([\t ])\S+/,
lookbehind: true,
greedy: true,
alias: "operator"
},
{
pattern: /\S(?:.*\S)?/,
alias: "operator"
}
]
};
Prism2.languages.naniscript = {
// ; ...
"comment": {
pattern: /^([\t ]*);.*/m,
lookbehind: true
},
// > ...
// Define is a control line starting with '>' followed by a word, a space and a text.
"define": {
pattern: /^>.+/m,
alias: "tag",
inside: {
"value": {
pattern: /(^>\w+[\t ]+)(?!\s)[^{}\r\n]+/,
lookbehind: true,
alias: "operator"
},
"key": {
pattern: /(^>)\w+/,
lookbehind: true
}
}
},
// # ...
"label": {
pattern: /^([\t ]*)#[\t ]*\w+[\t ]*$/m,
lookbehind: true,
alias: "regex"
},
"command": {
pattern: /^([\t ]*)@\w+(?=[\t ]|$).*/m,
lookbehind: true,
alias: "function",
inside: {
"command-name": /^@\w+/,
"expression": {
pattern: expressionDef,
greedy: true,
alias: "selector"
},
"command-params": {
pattern: /\s*\S[\s\S]*/,
inside: params
}
}
},
// Generic is any line that doesn't start with operators: ;>#@
"generic-text": {
pattern: /(^[ \t]*)[^#@>;\s].*/m,
lookbehind: true,
alias: "punctuation",
inside: {
// \{ ... \} ... \[ ... \] ... \"
"escaped-char": /\\[{}\[\]"]/,
"expression": {
pattern: expressionDef,
greedy: true,
alias: "selector"
},
"inline-command": {
pattern: /\[[\t ]*\w[^\r\n\[\]]*\]/,
greedy: true,
alias: "function",
inside: {
"command-params": {
pattern: /(^\[[\t ]*\w+\b)[\s\S]+(?=\]$)/,
lookbehind: true,
inside: params
},
"command-param-name": {
pattern: /^(\[[\t ]*)\w+/,
lookbehind: true,
alias: "name"
},
"start-stop-char": /[\[\]]/
}
}
}
}
};
Prism2.languages.nani = Prism2.languages["naniscript"];
Prism2.hooks.add("after-tokenize", function(env) {
var tokens = env.tokens;
tokens.forEach(function(token) {
if (typeof token !== "string" && token.type === "generic-text") {
var content = getTextContent(token);
if (!isBracketsBalanced(content)) {
token.type = "bad-line";
token.content = content;
}
}
});
});
function isBracketsBalanced(input) {
var brackets = "[]{}";
var stack = [];
for (var i = 0; i < input.length; i++) {
var bracket = input[i];
var bracketsIndex = brackets.indexOf(bracket);
if (bracketsIndex !== -1) {
if (bracketsIndex % 2 === 0) {
stack.push(bracketsIndex + 1);
} else if (stack.pop() !== bracketsIndex) {
return false;
}
}
}
return stack.length === 0;
}
function getTextContent(token) {
if (typeof token === "string") {
return token;
} else if (Array.isArray(token)) {
return token.map(getTextContent).join("");
} else {
return getTextContent(token.content);
}
}
})(Prism);
Prism.languages.nasm = {
"comment": /;.*$/m,
"string": /(["'`])(?:\\.|(?!\1)[^\\\r\n])*\1/,
"label": {
pattern: /(^\s*)[A-Za-z._?$][\w.?$@~#]*:/m,
lookbehind: true,
alias: "function"
},
"keyword": [
/\[?BITS (?:16|32|64)\]?/,
{
pattern: /(^\s*)section\s*[a-z.]+:?/im,
lookbehind: true
},
/(?:extern|global)[^;\r\n]*/i,
/(?:CPU|DEFAULT|FLOAT).*$/m
],
"register": {
pattern: /\b(?:st\d|[xyz]mm\d\d?|[cdt]r\d|r\d\d?[bwd]?|[er]?[abcd]x|[abcd][hl]|[er]?(?:bp|di|si|sp)|[cdefgs]s)\b/i,
alias: "variable"
},
"number": /(?:\b|(?=\$))(?:0[hx](?:\.[\da-f]+|[\da-f]+(?:\.[\da-f]+)?)(?:p[+-]?\d+)?|\d[\da-f]+[hx]|\$\d[\da-f]*|0[oq][0-7]+|[0-7]+[oq]|0[by][01]+|[01]+[by]|0[dt]\d+|(?:\d+(?:\.\d+)?|\.\d+)(?:\.?e[+-]?\d+)?[dt]?)\b/i,
"operator": /[\[\]*+\-\/%<>=&|$!]/
};
Prism.languages.neon = {
"comment": {
pattern: /#.*/,
greedy: true
},
"datetime": {
pattern: /(^|[[{(=:,\s])\d\d\d\d-\d\d?-\d\d?(?:(?:[Tt]| +)\d\d?:\d\d:\d\d(?:\.\d*)? *(?:Z|[-+]\d\d?(?::?\d\d)?)?)?(?=$|[\]}),\s])/,
lookbehind: true,
alias: "number"
},
"key": {
pattern: /(^|[[{(,\s])[^,:=[\]{}()'"\s]+(?=\s*:(?:$|[\]}),\s])|\s*=)/,
lookbehind: true,
alias: "property"
},
"number": {
pattern: /(^|[[{(=:,\s])[+-]?(?:0x[\da-fA-F]+|0o[0-7]+|0b[01]+|(?:\d+(?:\.\d*)?|\.?\d+)(?:[eE][+-]?\d+)?)(?=$|[\]}),:=\s])/,
lookbehind: true
},
"boolean": {
pattern: /(^|[[{(=:,\s])(?:false|no|true|yes)(?=$|[\]}),:=\s])/i,
lookbehind: true
},
"null": {
pattern: /(^|[[{(=:,\s])(?:null)(?=$|[\]}),:=\s])/i,
lookbehind: true,
alias: "keyword"
},
"string": {
pattern: /(^|[[{(=:,\s])(?:('''|""")\r?\n(?:(?:[^\r\n]|\r?\n(?![\t ]*\2))*\r?\n)?[\t ]*\2|'[^'\r\n]*'|"(?:\\.|[^\\"\r\n])*")/,
lookbehind: true,
greedy: true
},
"literal": {
pattern: /(^|[[{(=:,\s])(?:[^#"',:=[\]{}()\s`-]|[:-][^"',=[\]{}()\s])(?:[^,:=\]})(\s]|:(?![\s,\]})]|$)|[ \t]+[^#,:=\]})(\s])*/,
lookbehind: true,
alias: "string"
},
"punctuation": /[,:=[\]{}()-]/
};
Prism.languages.nevod = {
"comment": /\/\/.*|(?:\/\*[\s\S]*?(?:\*\/|$))/,
"string": {
pattern: /(?:"(?:""|[^"])*"(?!")|'(?:''|[^'])*'(?!'))!?\*?/,
greedy: true,
inside: {
"string-attrs": /!$|!\*$|\*$/
}
},
"namespace": {
pattern: /(@namespace\s+)[a-zA-Z0-9\-.]+(?=\s*\{)/,
lookbehind: true
},
"pattern": {
pattern: /(@pattern\s+)?#?[a-zA-Z0-9\-.]+(?:\s*\(\s*(?:~\s*)?[a-zA-Z0-9\-.]+\s*(?:,\s*(?:~\s*)?[a-zA-Z0-9\-.]*)*\))?(?=\s*=)/,
lookbehind: true,
inside: {
"pattern-name": {
pattern: /^#?[a-zA-Z0-9\-.]+/,
alias: "class-name"
},
"fields": {
pattern: /\(.*\)/,
inside: {
"field-name": {
pattern: /[a-zA-Z0-9\-.]+/,
alias: "variable"
},
"punctuation": /[,()]/,
"operator": {
pattern: /~/,
alias: "field-hidden-mark"
}
}
}
}
},
"search": {
pattern: /(@search\s+|#)[a-zA-Z0-9\-.]+(?:\.\*)?(?=\s*;)/,
alias: "function",
lookbehind: true
},
"keyword": /@(?:having|inside|namespace|outside|pattern|require|search|where)\b/,
"standard-pattern": {
pattern: /\b(?:Alpha|AlphaNum|Any|Blank|End|LineBreak|Num|NumAlpha|Punct|Space|Start|Symbol|Word|WordBreak)\b(?:\([a-zA-Z0-9\-.,\s+]*\))?/,
inside: {
"standard-pattern-name": {
pattern: /^[a-zA-Z0-9\-.]+/,
alias: "builtin"
},
"quantifier": {
pattern: /\b\d+(?:\s*\+|\s*-\s*\d+)?(?!\w)/,
alias: "number"
},
"standard-pattern-attr": {
pattern: /[a-zA-Z0-9\-.]+/,
alias: "builtin"
},
"punctuation": /[,()]/
}
},
"quantifier": {
pattern: /\b\d+(?:\s*\+|\s*-\s*\d+)?(?!\w)/,
alias: "number"
},
"operator": [
{
pattern: /=/,
alias: "pattern-def"
},
{
pattern: /&/,
alias: "conjunction"
},
{
pattern: /~/,
alias: "exception"
},
{
pattern: /\?/,
alias: "optionality"
},
{
pattern: /[[\]]/,
alias: "repetition"
},
{
pattern: /[{}]/,
alias: "variation"
},
{
pattern: /[+_]/,
alias: "sequence"
},
{
pattern: /\.{2,3}/,
alias: "span"
}
],
"field-capture": [
{
pattern: /([a-zA-Z0-9\-.]+\s*\()\s*[a-zA-Z0-9\-.]+\s*:\s*[a-zA-Z0-9\-.]+(?:\s*,\s*[a-zA-Z0-9\-.]+\s*:\s*[a-zA-Z0-9\-.]+)*(?=\s*\))/,
lookbehind: true,
inside: {
"field-name": {
pattern: /[a-zA-Z0-9\-.]+/,
alias: "variable"
},
"colon": /:/
}
},
{
pattern: /[a-zA-Z0-9\-.]+\s*:/,
inside: {
"field-name": {
pattern: /[a-zA-Z0-9\-.]+/,
alias: "variable"
},
"colon": /:/
}
}
],
"punctuation": /[:;,()]/,
"name": /[a-zA-Z0-9\-.]+/
};
(function(Prism2) {
var variable = /\$(?:\w[a-z\d]*(?:_[^\x00-\x1F\s"'\\()$]*)?|\{[^}\s"'\\]+\})/i;
Prism2.languages.nginx = {
"comment": {
pattern: /(^|[\s{};])#.*/,
lookbehind: true,
greedy: true
},
"directive": {
pattern: /(^|\s)\w(?:[^;{}"'\\\s]|\\.|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|\s+(?:#.*(?!.)|(?![#\s])))*?(?=\s*[;{])/,
lookbehind: true,
greedy: true,
inside: {
"string": {
pattern: /((?:^|[^\\])(?:\\\\)*)(?:"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/,
lookbehind: true,
greedy: true,
inside: {
"escape": {
pattern: /\\["'\\nrt]/,
alias: "entity"
},
"variable": variable
}
},
"comment": {
pattern: /(\s)#.*/,
lookbehind: true,
greedy: true
},
"keyword": {
pattern: /^\S+/,
greedy: true
},
// other patterns
"boolean": {
pattern: /(\s)(?:off|on)(?!\S)/,
lookbehind: true
},
"number": {
pattern: /(\s)\d+[a-z]*(?!\S)/i,
lookbehind: true
},
"variable": variable
}
},
"punctuation": /[{};]/
};
})(Prism);
Prism.languages.nim = {
"comment": {
pattern: /#.*/,
greedy: true
},
"string": {
// Double-quoted strings can be prefixed by an identifier (Generalized raw string literals)
pattern: /(?:\b(?!\d)(?:\w|\\x[89a-fA-F][0-9a-fA-F])+)?(?:"""[\s\S]*?"""(?!")|"(?:\\[\s\S]|""|[^"\\])*")/,
greedy: true
},
"char": {
// Character literals are handled specifically to prevent issues with numeric type suffixes
pattern: /'(?:\\(?:\d+|x[\da-fA-F]{0,2}|.)|[^'])'/,
greedy: true
},
"function": {
pattern: /(?:(?!\d)(?:\w|\\x[89a-fA-F][0-9a-fA-F])+|`[^`\r\n]+`)\*?(?:\[[^\]]+\])?(?=\s*\()/,
greedy: true,
inside: {
"operator": /\*$/
}
},
// We don't want to highlight operators (and anything really) inside backticks
"identifier": {
pattern: /`[^`\r\n]+`/,
greedy: true,
inside: {
"punctuation": /`/
}
},
// The negative look ahead prevents wrong highlighting of the .. operator
"number": /\b(?:0[xXoObB][\da-fA-F_]+|\d[\d_]*(?:(?!\.\.)\.[\d_]*)?(?:[eE][+-]?\d[\d_]*)?)(?:'?[iuf]\d*)?/,
"keyword": /\b(?:addr|as|asm|atomic|bind|block|break|case|cast|concept|const|continue|converter|defer|discard|distinct|do|elif|else|end|enum|except|export|finally|for|from|func|generic|if|import|include|interface|iterator|let|macro|method|mixin|nil|object|out|proc|ptr|raise|ref|return|static|template|try|tuple|type|using|var|when|while|with|without|yield)\b/,
"operator": {
// Look behind and look ahead prevent wrong highlighting of punctuations [. .] {. .} (. .)
// but allow the slice operator .. to take precedence over them
// One can define his own operators in Nim so all combination of operators might be an operator.
pattern: /(^|[({\[](?=\.\.)|(?![({\[]\.).)(?:(?:[=+\-*\/<>@$~&%|!?^:\\]|\.\.|\.(?![)}\]]))+|\b(?:and|div|in|is|isnot|mod|not|notin|of|or|shl|shr|xor)\b)/m,
lookbehind: true
},
"punctuation": /[({\[]\.|\.[)}\]]|[`(){}\[\],:]/
};
Prism.languages.nix = {
"comment": {
pattern: /\/\*[\s\S]*?\*\/|#.*/,
greedy: true
},
"string": {
pattern: /"(?:[^"\\]|\\[\s\S])*"|''(?:(?!'')[\s\S]|''(?:'|\\|\$\{))*''/,
greedy: true,
inside: {
"interpolation": {
// The lookbehind ensures the ${} is not preceded by \ or ''
pattern: /(^|(?:^|(?!'').)[^\\])\$\{(?:[^{}]|\{[^}]*\})*\}/,
lookbehind: true,
inside: null
// see below
}
}
},
"url": [
/\b(?:[a-z]{3,7}:\/\/)[\w\-+%~\/.:#=?&]+/,
{
pattern: /([^\/])(?:[\w\-+%~.:#=?&]*(?!\/\/)[\w\-+%~\/.:#=?&])?(?!\/\/)\/[\w\-+%~\/.:#=?&]*/,
lookbehind: true
}
],
"antiquotation": {
pattern: /\$(?=\{)/,
alias: "important"
},
"number": /\b\d+\b/,
"keyword": /\b(?:assert|builtins|else|if|in|inherit|let|null|or|then|with)\b/,
"function": /\b(?:abort|add|all|any|attrNames|attrValues|baseNameOf|compareVersions|concatLists|currentSystem|deepSeq|derivation|dirOf|div|elem(?:At)?|fetch(?:Tarball|url)|filter(?:Source)?|fromJSON|genList|getAttr|getEnv|hasAttr|hashString|head|import|intersectAttrs|is(?:Attrs|Bool|Function|Int|List|Null|String)|length|lessThan|listToAttrs|map|mul|parseDrvName|pathExists|read(?:Dir|File)|removeAttrs|replaceStrings|seq|sort|stringLength|sub(?:string)?|tail|throw|to(?:File|JSON|Path|String|XML)|trace|typeOf)\b|\bfoldl'\B/,
"boolean": /\b(?:false|true)\b/,
"operator": /[=!<>]=?|\+\+?|\|\||&&|\/\/|->?|[?@]/,
"punctuation": /[{}()[\].,:;]/
};
Prism.languages.nix.string.inside.interpolation.inside = Prism.languages.nix;
Prism.languages.nsis = {
"comment": {
pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|[#;].*)/,
lookbehind: true,
greedy: true
},
"string": {
pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
greedy: true
},
"keyword": {
pattern: /(^[\t ]*)(?:Abort|Add(?:BrandingImage|Size)|AdvSplash|Allow(?:RootDirInstall|SkipFiles)|AutoCloseWindow|BG(?:Font|Gradient|Image)|Banner|BrandingText|BringToFront|CRCCheck|Call(?:InstDLL)?|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|Create(?:Directory|Font|ShortCut)|Delete(?:INISec|INIStr|RegKey|RegValue)?|Detail(?:Print|sButtonText)|Dialer|Dir(?:Text|Var|Verify)|EnableWindow|Enum(?:RegKey|RegValue)|Exch|Exec(?:Shell(?:Wait)?|Wait)?|ExpandEnvStrings|File(?:BufSize|Close|ErrorText|Open|Read|ReadByte|ReadUTF16LE|ReadWord|Seek|Write|WriteByte|WriteUTF16LE|WriteWord)?|Find(?:Close|First|Next|Window)|FlushINI|Get(?:CurInstType|CurrentAddress|DLLVersion(?:Local)?|DlgItem|ErrorLevel|FileTime(?:Local)?|FullPathName|Function(?:Address|End)?|InstDirError|LabelAddress|TempFileName)|Goto|HideWindow|Icon|If(?:Abort|Errors|FileExists|RebootFlag|Silent)|InitPluginsDir|InstProgressFlags|Inst(?:Type(?:GetText|SetText)?)|Install(?:ButtonText|Colors|Dir(?:RegKey)?)|Int(?:64|Ptr)?CmpU?|Int(?:64)?Fmt|Int(?:Ptr)?Op|IsWindow|Lang(?:DLL|String)|License(?:BkColor|Data|ForceSelection|LangString|Text)|LoadLanguageFile|LockWindow|Log(?:Set|Text)|Manifest(?:DPIAware|SupportedOS)|Math|MessageBox|MiscButtonText|NSISdl|Name|Nop|OutFile|PE(?:DllCharacteristics|SubsysVer)|Page(?:Callbacks)?|Pop|Push|Quit|RMDir|Read(?:EnvStr|INIStr|RegDWORD|RegStr)|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|SearchPath|Section(?:End|GetFlags|GetInstTypes|GetSize|GetText|Group|In|SetFlags|SetInstTypes|SetSize|SetText)?|SendMessage|Set(?:AutoClose|BrandingImage|Compress|Compressor(?:DictSize)?|CtlColors|CurInstType|DatablockOptimize|DateSave|Details(?:Print|View)|ErrorLevel|Errors|FileAttributes|Font|OutPath|Overwrite|PluginUnload|RebootFlag|RegView|ShellVarContext|Silent)|Show(?:InstDetails|UninstDetails|Window)|Silent(?:Install|UnInstall)|Sleep|SpaceTexts|Splash|StartMenu|Str(?:CmpS?|Cpy|Len)|SubCaption|System|UnRegDLL|Unicode|UninstPage|Uninstall(?:ButtonText|Caption|Icon|SubCaption|Text)|UserInfo|VI(?:AddVersionKey|FileVersion|ProductVersion)|VPatch|Var|WindowIcon|Write(?:INIStr|Reg(?:Bin|DWORD|ExpandStr|MultiStr|None|Str)|Uninstaller)|XPStyle|ns(?:Dialogs|Exec))\b/m,
lookbehind: true
},
"property": /\b(?:ARCHIVE|FILE_(?:ATTRIBUTE_ARCHIVE|ATTRIBUTE_NORMAL|ATTRIBUTE_OFFLINE|ATTRIBUTE_READONLY|ATTRIBUTE_SYSTEM|ATTRIBUTE_TEMPORARY)|HK(?:(?:CR|CU|LM)(?:32|64)?|DD|PD|U)|HKEY_(?:CLASSES_ROOT|CURRENT_CONFIG|CURRENT_USER|DYN_DATA|LOCAL_MACHINE|PERFORMANCE_DATA|USERS)|ID(?:ABORT|CANCEL|IGNORE|NO|OK|RETRY|YES)|MB_(?:ABORTRETRYIGNORE|DEFBUTTON1|DEFBUTTON2|DEFBUTTON3|DEFBUTTON4|ICONEXCLAMATION|ICONINFORMATION|ICONQUESTION|ICONSTOP|OK|OKCANCEL|RETRYCANCEL|RIGHT|RTLREADING|SETFOREGROUND|TOPMOST|USERICON|YESNO)|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SYSTEM|TEMPORARY|admin|all|auto|both|colored|false|force|hide|highest|lastused|leave|listonly|none|normal|notset|off|on|open|print|show|silent|silentlog|smooth|textonly|true|user)\b/,
"constant": /\$\{[!\w\.:\^-]+\}|\$\([!\w\.:\^-]+\)/,
"variable": /\$\w[\w\.]*/,
"number": /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
"operator": /--?|\+\+?|<=?|>=?|==?=?|&&?|\|\|?|[?*\/~^%]/,
"punctuation": /[{}[\];(),.:]/,
"important": {
pattern: /(^[\t ]*)!(?:addincludedir|addplugindir|appendfile|cd|define|delfile|echo|else|endif|error|execute|finalize|getdllversion|gettlbversion|if|ifdef|ifmacrodef|ifmacrondef|ifndef|include|insertmacro|macro|macroend|makensis|packhdr|pragma|searchparse|searchreplace|system|tempfile|undef|verbose|warning)\b/im,
lookbehind: true
}
};
Prism.languages.objectivec = Prism.languages.extend("c", {
"string": {
pattern: /@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
greedy: true
},
"keyword": /\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,
"operator": /-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/
});
delete Prism.languages.objectivec["class-name"];
Prism.languages.objc = Prism.languages.objectivec;
Prism.languages.ocaml = {
"comment": {
pattern: /\(\*[\s\S]*?\*\)/,
greedy: true
},
"char": {
pattern: /'(?:[^\\\r\n']|\\(?:.|[ox]?[0-9a-f]{1,3}))'/i,
greedy: true
},
"string": [
{
pattern: /"(?:\\(?:[\s\S]|\r\n)|[^\\\r\n"])*"/,
greedy: true
},
{
pattern: /\{([a-z_]*)\|[\s\S]*?\|\1\}/,
greedy: true
}
],
"number": [
// binary and octal
/\b(?:0b[01][01_]*|0o[0-7][0-7_]*)\b/i,
// hexadecimal
/\b0x[a-f0-9][a-f0-9_]*(?:\.[a-f0-9_]*)?(?:p[+-]?\d[\d_]*)?(?!\w)/i,
// decimal
/\b\d[\d_]*(?:\.[\d_]*)?(?:e[+-]?\d[\d_]*)?(?!\w)/i
],
"directive": {
pattern: /\B#\w+/,
alias: "property"
},
"label": {
pattern: /\B~\w+/,
alias: "property"
},
"type-variable": {
pattern: /\B'\w+/,
alias: "function"
},
"variant": {
pattern: /`\w+/,
alias: "symbol"
},
// For the list of keywords and operators,
// see: http://caml.inria.fr/pub/docs/manual-ocaml/lex.html#sec84
"keyword": /\b(?:as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|match|method|module|mutable|new|nonrec|object|of|open|private|rec|sig|struct|then|to|try|type|val|value|virtual|when|where|while|with)\b/,
"boolean": /\b(?:false|true)\b/,
"operator-like-punctuation": {
pattern: /\[[<>|]|[>|]\]|\{<|>\}/,
alias: "punctuation"
},
// Custom operators are allowed
"operator": /\.[.~]|:[=>]|[=<>@^|&+\-*\/$%!?~][!$%&*+\-.\/:<=>?@^|~]*|\b(?:and|asr|land|lor|lsl|lsr|lxor|mod|or)\b/,
"punctuation": /;;|::|[(){}\[\].,:;#]|\b_\b/
};
(function(Prism2) {
var escapes = /\\(?:["'\\abefnrtv]|0[0-7]{2}|U[\dA-Fa-f]{6}|u[\dA-Fa-f]{4}|x[\dA-Fa-f]{2})/;
Prism2.languages.odin = {
/**
* The current implementation supports only 1 level of nesting.
*
* @author Michael Schmidt
* @author edukisto
*/
"comment": [
{
pattern: /\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:\*(?!\/)|[^*])*(?:\*\/|$))*(?:\*\/|$)/,
greedy: true
},
{
pattern: /#![^\n\r]*/,
greedy: true
},
{
pattern: /\/\/[^\n\r]*/,
greedy: true
}
],
/**
* Should be found before strings because of '"'"- and '`'`-like sequences.
*/
"char": {
pattern: /'(?:\\(?:.|[0Uux][0-9A-Fa-f]{1,6})|[^\n\r'\\])'/,
greedy: true,
inside: {
"symbol": escapes
}
},
"string": [
{
pattern: /`[^`]*`/,
greedy: true
},
{
pattern: /"(?:\\.|[^\n\r"\\])*"/,
greedy: true,
inside: {
"symbol": escapes
}
}
],
"directive": {
pattern: /#\w+/,
alias: "property"
},
"number": /\b0(?:b[01_]+|d[\d_]+|h_*(?:(?:(?:[\dA-Fa-f]_*){8}){1,2}|(?:[\dA-Fa-f]_*){4})|o[0-7_]+|x[\dA-F_a-f]+|z[\dAB_ab]+)\b|(?:\b\d+(?:\.(?!\.)\d*)?|\B\.\d+)(?:[Ee][+-]?\d*)?[ijk]?(?!\w)/,
"discard": {
pattern: /\b_\b/,
alias: "keyword"
},
"procedure-definition": {
pattern: /\b\w+(?=[ \t]*(?::\s*){2}proc\b)/,
alias: "function"
},
"keyword": /\b(?:asm|auto_cast|bit_set|break|case|cast|context|continue|defer|distinct|do|dynamic|else|enum|fallthrough|for|foreign|if|import|in|map|matrix|not_in|or_else|or_return|package|proc|return|struct|switch|transmute|typeid|union|using|when|where)\b/,
/**
* false, nil, true can be used as procedure names. "_" and keywords can't.
*/
"procedure-name": {
pattern: /\b\w+(?=[ \t]*\()/,
alias: "function"
},
"boolean": /\b(?:false|nil|true)\b/,
"constant-parameter-sign": {
pattern: /\$/,
alias: "important"
},
"undefined": {
pattern: /---/,
alias: "operator"
},
"arrow": {
pattern: /->/,
alias: "punctuation"
},
"operator": /\+\+|--|\.\.[<=]?|(?:&~|[-!*+/=~]|[%&<>|]{1,2})=?|[?^]/,
"punctuation": /[(),.:;@\[\]{}]/
};
})(Prism);
(function(Prism2) {
Prism2.languages.opencl = Prism2.languages.extend("c", {
// Extracted from the official specs (2.0) and http://streamcomputing.eu/downloads/?opencl.lang (opencl-keywords, opencl-types) and http://sourceforge.net/tracker/?func=detail&aid=2957794&group_id=95717&atid=612384 (Words2, partly Words3)
"keyword": /\b(?:(?:__)?(?:constant|global|kernel|local|private|read_only|read_write|write_only)|__attribute__|auto|(?:bool|u?(?:char|int|long|short)|half|quad)(?:2|3|4|8|16)?|break|case|complex|const|continue|(?:double|float)(?:16(?:x(?:1|2|4|8|16))?|1x(?:1|2|4|8|16)|2(?:x(?:1|2|4|8|16))?|3|4(?:x(?:1|2|4|8|16))?|8(?:x(?:1|2|4|8|16))?)?|default|do|else|enum|extern|for|goto|if|imaginary|inline|packed|pipe|register|restrict|return|signed|sizeof|static|struct|switch|typedef|uniform|union|unsigned|void|volatile|while)\b/,
// Extracted from http://streamcomputing.eu/downloads/?opencl.lang (opencl-const)
// Math Constants: https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/mathConstants.html
// Macros and Limits: https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/macroLimits.html
"number": /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[fuhl]{0,4}/i,
"boolean": /\b(?:false|true)\b/,
"constant-opencl-kernel": {
pattern: /\b(?:CHAR_(?:BIT|MAX|MIN)|CLK_(?:ADDRESS_(?:CLAMP(?:_TO_EDGE)?|NONE|REPEAT)|FILTER_(?:LINEAR|NEAREST)|(?:GLOBAL|LOCAL)_MEM_FENCE|NORMALIZED_COORDS_(?:FALSE|TRUE))|CL_(?:BGRA|(?:HALF_)?FLOAT|INTENSITY|LUMINANCE|A?R?G?B?[Ax]?|(?:(?:UN)?SIGNED|[US]NORM)_(?:INT(?:8|16|32))|UNORM_(?:INT_101010|SHORT_(?:555|565)))|(?:DBL|FLT|HALF)_(?:DIG|EPSILON|(?:MAX|MIN)(?:(?:_10)?_EXP)?|MANT_DIG)|FLT_RADIX|HUGE_VALF?|(?:INT|LONG|SCHAR|SHRT)_(?:MAX|MIN)|INFINITY|MAXFLOAT|M_(?:[12]_PI|2_SQRTPI|E|LN(?:2|10)|LOG(?:2|10)E?|PI(?:_[24])?|SQRT(?:1_2|2))(?:_F|_H)?|NAN|(?:UCHAR|UINT|ULONG|USHRT)_MAX)\b/,
alias: "constant"
}
});
Prism2.languages.insertBefore("opencl", "class-name", {
// https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/scalarDataTypes.html
// https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/otherDataTypes.html
"builtin-type": {
pattern: /\b(?:_cl_(?:command_queue|context|device_id|event|kernel|mem|platform_id|program|sampler)|cl_(?:image_format|mem_fence_flags)|clk_event_t|event_t|image(?:1d_(?:array_|buffer_)?t|2d_(?:array_(?:depth_|msaa_depth_|msaa_)?|depth_|msaa_depth_|msaa_)?t|3d_t)|intptr_t|ndrange_t|ptrdiff_t|queue_t|reserve_id_t|sampler_t|size_t|uintptr_t)\b/,
alias: "keyword"
}
});
var attributes = {
// Extracted from http://streamcomputing.eu/downloads/?opencl_host.lang (opencl-types and opencl-host)
"type-opencl-host": {
pattern: /\b(?:cl_(?:GLenum|GLint|GLuin|addressing_mode|bitfield|bool|buffer_create_type|build_status|channel_(?:order|type)|(?:u?(?:char|int|long|short)|double|float)(?:2|3|4|8|16)?|command_(?:queue(?:_info|_properties)?|type)|context(?:_info|_properties)?|device_(?:exec_capabilities|fp_config|id|info|local_mem_type|mem_cache_type|type)|(?:event|sampler)(?:_info)?|filter_mode|half|image_info|kernel(?:_info|_work_group_info)?|map_flags|mem(?:_flags|_info|_object_type)?|platform_(?:id|info)|profiling_info|program(?:_build_info|_info)?))\b/,
alias: "keyword"
},
"boolean-opencl-host": {
pattern: /\bCL_(?:FALSE|TRUE)\b/,
alias: "boolean"
},
// Extracted from cl.h (2.0) and http://streamcomputing.eu/downloads/?opencl_host.lang (opencl-const)
"constant-opencl-host": {
pattern: /\bCL_(?:A|ABGR|ADDRESS_(?:CLAMP(?:_TO_EDGE)?|MIRRORED_REPEAT|NONE|REPEAT)|ARGB|BGRA|BLOCKING|BUFFER_CREATE_TYPE_REGION|BUILD_(?:ERROR|IN_PROGRESS|NONE|PROGRAM_FAILURE|SUCCESS)|COMMAND_(?:ACQUIRE_GL_OBJECTS|BARRIER|COPY_(?:BUFFER(?:_RECT|_TO_IMAGE)?|IMAGE(?:_TO_BUFFER)?)|FILL_(?:BUFFER|IMAGE)|MAP(?:_BUFFER|_IMAGE)|MARKER|MIGRATE(?:_SVM)?_MEM_OBJECTS|NATIVE_KERNEL|NDRANGE_KERNEL|READ_(?:BUFFER(?:_RECT)?|IMAGE)|RELEASE_GL_OBJECTS|SVM_(?:FREE|MAP|MEMCPY|MEMFILL|UNMAP)|TASK|UNMAP_MEM_OBJECT|USER|WRITE_(?:BUFFER(?:_RECT)?|IMAGE))|COMPILER_NOT_AVAILABLE|COMPILE_PROGRAM_FAILURE|COMPLETE|CONTEXT_(?:DEVICES|INTEROP_USER_SYNC|NUM_DEVICES|PLATFORM|PROPERTIES|REFERENCE_COUNT)|DEPTH(?:_STENCIL)?|DEVICE_(?:ADDRESS_BITS|AFFINITY_DOMAIN_(?:L[1-4]_CACHE|NEXT_PARTITIONABLE|NUMA)|AVAILABLE|BUILT_IN_KERNELS|COMPILER_AVAILABLE|DOUBLE_FP_CONFIG|ENDIAN_LITTLE|ERROR_CORRECTION_SUPPORT|EXECUTION_CAPABILITIES|EXTENSIONS|GLOBAL_(?:MEM_(?:CACHELINE_SIZE|CACHE_SIZE|CACHE_TYPE|SIZE)|VARIABLE_PREFERRED_TOTAL_SIZE)|HOST_UNIFIED_MEMORY|IL_VERSION|IMAGE(?:2D_MAX_(?:HEIGHT|WIDTH)|3D_MAX_(?:DEPTH|HEIGHT|WIDTH)|_BASE_ADDRESS_ALIGNMENT|_MAX_ARRAY_SIZE|_MAX_BUFFER_SIZE|_PITCH_ALIGNMENT|_SUPPORT)|LINKER_AVAILABLE|LOCAL_MEM_SIZE|LOCAL_MEM_TYPE|MAX_(?:CLOCK_FREQUENCY|COMPUTE_UNITS|CONSTANT_ARGS|CONSTANT_BUFFER_SIZE|GLOBAL_VARIABLE_SIZE|MEM_ALLOC_SIZE|NUM_SUB_GROUPS|ON_DEVICE_(?:EVENTS|QUEUES)|PARAMETER_SIZE|PIPE_ARGS|READ_IMAGE_ARGS|READ_WRITE_IMAGE_ARGS|SAMPLERS|WORK_GROUP_SIZE|WORK_ITEM_DIMENSIONS|WORK_ITEM_SIZES|WRITE_IMAGE_ARGS)|MEM_BASE_ADDR_ALIGN|MIN_DATA_TYPE_ALIGN_SIZE|NAME|NATIVE_VECTOR_WIDTH_(?:CHAR|DOUBLE|FLOAT|HALF|INT|LONG|SHORT)|NOT_(?:AVAILABLE|FOUND)|OPENCL_C_VERSION|PARENT_DEVICE|PARTITION_(?:AFFINITY_DOMAIN|BY_AFFINITY_DOMAIN|BY_COUNTS|BY_COUNTS_LIST_END|EQUALLY|FAILED|MAX_SUB_DEVICES|PROPERTIES|TYPE)|PIPE_MAX_(?:ACTIVE_RESERVATIONS|PACKET_SIZE)|PLATFORM|PREFERRED_(?:GLOBAL_ATOMIC_ALIGNMENT|INTEROP_USER_SYNC|LOCAL_ATOMIC_ALIGNMENT|PLATFORM_ATOMIC_ALIGNMENT|VECTOR_WIDTH_(?:CHAR|DOUBLE|FLOAT|HALF|INT|LONG|SHORT))|PRINTF_BUFFER_SIZE|PROFILE|PROFILING_TIMER_RESOLUTION|QUEUE_(?:ON_(?:DEVICE_(?:MAX_SIZE|PREFERRED_SIZE|PROPERTIES)|HOST_PROPERTIES)|PROPERTIES)|REFERENCE_COUNT|SINGLE_FP_CONFIG|SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS|SVM_(?:ATOMICS|CAPABILITIES|COARSE_GRAIN_BUFFER|FINE_GRAIN_BUFFER|FINE_GRAIN_SYSTEM)|TYPE(?:_ACCELERATOR|_ALL|_CPU|_CUSTOM|_DEFAULT|_GPU)?|VENDOR(?:_ID)?|VERSION)|DRIVER_VERSION|EVENT_(?:COMMAND_(?:EXECUTION_STATUS|QUEUE|TYPE)|CONTEXT|REFERENCE_COUNT)|EXEC_(?:KERNEL|NATIVE_KERNEL|STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST)|FILTER_(?:LINEAR|NEAREST)|FLOAT|FP_(?:CORRECTLY_ROUNDED_DIVIDE_SQRT|DENORM|FMA|INF_NAN|ROUND_TO_INF|ROUND_TO_NEAREST|ROUND_TO_ZERO|SOFT_FLOAT)|GLOBAL|HALF_FLOAT|IMAGE_(?:ARRAY_SIZE|BUFFER|DEPTH|ELEMENT_SIZE|FORMAT|FORMAT_MISMATCH|FORMAT_NOT_SUPPORTED|HEIGHT|NUM_MIP_LEVELS|NUM_SAMPLES|ROW_PITCH|SLICE_PITCH|WIDTH)|INTENSITY|INVALID_(?:ARG_INDEX|ARG_SIZE|ARG_VALUE|BINARY|BUFFER_SIZE|BUILD_OPTIONS|COMMAND_QUEUE|COMPILER_OPTIONS|CONTEXT|DEVICE|DEVICE_PARTITION_COUNT|DEVICE_QUEUE|DEVICE_TYPE|EVENT|EVENT_WAIT_LIST|GLOBAL_OFFSET|GLOBAL_WORK_SIZE|GL_OBJECT|HOST_PTR|IMAGE_DESCRIPTOR|IMAGE_FORMAT_DESCRIPTOR|IMAGE_SIZE|KERNEL|KERNEL_ARGS|KERNEL_DEFINITION|KERNEL_NAME|LINKER_OPTIONS|MEM_OBJECT|MIP_LEVEL|OPERATION|PIPE_SIZE|PLATFORM|PROGRAM|PROGRAM_EXECUTABLE|PROPERTY|QUEUE_PROPERTIES|SAMPLER|VALUE|WORK_DIMENSION|WORK_GROUP_SIZE|WORK_ITEM_SIZE)|KERNEL_(?:ARG_(?:ACCESS_(?:NONE|QUALIFIER|READ_ONLY|READ_WRITE|WRITE_ONLY)|ADDRESS_(?:CONSTANT|GLOBAL|LOCAL|PRIVATE|QUALIFIER)|INFO_NOT_AVAILABLE|NAME|TYPE_(?:CONST|NAME|NONE|PIPE|QUALIFIER|RESTRICT|VOLATILE))|ATTRIBUTES|COMPILE_NUM_SUB_GROUPS|COMPILE_WORK_GROUP_SIZE|CONTEXT|EXEC_INFO_SVM_FINE_GRAIN_SYSTEM|EXEC_INFO_SVM_PTRS|FUNCTION_NAME|GLOBAL_WORK_SIZE|LOCAL_MEM_SIZE|LOCAL_SIZE_FOR_SUB_GROUP_COUNT|MAX_NUM_SUB_GROUPS|MAX_SUB_GROUP_SIZE_FOR_NDRANGE|NUM_ARGS|PREFERRED_WORK_GROUP_SIZE_MULTIPLE|PRIVATE_MEM_SIZE|PROGRAM|REFERENCE_COUNT|SUB_GROUP_COUNT_FOR_NDRANGE|WORK_GROUP_SIZE)|LINKER_NOT_AVAILABLE|LINK_PROGRAM_FAILURE|LOCAL|LUMINANCE|MAP_(?:FAILURE|READ|WRITE|WRITE_INVALIDATE_REGION)|MEM_(?:ALLOC_HOST_PTR|ASSOCIATED_MEMOBJECT|CONTEXT|COPY_HOST_PTR|COPY_OVERLAP|FLAGS|HOST_NO_ACCESS|HOST_PTR|HOST_READ_ONLY|HOST_WRITE_ONLY|KERNEL_READ_AND_WRITE|MAP_COUNT|OBJECT_(?:ALLOCATION_FAILURE|BUFFER|IMAGE1D|IMAGE1D_ARRAY|IMAGE1D_BUFFER|IMAGE2D|IMAGE2D_ARRAY|IMAGE3D|PIPE)|OFFSET|READ_ONLY|READ_WRITE|REFERENCE_COUNT|SIZE|SVM_ATOMICS|SVM_FINE_GRAIN_BUFFER|TYPE|USES_SVM_POINTER|USE_HOST_PTR|WRITE_ONLY)|MIGRATE_MEM_OBJECT_(?:CONTENT_UNDEFINED|HOST)|MISALIGNED_SUB_BUFFER_OFFSET|NONE|NON_BLOCKING|OUT_OF_(?:HOST_MEMORY|RESOURCES)|PIPE_(?:MAX_PACKETS|PACKET_SIZE)|PLATFORM_(?:EXTENSIONS|HOST_TIMER_RESOLUTION|NAME|PROFILE|VENDOR|VERSION)|PROFILING_(?:COMMAND_(?:COMPLETE|END|QUEUED|START|SUBMIT)|INFO_NOT_AVAILABLE)|PROGRAM_(?:BINARIES|BINARY_SIZES|BINARY_TYPE(?:_COMPILED_OBJECT|_EXECUTABLE|_LIBRARY|_NONE)?|BUILD_(?:GLOBAL_VARIABLE_TOTAL_SIZE|LOG|OPTIONS|STATUS)|CONTEXT|DEVICES|IL|KERNEL_NAMES|NUM_DEVICES|NUM_KERNELS|REFERENCE_COUNT|SOURCE)|QUEUED|QUEUE_(?:CONTEXT|DEVICE|DEVICE_DEFAULT|ON_DEVICE|ON_DEVICE_DEFAULT|OUT_OF_ORDER_EXEC_MODE_ENABLE|PROFILING_ENABLE|PROPERTIES|REFERENCE_COUNT|SIZE)|R|RA|READ_(?:ONLY|WRITE)_CACHE|RG|RGB|RGBA|RGBx|RGx|RUNNING|Rx|SAMPLER_(?:ADDRESSING_MODE|CONTEXT|FILTER_MODE|LOD_MAX|LOD_MIN|MIP_FILTER_MODE|NORMALIZED_COORDS|REFERENCE_COUNT)|(?:UN)?SIGNED_INT(?:8|16|32)|SNORM_INT(?:8|16)|SUBMITTED|SUCCESS|UNORM_INT(?:8|16|24|_101010|_101010_2)|UNORM_SHORT_(?:555|565)|VERSION_(?:1_0|1_1|1_2|2_0|2_1)|sBGRA|sRGB|sRGBA|sRGBx)\b/,
alias: "constant"
},
// Extracted from cl.h (2.0) and http://streamcomputing.eu/downloads/?opencl_host.lang (opencl-host)
"function-opencl-host": {
pattern: /\bcl(?:BuildProgram|CloneKernel|CompileProgram|Create(?:Buffer|CommandQueue(?:WithProperties)?|Context|ContextFromType|Image|Image2D|Image3D|Kernel|KernelsInProgram|Pipe|ProgramWith(?:Binary|BuiltInKernels|IL|Source)|Sampler|SamplerWithProperties|SubBuffer|SubDevices|UserEvent)|Enqueue(?:(?:Barrier|Marker)(?:WithWaitList)?|Copy(?:Buffer(?:Rect|ToImage)?|Image(?:ToBuffer)?)|(?:Fill|Map)(?:Buffer|Image)|MigrateMemObjects|NDRangeKernel|NativeKernel|(?:Read|Write)(?:Buffer(?:Rect)?|Image)|SVM(?:Free|Map|MemFill|Memcpy|MigrateMem|Unmap)|Task|UnmapMemObject|WaitForEvents)|Finish|Flush|Get(?:CommandQueueInfo|ContextInfo|Device(?:AndHostTimer|IDs|Info)|Event(?:Profiling)?Info|ExtensionFunctionAddress(?:ForPlatform)?|HostTimer|ImageInfo|Kernel(?:ArgInfo|Info|SubGroupInfo|WorkGroupInfo)|MemObjectInfo|PipeInfo|Platform(?:IDs|Info)|Program(?:Build)?Info|SamplerInfo|SupportedImageFormats)|LinkProgram|(?:Release|Retain)(?:CommandQueue|Context|Device|Event|Kernel|MemObject|Program|Sampler)|SVM(?:Alloc|Free)|Set(?:CommandQueueProperty|DefaultDeviceCommandQueue|EventCallback|Kernel|Kernel(?:Arg(?:SVMPointer)?|ExecInfo)|MemObjectDestructorCallback|UserEventStatus)|Unload(?:Platform)?Compiler|WaitForEvents)\b/,
alias: "function"
}
};
Prism2.languages.insertBefore("c", "keyword", attributes);
if (Prism2.languages.cpp) {
attributes["type-opencl-host-cpp"] = {
pattern: /\b(?:Buffer|BufferGL|BufferRenderGL|CommandQueue|Context|Device|DeviceCommandQueue|EnqueueArgs|Event|Image|Image1D|Image1DArray|Image1DBuffer|Image2D|Image2DArray|Image2DGL|Image3D|Image3DGL|ImageFormat|ImageGL|Kernel|KernelFunctor|LocalSpaceArg|Memory|NDRange|Pipe|Platform|Program|SVMAllocator|SVMTraitAtomic|SVMTraitCoarse|SVMTraitFine|SVMTraitReadOnly|SVMTraitReadWrite|SVMTraitWriteOnly|Sampler|UserEvent)\b/,
alias: "keyword"
};
Prism2.languages.insertBefore("cpp", "keyword", attributes);
}
})(Prism);
Prism.languages.openqasm = {
"comment": /\/\*[\s\S]*?\*\/|\/\/.*/,
"string": {
pattern: /"[^"\r\n\t]*"|'[^'\r\n\t]*'/,
greedy: true
},
"keyword": /\b(?:CX|OPENQASM|U|barrier|boxas|boxto|break|const|continue|ctrl|def|defcal|defcalgrammar|delay|else|end|for|gate|gphase|if|in|include|inv|kernel|lengthof|let|measure|pow|reset|return|rotary|stretchinf|while)\b|#pragma\b/,
"class-name": /\b(?:angle|bit|bool|creg|fixed|float|int|length|qreg|qubit|stretch|uint)\b/,
"function": /\b(?:cos|exp|ln|popcount|rotl|rotr|sin|sqrt|tan)\b(?=\s*\()/,
"constant": /\b(?:euler|pi|tau)\b|π|𝜏|ℇ/,
"number": {
pattern: /(^|[^.\w$])(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?(?:dt|ns|us|µs|ms|s)?/i,
lookbehind: true
},
"operator": /->|>>=?|<<=?|&&|\|\||\+\+|--|[!=<>&|~^+\-*/%]=?|@/,
"punctuation": /[(){}\[\];,:.]/
};
Prism.languages.qasm = Prism.languages.openqasm;
Prism.languages.oz = {
"comment": {
pattern: /\/\*[\s\S]*?\*\/|%.*/,
greedy: true
},
"string": {
pattern: /"(?:[^"\\]|\\[\s\S])*"/,
greedy: true
},
"atom": {
pattern: /'(?:[^'\\]|\\[\s\S])*'/,
greedy: true,
alias: "builtin"
},
"keyword": /\$|\[\]|\b(?:_|at|attr|case|catch|choice|class|cond|declare|define|dis|else(?:case|if)?|end|export|fail|false|feat|finally|from|fun|functor|if|import|in|local|lock|meth|nil|not|of|or|prepare|proc|prop|raise|require|self|skip|then|thread|true|try|unit)\b/,
"function": [
/\b[a-z][A-Za-z\d]*(?=\()/,
{
pattern: /(\{)[A-Z][A-Za-z\d]*\b/,
lookbehind: true
}
],
"number": /\b(?:0[bx][\da-f]+|\d+(?:\.\d*)?(?:e~?\d+)?)\b|&(?:[^\\]|\\(?:\d{3}|.))/i,
"variable": /`(?:[^`\\]|\\.)+`/,
"attr-name": /\b\w+(?=[ \t]*:(?![:=]))/,
"operator": /:(?:=|::?)|<[-:=]?|=(?:=|<?:?)|>=?:?|\\=:?|!!?|[|#+\-*\/,~^@]|\b(?:andthen|div|mod|orelse)\b/,
"punctuation": /[\[\](){}.:;?]/
};
Prism.languages.parigp = {
"comment": /\/\*[\s\S]*?\*\/|\\\\.*/,
"string": {
pattern: /"(?:[^"\\\r\n]|\\.)*"/,
greedy: true
},
// PARI/GP does not care about white spaces at all
// so let's process the keywords to build an appropriate regexp
// (e.g. "b *r *e *a *k", etc.)
"keyword": function() {
var keywords = [
"breakpoint",
"break",
"dbg_down",
"dbg_err",
"dbg_up",
"dbg_x",
"forcomposite",
"fordiv",
"forell",
"forpart",
"forprime",
"forstep",
"forsubgroup",
"forvec",
"for",
"iferr",
"if",
"local",
"my",
"next",
"return",
"until",
"while"
];
keywords = keywords.map(function(keyword) {
return keyword.split("").join(" *");
}).join("|");
return RegExp("\\b(?:" + keywords + ")\\b");
}(),
"function": /\b\w(?:[\w ]*\w)?(?= *\()/,
"number": {
// The lookbehind and the negative lookahead prevent from breaking the .. operator
pattern: /((?:\. *\. *)?)(?:\b\d(?: *\d)*(?: *(?!\. *\.)\.(?: *\d)*)?|\. *\d(?: *\d)*)(?: *e *(?:[+-] *)?\d(?: *\d)*)?/i,
lookbehind: true
},
"operator": /\. *\.|[*\/!](?: *=)?|%(?: *=|(?: *#)?(?: *')*)?|\+(?: *[+=])?|-(?: *[-=>])?|<(?: *>|(?: *<)?(?: *=)?)?|>(?: *>)?(?: *=)?|=(?: *=){0,2}|\\(?: *\/)?(?: *=)?|&(?: *&)?|\| *\||['#~^]/,
"punctuation": /[\[\]{}().,:;|]/
};
(function(Prism2) {
var parser = Prism2.languages.parser = Prism2.languages.extend("markup", {
"keyword": {
pattern: /(^|[^^])(?:\^(?:case|eval|for|if|switch|throw)\b|@(?:BASE|CLASS|GET(?:_DEFAULT)?|OPTIONS|SET_DEFAULT|USE)\b)/,
lookbehind: true
},
"variable": {
pattern: /(^|[^^])\B\$(?:\w+|(?=[.{]))(?:(?:\.|::?)\w+)*(?:\.|::?)?/,
lookbehind: true,
inside: {
"punctuation": /\.|:+/
}
},
"function": {
pattern: /(^|[^^])\B[@^]\w+(?:(?:\.|::?)\w+)*(?:\.|::?)?/,
lookbehind: true,
inside: {
"keyword": {
pattern: /(^@)(?:GET_|SET_)/,
lookbehind: true
},
"punctuation": /\.|:+/
}
},
"escape": {
pattern: /\^(?:[$^;@()\[\]{}"':]|#[a-f\d]*)/i,
alias: "builtin"
},
"punctuation": /[\[\](){};]/
});
parser = Prism2.languages.insertBefore("parser", "keyword", {
"parser-comment": {
pattern: /(\s)#.*/,
lookbehind: true,
alias: "comment"
},
"expression": {
// Allow for 3 levels of depth
pattern: /(^|[^^])\((?:[^()]|\((?:[^()]|\((?:[^()])*\))*\))*\)/,
greedy: true,
lookbehind: true,
inside: {
"string": {
pattern: /(^|[^^])(["'])(?:(?!\2)[^^]|\^[\s\S])*\2/,
lookbehind: true
},
"keyword": parser.keyword,
"variable": parser.variable,
"function": parser.function,
"boolean": /\b(?:false|true)\b/,
"number": /\b(?:0x[a-f\d]+|\d+(?:\.\d*)?(?:e[+-]?\d+)?)\b/i,
"escape": parser.escape,
"operator": /[~+*\/\\%]|!(?:\|\|?|=)?|&&?|\|\|?|==|<[<=]?|>[>=]?|-[fd]?|\b(?:def|eq|ge|gt|in|is|le|lt|ne)\b/,
"punctuation": parser.punctuation
}
}
});
Prism2.languages.insertBefore("inside", "punctuation", {
"expression": parser.expression,
"keyword": parser.keyword,
"variable": parser.variable,
"function": parser.function,
"escape": parser.escape,
"parser-punctuation": {
pattern: parser.punctuation,
alias: "punctuation"
}
}, parser["tag"].inside["attr-value"]);
})(Prism);
Prism.languages.pascal = {
"directive": {
pattern: /\{\$[\s\S]*?\}/,
greedy: true,
alias: ["marco", "property"]
},
"comment": {
pattern: /\(\*[\s\S]*?\*\)|\{[\s\S]*?\}|\/\/.*/,
greedy: true
},
"string": {
pattern: /(?:'(?:''|[^'\r\n])*'(?!')|#[&$%]?[a-f\d]+)+|\^[a-z]/i,
greedy: true
},
"asm": {
pattern: /(\basm\b)[\s\S]+?(?=\bend\s*[;[])/i,
lookbehind: true,
greedy: true,
inside: null
// see below
},
"keyword": [
{
// Turbo Pascal
pattern: /(^|[^&])\b(?:absolute|array|asm|begin|case|const|constructor|destructor|do|downto|else|end|file|for|function|goto|if|implementation|inherited|inline|interface|label|nil|object|of|operator|packed|procedure|program|record|reintroduce|repeat|self|set|string|then|to|type|unit|until|uses|var|while|with)\b/i,
lookbehind: true
},
{
// Free Pascal
pattern: /(^|[^&])\b(?:dispose|exit|false|new|true)\b/i,
lookbehind: true
},
{
// Object Pascal
pattern: /(^|[^&])\b(?:class|dispinterface|except|exports|finalization|finally|initialization|inline|library|on|out|packed|property|raise|resourcestring|threadvar|try)\b/i,
lookbehind: true
},
{
// Modifiers
pattern: /(^|[^&])\b(?:absolute|abstract|alias|assembler|bitpacked|break|cdecl|continue|cppdecl|cvar|default|deprecated|dynamic|enumerator|experimental|export|external|far|far16|forward|generic|helper|implements|index|interrupt|iochecks|local|message|name|near|nodefault|noreturn|nostackframe|oldfpccall|otherwise|overload|override|pascal|platform|private|protected|public|published|read|register|reintroduce|result|safecall|saveregisters|softfloat|specialize|static|stdcall|stored|strict|unaligned|unimplemented|varargs|virtual|write)\b/i,
lookbehind: true
}
],
"number": [
// Hexadecimal, octal and binary
/(?:[&%]\d+|\$[a-f\d]+)/i,
// Decimal
/\b\d+(?:\.\d+)?(?:e[+-]?\d+)?/i
],
"operator": [
/\.\.|\*\*|:=|<[<=>]?|>[>=]?|[+\-*\/]=?|[@^=]/,
{
pattern: /(^|[^&])\b(?:and|as|div|exclude|in|include|is|mod|not|or|shl|shr|xor)\b/,
lookbehind: true
}
],
"punctuation": /\(\.|\.\)|[()\[\]:;,.]/
};
Prism.languages.pascal.asm.inside = Prism.languages.extend("pascal", {
"asm": void 0,
"keyword": void 0,
"operator": void 0
});
Prism.languages.objectpascal = Prism.languages.pascal;
(function(Prism2) {
var braces = /\((?:[^()]|\((?:[^()]|\([^()]*\))*\))*\)/.source;
var type = /(?:\b\w+(?:<braces>)?|<braces>)/.source.replace(/<braces>/g, function() {
return braces;
});
var pascaligo = Prism2.languages.pascaligo = {
"comment": /\(\*[\s\S]+?\*\)|\/\/.*/,
"string": {
pattern: /(["'`])(?:\\[\s\S]|(?!\1)[^\\])*\1|\^[a-z]/i,
greedy: true
},
"class-name": [
{
pattern: RegExp(/(\btype\s+\w+\s+is\s+)<type>/.source.replace(/<type>/g, function() {
return type;
}), "i"),
lookbehind: true,
inside: null
// see below
},
{
pattern: RegExp(/<type>(?=\s+is\b)/.source.replace(/<type>/g, function() {
return type;
}), "i"),
inside: null
// see below
},
{
pattern: RegExp(/(:\s*)<type>/.source.replace(/<type>/g, function() {
return type;
})),
lookbehind: true,
inside: null
// see below
}
],
"keyword": {
pattern: /(^|[^&])\b(?:begin|block|case|const|else|end|fail|for|from|function|if|is|nil|of|remove|return|skip|then|type|var|while|with)\b/i,
lookbehind: true
},
"boolean": {
pattern: /(^|[^&])\b(?:False|True)\b/i,
lookbehind: true
},
"builtin": {
pattern: /(^|[^&])\b(?:bool|int|list|map|nat|record|string|unit)\b/i,
lookbehind: true
},
"function": /\b\w+(?=\s*\()/,
"number": [
// Hexadecimal, octal and binary
/%[01]+|&[0-7]+|\$[a-f\d]+/i,
// Decimal
/\b\d+(?:\.\d+)?(?:e[+-]?\d+)?(?:mtz|n)?/i
],
"operator": /->|=\/=|\.\.|\*\*|:=|<[<=>]?|>[>=]?|[+\-*\/]=?|[@^=|]|\b(?:and|mod|or)\b/,
"punctuation": /\(\.|\.\)|[()\[\]:;,.{}]/
};
var classNameInside = ["comment", "keyword", "builtin", "operator", "punctuation"].reduce(function(accum, key) {
accum[key] = pascaligo[key];
return accum;
}, {});
pascaligo["class-name"].forEach(function(p) {
p.inside = classNameInside;
});
})(Prism);
Prism.languages.psl = {
"comment": {
pattern: /#.*/,
greedy: true
},
"string": {
pattern: /"(?:\\.|[^\\"])*"/,
greedy: true,
inside: {
"symbol": /\\[ntrbA-Z"\\]/
}
},
"heredoc-string": {
pattern: /<<<([a-zA-Z_]\w*)[\r\n](?:.*[\r\n])*?\1\b/,
alias: "string",
greedy: true
},
"keyword": /\b(?:__multi|__single|case|default|do|else|elsif|exit|export|for|foreach|function|if|last|line|local|next|requires|return|switch|until|while|word)\b/,
"constant": /\b(?:ALARM|CHART_ADD_GRAPH|CHART_DELETE_GRAPH|CHART_DESTROY|CHART_LOAD|CHART_PRINT|EOF|OFFLINE|OK|PSL_PROF_LOG|R_CHECK_HORIZ|R_CHECK_VERT|R_CLICKER|R_COLUMN|R_FRAME|R_ICON|R_LABEL|R_LABEL_CENTER|R_LIST_MULTIPLE|R_LIST_MULTIPLE_ND|R_LIST_SINGLE|R_LIST_SINGLE_ND|R_MENU|R_POPUP|R_POPUP_SCROLLED|R_RADIO_HORIZ|R_RADIO_VERT|R_ROW|R_SCALE_HORIZ|R_SCALE_VERT|R_SEP_HORIZ|R_SEP_VERT|R_SPINNER|R_TEXT_FIELD|R_TEXT_FIELD_LABEL|R_TOGGLE|TRIM_LEADING|TRIM_LEADING_AND_TRAILING|TRIM_REDUNDANT|TRIM_TRAILING|VOID|WARN)\b/,
"boolean": /\b(?:FALSE|False|NO|No|TRUE|True|YES|Yes|false|no|true|yes)\b/,
"variable": /\b(?:PslDebug|errno|exit_status)\b/,
"builtin": {
pattern: /\b(?:PslExecute|PslFunctionCall|PslFunctionExists|PslSetOptions|_snmp_debug|acos|add_diary|annotate|annotate_get|ascii_to_ebcdic|asctime|asin|atan|atexit|batch_set|blackout|cat|ceil|chan_exists|change_state|close|code_cvt|cond_signal|cond_wait|console_type|convert_base|convert_date|convert_locale_date|cos|cosh|create|date|dcget_text|destroy|destroy_lock|dget_text|difference|dump_hist|ebcdic_to_ascii|encrypt|event_archive|event_catalog_get|event_check|event_query|event_range_manage|event_range_query|event_report|event_schedule|event_trigger|event_trigger2|execute|exists|exp|fabs|file|floor|fmod|fopen|fseek|ftell|full_discovery|get|get_chan_info|get_ranges|get_text|get_vars|getenv|gethostinfo|getpid|getpname|grep|history|history_get_retention|in_transition|index|int|internal|intersection|is_var|isnumber|join|kill|length|lines|lock|lock_info|log|log10|loge|matchline|msg_check|msg_get_format|msg_get_severity|msg_printf|msg_sprintf|ntharg|nthargf|nthline|nthlinef|num_bytes|num_consoles|pconfig|popen|poplines|pow|print|printf|proc_exists|process|random|read|readln|refresh_parameters|remote_check|remote_close|remote_event_query|remote_event_trigger|remote_file_send|remote_open|remove|replace|rindex|sec_check_priv|sec_store_get|sec_store_set|set|set_alarm_ranges|set_locale|share|sin|sinh|sleep|snmp_agent_config|snmp_agent_start|snmp_agent_stop|snmp_close|snmp_config|snmp_get|snmp_get_next|snmp_h_get|snmp_h_get_next|snmp_h_set|snmp_open|snmp_set|snmp_trap_ignore|snmp_trap_listen|snmp_trap_raise_std_trap|snmp_trap_receive|snmp_trap_register_im|snmp_trap_send|snmp_walk|sopen|sort|splitline|sprintf|sqrt|srandom|str_repeat|strcasecmp|subset|substr|system|tail|tan|tanh|text_domain|time|tmpnam|tolower|toupper|trace_psl_process|trim|union|unique|unlock|unset|va_arg|va_start|write)\b/,
alias: "builtin-function"
},
"foreach-variable": {
pattern: /(\bforeach\s+(?:(?:\w+\b|"(?:\\.|[^\\"])*")\s+){0,2})[_a-zA-Z]\w*(?=\s*\()/,
lookbehind: true,
greedy: true
},
"function": /\b[_a-z]\w*\b(?=\s*\()/i,
"number": /\b(?:0x[0-9a-f]+|\d+(?:\.\d+)?)\b/i,
"operator": /--|\+\+|&&=?|\|\|=?|<<=?|>>=?|[=!]~|[-+*/%&|^!=<>]=?|\.|[:?]/,
"punctuation": /[(){}\[\];,]/
};
Prism.languages.pcaxis = {
"string": /"[^"]*"/,
"keyword": {
pattern: /((?:^|;)\s*)[-A-Z\d]+(?:\s*\[[-\w]+\])?(?:\s*\("[^"]*"(?:,\s*"[^"]*")*\))?(?=\s*=)/,
lookbehind: true,
greedy: true,
inside: {
"keyword": /^[-A-Z\d]+/,
"language": {
pattern: /^(\s*)\[[-\w]+\]/,
lookbehind: true,
inside: {
"punctuation": /^\[|\]$/,
"property": /[-\w]+/
}
},
"sub-key": {
pattern: /^(\s*)\S[\s\S]*/,
lookbehind: true,
inside: {
"parameter": {
pattern: /"[^"]*"/,
alias: "property"
},
"punctuation": /^\(|\)$|,/
}
}
}
},
"operator": /=/,
"tlist": {
pattern: /TLIST\s*\(\s*\w+(?:(?:\s*,\s*"[^"]*")+|\s*,\s*"[^"]*"-"[^"]*")?\s*\)/,
greedy: true,
inside: {
"function": /^TLIST/,
"property": {
pattern: /^(\s*\(\s*)\w+/,
lookbehind: true
},
"string": /"[^"]*"/,
"punctuation": /[(),]/,
"operator": /-/
}
},
"punctuation": /[;,]/,
"number": {
pattern: /(^|\s)\d+(?:\.\d+)?(?!\S)/,
lookbehind: true
},
"boolean": /NO|YES/
};
Prism.languages.px = Prism.languages.pcaxis;
Prism.languages.peoplecode = {
"comment": RegExp([
// C-style multiline comments
/\/\*[\s\S]*?\*\//.source,
// REM comments
/\bREM[^;]*;/.source,
// Nested <* *> comments
/<\*(?:[^<*]|\*(?!>)|<(?!\*)|<\*(?:(?!\*>)[\s\S])*\*>)*\*>/.source,
// /+ +/ comments
/\/\+[\s\S]*?\+\//.source
].join("|")),
"string": {
pattern: /'(?:''|[^'\r\n])*'(?!')|"(?:""|[^"\r\n])*"(?!")/,
greedy: true
},
"variable": /%\w+/,
"function-definition": {
pattern: /((?:^|[^\w-])(?:function|method)\s+)\w+/i,
lookbehind: true,
alias: "function"
},
"class-name": {
pattern: /((?:^|[^-\w])(?:as|catch|class|component|create|extends|global|implements|instance|local|of|property|returns)\s+)\w+(?::\w+)*/i,
lookbehind: true,
inside: {
"punctuation": /:/
}
},
"keyword": /\b(?:abstract|alias|as|catch|class|component|constant|create|declare|else|end-(?:class|evaluate|for|function|get|if|method|set|try|while)|evaluate|extends|for|function|get|global|if|implements|import|instance|library|local|method|null|of|out|peopleCode|private|program|property|protected|readonly|ref|repeat|returns?|set|step|then|throw|to|try|until|value|when(?:-other)?|while)\b/i,
"operator-keyword": {
pattern: /\b(?:and|not|or)\b/i,
alias: "operator"
},
"function": /[_a-z]\w*(?=\s*\()/i,
"boolean": /\b(?:false|true)\b/i,
"number": /\b\d+(?:\.\d+)?\b/,
"operator": /<>|[<>]=?|!=|\*\*|[-+*/|=@]/,
"punctuation": /[:.;,()[\]]/
};
Prism.languages.pcode = Prism.languages.peoplecode;
(function(Prism2) {
var brackets = /(?:\((?:[^()\\]|\\[\s\S])*\)|\{(?:[^{}\\]|\\[\s\S])*\}|\[(?:[^[\]\\]|\\[\s\S])*\]|<(?:[^<>\\]|\\[\s\S])*>)/.source;
Prism2.languages.perl = {
"comment": [
{
// POD
pattern: /(^\s*)=\w[\s\S]*?=cut.*/m,
lookbehind: true,
greedy: true
},
{
pattern: /(^|[^\\$])#.*/,
lookbehind: true,
greedy: true
}
],
// TODO Could be nice to handle Heredoc too.
"string": [
{
pattern: RegExp(
/\b(?:q|qq|qw|qx)(?![a-zA-Z0-9])\s*/.source + "(?:" + [
// q/.../
/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,
// q a...a
// eslint-disable-next-line regexp/strict
/([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,
// q(...)
// q{...}
// q[...]
// q<...>
brackets
].join("|") + ")"
),
greedy: true
},
// "...", `...`
{
pattern: /("|`)(?:(?!\1)[^\\]|\\[\s\S])*\1/,
greedy: true
},
// '...'
// FIXME Multi-line single-quoted strings are not supported as they would break variables containing '
{
pattern: /'(?:[^'\\\r\n]|\\.)*'/,
greedy: true
}
],
"regex": [
{
pattern: RegExp(
/\b(?:m|qr)(?![a-zA-Z0-9])\s*/.source + "(?:" + [
// m/.../
/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,
// m a...a
// eslint-disable-next-line regexp/strict
/([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,
// m(...)
// m{...}
// m[...]
// m<...>
brackets
].join("|") + ")" + /[msixpodualngc]*/.source
),
greedy: true
},
// The lookbehinds prevent -s from breaking
{
pattern: RegExp(
/(^|[^-])\b(?:s|tr|y)(?![a-zA-Z0-9])\s*/.source + "(?:" + [
// s/.../.../
// eslint-disable-next-line regexp/strict
/([^a-zA-Z0-9\s{(\[<])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,
// s a...a...a
// eslint-disable-next-line regexp/strict
/([a-zA-Z0-9])(?:(?!\3)[^\\]|\\[\s\S])*\3(?:(?!\3)[^\\]|\\[\s\S])*\3/.source,
// s(...)(...)
// s{...}{...}
// s[...][...]
// s<...><...>
// s(...)[...]
brackets + /\s*/.source + brackets
].join("|") + ")" + /[msixpodualngcer]*/.source
),
lookbehind: true,
greedy: true
},
// /.../
// The look-ahead tries to prevent two divisions on
// the same line from being highlighted as regex.
// This does not support multi-line regex.
{
pattern: /\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&|\-+*~<>!?^]|(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|x|xor)\b))/,
greedy: true
}
],
// FIXME Not sure about the handling of ::, ', and #
"variable": [
// ${^POSTMATCH}
/[&*$@%]\{\^[A-Z]+\}/,
// $^V
/[&*$@%]\^[A-Z_]/,
// ${...}
/[&*$@%]#?(?=\{)/,
// $foo
/[&*$@%]#?(?:(?:::)*'?(?!\d)[\w$]+(?![\w$]))+(?:::)*/,
// $1
/[&*$@%]\d+/,
// $_, @_, %!
// The negative lookahead prevents from breaking the %= operator
/(?!%=)[$@%][!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/
],
"filehandle": {
// <>, <FOO>, _
pattern: /<(?![<=])\S*?>|\b_\b/,
alias: "symbol"
},
"v-string": {
// v1.2, 1.2.3
pattern: /v\d+(?:\.\d+)*|\d+(?:\.\d+){2,}/,
alias: "string"
},
"function": {
pattern: /(\bsub[ \t]+)\w+/,
lookbehind: true
},
"keyword": /\b(?:any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|return|say|state|sub|switch|undef|unless|until|use|when|while)\b/,
"number": /\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)\b/,
"operator": /-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/\/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)\b/,
"punctuation": /[{}[\];(),:]/
};
})(Prism);
(function(Prism2) {
var typeExpression = /(?:\b[a-zA-Z]\w*|[|\\[\]])+/.source;
Prism2.languages.phpdoc = Prism2.languages.extend("javadoclike", {
"parameter": {
pattern: RegExp("(@(?:global|param|property(?:-read|-write)?|var)\\s+(?:" + typeExpression + "\\s+)?)\\$\\w+"),
lookbehind: true
}
});
Prism2.languages.insertBefore("phpdoc", "keyword", {
"class-name": [
{
pattern: RegExp("(@(?:global|package|param|property(?:-read|-write)?|return|subpackage|throws|var)\\s+)" + typeExpression),
lookbehind: true,
inside: {
"keyword": /\b(?:array|bool|boolean|callback|double|false|float|int|integer|mixed|null|object|resource|self|string|true|void)\b/,
"punctuation": /[|\\[\]()]/
}
}
]
});
Prism2.languages.javadoclike.addSupport("php", Prism2.languages.phpdoc);
})(Prism);
Prism.languages.insertBefore("php", "variable", {
"this": {
pattern: /\$this\b/,
alias: "keyword"
},
"global": /\$(?:GLOBALS|HTTP_RAW_POST_DATA|_(?:COOKIE|ENV|FILES|GET|POST|REQUEST|SERVER|SESSION)|argc|argv|http_response_header|php_errormsg)\b/,
"scope": {
pattern: /\b[\w\\]+::/,
inside: {
"keyword": /\b(?:parent|self|static)\b/,
"punctuation": /::|\\/
}
}
});
(function(Prism2) {
var variable = /\$\w+|%[a-z]+%/;
var arrowAttr = /\[[^[\]]*\]/.source;
var arrowDirection = /(?:[drlu]|do|down|le|left|ri|right|up)/.source;
var arrowBody = "(?:-+" + arrowDirection + "-+|\\.+" + arrowDirection + "\\.+|-+(?:" + arrowAttr + "-*)?|" + arrowAttr + "-+|\\.+(?:" + arrowAttr + "\\.*)?|" + arrowAttr + "\\.+)";
var arrowLeft = /(?:<{1,2}|\/{1,2}|\\{1,2}|<\||[#*^+}xo])/.source;
var arrowRight = /(?:>{1,2}|\/{1,2}|\\{1,2}|\|>|[#*^+{xo])/.source;
var arrowPrefix = /[[?]?[ox]?/.source;
var arrowSuffix = /[ox]?[\]?]?/.source;
var arrow2 = arrowPrefix + "(?:" + arrowBody + arrowRight + "|" + arrowLeft + arrowBody + "(?:" + arrowRight + ")?)" + arrowSuffix;
Prism2.languages["plant-uml"] = {
"comment": {
pattern: /(^[ \t]*)(?:'.*|\/'[\s\S]*?'\/)/m,
lookbehind: true,
greedy: true
},
"preprocessor": {
pattern: /(^[ \t]*)!.*/m,
lookbehind: true,
greedy: true,
alias: "property",
inside: {
"variable": variable
}
},
"delimiter": {
pattern: /(^[ \t]*)@(?:end|start)uml\b/m,
lookbehind: true,
greedy: true,
alias: "punctuation"
},
"arrow": {
pattern: RegExp(/(^|[^-.<>?|\\[\]ox])/.source + arrow2 + /(?![-.<>?|\\\]ox])/.source),
lookbehind: true,
greedy: true,
alias: "operator",
inside: {
"expression": {
pattern: /(\[)[^[\]]+(?=\])/,
lookbehind: true,
inside: null
// see below
},
"punctuation": /\[(?=$|\])|^\]/
}
},
"string": {
pattern: /"[^"]*"/,
greedy: true
},
"text": {
pattern: /(\[[ \t]*[\r\n]+(?![\r\n]))[^\]]*(?=\])/,
lookbehind: true,
greedy: true,
alias: "string"
},
"keyword": [
{
pattern: /^([ \t]*)(?:abstract\s+class|end\s+(?:box|fork|group|merge|note|ref|split|title)|(?:fork|split)(?:\s+again)?|activate|actor|agent|alt|annotation|artifact|autoactivate|autonumber|backward|binary|boundary|box|break|caption|card|case|circle|class|clock|cloud|collections|component|concise|control|create|critical|database|deactivate|destroy|detach|diamond|else|elseif|end|end[hr]note|endif|endswitch|endwhile|entity|enum|file|folder|footer|frame|group|[hr]?note|header|hexagon|hide|if|interface|label|legend|loop|map|namespace|network|newpage|node|nwdiag|object|opt|package|page|par|participant|person|queue|rectangle|ref|remove|repeat|restore|return|robust|scale|set|show|skinparam|stack|start|state|stop|storage|switch|title|together|usecase|usecase\/|while)(?=\s|$)/m,
lookbehind: true,
greedy: true
},
/\b(?:elseif|equals|not|while)(?=\s*\()/,
/\b(?:as|is|then)\b/
],
"divider": {
pattern: /^==.+==$/m,
greedy: true,
alias: "important"
},
"time": {
pattern: /@(?:\d+(?:[:/]\d+){2}|[+-]?\d+|:[a-z]\w*(?:[+-]\d+)?)\b/i,
greedy: true,
alias: "number"
},
"color": {
pattern: /#(?:[a-z_]+|[a-fA-F0-9]+)\b/,
alias: "symbol"
},
"variable": variable,
"punctuation": /[:,;()[\]{}]|\.{3}/
};
Prism2.languages["plant-uml"].arrow.inside.expression.inside = Prism2.languages["plant-uml"];
Prism2.languages["plantuml"] = Prism2.languages["plant-uml"];
})(Prism);
Prism.languages.plsql = Prism.languages.extend("sql", {
"comment": {
pattern: /\/\*[\s\S]*?\*\/|--.*/,
greedy: true
},
// https://docs.oracle.com/en/database/oracle/oracle-database/21/lnpls/plsql-reserved-words-keywords.html
"keyword": /\b(?:A|ACCESSIBLE|ADD|AGENT|AGGREGATE|ALL|ALTER|AND|ANY|ARRAY|AS|ASC|AT|ATTRIBUTE|AUTHID|AVG|BEGIN|BETWEEN|BFILE_BASE|BINARY|BLOB_BASE|BLOCK|BODY|BOTH|BOUND|BULK|BY|BYTE|C|CALL|CALLING|CASCADE|CASE|CHAR|CHARACTER|CHARSET|CHARSETFORM|CHARSETID|CHAR_BASE|CHECK|CLOB_BASE|CLONE|CLOSE|CLUSTER|CLUSTERS|COLAUTH|COLLECT|COLUMNS|COMMENT|COMMIT|COMMITTED|COMPILED|COMPRESS|CONNECT|CONSTANT|CONSTRUCTOR|CONTEXT|CONTINUE|CONVERT|COUNT|CRASH|CREATE|CREDENTIAL|CURRENT|CURSOR|CUSTOMDATUM|DANGLING|DATA|DATE|DATE_BASE|DAY|DECLARE|DEFAULT|DEFINE|DELETE|DESC|DETERMINISTIC|DIRECTORY|DISTINCT|DOUBLE|DROP|DURATION|ELEMENT|ELSE|ELSIF|EMPTY|END|ESCAPE|EXCEPT|EXCEPTION|EXCEPTIONS|EXCLUSIVE|EXECUTE|EXISTS|EXIT|EXTERNAL|FETCH|FINAL|FIRST|FIXED|FLOAT|FOR|FORALL|FORCE|FROM|FUNCTION|GENERAL|GOTO|GRANT|GROUP|HASH|HAVING|HEAP|HIDDEN|HOUR|IDENTIFIED|IF|IMMEDIATE|IMMUTABLE|IN|INCLUDING|INDEX|INDEXES|INDICATOR|INDICES|INFINITE|INSERT|INSTANTIABLE|INT|INTERFACE|INTERSECT|INTERVAL|INTO|INVALIDATE|IS|ISOLATION|JAVA|LANGUAGE|LARGE|LEADING|LENGTH|LEVEL|LIBRARY|LIKE|LIKE2|LIKE4|LIKEC|LIMIT|LIMITED|LOCAL|LOCK|LONG|LOOP|MAP|MAX|MAXLEN|MEMBER|MERGE|MIN|MINUS|MINUTE|MOD|MODE|MODIFY|MONTH|MULTISET|MUTABLE|NAME|NAN|NATIONAL|NATIVE|NCHAR|NEW|NOCOMPRESS|NOCOPY|NOT|NOWAIT|NULL|NUMBER_BASE|OBJECT|OCICOLL|OCIDATE|OCIDATETIME|OCIDURATION|OCIINTERVAL|OCILOBLOCATOR|OCINUMBER|OCIRAW|OCIREF|OCIREFCURSOR|OCIROWID|OCISTRING|OCITYPE|OF|OLD|ON|ONLY|OPAQUE|OPEN|OPERATOR|OPTION|OR|ORACLE|ORADATA|ORDER|ORGANIZATION|ORLANY|ORLVARY|OTHERS|OUT|OVERLAPS|OVERRIDING|PACKAGE|PARALLEL_ENABLE|PARAMETER|PARAMETERS|PARENT|PARTITION|PASCAL|PERSISTABLE|PIPE|PIPELINED|PLUGGABLE|POLYMORPHIC|PRAGMA|PRECISION|PRIOR|PRIVATE|PROCEDURE|PUBLIC|RAISE|RANGE|RAW|READ|RECORD|REF|REFERENCE|RELIES_ON|REM|REMAINDER|RENAME|RESOURCE|RESULT|RESULT_CACHE|RETURN|RETURNING|REVERSE|REVOKE|ROLLBACK|ROW|SAMPLE|SAVE|SAVEPOINT|SB1|SB2|SB4|SECOND|SEGMENT|SELECT|SELF|SEPARATE|SEQUENCE|SERIALIZABLE|SET|SHARE|SHORT|SIZE|SIZE_T|SOME|SPARSE|SQL|SQLCODE|SQLDATA|SQLNAME|SQLSTATE|STANDARD|START|STATIC|STDDEV|STORED|STRING|STRUCT|STYLE|SUBMULTISET|SUBPARTITION|SUBSTITUTABLE|SUBTYPE|SUM|SYNONYM|TABAUTH|TABLE|TDO|THE|THEN|TIME|TIMESTAMP|TIMEZONE_ABBR|TIMEZONE_HOUR|TIMEZONE_MINUTE|TIMEZONE_REGION|TO|TRAILING|TRANSACTION|TRANSACTIONAL|TRUSTED|TYPE|UB1|UB2|UB4|UNDER|UNION|UNIQUE|UNPLUG|UNSIGNED|UNTRUSTED|UPDATE|USE|USING|VALIST|VALUE|VALUES|VARIABLE|VARIANCE|VARRAY|VARYING|VIEW|VIEWS|VOID|WHEN|WHERE|WHILE|WITH|WORK|WRAPPED|WRITE|YEAR|ZONE)\b/i,
// https://docs.oracle.com/en/database/oracle/oracle-database/21/lnpls/plsql-language-fundamentals.html#GUID-96A42F7C-7A71-4B90-8255-CA9C8BD9722E
"operator": /:=?|=>|[<>^~!]=|\.\.|\|\||\*\*|[-+*/%<>=@]/
});
Prism.languages.insertBefore("plsql", "operator", {
"label": {
pattern: /<<\s*\w+\s*>>/,
alias: "symbol"
}
});
Prism.languages.powerquery = {
"comment": {
pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
lookbehind: true,
greedy: true
},
"quoted-identifier": {
pattern: /#"(?:[^"\r\n]|"")*"(?!")/,
greedy: true
},
"string": {
pattern: /(?:#!)?"(?:[^"\r\n]|"")*"(?!")/,
greedy: true
},
"constant": [
/\bDay\.(?:Friday|Monday|Saturday|Sunday|Thursday|Tuesday|Wednesday)\b/,
/\bTraceLevel\.(?:Critical|Error|Information|Verbose|Warning)\b/,
/\bOccurrence\.(?:All|First|Last)\b/,
/\bOrder\.(?:Ascending|Descending)\b/,
/\bRoundingMode\.(?:AwayFromZero|Down|ToEven|TowardZero|Up)\b/,
/\bMissingField\.(?:Error|Ignore|UseNull)\b/,
/\bQuoteStyle\.(?:Csv|None)\b/,
/\bJoinKind\.(?:FullOuter|Inner|LeftAnti|LeftOuter|RightAnti|RightOuter)\b/,
/\bGroupKind\.(?:Global|Local)\b/,
/\bExtraValues\.(?:Error|Ignore|List)\b/,
/\bJoinAlgorithm\.(?:Dynamic|LeftHash|LeftIndex|PairwiseHash|RightHash|RightIndex|SortMerge)\b/,
/\bJoinSide\.(?:Left|Right)\b/,
/\bPrecision\.(?:Decimal|Double)\b/,
/\bRelativePosition\.From(?:End|Start)\b/,
/\bTextEncoding\.(?:Ascii|BigEndianUnicode|Unicode|Utf16|Utf8|Windows)\b/,
/\b(?:Any|Binary|Date|DateTime|DateTimeZone|Duration|Function|Int16|Int32|Int64|Int8|List|Logical|None|Number|Record|Table|Text|Time)\.Type\b/,
/\bnull\b/
],
"boolean": /\b(?:false|true)\b/,
"keyword": /\b(?:and|as|each|else|error|if|in|is|let|meta|not|nullable|optional|or|otherwise|section|shared|then|try|type)\b|#(?:binary|date|datetime|datetimezone|duration|infinity|nan|sections|shared|table|time)\b/,
"function": {
pattern: /(^|[^#\w.])[a-z_][\w.]*(?=\s*\()/i,
lookbehind: true
},
"data-type": {
pattern: /\b(?:any|anynonnull|binary|date|datetime|datetimezone|duration|function|list|logical|none|number|record|table|text|time)\b/,
alias: "class-name"
},
"number": {
pattern: /\b0x[\da-f]+\b|(?:[+-]?(?:\b\d+\.)?\b\d+|[+-]\.\d+|(^|[^.])\B\.\d+)(?:e[+-]?\d+)?\b/i,
lookbehind: true
},
"operator": /[-+*\/&?@^]|<(?:=>?|>)?|>=?|=>?|\.\.\.?/,
"punctuation": /[,;\[\](){}]/
};
Prism.languages.pq = Prism.languages["powerquery"];
Prism.languages.mscript = Prism.languages["powerquery"];
(function(Prism2) {
var powershell = Prism2.languages.powershell = {
"comment": [
{
pattern: /(^|[^`])<#[\s\S]*?#>/,
lookbehind: true
},
{
pattern: /(^|[^`])#.*/,
lookbehind: true
}
],
"string": [
{
pattern: /"(?:`[\s\S]|[^`"])*"/,
greedy: true,
inside: null
// see below
},
{
pattern: /'(?:[^']|'')*'/,
greedy: true
}
],
// Matches name spaces as well as casts, attribute decorators. Force starting with letter to avoid matching array indices
// Supports two levels of nested brackets (e.g. `[OutputType([System.Collections.Generic.List[int]])]`)
"namespace": /\[[a-z](?:\[(?:\[[^\]]*\]|[^\[\]])*\]|[^\[\]])*\]/i,
"boolean": /\$(?:false|true)\b/i,
"variable": /\$\w+\b/,
// Cmdlets and aliases. Aliases should come last, otherwise "write" gets preferred over "write-host" for example
// Get-Command | ?{ $_.ModuleName -match "Microsoft.PowerShell.(Util|Core|Management)" }
// Get-Alias | ?{ $_.ReferencedCommand.Module.Name -match "Microsoft.PowerShell.(Util|Core|Management)" }
"function": [
/\b(?:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i,
/\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i
],
// per http://technet.microsoft.com/en-us/library/hh847744.aspx
"keyword": /\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,
"operator": {
pattern: /(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,
lookbehind: true
},
"punctuation": /[|{}[\];(),.]/
};
powershell.string[0].inside = {
"function": {
// Allow for one level of nesting
pattern: /(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,
lookbehind: true,
inside: powershell
},
"boolean": powershell.boolean,
"variable": powershell.variable
};
})(Prism);
Prism.languages.processing = Prism.languages.extend("clike", {
"keyword": /\b(?:break|case|catch|class|continue|default|else|extends|final|for|if|implements|import|new|null|private|public|return|static|super|switch|this|try|void|while)\b/,
// Spaces are allowed between function name and parenthesis
"function": /\b\w+(?=\s*\()/,
"operator": /<[<=]?|>[>=]?|&&?|\|\|?|[%?]|[!=+\-*\/]=?/
});
Prism.languages.insertBefore("processing", "number", {
// Special case: XML is a type
"constant": /\b(?!XML\b)[A-Z][A-Z\d_]+\b/,
"type": {
pattern: /\b(?:boolean|byte|char|color|double|float|int|[A-Z]\w*)\b/,
alias: "class-name"
}
});
Prism.languages.prolog = {
// Syntax depends on the implementation
"comment": {
pattern: /\/\*[\s\S]*?\*\/|%.*/,
greedy: true
},
// Depending on the implementation, strings may allow escaped newlines and quote-escape
"string": {
pattern: /(["'])(?:\1\1|\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1(?!\1)/,
greedy: true
},
"builtin": /\b(?:fx|fy|xf[xy]?|yfx?)\b/,
// FIXME: Should we list all null-ary predicates (not followed by a parenthesis) like halt, trace, etc.?
"function": /\b[a-z]\w*(?:(?=\()|\/\d+)/,
"number": /\b\d+(?:\.\d*)?/,
// Custom operators are allowed
"operator": /[:\\=><\-?*@\/;+^|!$.]+|\b(?:is|mod|not|xor)\b/,
"punctuation": /[(){}\[\],]/
};
(function(Prism2) {
var aggregations = [
"sum",
"min",
"max",
"avg",
"group",
"stddev",
"stdvar",
"count",
"count_values",
"bottomk",
"topk",
"quantile"
];
var vectorMatching = [
"on",
"ignoring",
"group_right",
"group_left",
"by",
"without"
];
var offsetModifier = ["offset"];
var keywords = aggregations.concat(vectorMatching, offsetModifier);
Prism2.languages.promql = {
"comment": {
pattern: /(^[ \t]*)#.*/m,
lookbehind: true
},
"vector-match": {
// Match the comma-separated label lists inside vector matching:
pattern: new RegExp("((?:" + vectorMatching.join("|") + ")\\s*)\\([^)]*\\)"),
lookbehind: true,
inside: {
"label-key": {
pattern: /\b[^,]+\b/,
alias: "attr-name"
},
"punctuation": /[(),]/
}
},
"context-labels": {
pattern: /\{[^{}]*\}/,
inside: {
"label-key": {
pattern: /\b[a-z_]\w*(?=\s*(?:=|![=~]))/,
alias: "attr-name"
},
"label-value": {
pattern: /(["'`])(?:\\[\s\S]|(?!\1)[^\\])*\1/,
greedy: true,
alias: "attr-value"
},
"punctuation": /\{|\}|=~?|![=~]|,/
}
},
"context-range": [
{
pattern: /\[[\w\s:]+\]/,
// [1m]
inside: {
"punctuation": /\[|\]|:/,
"range-duration": {
pattern: /\b(?:\d+(?:[smhdwy]|ms))+\b/i,
alias: "number"
}
}
},
{
pattern: /(\boffset\s+)\w+/,
// offset 1m
lookbehind: true,
inside: {
"range-duration": {
pattern: /\b(?:\d+(?:[smhdwy]|ms))+\b/i,
alias: "number"
}
}
}
],
"keyword": new RegExp("\\b(?:" + keywords.join("|") + ")\\b", "i"),
"function": /\b[a-z_]\w*(?=\s*\()/i,
"number": /[-+]?(?:(?:\b\d+(?:\.\d+)?|\B\.\d+)(?:e[-+]?\d+)?\b|\b(?:0x[0-9a-f]+|nan|inf)\b)/i,
"operator": /[\^*/%+-]|==|!=|<=|<|>=|>|\b(?:and|or|unless)\b/i,
"punctuation": /[{};()`,.[\]]/
};
})(Prism);
Prism.languages.properties = {
"comment": /^[ \t]*[#!].*$/m,
"value": {
pattern: /(^[ \t]*(?:\\(?:\r\n|[\s\S])|[^\\\s:=])+(?: *[=:] *(?! )| ))(?:\\(?:\r\n|[\s\S])|[^\\\r\n])+/m,
lookbehind: true,
alias: "attr-value"
},
"key": {
pattern: /^[ \t]*(?:\\(?:\r\n|[\s\S])|[^\\\s:=])+(?= *[=:]| )/m,
alias: "attr-name"
},
"punctuation": /[=:]/
};
(function(Prism2) {
var builtinTypes = /\b(?:bool|bytes|double|s?fixed(?:32|64)|float|[su]?int(?:32|64)|string)\b/;
Prism2.languages.protobuf = Prism2.languages.extend("clike", {
"class-name": [
{
pattern: /(\b(?:enum|extend|message|service)\s+)[A-Za-z_]\w*(?=\s*\{)/,
lookbehind: true
},
{
pattern: /(\b(?:rpc\s+\w+|returns)\s*\(\s*(?:stream\s+)?)\.?[A-Za-z_]\w*(?:\.[A-Za-z_]\w*)*(?=\s*\))/,
lookbehind: true
}
],
"keyword": /\b(?:enum|extend|extensions|import|message|oneof|option|optional|package|public|repeated|required|reserved|returns|rpc(?=\s+\w)|service|stream|syntax|to)\b(?!\s*=\s*\d)/,
"function": /\b[a-z_]\w*(?=\s*\()/i
});
Prism2.languages.insertBefore("protobuf", "operator", {
"map": {
pattern: /\bmap<\s*[\w.]+\s*,\s*[\w.]+\s*>(?=\s+[a-z_]\w*\s*[=;])/i,
alias: "class-name",
inside: {
"punctuation": /[<>.,]/,
"builtin": builtinTypes
}
},
"builtin": builtinTypes,
"positional-class-name": {
pattern: /(?:\b|\B\.)[a-z_]\w*(?:\.[a-z_]\w*)*(?=\s+[a-z_]\w*\s*[=;])/i,
alias: "class-name",
inside: {
"punctuation": /\./
}
},
"annotation": {
pattern: /(\[\s*)[a-z_]\w*(?=\s*=)/i,
lookbehind: true
}
});
})(Prism);
(function(Prism2) {
Prism2.languages.pug = {
// Multiline stuff should appear before the rest
// This handles both single-line and multi-line comments
"comment": {
pattern: /(^([\t ]*))\/\/.*(?:(?:\r?\n|\r)\2[\t ].+)*/m,
lookbehind: true
},
// All the tag-related part is in lookbehind
// so that it can be highlighted by the "tag" pattern
"multiline-script": {
pattern: /(^([\t ]*)script\b.*\.[\t ]*)(?:(?:\r?\n|\r(?!\n))(?:\2[\t ].+|\s*?(?=\r?\n|\r)))+/m,
lookbehind: true,
inside: Prism2.languages.javascript
},
// See at the end of the file for known filters
"filter": {
pattern: /(^([\t ]*)):.+(?:(?:\r?\n|\r(?!\n))(?:\2[\t ].+|\s*?(?=\r?\n|\r)))+/m,
lookbehind: true,
inside: {
"filter-name": {
pattern: /^:[\w-]+/,
alias: "variable"
},
"text": /\S[\s\S]*/
}
},
"multiline-plain-text": {
pattern: /(^([\t ]*)[\w\-#.]+\.[\t ]*)(?:(?:\r?\n|\r(?!\n))(?:\2[\t ].+|\s*?(?=\r?\n|\r)))+/m,
lookbehind: true
},
"markup": {
pattern: /(^[\t ]*)<.+/m,
lookbehind: true,
inside: Prism2.languages.markup
},
"doctype": {
pattern: /((?:^|\n)[\t ]*)doctype(?: .+)?/,
lookbehind: true
},
// This handle all conditional and loop keywords
"flow-control": {
pattern: /(^[\t ]*)(?:case|default|each|else|if|unless|when|while)\b(?: .+)?/m,
lookbehind: true,
inside: {
"each": {
pattern: /^each .+? in\b/,
inside: {
"keyword": /\b(?:each|in)\b/,
"punctuation": /,/
}
},
"branch": {
pattern: /^(?:case|default|else|if|unless|when|while)\b/,
alias: "keyword"
},
rest: Prism2.languages.javascript
}
},
"keyword": {
pattern: /(^[\t ]*)(?:append|block|extends|include|prepend)\b.+/m,
lookbehind: true
},
"mixin": [
// Declaration
{
pattern: /(^[\t ]*)mixin .+/m,
lookbehind: true,
inside: {
"keyword": /^mixin/,
"function": /\w+(?=\s*\(|\s*$)/,
"punctuation": /[(),.]/
}
},
// Usage
{
pattern: /(^[\t ]*)\+.+/m,
lookbehind: true,
inside: {
"name": {
pattern: /^\+\w+/,
alias: "function"
},
rest: Prism2.languages.javascript
}
}
],
"script": {
pattern: /(^[\t ]*script(?:(?:&[^(]+)?\([^)]+\))*[\t ]).+/m,
lookbehind: true,
inside: Prism2.languages.javascript
},
"plain-text": {
pattern: /(^[\t ]*(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?[\t ]).+/m,
lookbehind: true
},
"tag": {
pattern: /(^[\t ]*)(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?:?/m,
lookbehind: true,
inside: {
"attributes": [
{
pattern: /&[^(]+\([^)]+\)/,
inside: Prism2.languages.javascript
},
{
pattern: /\([^)]+\)/,
inside: {
"attr-value": {
pattern: /(=\s*(?!\s))(?:\{[^}]*\}|[^,)\r\n]+)/,
lookbehind: true,
inside: Prism2.languages.javascript
},
"attr-name": /[\w-]+(?=\s*!?=|\s*[,)])/,
"punctuation": /[!=(),]+/
}
}
],
"punctuation": /:/,
"attr-id": /#[\w\-]+/,
"attr-class": /\.[\w\-]+/
}
},
"code": [
{
pattern: /(^[\t ]*(?:-|!?=)).+/m,
lookbehind: true,
inside: Prism2.languages.javascript
}
],
"punctuation": /[.\-!=|]+/
};
var filter_pattern = /(^([\t ]*)):<filter_name>(?:(?:\r?\n|\r(?!\n))(?:\2[\t ].+|\s*?(?=\r?\n|\r)))+/.source;
var filters = [
{ filter: "atpl", language: "twig" },
{ filter: "coffee", language: "coffeescript" },
"ejs",
"handlebars",
"less",
"livescript",
"markdown",
{ filter: "sass", language: "scss" },
"stylus"
];
var all_filters = {};
for (var i = 0, l = filters.length; i < l; i++) {
var filter = filters[i];
filter = typeof filter === "string" ? { filter, language: filter } : filter;
if (Prism2.languages[filter.language]) {
all_filters["filter-" + filter.filter] = {
pattern: RegExp(filter_pattern.replace("<filter_name>", function() {
return filter.filter;
}), "m"),
lookbehind: true,
inside: {
"filter-name": {
pattern: /^:[\w-]+/,
alias: "variable"
},
"text": {
pattern: /\S[\s\S]*/,
alias: [filter.language, "language-" + filter.language],
inside: Prism2.languages[filter.language]
}
}
};
}
}
Prism2.languages.insertBefore("pug", "filter", all_filters);
})(Prism);
(function(Prism2) {
Prism2.languages.puppet = {
"heredoc": [
// Matches the content of a quoted heredoc string (subject to interpolation)
{
pattern: /(@\("([^"\r\n\/):]+)"(?:\/[nrts$uL]*)?\).*(?:\r?\n|\r))(?:.*(?:\r?\n|\r(?!\n)))*?[ \t]*(?:\|[ \t]*)?(?:-[ \t]*)?\2/,
lookbehind: true,
alias: "string",
inside: {
// Matches the end tag
"punctuation": /(?=\S).*\S(?= *$)/
// See interpolation below
}
},
// Matches the content of an unquoted heredoc string (no interpolation)
{
pattern: /(@\(([^"\r\n\/):]+)(?:\/[nrts$uL]*)?\).*(?:\r?\n|\r))(?:.*(?:\r?\n|\r(?!\n)))*?[ \t]*(?:\|[ \t]*)?(?:-[ \t]*)?\2/,
lookbehind: true,
greedy: true,
alias: "string",
inside: {
// Matches the end tag
"punctuation": /(?=\S).*\S(?= *$)/
}
},
// Matches the start tag of heredoc strings
{
pattern: /@\("?(?:[^"\r\n\/):]+)"?(?:\/[nrts$uL]*)?\)/,
alias: "string",
inside: {
"punctuation": {
pattern: /(\().+?(?=\))/,
lookbehind: true
}
}
}
],
"multiline-comment": {
pattern: /(^|[^\\])\/\*[\s\S]*?\*\//,
lookbehind: true,
greedy: true,
alias: "comment"
},
"regex": {
// Must be prefixed with the keyword "node" or a non-word char
pattern: /((?:\bnode\s+|[~=\(\[\{,]\s*|[=+]>\s*|^\s*))\/(?:[^\/\\]|\\[\s\S])+\/(?:[imx]+\b|\B)/,
lookbehind: true,
greedy: true,
inside: {
// Extended regexes must have the x flag. They can contain single-line comments.
"extended-regex": {
pattern: /^\/(?:[^\/\\]|\\[\s\S])+\/[im]*x[im]*$/,
inside: {
"comment": /#.*/
}
}
}
},
"comment": {
pattern: /(^|[^\\])#.*/,
lookbehind: true,
greedy: true
},
"string": {
// Allow for one nested level of double quotes inside interpolation
pattern: /(["'])(?:\$\{(?:[^'"}]|(["'])(?:(?!\2)[^\\]|\\[\s\S])*\2)+\}|\$(?!\{)|(?!\1)[^\\$]|\\[\s\S])*\1/,
greedy: true,
inside: {
"double-quoted": {
pattern: /^"[\s\S]*"$/,
inside: {
// See interpolation below
}
}
}
},
"variable": {
pattern: /\$(?:::)?\w+(?:::\w+)*/,
inside: {
"punctuation": /::/
}
},
"attr-name": /(?:\b\w+|\*)(?=\s*=>)/,
"function": [
{
pattern: /(\.)(?!\d)\w+/,
lookbehind: true
},
/\b(?:contain|debug|err|fail|include|info|notice|realize|require|tag|warning)\b|\b(?!\d)\w+(?=\()/
],
"number": /\b(?:0x[a-f\d]+|\d+(?:\.\d+)?(?:e-?\d+)?)\b/i,
"boolean": /\b(?:false|true)\b/,
// Includes words reserved for future use
"keyword": /\b(?:application|attr|case|class|consumes|default|define|else|elsif|function|if|import|inherits|node|private|produces|type|undef|unless)\b/,
"datatype": {
pattern: /\b(?:Any|Array|Boolean|Callable|Catalogentry|Class|Collection|Data|Default|Enum|Float|Hash|Integer|NotUndef|Numeric|Optional|Pattern|Regexp|Resource|Runtime|Scalar|String|Struct|Tuple|Type|Undef|Variant)\b/,
alias: "symbol"
},
"operator": /=[=~>]?|![=~]?|<(?:<\|?|[=~|-])?|>[>=]?|->?|~>|\|>?>?|[*\/%+?]|\b(?:and|in|or)\b/,
"punctuation": /[\[\]{}().,;]|:+/
};
var interpolation = [
{
// Allow for one nested level of braces inside interpolation
pattern: /(^|[^\\])\$\{(?:[^'"{}]|\{[^}]*\}|(["'])(?:(?!\2)[^\\]|\\[\s\S])*\2)+\}/,
lookbehind: true,
inside: {
"short-variable": {
// Negative look-ahead prevent wrong highlighting of functions
pattern: /(^\$\{)(?!\w+\()(?:::)?\w+(?:::\w+)*/,
lookbehind: true,
alias: "variable",
inside: {
"punctuation": /::/
}
},
"delimiter": {
pattern: /^\$/,
alias: "variable"
},
rest: Prism2.languages.puppet
}
},
{
pattern: /(^|[^\\])\$(?:::)?\w+(?:::\w+)*/,
lookbehind: true,
alias: "variable",
inside: {
"punctuation": /::/
}
}
];
Prism2.languages.puppet["heredoc"][0].inside.interpolation = interpolation;
Prism2.languages.puppet["string"].inside["double-quoted"].inside.interpolation = interpolation;
})(Prism);
(function(Prism2) {
Prism2.languages.pure = {
"comment": [
{
pattern: /(^|[^\\])\/\*[\s\S]*?\*\//,
lookbehind: true
},
{
pattern: /(^|[^\\:])\/\/.*/,
lookbehind: true
},
/#!.+/
],
"inline-lang": {
pattern: /%<[\s\S]+?%>/,
greedy: true,
inside: {
"lang": {
pattern: /(^%< *)-\*-.+?-\*-/,
lookbehind: true,
alias: "comment"
},
"delimiter": {
pattern: /^%<.*|%>$/,
alias: "punctuation"
}
}
},
"string": {
pattern: /"(?:\\.|[^"\\\r\n])*"/,
greedy: true
},
"number": {
// The look-behind prevents wrong highlighting of the .. operator
pattern: /((?:\.\.)?)(?:\b(?:inf|nan)\b|\b0x[\da-f]+|(?:\b(?:0b)?\d+(?:\.\d+)?|\B\.\d+)(?:e[+-]?\d+)?L?)/i,
lookbehind: true
},
"keyword": /\b(?:NULL|ans|break|bt|case|catch|cd|clear|const|def|del|dump|else|end|exit|extern|false|force|help|if|infix[lr]?|interface|let|ls|mem|namespace|nonfix|of|otherwise|outfix|override|postfix|prefix|private|public|pwd|quit|run|save|show|stats|then|throw|trace|true|type|underride|using|when|with)\b/,
"function": /\b(?:abs|add_(?:addr|constdef|(?:fundef|interface|macdef|typedef)(?:_at)?|vardef)|all|any|applp?|arity|bigintp?|blob(?:_crc|_size|p)?|boolp?|byte_c?string(?:_pointer)?|byte_(?:matrix|pointer)|calloc|cat|catmap|ceil|char[ps]?|check_ptrtag|chr|clear_sentry|clearsym|closurep?|cmatrixp?|cols?|colcat(?:map)?|colmap|colrev|colvector(?:p|seq)?|complex(?:_float_(?:matrix|pointer)|_matrix(?:_view)?|_pointer|p)?|conj|cookedp?|cst|cstring(?:_(?:dup|list|vector))?|curry3?|cyclen?|del_(?:constdef|fundef|interface|macdef|typedef|vardef)|delete|diag(?:mat)?|dim|dmatrixp?|do|double(?:_matrix(?:_view)?|_pointer|p)?|dowith3?|drop|dropwhile|eval(?:cmd)?|exactp|filter|fix|fixity|flip|float(?:_matrix|_pointer)|floor|fold[lr]1?|frac|free|funp?|functionp?|gcd|get(?:_(?:byte|constdef|double|float|fundef|int(?:64)?|interface(?:_typedef)?|long|macdef|pointer|ptrtag|sentry|short|string|typedef|vardef))?|globsym|hash|head|id|im|imatrixp?|index|inexactp|infp|init|insert|int(?:_matrix(?:_view)?|_pointer|p)?|int64_(?:matrix|pointer)|integerp?|iteraten?|iterwhile|join|keys?|lambdap?|last(?:err(?:pos)?)?|lcd|list[2p]?|listmap|make_ptrtag|malloc|map|matcat|matrixp?|max|member|min|nanp|nargs|nmatrixp?|null|numberp?|ord|pack(?:ed)?|pointer(?:_cast|_tag|_type|p)?|pow|pred|ptrtag|put(?:_(?:byte|double|float|int(?:64)?|long|pointer|short|string))?|rationalp?|re|realp?|realloc|recordp?|redim|reduce(?:_with)?|refp?|repeatn?|reverse|rlistp?|round|rows?|rowcat(?:map)?|rowmap|rowrev|rowvector(?:p|seq)?|same|scan[lr]1?|sentry|sgn|short_(?:matrix|pointer)|slice|smatrixp?|sort|split|str|strcat|stream|stride|string(?:_(?:dup|list|vector)|p)?|subdiag(?:mat)?|submat|subseq2?|substr|succ|supdiag(?:mat)?|symbolp?|tail|take|takewhile|thunkp?|transpose|trunc|tuplep?|typep|ubyte|uint(?:64)?|ulong|uncurry3?|unref|unzip3?|update|ushort|vals?|varp?|vector(?:p|seq)?|void|zip3?|zipwith3?)\b/,
"special": {
pattern: /\b__[a-z]+__\b/i,
alias: "builtin"
},
// Any combination of operator chars can be an operator
// eslint-disable-next-line no-misleading-character-class
"operator": /(?:[!"#$%&'*+,\-.\/:<=>?@\\^`|~\u00a1-\u00bf\u00d7-\u00f7\u20d0-\u2bff]|\b_+\b)+|\b(?:and|div|mod|not|or)\b/,
// FIXME: How can we prevent | and , to be highlighted as operator when they are used alone?
"punctuation": /[(){}\[\];,|]/
};
var inlineLanguages = [
"c",
{ lang: "c++", alias: "cpp" },
"fortran"
];
var inlineLanguageRe = /%< *-\*- *<lang>\d* *-\*-[\s\S]+?%>/.source;
inlineLanguages.forEach(function(lang) {
var alias = lang;
if (typeof lang !== "string") {
alias = lang.alias;
lang = lang.lang;
}
if (Prism2.languages[alias]) {
var o = {};
o["inline-lang-" + alias] = {
pattern: RegExp(inlineLanguageRe.replace("<lang>", lang.replace(/([.+*?\/\\(){}\[\]])/g, "\\$1")), "i"),
inside: Prism2.util.clone(Prism2.languages.pure["inline-lang"].inside)
};
o["inline-lang-" + alias].inside.rest = Prism2.util.clone(Prism2.languages[alias]);
Prism2.languages.insertBefore("pure", "inline-lang", o);
}
});
if (Prism2.languages.c) {
Prism2.languages.pure["inline-lang"].inside.rest = Prism2.util.clone(Prism2.languages.c);
}
})(Prism);
Prism.languages.purebasic = Prism.languages.extend("clike", {
"comment": /;.*/,
"keyword": /\b(?:align|and|as|break|calldebugger|case|compilercase|compilerdefault|compilerelse|compilerelseif|compilerendif|compilerendselect|compilererror|compilerif|compilerselect|continue|data|datasection|debug|debuglevel|declare|declarec|declarecdll|declaredll|declaremodule|default|define|dim|disableasm|disabledebugger|disableexplicit|else|elseif|enableasm|enabledebugger|enableexplicit|end|enddatasection|enddeclaremodule|endenumeration|endif|endimport|endinterface|endmacro|endmodule|endprocedure|endselect|endstructure|endstructureunion|endwith|enumeration|extends|fakereturn|for|foreach|forever|global|gosub|goto|if|import|importc|includebinary|includefile|includepath|interface|macro|module|newlist|newmap|next|not|or|procedure|procedurec|procedurecdll|proceduredll|procedurereturn|protected|prototype|prototypec|read|redim|repeat|restore|return|runtime|select|shared|static|step|structure|structureunion|swap|threaded|to|until|wend|while|with|xincludefile|xor)\b/i,
"function": /\b\w+(?:\.\w+)?\s*(?=\()/,
"number": /(?:\$[\da-f]+|\b-?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)\b/i,
"operator": /(?:@\*?|\?|\*)\w+\$?|-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|?\||[~^%?*/@]/
});
Prism.languages.insertBefore("purebasic", "keyword", {
"tag": /#\w+\$?/,
"asm": {
pattern: /(^[\t ]*)!.*/m,
lookbehind: true,
alias: "tag",
inside: {
"comment": /;.*/,
"string": {
pattern: /(["'`])(?:\\.|(?!\1)[^\\\r\n])*\1/,
greedy: true
},
// Anonymous label references, i.e.: jmp @b
"label-reference-anonymous": {
pattern: /(!\s*j[a-z]+\s+)@[fb]/i,
lookbehind: true,
alias: "fasm-label"
},
// Named label reference, i.e.: jne label1
"label-reference-addressed": {
pattern: /(!\s*j[a-z]+\s+)[A-Z._?$@][\w.?$@~#]*/i,
lookbehind: true,
alias: "fasm-label"
},
"keyword": [
/\b(?:extern|global)\b[^;\r\n]*/i,
/\b(?:CPU|DEFAULT|FLOAT)\b.*/
],
"function": {
pattern: /^([\t ]*!\s*)[\da-z]+(?=\s|$)/im,
lookbehind: true
},
"function-inline": {
pattern: /(:\s*)[\da-z]+(?=\s)/i,
lookbehind: true,
alias: "function"
},
"label": {
pattern: /^([\t ]*!\s*)[A-Za-z._?$@][\w.?$@~#]*(?=:)/m,
lookbehind: true,
alias: "fasm-label"
},
"register": /\b(?:st\d|[xyz]mm\d\d?|[cdt]r\d|r\d\d?[bwd]?|[er]?[abcd]x|[abcd][hl]|[er]?(?:bp|di|si|sp)|[cdefgs]s|mm\d+)\b/i,
"number": /(?:\b|-|(?=\$))(?:0[hx](?:[\da-f]*\.)?[\da-f]+(?:p[+-]?\d+)?|\d[\da-f]+[hx]|\$\d[\da-f]*|0[oq][0-7]+|[0-7]+[oq]|0[by][01]+|[01]+[by]|0[dt]\d+|(?:\d+(?:\.\d+)?|\.\d+)(?:\.?e[+-]?\d+)?[dt]?)\b/i,
"operator": /[\[\]*+\-/%<>=&|$!,.:]/
}
}
});
delete Prism.languages.purebasic["class-name"];
delete Prism.languages.purebasic["boolean"];
Prism.languages.pbfasm = Prism.languages["purebasic"];
Prism.languages.purescript = Prism.languages.extend("haskell", {
"keyword": /\b(?:ado|case|class|data|derive|do|else|forall|if|in|infixl|infixr|instance|let|module|newtype|of|primitive|then|type|where)\b|∀/,
"import-statement": {
// The imported or hidden names are not included in this import
// statement. This is because we want to highlight those exactly like
// we do for the names in the program.
pattern: /(^[\t ]*)import\s+[A-Z][\w']*(?:\.[A-Z][\w']*)*(?:\s+as\s+[A-Z][\w']*(?:\.[A-Z][\w']*)*)?(?:\s+hiding\b)?/m,
lookbehind: true,
inside: {
"keyword": /\b(?:as|hiding|import)\b/,
"punctuation": /\./
}
},
// These are builtin functions only. Constructors are highlighted later as a constant.
"builtin": /\b(?:absurd|add|ap|append|apply|between|bind|bottom|clamp|compare|comparing|compose|conj|const|degree|discard|disj|div|eq|flap|flip|gcd|identity|ifM|join|lcm|liftA1|liftM1|map|max|mempty|min|mod|mul|negate|not|notEq|one|otherwise|recip|show|sub|top|unit|unless|unlessM|void|when|whenM|zero)\b/,
"operator": [
// Infix operators
Prism.languages.haskell.operator[0],
// ASCII operators
Prism.languages.haskell.operator[2],
// All UTF16 Unicode operator symbols
// This regex is equivalent to /(?=[\x80-\uFFFF])[\p{gc=Math_Symbol}\p{gc=Currency_Symbol}\p{Modifier_Symbol}\p{Other_Symbol}]/u
// See https://github.com/PrismJS/prism/issues/3006 for more details.
/[\xa2-\xa6\xa8\xa9\xac\xae-\xb1\xb4\xb8\xd7\xf7\u02c2-\u02c5\u02d2-\u02df\u02e5-\u02eb\u02ed\u02ef-\u02ff\u0375\u0384\u0385\u03f6\u0482\u058d-\u058f\u0606-\u0608\u060b\u060e\u060f\u06de\u06e9\u06fd\u06fe\u07f6\u07fe\u07ff\u09f2\u09f3\u09fa\u09fb\u0af1\u0b70\u0bf3-\u0bfa\u0c7f\u0d4f\u0d79\u0e3f\u0f01-\u0f03\u0f13\u0f15-\u0f17\u0f1a-\u0f1f\u0f34\u0f36\u0f38\u0fbe-\u0fc5\u0fc7-\u0fcc\u0fce\u0fcf\u0fd5-\u0fd8\u109e\u109f\u1390-\u1399\u166d\u17db\u1940\u19de-\u19ff\u1b61-\u1b6a\u1b74-\u1b7c\u1fbd\u1fbf-\u1fc1\u1fcd-\u1fcf\u1fdd-\u1fdf\u1fed-\u1fef\u1ffd\u1ffe\u2044\u2052\u207a-\u207c\u208a-\u208c\u20a0-\u20bf\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211e-\u2123\u2125\u2127\u2129\u212e\u213a\u213b\u2140-\u2144\u214a-\u214d\u214f\u218a\u218b\u2190-\u2307\u230c-\u2328\u232b-\u2426\u2440-\u244a\u249c-\u24e9\u2500-\u2767\u2794-\u27c4\u27c7-\u27e5\u27f0-\u2982\u2999-\u29d7\u29dc-\u29fb\u29fe-\u2b73\u2b76-\u2b95\u2b97-\u2bff\u2ce5-\u2cea\u2e50\u2e51\u2e80-\u2e99\u2e9b-\u2ef3\u2f00-\u2fd5\u2ff0-\u2ffb\u3004\u3012\u3013\u3020\u3036\u3037\u303e\u303f\u309b\u309c\u3190\u3191\u3196-\u319f\u31c0-\u31e3\u3200-\u321e\u322a-\u3247\u3250\u3260-\u327f\u328a-\u32b0\u32c0-\u33ff\u4dc0-\u4dff\ua490-\ua4c6\ua700-\ua716\ua720\ua721\ua789\ua78a\ua828-\ua82b\ua836-\ua839\uaa77-\uaa79\uab5b\uab6a\uab6b\ufb29\ufbb2-\ufbc1\ufdfc\ufdfd\ufe62\ufe64-\ufe66\ufe69\uff04\uff0b\uff1c-\uff1e\uff3e\uff40\uff5c\uff5e\uffe0-\uffe6\uffe8-\uffee\ufffc\ufffd]/
]
});
Prism.languages.purs = Prism.languages.purescript;
Prism.languages.python = {
"comment": {
pattern: /(^|[^\\])#.*/,
lookbehind: true,
greedy: true
},
"string-interpolation": {
pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
greedy: true,
inside: {
"interpolation": {
// "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
lookbehind: true,
inside: {
"format-spec": {
pattern: /(:)[^:(){}]+(?=\}$)/,
lookbehind: true
},
"conversion-option": {
pattern: //,
alias: "punctuation"
},
rest: null
}
},
"string": /[\s\S]+/
}
},
"triple-quoted-string": {
pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
greedy: true,
alias: "string"
},
"string": {
pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
greedy: true
},
"function": {
pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
lookbehind: true
},
"class-name": {
pattern: /(\bclass\s+)\w+/i,
lookbehind: true
},
"decorator": {
pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
lookbehind: true,
alias: ["annotation", "punctuation"],
inside: {
"punctuation": /\./
}
},
"keyword": /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
"builtin": /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
"boolean": /\b(?:False|None|True)\b/,
"number": /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
"operator": /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
"punctuation": /[{}[\];(),.:]/
};
Prism.languages.python["string-interpolation"].inside["interpolation"].inside.rest = Prism.languages.python;
Prism.languages.py = Prism.languages.python;
(function(Prism2) {
function replace(pattern, replacements) {
return pattern.replace(/<<(\d+)>>/g, function(m, index) {
return "(?:" + replacements[+index] + ")";
});
}
function re(pattern, replacements, flags) {
return RegExp(replace(pattern, replacements), flags || "");
}
function nested(pattern, depthLog2) {
for (var i = 0; i < depthLog2; i++) {
pattern = pattern.replace(/<<self>>/g, function() {
return "(?:" + pattern + ")";
});
}
return pattern.replace(/<<self>>/g, "[^\\s\\S]");
}
var keywordKinds = {
// keywords which represent a return or variable type
type: "Adj BigInt Bool Ctl Double false Int One Pauli PauliI PauliX PauliY PauliZ Qubit Range Result String true Unit Zero",
// all other keywords
other: "Adjoint adjoint apply as auto body borrow borrowing Controlled controlled distribute elif else fail fixup for function if in internal intrinsic invert is let mutable namespace new newtype open operation repeat return self set until use using while within"
};
function keywordsToPattern(words) {
return "\\b(?:" + words.trim().replace(/ /g, "|") + ")\\b";
}
var keywords = RegExp(keywordsToPattern(keywordKinds.type + " " + keywordKinds.other));
var identifier = /\b[A-Za-z_]\w*\b/.source;
var qualifiedName = replace(/<<0>>(?:\s*\.\s*<<0>>)*/.source, [identifier]);
var typeInside = {
"keyword": keywords,
"punctuation": /[<>()?,.:[\]]/
};
var regularString = /"(?:\\.|[^\\"])*"/.source;
Prism2.languages.qsharp = Prism2.languages.extend("clike", {
"comment": /\/\/.*/,
"string": [
{
pattern: re(/(^|[^$\\])<<0>>/.source, [regularString]),
lookbehind: true,
greedy: true
}
],
"class-name": [
{
// open Microsoft.Quantum.Canon;
// open Microsoft.Quantum.Canon as CN;
pattern: re(/(\b(?:as|open)\s+)<<0>>(?=\s*(?:;|as\b))/.source, [qualifiedName]),
lookbehind: true,
inside: typeInside
},
{
// namespace Quantum.App1;
pattern: re(/(\bnamespace\s+)<<0>>(?=\s*\{)/.source, [qualifiedName]),
lookbehind: true,
inside: typeInside
}
],
"keyword": keywords,
"number": /(?:\b0(?:x[\da-f]+|b[01]+|o[0-7]+)|(?:\B\.\d+|\b\d+(?:\.\d*)?)(?:e[-+]?\d+)?)l?\b/i,
"operator": /\band=|\bor=|\band\b|\bnot\b|\bor\b|<[-=]|[-=]>|>>>=?|<<<=?|\^\^\^=?|\|\|\|=?|&&&=?|w\/=?|~~~|[*\/+\-^=!%]=?/,
"punctuation": /::|[{}[\];(),.:]/
});
Prism2.languages.insertBefore("qsharp", "number", {
"range": {
pattern: /\.\./,
alias: "operator"
}
});
var interpolationExpr = nested(replace(/\{(?:[^"{}]|<<0>>|<<self>>)*\}/.source, [regularString]), 2);
Prism2.languages.insertBefore("qsharp", "string", {
"interpolation-string": {
pattern: re(/\$"(?:\\.|<<0>>|[^\\"{])*"/.source, [interpolationExpr]),
greedy: true,
inside: {
"interpolation": {
pattern: re(/((?:^|[^\\])(?:\\\\)*)<<0>>/.source, [interpolationExpr]),
lookbehind: true,
inside: {
"punctuation": /^\{|\}$/,
"expression": {
pattern: /[\s\S]+/,
alias: "language-qsharp",
inside: Prism2.languages.qsharp
}
}
},
"string": /[\s\S]+/
}
}
});
})(Prism);
Prism.languages.qs = Prism.languages.qsharp;
Prism.languages.q = {
"string": /"(?:\\.|[^"\\\r\n])*"/,
"comment": [
// From http://code.kx.com/wiki/Reference/Slash:
// When / is following a space (or a right parenthesis, bracket, or brace), it is ignored with the rest of the line.
{
pattern: /([\t )\]}])\/.*/,
lookbehind: true,
greedy: true
},
// From http://code.kx.com/wiki/Reference/Slash:
// A line which has / as its first character and contains at least one other non-whitespace character is a whole-line comment and is ignored entirely.
// A / on a line by itself begins a multiline comment which is terminated by the next \ on a line by itself.
// If a / is not matched by a \, the multiline comment is unterminated and continues to end of file.
// The / and \ must be the first char on the line, but may be followed by any amount of whitespace.
{
pattern: /(^|\r?\n|\r)\/[\t ]*(?:(?:\r?\n|\r)(?:.*(?:\r?\n|\r(?!\n)))*?(?:\\(?=[\t ]*(?:\r?\n|\r))|$)|\S.*)/,
lookbehind: true,
greedy: true
},
// From http://code.kx.com/wiki/Reference/Slash:
// A \ on a line by itself with no preceding matching / will comment to end of file.
{
pattern: /^\\[\t ]*(?:\r?\n|\r)[\s\S]+/m,
greedy: true
},
{
pattern: /^#!.+/m,
greedy: true
}
],
"symbol": /`(?::\S+|[\w.]*)/,
"datetime": {
pattern: /0N[mdzuvt]|0W[dtz]|\d{4}\.\d\d(?:m|\.\d\d(?:T(?:\d\d(?::\d\d(?::\d\d(?:[.:]\d\d\d)?)?)?)?)?[dz]?)|\d\d:\d\d(?::\d\d(?:[.:]\d\d\d)?)?[uvt]?/,
alias: "number"
},
// The negative look-ahead prevents bad highlighting
// of verbs 0: and 1:
"number": /\b(?![01]:)(?:0N[hje]?|0W[hj]?|0[wn]|0x[\da-fA-F]+|\d+(?:\.\d*)?(?:e[+-]?\d+)?[hjfeb]?)/,
"keyword": /\\\w+\b|\b(?:abs|acos|aj0?|all|and|any|asc|asin|asof|atan|attr|avgs?|binr?|by|ceiling|cols|cor|cos|count|cov|cross|csv|cut|delete|deltas|desc|dev|differ|distinct|div|do|dsave|ej|enlist|eval|except|exec|exit|exp|fby|fills|first|fkeys|flip|floor|from|get|getenv|group|gtime|hclose|hcount|hdel|hopen|hsym|iasc|identity|idesc|if|ij|in|insert|inter|inv|keys?|last|like|list|ljf?|load|log|lower|lsq|ltime|ltrim|mavg|maxs?|mcount|md5|mdev|med|meta|mins?|mmax|mmin|mmu|mod|msum|neg|next|not|null|or|over|parse|peach|pj|plist|prds?|prev|prior|rand|rank|ratios|raze|read0|read1|reciprocal|reval|reverse|rload|rotate|rsave|rtrim|save|scan|scov|sdev|select|set|setenv|show|signum|sin|sqrt|ssr?|string|sublist|sums?|sv|svar|system|tables|tan|til|trim|txf|type|uj|ungroup|union|update|upper|upsert|value|var|views?|vs|wavg|where|while|within|wj1?|wsum|ww|xasc|xbar|xcols?|xdesc|xexp|xgroup|xkey|xlog|xprev|xrank)\b/,
"adverb": {
pattern: /['\/\\]:?|\beach\b/,
alias: "function"
},
"verb": {
pattern: /(?:\B\.\B|\b[01]:|<[=>]?|>=?|[:+\-*%,!?~=|$&#@^]):?|\b_\b:?/,
alias: "operator"
},
"punctuation": /[(){}\[\];.]/
};
(function(Prism2) {
var jsString = /"(?:\\.|[^\\"\r\n])*"|'(?:\\.|[^\\'\r\n])*'/.source;
var jsComment = /\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))*\*\//.source;
var jsExpr = /(?:[^\\()[\]{}"'/]|<string>|\/(?![*/])|<comment>|\(<expr>*\)|\[<expr>*\]|\{<expr>*\}|\\[\s\S])/.source.replace(/<string>/g, function() {
return jsString;
}).replace(/<comment>/g, function() {
return jsComment;
});
for (var i = 0; i < 2; i++) {
jsExpr = jsExpr.replace(/<expr>/g, function() {
return jsExpr;
});
}
jsExpr = jsExpr.replace(/<expr>/g, "[^\\s\\S]");
Prism2.languages.qml = {
"comment": {
pattern: /\/\/.*|\/\*[\s\S]*?\*\//,
greedy: true
},
"javascript-function": {
pattern: RegExp(/((?:^|;)[ \t]*)function\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*\(<js>*\)\s*\{<js>*\}/.source.replace(/<js>/g, function() {
return jsExpr;
}), "m"),
lookbehind: true,
greedy: true,
alias: "language-javascript",
inside: Prism2.languages.javascript
},
"class-name": {
pattern: /((?:^|[:;])[ \t]*)(?!\d)\w+(?=[ \t]*\{|[ \t]+on\b)/m,
lookbehind: true
},
"property": [
{
pattern: /((?:^|[;{])[ \t]*)(?!\d)\w+(?:\.\w+)*(?=[ \t]*:)/m,
lookbehind: true
},
{
pattern: /((?:^|[;{])[ \t]*)property[ \t]+(?!\d)\w+(?:\.\w+)*[ \t]+(?!\d)\w+(?:\.\w+)*(?=[ \t]*:)/m,
lookbehind: true,
inside: {
"keyword": /^property/,
"property": /\w+(?:\.\w+)*/
}
}
],
"javascript-expression": {
pattern: RegExp(/(:[ \t]*)(?![\s;}[])(?:(?!$|[;}])<js>)+/.source.replace(/<js>/g, function() {
return jsExpr;
}), "m"),
lookbehind: true,
greedy: true,
alias: "language-javascript",
inside: Prism2.languages.javascript
},
"string": {
pattern: /"(?:\\.|[^\\"\r\n])*"/,
greedy: true
},
"keyword": /\b(?:as|import|on)\b/,
"punctuation": /[{}[\]:;,]/
};
})(Prism);
Prism.languages.qore = Prism.languages.extend("clike", {
"comment": {
pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:\/\/|#).*)/,
lookbehind: true
},
// Overridden to allow unescaped multi-line strings
"string": {
pattern: /("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/,
greedy: true
},
"keyword": /\b(?:abstract|any|assert|binary|bool|boolean|break|byte|case|catch|char|class|code|const|continue|data|default|do|double|else|enum|extends|final|finally|float|for|goto|hash|if|implements|import|inherits|instanceof|int|interface|long|my|native|new|nothing|null|object|our|own|private|reference|rethrow|return|short|soft(?:bool|date|float|int|list|number|string)|static|strictfp|string|sub|super|switch|synchronized|this|throw|throws|transient|try|void|volatile|while)\b/,
"boolean": /\b(?:false|true)\b/i,
"function": /\$?\b(?!\d)\w+(?=\()/,
"number": /\b(?:0b[01]+|0x(?:[\da-f]*\.)?[\da-fp\-]+|(?:\d+(?:\.\d+)?|\.\d+)(?:e\d+)?[df]|(?:\d+(?:\.\d+)?|\.\d+))\b/i,
"operator": {
pattern: /(^|[^.])(?:\+[+=]?|-[-=]?|[!=](?:==?|~)?|>>?=?|<(?:=>?|<=?)?|&[&=]?|\|[|=]?|[*\/%^]=?|[~?])/,
lookbehind: true
},
"variable": /\$(?!\d)\w+\b/
});
Prism.languages.r = {
"comment": /#.*/,
"string": {
pattern: /(['"])(?:\\.|(?!\1)[^\\\r\n])*\1/,
greedy: true
},
"percent-operator": {
// Includes user-defined operators
// and %%, %*%, %/%, %in%, %o%, %x%
pattern: /%[^%\s]*%/,
alias: "operator"
},
"boolean": /\b(?:FALSE|TRUE)\b/,
"ellipsis": /\.\.(?:\.|\d+)/,
"number": [
/\b(?:Inf|NaN)\b/,
/(?:\b0x[\dA-Fa-f]+(?:\.\d*)?|\b\d+(?:\.\d*)?|\B\.\d+)(?:[EePp][+-]?\d+)?[iL]?/
],
"keyword": /\b(?:NA|NA_character_|NA_complex_|NA_integer_|NA_real_|NULL|break|else|for|function|if|in|next|repeat|while)\b/,
"operator": /->?>?|<(?:=|<?-)?|[>=!]=?|::?|&&?|\|\|?|[+*\/^$@~]/,
"punctuation": /[(){}\[\],;]/
};
Prism.languages.racket = Prism.languages.extend("scheme", {
"lambda-parameter": {
// the racket lambda syntax is a lot more complex, so we won't even attempt to capture it.
// this will just prevent false positives of the `function` pattern
pattern: /([(\[]lambda\s+[(\[])[^()\[\]'\s]+/,
lookbehind: true
}
});
Prism.languages.insertBefore("racket", "string", {
"lang": {
pattern: /^#lang.+/m,
greedy: true,
alias: "keyword"
}
});
Prism.languages.rkt = Prism.languages.racket;
(function(Prism2) {
var commentLike = /\/(?![/*])|\/\/.*[\r\n]|\/\*[^*]*(?:\*(?!\/)[^*]*)*\*\//.source;
var stringLike = /@(?!")|"(?:[^\r\n\\"]|\\.)*"|@"(?:[^\\"]|""|\\[\s\S])*"(?!")/.source + "|" + /'(?:(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'|(?=[^\\](?!')))/.source;
function nested(pattern, depthLog2) {
for (var i = 0; i < depthLog2; i++) {
pattern = pattern.replace(/<self>/g, function() {
return "(?:" + pattern + ")";
});
}
return pattern.replace(/<self>/g, "[^\\s\\S]").replace(/<str>/g, "(?:" + stringLike + ")").replace(/<comment>/g, "(?:" + commentLike + ")");
}
var round2 = nested(/\((?:[^()'"@/]|<str>|<comment>|<self>)*\)/.source, 2);
var square = nested(/\[(?:[^\[\]'"@/]|<str>|<comment>|<self>)*\]/.source, 1);
var curly = nested(/\{(?:[^{}'"@/]|<str>|<comment>|<self>)*\}/.source, 2);
var angle = nested(/<(?:[^<>'"@/]|<comment>|<self>)*>/.source, 1);
var inlineCs = /@/.source + /(?:await\b\s*)?/.source + "(?:" + /(?!await\b)\w+\b/.source + "|" + round2 + ")(?:" + /[?!]?\.\w+\b/.source + "|(?:" + angle + ")?" + round2 + "|" + square + ")*" + /(?![?!\.(\[]|<(?!\/))/.source;
var tagAttrInlineCs = /@(?![\w()])/.source + "|" + inlineCs;
var tagAttrValue = "(?:" + /"[^"@]*"|'[^'@]*'|[^\s'"@>=]+(?=[\s>])/.source + `|["'][^"'@]*(?:(?:` + tagAttrInlineCs + `)[^"'@]*)+["'])`;
var tagAttrs = /(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*<tagAttrValue>|(?=[\s/>])))+)?/.source.replace(/<tagAttrValue>/, tagAttrValue);
var tagContent = /(?!\d)[^\s>\/=$<%]+/.source + tagAttrs + /\s*\/?>/.source;
var tagRegion = /\B@?/.source + "(?:" + /<([a-zA-Z][\w:]*)/.source + tagAttrs + /\s*>/.source + "(?:" + (/[^<]/.source + "|" + // all tags that are not the start tag
// eslint-disable-next-line regexp/strict
/<\/?(?!\1\b)/.source + tagContent + "|" + // nested start tag
nested(
// eslint-disable-next-line regexp/strict
/<\1/.source + tagAttrs + /\s*>/.source + "(?:" + (/[^<]/.source + "|" + // all tags that are not the start tag
// eslint-disable-next-line regexp/strict
/<\/?(?!\1\b)/.source + tagContent + "|<self>") + ")*" + // eslint-disable-next-line regexp/strict
/<\/\1\s*>/.source,
2
)) + ")*" + // eslint-disable-next-line regexp/strict
/<\/\1\s*>/.source + "|" + /</.source + tagContent + ")";
Prism2.languages.cshtml = Prism2.languages.extend("markup", {});
var csharpWithHtml = Prism2.languages.insertBefore("csharp", "string", {
"html": {
pattern: RegExp(tagRegion),
greedy: true,
inside: Prism2.languages.cshtml
}
}, { csharp: Prism2.languages.extend("csharp", {}) });
var cs = {
pattern: /\S[\s\S]*/,
alias: "language-csharp",
inside: csharpWithHtml
};
var inlineValue = {
pattern: RegExp(/(^|[^@])/.source + inlineCs),
lookbehind: true,
greedy: true,
alias: "variable",
inside: {
"keyword": /^@/,
"csharp": cs
}
};
Prism2.languages.cshtml.tag.pattern = RegExp(/<\/?/.source + tagContent);
Prism2.languages.cshtml.tag.inside["attr-value"].pattern = RegExp(/=\s*/.source + tagAttrValue);
Prism2.languages.insertBefore("inside", "punctuation", { "value": inlineValue }, Prism2.languages.cshtml.tag.inside["attr-value"]);
Prism2.languages.insertBefore("cshtml", "prolog", {
"razor-comment": {
pattern: /@\*[\s\S]*?\*@/,
greedy: true,
alias: "comment"
},
"block": {
pattern: RegExp(
/(^|[^@])@/.source + "(?:" + [
// @{ ... }
curly,
// @code{ ... }
/(?:code|functions)\s*/.source + curly,
// @for (...) { ... }
/(?:for|foreach|lock|switch|using|while)\s*/.source + round2 + /\s*/.source + curly,
// @do { ... } while (...);
/do\s*/.source + curly + /\s*while\s*/.source + round2 + /(?:\s*;)?/.source,
// @try { ... } catch (...) { ... } finally { ... }
/try\s*/.source + curly + /\s*catch\s*/.source + round2 + /\s*/.source + curly + /\s*finally\s*/.source + curly,
// @if (...) {...} else if (...) {...} else {...}
/if\s*/.source + round2 + /\s*/.source + curly + "(?:" + /\s*else/.source + "(?:" + /\s+if\s*/.source + round2 + ")?" + /\s*/.source + curly + ")*",
// @helper Ident(params) { ... }
/helper\s+\w+\s*/.source + round2 + /\s*/.source + curly
].join("|") + ")"
),
lookbehind: true,
greedy: true,
inside: {
"keyword": /^@\w*/,
"csharp": cs
}
},
"directive": {
pattern: /^([ \t]*)@(?:addTagHelper|attribute|implements|inherits|inject|layout|model|namespace|page|preservewhitespace|removeTagHelper|section|tagHelperPrefix|using)(?=\s).*/m,
lookbehind: true,
greedy: true,
inside: {
"keyword": /^@\w+/,
"csharp": cs
}
},
"value": inlineValue,
"delegate-operator": {
pattern: /(^|[^@])@(?=<)/,
lookbehind: true,
alias: "operator"
}
});
Prism2.languages.razor = Prism2.languages.cshtml;
})(Prism);
(function(Prism2) {
var javascript = Prism2.util.clone(Prism2.languages.javascript);
var space = /(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source;
var braces = /(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source;
var spread = /(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;
function re(source, flags) {
source = source.replace(/<S>/g, function() {
return space;
}).replace(/<BRACES>/g, function() {
return braces;
}).replace(/<SPREAD>/g, function() {
return spread;
});
return RegExp(source, flags);
}
spread = re(spread).source;
Prism2.languages.jsx = Prism2.languages.extend("markup", javascript);
Prism2.languages.jsx.tag.pattern = re(
/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source
);
Prism2.languages.jsx.tag.inside["tag"].pattern = /^<\/?[^\s>\/]*/;
Prism2.languages.jsx.tag.inside["attr-value"].pattern = /=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/;
Prism2.languages.jsx.tag.inside["tag"].inside["class-name"] = /^[A-Z]\w*(?:\.[A-Z]\w*)*$/;
Prism2.languages.jsx.tag.inside["comment"] = javascript["comment"];
Prism2.languages.insertBefore("inside", "attr-name", {
"spread": {
pattern: re(/<SPREAD>/.source),
inside: Prism2.languages.jsx
}
}, Prism2.languages.jsx.tag);
Prism2.languages.insertBefore("inside", "special-attr", {
"script": {
// Allow for two levels of nesting
pattern: re(/=<BRACES>/.source),
alias: "language-javascript",
inside: {
"script-punctuation": {
pattern: /^=(?=\{)/,
alias: "punctuation"
},
rest: Prism2.languages.jsx
}
}
}, Prism2.languages.jsx.tag);
var stringifyToken = function(token) {
if (!token) {
return "";
}
if (typeof token === "string") {
return token;
}
if (typeof token.content === "string") {
return token.content;
}
return token.content.map(stringifyToken).join("");
};
var walkTokens = function(tokens) {
var openedTags = [];
for (var i = 0; i < tokens.length; i++) {
var token = tokens[i];
var notTagNorBrace = false;
if (typeof token !== "string") {
if (token.type === "tag" && token.content[0] && token.content[0].type === "tag") {
if (token.content[0].content[0].content === "</") {
if (openedTags.length > 0 && openedTags[openedTags.length - 1].tagName === stringifyToken(token.content[0].content[1])) {
openedTags.pop();
}
} else {
if (token.content[token.content.length - 1].content === "/>") {
} else {
openedTags.push({
tagName: stringifyToken(token.content[0].content[1]),
openedBraces: 0
});
}
}
} else if (openedTags.length > 0 && token.type === "punctuation" && token.content === "{") {
openedTags[openedTags.length - 1].openedBraces++;
} else if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces > 0 && token.type === "punctuation" && token.content === "}") {
openedTags[openedTags.length - 1].openedBraces--;
} else {
notTagNorBrace = true;
}
}
if (notTagNorBrace || typeof token === "string") {
if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces === 0) {
var plainText = stringifyToken(token);
if (i < tokens.length - 1 && (typeof tokens[i + 1] === "string" || tokens[i + 1].type === "plain-text")) {
plainText += stringifyToken(tokens[i + 1]);
tokens.splice(i + 1, 1);
}
if (i > 0 && (typeof tokens[i - 1] === "string" || tokens[i - 1].type === "plain-text")) {
plainText = stringifyToken(tokens[i - 1]) + plainText;
tokens.splice(i - 1, 1);
i--;
}
tokens[i] = new Prism2.Token("plain-text", plainText, null, plainText);
}
}
if (token.content && typeof token.content !== "string") {
walkTokens(token.content);
}
}
};
Prism2.hooks.add("after-tokenize", function(env) {
if (env.language !== "jsx" && env.language !== "tsx") {
return;
}
walkTokens(env.tokens);
});
})(Prism);
(function(Prism2) {
var typescript = Prism2.util.clone(Prism2.languages.typescript);
Prism2.languages.tsx = Prism2.languages.extend("jsx", typescript);
delete Prism2.languages.tsx["parameter"];
delete Prism2.languages.tsx["literal-property"];
var tag = Prism2.languages.tsx.tag;
tag.pattern = RegExp(/(^|[^\w$]|(?=<\/))/.source + "(?:" + tag.pattern.source + ")", tag.pattern.flags);
tag.lookbehind = true;
})(Prism);
Prism.languages.reason = Prism.languages.extend("clike", {
"string": {
pattern: /"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,
greedy: true
},
// 'class-name' must be matched *after* 'constructor' defined below
"class-name": /\b[A-Z]\w*/,
"keyword": /\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,
"operator": /\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/
});
Prism.languages.insertBefore("reason", "class-name", {
"char": {
pattern: /'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,
greedy: true
},
// Negative look-ahead prevents from matching things like String.capitalize
"constructor": /\b[A-Z]\w*\b(?!\s*\.)/,
"label": {
pattern: /\b[a-z]\w*(?=::)/,
alias: "symbol"
}
});
delete Prism.languages.reason.function;
(function(Prism2) {
var specialEscape = {
pattern: /\\[\\(){}[\]^$+*?|.]/,
alias: "escape"
};
var escape = /\\(?:x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]+\}|0[0-7]{0,2}|[123][0-7]{2}|c[a-zA-Z]|.)/;
var charSet = {
pattern: /\.|\\[wsd]|\\p\{[^{}]+\}/i,
alias: "class-name"
};
var charSetWithoutDot = {
pattern: /\\[wsd]|\\p\{[^{}]+\}/i,
alias: "class-name"
};
var rangeChar = "(?:[^\\\\-]|" + escape.source + ")";
var range2 = RegExp(rangeChar + "-" + rangeChar);
var groupName = {
pattern: /(<|')[^<>']+(?=[>']$)/,
lookbehind: true,
alias: "variable"
};
Prism2.languages.regex = {
"char-class": {
pattern: /((?:^|[^\\])(?:\\\\)*)\[(?:[^\\\]]|\\[\s\S])*\]/,
lookbehind: true,
inside: {
"char-class-negation": {
pattern: /(^\[)\^/,
lookbehind: true,
alias: "operator"
},
"char-class-punctuation": {
pattern: /^\[|\]$/,
alias: "punctuation"
},
"range": {
pattern: range2,
inside: {
"escape": escape,
"range-punctuation": {
pattern: /-/,
alias: "operator"
}
}
},
"special-escape": specialEscape,
"char-set": charSetWithoutDot,
"escape": escape
}
},
"special-escape": specialEscape,
"char-set": charSet,
"backreference": [
{
// a backreference which is not an octal escape
pattern: /\\(?![123][0-7]{2})[1-9]/,
alias: "keyword"
},
{
pattern: /\\k<[^<>']+>/,
alias: "keyword",
inside: {
"group-name": groupName
}
}
],
"anchor": {
pattern: /[$^]|\\[ABbGZz]/,
alias: "function"
},
"escape": escape,
"group": [
{
// https://docs.oracle.com/javase/10/docs/api/java/util/regex/Pattern.html
// https://docs.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference?view=netframework-4.7.2#grouping-constructs
// (), (?<name>), (?'name'), (?>), (?:), (?=), (?!), (?<=), (?<!), (?is-m), (?i-m:)
pattern: /\((?:\?(?:<[^<>']+>|'[^<>']+'|[>:]|<?[=!]|[idmnsuxU]+(?:-[idmnsuxU]+)?:?))?/,
alias: "punctuation",
inside: {
"group-name": groupName
}
},
{
pattern: /\)/,
alias: "punctuation"
}
],
"quantifier": {
pattern: /(?:[+*?]|\{\d+(?:,\d*)?\})[?+]?/,
alias: "number"
},
"alternation": {
pattern: /\|/,
alias: "keyword"
}
};
})(Prism);
Prism.languages.rego = {
"comment": /#.*/,
"property": {
pattern: /(^|[^\\.])(?:"(?:\\.|[^\\"\r\n])*"|`[^`]*`|\b[a-z_]\w*\b)(?=\s*:(?!=))/i,
lookbehind: true,
greedy: true
},
"string": {
pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"|`[^`]*`/,
lookbehind: true,
greedy: true
},
"keyword": /\b(?:as|default|else|import|not|null|package|set(?=\s*\()|some|with)\b/,
"boolean": /\b(?:false|true)\b/,
"function": {
pattern: /\b[a-z_]\w*\b(?:\s*\.\s*\b[a-z_]\w*\b)*(?=\s*\()/i,
inside: {
"namespace": /\b\w+\b(?=\s*\.)/,
"punctuation": /\./
}
},
"number": /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
"operator": /[-+*/%|&]|[<>:=]=?|!=|\b_\b/,
"punctuation": /[,;.\[\]{}()]/
};
Prism.languages.renpy = {
"comment": {
pattern: /(^|[^\\])#.+/,
lookbehind: true
},
"string": {
pattern: /("""|''')[\s\S]+?\1|("|')(?:\\.|(?!\2)[^\\])*\2|(?:^#?(?:(?:[0-9a-fA-F]){3}|[0-9a-fA-F]{6})$)/m,
greedy: true
},
"function": /\b[a-z_]\w*(?=\()/i,
"property": /\b(?:Update|UpdateVersion|action|activate_sound|adv_nvl_transition|after_load_transition|align|alpha|alt|anchor|antialias|area|auto|background|bar_invert|bar_resizing|bar_vertical|black_color|bold|bottom_bar|bottom_gutter|bottom_margin|bottom_padding|box_reverse|box_wrap|can_update|caret|child|color|crop|default_afm_enable|default_afm_time|default_fullscreen|default_text_cps|developer|directory_name|drag_handle|drag_joined|drag_name|drag_raise|draggable|dragged|drop_shadow|drop_shadow_color|droppable|dropped|easein|easeout|edgescroll|end_game_transition|end_splash_transition|enter_replay_transition|enter_sound|enter_transition|enter_yesno_transition|executable_name|exit_replay_transition|exit_sound|exit_transition|exit_yesno_transition|fadein|fadeout|first_indent|first_spacing|fit_first|focus|focus_mask|font|foreground|game_main_transition|get_installed_packages|google_play_key|google_play_salt|ground|has_music|has_sound|has_voice|height|help|hinting|hover|hover_background|hover_color|hover_sound|hovered|hyperlink_functions|idle|idle_color|image_style|include_update|insensitive|insensitive_background|insensitive_color|inside|intra_transition|italic|justify|kerning|keyboard_focus|language|layer_clipping|layers|layout|left_bar|left_gutter|left_margin|left_padding|length|line_leading|line_overlap_split|line_spacing|linear|main_game_transition|main_menu_music|maximum|min_width|minimum|minwidth|modal|mouse|mousewheel|name|narrator_menu|newline_indent|nvl_adv_transition|offset|order_reverse|outlines|overlay_functions|pos|position|prefix|radius|range|rest_indent|right_bar|right_gutter|right_margin|right_padding|rotate|rotate_pad|ruby_style|sample_sound|save_directory|say_attribute_transition|screen_height|screen_width|scrollbars|selected_hover|selected_hover_color|selected_idle|selected_idle_color|selected_insensitive|show_side_image|show_two_window|side_spacing|side_xpos|side_ypos|size|size_group|slow_cps|slow_cps_multiplier|spacing|strikethrough|subpixel|text_align|text_style|text_xpos|text_y_fudge|text_ypos|thumb|thumb_offset|thumb_shadow|thumbnail_height|thumbnail_width|time|top_bar|top_gutter|top_margin|top_padding|translations|underline|unscrollable|update|value|version|version_name|version_tuple|vertical|width|window_hide_transition|window_icon|window_left_padding|window_show_transition|window_title|windows_icon|xadjustment|xalign|xanchor|xanchoraround|xaround|xcenter|xfill|xinitial|xmargin|xmaximum|xminimum|xoffset|xofsset|xpadding|xpos|xsize|xzoom|yadjustment|yalign|yanchor|yanchoraround|yaround|ycenter|yfill|yinitial|ymargin|ymaximum|yminimum|yoffset|ypadding|ypos|ysize|ysizexysize|yzoom|zoom|zorder)\b/,
"tag": /\b(?:bar|block|button|buttoscreenn|drag|draggroup|fixed|frame|grid|[hv]box|hotbar|hotspot|image|imagebutton|imagemap|input|key|label|menu|mm_menu_frame|mousearea|nvl|parallel|screen|self|side|tag|text|textbutton|timer|vbar|viewport|window)\b|\$/,
"keyword": /\b(?:None|add|adjustment|alignaround|allow|angle|animation|around|as|assert|behind|box_layout|break|build|cache|call|center|changed|child_size|choice|circles|class|clear|clicked|clipping|clockwise|config|contains|continue|corner1|corner2|counterclockwise|def|default|define|del|delay|disabled|disabled_text|dissolve|elif|else|event|except|exclude|exec|expression|fade|finally|for|from|function|global|gm_root|has|hide|id|if|import|in|init|is|jump|knot|lambda|left|less_rounded|mm_root|movie|music|null|on|onlayer|pass|pause|persistent|play|print|python|queue|raise|random|renpy|repeat|return|right|rounded_window|scene|scope|set|show|slow|slow_abortable|slow_done|sound|stop|store|style|style_group|substitute|suffix|theme|transform|transform_anchor|transpose|try|ui|unhovered|updater|use|voice|while|widget|widget_hover|widget_selected|widget_text|yield)\b/,
"boolean": /\b(?:[Ff]alse|[Tt]rue)\b/,
"number": /(?:\b(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*(?:\.\d*)?)|\B\.\d+)(?:e[+-]?\d+)?j?/i,
"operator": /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:and|at|not|or|with)\b/,
"punctuation": /[{}[\];(),.:]/
};
Prism.languages.rpy = Prism.languages.renpy;
Prism.languages.rescript = {
"comment": {
pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
greedy: true
},
"char": { pattern: /'(?:[^\r\n\\]|\\(?:.|\w+))'/, greedy: true },
"string": {
pattern: /"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,
greedy: true
},
"class-name": /\b[A-Z]\w*|@[a-z.]*|#[A-Za-z]\w*|#\d/,
"function": {
pattern: /[a-zA-Z]\w*(?=\()|(\.)[a-z]\w*/,
lookbehind: true
},
"number": /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
"boolean": /\b(?:false|true)\b/,
"attr-value": /[A-Za-z]\w*(?==)/,
"constant": {
pattern: /(\btype\s+)[a-z]\w*/,
lookbehind: true
},
"tag": {
pattern: /(<)[a-z]\w*|(?:<\/)[a-z]\w*/,
lookbehind: true,
inside: {
"operator": /<|>|\//
}
},
"keyword": /\b(?:and|as|assert|begin|bool|class|constraint|do|done|downto|else|end|exception|external|float|for|fun|function|if|in|include|inherit|initializer|int|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|string|switch|then|to|try|type|when|while|with)\b/,
"operator": /\.{3}|:[:=]?|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/,
"punctuation": /[(){}[\],;.]/
};
Prism.languages.insertBefore("rescript", "string", {
"template-string": {
pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
greedy: true,
inside: {
"template-punctuation": {
pattern: /^`|`$/,
alias: "string"
},
"interpolation": {
pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
lookbehind: true,
inside: {
"interpolation-punctuation": {
pattern: /^\$\{|\}$/,
alias: "tag"
},
rest: Prism.languages.rescript
}
},
"string": /[\s\S]+/
}
}
});
Prism.languages.res = Prism.languages.rescript;
Prism.languages.rest = {
"table": [
{
pattern: /(^[\t ]*)(?:\+[=-]+)+\+(?:\r?\n|\r)(?:\1[+|].+[+|](?:\r?\n|\r))+\1(?:\+[=-]+)+\+/m,
lookbehind: true,
inside: {
"punctuation": /\||(?:\+[=-]+)+\+/
}
},
{
pattern: /(^[\t ]*)=+ [ =]*=(?:(?:\r?\n|\r)\1.+)+(?:\r?\n|\r)\1=+ [ =]*=(?=(?:\r?\n|\r){2}|\s*$)/m,
lookbehind: true,
inside: {
"punctuation": /[=-]+/
}
}
],
// Directive-like patterns
"substitution-def": {
pattern: /(^[\t ]*\.\. )\|(?:[^|\s](?:[^|]*[^|\s])?)\| [^:]+::/m,
lookbehind: true,
inside: {
"substitution": {
pattern: /^\|(?:[^|\s]|[^|\s][^|]*[^|\s])\|/,
alias: "attr-value",
inside: {
"punctuation": /^\||\|$/
}
},
"directive": {
pattern: /( )(?! )[^:]+::/,
lookbehind: true,
alias: "function",
inside: {
"punctuation": /::$/
}
}
}
},
"link-target": [
{
pattern: /(^[\t ]*\.\. )\[[^\]]+\]/m,
lookbehind: true,
alias: "string",
inside: {
"punctuation": /^\[|\]$/
}
},
{
pattern: /(^[\t ]*\.\. )_(?:`[^`]+`|(?:[^:\\]|\\.)+):/m,
lookbehind: true,
alias: "string",
inside: {
"punctuation": /^_|:$/
}
}
],
"directive": {
pattern: /(^[\t ]*\.\. )[^:]+::/m,
lookbehind: true,
alias: "function",
inside: {
"punctuation": /::$/
}
},
"comment": {
// The two alternatives try to prevent highlighting of blank comments
pattern: /(^[\t ]*\.\.)(?:(?: .+)?(?:(?:\r?\n|\r).+)+| .+)(?=(?:\r?\n|\r){2}|$)/m,
lookbehind: true
},
"title": [
// Overlined and underlined
{
pattern: /^(([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~])\2+)(?:\r?\n|\r).+(?:\r?\n|\r)\1$/m,
inside: {
"punctuation": /^[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]+|[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]+$/,
"important": /.+/
}
},
// Underlined only
{
pattern: /(^|(?:\r?\n|\r){2}).+(?:\r?\n|\r)([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~])\2+(?=\r?\n|\r|$)/,
lookbehind: true,
inside: {
"punctuation": /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]+$/,
"important": /.+/
}
}
],
"hr": {
pattern: /((?:\r?\n|\r){2})([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~])\2{3,}(?=(?:\r?\n|\r){2})/,
lookbehind: true,
alias: "punctuation"
},
"field": {
pattern: /(^[\t ]*):[^:\r\n]+:(?= )/m,
lookbehind: true,
alias: "attr-name"
},
"command-line-option": {
pattern: /(^[\t ]*)(?:[+-][a-z\d]|(?:--|\/)[a-z\d-]+)(?:[ =](?:[a-z][\w-]*|<[^<>]+>))?(?:, (?:[+-][a-z\d]|(?:--|\/)[a-z\d-]+)(?:[ =](?:[a-z][\w-]*|<[^<>]+>))?)*(?=(?:\r?\n|\r)? {2,}\S)/im,
lookbehind: true,
alias: "symbol"
},
"literal-block": {
pattern: /::(?:\r?\n|\r){2}([ \t]+)(?![ \t]).+(?:(?:\r?\n|\r)\1.+)*/,
inside: {
"literal-block-punctuation": {
pattern: /^::/,
alias: "punctuation"
}
}
},
"quoted-literal-block": {
pattern: /::(?:\r?\n|\r){2}([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]).*(?:(?:\r?\n|\r)\1.*)*/,
inside: {
"literal-block-punctuation": {
pattern: /^(?:::|([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~])\1*)/m,
alias: "punctuation"
}
}
},
"list-bullet": {
pattern: /(^[\t ]*)(?:[*+\-•‣⁃]|\(?(?:\d+|[a-z]|[ivxdclm]+)\)|(?:\d+|[a-z]|[ivxdclm]+)\.)(?= )/im,
lookbehind: true,
alias: "punctuation"
},
"doctest-block": {
pattern: /(^[\t ]*)>>> .+(?:(?:\r?\n|\r).+)*/m,
lookbehind: true,
inside: {
"punctuation": /^>>>/
}
},
"inline": [
{
pattern: /(^|[\s\-:\/'"<(\[{])(?::[^:]+:`.*?`|`.*?`:[^:]+:|(\*\*?|``?|\|)(?!\s)(?:(?!\2).)*\S\2(?=[\s\-.,:;!?\\\/'")\]}]|$))/m,
lookbehind: true,
inside: {
"bold": {
pattern: /(^\*\*).+(?=\*\*$)/,
lookbehind: true
},
"italic": {
pattern: /(^\*).+(?=\*$)/,
lookbehind: true
},
"inline-literal": {
pattern: /(^``).+(?=``$)/,
lookbehind: true,
alias: "symbol"
},
"role": {
pattern: /^:[^:]+:|:[^:]+:$/,
alias: "function",
inside: {
"punctuation": /^:|:$/
}
},
"interpreted-text": {
pattern: /(^`).+(?=`$)/,
lookbehind: true,
alias: "attr-value"
},
"substitution": {
pattern: /(^\|).+(?=\|$)/,
lookbehind: true,
alias: "attr-value"
},
"punctuation": /\*\*?|``?|\|/
}
}
],
"link": [
{
pattern: /\[[^\[\]]+\]_(?=[\s\-.,:;!?\\\/'")\]}]|$)/,
alias: "string",
inside: {
"punctuation": /^\[|\]_$/
}
},
{
pattern: /(?:\b[a-z\d]+(?:[_.:+][a-z\d]+)*_?_|`[^`]+`_?_|_`[^`]+`)(?=[\s\-.,:;!?\\\/'")\]}]|$)/i,
alias: "string",
inside: {
"punctuation": /^_?`|`$|`?_?_$/
}
}
],
// Line block start,
// quote attribution,
// explicit markup start,
// and anonymous hyperlink target shortcut (__)
"punctuation": {
pattern: /(^[\t ]*)(?:\|(?= |$)|(?:---?|—|\.\.|__)(?= )|\.\.$)/m,
lookbehind: true
}
};
Prism.languages.rip = {
"comment": {
pattern: /#.*/,
greedy: true
},
"char": {
pattern: /\B`[^\s`'",.:;#\/\\()<>\[\]{}]\b/,
greedy: true
},
"string": {
pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
greedy: true
},
"regex": {
pattern: /(^|[^/])\/(?!\/)(?:\[[^\n\r\]]*\]|\\.|[^/\\\r\n\[])+\/(?=\s*(?:$|[\r\n,.;})]))/,
lookbehind: true,
greedy: true
},
"keyword": /(?:=>|->)|\b(?:case|catch|class|else|exit|finally|if|raise|return|switch|try)\b/,
"builtin": /@|\bSystem\b/,
"boolean": /\b(?:false|true)\b/,
"date": /\b\d{4}-\d{2}-\d{2}\b/,
"time": /\b\d{2}:\d{2}:\d{2}\b/,
"datetime": /\b\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\b/,
"symbol": /:[^\d\s`'",.:;#\/\\()<>\[\]{}][^\s`'",.:;#\/\\()<>\[\]{}]*/,
"number": /[+-]?\b(?:\d+\.\d+|\d+)\b/,
"punctuation": /(?:\.{2,3})|[`,.:;=\/\\()<>\[\]{}]/,
"reference": /[^\d\s`'",.:;#\/\\()<>\[\]{}][^\s`'",.:;#\/\\()<>\[\]{}]*/
};
Prism.languages.roboconf = {
"comment": /#.*/,
"keyword": {
"pattern": /(^|\s)(?:(?:external|import)\b|(?:facet|instance of)(?=[ \t]+[\w-]+[ \t]*\{))/,
lookbehind: true
},
"component": {
pattern: /[\w-]+(?=[ \t]*\{)/,
alias: "variable"
},
"property": /[\w.-]+(?=[ \t]*:)/,
"value": {
pattern: /(=[ \t]*(?![ \t]))[^,;]+/,
lookbehind: true,
alias: "attr-value"
},
"optional": {
pattern: /\(optional\)/,
alias: "builtin"
},
"wildcard": {
pattern: /(\.)\*/,
lookbehind: true,
alias: "operator"
},
"punctuation": /[{},.;:=]/
};
(function(Prism2) {
var comment = {
pattern: /(^[ \t]*| {2}|\t)#.*/m,
lookbehind: true,
greedy: true
};
var variable = {
pattern: /((?:^|[^\\])(?:\\{2})*)[$@&%]\{(?:[^{}\r\n]|\{[^{}\r\n]*\})*\}/,
lookbehind: true,
inside: {
"punctuation": /^[$@&%]\{|\}$/
}
};
function createSection(name, inside) {
var extendecInside = {};
extendecInside["section-header"] = {
pattern: /^ ?\*{3}.+?\*{3}/,
alias: "keyword"
};
for (var token in inside) {
extendecInside[token] = inside[token];
}
extendecInside["tag"] = {
pattern: /([\r\n](?: {2}|\t)[ \t]*)\[[-\w]+\]/,
lookbehind: true,
inside: {
"punctuation": /\[|\]/
}
};
extendecInside["variable"] = variable;
extendecInside["comment"] = comment;
return {
pattern: RegExp(/^ ?\*{3}[ \t]*<name>[ \t]*\*{3}(?:.|[\r\n](?!\*{3}))*/.source.replace(/<name>/g, function() {
return name;
}), "im"),
alias: "section",
inside: extendecInside
};
}
var docTag = {
pattern: /(\[Documentation\](?: {2}|\t)[ \t]*)(?![ \t]|#)(?:.|(?:\r\n?|\n)[ \t]*\.{3})+/,
lookbehind: true,
alias: "string"
};
var testNameLike = {
pattern: /([\r\n] ?)(?!#)(?:\S(?:[ \t]\S)*)+/,
lookbehind: true,
alias: "function",
inside: {
"variable": variable
}
};
var testPropertyLike = {
pattern: /([\r\n](?: {2}|\t)[ \t]*)(?!\[|\.{3}|#)(?:\S(?:[ \t]\S)*)+/,
lookbehind: true,
inside: {
"variable": variable
}
};
Prism2.languages["robotframework"] = {
"settings": createSection("Settings", {
"documentation": {
pattern: /([\r\n] ?Documentation(?: {2}|\t)[ \t]*)(?![ \t]|#)(?:.|(?:\r\n?|\n)[ \t]*\.{3})+/,
lookbehind: true,
alias: "string"
},
"property": {
pattern: /([\r\n] ?)(?!\.{3}|#)(?:\S(?:[ \t]\S)*)+/,
lookbehind: true
}
}),
"variables": createSection("Variables"),
"test-cases": createSection("Test Cases", {
"test-name": testNameLike,
"documentation": docTag,
"property": testPropertyLike
}),
"keywords": createSection("Keywords", {
"keyword-name": testNameLike,
"documentation": docTag,
"property": testPropertyLike
}),
"tasks": createSection("Tasks", {
"task-name": testNameLike,
"documentation": docTag,
"property": testPropertyLike
}),
"comment": comment
};
Prism2.languages.robot = Prism2.languages["robotframework"];
})(Prism);
(function(Prism2) {
var multilineComment = /\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source;
for (var i = 0; i < 2; i++) {
multilineComment = multilineComment.replace(/<self>/g, function() {
return multilineComment;
});
}
multilineComment = multilineComment.replace(/<self>/g, function() {
return /[^\s\S]/.source;
});
Prism2.languages.rust = {
"comment": [
{
pattern: RegExp(/(^|[^\\])/.source + multilineComment),
lookbehind: true,
greedy: true
},
{
pattern: /(^|[^\\:])\/\/.*/,
lookbehind: true,
greedy: true
}
],
"string": {
pattern: /b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,
greedy: true
},
"char": {
pattern: /b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,
greedy: true
},
"attribute": {
pattern: /#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,
greedy: true,
alias: "attr-name",
inside: {
"string": null
// see below
}
},
// Closure params should not be confused with bitwise OR |
"closure-params": {
pattern: /([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,
lookbehind: true,
greedy: true,
inside: {
"closure-punctuation": {
pattern: /^\||\|$/,
alias: "punctuation"
},
rest: null
// see below
}
},
"lifetime-annotation": {
pattern: /'\w+/,
alias: "symbol"
},
"fragment-specifier": {
pattern: /(\$\w+:)[a-z]+/,
lookbehind: true,
alias: "punctuation"
},
"variable": /\$\w+/,
"function-definition": {
pattern: /(\bfn\s+)\w+/,
lookbehind: true,
alias: "function"
},
"type-definition": {
pattern: /(\b(?:enum|struct|trait|type|union)\s+)\w+/,
lookbehind: true,
alias: "class-name"
},
"module-declaration": [
{
pattern: /(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,
lookbehind: true,
alias: "namespace"
},
{
pattern: /(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,
lookbehind: true,
alias: "namespace",
inside: {
"punctuation": /::/
}
}
],
"keyword": [
// https://github.com/rust-lang/reference/blob/master/src/keywords.md
/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,
// primitives and str
// https://doc.rust-lang.org/stable/rust-by-example/primitives.html
/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/
],
// functions can technically start with an upper-case letter, but this will introduce a lot of false positives
// and Rust's naming conventions recommend snake_case anyway.
// https://doc.rust-lang.org/1.0.0/style/style/naming/README.html
"function": /\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,
"macro": {
pattern: /\b\w+!/,
alias: "property"
},
"constant": /\b[A-Z_][A-Z_\d]+\b/,
"class-name": /\b[A-Z]\w*\b/,
"namespace": {
pattern: /(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,
inside: {
"punctuation": /::/
}
},
// Hex, oct, bin, dec numbers with visual separators and type suffix
"number": /\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,
"boolean": /\b(?:false|true)\b/,
"punctuation": /->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,
"operator": /[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/
};
Prism2.languages.rust["closure-params"].inside.rest = Prism2.languages.rust;
Prism2.languages.rust["attribute"].inside["string"] = Prism2.languages.rust["string"];
})(Prism);
(function(Prism2) {
var stringPattern = /(?:"(?:""|[^"])*"(?!")|'(?:''|[^'])*'(?!'))/.source;
var number = /\b(?:\d[\da-f]*x|\d+(?:\.\d+)?(?:e[+-]?\d+)?)\b/i;
var numericConstant = {
pattern: RegExp(stringPattern + "[bx]"),
alias: "number"
};
var macroVariable = {
pattern: /&[a-z_]\w*/i
};
var macroKeyword = {
pattern: /((?:^|\s|=|\())%(?:ABORT|BY|CMS|COPY|DISPLAY|DO|ELSE|END|EVAL|GLOBAL|GO|GOTO|IF|INC|INCLUDE|INDEX|INPUT|KTRIM|LENGTH|LET|LIST|LOCAL|PUT|QKTRIM|QSCAN|QSUBSTR|QSYSFUNC|QUPCASE|RETURN|RUN|SCAN|SUBSTR|SUPERQ|SYMDEL|SYMEXIST|SYMGLOBL|SYMLOCAL|SYSCALL|SYSEVALF|SYSEXEC|SYSFUNC|SYSGET|SYSRPUT|THEN|TO|TSO|UNQUOTE|UNTIL|UPCASE|WHILE|WINDOW)\b/i,
lookbehind: true,
alias: "keyword"
};
var step = {
pattern: /(^|\s)(?:proc\s+\w+|data(?!=)|quit|run)\b/i,
alias: "keyword",
lookbehind: true
};
var comment = [
/\/\*[\s\S]*?\*\//,
{
pattern: /(^[ \t]*|;\s*)\*[^;]*;/m,
lookbehind: true
}
];
var string = {
pattern: RegExp(stringPattern),
greedy: true
};
var punctuation = /[$%@.(){}\[\];,\\]/;
var func = {
pattern: /%?\b\w+(?=\()/,
alias: "keyword"
};
var args = {
"function": func,
"arg-value": {
pattern: /(=\s*)[A-Z\.]+/i,
lookbehind: true
},
"operator": /=/,
"macro-variable": macroVariable,
"arg": {
pattern: /[A-Z]+/i,
alias: "keyword"
},
"number": number,
"numeric-constant": numericConstant,
"punctuation": punctuation,
"string": string
};
var format = {
pattern: /\b(?:format|put)\b=?[\w'$.]+/i,
inside: {
"keyword": /^(?:format|put)(?==)/i,
"equals": /=/,
"format": {
pattern: /(?:\w|\$\d)+\.\d?/,
alias: "number"
}
}
};
var altformat = {
pattern: /\b(?:format|put)\s+[\w']+(?:\s+[$.\w]+)+(?=;)/i,
inside: {
"keyword": /^(?:format|put)/i,
"format": {
pattern: /[\w$]+\.\d?/,
alias: "number"
}
}
};
var globalStatements = {
pattern: /((?:^|\s)=?)(?:catname|checkpoint execute_always|dm|endsas|filename|footnote|%include|libname|%list|lock|missing|options|page|resetline|%run|sasfile|skip|sysecho|title\d?)\b/i,
lookbehind: true,
alias: "keyword"
};
var submitStatement = {
pattern: /(^|\s)(?:submit(?:\s+(?:load|norun|parseonly))?|endsubmit)\b/i,
lookbehind: true,
alias: "keyword"
};
var actionSets = /aStore|accessControl|aggregation|audio|autotune|bayesianNetClassifier|bioMedImage|boolRule|builtins|cardinality|cdm|clustering|conditionalRandomFields|configuration|copula|countreg|dataDiscovery|dataPreprocess|dataSciencePilot|dataStep|decisionTree|deduplication|deepLearn|deepNeural|deepRnn|ds2|ecm|entityRes|espCluster|explainModel|factmac|fastKnn|fcmpact|fedSql|freqTab|gVarCluster|gam|gleam|graphSemiSupLearn|hiddenMarkovModel|hyperGroup|ica|image|iml|kernalPca|langModel|ldaTopic|loadStreams|mbc|mixed|mlTools|modelPublishing|network|neuralNet|nmf|nonParametricBayes|nonlinear|optNetwork|optimization|panel|pca|percentile|phreg|pls|qkb|qlim|quantreg|recommend|regression|reinforcementLearn|robustPca|ruleMining|sampling|sandwich|sccasl|search(?:Analytics)?|sentimentAnalysis|sequence|session(?:Prop)?|severity|simSystem|simple|smartData|sparkEmbeddedProcess|sparseML|spatialreg|spc|stabilityMonitoring|svDataDescription|svm|table|text(?:Filters|Frequency|Mining|Parse|Rule(?:Develop|Score)|Topic|Util)|timeData|transpose|tsInfo|tsReconcile|uniTimeSeries|varReduce/.source;
var casActions = {
pattern: RegExp(/(^|\s)(?:action\s+)?(?:<act>)\.[a-z]+\b[^;]+/.source.replace(/<act>/g, function() {
return actionSets;
}), "i"),
lookbehind: true,
inside: {
"keyword": RegExp(/(?:<act>)\.[a-z]+\b/.source.replace(/<act>/g, function() {
return actionSets;
}), "i"),
"action": {
pattern: /(?:action)/i,
alias: "keyword"
},
"comment": comment,
"function": func,
"arg-value": args["arg-value"],
"operator": args.operator,
"argument": args.arg,
"number": number,
"numeric-constant": numericConstant,
"punctuation": punctuation,
"string": string
}
};
var keywords = {
pattern: /((?:^|\s)=?)(?:after|analysis|and|array|barchart|barwidth|begingraph|by|call|cas|cbarline|cfill|class(?:lev)?|close|column|computed?|contains|continue|data(?==)|define|delete|describe|document|do\s+over|do|dol|drop|dul|else|end(?:comp|source)?|entryTitle|eval(?:uate)?|exec(?:ute)?|exit|file(?:name)?|fill(?:attrs)?|flist|fnc|function(?:list)?|global|goto|group(?:by)?|headline|headskip|histogram|if|infile|keep|keylabel|keyword|label|layout|leave|legendlabel|length|libname|loadactionset|merge|midpoints|_?null_|name|noobs|nowd|ods|options|or|otherwise|out(?:put)?|over(?:lay)?|plot|print|put|raise|ranexp|rannor|rbreak|retain|return|select|session|sessref|set|source|statgraph|sum|summarize|table|temp|terminate|then\s+do|then|title\d?|to|var|when|where|xaxisopts|y2axisopts|yaxisopts)\b/i,
lookbehind: true
};
Prism2.languages.sas = {
"datalines": {
pattern: /^([ \t]*)(?:cards|(?:data)?lines);[\s\S]+?^[ \t]*;/im,
lookbehind: true,
alias: "string",
inside: {
"keyword": {
pattern: /^(?:cards|(?:data)?lines)/i
},
"punctuation": /;/
}
},
"proc-sql": {
pattern: /(^proc\s+(?:fed)?sql(?:\s+[\w|=]+)?;)[\s\S]+?(?=^(?:proc\s+\w+|data|quit|run);|(?![\s\S]))/im,
lookbehind: true,
inside: {
"sql": {
pattern: RegExp(/^[ \t]*(?:select|alter\s+table|(?:create|describe|drop)\s+(?:index|table(?:\s+constraints)?|view)|create\s+unique\s+index|insert\s+into|update)(?:<str>|[^;"'])+;/.source.replace(/<str>/g, function() {
return stringPattern;
}), "im"),
alias: "language-sql",
inside: Prism2.languages.sql
},
"global-statements": globalStatements,
"sql-statements": {
pattern: /(^|\s)(?:disconnect\s+from|begin|commit|exec(?:ute)?|reset|rollback|validate)\b/i,
lookbehind: true,
alias: "keyword"
},
"number": number,
"numeric-constant": numericConstant,
"punctuation": punctuation,
"string": string
}
},
"proc-groovy": {
pattern: /(^proc\s+groovy(?:\s+[\w|=]+)?;)[\s\S]+?(?=^(?:proc\s+\w+|data|quit|run);|(?![\s\S]))/im,
lookbehind: true,
inside: {
"comment": comment,
"groovy": {
pattern: RegExp(/(^[ \t]*submit(?:\s+(?:load|norun|parseonly))?)(?:<str>|[^"'])+?(?=endsubmit;)/.source.replace(/<str>/g, function() {
return stringPattern;
}), "im"),
lookbehind: true,
alias: "language-groovy",
inside: Prism2.languages.groovy
},
"keyword": keywords,
"submit-statement": submitStatement,
"global-statements": globalStatements,
"number": number,
"numeric-constant": numericConstant,
"punctuation": punctuation,
"string": string
}
},
"proc-lua": {
pattern: /(^proc\s+lua(?:\s+[\w|=]+)?;)[\s\S]+?(?=^(?:proc\s+\w+|data|quit|run);|(?![\s\S]))/im,
lookbehind: true,
inside: {
"comment": comment,
"lua": {
pattern: RegExp(/(^[ \t]*submit(?:\s+(?:load|norun|parseonly))?)(?:<str>|[^"'])+?(?=endsubmit;)/.source.replace(/<str>/g, function() {
return stringPattern;
}), "im"),
lookbehind: true,
alias: "language-lua",
inside: Prism2.languages.lua
},
"keyword": keywords,
"submit-statement": submitStatement,
"global-statements": globalStatements,
"number": number,
"numeric-constant": numericConstant,
"punctuation": punctuation,
"string": string
}
},
"proc-cas": {
pattern: /(^proc\s+cas(?:\s+[\w|=]+)?;)[\s\S]+?(?=^(?:proc\s+\w+|quit|data);|(?![\s\S]))/im,
lookbehind: true,
inside: {
"comment": comment,
"statement-var": {
pattern: /((?:^|\s)=?)saveresult\s[^;]+/im,
lookbehind: true,
inside: {
"statement": {
pattern: /^saveresult\s+\S+/i,
inside: {
keyword: /^(?:saveresult)/i
}
},
rest: args
}
},
"cas-actions": casActions,
"statement": {
pattern: /((?:^|\s)=?)(?:default|(?:un)?set|on|output|upload)[^;]+/im,
lookbehind: true,
inside: args
},
"step": step,
"keyword": keywords,
"function": func,
"format": format,
"altformat": altformat,
"global-statements": globalStatements,
"number": number,
"numeric-constant": numericConstant,
"punctuation": punctuation,
"string": string
}
},
"proc-args": {
pattern: RegExp(/(^proc\s+\w+\s+)(?!\s)(?:[^;"']|<str>)+;/.source.replace(/<str>/g, function() {
return stringPattern;
}), "im"),
lookbehind: true,
inside: args
},
/*Special keywords within macros*/
"macro-keyword": macroKeyword,
"macro-variable": macroVariable,
"macro-string-functions": {
pattern: /((?:^|\s|=))%(?:BQUOTE|NRBQUOTE|NRQUOTE|NRSTR|QUOTE|STR)\(.*?(?:[^%]\))/i,
lookbehind: true,
inside: {
"function": {
pattern: /%(?:BQUOTE|NRBQUOTE|NRQUOTE|NRSTR|QUOTE|STR)/i,
alias: "keyword"
},
"macro-keyword": macroKeyword,
"macro-variable": macroVariable,
"escaped-char": {
pattern: /%['"()<>=¬^~;,#]/
},
"punctuation": punctuation
}
},
"macro-declaration": {
pattern: /^%macro[^;]+(?=;)/im,
inside: {
"keyword": /%macro/i
}
},
"macro-end": {
pattern: /^%mend[^;]+(?=;)/im,
inside: {
"keyword": /%mend/i
}
},
/*%_zscore(headcir, _lhc, _mhc, _shc, headcz, headcpct, _Fheadcz); */
"macro": {
pattern: /%_\w+(?=\()/,
alias: "keyword"
},
"input": {
pattern: /\binput\s[-\w\s/*.$&]+;/i,
inside: {
"input": {
alias: "keyword",
pattern: /^input/i
},
"comment": comment,
"number": number,
"numeric-constant": numericConstant
}
},
"options-args": {
pattern: /(^options)[-'"|/\\<>*+=:()\w\s]*(?=;)/im,
lookbehind: true,
inside: args
},
"cas-actions": casActions,
"comment": comment,
"function": func,
"format": format,
"altformat": altformat,
"numeric-constant": numericConstant,
"datetime": {
// '1jan2013'd, '9:25:19pm't, '18jan2003:9:27:05am'dt
pattern: RegExp(stringPattern + "(?:dt?|t)"),
alias: "number"
},
"string": string,
"step": step,
"keyword": keywords,
// In SAS Studio syntax highlighting, these operators are styled like keywords
"operator-keyword": {
pattern: /\b(?:eq|ge|gt|in|le|lt|ne|not)\b/i,
alias: "operator"
},
// Decimal (1.2e23), hexadecimal (0c1x)
"number": number,
"operator": /\*\*?|\|\|?|!!?|¦¦?|<[>=]?|>[<=]?|[-+\/=&]|[~¬^]=?/,
"punctuation": punctuation
};
})(Prism);
(function(Prism2) {
Prism2.languages.sass = Prism2.languages.extend("css", {
// Sass comments don't need to be closed, only indented
"comment": {
pattern: /^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,
lookbehind: true,
greedy: true
}
});
Prism2.languages.insertBefore("sass", "atrule", {
// We want to consume the whole line
"atrule-line": {
// Includes support for = and + shortcuts
pattern: /^(?:[ \t]*)[@+=].+/m,
greedy: true,
inside: {
"atrule": /(?:@[\w-]+|[+=])/
}
}
});
delete Prism2.languages.sass.atrule;
var variable = /\$[-\w]+|#\{\$[-\w]+\}/;
var operator = [
/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,
{
pattern: /(\s)-(?=\s)/,
lookbehind: true
}
];
Prism2.languages.insertBefore("sass", "property", {
// We want to consume the whole line
"variable-line": {
pattern: /^[ \t]*\$.+/m,
greedy: true,
inside: {
"punctuation": /:/,
"variable": variable,
"operator": operator
}
},
// We want to consume the whole line
"property-line": {
pattern: /^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,
greedy: true,
inside: {
"property": [
/[^:\s]+(?=\s*:)/,
{
pattern: /(:)[^:\s]+/,
lookbehind: true
}
],
"punctuation": /:/,
"variable": variable,
"operator": operator,
"important": Prism2.languages.sass.important
}
}
});
delete Prism2.languages.sass.property;
delete Prism2.languages.sass.important;
Prism2.languages.insertBefore("sass", "punctuation", {
"selector": {
pattern: /^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,
lookbehind: true,
greedy: true
}
});
})(Prism);
Prism.languages.scss = Prism.languages.extend("css", {
"comment": {
pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
lookbehind: true
},
"atrule": {
pattern: /@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,
inside: {
"rule": /@[\w-]+/
// See rest below
}
},
// url, compassified
"url": /(?:[-a-z]+-)?url(?=\()/i,
// CSS selector regex is not appropriate for Sass
// since there can be lot more things (var, @ directive, nesting..)
// a selector must start at the end of a property or after a brace (end of other rules or nesting)
// it can contain some characters that aren't used for defining rules or end of selector, & (parent selector), or interpolated variable
// the end of a selector is found when there is no rules in it ( {} or {\s}) or if there is a property (because an interpolated var
// can "pass" as a selector- e.g: proper#{$erty})
// this one was hard to do, so please be careful if you edit this one :)
"selector": {
// Initial look-ahead is used to prevent matching of blank selectors
pattern: /(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,
inside: {
"parent": {
pattern: /&/,
alias: "important"
},
"placeholder": /%[-\w]+/,
"variable": /\$[-\w]+|#\{\$[-\w]+\}/
}
},
"property": {
pattern: /(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,
inside: {
"variable": /\$[-\w]+|#\{\$[-\w]+\}/
}
}
});
Prism.languages.insertBefore("scss", "atrule", {
"keyword": [
/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,
{
pattern: /( )(?:from|through)(?= )/,
lookbehind: true
}
]
});
Prism.languages.insertBefore("scss", "important", {
// var and interpolated vars
"variable": /\$[-\w]+|#\{\$[-\w]+\}/
});
Prism.languages.insertBefore("scss", "function", {
"module-modifier": {
pattern: /\b(?:as|hide|show|with)\b/i,
alias: "keyword"
},
"placeholder": {
pattern: /%[-\w]+/,
alias: "selector"
},
"statement": {
pattern: /\B!(?:default|optional)\b/i,
alias: "keyword"
},
"boolean": /\b(?:false|true)\b/,
"null": {
pattern: /\bnull\b/,
alias: "keyword"
},
"operator": {
pattern: /(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,
lookbehind: true
}
});
Prism.languages.scss["atrule"].inside.rest = Prism.languages.scss;
Prism.languages.scala = Prism.languages.extend("java", {
"triple-quoted-string": {
pattern: /"""[\s\S]*?"""/,
greedy: true,
alias: "string"
},
"string": {
pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
greedy: true
},
"keyword": /<-|=>|\b(?:abstract|case|catch|class|def|do|else|extends|final|finally|for|forSome|if|implicit|import|lazy|match|new|null|object|override|package|private|protected|return|sealed|self|super|this|throw|trait|try|type|val|var|while|with|yield)\b/,
"number": /\b0x(?:[\da-f]*\.)?[\da-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e\d+)?[dfl]?/i,
"builtin": /\b(?:Any|AnyRef|AnyVal|Boolean|Byte|Char|Double|Float|Int|Long|Nothing|Short|String|Unit)\b/,
"symbol": /'[^\d\s\\]\w*/
});
Prism.languages.insertBefore("scala", "triple-quoted-string", {
"string-interpolation": {
pattern: /\b[a-z]\w*(?:"""(?:[^$]|\$(?:[^{]|\{(?:[^{}]|\{[^{}]*\})*\}))*?"""|"(?:[^$"\r\n]|\$(?:[^{]|\{(?:[^{}]|\{[^{}]*\})*\}))*")/i,
greedy: true,
inside: {
"id": {
pattern: /^\w+/,
greedy: true,
alias: "function"
},
"escape": {
pattern: /\\\$"|\$[$"]/,
greedy: true,
alias: "symbol"
},
"interpolation": {
pattern: /\$(?:\w+|\{(?:[^{}]|\{[^{}]*\})*\})/,
greedy: true,
inside: {
"punctuation": /^\$\{?|\}$/,
"expression": {
pattern: /[\s\S]+/,
inside: Prism.languages.scala
}
}
},
"string": /[\s\S]+/
}
}
});
delete Prism.languages.scala["class-name"];
delete Prism.languages.scala["function"];
(function(Prism2) {
var strings = [
// normal string
/"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/.source,
/'[^']*'/.source,
/\$'(?:[^'\\]|\\[\s\S])*'/.source,
// here doc
// 2 capturing groups
/<<-?\s*(["']?)(\w+)\1\s[\s\S]*?[\r\n]\2/.source
].join("|");
Prism2.languages["shell-session"] = {
"command": {
pattern: RegExp(
// user info
/^/.source + "(?:" + // <user> ":" ( <path> )?
(/[^\s@:$#%*!/\\]+@[^\r\n@:$#%*!/\\]+(?::[^\0-\x1F$#%*?"<>:;|]+)?/.source + "|" + // <path>
// Since the path pattern is quite general, we will require it to start with a special character to
// prevent false positives.
/[/~.][^\0-\x1F$#%*?"<>@:;|]*/.source) + ")?" + // shell symbol
/[$#%](?=\s)/.source + // bash command
/(?:[^\\\r\n \t'"<$]|[ \t](?:(?!#)|#.*$)|\\(?:[^\r]|\r\n?)|\$(?!')|<(?!<)|<<str>>)+/.source.replace(/<<str>>/g, function() {
return strings;
}),
"m"
),
greedy: true,
inside: {
"info": {
// foo@bar:~/files$ exit
// foo@bar$ exit
// ~/files$ exit
pattern: /^[^#$%]+/,
alias: "punctuation",
inside: {
"user": /^[^\s@:$#%*!/\\]+@[^\r\n@:$#%*!/\\]+/,
"punctuation": /:/,
"path": /[\s\S]+/
}
},
"bash": {
pattern: /(^[$#%]\s*)\S[\s\S]*/,
lookbehind: true,
alias: "language-bash",
inside: Prism2.languages.bash
},
"shell-symbol": {
pattern: /^[$#%]/,
alias: "important"
}
}
},
"output": /.(?:.*(?:[\r\n]|.$))*/
};
Prism2.languages["sh-session"] = Prism2.languages["shellsession"] = Prism2.languages["shell-session"];
})(Prism);
Prism.languages.smali = {
"comment": /#.*/,
"string": {
pattern: /"(?:[^\r\n\\"]|\\.)*"|'(?:[^\r\n\\']|\\(?:.|u[\da-fA-F]{4}))'/,
greedy: true
},
"class-name": {
pattern: /(^|[^L])L(?:(?:\w+|`[^`\r\n]*`)\/)*(?:[\w$]+|`[^`\r\n]*`)(?=\s*;)/,
lookbehind: true,
inside: {
"class-name": {
pattern: /(^L|\/)(?:[\w$]+|`[^`\r\n]*`)$/,
lookbehind: true
},
"namespace": {
pattern: /^(L)(?:(?:\w+|`[^`\r\n]*`)\/)+/,
lookbehind: true,
inside: {
"punctuation": /\//
}
},
"builtin": /^L/
}
},
"builtin": [
{
// Reference: https://github.com/JesusFreke/smali/wiki/TypesMethodsAndFields#types
pattern: /([();\[])[BCDFIJSVZ]+/,
lookbehind: true
},
{
// e.g. .field mWifiOnUid:I
pattern: /([\w$>]:)[BCDFIJSVZ]/,
lookbehind: true
}
],
"keyword": [
{
pattern: /(\.end\s+)[\w-]+/,
lookbehind: true
},
{
pattern: /(^|[^\w.-])\.(?!\d)[\w-]+/,
lookbehind: true
},
{
pattern: /(^|[^\w.-])(?:abstract|annotation|bridge|constructor|enum|final|interface|private|protected|public|runtime|static|synthetic|system|transient)(?![\w.-])/,
lookbehind: true
}
],
"function": {
pattern: /(^|[^\w.-])(?:\w+|<[\w$-]+>)(?=\()/,
lookbehind: true
},
"field": {
pattern: /[\w$]+(?=:)/,
alias: "variable"
},
"register": {
pattern: /(^|[^\w.-])[vp]\d(?![\w.-])/,
lookbehind: true,
alias: "variable"
},
"boolean": {
pattern: /(^|[^\w.-])(?:false|true)(?![\w.-])/,
lookbehind: true
},
"number": {
pattern: /(^|[^/\w.-])-?(?:NAN|INFINITY|0x(?:[\dA-F]+(?:\.[\dA-F]*)?|\.[\dA-F]+)(?:p[+-]?[\dA-F]+)?|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)[dflst]?(?![\w.-])/i,
lookbehind: true
},
"label": {
pattern: /(:)\w+/,
lookbehind: true,
alias: "property"
},
"operator": /->|\.\.|[\[=]/,
"punctuation": /[{}(),;:]/
};
Prism.languages.smalltalk = {
"comment": {
pattern: /"(?:""|[^"])*"/,
greedy: true
},
"char": {
pattern: /\$./,
greedy: true
},
"string": {
pattern: /'(?:''|[^'])*'/,
greedy: true
},
"symbol": /#[\da-z]+|#(?:-|([+\/\\*~<>=@%|&?!])\1?)|#(?=\()/i,
"block-arguments": {
pattern: /(\[\s*):[^\[|]*\|/,
lookbehind: true,
inside: {
"variable": /:[\da-z]+/i,
"punctuation": /\|/
}
},
"temporary-variables": {
pattern: /\|[^|]+\|/,
inside: {
"variable": /[\da-z]+/i,
"punctuation": /\|/
}
},
"keyword": /\b(?:new|nil|self|super)\b/,
"boolean": /\b(?:false|true)\b/,
"number": [
/\d+r-?[\dA-Z]+(?:\.[\dA-Z]+)?(?:e-?\d+)?/,
/\b\d+(?:\.\d+)?(?:e-?\d+)?/
],
"operator": /[<=]=?|:=|~[~=]|\/\/?|\\\\|>[>=]?|[!^+\-*&|,@]/,
"punctuation": /[.;:?\[\](){}]/
};
(function(Prism2) {
Prism2.languages.smarty = {
"comment": {
pattern: /^\{\*[\s\S]*?\*\}/,
greedy: true
},
"embedded-php": {
pattern: /^\{php\}[\s\S]*?\{\/php\}/,
greedy: true,
inside: {
"smarty": {
pattern: /^\{php\}|\{\/php\}$/,
inside: null
// see below
},
"php": {
pattern: /[\s\S]+/,
alias: "language-php",
inside: Prism2.languages.php
}
}
},
"string": [
{
pattern: /"(?:\\.|[^"\\\r\n])*"/,
greedy: true,
inside: {
"interpolation": {
pattern: /\{[^{}]*\}|`[^`]*`/,
inside: {
"interpolation-punctuation": {
pattern: /^[{`]|[`}]$/,
alias: "punctuation"
},
"expression": {
pattern: /[\s\S]+/,
inside: null
// see below
}
}
},
"variable": /\$\w+/
}
},
{
pattern: /'(?:\\.|[^'\\\r\n])*'/,
greedy: true
}
],
"keyword": {
pattern: /(^\{\/?)[a-z_]\w*\b(?!\()/i,
lookbehind: true,
greedy: true
},
"delimiter": {
pattern: /^\{\/?|\}$/,
greedy: true,
alias: "punctuation"
},
"number": /\b0x[\dA-Fa-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][-+]?\d+)?/,
"variable": [
/\$(?!\d)\w+/,
/#(?!\d)\w+#/,
{
pattern: /(\.|->|\w\s*=)(?!\d)\w+\b(?!\()/,
lookbehind: true
},
{
pattern: /(\[)(?!\d)\w+(?=\])/,
lookbehind: true
}
],
"function": {
pattern: /(\|\s*)@?[a-z_]\w*|\b[a-z_]\w*(?=\()/i,
lookbehind: true
},
"attr-name": /\b[a-z_]\w*(?=\s*=)/i,
"boolean": /\b(?:false|no|off|on|true|yes)\b/,
"punctuation": /[\[\](){}.,:`]|->/,
"operator": [
/[+\-*\/%]|==?=?|[!<>]=?|&&|\|\|?/,
/\bis\s+(?:not\s+)?(?:div|even|odd)(?:\s+by)?\b/,
/\b(?:and|eq|gt?e|gt|lt?e|lt|mod|neq?|not|or)\b/
]
};
Prism2.languages.smarty["embedded-php"].inside.smarty.inside = Prism2.languages.smarty;
Prism2.languages.smarty.string[0].inside.interpolation.inside.expression.inside = Prism2.languages.smarty;
var string = /"(?:\\.|[^"\\\r\n])*"|'(?:\\.|[^'\\\r\n])*'/;
var smartyPattern = RegExp(
// comments
/\{\*[\s\S]*?\*\}/.source + "|" + // php tags
/\{php\}[\s\S]*?\{\/php\}/.source + "|" + // smarty blocks
/\{(?:[^{}"']|<str>|\{(?:[^{}"']|<str>|\{(?:[^{}"']|<str>)*\})*\})*\}/.source.replace(/<str>/g, function() {
return string.source;
}),
"g"
);
Prism2.hooks.add("before-tokenize", function(env) {
var smartyLiteralStart = "{literal}";
var smartyLiteralEnd = "{/literal}";
var smartyLiteralMode = false;
Prism2.languages["markup-templating"].buildPlaceholders(env, "smarty", smartyPattern, function(match) {
if (match === smartyLiteralEnd) {
smartyLiteralMode = false;
}
if (!smartyLiteralMode) {
if (match === smartyLiteralStart) {
smartyLiteralMode = true;
}
return true;
}
return false;
});
});
Prism2.hooks.add("after-tokenize", function(env) {
Prism2.languages["markup-templating"].tokenizePlaceholders(env, "smarty");
});
})(Prism);
(function(Prism2) {
var keywords = /\b(?:abstype|and|andalso|as|case|datatype|do|else|end|eqtype|exception|fn|fun|functor|handle|if|in|include|infix|infixr|let|local|nonfix|of|op|open|orelse|raise|rec|sharing|sig|signature|struct|structure|then|type|val|where|while|with|withtype)\b/i;
Prism2.languages.sml = {
// allow one level of nesting
"comment": /\(\*(?:[^*(]|\*(?!\))|\((?!\*)|\(\*(?:[^*(]|\*(?!\))|\((?!\*))*\*\))*\*\)/,
"string": {
pattern: /#?"(?:[^"\\]|\\.)*"/,
greedy: true
},
"class-name": [
{
// This is only an approximation since the real grammar is context-free
//
// Why the main loop so complex?
// The main loop is approximately the same as /(?:\s*(?:[*,]|->)\s*<TERMINAL>)*/ which is, obviously, a lot
// simpler. The difference is that if a comma is the last iteration of the loop, then the terminal must be
// followed by a long identifier.
pattern: RegExp(
/((?:^|[^:]):\s*)<TERMINAL>(?:\s*(?:(?:\*|->)\s*<TERMINAL>|,\s*<TERMINAL>(?:(?=<NOT-LAST>)|(?!<NOT-LAST>)\s+<LONG-ID>)))*/.source.replace(/<NOT-LAST>/g, function() {
return /\s*(?:[*,]|->)/.source;
}).replace(/<TERMINAL>/g, function() {
return /(?:'[\w']*|<LONG-ID>|\((?:[^()]|\([^()]*\))*\)|\{(?:[^{}]|\{[^{}]*\})*\})(?:\s+<LONG-ID>)*/.source;
}).replace(/<LONG-ID>/g, function() {
return /(?!<KEYWORD>)[a-z\d_][\w'.]*/.source;
}).replace(/<KEYWORD>/g, function() {
return keywords.source;
}),
"i"
),
lookbehind: true,
greedy: true,
inside: null
// see below
},
{
pattern: /((?:^|[^\w'])(?:datatype|exception|functor|signature|structure|type)\s+)[a-z_][\w'.]*/i,
lookbehind: true
}
],
"function": {
pattern: /((?:^|[^\w'])fun\s+)[a-z_][\w'.]*/i,
lookbehind: true
},
"keyword": keywords,
"variable": {
pattern: /(^|[^\w'])'[\w']*/,
lookbehind: true
},
"number": /~?\b(?:\d+(?:\.\d+)?(?:e~?\d+)?|0x[\da-f]+)\b/i,
"word": {
pattern: /\b0w(?:\d+|x[\da-f]+)\b/i,
alias: "constant"
},
"boolean": /\b(?:false|true)\b/i,
"operator": /\.\.\.|:[>=:]|=>?|->|[<>]=?|[!+\-*/^#|@~]/,
"punctuation": /[(){}\[\].:,;]/
};
Prism2.languages.sml["class-name"][0].inside = Prism2.languages.sml;
Prism2.languages.smlnj = Prism2.languages.sml;
})(Prism);
Prism.languages.solidity = Prism.languages.extend("clike", {
"class-name": {
pattern: /(\b(?:contract|enum|interface|library|new|struct|using)\s+)(?!\d)[\w$]+/,
lookbehind: true
},
"keyword": /\b(?:_|anonymous|as|assembly|assert|break|calldata|case|constant|constructor|continue|contract|default|delete|do|else|emit|enum|event|external|for|from|function|if|import|indexed|inherited|interface|internal|is|let|library|mapping|memory|modifier|new|payable|pragma|private|public|pure|require|returns?|revert|selfdestruct|solidity|storage|struct|suicide|switch|this|throw|using|var|view|while)\b/,
"operator": /=>|->|:=|=:|\*\*|\+\+|--|\|\||&&|<<=?|>>=?|[-+*/%^&|<>!=]=?|[~?]/
});
Prism.languages.insertBefore("solidity", "keyword", {
"builtin": /\b(?:address|bool|byte|u?int(?:8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?|string|bytes(?:[1-9]|[12]\d|3[0-2])?)\b/
});
Prism.languages.insertBefore("solidity", "number", {
"version": {
pattern: /([<>]=?|\^)\d+\.\d+\.\d+\b/,
lookbehind: true,
alias: "number"
}
});
Prism.languages.sol = Prism.languages.solidity;
(function(Prism2) {
var guid = {
// https://en.wikipedia.org/wiki/Universally_unique_identifier#Format
pattern: /\{[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}\}/i,
alias: "constant",
inside: {
"punctuation": /[{}]/
}
};
Prism2.languages["solution-file"] = {
"comment": {
pattern: /#.*/,
greedy: true
},
"string": {
pattern: /"[^"\r\n]*"|'[^'\r\n]*'/,
greedy: true,
inside: {
"guid": guid
}
},
"object": {
// Foo
// Bar("abs") = 9
// EndBar
// Prop = TRUE
// EndFoo
pattern: /^([ \t]*)(?:([A-Z]\w*)\b(?=.*(?:\r\n?|\n)(?:\1[ \t].*(?:\r\n?|\n))*\1End\2(?=[ \t]*$))|End[A-Z]\w*(?=[ \t]*$))/m,
lookbehind: true,
greedy: true,
alias: "keyword"
},
"property": {
pattern: /^([ \t]*)(?!\s)[^\r\n"#=()]*[^\s"#=()](?=\s*=)/m,
lookbehind: true,
inside: {
"guid": guid
}
},
"guid": guid,
"number": /\b\d+(?:\.\d+)*\b/,
"boolean": /\b(?:FALSE|TRUE)\b/,
"operator": /=/,
"punctuation": /[(),]/
};
Prism2.languages["sln"] = Prism2.languages["solution-file"];
})(Prism);
(function(Prism2) {
var stringPattern = /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;
var numberPattern = /\b\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b|\b0x[\dA-F]+\b/;
Prism2.languages.soy = {
"comment": [
/\/\*[\s\S]*?\*\//,
{
pattern: /(\s)\/\/.*/,
lookbehind: true,
greedy: true
}
],
"command-arg": {
pattern: /(\{+\/?\s*(?:alias|call|delcall|delpackage|deltemplate|namespace|template)\s+)\.?[\w.]+/,
lookbehind: true,
alias: "string",
inside: {
"punctuation": /\./
}
},
"parameter": {
pattern: /(\{+\/?\s*@?param\??\s+)\.?[\w.]+/,
lookbehind: true,
alias: "variable"
},
"keyword": [
{
pattern: /(\{+\/?[^\S\r\n]*)(?:\\[nrt]|alias|call|case|css|default|delcall|delpackage|deltemplate|else(?:if)?|fallbackmsg|for(?:each)?|if(?:empty)?|lb|let|literal|msg|namespace|nil|@?param\??|rb|sp|switch|template|xid)/,
lookbehind: true
},
/\b(?:any|as|attributes|bool|css|float|html|in|int|js|list|map|null|number|string|uri)\b/
],
"delimiter": {
pattern: /^\{+\/?|\/?\}+$/,
alias: "punctuation"
},
"property": /\w+(?==)/,
"variable": {
pattern: /\$[^\W\d]\w*(?:\??(?:\.\w+|\[[^\]]+\]))*/,
inside: {
"string": {
pattern: stringPattern,
greedy: true
},
"number": numberPattern,
"punctuation": /[\[\].?]/
}
},
"string": {
pattern: stringPattern,
greedy: true
},
"function": [
/\w+(?=\()/,
{
pattern: /(\|[^\S\r\n]*)\w+/,
lookbehind: true
}
],
"boolean": /\b(?:false|true)\b/,
"number": numberPattern,
"operator": /\?:?|<=?|>=?|==?|!=|[+*/%-]|\b(?:and|not|or)\b/,
"punctuation": /[{}()\[\]|.,:]/
};
Prism2.hooks.add("before-tokenize", function(env) {
var soyPattern = /\{\{.+?\}\}|\{.+?\}|\s\/\/.*|\/\*[\s\S]*?\*\//g;
var soyLitteralStart = "{literal}";
var soyLitteralEnd = "{/literal}";
var soyLitteralMode = false;
Prism2.languages["markup-templating"].buildPlaceholders(env, "soy", soyPattern, function(match) {
if (match === soyLitteralEnd) {
soyLitteralMode = false;
}
if (!soyLitteralMode) {
if (match === soyLitteralStart) {
soyLitteralMode = true;
}
return true;
}
return false;
});
});
Prism2.hooks.add("after-tokenize", function(env) {
Prism2.languages["markup-templating"].tokenizePlaceholders(env, "soy");
});
})(Prism);
Prism.languages.turtle = {
"comment": {
pattern: /#.*/,
greedy: true
},
"multiline-string": {
pattern: /"""(?:(?:""?)?(?:[^"\\]|\\.))*"""|'''(?:(?:''?)?(?:[^'\\]|\\.))*'''/,
greedy: true,
alias: "string",
inside: {
"comment": /#.*/
}
},
"string": {
pattern: /"(?:[^\\"\r\n]|\\.)*"|'(?:[^\\'\r\n]|\\.)*'/,
greedy: true
},
"url": {
pattern: /<(?:[^\x00-\x20<>"{}|^`\\]|\\(?:u[\da-fA-F]{4}|U[\da-fA-F]{8}))*>/,
greedy: true,
inside: {
"punctuation": /[<>]/
}
},
"function": {
pattern: /(?:(?![-.\d\xB7])[-.\w\xB7\xC0-\uFFFD]+)?:(?:(?![-.])(?:[-.:\w\xC0-\uFFFD]|%[\da-f]{2}|\\.)+)?/i,
inside: {
"local-name": {
pattern: /([^:]*:)[\s\S]+/,
lookbehind: true
},
"prefix": {
pattern: /[\s\S]+/,
inside: {
"punctuation": /:/
}
}
}
},
"number": /[+-]?\b\d+(?:\.\d*)?(?:e[+-]?\d+)?/i,
"punctuation": /[{}.,;()[\]]|\^\^/,
"boolean": /\b(?:false|true)\b/,
"keyword": [
/(?:\ba|@prefix|@base)\b|=/,
/\b(?:base|graph|prefix)\b/i
],
"tag": {
pattern: /@[a-z]+(?:-[a-z\d]+)*/i,
inside: {
"punctuation": /@/
}
}
};
Prism.languages.trig = Prism.languages["turtle"];
Prism.languages.sparql = Prism.languages.extend(
"turtle",
{
"boolean": /\b(?:false|true)\b/i,
"variable": {
pattern: /[?$]\w+/,
greedy: true
}
}
);
Prism.languages.insertBefore("sparql", "punctuation", {
"keyword": [
/\b(?:A|ADD|ALL|AS|ASC|ASK|BNODE|BY|CLEAR|CONSTRUCT|COPY|CREATE|DATA|DEFAULT|DELETE|DESC|DESCRIBE|DISTINCT|DROP|EXISTS|FILTER|FROM|GROUP|HAVING|INSERT|INTO|LIMIT|LOAD|MINUS|MOVE|NAMED|NOT|NOW|OFFSET|OPTIONAL|ORDER|RAND|REDUCED|SELECT|SEPARATOR|SERVICE|SILENT|STRUUID|UNION|USING|UUID|VALUES|WHERE)\b/i,
/\b(?:ABS|AVG|BIND|BOUND|CEIL|COALESCE|CONCAT|CONTAINS|COUNT|DATATYPE|DAY|ENCODE_FOR_URI|FLOOR|GROUP_CONCAT|HOURS|IF|IRI|isBLANK|isIRI|isLITERAL|isNUMERIC|isURI|LANG|LANGMATCHES|LCASE|MAX|MD5|MIN|MINUTES|MONTH|REGEX|REPLACE|ROUND|sameTerm|SAMPLE|SECONDS|SHA1|SHA256|SHA384|SHA512|STR|STRAFTER|STRBEFORE|STRDT|STRENDS|STRLANG|STRLEN|STRSTARTS|SUBSTR|SUM|TIMEZONE|TZ|UCASE|URI|YEAR)\b(?=\s*\()/i,
/\b(?:BASE|GRAPH|PREFIX)\b/i
]
});
Prism.languages.rq = Prism.languages.sparql;
Prism.languages["splunk-spl"] = {
"comment": /`comment\("(?:\\.|[^\\"])*"\)`/,
"string": {
pattern: /"(?:\\.|[^\\"])*"/,
greedy: true
},
// https://docs.splunk.com/Documentation/Splunk/7.3.0/SearchReference/ListOfSearchCommands
"keyword": /\b(?:abstract|accum|addcoltotals|addinfo|addtotals|analyzefields|anomalies|anomalousvalue|anomalydetection|append|appendcols|appendcsv|appendlookup|appendpipe|arules|associate|audit|autoregress|bin|bucket|bucketdir|chart|cluster|cofilter|collect|concurrency|contingency|convert|correlate|datamodel|dbinspect|dedup|delete|delta|diff|erex|eval|eventcount|eventstats|extract|fieldformat|fields|fieldsummary|filldown|fillnull|findtypes|folderize|foreach|format|from|gauge|gentimes|geom|geomfilter|geostats|head|highlight|history|iconify|input|inputcsv|inputlookup|iplocation|join|kmeans|kv|kvform|loadjob|localize|localop|lookup|makecontinuous|makemv|makeresults|map|mcollect|metadata|metasearch|meventcollect|mstats|multikv|multisearch|mvcombine|mvexpand|nomv|outlier|outputcsv|outputlookup|outputtext|overlap|pivot|predict|rangemap|rare|regex|relevancy|reltime|rename|replace|rest|return|reverse|rex|rtorder|run|savedsearch|script|scrub|search|searchtxn|selfjoin|sendemail|set|setfields|sichart|sirare|sistats|sitimechart|sitop|sort|spath|stats|strcat|streamstats|table|tags|tail|timechart|timewrap|top|transaction|transpose|trendline|tscollect|tstats|typeahead|typelearner|typer|union|uniq|untable|where|x11|xmlkv|xmlunescape|xpath|xyseries)\b/i,
"operator-word": {
pattern: /\b(?:and|as|by|not|or|xor)\b/i,
alias: "operator"
},
"function": /\b\w+(?=\s*\()/,
"property": /\b\w+(?=\s*=(?!=))/,
"date": {
// MM/DD/YYYY(:HH:MM:SS)?
pattern: /\b\d{1,2}\/\d{1,2}\/\d{1,4}(?:(?::\d{1,2}){3})?\b/,
alias: "number"
},
"number": /\b\d+(?:\.\d+)?\b/,
"boolean": /\b(?:f|false|t|true)\b/i,
"operator": /[<>=]=?|[-+*/%|]/,
"punctuation": /[()[\],]/
};
Prism.languages.sqf = Prism.languages.extend("clike", {
"string": {
pattern: /"(?:(?:"")?[^"])*"(?!")|'(?:[^'])*'/,
greedy: true
},
"keyword": /\b(?:breakOut|breakTo|call|case|catch|default|do|echo|else|execFSM|execVM|exitWith|for|forEach|forEachMember|forEachMemberAgent|forEachMemberTeam|from|goto|if|nil|preprocessFile|preprocessFileLineNumbers|private|scopeName|spawn|step|switch|then|throw|to|try|while|with)\b/i,
"boolean": /\b(?:false|true)\b/i,
"function": /\b(?:abs|accTime|acos|action|actionIDs|actionKeys|actionKeysImages|actionKeysNames|actionKeysNamesArray|actionName|actionParams|activateAddons|activatedAddons|activateKey|add3DENConnection|add3DENEventHandler|add3DENLayer|addAction|addBackpack|addBackpackCargo|addBackpackCargoGlobal|addBackpackGlobal|addCamShake|addCuratorAddons|addCuratorCameraArea|addCuratorEditableObjects|addCuratorEditingArea|addCuratorPoints|addEditorObject|addEventHandler|addForce|addForceGeneratorRTD|addGoggles|addGroupIcon|addHandgunItem|addHeadgear|addItem|addItemCargo|addItemCargoGlobal|addItemPool|addItemToBackpack|addItemToUniform|addItemToVest|addLiveStats|addMagazine|addMagazineAmmoCargo|addMagazineCargo|addMagazineCargoGlobal|addMagazineGlobal|addMagazinePool|addMagazines|addMagazineTurret|addMenu|addMenuItem|addMissionEventHandler|addMPEventHandler|addMusicEventHandler|addOwnedMine|addPlayerScores|addPrimaryWeaponItem|addPublicVariableEventHandler|addRating|addResources|addScore|addScoreSide|addSecondaryWeaponItem|addSwitchableUnit|addTeamMember|addToRemainsCollector|addTorque|addUniform|addVehicle|addVest|addWaypoint|addWeapon|addWeaponCargo|addWeaponCargoGlobal|addWeaponGlobal|addWeaponItem|addWeaponPool|addWeaponTurret|admin|agent|agents|AGLToASL|aimedAtTarget|aimPos|airDensityCurveRTD|airDensityRTD|airplaneThrottle|airportSide|AISFinishHeal|alive|all3DENEntities|allAirports|allControls|allCurators|allCutLayers|allDead|allDeadMen|allDisplays|allGroups|allMapMarkers|allMines|allMissionObjects|allow3DMode|allowCrewInImmobile|allowCuratorLogicIgnoreAreas|allowDamage|allowDammage|allowFileOperations|allowFleeing|allowGetIn|allowSprint|allPlayers|allSimpleObjects|allSites|allTurrets|allUnits|allUnitsUAV|allVariables|ammo|ammoOnPylon|animate|animateBay|animateDoor|animatePylon|animateSource|animationNames|animationPhase|animationSourcePhase|animationState|append|apply|armoryPoints|arrayIntersect|asin|ASLToAGL|ASLToATL|assert|assignAsCargo|assignAsCargoIndex|assignAsCommander|assignAsDriver|assignAsGunner|assignAsTurret|assignCurator|assignedCargo|assignedCommander|assignedDriver|assignedGunner|assignedItems|assignedTarget|assignedTeam|assignedVehicle|assignedVehicleRole|assignItem|assignTeam|assignToAirport|atan|atan2|atg|ATLToASL|attachedObject|attachedObjects|attachedTo|attachObject|attachTo|attackEnabled|backpack|backpackCargo|backpackContainer|backpackItems|backpackMagazines|backpackSpaceFor|behaviour|benchmark|binocular|blufor|boundingBox|boundingBoxReal|boundingCenter|briefingName|buildingExit|buildingPos|buldozer_EnableRoadDiag|buldozer_IsEnabledRoadDiag|buldozer_LoadNewRoads|buldozer_reloadOperMap|buttonAction|buttonSetAction|cadetMode|callExtension|camCommand|camCommit|camCommitPrepared|camCommitted|camConstuctionSetParams|camCreate|camDestroy|cameraEffect|cameraEffectEnableHUD|cameraInterest|cameraOn|cameraView|campaignConfigFile|camPreload|camPreloaded|camPrepareBank|camPrepareDir|camPrepareDive|camPrepareFocus|camPrepareFov|camPrepareFovRange|camPreparePos|camPrepareRelPos|camPrepareTarget|camSetBank|camSetDir|camSetDive|camSetFocus|camSetFov|camSetFovRange|camSetPos|camSetRelPos|camSetTarget|camTarget|camUseNVG|canAdd|canAddItemToBackpack|canAddItemToUniform|canAddItemToVest|cancelSimpleTaskDestination|canFire|canMove|canSlingLoad|canStand|canSuspend|canTriggerDynamicSimulation|canUnloadInCombat|canVehicleCargo|captive|captiveNum|cbChecked|cbSetChecked|ceil|channelEnabled|cheatsEnabled|checkAIFeature|checkVisibility|civilian|className|clear3DENAttribute|clear3DENInventory|clearAllItemsFromBackpack|clearBackpackCargo|clearBackpackCargoGlobal|clearForcesRTD|clearGroupIcons|clearItemCargo|clearItemCargoGlobal|clearItemPool|clearMagazineCargo|clearMagazineCargoGlobal|clearMagazinePool|clearOverlay|clearRadio|clearVehicleInit|clearWeaponCargo|clearWeaponCargoGlobal|clearWeaponPool|clientOwner|closeDialog|closeDisplay|closeOverlay|collapseObjectTree|collect3DENHistory|collectiveRTD|combatMode|commandArtilleryFire|commandChat|commander|commandFire|commandFollow|commandFSM|commandGetOut|commandingMenu|commandMove|commandRadio|commandStop|commandSuppressiveFire|commandTarget|commandWatch|comment|commitOverlay|compile|compileFinal|completedFSM|composeText|configClasses|configFile|configHierarchy|configName|configNull|configProperties|configSourceAddonList|configSourceMod|configSourceModList|confirmSensorTarget|connectTerminalToUAV|controlNull|controlsGroupCtrl|copyFromClipboard|copyToClipboard|copyWaypoints|cos|count|countEnemy|countFriendly|countSide|countType|countUnknown|create3DENComposition|create3DENEntity|createAgent|createCenter|createDialog|createDiaryLink|createDiaryRecord|createDiarySubject|createDisplay|createGearDialog|createGroup|createGuardedPoint|createLocation|createMarker|createMarkerLocal|createMenu|createMine|createMissionDisplay|createMPCampaignDisplay|createSimpleObject|createSimpleTask|createSite|createSoundSource|createTask|createTeam|createTrigger|createUnit|createVehicle|createVehicleCrew|createVehicleLocal|crew|ctAddHeader|ctAddRow|ctClear|ctCurSel|ctData|ctFindHeaderRows|ctFindRowHeader|ctHeaderControls|ctHeaderCount|ctRemoveHeaders|ctRemoveRows|ctrlActivate|ctrlAddEventHandler|ctrlAngle|ctrlAutoScrollDelay|ctrlAutoScrollRewind|ctrlAutoScrollSpeed|ctrlChecked|ctrlClassName|ctrlCommit|ctrlCommitted|ctrlCreate|ctrlDelete|ctrlEnable|ctrlEnabled|ctrlFade|ctrlHTMLLoaded|ctrlIDC|ctrlIDD|ctrlMapAnimAdd|ctrlMapAnimClear|ctrlMapAnimCommit|ctrlMapAnimDone|ctrlMapCursor|ctrlMapMouseOver|ctrlMapScale|ctrlMapScreenToWorld|ctrlMapWorldToScreen|ctrlModel|ctrlModelDirAndUp|ctrlModelScale|ctrlParent|ctrlParentControlsGroup|ctrlPosition|ctrlRemoveAllEventHandlers|ctrlRemoveEventHandler|ctrlScale|ctrlSetActiveColor|ctrlSetAngle|ctrlSetAutoScrollDelay|ctrlSetAutoScrollRewind|ctrlSetAutoScrollSpeed|ctrlSetBackgroundColor|ctrlSetChecked|ctrlSetDisabledColor|ctrlSetEventHandler|ctrlSetFade|ctrlSetFocus|ctrlSetFont|ctrlSetFontH1|ctrlSetFontH1B|ctrlSetFontH2|ctrlSetFontH2B|ctrlSetFontH3|ctrlSetFontH3B|ctrlSetFontH4|ctrlSetFontH4B|ctrlSetFontH5|ctrlSetFontH5B|ctrlSetFontH6|ctrlSetFontH6B|ctrlSetFontHeight|ctrlSetFontHeightH1|ctrlSetFontHeightH2|ctrlSetFontHeightH3|ctrlSetFontHeightH4|ctrlSetFontHeightH5|ctrlSetFontHeightH6|ctrlSetFontHeightSecondary|ctrlSetFontP|ctrlSetFontPB|ctrlSetFontSecondary|ctrlSetForegroundColor|ctrlSetModel|ctrlSetModelDirAndUp|ctrlSetModelScale|ctrlSetPixelPrecision|ctrlSetPosition|ctrlSetScale|ctrlSetStructuredText|ctrlSetText|ctrlSetTextColor|ctrlSetTextColorSecondary|ctrlSetTextSecondary|ctrlSetTooltip|ctrlSetTooltipColorBox|ctrlSetTooltipColorShade|ctrlSetTooltipColorText|ctrlShow|ctrlShown|ctrlText|ctrlTextHeight|ctrlTextSecondary|ctrlTextWidth|ctrlType|ctrlVisible|ctRowControls|ctRowCount|ctSetCurSel|ctSetData|ctSetHeaderTemplate|ctSetRowTemplate|ctSetValue|ctValue|curatorAddons|curatorCamera|curatorCameraArea|curatorCameraAreaCeiling|curatorCoef|curatorEditableObjects|curatorEditingArea|curatorEditingAreaType|curatorMouseOver|curatorPoints|curatorRegisteredObjects|curatorSelected|curatorWaypointCost|current3DENOperation|currentChannel|currentCommand|currentMagazine|currentMagazineDetail|currentMagazineDetailTurret|currentMagazineTurret|currentMuzzle|currentNamespace|currentTask|currentTasks|currentThrowable|currentVisionMode|currentWaypoint|currentWeapon|currentWeaponMode|currentWeaponTurret|currentZeroing|cursorObject|cursorTarget|customChat|customRadio|cutFadeOut|cutObj|cutRsc|cutText|damage|date|dateToNumber|daytime|deActivateKey|debriefingText|debugFSM|debugLog|deg|delete3DENEntities|deleteAt|deleteCenter|deleteCollection|deleteEditorObject|deleteGroup|deleteGroupWhenEmpty|deleteIdentity|deleteLocation|deleteMarker|deleteMarkerLocal|deleteRange|deleteResources|deleteSite|deleteStatus|deleteTeam|deleteVehicle|deleteVehicleCrew|deleteWaypoint|detach|detectedMines|diag_activeMissionFSMs|diag_activeScripts|diag_activeSQFScripts|diag_activeSQSScripts|diag_captureFrame|diag_captureFrameToFile|diag_captureSlowFrame|diag_codePerformance|diag_drawMode|diag_dynamicSimulationEnd|diag_enable|diag_enabled|diag_fps|diag_fpsMin|diag_frameNo|diag_lightNewLoad|diag_list|diag_log|diag_logSlowFrame|diag_mergeConfigFile|diag_recordTurretLimits|diag_setLightNew|diag_tickTime|diag_toggle|dialog|diarySubjectExists|didJIP|didJIPOwner|difficulty|difficultyEnabled|difficultyEnabledRTD|difficultyOption|direction|directSay|disableAI|disableCollisionWith|disableConversation|disableDebriefingStats|disableMapIndicators|disableNVGEquipment|disableRemoteSensors|disableSerialization|disableTIEquipment|disableUAVConnectability|disableUserInput|displayAddEventHandler|displayCtrl|displayNull|displayParent|displayRemoveAllEventHandlers|displayRemoveEventHandler|displaySetEventHandler|dissolveTeam|distance|distance2D|distanceSqr|distributionRegion|do3DENAction|doArtilleryFire|doFire|doFollow|doFSM|doGetOut|doMove|doorPhase|doStop|doSuppressiveFire|doTarget|doWatch|drawArrow|drawEllipse|drawIcon|drawIcon3D|drawLine|drawLine3D|drawLink|drawLocation|drawPolygon|drawRectangle|drawTriangle|driver|drop|dynamicSimulationDistance|dynamicSimulationDistanceCoef|dynamicSimulationEnabled|dynamicSimulationSystemEnabled|east|edit3DENMissionAttributes|editObject|editorSetEventHandler|effectiveCommander|emptyPositions|enableAI|enableAIFeature|enableAimPrecision|enableAttack|enableAudioFeature|enableAutoStartUpRTD|enableAutoTrimRTD|enableCamShake|enableCaustics|enableChannel|enableCollisionWith|enableCopilot|enableDebriefingStats|enableDiagLegend|enableDynamicSimulation|enableDynamicSimulationSystem|enableEndDialog|enableEngineArtillery|enableEnvironment|enableFatigue|enableGunLights|enableInfoPanelComponent|enableIRLasers|enableMimics|enablePersonTurret|enableRadio|enableReload|enableRopeAttach|enableSatNormalOnDetail|enableSaving|enableSentences|enableSimulation|enableSimulationGlobal|enableStamina|enableStressDamage|enableTeamSwitch|enableTraffic|enableUAVConnectability|enableUAVWaypoints|enableVehicleCargo|enableVehicleSensor|enableWeaponDisassembly|endl|endLoadingScreen|endMission|engineOn|enginesIsOnRTD|enginesPowerRTD|enginesRpmRTD|enginesTorqueRTD|entities|environmentEnabled|estimatedEndServerTime|estimatedTimeLeft|evalObjectArgument|everyBackpack|everyContainer|exec|execEditorScript|exp|expectedDestination|exportJIPMessages|eyeDirection|eyePos|face|faction|fadeMusic|fadeRadio|fadeSound|fadeSpeech|failMission|fillWeaponsFromPool|find|findCover|findDisplay|findEditorObject|findEmptyPosition|findEmptyPositionReady|findIf|findNearestEnemy|finishMissionInit|finite|fire|fireAtTarget|firstBackpack|flag|flagAnimationPhase|flagOwner|flagSide|flagTexture|fleeing|floor|flyInHeight|flyInHeightASL|fog|fogForecast|fogParams|forceAddUniform|forceAtPositionRTD|forcedMap|forceEnd|forceFlagTexture|forceFollowRoad|forceGeneratorRTD|forceMap|forceRespawn|forceSpeed|forceWalk|forceWeaponFire|forceWeatherChange|forgetTarget|format|formation|formationDirection|formationLeader|formationMembers|formationPosition|formationTask|formatText|formLeader|freeLook|fromEditor|fuel|fullCrew|gearIDCAmmoCount|gearSlotAmmoCount|gearSlotData|get3DENActionState|get3DENAttribute|get3DENCamera|get3DENConnections|get3DENEntity|get3DENEntityID|get3DENGrid|get3DENIconsVisible|get3DENLayerEntities|get3DENLinesVisible|get3DENMissionAttribute|get3DENMouseOver|get3DENSelected|getAimingCoef|getAllEnvSoundControllers|getAllHitPointsDamage|getAllOwnedMines|getAllSoundControllers|getAmmoCargo|getAnimAimPrecision|getAnimSpeedCoef|getArray|getArtilleryAmmo|getArtilleryComputerSettings|getArtilleryETA|getAssignedCuratorLogic|getAssignedCuratorUnit|getBackpackCargo|getBleedingRemaining|getBurningValue|getCameraViewDirection|getCargoIndex|getCenterOfMass|getClientState|getClientStateNumber|getCompatiblePylonMagazines|getConnectedUAV|getContainerMaxLoad|getCursorObjectParams|getCustomAimCoef|getDammage|getDescription|getDir|getDirVisual|getDLCAssetsUsage|getDLCAssetsUsageByName|getDLCs|getDLCUsageTime|getEditorCamera|getEditorMode|getEditorObjectScope|getElevationOffset|getEngineTargetRpmRTD|getEnvSoundController|getFatigue|getFieldManualStartPage|getForcedFlagTexture|getFriend|getFSMVariable|getFuelCargo|getGroupIcon|getGroupIconParams|getGroupIcons|getHideFrom|getHit|getHitIndex|getHitPointDamage|getItemCargo|getMagazineCargo|getMarkerColor|getMarkerPos|getMarkerSize|getMarkerType|getMass|getMissionConfig|getMissionConfigValue|getMissionDLCs|getMissionLayerEntities|getMissionLayers|getModelInfo|getMousePosition|getMusicPlayedTime|getNumber|getObjectArgument|getObjectChildren|getObjectDLC|getObjectMaterials|getObjectProxy|getObjectTextures|getObjectType|getObjectViewDistance|getOxygenRemaining|getPersonUsedDLCs|getPilotCameraDirection|getPilotCameraPosition|getPilotCameraRotation|getPilotCameraTarget|getPlateNumber|getPlayerChannel|getPlayerScores|getPlayerUID|getPlayerUIDOld|getPos|getPosASL|getPosASLVisual|getPosASLW|getPosATL|getPosATLVisual|getPosVisual|getPosWorld|getPylonMagazines|getRelDir|getRelPos|getRemoteSensorsDisabled|getRepairCargo|getResolution|getRotorBrakeRTD|getShadowDistance|getShotParents|getSlingLoad|getSoundController|getSoundControllerResult|getSpeed|getStamina|getStatValue|getSuppression|getTerrainGrid|getTerrainHeightASL|getText|getTotalDLCUsageTime|getTrimOffsetRTD|getUnitLoadout|getUnitTrait|getUserMFDText|getUserMFDValue|getVariable|getVehicleCargo|getWeaponCargo|getWeaponSway|getWingsOrientationRTD|getWingsPositionRTD|getWPPos|glanceAt|globalChat|globalRadio|goggles|group|groupChat|groupFromNetId|groupIconSelectable|groupIconsVisible|groupId|groupOwner|groupRadio|groupSelectedUnits|groupSelectUnit|grpNull|gunner|gusts|halt|handgunItems|handgunMagazine|handgunWeapon|handsHit|hasInterface|hasPilotCamera|hasWeapon|hcAllGroups|hcGroupParams|hcLeader|hcRemoveAllGroups|hcRemoveGroup|hcSelected|hcSelectGroup|hcSetGroup|hcShowBar|hcShownBar|headgear|hideBody|hideObject|hideObjectGlobal|hideSelection|hint|hintC|hintCadet|hintSilent|hmd|hostMission|htmlLoad|HUDMovementLevels|humidity|image|importAllGroups|importance|in|inArea|inAreaArray|incapacitatedState|independent|inflame|inflamed|infoPanel|infoPanelComponentEnabled|infoPanelComponents|infoPanels|inGameUISetEventHandler|inheritsFrom|initAmbientLife|inPolygon|inputAction|inRangeOfArtillery|insertEditorObject|intersect|is3DEN|is3DENMultiplayer|isAbleToBreathe|isAgent|isAimPrecisionEnabled|isArray|isAutoHoverOn|isAutonomous|isAutoStartUpEnabledRTD|isAutotest|isAutoTrimOnRTD|isBleeding|isBurning|isClass|isCollisionLightOn|isCopilotEnabled|isDamageAllowed|isDedicated|isDLCAvailable|isEngineOn|isEqualTo|isEqualType|isEqualTypeAll|isEqualTypeAny|isEqualTypeArray|isEqualTypeParams|isFilePatchingEnabled|isFlashlightOn|isFlatEmpty|isForcedWalk|isFormationLeader|isGroupDeletedWhenEmpty|isHidden|isInRemainsCollector|isInstructorFigureEnabled|isIRLaserOn|isKeyActive|isKindOf|isLaserOn|isLightOn|isLocalized|isManualFire|isMarkedForCollection|isMultiplayer|isMultiplayerSolo|isNil|isNull|isNumber|isObjectHidden|isObjectRTD|isOnRoad|isPipEnabled|isPlayer|isRealTime|isRemoteExecuted|isRemoteExecutedJIP|isServer|isShowing3DIcons|isSimpleObject|isSprintAllowed|isStaminaEnabled|isSteamMission|isStreamFriendlyUIEnabled|isStressDamageEnabled|isText|isTouchingGround|isTurnedOut|isTutHintsEnabled|isUAVConnectable|isUAVConnected|isUIContext|isUniformAllowed|isVehicleCargo|isVehicleRadarOn|isVehicleSensorEnabled|isWalking|isWeaponDeployed|isWeaponRested|itemCargo|items|itemsWithMagazines|join|joinAs|joinAsSilent|joinSilent|joinString|kbAddDatabase|kbAddDatabaseTargets|kbAddTopic|kbHasTopic|kbReact|kbRemoveTopic|kbTell|kbWasSaid|keyImage|keyName|knowsAbout|land|landAt|landResult|language|laserTarget|lbAdd|lbClear|lbColor|lbColorRight|lbCurSel|lbData|lbDelete|lbIsSelected|lbPicture|lbPictureRight|lbSelection|lbSetColor|lbSetColorRight|lbSetCurSel|lbSetData|lbSetPicture|lbSetPictureColor|lbSetPictureColorDisabled|lbSetPictureColorSelected|lbSetPictureRight|lbSetPictureRightColor|lbSetPictureRightColorDisabled|lbSetPictureRightColorSelected|lbSetSelectColor|lbSetSelectColorRight|lbSetSelected|lbSetText|lbSetTextRight|lbSetTooltip|lbSetValue|lbSize|lbSort|lbSortByValue|lbText|lbTextRight|lbValue|leader|leaderboardDeInit|leaderboardGetRows|leaderboardInit|leaderboardRequestRowsFriends|leaderboardRequestRowsGlobal|leaderboardRequestRowsGlobalAroundUser|leaderboardsRequestUploadScore|leaderboardsRequestUploadScoreKeepBest|leaderboardState|leaveVehicle|libraryCredits|libraryDisclaimers|lifeState|lightAttachObject|lightDetachObject|lightIsOn|lightnings|limitSpeed|linearConversion|lineBreak|lineIntersects|lineIntersectsObjs|lineIntersectsSurfaces|lineIntersectsWith|linkItem|list|listObjects|listRemoteTargets|listVehicleSensors|ln|lnbAddArray|lnbAddColumn|lnbAddRow|lnbClear|lnbColor|lnbColorRight|lnbCurSelRow|lnbData|lnbDeleteColumn|lnbDeleteRow|lnbGetColumnsPosition|lnbPicture|lnbPictureRight|lnbSetColor|lnbSetColorRight|lnbSetColumnsPos|lnbSetCurSelRow|lnbSetData|lnbSetPicture|lnbSetPictureColor|lnbSetPictureColorRight|lnbSetPictureColorSelected|lnbSetPictureColorSelectedRight|lnbSetPictureRight|lnbSetText|lnbSetTextRight|lnbSetValue|lnbSize|lnbSort|lnbSortByValue|lnbText|lnbTextRight|lnbValue|load|loadAbs|loadBackpack|loadFile|loadGame|loadIdentity|loadMagazine|loadOverlay|loadStatus|loadUniform|loadVest|local|localize|locationNull|locationPosition|lock|lockCameraTo|lockCargo|lockDriver|locked|lockedCargo|lockedDriver|lockedTurret|lockIdentity|lockTurret|lockWP|log|logEntities|logNetwork|logNetworkTerminate|lookAt|lookAtPos|magazineCargo|magazines|magazinesAllTurrets|magazinesAmmo|magazinesAmmoCargo|magazinesAmmoFull|magazinesDetail|magazinesDetailBackpack|magazinesDetailUniform|magazinesDetailVest|magazinesTurret|magazineTurretAmmo|mapAnimAdd|mapAnimClear|mapAnimCommit|mapAnimDone|mapCenterOnCamera|mapGridPosition|markAsFinishedOnSteam|markerAlpha|markerBrush|markerColor|markerDir|markerPos|markerShape|markerSize|markerText|markerType|max|members|menuAction|menuAdd|menuChecked|menuClear|menuCollapse|menuData|menuDelete|menuEnable|menuEnabled|menuExpand|menuHover|menuPicture|menuSetAction|menuSetCheck|menuSetData|menuSetPicture|menuSetValue|menuShortcut|menuShortcutText|menuSize|menuSort|menuText|menuURL|menuValue|min|mineActive|mineDetectedBy|missionConfigFile|missionDifficulty|missionName|missionNamespace|missionStart|missionVersion|modelToWorld|modelToWorldVisual|modelToWorldVisualWorld|modelToWorldWorld|modParams|moonIntensity|moonPhase|morale|move|move3DENCamera|moveInAny|moveInCargo|moveInCommander|moveInDriver|moveInGunner|moveInTurret|moveObjectToEnd|moveOut|moveTime|moveTo|moveToCompleted|moveToFailed|musicVolume|name|nameSound|nearEntities|nearestBuilding|nearestLocation|nearestLocations|nearestLocationWithDubbing|nearestObject|nearestObjects|nearestTerrainObjects|nearObjects|nearObjectsReady|nearRoads|nearSupplies|nearTargets|needReload|netId|netObjNull|newOverlay|nextMenuItemIndex|nextWeatherChange|nMenuItems|numberOfEnginesRTD|numberToDate|objectCurators|objectFromNetId|objectParent|objNull|objStatus|onBriefingGear|onBriefingGroup|onBriefingNotes|onBriefingPlan|onBriefingTeamSwitch|onCommandModeChanged|onDoubleClick|onEachFrame|onGroupIconClick|onGroupIconOverEnter|onGroupIconOverLeave|onHCGroupSelectionChanged|onMapSingleClick|onPlayerConnected|onPlayerDisconnected|onPreloadFinished|onPreloadStarted|onShowNewObject|onTeamSwitch|openCuratorInterface|openDLCPage|openDSInterface|openMap|openSteamApp|openYoutubeVideo|opfor|orderGetIn|overcast|overcastForecast|owner|param|params|parseNumber|parseSimpleArray|parseText|parsingNamespace|particlesQuality|pi|pickWeaponPool|pitch|pixelGrid|pixelGridBase|pixelGridNoUIScale|pixelH|pixelW|playableSlotsNumber|playableUnits|playAction|playActionNow|player|playerRespawnTime|playerSide|playersNumber|playGesture|playMission|playMove|playMoveNow|playMusic|playScriptedMission|playSound|playSound3D|position|positionCameraToWorld|posScreenToWorld|posWorldToScreen|ppEffectAdjust|ppEffectCommit|ppEffectCommitted|ppEffectCreate|ppEffectDestroy|ppEffectEnable|ppEffectEnabled|ppEffectForceInNVG|precision|preloadCamera|preloadObject|preloadSound|preloadTitleObj|preloadTitleRsc|primaryWeapon|primaryWeaponItems|primaryWeaponMagazine|priority|processDiaryLink|processInitCommands|productVersion|profileName|profileNamespace|profileNameSteam|progressLoadingScreen|progressPosition|progressSetPosition|publicVariable|publicVariableClient|publicVariableServer|pushBack|pushBackUnique|putWeaponPool|queryItemsPool|queryMagazinePool|queryWeaponPool|rad|radioChannelAdd|radioChannelCreate|radioChannelRemove|radioChannelSetCallSign|radioChannelSetLabel|radioVolume|rain|rainbow|random|rank|rankId|rating|rectangular|registeredTasks|registerTask|reload|reloadEnabled|remoteControl|remoteExec|remoteExecCall|remoteExecutedOwner|remove3DENConnection|remove3DENEventHandler|remove3DENLayer|removeAction|removeAll3DENEventHandlers|removeAllActions|removeAllAssignedItems|removeAllContainers|removeAllCuratorAddons|removeAllCuratorCameraAreas|removeAllCuratorEditingAreas|removeAllEventHandlers|removeAllHandgunItems|removeAllItems|removeAllItemsWithMagazines|removeAllMissionEventHandlers|removeAllMPEventHandlers|removeAllMusicEventHandlers|removeAllOwnedMines|removeAllPrimaryWeaponItems|removeAllWeapons|removeBackpack|removeBackpackGlobal|removeCuratorAddons|removeCuratorCameraArea|removeCuratorEditableObjects|removeCuratorEditingArea|removeDrawIcon|removeDrawLinks|removeEventHandler|removeFromRemainsCollector|removeGoggles|removeGroupIcon|removeHandgunItem|removeHeadgear|removeItem|removeItemFromBackpack|removeItemFromUniform|removeItemFromVest|removeItems|removeMagazine|removeMagazineGlobal|removeMagazines|removeMagazinesTurret|removeMagazineTurret|removeMenuItem|removeMissionEventHandler|removeMPEventHandler|removeMusicEventHandler|removeOwnedMine|removePrimaryWeaponItem|removeSecondaryWeaponItem|removeSimpleTask|removeSwitchableUnit|removeTeamMember|removeUniform|removeVest|removeWeapon|removeWeaponAttachmentCargo|removeWeaponCargo|removeWeaponGlobal|removeWeaponTurret|reportRemoteTarget|requiredVersion|resetCamShake|resetSubgroupDirection|resistance|resize|resources|respawnVehicle|restartEditorCamera|reveal|revealMine|reverse|reversedMouseY|roadAt|roadsConnectedTo|roleDescription|ropeAttachedObjects|ropeAttachedTo|ropeAttachEnabled|ropeAttachTo|ropeCreate|ropeCut|ropeDestroy|ropeDetach|ropeEndPosition|ropeLength|ropes|ropeUnwind|ropeUnwound|rotorsForcesRTD|rotorsRpmRTD|round|runInitScript|safeZoneH|safeZoneW|safeZoneWAbs|safeZoneX|safeZoneXAbs|safeZoneY|save3DENInventory|saveGame|saveIdentity|saveJoysticks|saveOverlay|saveProfileNamespace|saveStatus|saveVar|savingEnabled|say|say2D|say3D|score|scoreSide|screenshot|screenToWorld|scriptDone|scriptName|scriptNull|scudState|secondaryWeapon|secondaryWeaponItems|secondaryWeaponMagazine|select|selectBestPlaces|selectDiarySubject|selectedEditorObjects|selectEditorObject|selectionNames|selectionPosition|selectLeader|selectMax|selectMin|selectNoPlayer|selectPlayer|selectRandom|selectRandomWeighted|selectWeapon|selectWeaponTurret|sendAUMessage|sendSimpleCommand|sendTask|sendTaskResult|sendUDPMessage|serverCommand|serverCommandAvailable|serverCommandExecutable|serverName|serverTime|set|set3DENAttribute|set3DENAttributes|set3DENGrid|set3DENIconsVisible|set3DENLayer|set3DENLinesVisible|set3DENLogicType|set3DENMissionAttribute|set3DENMissionAttributes|set3DENModelsVisible|set3DENObjectType|set3DENSelected|setAccTime|setActualCollectiveRTD|setAirplaneThrottle|setAirportSide|setAmmo|setAmmoCargo|setAmmoOnPylon|setAnimSpeedCoef|setAperture|setApertureNew|setArmoryPoints|setAttributes|setAutonomous|setBehaviour|setBleedingRemaining|setBrakesRTD|setCameraInterest|setCamShakeDefParams|setCamShakeParams|setCamUseTI|setCaptive|setCenterOfMass|setCollisionLight|setCombatMode|setCompassOscillation|setConvoySeparation|setCuratorCameraAreaCeiling|setCuratorCoef|setCuratorEditingAreaType|setCuratorWaypointCost|setCurrentChannel|setCurrentTask|setCurrentWaypoint|setCustomAimCoef|setCustomWeightRTD|setDamage|setDammage|setDate|setDebriefingText|setDefaultCamera|setDestination|setDetailMapBlendPars|setDir|setDirection|setDrawIcon|setDriveOnPath|setDropInterval|setDynamicSimulationDistance|setDynamicSimulationDistanceCoef|setEditorMode|setEditorObjectScope|setEffectCondition|setEngineRpmRTD|setFace|setFaceAnimation|setFatigue|setFeatureType|setFlagAnimationPhase|setFlagOwner|setFlagSide|setFlagTexture|setFog|setForceGeneratorRTD|setFormation|setFormationTask|setFormDir|setFriend|setFromEditor|setFSMVariable|setFuel|setFuelCargo|setGroupIcon|setGroupIconParams|setGroupIconsSelectable|setGroupIconsVisible|setGroupId|setGroupIdGlobal|setGroupOwner|setGusts|setHideBehind|setHit|setHitIndex|setHitPointDamage|setHorizonParallaxCoef|setHUDMovementLevels|setIdentity|setImportance|setInfoPanel|setLeader|setLightAmbient|setLightAttenuation|setLightBrightness|setLightColor|setLightDayLight|setLightFlareMaxDistance|setLightFlareSize|setLightIntensity|setLightnings|setLightUseFlare|setLocalWindParams|setMagazineTurretAmmo|setMarkerAlpha|setMarkerAlphaLocal|setMarkerBrush|setMarkerBrushLocal|setMarkerColor|setMarkerColorLocal|setMarkerDir|setMarkerDirLocal|setMarkerPos|setMarkerPosLocal|setMarkerShape|setMarkerShapeLocal|setMarkerSize|setMarkerSizeLocal|setMarkerText|setMarkerTextLocal|setMarkerType|setMarkerTypeLocal|setMass|setMimic|setMousePosition|setMusicEffect|setMusicEventHandler|setName|setNameSound|setObjectArguments|setObjectMaterial|setObjectMaterialGlobal|setObjectProxy|setObjectTexture|setObjectTextureGlobal|setObjectViewDistance|setOvercast|setOwner|setOxygenRemaining|setParticleCircle|setParticleClass|setParticleFire|setParticleParams|setParticleRandom|setPilotCameraDirection|setPilotCameraRotation|setPilotCameraTarget|setPilotLight|setPiPEffect|setPitch|setPlateNumber|setPlayable|setPlayerRespawnTime|setPos|setPosASL|setPosASL2|setPosASLW|setPosATL|setPosition|setPosWorld|setPylonLoadOut|setPylonsPriority|setRadioMsg|setRain|setRainbow|setRandomLip|setRank|setRectangular|setRepairCargo|setRotorBrakeRTD|setShadowDistance|setShotParents|setSide|setSimpleTaskAlwaysVisible|setSimpleTaskCustomData|setSimpleTaskDescription|setSimpleTaskDestination|setSimpleTaskTarget|setSimpleTaskType|setSimulWeatherLayers|setSize|setSkill|setSlingLoad|setSoundEffect|setSpeaker|setSpeech|setSpeedMode|setStamina|setStaminaScheme|setStatValue|setSuppression|setSystemOfUnits|setTargetAge|setTaskMarkerOffset|setTaskResult|setTaskState|setTerrainGrid|setText|setTimeMultiplier|setTitleEffect|setToneMapping|setToneMappingParams|setTrafficDensity|setTrafficDistance|setTrafficGap|setTrafficSpeed|setTriggerActivation|setTriggerArea|setTriggerStatements|setTriggerText|setTriggerTimeout|setTriggerType|setType|setUnconscious|setUnitAbility|setUnitLoadout|setUnitPos|setUnitPosWeak|setUnitRank|setUnitRecoilCoefficient|setUnitTrait|setUnloadInCombat|setUserActionText|setUserMFDText|setUserMFDValue|setVariable|setVectorDir|setVectorDirAndUp|setVectorUp|setVehicleAmmo|setVehicleAmmoDef|setVehicleArmor|setVehicleCargo|setVehicleId|setVehicleInit|setVehicleLock|setVehiclePosition|setVehicleRadar|setVehicleReceiveRemoteTargets|setVehicleReportOwnPosition|setVehicleReportRemoteTargets|setVehicleTIPars|setVehicleVarName|setVelocity|setVelocityModelSpace|setVelocityTransformation|setViewDistance|setVisibleIfTreeCollapsed|setWantedRpmRTD|setWaves|setWaypointBehaviour|setWaypointCombatMode|setWaypointCompletionRadius|setWaypointDescription|setWaypointForceBehaviour|setWaypointFormation|setWaypointHousePosition|setWaypointLoiterRadius|setWaypointLoiterType|setWaypointName|setWaypointPosition|setWaypointScript|setWaypointSpeed|setWaypointStatements|setWaypointTimeout|setWaypointType|setWaypointVisible|setWeaponReloadingTime|setWind|setWindDir|setWindForce|setWindStr|setWingForceScaleRTD|setWPPos|show3DIcons|showChat|showCinemaBorder|showCommandingMenu|showCompass|showCuratorCompass|showGPS|showHUD|showLegend|showMap|shownArtilleryComputer|shownChat|shownCompass|shownCuratorCompass|showNewEditorObject|shownGPS|shownHUD|shownMap|shownPad|shownRadio|shownScoretable|shownUAVFeed|shownWarrant|shownWatch|showPad|showRadio|showScoretable|showSubtitles|showUAVFeed|showWarrant|showWatch|showWaypoint|showWaypoints|side|sideAmbientLife|sideChat|sideEmpty|sideEnemy|sideFriendly|sideLogic|sideRadio|sideUnknown|simpleTasks|simulationEnabled|simulCloudDensity|simulCloudOcclusion|simulInClouds|simulWeatherSync|sin|size|sizeOf|skill|skillFinal|skipTime|sleep|sliderPosition|sliderRange|sliderSetPosition|sliderSetRange|sliderSetSpeed|sliderSpeed|slingLoadAssistantShown|soldierMagazines|someAmmo|sort|soundVolume|speaker|speed|speedMode|splitString|sqrt|squadParams|stance|startLoadingScreen|stop|stopEngineRTD|stopped|str|sunOrMoon|supportInfo|suppressFor|surfaceIsWater|surfaceNormal|surfaceType|swimInDepth|switchableUnits|switchAction|switchCamera|switchGesture|switchLight|switchMove|synchronizedObjects|synchronizedTriggers|synchronizedWaypoints|synchronizeObjectsAdd|synchronizeObjectsRemove|synchronizeTrigger|synchronizeWaypoint|systemChat|systemOfUnits|tan|targetKnowledge|targets|targetsAggregate|targetsQuery|taskAlwaysVisible|taskChildren|taskCompleted|taskCustomData|taskDescription|taskDestination|taskHint|taskMarkerOffset|taskNull|taskParent|taskResult|taskState|taskType|teamMember|teamMemberNull|teamName|teams|teamSwitch|teamSwitchEnabled|teamType|terminate|terrainIntersect|terrainIntersectASL|terrainIntersectAtASL|text|textLog|textLogFormat|tg|time|timeMultiplier|titleCut|titleFadeOut|titleObj|titleRsc|titleText|toArray|toFixed|toLower|toString|toUpper|triggerActivated|triggerActivation|triggerArea|triggerAttachedVehicle|triggerAttachObject|triggerAttachVehicle|triggerDynamicSimulation|triggerStatements|triggerText|triggerTimeout|triggerTimeoutCurrent|triggerType|turretLocal|turretOwner|turretUnit|tvAdd|tvClear|tvCollapse|tvCollapseAll|tvCount|tvCurSel|tvData|tvDelete|tvExpand|tvExpandAll|tvPicture|tvPictureRight|tvSetColor|tvSetCurSel|tvSetData|tvSetPicture|tvSetPictureColor|tvSetPictureColorDisabled|tvSetPictureColorSelected|tvSetPictureRight|tvSetPictureRightColor|tvSetPictureRightColorDisabled|tvSetPictureRightColorSelected|tvSetSelectColor|tvSetText|tvSetTooltip|tvSetValue|tvSort|tvSortByValue|tvText|tvTooltip|tvValue|type|typeName|typeOf|UAVControl|uiNamespace|uiSleep|unassignCurator|unassignItem|unassignTeam|unassignVehicle|underwater|uniform|uniformContainer|uniformItems|uniformMagazines|unitAddons|unitAimPosition|unitAimPositionVisual|unitBackpack|unitIsUAV|unitPos|unitReady|unitRecoilCoefficient|units|unitsBelowHeight|unlinkItem|unlockAchievement|unregisterTask|updateDrawIcon|updateMenuItem|updateObjectTree|useAIOperMapObstructionTest|useAISteeringComponent|useAudioTimeForMoves|userInputDisabled|vectorAdd|vectorCos|vectorCrossProduct|vectorDiff|vectorDir|vectorDirVisual|vectorDistance|vectorDistanceSqr|vectorDotProduct|vectorFromTo|vectorMagnitude|vectorMagnitudeSqr|vectorModelToWorld|vectorModelToWorldVisual|vectorMultiply|vectorNormalized|vectorUp|vectorUpVisual|vectorWorldToModel|vectorWorldToModelVisual|vehicle|vehicleCargoEnabled|vehicleChat|vehicleRadio|vehicleReceiveRemoteTargets|vehicleReportOwnPosition|vehicleReportRemoteTargets|vehicles|vehicleVarName|velocity|velocityModelSpace|verifySignature|vest|vestContainer|vestItems|vestMagazines|viewDistance|visibleCompass|visibleGPS|visibleMap|visiblePosition|visiblePositionASL|visibleScoretable|visibleWatch|waitUntil|waves|waypointAttachedObject|waypointAttachedVehicle|waypointAttachObject|waypointAttachVehicle|waypointBehaviour|waypointCombatMode|waypointCompletionRadius|waypointDescription|waypointForceBehaviour|waypointFormation|waypointHousePosition|waypointLoiterRadius|waypointLoiterType|waypointName|waypointPosition|waypoints|waypointScript|waypointsEnabledUAV|waypointShow|waypointSpeed|waypointStatements|waypointTimeout|waypointTimeoutCurrent|waypointType|waypointVisible|weaponAccessories|weaponAccessoriesCargo|weaponCargo|weaponDirection|weaponInertia|weaponLowered|weapons|weaponsItems|weaponsItemsCargo|weaponState|weaponsTurret|weightRTD|west|WFSideText|wind|windDir|windRTD|windStr|wingsForcesRTD|worldName|worldSize|worldToModel|worldToModelVisual|worldToScreen)\b/i,
"number": /(?:\$|\b0x)[\da-f]+\b|(?:\B\.\d+|\b\d+(?:\.\d+)?)(?:e[+-]?\d+)?\b/i,
"operator": /##|>>|&&|\|\||[!=<>]=?|[-+*/%#^]|\b(?:and|mod|not|or)\b/i,
"magic-variable": {
pattern: /\b(?:this|thisList|thisTrigger|_exception|_fnc_scriptName|_fnc_scriptNameParent|_forEachIndex|_this|_thisEventHandler|_thisFSM|_thisScript|_x)\b/i,
alias: "keyword"
},
"constant": /\bDIK(?:_[a-z\d]+)+\b/i
});
Prism.languages.insertBefore("sqf", "string", {
"macro": {
pattern: /(^[ \t]*)#[a-z](?:[^\r\n\\]|\\(?:\r\n|[\s\S]))*/im,
lookbehind: true,
greedy: true,
alias: "property",
inside: {
"directive": {
pattern: /#[a-z]+\b/i,
alias: "keyword"
},
"comment": Prism.languages.sqf.comment
}
}
});
delete Prism.languages.sqf["class-name"];
Prism.languages.squirrel = Prism.languages.extend("clike", {
"comment": [
Prism.languages.clike["comment"][0],
{
pattern: /(^|[^\\:])(?:\/\/|#).*/,
lookbehind: true,
greedy: true
}
],
"string": {
pattern: /(^|[^\\"'@])(?:@"(?:[^"]|"")*"(?!")|"(?:[^\\\r\n"]|\\.)*")/,
lookbehind: true,
greedy: true
},
"class-name": {
pattern: /(\b(?:class|enum|extends|instanceof)\s+)\w+(?:\.\w+)*/,
lookbehind: true,
inside: {
"punctuation": /\./
}
},
"keyword": /\b(?:__FILE__|__LINE__|base|break|case|catch|class|clone|const|constructor|continue|default|delete|else|enum|extends|for|foreach|function|if|in|instanceof|local|null|resume|return|static|switch|this|throw|try|typeof|while|yield)\b/,
"number": /\b(?:0x[0-9a-fA-F]+|\d+(?:\.(?:\d+|[eE][+-]?\d+))?)\b/,
"operator": /\+\+|--|<=>|<[-<]|>>>?|&&?|\|\|?|[-+*/%!=<>]=?|[~^]|::?/,
"punctuation": /[(){}\[\],;.]/
});
Prism.languages.insertBefore("squirrel", "string", {
"char": {
pattern: /(^|[^\\"'])'(?:[^\\']|\\(?:[xuU][0-9a-fA-F]{0,8}|[\s\S]))'/,
lookbehind: true,
greedy: true
}
});
Prism.languages.insertBefore("squirrel", "operator", {
"attribute-punctuation": {
pattern: /<\/|\/>/,
alias: "important"
},
"lambda": {
pattern: /@(?=\()/,
alias: "operator"
}
});
(function(Prism2) {
var higherOrderFunctions = /\b(?:algebra_solver|algebra_solver_newton|integrate_1d|integrate_ode|integrate_ode_bdf|integrate_ode_rk45|map_rect|ode_(?:adams|bdf|ckrk|rk45)(?:_tol)?|ode_adjoint_tol_ctl|reduce_sum|reduce_sum_static)\b/;
Prism2.languages.stan = {
"comment": /\/\/.*|\/\*[\s\S]*?\*\/|#(?!include).*/,
"string": {
// String literals can contain spaces and any printable ASCII characters except for " and \
// https://mc-stan.org/docs/2_24/reference-manual/print-statements-section.html#string-literals
pattern: /"[\x20\x21\x23-\x5B\x5D-\x7E]*"/,
greedy: true
},
"directive": {
pattern: /^([ \t]*)#include\b.*/m,
lookbehind: true,
alias: "property"
},
"function-arg": {
pattern: RegExp(
"(" + higherOrderFunctions.source + /\s*\(\s*/.source + ")" + /[a-zA-Z]\w*/.source
),
lookbehind: true,
alias: "function"
},
"constraint": {
pattern: /(\b(?:int|matrix|real|row_vector|vector)\s*)<[^<>]*>/,
lookbehind: true,
inside: {
"expression": {
pattern: /(=\s*)\S(?:\S|\s+(?!\s))*?(?=\s*(?:>$|,\s*\w+\s*=))/,
lookbehind: true,
inside: null
// see below
},
"property": /\b[a-z]\w*(?=\s*=)/i,
"operator": /=/,
"punctuation": /^<|>$|,/
}
},
"keyword": [
{
pattern: /\bdata(?=\s*\{)|\b(?:functions|generated|model|parameters|quantities|transformed)\b/,
alias: "program-block"
},
/\b(?:array|break|cholesky_factor_corr|cholesky_factor_cov|complex|continue|corr_matrix|cov_matrix|data|else|for|if|in|increment_log_prob|int|matrix|ordered|positive_ordered|print|real|reject|return|row_vector|simplex|target|unit_vector|vector|void|while)\b/,
// these are functions that are known to take another function as their first argument.
higherOrderFunctions
],
"function": /\b[a-z]\w*(?=\s*\()/i,
"number": /(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:E[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,
"boolean": /\b(?:false|true)\b/,
"operator": /<-|\.[*/]=?|\|\|?|&&|[!=<>+\-*/]=?|['^%~?:]/,
"punctuation": /[()\[\]{},;]/
};
Prism2.languages.stan.constraint.inside.expression.inside = Prism2.languages.stan;
})(Prism);
Prism.languages.stata = {
"comment": [
{
pattern: /(^[ \t]*)\*.*/m,
lookbehind: true,
greedy: true
},
{
pattern: /(^|\s)\/\/.*|\/\*[\s\S]*?\*\//,
lookbehind: true,
greedy: true
}
],
"string-literal": {
pattern: /"[^"\r\n]*"|[‘`']".*?"[’`']/,
greedy: true,
inside: {
"interpolation": {
pattern: /\$\{[^{}]*\}|[‘`']\w[^’`'\r\n]*[’`']/,
inside: {
"punctuation": /^\$\{|\}$/,
"expression": {
pattern: /[\s\S]+/,
inside: null
// see below
}
}
},
"string": /[\s\S]+/
}
},
"mata": {
pattern: /(^[ \t]*mata[ \t]*:)[\s\S]+?(?=^end\b)/m,
lookbehind: true,
greedy: true,
alias: "language-mata",
inside: Prism.languages.mata
},
"java": {
pattern: /(^[ \t]*java[ \t]*:)[\s\S]+?(?=^end\b)/m,
lookbehind: true,
greedy: true,
alias: "language-java",
inside: Prism.languages.java
},
"python": {
pattern: /(^[ \t]*python[ \t]*:)[\s\S]+?(?=^end\b)/m,
lookbehind: true,
greedy: true,
alias: "language-python",
inside: Prism.languages.python
},
"command": {
pattern: /(^[ \t]*(?:\.[ \t]+)?(?:(?:bayes|bootstrap|by|bysort|capture|collect|fmm|fp|frame|jackknife|mfp|mi|nestreg|noisily|permute|quietly|rolling|simulate|statsby|stepwise|svy|version|xi)\b[^:\r\n]*:[ \t]*|(?:capture|noisily|quietly|version)[ \t]+)?)[a-zA-Z]\w*/m,
lookbehind: true,
greedy: true,
alias: "keyword"
},
"variable": /\$\w+|[‘`']\w[^’`'\r\n]*[’`']/,
"keyword": /\b(?:bayes|bootstrap|by|bysort|capture|clear|collect|fmm|fp|frame|if|in|jackknife|mi[ \t]+estimate|mfp|nestreg|noisily|of|permute|quietly|rolling|simulate|sort|statsby|stepwise|svy|varlist|version|xi)\b/,
"boolean": /\b(?:off|on)\b/,
"number": /\b\d+(?:\.\d+)?\b|\B\.\d+/,
"function": /\b[a-z_]\w*(?=\()/i,
"operator": /\+\+|--|##?|[<>!=~]=?|[+\-*^&|/]/,
"punctuation": /[(){}[\],:]/
};
Prism.languages.stata["string-literal"].inside.interpolation.inside.expression.inside = Prism.languages.stata;
Prism.languages.iecst = {
"comment": [
{
pattern: /(^|[^\\])(?:\/\*[\s\S]*?(?:\*\/|$)|\(\*[\s\S]*?(?:\*\)|$)|\{[\s\S]*?(?:\}|$))/,
lookbehind: true,
greedy: true
},
{
pattern: /(^|[^\\:])\/\/.*/,
lookbehind: true,
greedy: true
}
],
"string": {
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
greedy: true
},
"keyword": [
/\b(?:END_)?(?:PROGRAM|CONFIGURATION|INTERFACE|FUNCTION_BLOCK|FUNCTION|ACTION|TRANSITION|TYPE|STRUCT|(?:INITIAL_)?STEP|NAMESPACE|LIBRARY|CHANNEL|FOLDER|RESOURCE|VAR_(?:ACCESS|CONFIG|EXTERNAL|GLOBAL|INPUT|IN_OUT|OUTPUT|TEMP)|VAR|METHOD|PROPERTY)\b/i,
/\b(?:AT|BY|(?:END_)?(?:CASE|FOR|IF|REPEAT|WHILE)|CONSTANT|CONTINUE|DO|ELSE|ELSIF|EXIT|EXTENDS|FROM|GET|GOTO|IMPLEMENTS|JMP|NON_RETAIN|OF|PRIVATE|PROTECTED|PUBLIC|RETAIN|RETURN|SET|TASK|THEN|TO|UNTIL|USING|WITH|__CATCH|__ENDTRY|__FINALLY|__TRY)\b/
],
"class-name": /\b(?:ANY|ARRAY|BOOL|BYTE|U?(?:D|L|S)?INT|(?:D|L)?WORD|DATE(?:_AND_TIME)?|DT|L?REAL|POINTER|STRING|TIME(?:_OF_DAY)?|TOD)\b/,
"address": {
pattern: /%[IQM][XBWDL][\d.]*|%[IQ][\d.]*/,
alias: "symbol"
},
"number": /\b(?:16#[\da-f]+|2#[01_]+|0x[\da-f]+)\b|\b(?:D|DT|T|TOD)#[\d_shmd:]*|\b[A-Z]*#[\d.,_]*|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
"boolean": /\b(?:FALSE|NULL|TRUE)\b/,
"operator": /S?R?:?=>?|&&?|\*\*?|<[=>]?|>=?|[-:^/+#]|\b(?:AND|EQ|EXPT|GE|GT|LE|LT|MOD|NE|NOT|OR|XOR)\b/,
"function": /\b[a-z_]\w*(?=\s*\()/i,
"punctuation": /[()[\].,;]/
};
(function(Prism2) {
var unit = {
pattern: /(\b\d+)(?:%|[a-z]+)/,
lookbehind: true
};
var number = {
pattern: /(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,
lookbehind: true
};
var inside = {
"comment": {
pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
lookbehind: true
},
"url": {
pattern: /\burl\((["']?).*?\1\)/i,
greedy: true
},
"string": {
pattern: /("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,
greedy: true
},
"interpolation": null,
// See below
"func": null,
// See below
"important": /\B!(?:important|optional)\b/i,
"keyword": {
pattern: /(^|\s+)(?:(?:else|for|if|return|unless)(?=\s|$)|@[\w-]+)/,
lookbehind: true
},
"hexcode": /#[\da-f]{3,6}/i,
"color": [
/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,
{
pattern: /\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,
inside: {
"unit": unit,
"number": number,
"function": /[\w-]+(?=\()/,
"punctuation": /[(),]/
}
}
],
"entity": /\\[\da-f]{1,8}/i,
"unit": unit,
"boolean": /\b(?:false|true)\b/,
"operator": [
// We want non-word chars around "-" because it is
// accepted in property names.
/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.{2,3}|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/
],
"number": number,
"punctuation": /[{}()\[\];:,]/
};
inside["interpolation"] = {
pattern: /\{[^\r\n}:]+\}/,
alias: "variable",
inside: {
"delimiter": {
pattern: /^\{|\}$/,
alias: "punctuation"
},
rest: inside
}
};
inside["func"] = {
pattern: /[\w-]+\([^)]*\).*/,
inside: {
"function": /^[^(]+/,
rest: inside
}
};
Prism2.languages.stylus = {
"atrule-declaration": {
pattern: /(^[ \t]*)@.+/m,
lookbehind: true,
inside: {
"atrule": /^@[\w-]+/,
rest: inside
}
},
"variable-declaration": {
pattern: /(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:\{[^{}]*\}|\S.*|$)/m,
lookbehind: true,
inside: {
"variable": /^\S+/,
rest: inside
}
},
"statement": {
pattern: /(^[ \t]*)(?:else|for|if|return|unless)[ \t].+/m,
lookbehind: true,
inside: {
"keyword": /^\S+/,
rest: inside
}
},
// A property/value pair cannot end with a comma or a brace
// It cannot have indented content unless it ended with a semicolon
"property-declaration": {
pattern: /((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)(?!\s)[^{\r\n]*(?:;|[^{\r\n,]$(?!(?:\r?\n|\r)(?:\{|\2[ \t])))/m,
lookbehind: true,
inside: {
"property": {
pattern: /^[^\s:]+/,
inside: {
"interpolation": inside.interpolation
}
},
rest: inside
}
},
// A selector can contain parentheses only as part of a pseudo-element
// It can span multiple lines.
// It must end with a comma or an accolade or have indented content.
"selector": {
pattern: /(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t])))/m,
lookbehind: true,
inside: {
"interpolation": inside.interpolation,
"comment": inside.comment,
"punctuation": /[{},]/
}
},
"func": inside.func,
"string": inside.string,
"comment": {
pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
lookbehind: true,
greedy: true
},
"interpolation": inside.interpolation,
"punctuation": /[{}()\[\];:.]/
};
})(Prism);
Prism.languages.supercollider = {
"comment": {
pattern: /\/\/.*|\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\//,
greedy: true
},
"string": {
pattern: /(^|[^\\])"(?:[^"\\]|\\[\s\S])*"/,
lookbehind: true,
greedy: true
},
"char": {
pattern: /\$(?:[^\\\r\n]|\\.)/,
greedy: true
},
"symbol": {
pattern: /(^|[^\\])'(?:[^'\\]|\\[\s\S])*'|\\\w+/,
lookbehind: true,
greedy: true
},
"keyword": /\b(?:_|arg|classvar|const|nil|var|while)\b/,
"boolean": /\b(?:false|true)\b/,
"label": {
pattern: /\b[a-z_]\w*(?=\s*:)/,
alias: "property"
},
"number": /\b(?:inf|pi|0x[0-9a-fA-F]+|\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(?:pi)?|\d+r[0-9a-zA-Z]+(?:\.[0-9a-zA-Z]+)?|\d+[sb]{1,4}\d*)\b/,
"class-name": /\b[A-Z]\w*\b/,
"operator": /\.{2,3}|#(?![[{])|&&|[!=]==?|\+>>|\+{1,3}|-[->]|=>|>>|\?\?|@\|?@|\|(?:@|[!=]=)?\||!\?|<[!=>]|\*{1,2}|<{2,3}\*?|[-!%&/<>?@|=`]/,
"punctuation": /[{}()[\].:,;]|#[[{]/
};
Prism.languages.sclang = Prism.languages.supercollider;
Prism.languages.swift = {
"comment": {
// Nested comments are supported up to 2 levels
pattern: /(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,
lookbehind: true,
greedy: true
},
"string-literal": [
// https://docs.swift.org/swift-book/LanguageGuide/StringsAndCharacters.html
{
pattern: RegExp(
/(^|[^"#])/.source + "(?:" + /"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source + "|" + /"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source + ")" + /(?!["#])/.source
),
lookbehind: true,
greedy: true,
inside: {
"interpolation": {
pattern: /(\\\()(?:[^()]|\([^()]*\))*(?=\))/,
lookbehind: true,
inside: null
// see below
},
"interpolation-punctuation": {
pattern: /^\)|\\\($/,
alias: "punctuation"
},
"punctuation": /\\(?=[\r\n])/,
"string": /[\s\S]+/
}
},
{
pattern: RegExp(
/(^|[^"#])(#+)/.source + "(?:" + /"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source + "|" + /"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source + ")\\2"
),
lookbehind: true,
greedy: true,
inside: {
"interpolation": {
pattern: /(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,
lookbehind: true,
inside: null
// see below
},
"interpolation-punctuation": {
pattern: /^\)|\\#+\($/,
alias: "punctuation"
},
"string": /[\s\S]+/
}
}
],
"directive": {
// directives with conditions
pattern: RegExp(
/#/.source + "(?:" + (/(?:elseif|if)\b/.source + "(?:[ ]*" + /(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source + ")+") + "|" + /(?:else|endif)\b/.source + ")"
),
alias: "property",
inside: {
"directive-name": /^#\w+/,
"boolean": /\b(?:false|true)\b/,
"number": /\b\d+(?:\.\d+)*\b/,
"operator": /!|&&|\|\||[<>]=?/,
"punctuation": /[(),]/
}
},
"literal": {
pattern: /#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,
alias: "constant"
},
"other-directive": {
pattern: /#\w+\b/,
alias: "property"
},
"attribute": {
pattern: /@\w+/,
alias: "atrule"
},
"function-definition": {
pattern: /(\bfunc\s+)\w+/,
lookbehind: true,
alias: "function"
},
"label": {
// https://docs.swift.org/swift-book/LanguageGuide/ControlFlow.html#ID141
pattern: /\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,
lookbehind: true,
alias: "important"
},
"keyword": /\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,
"boolean": /\b(?:false|true)\b/,
"nil": {
pattern: /\bnil\b/,
alias: "constant"
},
"short-argument": /\$\d+\b/,
"omit": {
pattern: /\b_\b/,
alias: "keyword"
},
"number": /\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,
// A class name must start with an upper-case letter and be either 1 letter long or contain a lower-case letter.
"class-name": /\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,
"function": /\b[a-z_]\w*(?=\s*\()/i,
"constant": /\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,
// Operators are generic in Swift. Developers can even create new operators (e.g. +++).
// https://docs.swift.org/swift-book/ReferenceManual/zzSummaryOfTheGrammar.html#ID481
// This regex only supports ASCII operators.
"operator": /[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,
"punctuation": /[{}[\]();,.:\\]/
};
Prism.languages.swift["string-literal"].forEach(function(rule) {
rule.inside["interpolation"].inside = Prism.languages.swift;
});
(function(Prism2) {
var comment = {
pattern: /^[;#].*/m,
greedy: true
};
var quotesSource = /"(?:[^\r\n"\\]|\\(?:[^\r]|\r\n?))*"(?!\S)/.source;
Prism2.languages.systemd = {
"comment": comment,
"section": {
pattern: /^\[[^\n\r\[\]]*\](?=[ \t]*$)/m,
greedy: true,
inside: {
"punctuation": /^\[|\]$/,
"section-name": {
pattern: /[\s\S]+/,
alias: "selector"
}
}
},
"key": {
pattern: /^[^\s=]+(?=[ \t]*=)/m,
greedy: true,
alias: "attr-name"
},
"value": {
// This pattern is quite complex because of two properties:
// 1) Quotes (strings) must be preceded by a space. Since we can't use lookbehinds, we have to "resolve"
// the lookbehind. You will see this in the main loop where spaces are handled separately.
// 2) Line continuations.
// After line continuations, empty lines and comments are ignored so we have to consume them.
pattern: RegExp(
/(=[ \t]*(?!\s))/.source + // the value either starts with quotes or not
"(?:" + quotesSource + '|(?=[^"\r\n]))(?:' + (/[^\s\\]/.source + // handle spaces separately because of quotes
'|[ ]+(?:(?![ "])|' + quotesSource + ")|" + /\\[\r\n]+(?:[#;].*[\r\n]+)*(?![#;])/.source) + ")*"
),
lookbehind: true,
greedy: true,
alias: "attr-value",
inside: {
"comment": comment,
"quoted": {
pattern: RegExp(/(^|\s)/.source + quotesSource),
lookbehind: true,
greedy: true
},
"punctuation": /\\$/m,
"boolean": {
pattern: /^(?:false|no|off|on|true|yes)$/,
greedy: true
}
}
},
"punctuation": /=/
};
})(Prism);
(function(Prism2) {
function createBlock(prefix, inside, contentAlias) {
return {
pattern: RegExp("<#" + prefix + "[\\s\\S]*?#>"),
alias: "block",
inside: {
"delimiter": {
pattern: RegExp("^<#" + prefix + "|#>$"),
alias: "important"
},
"content": {
pattern: /[\s\S]+/,
inside,
alias: contentAlias
}
}
};
}
function createT4(insideLang) {
var grammar = Prism2.languages[insideLang];
var className = "language-" + insideLang;
return {
"block": {
pattern: /<#[\s\S]+?#>/,
inside: {
"directive": createBlock("@", {
"attr-value": {
pattern: /=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/,
inside: {
"punctuation": /^=|^["']|["']$/
}
},
"keyword": /\b\w+(?=\s)/,
"attr-name": /\b\w+/
}),
"expression": createBlock("=", grammar, className),
"class-feature": createBlock("\\+", grammar, className),
"standard": createBlock("", grammar, className)
}
}
};
}
Prism2.languages["t4-templating"] = Object.defineProperty({}, "createT4", { value: createT4 });
})(Prism);
Prism.languages.t4 = Prism.languages["t4-cs"] = Prism.languages["t4-templating"].createT4("csharp");
Prism.languages.vbnet = Prism.languages.extend("basic", {
"comment": [
{
pattern: /(?:!|REM\b).+/i,
inside: {
"keyword": /^REM/i
}
},
{
pattern: /(^|[^\\:])'.*/,
lookbehind: true,
greedy: true
}
],
"string": {
pattern: /(^|[^"])"(?:""|[^"])*"(?!")/,
lookbehind: true,
greedy: true
},
"keyword": /(?:\b(?:ADDHANDLER|ADDRESSOF|ALIAS|AND|ANDALSO|AS|BEEP|BLOAD|BOOLEAN|BSAVE|BYREF|BYTE|BYVAL|CALL(?: ABSOLUTE)?|CASE|CATCH|CBOOL|CBYTE|CCHAR|CDATE|CDBL|CDEC|CHAIN|CHAR|CHDIR|CINT|CLASS|CLEAR|CLNG|CLOSE|CLS|COBJ|COM|COMMON|CONST|CONTINUE|CSBYTE|CSHORT|CSNG|CSTR|CTYPE|CUINT|CULNG|CUSHORT|DATA|DATE|DECIMAL|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DEFAULT|DELEGATE|DIM|DIRECTCAST|DO|DOUBLE|ELSE|ELSEIF|END|ENUM|ENVIRON|ERASE|ERROR|EVENT|EXIT|FALSE|FIELD|FILES|FINALLY|FOR(?: EACH)?|FRIEND|FUNCTION|GET|GETTYPE|GETXMLNAMESPACE|GLOBAL|GOSUB|GOTO|HANDLES|IF|IMPLEMENTS|IMPORTS|IN|INHERITS|INPUT|INTEGER|INTERFACE|IOCTL|IS|ISNOT|KEY|KILL|LET|LIB|LIKE|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|ME|MKDIR|MOD|MODULE|MUSTINHERIT|MUSTOVERRIDE|MYBASE|MYCLASS|NAME|NAMESPACE|NARROWING|NEW|NEXT|NOT|NOTHING|NOTINHERITABLE|NOTOVERRIDABLE|OBJECT|OF|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPERATOR|OPTION(?: BASE)?|OPTIONAL|OR|ORELSE|OUT|OVERLOADS|OVERRIDABLE|OVERRIDES|PARAMARRAY|PARTIAL|POKE|PRIVATE|PROPERTY|PROTECTED|PUBLIC|PUT|RAISEEVENT|READ|READONLY|REDIM|REM|REMOVEHANDLER|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SBYTE|SELECT(?: CASE)?|SET|SHADOWS|SHARED|SHELL|SHORT|SINGLE|SLEEP|STATIC|STEP|STOP|STRING|STRUCTURE|SUB|SWAP|SYNCLOCK|SYSTEM|THEN|THROW|TIMER|TO|TROFF|TRON|TRUE|TRY|TRYCAST|TYPE|TYPEOF|UINTEGER|ULONG|UNLOCK|UNTIL|USHORT|USING|VIEW PRINT|WAIT|WEND|WHEN|WHILE|WIDENING|WITH|WITHEVENTS|WRITE|WRITEONLY|XOR)|\B(?:#CONST|#ELSE|#ELSEIF|#END|#IF))(?:\$|\b)/i,
"punctuation": /[,;:(){}]/
});
Prism.languages["t4-vb"] = Prism.languages["t4-templating"].createT4("vbnet");
(function(Prism2) {
var anchorOrAlias = /[*&][^\s[\]{},]+/;
var tag = /!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/;
var properties = "(?:" + tag.source + "(?:[ ]+" + anchorOrAlias.source + ")?|" + anchorOrAlias.source + "(?:[ ]+" + tag.source + ")?)";
var plainKey = /(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g, function() {
return /[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source;
});
var string = /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;
function createValuePattern(value, flags) {
flags = (flags || "").replace(/m/g, "") + "m";
var pattern = /([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g, function() {
return properties;
}).replace(/<<value>>/g, function() {
return value;
});
return RegExp(pattern, flags);
}
Prism2.languages.yaml = {
"scalar": {
pattern: RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g, function() {
return properties;
})),
lookbehind: true,
alias: "string"
},
"comment": /#.*/,
"key": {
pattern: RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g, function() {
return properties;
}).replace(/<<key>>/g, function() {
return "(?:" + plainKey + "|" + string + ")";
})),
lookbehind: true,
greedy: true,
alias: "atrule"
},
"directive": {
pattern: /(^[ \t]*)%.+/m,
lookbehind: true,
alias: "important"
},
"datetime": {
pattern: createValuePattern(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),
lookbehind: true,
alias: "number"
},
"boolean": {
pattern: createValuePattern(/false|true/.source, "i"),
lookbehind: true,
alias: "important"
},
"null": {
pattern: createValuePattern(/null|~/.source, "i"),
lookbehind: true,
alias: "important"
},
"string": {
pattern: createValuePattern(string),
lookbehind: true,
greedy: true
},
"number": {
pattern: createValuePattern(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source, "i"),
lookbehind: true
},
"tag": tag,
"important": anchorOrAlias,
"punctuation": /---|[:[\]{}\-,|>?]|\.\.\./
};
Prism2.languages.yml = Prism2.languages.yaml;
})(Prism);
Prism.languages.tap = {
"fail": /not ok[^#{\n\r]*/,
"pass": /ok[^#{\n\r]*/,
"pragma": /pragma [+-][a-z]+/,
"bailout": /bail out!.*/i,
"version": /TAP version \d+/i,
"plan": /\b\d+\.\.\d+(?: +#.*)?/,
"subtest": {
pattern: /# Subtest(?:: .*)?/,
greedy: true
},
"punctuation": /[{}]/,
"directive": /#.*/,
"yamlish": {
pattern: /(^[ \t]*)---[\s\S]*?[\r\n][ \t]*\.\.\.$/m,
lookbehind: true,
inside: Prism.languages.yaml,
alias: "language-yaml"
}
};
Prism.languages.tcl = {
"comment": {
pattern: /(^|[^\\])#.*/,
lookbehind: true
},
"string": {
pattern: /"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"/,
greedy: true
},
"variable": [
{
pattern: /(\$)(?:::)?(?:[a-zA-Z0-9]+::)*\w+/,
lookbehind: true
},
{
pattern: /(\$)\{[^}]+\}/,
lookbehind: true
},
{
pattern: /(^[\t ]*set[ \t]+)(?:::)?(?:[a-zA-Z0-9]+::)*\w+/m,
lookbehind: true
}
],
"function": {
pattern: /(^[\t ]*proc[ \t]+)\S+/m,
lookbehind: true
},
"builtin": [
{
pattern: /(^[\t ]*)(?:break|class|continue|error|eval|exit|for|foreach|if|proc|return|switch|while)\b/m,
lookbehind: true
},
/\b(?:else|elseif)\b/
],
"scope": {
pattern: /(^[\t ]*)(?:global|upvar|variable)\b/m,
lookbehind: true,
alias: "constant"
},
"keyword": {
pattern: /(^[\t ]*|\[)(?:Safe_Base|Tcl|after|append|apply|array|auto_(?:execok|import|load|mkindex|qualify|reset)|automkindex_old|bgerror|binary|catch|cd|chan|clock|close|concat|dde|dict|encoding|eof|exec|expr|fblocked|fconfigure|fcopy|file(?:event|name)?|flush|gets|glob|history|http|incr|info|interp|join|lappend|lassign|lindex|linsert|list|llength|load|lrange|lrepeat|lreplace|lreverse|lsearch|lset|lsort|math(?:func|op)|memory|msgcat|namespace|open|package|parray|pid|pkg_mkIndex|platform|puts|pwd|re_syntax|read|refchan|regexp|registry|regsub|rename|scan|seek|set|socket|source|split|string|subst|tcl(?:_endOfWord|_findLibrary|startOf(?:Next|Previous)Word|test|vars|wordBreak(?:After|Before))|tell|time|tm|trace|unknown|unload|unset|update|uplevel|vwait)\b/m,
lookbehind: true
},
"operator": /!=?|\*\*?|==|&&?|\|\|?|<[=<]?|>[=>]?|[-+~\/%?^]|\b(?:eq|in|ne|ni)\b/,
"punctuation": /[{}()\[\]]/
};
(function(Prism2) {
Prism2.languages.tt2 = Prism2.languages.extend("clike", {
"comment": /#.*|\[%#[\s\S]*?%\]/,
"keyword": /\b(?:BLOCK|CALL|CASE|CATCH|CLEAR|DEBUG|DEFAULT|ELSE|ELSIF|END|FILTER|FINAL|FOREACH|GET|IF|IN|INCLUDE|INSERT|LAST|MACRO|META|NEXT|PERL|PROCESS|RAWPERL|RETURN|SET|STOP|SWITCH|TAGS|THROW|TRY|UNLESS|USE|WHILE|WRAPPER)\b/,
"punctuation": /[[\]{},()]/
});
Prism2.languages.insertBefore("tt2", "number", {
"operator": /=[>=]?|!=?|<=?|>=?|&&|\|\|?|\b(?:and|not|or)\b/,
"variable": {
pattern: /\b[a-z]\w*(?:\s*\.\s*(?:\d+|\$?[a-z]\w*))*\b/i
}
});
Prism2.languages.insertBefore("tt2", "keyword", {
"delimiter": {
pattern: /^(?:\[%|%%)-?|-?%\]$/,
alias: "punctuation"
}
});
Prism2.languages.insertBefore("tt2", "string", {
"single-quoted-string": {
pattern: /'[^\\']*(?:\\[\s\S][^\\']*)*'/,
greedy: true,
alias: "string"
},
"double-quoted-string": {
pattern: /"[^\\"]*(?:\\[\s\S][^\\"]*)*"/,
greedy: true,
alias: "string",
inside: {
"variable": {
pattern: /\$(?:[a-z]\w*(?:\.(?:\d+|\$?[a-z]\w*))*)/i
}
}
}
});
delete Prism2.languages.tt2.string;
Prism2.hooks.add("before-tokenize", function(env) {
var tt2Pattern = /\[%[\s\S]+?%\]/g;
Prism2.languages["markup-templating"].buildPlaceholders(env, "tt2", tt2Pattern);
});
Prism2.hooks.add("after-tokenize", function(env) {
Prism2.languages["markup-templating"].tokenizePlaceholders(env, "tt2");
});
})(Prism);
(function(Prism2) {
var modifierRegex = /\([^|()\n]+\)|\[[^\]\n]+\]|\{[^}\n]+\}/.source;
var parenthesesRegex = /\)|\((?![^|()\n]+\))/.source;
function withModifier(source, flags) {
return RegExp(
source.replace(/<MOD>/g, function() {
return "(?:" + modifierRegex + ")";
}).replace(/<PAR>/g, function() {
return "(?:" + parenthesesRegex + ")";
}),
flags || ""
);
}
var modifierTokens = {
"css": {
pattern: /\{[^{}]+\}/,
inside: {
rest: Prism2.languages.css
}
},
"class-id": {
pattern: /(\()[^()]+(?=\))/,
lookbehind: true,
alias: "attr-value"
},
"lang": {
pattern: /(\[)[^\[\]]+(?=\])/,
lookbehind: true,
alias: "attr-value"
},
// Anything else is punctuation (the first pattern is for row/col spans inside tables)
"punctuation": /[\\\/]\d+|\S/
};
var textile = Prism2.languages.textile = Prism2.languages.extend("markup", {
"phrase": {
pattern: /(^|\r|\n)\S[\s\S]*?(?=$|\r?\n\r?\n|\r\r)/,
lookbehind: true,
inside: {
// h1. Header 1
"block-tag": {
pattern: withModifier(/^[a-z]\w*(?:<MOD>|<PAR>|[<>=])*\./.source),
inside: {
"modifier": {
pattern: withModifier(/(^[a-z]\w*)(?:<MOD>|<PAR>|[<>=])+(?=\.)/.source),
lookbehind: true,
inside: modifierTokens
},
"tag": /^[a-z]\w*/,
"punctuation": /\.$/
}
},
// # List item
// * List item
"list": {
pattern: withModifier(/^[*#]+<MOD>*\s+\S.*/.source, "m"),
inside: {
"modifier": {
pattern: withModifier(/(^[*#]+)<MOD>+/.source),
lookbehind: true,
inside: modifierTokens
},
"punctuation": /^[*#]+/
}
},
// | cell | cell | cell |
"table": {
// Modifiers can be applied to the row: {color:red}.|1|2|3|
// or the cell: |{color:red}.1|2|3|
pattern: withModifier(/^(?:(?:<MOD>|<PAR>|[<>=^~])+\.\s*)?(?:\|(?:(?:<MOD>|<PAR>|[<>=^~_]|[\\/]\d+)+\.|(?!(?:<MOD>|<PAR>|[<>=^~_]|[\\/]\d+)+\.))[^|]*)+\|/.source, "m"),
inside: {
"modifier": {
// Modifiers for rows after the first one are
// preceded by a pipe and a line feed
pattern: withModifier(/(^|\|(?:\r?\n|\r)?)(?:<MOD>|<PAR>|[<>=^~_]|[\\/]\d+)+(?=\.)/.source),
lookbehind: true,
inside: modifierTokens
},
"punctuation": /\||^\./
}
},
"inline": {
// eslint-disable-next-line regexp/no-super-linear-backtracking
pattern: withModifier(/(^|[^a-zA-Z\d])(\*\*|__|\?\?|[*_%@+\-^~])<MOD>*.+?\2(?![a-zA-Z\d])/.source),
lookbehind: true,
inside: {
// Note: superscripts and subscripts are not handled specifically
// *bold*, **bold**
"bold": {
// eslint-disable-next-line regexp/no-super-linear-backtracking
pattern: withModifier(/(^(\*\*?)<MOD>*).+?(?=\2)/.source),
lookbehind: true
},
// _italic_, __italic__
"italic": {
// eslint-disable-next-line regexp/no-super-linear-backtracking
pattern: withModifier(/(^(__?)<MOD>*).+?(?=\2)/.source),
lookbehind: true
},
// ??cite??
"cite": {
// eslint-disable-next-line regexp/no-super-linear-backtracking
pattern: withModifier(/(^\?\?<MOD>*).+?(?=\?\?)/.source),
lookbehind: true,
alias: "string"
},
// @code@
"code": {
// eslint-disable-next-line regexp/no-super-linear-backtracking
pattern: withModifier(/(^@<MOD>*).+?(?=@)/.source),
lookbehind: true,
alias: "keyword"
},
// +inserted+
"inserted": {
// eslint-disable-next-line regexp/no-super-linear-backtracking
pattern: withModifier(/(^\+<MOD>*).+?(?=\+)/.source),
lookbehind: true
},
// -deleted-
"deleted": {
// eslint-disable-next-line regexp/no-super-linear-backtracking
pattern: withModifier(/(^-<MOD>*).+?(?=-)/.source),
lookbehind: true
},
// %span%
"span": {
// eslint-disable-next-line regexp/no-super-linear-backtracking
pattern: withModifier(/(^%<MOD>*).+?(?=%)/.source),
lookbehind: true
},
"modifier": {
pattern: withModifier(/(^\*\*|__|\?\?|[*_%@+\-^~])<MOD>+/.source),
lookbehind: true,
inside: modifierTokens
},
"punctuation": /[*_%?@+\-^~]+/
}
},
// [alias]http://example.com
"link-ref": {
pattern: /^\[[^\]]+\]\S+$/m,
inside: {
"string": {
pattern: /(^\[)[^\]]+(?=\])/,
lookbehind: true
},
"url": {
pattern: /(^\])\S+$/,
lookbehind: true
},
"punctuation": /[\[\]]/
}
},
// "text":http://example.com
// "text":link-ref
"link": {
// eslint-disable-next-line regexp/no-super-linear-backtracking
pattern: withModifier(/"<MOD>*[^"]+":.+?(?=[^\w/]?(?:\s|$))/.source),
inside: {
"text": {
// eslint-disable-next-line regexp/no-super-linear-backtracking
pattern: withModifier(/(^"<MOD>*)[^"]+(?=")/.source),
lookbehind: true
},
"modifier": {
pattern: withModifier(/(^")<MOD>+/.source),
lookbehind: true,
inside: modifierTokens
},
"url": {
pattern: /(:).+/,
lookbehind: true
},
"punctuation": /[":]/
}
},
// !image.jpg!
// !image.jpg(Title)!:http://example.com
"image": {
pattern: withModifier(/!(?:<MOD>|<PAR>|[<>=])*(?![<>=])[^!\s()]+(?:\([^)]+\))?!(?::.+?(?=[^\w/]?(?:\s|$)))?/.source),
inside: {
"source": {
pattern: withModifier(/(^!(?:<MOD>|<PAR>|[<>=])*)(?![<>=])[^!\s()]+(?:\([^)]+\))?(?=!)/.source),
lookbehind: true,
alias: "url"
},
"modifier": {
pattern: withModifier(/(^!)(?:<MOD>|<PAR>|[<>=])+/.source),
lookbehind: true,
inside: modifierTokens
},
"url": {
pattern: /(:).+/,
lookbehind: true
},
"punctuation": /[!:]/
}
},
// Footnote[1]
"footnote": {
pattern: /\b\[\d+\]/,
alias: "comment",
inside: {
"punctuation": /\[|\]/
}
},
// CSS(Cascading Style Sheet)
"acronym": {
pattern: /\b[A-Z\d]+\([^)]+\)/,
inside: {
"comment": {
pattern: /(\()[^()]+(?=\))/,
lookbehind: true
},
"punctuation": /[()]/
}
},
// Prism(C)
"mark": {
pattern: /\b\((?:C|R|TM)\)/,
alias: "comment",
inside: {
"punctuation": /[()]/
}
}
}
}
});
var phraseInside = textile["phrase"].inside;
var nestedPatterns = {
"inline": phraseInside["inline"],
"link": phraseInside["link"],
"image": phraseInside["image"],
"footnote": phraseInside["footnote"],
"acronym": phraseInside["acronym"],
"mark": phraseInside["mark"]
};
textile.tag.pattern = /<\/?(?!\d)[a-z0-9]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i;
var phraseInlineInside = phraseInside["inline"].inside;
phraseInlineInside["bold"].inside = nestedPatterns;
phraseInlineInside["italic"].inside = nestedPatterns;
phraseInlineInside["inserted"].inside = nestedPatterns;
phraseInlineInside["deleted"].inside = nestedPatterns;
phraseInlineInside["span"].inside = nestedPatterns;
var phraseTableInside = phraseInside["table"].inside;
phraseTableInside["inline"] = nestedPatterns["inline"];
phraseTableInside["link"] = nestedPatterns["link"];
phraseTableInside["image"] = nestedPatterns["image"];
phraseTableInside["footnote"] = nestedPatterns["footnote"];
phraseTableInside["acronym"] = nestedPatterns["acronym"];
phraseTableInside["mark"] = nestedPatterns["mark"];
})(Prism);
(function(Prism2) {
var key = /(?:[\w-]+|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*")/.source;
function insertKey(pattern) {
return pattern.replace(/__/g, function() {
return key;
});
}
Prism2.languages.toml = {
"comment": {
pattern: /#.*/,
greedy: true
},
"table": {
pattern: RegExp(insertKey(/(^[\t ]*\[\s*(?:\[\s*)?)__(?:\s*\.\s*__)*(?=\s*\])/.source), "m"),
lookbehind: true,
greedy: true,
alias: "class-name"
},
"key": {
pattern: RegExp(insertKey(/(^[\t ]*|[{,]\s*)__(?:\s*\.\s*__)*(?=\s*=)/.source), "m"),
lookbehind: true,
greedy: true,
alias: "property"
},
"string": {
pattern: /"""(?:\\[\s\S]|[^\\])*?"""|'''[\s\S]*?'''|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*"/,
greedy: true
},
"date": [
{
// Offset Date-Time, Local Date-Time, Local Date
pattern: /\b\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?\b/i,
alias: "number"
},
{
// Local Time
pattern: /\b\d{2}:\d{2}:\d{2}(?:\.\d+)?\b/,
alias: "number"
}
],
"number": /(?:\b0(?:x[\da-zA-Z]+(?:_[\da-zA-Z]+)*|o[0-7]+(?:_[0-7]+)*|b[10]+(?:_[10]+)*))\b|[-+]?\b\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?\b|[-+]?\b(?:inf|nan)\b/,
"boolean": /\b(?:false|true)\b/,
"punctuation": /[.,=[\]{}]/
};
})(Prism);
(function(Prism2) {
Prism2.languages.tremor = {
"comment": {
pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
lookbehind: true
},
"interpolated-string": null,
// see below
"extractor": {
pattern: /\b[a-z_]\w*\|(?:[^\r\n\\|]|\\(?:\r\n|[\s\S]))*\|/i,
greedy: true,
inside: {
"regex": {
pattern: /(^re)\|[\s\S]+/,
lookbehind: true
},
"function": /^\w+/,
"value": /\|[\s\S]+/
}
},
"identifier": {
pattern: /`[^`]*`/,
greedy: true
},
"function": /\b[a-z_]\w*(?=\s*(?:::\s*<|\())\b/,
"keyword": /\b(?:args|as|by|case|config|connect|connector|const|copy|create|default|define|deploy|drop|each|emit|end|erase|event|flow|fn|for|from|group|having|insert|into|intrinsic|let|links|match|merge|mod|move|of|operator|patch|pipeline|recur|script|select|set|sliding|state|stream|to|tumbling|update|use|when|where|window|with)\b/,
"boolean": /\b(?:false|null|true)\b/i,
"number": /\b(?:0b[01_]*|0x[0-9a-fA-F_]*|\d[\d_]*(?:\.\d[\d_]*)?(?:[Ee][+-]?[\d_]+)?)\b/,
"pattern-punctuation": {
pattern: /%(?=[({[])/,
alias: "punctuation"
},
"operator": /[-+*\/%~!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?>?=?|(?:absent|and|not|or|present|xor)\b/,
"punctuation": /::|[;\[\]()\{\},.:]/
};
var interpolationPattern = /#\{(?:[^"{}]|\{[^{}]*\}|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*")*\}/.source;
Prism2.languages.tremor["interpolated-string"] = {
pattern: RegExp(
/(^|[^\\])/.source + '(?:"""(?:' + /[^"\\#]|\\[\s\S]|"(?!"")|#(?!\{)/.source + "|" + interpolationPattern + ')*"""|"(?:' + /[^"\\\r\n#]|\\(?:\r\n|[\s\S])|#(?!\{)/.source + "|" + interpolationPattern + ')*")'
),
lookbehind: true,
greedy: true,
inside: {
"interpolation": {
pattern: RegExp(interpolationPattern),
inside: {
"punctuation": /^#\{|\}$/,
"expression": {
pattern: /[\s\S]+/,
inside: Prism2.languages.tremor
}
}
},
"string": /[\s\S]+/
}
};
Prism2.languages.troy = Prism2.languages["tremor"];
Prism2.languages.trickle = Prism2.languages["tremor"];
})(Prism);
Prism.languages.twig = {
"comment": /^\{#[\s\S]*?#\}$/,
"tag-name": {
pattern: /(^\{%-?\s*)\w+/,
lookbehind: true,
alias: "keyword"
},
"delimiter": {
pattern: /^\{[{%]-?|-?[%}]\}$/,
alias: "punctuation"
},
"string": {
pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
inside: {
"punctuation": /^['"]|['"]$/
}
},
"keyword": /\b(?:even|if|odd)\b/,
"boolean": /\b(?:false|null|true)\b/,
"number": /\b0x[\dA-Fa-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][-+]?\d+)?/,
"operator": [
{
pattern: /(\s)(?:and|b-and|b-or|b-xor|ends with|in|is|matches|not|or|same as|starts with)(?=\s)/,
lookbehind: true
},
/[=<>]=?|!=|\*\*?|\/\/?|\?:?|[-+~%|]/
],
"punctuation": /[()\[\]{}:.,]/
};
Prism.hooks.add("before-tokenize", function(env) {
if (env.language !== "twig") {
return;
}
var pattern = /\{(?:#[\s\S]*?#|%[\s\S]*?%|\{[\s\S]*?\})\}/g;
Prism.languages["markup-templating"].buildPlaceholders(env, "twig", pattern);
});
Prism.hooks.add("after-tokenize", function(env) {
Prism.languages["markup-templating"].tokenizePlaceholders(env, "twig");
});
(function(Prism2) {
var keywords = /\b(?:ACT|ACTIFSUB|CARRAY|CASE|CLEARGIF|COA|COA_INT|CONSTANTS|CONTENT|CUR|EDITPANEL|EFFECT|EXT|FILE|FLUIDTEMPLATE|FORM|FRAME|FRAMESET|GIFBUILDER|GMENU|GMENU_FOLDOUT|GMENU_LAYERS|GP|HMENU|HRULER|HTML|IENV|IFSUB|IMAGE|IMGMENU|IMGMENUITEM|IMGTEXT|IMG_RESOURCE|INCLUDE_TYPOSCRIPT|JSMENU|JSMENUITEM|LLL|LOAD_REGISTER|NO|PAGE|RECORDS|RESTORE_REGISTER|TEMPLATE|TEXT|TMENU|TMENUITEM|TMENU_LAYERS|USER|USER_INT|_GIFBUILDER|global|globalString|globalVar)\b/;
Prism2.languages.typoscript = {
"comment": [
{
// multiline comments /* */
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
lookbehind: true
},
{
// double-slash comments - ignored when backslashes or colon is found in front
// also ignored whenever directly after an equal-sign, because it would probably be an url without protocol
pattern: /(^|[^\\:= \t]|(?:^|[^= \t])[ \t]+)\/\/.*/,
lookbehind: true,
greedy: true
},
{
// hash comments - ignored when leading quote is found for hex colors in strings
pattern: /(^|[^"'])#.*/,
lookbehind: true,
greedy: true
}
],
"function": [
{
// old include style
pattern: /<INCLUDE_TYPOSCRIPT:\s*source\s*=\s*(?:"[^"\r\n]*"|'[^'\r\n]*')\s*>/,
inside: {
"string": {
pattern: /"[^"\r\n]*"|'[^'\r\n]*'/,
inside: {
"keyword": keywords
}
},
"keyword": {
pattern: /INCLUDE_TYPOSCRIPT/
}
}
},
{
// new include style
pattern: /@import\s*(?:"[^"\r\n]*"|'[^'\r\n]*')/,
inside: {
"string": /"[^"\r\n]*"|'[^'\r\n]*'/
}
}
],
"string": {
pattern: /^([^=]*=[< ]?)(?:(?!\]\n).)*/,
lookbehind: true,
inside: {
"function": /\{\$.*\}/,
// constants include
"keyword": keywords,
"number": /^\d+$/,
"punctuation": /[,|:]/
}
},
"keyword": keywords,
"number": {
// special highlighting for indexes of arrays in tags
pattern: /\b\d+\s*[.{=]/,
inside: {
"operator": /[.{=]/
}
},
"tag": {
pattern: /\.?[-\w\\]+\.?/,
inside: {
"punctuation": /\./
}
},
"punctuation": /[{}[\];(),.:|]/,
"operator": /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/
};
Prism2.languages.tsconfig = Prism2.languages.typoscript;
})(Prism);
Prism.languages.unrealscript = {
"comment": /\/\/.*|\/\*[\s\S]*?\*\//,
"string": {
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
greedy: true
},
"category": {
pattern: /(\b(?:(?:autoexpand|hide|show)categories|var)\s*\()[^()]+(?=\))/,
lookbehind: true,
greedy: true,
alias: "property"
},
"metadata": {
pattern: /(\w\s*)<\s*\w+\s*=[^<>|=\r\n]+(?:\|\s*\w+\s*=[^<>|=\r\n]+)*>/,
lookbehind: true,
greedy: true,
inside: {
"property": /\b\w+(?=\s*=)/,
"operator": /=/,
"punctuation": /[<>|]/
}
},
"macro": {
pattern: /`\w+/,
alias: "property"
},
"class-name": {
pattern: /(\b(?:class|enum|extends|interface|state(?:\(\))?|struct|within)\s+)\w+/,
lookbehind: true
},
"keyword": /\b(?:abstract|actor|array|auto|autoexpandcategories|bool|break|byte|case|class|classgroup|client|coerce|collapsecategories|config|const|continue|default|defaultproperties|delegate|dependson|deprecated|do|dontcollapsecategories|editconst|editinlinenew|else|enum|event|exec|export|extends|final|float|for|forcescriptorder|foreach|function|goto|guid|hidecategories|hidedropdown|if|ignores|implements|inherits|input|int|interface|iterator|latent|local|material|name|native|nativereplication|noexport|nontransient|noteditinlinenew|notplaceable|operator|optional|out|pawn|perobjectconfig|perobjectlocalized|placeable|postoperator|preoperator|private|protected|reliable|replication|return|server|showcategories|simulated|singular|state|static|string|struct|structdefault|structdefaultproperties|switch|texture|transient|travel|unreliable|until|var|vector|while|within)\b/,
"function": /\b[a-z_]\w*(?=\s*\()/i,
"boolean": /\b(?:false|true)\b/,
"number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
// https://docs.unrealengine.com/udk/Three/UnrealScriptExpressions.html
"operator": />>|<<|--|\+\+|\*\*|[-+*/~!=<>$@]=?|&&?|\|\|?|\^\^?|[?:%]|\b(?:ClockwiseFrom|Cross|Dot)\b/,
"punctuation": /[()[\]{};,.]/
};
Prism.languages.uc = Prism.languages.uscript = Prism.languages.unrealscript;
Prism.languages.uorazor = {
"comment-hash": {
pattern: /#.*/,
alias: "comment",
greedy: true
},
"comment-slash": {
pattern: /\/\/.*/,
alias: "comment",
greedy: true
},
"string": {
pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
inside: {
"punctuation": /^['"]|['"]$/
},
greedy: true
},
"source-layers": {
pattern: /\b(?:arms|backpack|blue|bracelet|cancel|clear|cloak|criminal|earrings|enemy|facialhair|friend|friendly|gloves|gray|grey|ground|hair|head|innerlegs|innertorso|innocent|lefthand|middletorso|murderer|neck|nonfriendly|onehandedsecondary|outerlegs|outertorso|pants|red|righthand|ring|self|shirt|shoes|talisman|waist)\b/i,
alias: "function"
},
"source-commands": {
pattern: /\b(?:alliance|attack|cast|clearall|clearignore|clearjournal|clearlist|clearsysmsg|createlist|createtimer|dclick|dclicktype|dclickvar|dress|dressconfig|drop|droprelloc|emote|getlabel|guild|gumpclose|gumpresponse|hotkey|ignore|lasttarget|lift|lifttype|menu|menuresponse|msg|org|organize|organizer|overhead|pause|poplist|potion|promptresponse|pushlist|removelist|removetimer|rename|restock|say|scav|scavenger|script|setability|setlasttarget|setskill|settimer|setvar|sysmsg|target|targetloc|targetrelloc|targettype|undress|unignore|unsetvar|useobject|useonce|useskill|usetype|virtue|wait|waitforgump|waitformenu|waitforprompt|waitforstat|waitforsysmsg|waitfortarget|walk|wfsysmsg|wft|whisper|yell)\b/,
alias: "function"
},
"tag-name": {
pattern: /(^\{%-?\s*)\w+/,
lookbehind: true,
alias: "keyword"
},
"delimiter": {
pattern: /^\{[{%]-?|-?[%}]\}$/,
alias: "punctuation"
},
"function": /\b(?:atlist|close|closest|count|counter|counttype|dead|dex|diffhits|diffmana|diffstam|diffweight|find|findbuff|finddebuff|findlayer|findtype|findtypelist|followers|gumpexists|hidden|hits|hp|hue|human|humanoid|ingump|inlist|insysmessage|insysmsg|int|invul|lhandempty|list|listexists|mana|maxhits|maxhp|maxmana|maxstam|maxweight|monster|mounted|name|next|noto|paralyzed|poisoned|position|prev|previous|queued|rand|random|rhandempty|skill|stam|str|targetexists|timer|timerexists|varexist|warmode|weight)\b/,
"keyword": /\b(?:and|as|break|continue|else|elseif|endfor|endif|endwhile|for|if|loop|not|or|replay|stop|while)\b/,
"boolean": /\b(?:false|null|true)\b/,
"number": /\b0x[\dA-Fa-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][-+]?\d+)?/,
"operator": [
{
pattern: /(\s)(?:and|b-and|b-or|b-xor|ends with|in|is|matches|not|or|same as|starts with)(?=\s)/,
lookbehind: true
},
/[=<>]=?|!=|\*\*?|\/\/?|\?:?|[-+~%|]/
],
"punctuation": /[()\[\]{}:.,]/
};
Prism.languages.uri = {
"scheme": {
pattern: /^[a-z][a-z0-9+.-]*:/im,
greedy: true,
inside: {
"scheme-delimiter": /:$/
}
},
"fragment": {
pattern: /#[\w\-.~!$&'()*+,;=%:@/?]*/,
inside: {
"fragment-delimiter": /^#/
}
},
"query": {
pattern: /\?[\w\-.~!$&'()*+,;=%:@/?]*/,
inside: {
"query-delimiter": {
pattern: /^\?/,
greedy: true
},
"pair-delimiter": /[&;]/,
"pair": {
pattern: /^[^=][\s\S]*/,
inside: {
"key": /^[^=]+/,
"value": {
pattern: /(^=)[\s\S]+/,
lookbehind: true
}
}
}
}
},
"authority": {
pattern: RegExp(
/^\/\//.source + /(?:[\w\-.~!$&'()*+,;=%:]*@)?/.source + ("(?:" + /\[(?:[0-9a-fA-F:.]{2,48}|v[0-9a-fA-F]+\.[\w\-.~!$&'()*+,;=]+)\]/.source + "|" + /[\w\-.~!$&'()*+,;=%]*/.source + ")") + /(?::\d*)?/.source,
"m"
),
inside: {
"authority-delimiter": /^\/\//,
"user-info-segment": {
pattern: /^[\w\-.~!$&'()*+,;=%:]*@/,
inside: {
"user-info-delimiter": /@$/,
"user-info": /^[\w\-.~!$&'()*+,;=%:]+/
}
},
"port-segment": {
pattern: /:\d*$/,
inside: {
"port-delimiter": /^:/,
"port": /^\d+/
}
},
"host": {
pattern: /[\s\S]+/,
inside: {
"ip-literal": {
pattern: /^\[[\s\S]+\]$/,
inside: {
"ip-literal-delimiter": /^\[|\]$/,
"ipv-future": /^v[\s\S]+/,
"ipv6-address": /^[\s\S]+/
}
},
"ipv4-address": /^(?:(?:[03-9]\d?|[12]\d{0,2})\.){3}(?:[03-9]\d?|[12]\d{0,2})$/
}
}
}
},
"path": {
pattern: /^[\w\-.~!$&'()*+,;=%:@/]+/m,
inside: {
"path-separator": /\//
}
}
};
Prism.languages.url = Prism.languages.uri;
(function(Prism2) {
var interpolationExpr = {
pattern: /[\s\S]+/,
inside: null
};
Prism2.languages.v = Prism2.languages.extend("clike", {
"string": {
pattern: /r?(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
alias: "quoted-string",
greedy: true,
inside: {
"interpolation": {
pattern: /((?:^|[^\\])(?:\\{2})*)\$(?:\{[^{}]*\}|\w+(?:\.\w+(?:\([^\(\)]*\))?|\[[^\[\]]+\])*)/,
lookbehind: true,
inside: {
"interpolation-variable": {
pattern: /^\$\w[\s\S]*$/,
alias: "variable"
},
"interpolation-punctuation": {
pattern: /^\$\{|\}$/,
alias: "punctuation"
},
"interpolation-expression": interpolationExpr
}
}
}
},
"class-name": {
pattern: /(\b(?:enum|interface|struct|type)\s+)(?:C\.)?\w+/,
lookbehind: true
},
"keyword": /(?:\b(?:__global|as|asm|assert|atomic|break|chan|const|continue|defer|else|embed|enum|fn|for|go(?:to)?|if|import|in|interface|is|lock|match|module|mut|none|or|pub|return|rlock|select|shared|sizeof|static|struct|type(?:of)?|union|unsafe)|\$(?:else|for|if)|#(?:flag|include))\b/,
"number": /\b(?:0x[a-f\d]+(?:_[a-f\d]+)*|0b[01]+(?:_[01]+)*|0o[0-7]+(?:_[0-7]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?)\b/i,
"operator": /~|\?|[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\.?/,
"builtin": /\b(?:any(?:_float|_int)?|bool|byte(?:ptr)?|charptr|f(?:32|64)|i(?:8|16|64|128|nt)|rune|size_t|string|u(?:16|32|64|128)|voidptr)\b/
});
interpolationExpr.inside = Prism2.languages.v;
Prism2.languages.insertBefore("v", "string", {
"char": {
pattern: /`(?:\\`|\\?[^`]{1,2})`/,
// using {1,2} instead of `u` flag for compatibility
alias: "rune"
}
});
Prism2.languages.insertBefore("v", "operator", {
"attribute": {
pattern: /(^[\t ]*)\[(?:deprecated|direct_array_access|flag|inline|live|ref_only|typedef|unsafe_fn|windows_stdcall)\]/m,
lookbehind: true,
alias: "annotation",
inside: {
"punctuation": /[\[\]]/,
"keyword": /\w+/
}
},
"generic": {
pattern: /<\w+>(?=\s*[\)\{])/,
inside: {
"punctuation": /[<>]/,
"class-name": /\w+/
}
}
});
Prism2.languages.insertBefore("v", "function", {
"generic-function": {
// e.g. foo<T>( ...
pattern: /\b\w+\s*<\w+>(?=\()/,
inside: {
"function": /^\w+/,
"generic": {
pattern: /<\w+>/,
inside: Prism2.languages.v.generic.inside
}
}
}
});
})(Prism);
Prism.languages.vala = Prism.languages.extend("clike", {
// Classes copied from prism-csharp
"class-name": [
{
// (Foo bar, Bar baz)
pattern: /\b[A-Z]\w*(?:\.\w+)*\b(?=(?:\?\s+|\*?\s+\*?)\w)/,
inside: {
punctuation: /\./
}
},
{
// [Foo]
pattern: /(\[)[A-Z]\w*(?:\.\w+)*\b/,
lookbehind: true,
inside: {
punctuation: /\./
}
},
{
// class Foo : Bar
pattern: /(\b(?:class|interface)\s+[A-Z]\w*(?:\.\w+)*\s*:\s*)[A-Z]\w*(?:\.\w+)*\b/,
lookbehind: true,
inside: {
punctuation: /\./
}
},
{
// class Foo
pattern: /((?:\b(?:class|enum|interface|new|struct)\s+)|(?:catch\s+\())[A-Z]\w*(?:\.\w+)*\b/,
lookbehind: true,
inside: {
punctuation: /\./
}
}
],
"keyword": /\b(?:abstract|as|assert|async|base|bool|break|case|catch|char|class|const|construct|continue|default|delegate|delete|do|double|dynamic|else|ensures|enum|errordomain|extern|finally|float|for|foreach|get|if|in|inline|int|int16|int32|int64|int8|interface|internal|is|lock|long|namespace|new|null|out|override|owned|params|private|protected|public|ref|requires|return|set|short|signal|sizeof|size_t|ssize_t|static|string|struct|switch|this|throw|throws|try|typeof|uchar|uint|uint16|uint32|uint64|uint8|ulong|unichar|unowned|ushort|using|value|var|virtual|void|volatile|weak|while|yield)\b/i,
"function": /\b\w+(?=\s*\()/,
"number": /(?:\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)(?:f|u?l?)?/i,
"operator": /\+\+|--|&&|\|\||<<=?|>>=?|=>|->|~|[+\-*\/%&^|=!<>]=?|\?\??|\.\.\./,
"punctuation": /[{}[\];(),.:]/,
"constant": /\b[A-Z0-9_]+\b/
});
Prism.languages.insertBefore("vala", "string", {
"raw-string": {
pattern: /"""[\s\S]*?"""/,
greedy: true,
alias: "string"
},
"template-string": {
pattern: /@"[\s\S]*?"/,
greedy: true,
inside: {
"interpolation": {
pattern: /\$(?:\([^)]*\)|[a-zA-Z]\w*)/,
inside: {
"delimiter": {
pattern: /^\$\(?|\)$/,
alias: "punctuation"
},
rest: Prism.languages.vala
}
},
"string": /[\s\S]+/
}
}
});
Prism.languages.insertBefore("vala", "keyword", {
"regex": {
pattern: /\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[imsx]{0,4}(?=\s*(?:$|[\r\n,.;})\]]))/,
greedy: true,
inside: {
"regex-source": {
pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
lookbehind: true,
alias: "language-regex",
inside: Prism.languages.regex
},
"regex-delimiter": /^\//,
"regex-flags": /^[a-z]+$/
}
}
});
(function(Prism2) {
Prism2.languages.velocity = Prism2.languages.extend("markup", {});
var velocity = {
"variable": {
pattern: /(^|[^\\](?:\\\\)*)\$!?(?:[a-z][\w-]*(?:\([^)]*\))?(?:\.[a-z][\w-]*(?:\([^)]*\))?|\[[^\]]+\])*|\{[^}]+\})/i,
lookbehind: true,
inside: {}
// See below
},
"string": {
pattern: /"[^"]*"|'[^']*'/,
greedy: true
},
"number": /\b\d+\b/,
"boolean": /\b(?:false|true)\b/,
"operator": /[=!<>]=?|[+*/%-]|&&|\|\||\.\.|\b(?:eq|g[et]|l[et]|n(?:e|ot))\b/,
"punctuation": /[(){}[\]:,.]/
};
velocity.variable.inside = {
"string": velocity["string"],
"function": {
pattern: /([^\w-])[a-z][\w-]*(?=\()/,
lookbehind: true
},
"number": velocity["number"],
"boolean": velocity["boolean"],
"punctuation": velocity["punctuation"]
};
Prism2.languages.insertBefore("velocity", "comment", {
"unparsed": {
pattern: /(^|[^\\])#\[\[[\s\S]*?\]\]#/,
lookbehind: true,
greedy: true,
inside: {
"punctuation": /^#\[\[|\]\]#$/
}
},
"velocity-comment": [
{
pattern: /(^|[^\\])#\*[\s\S]*?\*#/,
lookbehind: true,
greedy: true,
alias: "comment"
},
{
pattern: /(^|[^\\])##.*/,
lookbehind: true,
greedy: true,
alias: "comment"
}
],
"directive": {
pattern: /(^|[^\\](?:\\\\)*)#@?(?:[a-z][\w-]*|\{[a-z][\w-]*\})(?:\s*\((?:[^()]|\([^()]*\))*\))?/i,
lookbehind: true,
inside: {
"keyword": {
pattern: /^#@?(?:[a-z][\w-]*|\{[a-z][\w-]*\})|\bin\b/,
inside: {
"punctuation": /[{}]/
}
},
rest: velocity
}
},
"variable": velocity["variable"]
});
Prism2.languages.velocity["tag"].inside["attr-value"].inside.rest = Prism2.languages.velocity;
})(Prism);
Prism.languages.verilog = {
"comment": {
pattern: /\/\/.*|\/\*[\s\S]*?\*\//,
greedy: true
},
"string": {
pattern: /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
greedy: true
},
"kernel-function": {
// support for any kernel function (ex: $display())
pattern: /\B\$\w+\b/,
alias: "property"
},
// support for user defined constants (ex: `define)
"constant": /\B`\w+\b/,
"function": /\b\w+(?=\()/,
// support for verilog and system verilog keywords
"keyword": /\b(?:alias|and|assert|assign|assume|automatic|before|begin|bind|bins|binsof|bit|break|buf|bufif0|bufif1|byte|case|casex|casez|cell|chandle|class|clocking|cmos|config|const|constraint|context|continue|cover|covergroup|coverpoint|cross|deassign|default|defparam|design|disable|dist|do|edge|else|end|endcase|endclass|endclocking|endconfig|endfunction|endgenerate|endgroup|endinterface|endmodule|endpackage|endprimitive|endprogram|endproperty|endsequence|endspecify|endtable|endtask|enum|event|expect|export|extends|extern|final|first_match|for|force|foreach|forever|fork|forkjoin|function|generate|genvar|highz0|highz1|if|iff|ifnone|ignore_bins|illegal_bins|import|incdir|include|initial|inout|input|inside|instance|int|integer|interface|intersect|join|join_any|join_none|large|liblist|library|local|localparam|logic|longint|macromodule|matches|medium|modport|module|nand|negedge|new|nmos|nor|noshowcancelled|not|notif0|notif1|null|or|output|package|packed|parameter|pmos|posedge|primitive|priority|program|property|protected|pull0|pull1|pulldown|pullup|pulsestyle_ondetect|pulsestyle_onevent|pure|rand|randc|randcase|randsequence|rcmos|real|realtime|ref|reg|release|repeat|return|rnmos|rpmos|rtran|rtranif0|rtranif1|scalared|sequence|shortint|shortreal|showcancelled|signed|small|solve|specify|specparam|static|string|strong0|strong1|struct|super|supply0|supply1|table|tagged|task|this|throughout|time|timeprecision|timeunit|tran|tranif0|tranif1|tri|tri0|tri1|triand|trior|trireg|type|typedef|union|unique|unsigned|use|uwire|var|vectored|virtual|void|wait|wait_order|wand|weak0|weak1|while|wildcard|wire|with|within|wor|xnor|xor)\b/,
// bold highlighting for all verilog and system verilog logic blocks
"important": /\b(?:always|always_comb|always_ff|always_latch)\b(?: *@)?/,
// support for time ticks, vectors, and real numbers
"number": /\B##?\d+|(?:\b\d+)?'[odbh] ?[\da-fzx_?]+|\b(?:\d*[._])?\d+(?:e[-+]?\d+)?/i,
"operator": /[-+{}^~%*\/?=!<>&|]+/,
"punctuation": /[[\];(),.:]/
};
Prism.languages.vhdl = {
"comment": /--.+/,
// support for all logic vectors
"vhdl-vectors": {
"pattern": /\b[oxb]"[\da-f_]+"|"[01uxzwlh-]+"/i,
"alias": "number"
},
// support for operator overloading included
"quoted-function": {
pattern: /"\S+?"(?=\()/,
alias: "function"
},
"string": /"(?:[^\\"\r\n]|\\(?:\r\n|[\s\S]))*"/,
"attribute": {
pattern: /\b'\w+/,
alias: "attr-name"
},
// support for predefined attributes included
"keyword": /\b(?:access|after|alias|all|architecture|array|assert|attribute|begin|block|body|buffer|bus|case|component|configuration|constant|disconnect|downto|else|elsif|end|entity|exit|file|for|function|generate|generic|group|guarded|if|impure|in|inertial|inout|is|label|library|linkage|literal|loop|map|new|next|null|of|on|open|others|out|package|port|postponed|private|procedure|process|pure|range|record|register|reject|report|return|select|severity|shared|signal|subtype|then|to|transport|type|unaffected|units|until|use|variable|view|wait|when|while|with)\b/i,
"boolean": /\b(?:false|true)\b/i,
"function": /\w+(?=\()/,
// decimal, based, physical, and exponential numbers supported
"number": /'[01uxzwlh-]'|\b(?:\d+#[\da-f_.]+#|\d[\d_.]*)(?:e[-+]?\d+)?/i,
"operator": /[<>]=?|:=|[-+*/&=]|\b(?:abs|and|mod|nand|nor|not|or|rem|rol|ror|sla|sll|sra|srl|xnor|xor)\b/i,
"punctuation": /[{}[\];(),.:]/
};
Prism.languages.vim = {
"string": /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\r\n]|'')*'/,
"comment": /".*/,
"function": /\b\w+(?=\()/,
"keyword": /\b(?:N|Next|P|Print|X|XMLent|XMLns|ab|abbreviate|abc|abclear|abo|aboveleft|al|all|ar|arga|argadd|argd|argdelete|argdo|arge|argedit|argg|argglobal|argl|arglocal|args|argu|argument|as|ascii|b|bN|bNext|ba|bad|badd|ball|bd|bdelete|be|bel|belowright|bf|bfirst|bl|blast|bm|bmodified|bn|bnext|bo|botright|bp|bprevious|br|brea|break|breaka|breakadd|breakd|breakdel|breakl|breaklist|brewind|bro|browse|bufdo|buffer|buffers|bun|bunload|bw|bwipeout|c|cN|cNext|cNfcNfile|ca|cabbrev|cabc|cabclear|cad|caddb|caddbuffer|caddexpr|caddf|caddfile|cal|call|cat|catch|cb|cbuffer|cc|ccl|cclose|cd|ce|center|cex|cexpr|cf|cfile|cfir|cfirst|cg|cgetb|cgetbuffer|cgete|cgetexpr|cgetfile|change|changes|chd|chdir|che|checkpath|checkt|checktime|cl|cla|clast|clist|clo|close|cmapc|cmapclear|cn|cnew|cnewer|cnext|cnf|cnfile|cnorea|cnoreabbrev|co|col|colder|colo|colorscheme|comc|comclear|comp|compiler|con|conf|confirm|continue|cope|copen|copy|cp|cpf|cpfile|cprevious|cq|cquit|cr|crewind|cu|cuna|cunabbrev|cunmap|cw|cwindow|d|debugg|debuggreedy|delc|delcommand|delete|delf|delfunction|delm|delmarks|di|diffg|diffget|diffoff|diffpatch|diffpu|diffput|diffsplit|diffthis|diffu|diffupdate|dig|digraphs|display|dj|djump|dl|dlist|dr|drop|ds|dsearch|dsp|dsplit|e|earlier|echoe|echoerr|echom|echomsg|echon|edit|el|else|elsei|elseif|em|emenu|en|endf|endfo|endfor|endfun|endfunction|endif|endt|endtry|endw|endwhile|ene|enew|ex|exi|exit|exu|exusage|f|file|files|filetype|fin|fina|finally|find|fini|finish|fir|first|fix|fixdel|fo|fold|foldc|foldclose|foldd|folddoc|folddoclosed|folddoopen|foldo|foldopen|for|fu|fun|function|go|goto|gr|grep|grepa|grepadd|h|ha|hardcopy|help|helpf|helpfind|helpg|helpgrep|helpt|helptags|hid|hide|his|history|ia|iabbrev|iabc|iabclear|if|ij|ijump|il|ilist|imapc|imapclear|in|inorea|inoreabbrev|isearch|isp|isplit|iu|iuna|iunabbrev|iunmap|j|join|ju|jumps|k|kee|keepalt|keepj|keepjumps|keepmarks|l|lN|lNext|lNf|lNfile|la|lad|laddb|laddbuffer|laddexpr|laddf|laddfile|lan|language|last|later|lb|lbuffer|lc|lcd|lch|lchdir|lcl|lclose|left|lefta|leftabove|let|lex|lexpr|lf|lfile|lfir|lfirst|lg|lgetb|lgetbuffer|lgete|lgetexpr|lgetfile|lgr|lgrep|lgrepa|lgrepadd|lh|lhelpgrep|list|ll|lla|llast|lli|llist|lm|lmak|lmake|lmap|lmapc|lmapclear|ln|lne|lnew|lnewer|lnext|lnf|lnfile|lnoremap|lo|loadview|loc|lockmarks|lockv|lockvar|lol|lolder|lop|lopen|lp|lpf|lpfile|lprevious|lr|lrewind|ls|lt|ltag|lu|lunmap|lv|lvimgrep|lvimgrepa|lvimgrepadd|lw|lwindow|m|ma|mak|make|mark|marks|mat|match|menut|menutranslate|mk|mkexrc|mks|mksession|mksp|mkspell|mkv|mkvie|mkview|mkvimrc|mod|mode|move|mz|mzf|mzfile|mzscheme|n|nbkey|new|next|nmapc|nmapclear|noh|nohlsearch|norea|noreabbrev|nu|number|nun|nunmap|o|omapc|omapclear|on|only|open|opt|options|ou|ounmap|p|pc|pclose|pe|ped|pedit|perl|perld|perldo|po|pop|popu|popup|pp|ppop|pre|preserve|prev|previous|print|prof|profd|profdel|profile|promptf|promptfind|promptr|promptrepl|ps|psearch|ptN|ptNext|pta|ptag|ptf|ptfirst|ptj|ptjump|ptl|ptlast|ptn|ptnext|ptp|ptprevious|ptr|ptrewind|pts|ptselect|pu|put|pw|pwd|py|pyf|pyfile|python|q|qa|qall|quit|quita|quitall|r|read|rec|recover|red|redi|redir|redo|redr|redraw|redraws|redrawstatus|reg|registers|res|resize|ret|retab|retu|return|rew|rewind|ri|right|rightb|rightbelow|ru|rub|ruby|rubyd|rubydo|rubyf|rubyfile|runtime|rv|rviminfo|sN|sNext|sa|sal|sall|san|sandbox|sargument|sav|saveas|sb|sbN|sbNext|sba|sball|sbf|sbfirst|sbl|sblast|sbm|sbmodified|sbn|sbnext|sbp|sbprevious|sbr|sbrewind|sbuffer|scrip|scripte|scriptencoding|scriptnames|se|set|setf|setfiletype|setg|setglobal|setl|setlocal|sf|sfind|sfir|sfirst|sh|shell|sign|sil|silent|sim|simalt|sl|sla|slast|sleep|sm|smagic|smap|smapc|smapclear|sme|smenu|sn|snext|sni|sniff|sno|snomagic|snor|snoremap|snoreme|snoremenu|so|sor|sort|source|sp|spe|spelld|spelldump|spellgood|spelli|spellinfo|spellr|spellrepall|spellu|spellundo|spellw|spellwrong|split|spr|sprevious|sre|srewind|st|sta|stag|star|startg|startgreplace|startinsert|startr|startreplace|stj|stjump|stop|stopi|stopinsert|sts|stselect|sun|sunhide|sunm|sunmap|sus|suspend|sv|sview|syncbind|t|tN|tNext|ta|tab|tabN|tabNext|tabc|tabclose|tabd|tabdo|tabe|tabedit|tabf|tabfind|tabfir|tabfirst|tabl|tablast|tabm|tabmove|tabn|tabnew|tabnext|tabo|tabonly|tabp|tabprevious|tabr|tabrewind|tabs|tag|tags|tc|tcl|tcld|tcldo|tclf|tclfile|te|tearoff|tf|tfirst|th|throw|tj|tjump|tl|tlast|tm|tmenu|tn|tnext|to|topleft|tp|tprevious|tr|trewind|try|ts|tselect|tu|tunmenu|u|una|unabbreviate|undo|undoj|undojoin|undol|undolist|unh|unhide|unlet|unlo|unlockvar|unm|unmap|up|update|ve|verb|verbose|version|vert|vertical|vi|vie|view|vim|vimgrep|vimgrepa|vimgrepadd|visual|viu|viusage|vmapc|vmapclear|vne|vnew|vs|vsplit|vu|vunmap|w|wN|wNext|wa|wall|wh|while|win|winc|wincmd|windo|winp|winpos|winsize|wn|wnext|wp|wprevious|wq|wqa|wqall|write|ws|wsverb|wv|wviminfo|x|xa|xall|xit|xm|xmap|xmapc|xmapclear|xme|xmenu|xn|xnoremap|xnoreme|xnoremenu|xu|xunmap|y|yank)\b/,
"builtin": /\b(?:acd|ai|akm|aleph|allowrevins|altkeymap|ambiwidth|ambw|anti|antialias|arab|arabic|arabicshape|ari|arshape|autochdir|autocmd|autoindent|autoread|autowrite|autowriteall|aw|awa|background|backspace|backup|backupcopy|backupdir|backupext|backupskip|balloondelay|ballooneval|balloonexpr|bdir|bdlay|beval|bex|bexpr|bg|bh|bin|binary|biosk|bioskey|bk|bkc|bomb|breakat|brk|browsedir|bs|bsdir|bsk|bt|bufhidden|buflisted|buftype|casemap|ccv|cdpath|cedit|cfu|ch|charconvert|ci|cin|cindent|cink|cinkeys|cino|cinoptions|cinw|cinwords|clipboard|cmdheight|cmdwinheight|cmp|cms|columns|com|comments|commentstring|compatible|complete|completefunc|completeopt|consk|conskey|copyindent|cot|cpo|cpoptions|cpt|cscopepathcomp|cscopeprg|cscopequickfix|cscopetag|cscopetagorder|cscopeverbose|cspc|csprg|csqf|cst|csto|csverb|cuc|cul|cursorcolumn|cursorline|cwh|debug|deco|def|define|delcombine|dex|dg|dict|dictionary|diff|diffexpr|diffopt|digraph|dip|dir|directory|dy|ea|ead|eadirection|eb|ed|edcompatible|ef|efm|ei|ek|enc|encoding|endofline|eol|ep|equalalways|equalprg|errorbells|errorfile|errorformat|esckeys|et|eventignore|expandtab|exrc|fcl|fcs|fdc|fde|fdi|fdl|fdls|fdm|fdn|fdo|fdt|fen|fenc|fencs|fex|ff|ffs|fileencoding|fileencodings|fileformat|fileformats|fillchars|fk|fkmap|flp|fml|fmr|foldcolumn|foldenable|foldexpr|foldignore|foldlevel|foldlevelstart|foldmarker|foldmethod|foldminlines|foldnestmax|foldtext|formatexpr|formatlistpat|formatoptions|formatprg|fp|fs|fsync|ft|gcr|gd|gdefault|gfm|gfn|gfs|gfw|ghr|gp|grepformat|grepprg|gtl|gtt|guicursor|guifont|guifontset|guifontwide|guiheadroom|guioptions|guipty|guitablabel|guitabtooltip|helpfile|helpheight|helplang|hf|hh|hi|hidden|highlight|hk|hkmap|hkmapp|hkp|hl|hlg|hls|hlsearch|ic|icon|iconstring|ignorecase|im|imactivatekey|imak|imc|imcmdline|imd|imdisable|imi|iminsert|ims|imsearch|inc|include|includeexpr|incsearch|inde|indentexpr|indentkeys|indk|inex|inf|infercase|insertmode|invacd|invai|invakm|invallowrevins|invaltkeymap|invanti|invantialias|invar|invarab|invarabic|invarabicshape|invari|invarshape|invautochdir|invautoindent|invautoread|invautowrite|invautowriteall|invaw|invawa|invbackup|invballooneval|invbeval|invbin|invbinary|invbiosk|invbioskey|invbk|invbl|invbomb|invbuflisted|invcf|invci|invcin|invcindent|invcompatible|invconfirm|invconsk|invconskey|invcopyindent|invcp|invcscopetag|invcscopeverbose|invcst|invcsverb|invcuc|invcul|invcursorcolumn|invcursorline|invdeco|invdelcombine|invdg|invdiff|invdigraph|invdisable|invea|inveb|inved|invedcompatible|invek|invendofline|inveol|invequalalways|inverrorbells|invesckeys|invet|invex|invexpandtab|invexrc|invfen|invfk|invfkmap|invfoldenable|invgd|invgdefault|invguipty|invhid|invhidden|invhk|invhkmap|invhkmapp|invhkp|invhls|invhlsearch|invic|invicon|invignorecase|invim|invimc|invimcmdline|invimd|invincsearch|invinf|invinfercase|invinsertmode|invis|invjoinspaces|invjs|invlazyredraw|invlbr|invlinebreak|invlisp|invlist|invloadplugins|invlpl|invlz|invma|invmacatsui|invmagic|invmh|invml|invmod|invmodeline|invmodifiable|invmodified|invmore|invmousef|invmousefocus|invmousehide|invnu|invnumber|invodev|invopendevice|invpaste|invpi|invpreserveindent|invpreviewwindow|invprompt|invpvw|invreadonly|invremap|invrestorescreen|invrevins|invri|invrightleft|invrightleftcmd|invrl|invrlc|invro|invrs|invru|invruler|invsb|invsc|invscb|invscrollbind|invscs|invsecure|invsft|invshellslash|invshelltemp|invshiftround|invshortname|invshowcmd|invshowfulltag|invshowmatch|invshowmode|invsi|invsm|invsmartcase|invsmartindent|invsmarttab|invsmd|invsn|invsol|invspell|invsplitbelow|invsplitright|invspr|invsr|invssl|invsta|invstartofline|invstmp|invswapfile|invswf|invta|invtagbsearch|invtagrelative|invtagstack|invtbi|invtbidi|invtbs|invtermbidi|invterse|invtextauto|invtextmode|invtf|invtgst|invtildeop|invtimeout|invtitle|invto|invtop|invtr|invttimeout|invttybuiltin|invttyfast|invtx|invvb|invvisualbell|invwa|invwarn|invwb|invweirdinvert|invwfh|invwfw|invwildmenu|invwinfixheight|invwinfixwidth|invwiv|invwmnu|invwrap|invwrapscan|invwrite|invwriteany|invwritebackup|invws|isf|isfname|isi|isident|isk|iskeyword|isprint|joinspaces|js|key|keymap|keymodel|keywordprg|km|kmp|kp|langmap|langmenu|laststatus|lazyredraw|lbr|lcs|linebreak|lines|linespace|lisp|lispwords|listchars|loadplugins|lpl|lsp|lz|macatsui|magic|makeef|makeprg|matchpairs|matchtime|maxcombine|maxfuncdepth|maxmapdepth|maxmem|maxmempattern|maxmemtot|mco|mef|menuitems|mfd|mh|mis|mkspellmem|ml|mls|mm|mmd|mmp|mmt|modeline|modelines|modifiable|modified|more|mouse|mousef|mousefocus|mousehide|mousem|mousemodel|mouses|mouseshape|mouset|mousetime|mp|mps|msm|mzq|mzquantum|nf|noacd|noai|noakm|noallowrevins|noaltkeymap|noanti|noantialias|noar|noarab|noarabic|noarabicshape|noari|noarshape|noautochdir|noautoindent|noautoread|noautowrite|noautowriteall|noaw|noawa|nobackup|noballooneval|nobeval|nobin|nobinary|nobiosk|nobioskey|nobk|nobl|nobomb|nobuflisted|nocf|noci|nocin|nocindent|nocompatible|noconfirm|noconsk|noconskey|nocopyindent|nocp|nocscopetag|nocscopeverbose|nocst|nocsverb|nocuc|nocul|nocursorcolumn|nocursorline|nodeco|nodelcombine|nodg|nodiff|nodigraph|nodisable|noea|noeb|noed|noedcompatible|noek|noendofline|noeol|noequalalways|noerrorbells|noesckeys|noet|noex|noexpandtab|noexrc|nofen|nofk|nofkmap|nofoldenable|nogd|nogdefault|noguipty|nohid|nohidden|nohk|nohkmap|nohkmapp|nohkp|nohls|noic|noicon|noignorecase|noim|noimc|noimcmdline|noimd|noincsearch|noinf|noinfercase|noinsertmode|nois|nojoinspaces|nojs|nolazyredraw|nolbr|nolinebreak|nolisp|nolist|noloadplugins|nolpl|nolz|noma|nomacatsui|nomagic|nomh|noml|nomod|nomodeline|nomodifiable|nomodified|nomore|nomousef|nomousefocus|nomousehide|nonu|nonumber|noodev|noopendevice|nopaste|nopi|nopreserveindent|nopreviewwindow|noprompt|nopvw|noreadonly|noremap|norestorescreen|norevins|nori|norightleft|norightleftcmd|norl|norlc|noro|nors|noru|noruler|nosb|nosc|noscb|noscrollbind|noscs|nosecure|nosft|noshellslash|noshelltemp|noshiftround|noshortname|noshowcmd|noshowfulltag|noshowmatch|noshowmode|nosi|nosm|nosmartcase|nosmartindent|nosmarttab|nosmd|nosn|nosol|nospell|nosplitbelow|nosplitright|nospr|nosr|nossl|nosta|nostartofline|nostmp|noswapfile|noswf|nota|notagbsearch|notagrelative|notagstack|notbi|notbidi|notbs|notermbidi|noterse|notextauto|notextmode|notf|notgst|notildeop|notimeout|notitle|noto|notop|notr|nottimeout|nottybuiltin|nottyfast|notx|novb|novisualbell|nowa|nowarn|nowb|noweirdinvert|nowfh|nowfw|nowildmenu|nowinfixheight|nowinfixwidth|nowiv|nowmnu|nowrap|nowrapscan|nowrite|nowriteany|nowritebackup|nows|nrformats|numberwidth|nuw|odev|oft|ofu|omnifunc|opendevice|operatorfunc|opfunc|osfiletype|pa|para|paragraphs|paste|pastetoggle|patchexpr|patchmode|path|pdev|penc|pex|pexpr|pfn|ph|pheader|pi|pm|pmbcs|pmbfn|popt|preserveindent|previewheight|previewwindow|printdevice|printencoding|printexpr|printfont|printheader|printmbcharset|printmbfont|printoptions|prompt|pt|pumheight|pvh|pvw|qe|quoteescape|readonly|remap|report|restorescreen|revins|rightleft|rightleftcmd|rl|rlc|ro|rs|rtp|ruf|ruler|rulerformat|runtimepath|sbo|sc|scb|scr|scroll|scrollbind|scrolljump|scrolloff|scrollopt|scs|sect|sections|secure|sel|selection|selectmode|sessionoptions|sft|shcf|shellcmdflag|shellpipe|shellquote|shellredir|shellslash|shelltemp|shelltype|shellxquote|shiftround|shiftwidth|shm|shortmess|shortname|showbreak|showcmd|showfulltag|showmatch|showmode|showtabline|shq|si|sidescroll|sidescrolloff|siso|sj|slm|smartcase|smartindent|smarttab|smc|smd|softtabstop|sol|spc|spell|spellcapcheck|spellfile|spelllang|spellsuggest|spf|spl|splitbelow|splitright|sps|sr|srr|ss|ssl|ssop|stal|startofline|statusline|stl|stmp|su|sua|suffixes|suffixesadd|sw|swapfile|swapsync|swb|swf|switchbuf|sws|sxq|syn|synmaxcol|syntax|t_AB|t_AF|t_AL|t_CS|t_CV|t_Ce|t_Co|t_Cs|t_DL|t_EI|t_F1|t_F2|t_F3|t_F4|t_F5|t_F6|t_F7|t_F8|t_F9|t_IE|t_IS|t_K1|t_K3|t_K4|t_K5|t_K6|t_K7|t_K8|t_K9|t_KA|t_KB|t_KC|t_KD|t_KE|t_KF|t_KG|t_KH|t_KI|t_KJ|t_KK|t_KL|t_RI|t_RV|t_SI|t_Sb|t_Sf|t_WP|t_WS|t_ZH|t_ZR|t_al|t_bc|t_cd|t_ce|t_cl|t_cm|t_cs|t_da|t_db|t_dl|t_fs|t_k1|t_k2|t_k3|t_k4|t_k5|t_k6|t_k7|t_k8|t_k9|t_kB|t_kD|t_kI|t_kN|t_kP|t_kb|t_kd|t_ke|t_kh|t_kl|t_kr|t_ks|t_ku|t_le|t_mb|t_md|t_me|t_mr|t_ms|t_nd|t_op|t_se|t_so|t_sr|t_te|t_ti|t_ts|t_ue|t_us|t_ut|t_vb|t_ve|t_vi|t_vs|t_xs|tabline|tabpagemax|tabstop|tagbsearch|taglength|tagrelative|tagstack|tal|tb|tbi|tbidi|tbis|tbs|tenc|term|termbidi|termencoding|terse|textauto|textmode|textwidth|tgst|thesaurus|tildeop|timeout|timeoutlen|title|titlelen|titleold|titlestring|toolbar|toolbariconsize|top|tpm|tsl|tsr|ttimeout|ttimeoutlen|ttm|tty|ttybuiltin|ttyfast|ttym|ttymouse|ttyscroll|ttytype|tw|tx|uc|ul|undolevels|updatecount|updatetime|ut|vb|vbs|vdir|verbosefile|vfile|viewdir|viewoptions|viminfo|virtualedit|visualbell|vop|wak|warn|wb|wc|wcm|wd|weirdinvert|wfh|wfw|whichwrap|wi|wig|wildchar|wildcharm|wildignore|wildmenu|wildmode|wildoptions|wim|winaltkeys|window|winfixheight|winfixwidth|winheight|winminheight|winminwidth|winwidth|wiv|wiw|wm|wmh|wmnu|wmw|wop|wrap|wrapmargin|wrapscan|writeany|writebackup|writedelay|ww)\b/,
"number": /\b(?:0x[\da-f]+|\d+(?:\.\d+)?)\b/i,
"operator": /\|\||&&|[-+.]=?|[=!](?:[=~][#?]?)?|[<>]=?[#?]?|[*\/%?]|\b(?:is(?:not)?)\b/,
"punctuation": /[{}[\](),;:]/
};
Prism.languages["visual-basic"] = {
"comment": {
pattern: /(?:['‘’]|REM\b)(?:[^\r\n_]|_(?:\r\n?|\n)?)*/i,
inside: {
"keyword": /^REM/i
}
},
"directive": {
pattern: /#(?:Const|Else|ElseIf|End|ExternalChecksum|ExternalSource|If|Region)(?:\b_[ \t]*(?:\r\n?|\n)|.)+/i,
alias: "property",
greedy: true
},
"string": {
pattern: /\$?["“”](?:["“”]{2}|[^"“”])*["“”]C?/i,
greedy: true
},
"date": {
pattern: /#[ \t]*(?:\d+([/-])\d+\1\d+(?:[ \t]+(?:\d+[ \t]*(?:AM|PM)|\d+:\d+(?::\d+)?(?:[ \t]*(?:AM|PM))?))?|\d+[ \t]*(?:AM|PM)|\d+:\d+(?::\d+)?(?:[ \t]*(?:AM|PM))?)[ \t]*#/i,
alias: "number"
},
"number": /(?:(?:\b\d+(?:\.\d+)?|\.\d+)(?:E[+-]?\d+)?|&[HO][\dA-F]+)(?:[FRD]|U?[ILS])?/i,
"boolean": /\b(?:False|Nothing|True)\b/i,
"keyword": /\b(?:AddHandler|AddressOf|Alias|And(?:Also)?|As|Boolean|ByRef|Byte|ByVal|Call|Case|Catch|C(?:Bool|Byte|Char|Date|Dbl|Dec|Int|Lng|Obj|SByte|Short|Sng|Str|Type|UInt|ULng|UShort)|Char|Class|Const|Continue|Currency|Date|Decimal|Declare|Default|Delegate|Dim|DirectCast|Do|Double|Each|Else(?:If)?|End(?:If)?|Enum|Erase|Error|Event|Exit|Finally|For|Friend|Function|Get(?:Type|XMLNamespace)?|Global|GoSub|GoTo|Handles|If|Implements|Imports|In|Inherits|Integer|Interface|Is|IsNot|Let|Lib|Like|Long|Loop|Me|Mod|Module|Must(?:Inherit|Override)|My(?:Base|Class)|Namespace|Narrowing|New|Next|Not(?:Inheritable|Overridable)?|Object|Of|On|Operator|Option(?:al)?|Or(?:Else)?|Out|Overloads|Overridable|Overrides|ParamArray|Partial|Private|Property|Protected|Public|RaiseEvent|ReadOnly|ReDim|RemoveHandler|Resume|Return|SByte|Select|Set|Shadows|Shared|short|Single|Static|Step|Stop|String|Structure|Sub|SyncLock|Then|Throw|To|Try|TryCast|Type|TypeOf|U(?:Integer|Long|Short)|Until|Using|Variant|Wend|When|While|Widening|With(?:Events)?|WriteOnly|Xor)\b/i,
"operator": /[+\-*/\\^<=>&#@$%!]|\b_(?=[ \t]*[\r\n])/,
"punctuation": /[{}().,:?]/
};
Prism.languages.vb = Prism.languages["visual-basic"];
Prism.languages.vba = Prism.languages["visual-basic"];
Prism.languages.warpscript = {
"comment": /#.*|\/\/.*|\/\*[\s\S]*?\*\//,
"string": {
pattern: /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'|<'(?:[^\\']|'(?!>)|\\.)*'>/,
greedy: true
},
"variable": /\$\S+/,
"macro": {
pattern: /@\S+/,
alias: "property"
},
// WarpScript doesn't have any keywords, these are all functions under the control category
// https://www.warp10.io/tags/control
"keyword": /\b(?:BREAK|CHECKMACRO|CONTINUE|CUDF|DEFINED|DEFINEDMACRO|EVAL|FAIL|FOR|FOREACH|FORSTEP|IFT|IFTE|MSGFAIL|NRETURN|RETHROW|RETURN|SWITCH|TRY|UDF|UNTIL|WHILE)\b/,
"number": /[+-]?\b(?:NaN|Infinity|\d+(?:\.\d*)?(?:[Ee][+-]?\d+)?|0x[\da-fA-F]+|0b[01]+)\b/,
"boolean": /\b(?:F|T|false|true)\b/,
"punctuation": /<%|%>|[{}[\]()]/,
// Some operators from the "operators" category
// https://www.warp10.io/tags/operators
"operator": /==|&&?|\|\|?|\*\*?|>>>?|<<|[<>!~]=?|[-/%^]|\+!?|\b(?:AND|NOT|OR)\b/
};
Prism.languages.wasm = {
"comment": [
/\(;[\s\S]*?;\)/,
{
pattern: /;;.*/,
greedy: true
}
],
"string": {
pattern: /"(?:\\[\s\S]|[^"\\])*"/,
greedy: true
},
"keyword": [
{
pattern: /\b(?:align|offset)=/,
inside: {
"operator": /=/
}
},
{
pattern: /\b(?:(?:f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|neg?|nearest|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|sqrt|store(?:8|16|32)?|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))?|memory\.(?:grow|size))\b/,
inside: {
"punctuation": /\./
}
},
/\b(?:anyfunc|block|br(?:_if|_table)?|call(?:_indirect)?|data|drop|elem|else|end|export|func|get_(?:global|local)|global|if|import|local|loop|memory|module|mut|nop|offset|param|result|return|select|set_(?:global|local)|start|table|tee_local|then|type|unreachable)\b/
],
"variable": /\$[\w!#$%&'*+\-./:<=>?@\\^`|~]+/,
"number": /[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/,
"punctuation": /[()]/
};
(function(Prism2) {
var id = /(?:\B-|\b_|\b)[A-Za-z][\w-]*(?![\w-])/.source;
var type = "(?:" + /\b(?:unsigned\s+)?long\s+long(?![\w-])/.source + "|" + /\b(?:unrestricted|unsigned)\s+[a-z]+(?![\w-])/.source + "|" + /(?!(?:unrestricted|unsigned)\b)/.source + id + /(?:\s*<(?:[^<>]|<[^<>]*>)*>)?/.source + ")" + /(?:\s*\?)?/.source;
var typeInside = {};
Prism2.languages["web-idl"] = {
"comment": {
pattern: /\/\/.*|\/\*[\s\S]*?\*\//,
greedy: true
},
"string": {
pattern: /"[^"]*"/,
greedy: true
},
"namespace": {
pattern: RegExp(/(\bnamespace\s+)/.source + id),
lookbehind: true
},
"class-name": [
{
pattern: /(^|[^\w-])(?:iterable|maplike|setlike)\s*<(?:[^<>]|<[^<>]*>)*>/,
lookbehind: true,
inside: typeInside
},
{
pattern: RegExp(/(\b(?:attribute|const|deleter|getter|optional|setter)\s+)/.source + type),
lookbehind: true,
inside: typeInside
},
{
// callback return type
pattern: RegExp("(" + /\bcallback\s+/.source + id + /\s*=\s*/.source + ")" + type),
lookbehind: true,
inside: typeInside
},
{
// typedef
pattern: RegExp(/(\btypedef\b\s*)/.source + type),
lookbehind: true,
inside: typeInside
},
{
pattern: RegExp(/(\b(?:callback|dictionary|enum|interface(?:\s+mixin)?)\s+)(?!(?:interface|mixin)\b)/.source + id),
lookbehind: true
},
{
// inheritance
pattern: RegExp(/(:\s*)/.source + id),
lookbehind: true
},
// includes and implements
RegExp(id + /(?=\s+(?:implements|includes)\b)/.source),
{
pattern: RegExp(/(\b(?:implements|includes)\s+)/.source + id),
lookbehind: true
},
{
// function return type, parameter types, and dictionary members
pattern: RegExp(type + "(?=" + /\s*(?:\.{3}\s*)?/.source + id + /\s*[(),;=]/.source + ")"),
inside: typeInside
}
],
"builtin": /\b(?:ArrayBuffer|BigInt64Array|BigUint64Array|ByteString|DOMString|DataView|Float32Array|Float64Array|FrozenArray|Int16Array|Int32Array|Int8Array|ObservableArray|Promise|USVString|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray)\b/,
"keyword": [
/\b(?:async|attribute|callback|const|constructor|deleter|dictionary|enum|getter|implements|includes|inherit|interface|mixin|namespace|null|optional|or|partial|readonly|required|setter|static|stringifier|typedef|unrestricted)\b/,
// type keywords
/\b(?:any|bigint|boolean|byte|double|float|iterable|long|maplike|object|octet|record|sequence|setlike|short|symbol|undefined|unsigned|void)\b/
],
"boolean": /\b(?:false|true)\b/,
"number": {
pattern: /(^|[^\w-])-?(?:0x[0-9a-f]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|NaN|Infinity)(?![\w-])/i,
lookbehind: true
},
"operator": /\.{3}|[=:?<>-]/,
"punctuation": /[(){}[\].,;]/
};
for (var key in Prism2.languages["web-idl"]) {
if (key !== "class-name") {
typeInside[key] = Prism2.languages["web-idl"][key];
}
}
Prism2.languages["webidl"] = Prism2.languages["web-idl"];
})(Prism);
Prism.languages.wgsl = {
"comment": {
pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
greedy: true
},
"builtin-attribute": {
pattern: /(@)builtin\(.*?\)/,
lookbehind: true,
inside: {
"attribute": {
pattern: /^builtin/,
alias: "attr-name"
},
"punctuation": /[(),]/,
"built-in-values": {
pattern: /\b(?:frag_depth|front_facing|global_invocation_id|instance_index|local_invocation_id|local_invocation_index|num_workgroups|position|sample_index|sample_mask|vertex_index|workgroup_id)\b/,
alias: "attr-value"
}
}
},
"attributes": {
pattern: /(@)(?:align|binding|compute|const|fragment|group|id|interpolate|invariant|location|size|vertex|workgroup_size)/i,
lookbehind: true,
alias: "attr-name"
},
"functions": {
pattern: /\b(fn\s+)[_a-zA-Z]\w*(?=[(<])/,
lookbehind: true,
alias: "function"
},
"keyword": /\b(?:bitcast|break|case|const|continue|continuing|default|discard|else|enable|fallthrough|fn|for|function|if|let|loop|private|return|storage|struct|switch|type|uniform|var|while|workgroup)\b/,
"builtin": /\b(?:abs|acos|acosh|all|any|array|asin|asinh|atan|atan2|atanh|atomic|atomicAdd|atomicAnd|atomicCompareExchangeWeak|atomicExchange|atomicLoad|atomicMax|atomicMin|atomicOr|atomicStore|atomicSub|atomicXor|bool|ceil|clamp|cos|cosh|countLeadingZeros|countOneBits|countTrailingZeros|cross|degrees|determinant|distance|dot|dpdx|dpdxCoarse|dpdxFine|dpdy|dpdyCoarse|dpdyFine|exp|exp2|extractBits|f32|f64|faceForward|firstLeadingBit|floor|fma|fract|frexp|fwidth|fwidthCoarse|fwidthFine|i32|i64|insertBits|inverseSqrt|ldexp|length|log|log2|mat[2-4]x[2-4]|max|min|mix|modf|normalize|override|pack2x16float|pack2x16snorm|pack2x16unorm|pack4x8snorm|pack4x8unorm|pow|ptr|quantizeToF16|radians|reflect|refract|reverseBits|round|sampler|sampler_comparison|select|shiftLeft|shiftRight|sign|sin|sinh|smoothstep|sqrt|staticAssert|step|storageBarrier|tan|tanh|textureDimensions|textureGather|textureGatherCompare|textureLoad|textureNumLayers|textureNumLevels|textureNumSamples|textureSample|textureSampleBias|textureSampleCompare|textureSampleCompareLevel|textureSampleGrad|textureSampleLevel|textureStore|texture_1d|texture_2d|texture_2d_array|texture_3d|texture_cube|texture_cube_array|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d|texture_multisampled_2d|texture_storage_1d|texture_storage_2d|texture_storage_2d_array|texture_storage_3d|transpose|trunc|u32|u64|unpack2x16float|unpack2x16snorm|unpack2x16unorm|unpack4x8snorm|unpack4x8unorm|vec[2-4]|workgroupBarrier)\b/,
"function-calls": {
pattern: /\b[_a-z]\w*(?=\()/i,
alias: "function"
},
"class-name": /\b(?:[A-Z][A-Za-z0-9]*)\b/,
"bool-literal": {
pattern: /\b(?:false|true)\b/,
alias: "boolean"
},
"hex-int-literal": {
pattern: /\b0[xX][0-9a-fA-F]+[iu]?\b(?![.pP])/,
alias: "number"
},
"hex-float-literal": {
pattern: /\b0[xX][0-9a-fA-F]*(?:\.[0-9a-fA-F]*)?(?:[pP][+-]?\d+[fh]?)?/,
alias: "number"
},
"decimal-float-literal": [
{ pattern: /\d*\.\d+(?:[eE](?:\+|-)?\d+)?[fh]?/, alias: "number" },
{ pattern: /\d+\.\d*(?:[eE](?:\+|-)?\d+)?[fh]?/, alias: "number" },
{ pattern: /\d+[eE](?:\+|-)?\d+[fh]?/, alias: "number" },
{ pattern: /\b\d+[fh]\b/, alias: "number" }
],
"int-literal": {
pattern: /\b\d+[iu]?\b/,
alias: "number"
},
"operator": [
{ pattern: /(?:\^|~|\|(?!\|)|\|\||&&|<<|>>|!)(?!=)/ },
{ pattern: /&(?![&=])/ },
{ pattern: /(?:\+=|-=|\*=|\/=|%=|\^=|&=|\|=|<<=|>>=)/ },
{ pattern: /(^|[^<>=!])=(?![=>])/, lookbehind: true },
{ pattern: /(?:==|!=|<=|\+\+|--|(^|[^=])>=)/, lookbehind: true },
{ pattern: /(?:(?:[+%]|(?:\*(?!\w)))(?!=))|(?:-(?!>))|(?:\/(?!\/))/ },
{ pattern: /->/ }
],
"punctuation": /[@(){}[\],;<>:.]/
};
Prism.languages.wiki = Prism.languages.extend("markup", {
"block-comment": {
pattern: /(^|[^\\])\/\*[\s\S]*?\*\//,
lookbehind: true,
alias: "comment"
},
"heading": {
pattern: /^(=+)[^=\r\n].*?\1/m,
inside: {
"punctuation": /^=+|=+$/,
"important": /.+/
}
},
"emphasis": {
// TODO Multi-line
pattern: /('{2,5}).+?\1/,
inside: {
"bold-italic": {
pattern: /(''''').+?(?=\1)/,
lookbehind: true,
alias: ["bold", "italic"]
},
"bold": {
pattern: /(''')[^'](?:.*?[^'])?(?=\1)/,
lookbehind: true
},
"italic": {
pattern: /('')[^'](?:.*?[^'])?(?=\1)/,
lookbehind: true
},
"punctuation": /^''+|''+$/
}
},
"hr": {
pattern: /^-{4,}/m,
alias: "punctuation"
},
"url": [
/ISBN +(?:97[89][ -]?)?(?:\d[ -]?){9}[\dx]\b|(?:PMID|RFC) +\d+/i,
/\[\[.+?\]\]|\[.+?\]/
],
"variable": [
/__[A-Z]+__/,
// FIXME Nested structures should be handled
// {{formatnum:{{#expr:{{{3}}}}}}}
/\{{3}.+?\}{3}/,
/\{\{.+?\}\}/
],
"symbol": [
/^#redirect/im,
/~{3,5}/
],
// Handle table attrs:
// {|
// ! style="text-align:left;"| Item
// |}
"table-tag": {
pattern: /((?:^|[|!])[|!])[^|\r\n]+\|(?!\|)/m,
lookbehind: true,
inside: {
"table-bar": {
pattern: /\|$/,
alias: "punctuation"
},
rest: Prism.languages.markup["tag"].inside
}
},
"punctuation": /^(?:\{\||\|\}|\|-|[*#:;!|])|\|\||!!/m
});
Prism.languages.insertBefore("wiki", "tag", {
// Prevent highlighting inside <nowiki>, <source> and <pre> tags
"nowiki": {
pattern: /<(nowiki|pre|source)\b[^>]*>[\s\S]*?<\/\1>/i,
inside: {
"tag": {
pattern: /<(?:nowiki|pre|source)\b[^>]*>|<\/(?:nowiki|pre|source)>/i,
inside: Prism.languages.markup["tag"].inside
}
}
}
});
Prism.languages.wolfram = {
"comment": (
// Allow one level of nesting - note: regex taken from applescipt
/\(\*(?:\(\*(?:[^*]|\*(?!\)))*\*\)|(?!\(\*)[\s\S])*?\*\)/
),
"string": {
pattern: /"(?:\\.|[^"\\\r\n])*"/,
greedy: true
},
"keyword": /\b(?:Abs|AbsArg|Accuracy|Block|Do|For|Function|If|Manipulate|Module|Nest|NestList|None|Return|Switch|Table|Which|While)\b/,
"context": {
pattern: /\b\w+`+\w*/,
alias: "class-name"
},
"blank": {
pattern: /\b\w+_\b/,
alias: "regex"
},
"global-variable": {
pattern: /\$\w+/,
alias: "variable"
},
"boolean": /\b(?:False|True)\b/,
"number": /(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?j?\b/i,
"operator": /\/\.|;|=\.|\^=|\^:=|:=|<<|>>|<\||\|>|:>|\|->|->|<-|@@@|@@|@|\/@|=!=|===|==|=|\+|-|\[\/-+%=\]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
"punctuation": /[{}[\];(),.:]/
};
Prism.languages.mathematica = Prism.languages.wolfram;
Prism.languages.wl = Prism.languages.wolfram;
Prism.languages.nb = Prism.languages.wolfram;
Prism.languages.wren = {
// Multiline comments in Wren can have nested multiline comments
// Comments: // and /* */
"comment": [
{
// support 3 levels of nesting
// regex: \/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\/
pattern: /\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|\/\*(?:[^*/]|\*(?!\/)|\/(?!\*))*\*\/)*\*\/)*\*\//,
greedy: true
},
{
pattern: /(^|[^\\:])\/\/.*/,
lookbehind: true,
greedy: true
}
],
// Triple quoted strings are multiline but cannot have interpolation (raw strings)
// Based on prism-python.js
"triple-quoted-string": {
pattern: /"""[\s\S]*?"""/,
greedy: true,
alias: "string"
},
// see below
"string-literal": null,
// #!/usr/bin/env wren on the first line
"hashbang": {
pattern: /^#!\/.+/,
greedy: true,
alias: "comment"
},
// Attributes are special keywords to add meta data to classes
"attribute": {
// #! attributes are stored in class properties
// #!myvar = true
// #attributes are not stored and dismissed at compilation
pattern: /#!?[ \t\u3000]*\w+/,
alias: "keyword"
},
"class-name": [
{
// class definition
// class Meta {}
pattern: /(\bclass\s+)\w+/,
lookbehind: true
},
// A class must always start with an uppercase.
// File.read
/\b[A-Z][a-z\d_]*\b/
],
// A constant can be a variable, class, property or method. Just named in all uppercase letters
"constant": /\b[A-Z][A-Z\d_]*\b/,
"null": {
pattern: /\bnull\b/,
alias: "keyword"
},
"keyword": /\b(?:as|break|class|construct|continue|else|for|foreign|if|import|in|is|return|static|super|this|var|while)\b/,
"boolean": /\b(?:false|true)\b/,
"number": /\b(?:0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)\b/i,
// Functions can be Class.method()
"function": /\b[a-z_]\w*(?=\s*[({])/i,
"operator": /<<|>>|[=!<>]=?|&&|\|\||[-+*/%~^&|?:]|\.{2,3}/,
"punctuation": /[\[\](){}.,;]/
};
Prism.languages.wren["string-literal"] = {
// A single quote string is multiline and can have interpolation (similar to JS backticks ``)
pattern: /(^|[^\\"])"(?:[^\\"%]|\\[\s\S]|%(?!\()|%\((?:[^()]|\((?:[^()]|\([^)]*\))*\))*\))*"/,
lookbehind: true,
greedy: true,
inside: {
"interpolation": {
// "%(interpolation)"
pattern: /((?:^|[^\\])(?:\\{2})*)%\((?:[^()]|\((?:[^()]|\([^)]*\))*\))*\)/,
lookbehind: true,
inside: {
"expression": {
pattern: /^(%\()[\s\S]+(?=\)$)/,
lookbehind: true,
inside: Prism.languages.wren
},
"interpolation-punctuation": {
pattern: /^%\(|\)$/,
alias: "punctuation"
}
}
},
"string": /[\s\S]+/
}
};
(function(Prism2) {
Prism2.languages.xeora = Prism2.languages.extend("markup", {
"constant": {
pattern: /\$(?:DomainContents|PageRenderDuration)\$/,
inside: {
"punctuation": {
pattern: /\$/
}
}
},
"variable": {
pattern: /\$@?(?:#+|[-+*~=^])?[\w.]+\$/,
inside: {
"punctuation": {
pattern: /[$.]/
},
"operator": {
pattern: /#+|[-+*~=^@]/
}
}
},
"function-inline": {
pattern: /\$F:[-\w.]+\?[-\w.]+(?:,(?:(?:@[-#]*\w+\.[\w+.]\.*)*\|)*(?:(?:[\w+]|[-#*.~^]+[\w+]|=\S)(?:[^$=]|=+[^=])*=*|(?:@[-#]*\w+\.[\w+.]\.*)+(?:(?:[\w+]|[-#*~^][-#*.~^]*[\w+]|=\S)(?:[^$=]|=+[^=])*=*)?)?)?\$/,
inside: {
"variable": {
pattern: /(?:[,|])@?(?:#+|[-+*~=^])?[\w.]+/,
inside: {
"punctuation": {
pattern: /[,.|]/
},
"operator": {
pattern: /#+|[-+*~=^@]/
}
}
},
"punctuation": {
pattern: /\$\w:|[$:?.,|]/
}
},
alias: "function"
},
"function-block": {
pattern: /\$XF:\{[-\w.]+\?[-\w.]+(?:,(?:(?:@[-#]*\w+\.[\w+.]\.*)*\|)*(?:(?:[\w+]|[-#*.~^]+[\w+]|=\S)(?:[^$=]|=+[^=])*=*|(?:@[-#]*\w+\.[\w+.]\.*)+(?:(?:[\w+]|[-#*~^][-#*.~^]*[\w+]|=\S)(?:[^$=]|=+[^=])*=*)?)?)?\}:XF\$/,
inside: {
"punctuation": {
pattern: /[$:{}?.,|]/
}
},
alias: "function"
},
"directive-inline": {
pattern: /\$\w(?:#\d+\+?)?(?:\[[-\w.]+\])?:[-\/\w.]+\$/,
inside: {
"punctuation": {
pattern: /\$(?:\w:|C(?:\[|#\d))?|[:{[\]]/,
inside: {
"tag": {
pattern: /#\d/
}
}
}
},
alias: "function"
},
"directive-block-open": {
pattern: /\$\w+:\{|\$\w(?:#\d+\+?)?(?:\[[-\w.]+\])?:[-\w.]+:\{(?:![A-Z]+)?/,
inside: {
"punctuation": {
pattern: /\$(?:\w:|C(?:\[|#\d))?|[:{[\]]/,
inside: {
"tag": {
pattern: /#\d/
}
}
},
"attribute": {
pattern: /![A-Z]+$/,
inside: {
"punctuation": {
pattern: /!/
}
},
alias: "keyword"
}
},
alias: "function"
},
"directive-block-separator": {
pattern: /\}:[-\w.]+:\{/,
inside: {
"punctuation": {
pattern: /[:{}]/
}
},
alias: "function"
},
"directive-block-close": {
pattern: /\}:[-\w.]+\$/,
inside: {
"punctuation": {
pattern: /[:{}$]/
}
},
alias: "function"
}
});
Prism2.languages.insertBefore("inside", "punctuation", {
"variable": Prism2.languages.xeora["function-inline"].inside["variable"]
}, Prism2.languages.xeora["function-block"]);
Prism2.languages.xeoracube = Prism2.languages.xeora;
})(Prism);
(function(Prism2) {
function insertDocComment(lang, docComment) {
if (Prism2.languages[lang]) {
Prism2.languages.insertBefore(lang, "comment", {
"doc-comment": docComment
});
}
}
var tag = Prism2.languages.markup.tag;
var slashDocComment = {
pattern: /\/\/\/.*/,
greedy: true,
alias: "comment",
inside: {
"tag": tag
}
};
var tickDocComment = {
pattern: /'''.*/,
greedy: true,
alias: "comment",
inside: {
"tag": tag
}
};
insertDocComment("csharp", slashDocComment);
insertDocComment("fsharp", slashDocComment);
insertDocComment("vbnet", tickDocComment);
})(Prism);
Prism.languages.xojo = {
"comment": {
pattern: /(?:'|\/\/|Rem\b).+/i,
greedy: true
},
"string": {
pattern: /"(?:""|[^"])*"/,
greedy: true
},
"number": [
/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,
/&[bchou][a-z\d]+/i
],
"directive": {
pattern: /#(?:Else|ElseIf|Endif|If|Pragma)\b/i,
alias: "property"
},
"keyword": /\b(?:AddHandler|App|Array|As(?:signs)?|Auto|Boolean|Break|By(?:Ref|Val)|Byte|Call|Case|Catch|CFStringRef|CGFloat|Class|Color|Const|Continue|CString|Currency|CurrentMethodName|Declare|Delegate|Dim|Do(?:uble|wnTo)?|Each|Else(?:If)?|End|Enumeration|Event|Exception|Exit|Extends|False|Finally|For|Function|Get|GetTypeInfo|Global|GOTO|If|Implements|In|Inherits|Int(?:8|16|32|64|eger|erface)?|Lib|Loop|Me|Module|Next|Nil|Object|Optional|OSType|ParamArray|Private|Property|Protected|PString|Ptr|Raise(?:Event)?|ReDim|RemoveHandler|Return|Select(?:or)?|Self|Set|Shared|Short|Single|Soft|Static|Step|String|Sub|Super|Text|Then|To|True|Try|Ubound|UInt(?:8|16|32|64|eger)?|Until|Using|Var(?:iant)?|Wend|While|WindowPtr|WString)\b/i,
"operator": /<[=>]?|>=?|[+\-*\/\\^=]|\b(?:AddressOf|And|Ctype|IsA?|Mod|New|Not|Or|WeakAddressOf|Xor)\b/i,
"punctuation": /[.,;:()]/
};
(function(Prism2) {
Prism2.languages.xquery = Prism2.languages.extend("markup", {
"xquery-comment": {
pattern: /\(:[\s\S]*?:\)/,
greedy: true,
alias: "comment"
},
"string": {
pattern: /(["'])(?:\1\1|(?!\1)[\s\S])*\1/,
greedy: true
},
"extension": {
pattern: /\(#.+?#\)/,
alias: "symbol"
},
"variable": /\$[-\w:]+/,
"axis": {
pattern: /(^|[^-])(?:ancestor(?:-or-self)?|attribute|child|descendant(?:-or-self)?|following(?:-sibling)?|parent|preceding(?:-sibling)?|self)(?=::)/,
lookbehind: true,
alias: "operator"
},
"keyword-operator": {
pattern: /(^|[^:-])\b(?:and|castable as|div|eq|except|ge|gt|idiv|instance of|intersect|is|le|lt|mod|ne|or|union)\b(?=$|[^:-])/,
lookbehind: true,
alias: "operator"
},
"keyword": {
pattern: /(^|[^:-])\b(?:as|ascending|at|base-uri|boundary-space|case|cast as|collation|construction|copy-namespaces|declare|default|descending|else|empty (?:greatest|least)|encoding|every|external|for|function|if|import|in|inherit|lax|let|map|module|namespace|no-inherit|no-preserve|option|order(?: by|ed|ing)?|preserve|return|satisfies|schema|some|stable|strict|strip|then|to|treat as|typeswitch|unordered|validate|variable|version|where|xquery)\b(?=$|[^:-])/,
lookbehind: true
},
"function": /[\w-]+(?::[\w-]+)*(?=\s*\()/,
"xquery-element": {
pattern: /(element\s+)[\w-]+(?::[\w-]+)*/,
lookbehind: true,
alias: "tag"
},
"xquery-attribute": {
pattern: /(attribute\s+)[\w-]+(?::[\w-]+)*/,
lookbehind: true,
alias: "attr-name"
},
"builtin": {
pattern: /(^|[^:-])\b(?:attribute|comment|document|element|processing-instruction|text|xs:(?:ENTITIES|ENTITY|ID|IDREFS?|NCName|NMTOKENS?|NOTATION|Name|QName|anyAtomicType|anyType|anyURI|base64Binary|boolean|byte|date|dateTime|dayTimeDuration|decimal|double|duration|float|gDay|gMonth|gMonthDay|gYear|gYearMonth|hexBinary|int|integer|language|long|negativeInteger|nonNegativeInteger|nonPositiveInteger|normalizedString|positiveInteger|short|string|time|token|unsigned(?:Byte|Int|Long|Short)|untyped(?:Atomic)?|yearMonthDuration))\b(?=$|[^:-])/,
lookbehind: true
},
"number": /\b\d+(?:\.\d+)?(?:E[+-]?\d+)?/,
"operator": [
/[+*=?|@]|\.\.?|:=|!=|<[=<]?|>[=>]?/,
{
pattern: /(\s)-(?=\s)/,
lookbehind: true
}
],
"punctuation": /[[\](){},;:/]/
});
Prism2.languages.xquery.tag.pattern = /<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|\{(?!\{)(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\}|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/;
Prism2.languages.xquery["tag"].inside["attr-value"].pattern = /=(?:("|')(?:\\[\s\S]|\{(?!\{)(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\}|(?!\1)[^\\])*\1|[^\s'">=]+)/;
Prism2.languages.xquery["tag"].inside["attr-value"].inside["punctuation"] = /^="|"$/;
Prism2.languages.xquery["tag"].inside["attr-value"].inside["expression"] = {
// Allow for two levels of nesting
pattern: /\{(?!\{)(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\}/,
inside: Prism2.languages.xquery,
alias: "language-xquery"
};
var stringifyToken = function(token) {
if (typeof token === "string") {
return token;
}
if (typeof token.content === "string") {
return token.content;
}
return token.content.map(stringifyToken).join("");
};
var walkTokens = function(tokens) {
var openedTags = [];
for (var i = 0; i < tokens.length; i++) {
var token = tokens[i];
var notTagNorBrace = false;
if (typeof token !== "string") {
if (token.type === "tag" && token.content[0] && token.content[0].type === "tag") {
if (token.content[0].content[0].content === "</") {
if (openedTags.length > 0 && openedTags[openedTags.length - 1].tagName === stringifyToken(token.content[0].content[1])) {
openedTags.pop();
}
} else {
if (token.content[token.content.length - 1].content === "/>") {
} else {
openedTags.push({
tagName: stringifyToken(token.content[0].content[1]),
openedBraces: 0
});
}
}
} else if (openedTags.length > 0 && token.type === "punctuation" && token.content === "{" && // Ignore `{{`
(!tokens[i + 1] || tokens[i + 1].type !== "punctuation" || tokens[i + 1].content !== "{") && (!tokens[i - 1] || tokens[i - 1].type !== "plain-text" || tokens[i - 1].content !== "{")) {
openedTags[openedTags.length - 1].openedBraces++;
} else if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces > 0 && token.type === "punctuation" && token.content === "}") {
openedTags[openedTags.length - 1].openedBraces--;
} else if (token.type !== "comment") {
notTagNorBrace = true;
}
}
if (notTagNorBrace || typeof token === "string") {
if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces === 0) {
var plainText = stringifyToken(token);
if (i < tokens.length - 1 && (typeof tokens[i + 1] === "string" || tokens[i + 1].type === "plain-text")) {
plainText += stringifyToken(tokens[i + 1]);
tokens.splice(i + 1, 1);
}
if (i > 0 && (typeof tokens[i - 1] === "string" || tokens[i - 1].type === "plain-text")) {
plainText = stringifyToken(tokens[i - 1]) + plainText;
tokens.splice(i - 1, 1);
i--;
}
if (/^\s+$/.test(plainText)) {
tokens[i] = plainText;
} else {
tokens[i] = new Prism2.Token("plain-text", plainText, null, plainText);
}
}
}
if (token.content && typeof token.content !== "string") {
walkTokens(token.content);
}
}
};
Prism2.hooks.add("after-tokenize", function(env) {
if (env.language !== "xquery") {
return;
}
walkTokens(env.tokens);
});
})(Prism);
Prism.languages.yang = {
// https://tools.ietf.org/html/rfc6020#page-34
// http://www.yang-central.org/twiki/bin/view/Main/YangExamples
"comment": /\/\*[\s\S]*?\*\/|\/\/.*/,
"string": {
pattern: /"(?:[^\\"]|\\.)*"|'[^']*'/,
greedy: true
},
"keyword": {
pattern: /(^|[{};\r\n][ \t]*)[a-z_][\w.-]*/i,
lookbehind: true
},
"namespace": {
pattern: /(\s)[a-z_][\w.-]*(?=:)/i,
lookbehind: true
},
"boolean": /\b(?:false|true)\b/,
"operator": /\+/,
"punctuation": /[{};:]/
};
(function(Prism2) {
function literal(str) {
return function() {
return str;
};
}
var keyword = /\b(?:align|allowzero|and|anyframe|anytype|asm|async|await|break|cancel|catch|comptime|const|continue|defer|else|enum|errdefer|error|export|extern|fn|for|if|inline|linksection|nakedcc|noalias|nosuspend|null|or|orelse|packed|promise|pub|resume|return|stdcallcc|struct|suspend|switch|test|threadlocal|try|undefined|union|unreachable|usingnamespace|var|volatile|while)\b/;
var IDENTIFIER = "\\b(?!" + keyword.source + ")(?!\\d)\\w+\\b";
var ALIGN = /align\s*\((?:[^()]|\([^()]*\))*\)/.source;
var PREFIX_TYPE_OP = /(?:\?|\bpromise->|(?:\[[^[\]]*\]|\*(?!\*)|\*\*)(?:\s*<ALIGN>|\s*const\b|\s*volatile\b|\s*allowzero\b)*)/.source.replace(/<ALIGN>/g, literal(ALIGN));
var SUFFIX_EXPR = /(?:\bpromise\b|(?:\berror\.)?<ID>(?:\.<ID>)*(?!\s+<ID>))/.source.replace(/<ID>/g, literal(IDENTIFIER));
var TYPE = "(?!\\s)(?:!?\\s*(?:" + PREFIX_TYPE_OP + "\\s*)*" + SUFFIX_EXPR + ")+";
Prism2.languages.zig = {
"comment": [
{
pattern: /\/\/[/!].*/,
alias: "doc-comment"
},
/\/{2}.*/
],
"string": [
{
// "string" and c"string"
pattern: /(^|[^\\@])c?"(?:[^"\\\r\n]|\\.)*"/,
lookbehind: true,
greedy: true
},
{
// multiline strings and c-strings
pattern: /([\r\n])([ \t]+c?\\{2}).*(?:(?:\r\n?|\n)\2.*)*/,
lookbehind: true,
greedy: true
}
],
"char": {
// characters 'a', '\n', '\xFF', '\u{10FFFF}'
pattern: /(^|[^\\])'(?:[^'\\\r\n]|[\uD800-\uDFFF]{2}|\\(?:.|x[a-fA-F\d]{2}|u\{[a-fA-F\d]{1,6}\}))'/,
lookbehind: true,
greedy: true
},
"builtin": /\B@(?!\d)\w+(?=\s*\()/,
"label": {
pattern: /(\b(?:break|continue)\s*:\s*)\w+\b|\b(?!\d)\w+\b(?=\s*:\s*(?:\{|while\b))/,
lookbehind: true
},
"class-name": [
// const Foo = struct {};
/\b(?!\d)\w+(?=\s*=\s*(?:(?:extern|packed)\s+)?(?:enum|struct|union)\s*[({])/,
{
// const x: i32 = 9;
// var x: Bar;
// fn foo(x: bool, y: f32) void {}
pattern: RegExp(/(:\s*)<TYPE>(?=\s*(?:<ALIGN>\s*)?[=;,)])|<TYPE>(?=\s*(?:<ALIGN>\s*)?\{)/.source.replace(/<TYPE>/g, literal(TYPE)).replace(/<ALIGN>/g, literal(ALIGN))),
lookbehind: true,
inside: null
// see below
},
{
// extern fn foo(x: f64) f64; (optional alignment)
pattern: RegExp(/(\)\s*)<TYPE>(?=\s*(?:<ALIGN>\s*)?;)/.source.replace(/<TYPE>/g, literal(TYPE)).replace(/<ALIGN>/g, literal(ALIGN))),
lookbehind: true,
inside: null
// see below
}
],
"builtin-type": {
pattern: /\b(?:anyerror|bool|c_u?(?:int|long|longlong|short)|c_longdouble|c_void|comptime_(?:float|int)|f(?:16|32|64|128)|[iu](?:8|16|32|64|128|size)|noreturn|type|void)\b/,
alias: "keyword"
},
"keyword": keyword,
"function": /\b(?!\d)\w+(?=\s*\()/,
"number": /\b(?:0b[01]+|0o[0-7]+|0x[a-fA-F\d]+(?:\.[a-fA-F\d]*)?(?:[pP][+-]?[a-fA-F\d]+)?|\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)\b/,
"boolean": /\b(?:false|true)\b/,
"operator": /\.[*?]|\.{2,3}|[-=]>|\*\*|\+\+|\|\||(?:<<|>>|[-+*]%|[-+*/%^&|<>!=])=?|[?~]/,
"punctuation": /[.:,;(){}[\]]/
};
Prism2.languages.zig["class-name"].forEach(function(obj) {
if (obj.inside === null) {
obj.inside = Prism2.languages.zig;
}
});
})(Prism);
(function() {
if (typeof Prism === "undefined" || typeof document === "undefined") {
return;
}
var PLUGIN_NAME = "line-numbers";
var NEW_LINE_EXP = /\n(?!$)/g;
var config = Prism.plugins.lineNumbers = {
/**
* Get node for provided line number
*
* @param {Element} element pre element
* @param {number} number line number
* @returns {Element|undefined}
*/
getLine: function(element, number) {
if (element.tagName !== "PRE" || !element.classList.contains(PLUGIN_NAME)) {
return;
}
var lineNumberRows = element.querySelector(".line-numbers-rows");
if (!lineNumberRows) {
return;
}
var lineNumberStart = parseInt(element.getAttribute("data-start"), 10) || 1;
var lineNumberEnd = lineNumberStart + (lineNumberRows.children.length - 1);
if (number < lineNumberStart) {
number = lineNumberStart;
}
if (number > lineNumberEnd) {
number = lineNumberEnd;
}
var lineIndex = number - lineNumberStart;
return lineNumberRows.children[lineIndex];
},
/**
* Resizes the line numbers of the given element.
*
* This function will not add line numbers. It will only resize existing ones.
*
* @param {HTMLElement} element A `<pre>` element with line numbers.
* @returns {void}
*/
resize: function(element) {
resizeElements([element]);
},
/**
* Whether the plugin can assume that the units font sizes and margins are not depended on the size of
* the current viewport.
*
* Setting this to `true` will allow the plugin to do certain optimizations for better performance.
*
* Set this to `false` if you use any of the following CSS units: `vh`, `vw`, `vmin`, `vmax`.
*
* @type {boolean}
*/
assumeViewportIndependence: true
};
function resizeElements(elements) {
elements = elements.filter(function(e) {
var codeStyles = getStyles(e);
var whiteSpace = codeStyles["white-space"];
return whiteSpace === "pre-wrap" || whiteSpace === "pre-line";
});
if (elements.length == 0) {
return;
}
var infos = elements.map(function(element) {
var codeElement = element.querySelector("code");
var lineNumbersWrapper = element.querySelector(".line-numbers-rows");
if (!codeElement || !lineNumbersWrapper) {
return void 0;
}
var lineNumberSizer = element.querySelector(".line-numbers-sizer");
var codeLines = codeElement.textContent.split(NEW_LINE_EXP);
if (!lineNumberSizer) {
lineNumberSizer = document.createElement("span");
lineNumberSizer.className = "line-numbers-sizer";
codeElement.appendChild(lineNumberSizer);
}
lineNumberSizer.innerHTML = "0";
lineNumberSizer.style.display = "block";
var oneLinerHeight = lineNumberSizer.getBoundingClientRect().height;
lineNumberSizer.innerHTML = "";
return {
element,
lines: codeLines,
lineHeights: [],
oneLinerHeight,
sizer: lineNumberSizer
};
}).filter(Boolean);
infos.forEach(function(info) {
var lineNumberSizer = info.sizer;
var lines = info.lines;
var lineHeights = info.lineHeights;
var oneLinerHeight = info.oneLinerHeight;
lineHeights[lines.length - 1] = void 0;
lines.forEach(function(line, index) {
if (line && line.length > 1) {
var e = lineNumberSizer.appendChild(document.createElement("span"));
e.style.display = "block";
e.textContent = line;
} else {
lineHeights[index] = oneLinerHeight;
}
});
});
infos.forEach(function(info) {
var lineNumberSizer = info.sizer;
var lineHeights = info.lineHeights;
var childIndex = 0;
for (var i = 0; i < lineHeights.length; i++) {
if (lineHeights[i] === void 0) {
lineHeights[i] = lineNumberSizer.children[childIndex++].getBoundingClientRect().height;
}
}
});
infos.forEach(function(info) {
var lineNumberSizer = info.sizer;
var wrapper = info.element.querySelector(".line-numbers-rows");
lineNumberSizer.style.display = "none";
lineNumberSizer.innerHTML = "";
info.lineHeights.forEach(function(height, lineNumber) {
wrapper.children[lineNumber].style.height = height + "px";
});
});
}
function getStyles(element) {
if (!element) {
return null;
}
return window.getComputedStyle ? getComputedStyle(element) : element.currentStyle || null;
}
var lastWidth = void 0;
window.addEventListener("resize", function() {
if (config.assumeViewportIndependence && lastWidth === window.innerWidth) {
return;
}
lastWidth = window.innerWidth;
resizeElements(Array.prototype.slice.call(document.querySelectorAll("pre." + PLUGIN_NAME)));
});
Prism.hooks.add("complete", function(env) {
if (!env.code) {
return;
}
var code = (
/** @type {Element} */
env.element
);
var pre = (
/** @type {HTMLElement} */
code.parentNode
);
if (!pre || !/pre/i.test(pre.nodeName)) {
return;
}
if (code.querySelector(".line-numbers-rows")) {
return;
}
if (!Prism.util.isActive(code, PLUGIN_NAME)) {
return;
}
code.classList.remove(PLUGIN_NAME);
pre.classList.add(PLUGIN_NAME);
var match = env.code.match(NEW_LINE_EXP);
var linesNum = match ? match.length + 1 : 1;
var lineNumbersWrapper;
var lines = new Array(linesNum + 1).join("<span></span>");
lineNumbersWrapper = document.createElement("span");
lineNumbersWrapper.setAttribute("aria-hidden", "true");
lineNumbersWrapper.className = "line-numbers-rows";
lineNumbersWrapper.innerHTML = lines;
if (pre.hasAttribute("data-start")) {
pre.style.counterReset = "linenumber " + (parseInt(pre.getAttribute("data-start"), 10) - 1);
}
env.element.appendChild(lineNumbersWrapper);
resizeElements([pre]);
Prism.hooks.run("line-numbers", env);
});
Prism.hooks.add("line-numbers", function(env) {
env.plugins = env.plugins || {};
env.plugins.lineNumbers = true;
});
})();
(function() {
if (typeof Prism === "undefined" || typeof document === "undefined") {
return;
}
if (!Element.prototype.matches) {
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
}
var LOADING_MESSAGE = "Loading\u2026";
var FAILURE_MESSAGE = function(status, message) {
return "\u2716 Error " + status + " while fetching file: " + message;
};
var FAILURE_EMPTY_MESSAGE = "\u2716 Error: File does not exist or is empty";
var EXTENSIONS = {
"js": "javascript",
"py": "python",
"rb": "ruby",
"ps1": "powershell",
"psm1": "powershell",
"sh": "bash",
"bat": "batch",
"h": "c",
"tex": "latex"
};
var STATUS_ATTR = "data-src-status";
var STATUS_LOADING = "loading";
var STATUS_LOADED = "loaded";
var STATUS_FAILED = "failed";
var SELECTOR = "pre[data-src]:not([" + STATUS_ATTR + '="' + STATUS_LOADED + '"]):not([' + STATUS_ATTR + '="' + STATUS_LOADING + '"])';
function loadFile(src, success, error) {
var xhr = new XMLHttpRequest();
xhr.open("GET", src, true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
if (xhr.status < 400 && xhr.responseText) {
success(xhr.responseText);
} else {
if (xhr.status >= 400) {
error(FAILURE_MESSAGE(xhr.status, xhr.statusText));
} else {
error(FAILURE_EMPTY_MESSAGE);
}
}
}
};
xhr.send(null);
}
function parseRange(range2) {
var m = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(range2 || "");
if (m) {
var start2 = Number(m[1]);
var comma = m[2];
var end2 = m[3];
if (!comma) {
return [start2, start2];
}
if (!end2) {
return [start2, void 0];
}
return [start2, Number(end2)];
}
return void 0;
}
Prism.hooks.add("before-highlightall", function(env) {
env.selector += ", " + SELECTOR;
});
Prism.hooks.add("before-sanity-check", function(env) {
var pre = (
/** @type {HTMLPreElement} */
env.element
);
if (pre.matches(SELECTOR)) {
env.code = "";
pre.setAttribute(STATUS_ATTR, STATUS_LOADING);
var code = pre.appendChild(document.createElement("CODE"));
code.textContent = LOADING_MESSAGE;
var src = pre.getAttribute("data-src");
var language = env.language;
if (language === "none") {
var extension = (/\.(\w+)$/.exec(src) || [, "none"])[1];
language = EXTENSIONS[extension] || extension;
}
Prism.util.setLanguage(code, language);
Prism.util.setLanguage(pre, language);
var autoloader = Prism.plugins.autoloader;
if (autoloader) {
autoloader.loadLanguages(language);
}
loadFile(
src,
function(text) {
pre.setAttribute(STATUS_ATTR, STATUS_LOADED);
var range2 = parseRange(pre.getAttribute("data-range"));
if (range2) {
var lines = text.split(/\r\n?|\n/g);
var start2 = range2[0];
var end2 = range2[1] == null ? lines.length : range2[1];
if (start2 < 0) {
start2 += lines.length;
}
start2 = Math.max(0, Math.min(start2 - 1, lines.length));
if (end2 < 0) {
end2 += lines.length;
}
end2 = Math.max(0, Math.min(end2, lines.length));
text = lines.slice(start2, end2).join("\n");
if (!pre.hasAttribute("data-start")) {
pre.setAttribute("data-start", String(start2 + 1));
}
}
code.textContent = text;
Prism.highlightElement(code);
},
function(error) {
pre.setAttribute(STATUS_ATTR, STATUS_FAILED);
code.textContent = error;
}
);
}
});
Prism.plugins.fileHighlight = {
/**
* Executes the File Highlight plugin for all matching `pre` elements under the given container.
*
* Note: Elements which are already loaded or currently loading will not be touched by this method.
*
* @param {ParentNode} [container=document]
*/
highlight: function highlight(container) {
var elements = (container || document).querySelectorAll(SELECTOR);
for (var i = 0, element; element = elements[i++]; ) {
Prism.highlightElement(element);
}
}
};
var logged = false;
Prism.fileHighlight = function() {
if (!logged) {
console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead.");
logged = true;
}
Prism.plugins.fileHighlight.highlight.apply(this, arguments);
};
})();
}
});
// vendor/topbar.js
var require_topbar = __commonJS({
"vendor/topbar.js"(exports, module) {
(function(window2, document2) {
"use strict";
(function() {
var lastTime = 0;
var vendors = ["ms", "moz", "webkit", "o"];
for (var x = 0; x < vendors.length && !window2.requestAnimationFrame; ++x) {
window2.requestAnimationFrame = window2[vendors[x] + "RequestAnimationFrame"];
window2.cancelAnimationFrame = window2[vendors[x] + "CancelAnimationFrame"] || window2[vendors[x] + "CancelRequestAnimationFrame"];
}
if (!window2.requestAnimationFrame)
window2.requestAnimationFrame = function(callback, element) {
var currTime = (/* @__PURE__ */ new Date()).getTime();
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
var id = window2.setTimeout(function() {
callback(currTime + timeToCall);
}, timeToCall);
lastTime = currTime + timeToCall;
return id;
};
if (!window2.cancelAnimationFrame)
window2.cancelAnimationFrame = function(id) {
clearTimeout(id);
};
})();
var canvas, progressTimerId, fadeTimerId, currentProgress, showing, addEvent = function(elem, type, handler) {
if (elem.addEventListener)
elem.addEventListener(type, handler, false);
else if (elem.attachEvent)
elem.attachEvent("on" + type, handler);
else
elem["on" + type] = handler;
}, options = {
autoRun: true,
barThickness: 3,
barColors: {
0: "rgba(26, 188, 156, .9)",
".25": "rgba(52, 152, 219, .9)",
".50": "rgba(241, 196, 15, .9)",
".75": "rgba(230, 126, 34, .9)",
"1.0": "rgba(211, 84, 0, .9)"
},
shadowBlur: 10,
shadowColor: "rgba(0, 0, 0, .6)",
className: null
}, repaint = function() {
canvas.width = window2.innerWidth;
canvas.height = options.barThickness * 5;
var ctx = canvas.getContext("2d");
ctx.shadowBlur = options.shadowBlur;
ctx.shadowColor = options.shadowColor;
var lineGradient = ctx.createLinearGradient(0, 0, canvas.width, 0);
for (var stop in options.barColors)
lineGradient.addColorStop(stop, options.barColors[stop]);
ctx.lineWidth = options.barThickness;
ctx.beginPath();
ctx.moveTo(0, options.barThickness / 2);
ctx.lineTo(
Math.ceil(currentProgress * canvas.width),
options.barThickness / 2
);
ctx.strokeStyle = lineGradient;
ctx.stroke();
}, createCanvas = function() {
canvas = document2.createElement("canvas");
var style = canvas.style;
style.position = "fixed";
style.top = style.left = style.right = style.margin = style.padding = 0;
style.zIndex = 100001;
style.display = "none";
if (options.className)
canvas.classList.add(options.className);
document2.body.appendChild(canvas);
addEvent(window2, "resize", repaint);
}, topbar2 = {
config: function(opts) {
for (var key in opts)
if (options.hasOwnProperty(key))
options[key] = opts[key];
},
show: function() {
if (showing)
return;
showing = true;
if (fadeTimerId !== null)
window2.cancelAnimationFrame(fadeTimerId);
if (!canvas)
createCanvas();
canvas.style.opacity = 1;
canvas.style.display = "block";
topbar2.progress(0);
if (options.autoRun) {
(function loop() {
progressTimerId = window2.requestAnimationFrame(loop);
topbar2.progress(
"+" + 0.05 * Math.pow(1 - Math.sqrt(currentProgress), 2)
);
})();
}
},
progress: function(to) {
if (typeof to === "undefined")
return currentProgress;
if (typeof to === "string") {
to = (to.indexOf("+") >= 0 || to.indexOf("-") >= 0 ? currentProgress : 0) + parseFloat(to);
}
currentProgress = to > 1 ? 1 : to;
repaint();
return currentProgress;
},
hide: function() {
if (!showing)
return;
showing = false;
if (progressTimerId != null) {
window2.cancelAnimationFrame(progressTimerId);
progressTimerId = null;
}
(function loop() {
if (topbar2.progress("+.1") >= 1) {
canvas.style.opacity -= 0.05;
if (canvas.style.opacity <= 0.05) {
canvas.style.display = "none";
fadeTimerId = null;
return;
}
}
fadeTimerId = window2.requestAnimationFrame(loop);
})();
}
};
if (typeof module === "object" && typeof module.exports === "object") {
module.exports = topbar2;
} else if (typeof define === "function" && define.amd) {
define(function() {
return topbar2;
});
} else {
this.topbar = topbar2;
}
}).call(exports, window, document);
}
});
// js/app.js
var import_jquery3 = __toESM(require_jquery());
// node_modules/@popperjs/core/lib/index.js
var lib_exports = {};
__export(lib_exports, {
afterMain: () => afterMain,
afterRead: () => afterRead,
afterWrite: () => afterWrite,
applyStyles: () => applyStyles_default,
arrow: () => arrow_default,
auto: () => auto,
basePlacements: () => basePlacements,
beforeMain: () => beforeMain,
beforeRead: () => beforeRead,
beforeWrite: () => beforeWrite,
bottom: () => bottom,
clippingParents: () => clippingParents,
computeStyles: () => computeStyles_default,
createPopper: () => createPopper3,
createPopperBase: () => createPopper,
createPopperLite: () => createPopper2,
detectOverflow: () => detectOverflow,
end: () => end,
eventListeners: () => eventListeners_default,
flip: () => flip_default,
hide: () => hide_default,
left: () => left,
main: () => main,
modifierPhases: () => modifierPhases,
offset: () => offset_default,
placements: () => placements,
popper: () => popper,
popperGenerator: () => popperGenerator,
popperOffsets: () => popperOffsets_default,
preventOverflow: () => preventOverflow_default,
read: () => read,
reference: () => reference,
right: () => right,
start: () => start,
top: () => top,
variationPlacements: () => variationPlacements,
viewport: () => viewport,
write: () => write
});
// node_modules/@popperjs/core/lib/enums.js
var top = "top";
var bottom = "bottom";
var right = "right";
var left = "left";
var auto = "auto";
var basePlacements = [top, bottom, right, left];
var start = "start";
var end = "end";
var clippingParents = "clippingParents";
var viewport = "viewport";
var popper = "popper";
var reference = "reference";
var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
return acc.concat([placement + "-" + start, placement + "-" + end]);
}, []);
var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
}, []);
var beforeRead = "beforeRead";
var read = "read";
var afterRead = "afterRead";
var beforeMain = "beforeMain";
var main = "main";
var afterMain = "afterMain";
var beforeWrite = "beforeWrite";
var write = "write";
var afterWrite = "afterWrite";
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
// node_modules/@popperjs/core/lib/dom-utils/getNodeName.js
function getNodeName(element) {
return element ? (element.nodeName || "").toLowerCase() : null;
}
// node_modules/@popperjs/core/lib/dom-utils/getWindow.js
function getWindow(node) {
if (node == null) {
return window;
}
if (node.toString() !== "[object Window]") {
var ownerDocument = node.ownerDocument;
return ownerDocument ? ownerDocument.defaultView || window : window;
}
return node;
}
// node_modules/@popperjs/core/lib/dom-utils/instanceOf.js
function isElement(node) {
var OwnElement = getWindow(node).Element;
return node instanceof OwnElement || node instanceof Element;
}
function isHTMLElement(node) {
var OwnElement = getWindow(node).HTMLElement;
return node instanceof OwnElement || node instanceof HTMLElement;
}
function isShadowRoot(node) {
if (typeof ShadowRoot === "undefined") {
return false;
}
var OwnElement = getWindow(node).ShadowRoot;
return node instanceof OwnElement || node instanceof ShadowRoot;
}
// node_modules/@popperjs/core/lib/modifiers/applyStyles.js
function applyStyles(_ref) {
var state = _ref.state;
Object.keys(state.elements).forEach(function(name) {
var style = state.styles[name] || {};
var attributes = state.attributes[name] || {};
var element = state.elements[name];
if (!isHTMLElement(element) || !getNodeName(element)) {
return;
}
Object.assign(element.style, style);
Object.keys(attributes).forEach(function(name2) {
var value = attributes[name2];
if (value === false) {
element.removeAttribute(name2);
} else {
element.setAttribute(name2, value === true ? "" : value);
}
});
});
}
function effect(_ref2) {
var state = _ref2.state;
var initialStyles = {
popper: {
position: state.options.strategy,
left: "0",
top: "0",
margin: "0"
},
arrow: {
position: "absolute"
},
reference: {}
};
Object.assign(state.elements.popper.style, initialStyles.popper);
state.styles = initialStyles;
if (state.elements.arrow) {
Object.assign(state.elements.arrow.style, initialStyles.arrow);
}
return function() {
Object.keys(state.elements).forEach(function(name) {
var element = state.elements[name];
var attributes = state.attributes[name] || {};
var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
var style = styleProperties.reduce(function(style2, property) {
style2[property] = "";
return style2;
}, {});
if (!isHTMLElement(element) || !getNodeName(element)) {
return;
}
Object.assign(element.style, style);
Object.keys(attributes).forEach(function(attribute) {
element.removeAttribute(attribute);
});
});
};
}
var applyStyles_default = {
name: "applyStyles",
enabled: true,
phase: "write",
fn: applyStyles,
effect,
requires: ["computeStyles"]
};
// node_modules/@popperjs/core/lib/utils/getBasePlacement.js
function getBasePlacement(placement) {
return placement.split("-")[0];
}
// node_modules/@popperjs/core/lib/utils/math.js
var max = Math.max;
var min = Math.min;
var round = Math.round;
// node_modules/@popperjs/core/lib/utils/userAgent.js
function getUAString() {
var uaData = navigator.userAgentData;
if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
return uaData.brands.map(function(item) {
return item.brand + "/" + item.version;
}).join(" ");
}
return navigator.userAgent;
}
// node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js
function isLayoutViewport() {
return !/^((?!chrome|android).)*safari/i.test(getUAString());
}
// node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js
function getBoundingClientRect(element, includeScale, isFixedStrategy) {
if (includeScale === void 0) {
includeScale = false;
}
if (isFixedStrategy === void 0) {
isFixedStrategy = false;
}
var clientRect = element.getBoundingClientRect();
var scaleX = 1;
var scaleY = 1;
if (includeScale && isHTMLElement(element)) {
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
}
var _ref = isElement(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
var width = clientRect.width / scaleX;
var height = clientRect.height / scaleY;
return {
width,
height,
top: y,
right: x + width,
bottom: y + height,
left: x,
x,
y
};
}
// node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js
function getLayoutRect(element) {
var clientRect = getBoundingClientRect(element);
var width = element.offsetWidth;
var height = element.offsetHeight;
if (Math.abs(clientRect.width - width) <= 1) {
width = clientRect.width;
}
if (Math.abs(clientRect.height - height) <= 1) {
height = clientRect.height;
}
return {
x: element.offsetLeft,
y: element.offsetTop,
width,
height
};
}
// node_modules/@popperjs/core/lib/dom-utils/contains.js
function contains(parent, child) {
var rootNode = child.getRootNode && child.getRootNode();
if (parent.contains(child)) {
return true;
} else if (rootNode && isShadowRoot(rootNode)) {
var next = child;
do {
if (next && parent.isSameNode(next)) {
return true;
}
next = next.parentNode || next.host;
} while (next);
}
return false;
}
// node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js
function getComputedStyle2(element) {
return getWindow(element).getComputedStyle(element);
}
// node_modules/@popperjs/core/lib/dom-utils/isTableElement.js
function isTableElement(element) {
return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
}
// node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js
function getDocumentElement(element) {
return ((isElement(element) ? element.ownerDocument : (
// $FlowFixMe[prop-missing]
element.document
)) || window.document).documentElement;
}
// node_modules/@popperjs/core/lib/dom-utils/getParentNode.js
function getParentNode(element) {
if (getNodeName(element) === "html") {
return element;
}
return (
// this is a quicker (but less type safe) way to save quite some bytes from the bundle
// $FlowFixMe[incompatible-return]
// $FlowFixMe[prop-missing]
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
element.parentNode || // DOM Element detected
(isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
// $FlowFixMe[incompatible-call]: HTMLElement is a Node
getDocumentElement(element)
);
}
// node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js
function getTrueOffsetParent(element) {
if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
getComputedStyle2(element).position === "fixed") {
return null;
}
return element.offsetParent;
}
function getContainingBlock(element) {
var isFirefox = /firefox/i.test(getUAString());
var isIE = /Trident/i.test(getUAString());
if (isIE && isHTMLElement(element)) {
var elementCss = getComputedStyle2(element);
if (elementCss.position === "fixed") {
return null;
}
}
var currentNode = getParentNode(element);
if (isShadowRoot(currentNode)) {
currentNode = currentNode.host;
}
while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
var css = getComputedStyle2(currentNode);
if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
return currentNode;
} else {
currentNode = currentNode.parentNode;
}
}
return null;
}
function getOffsetParent(element) {
var window2 = getWindow(element);
var offsetParent = getTrueOffsetParent(element);
while (offsetParent && isTableElement(offsetParent) && getComputedStyle2(offsetParent).position === "static") {
offsetParent = getTrueOffsetParent(offsetParent);
}
if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle2(offsetParent).position === "static")) {
return window2;
}
return offsetParent || getContainingBlock(element) || window2;
}
// node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js
function getMainAxisFromPlacement(placement) {
return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
}
// node_modules/@popperjs/core/lib/utils/within.js
function within(min2, value, max2) {
return max(min2, min(value, max2));
}
function withinMaxClamp(min2, value, max2) {
var v = within(min2, value, max2);
return v > max2 ? max2 : v;
}
// node_modules/@popperjs/core/lib/utils/getFreshSideObject.js
function getFreshSideObject() {
return {
top: 0,
right: 0,
bottom: 0,
left: 0
};
}
// node_modules/@popperjs/core/lib/utils/mergePaddingObject.js
function mergePaddingObject(paddingObject) {
return Object.assign({}, getFreshSideObject(), paddingObject);
}
// node_modules/@popperjs/core/lib/utils/expandToHashMap.js
function expandToHashMap(value, keys) {
return keys.reduce(function(hashMap, key) {
hashMap[key] = value;
return hashMap;
}, {});
}
// node_modules/@popperjs/core/lib/modifiers/arrow.js
var toPaddingObject = function toPaddingObject2(padding, state) {
padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
placement: state.placement
})) : padding;
return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
};
function arrow(_ref) {
var _state$modifiersData$;
var state = _ref.state, name = _ref.name, options = _ref.options;
var arrowElement = state.elements.arrow;
var popperOffsets2 = state.modifiersData.popperOffsets;
var basePlacement = getBasePlacement(state.placement);
var axis = getMainAxisFromPlacement(basePlacement);
var isVertical = [left, right].indexOf(basePlacement) >= 0;
var len = isVertical ? "height" : "width";
if (!arrowElement || !popperOffsets2) {
return;
}
var paddingObject = toPaddingObject(options.padding, state);
var arrowRect = getLayoutRect(arrowElement);
var minProp = axis === "y" ? top : left;
var maxProp = axis === "y" ? bottom : right;
var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
var arrowOffsetParent = getOffsetParent(arrowElement);
var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
var centerToReference = endDiff / 2 - startDiff / 2;
var min2 = paddingObject[minProp];
var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
var offset2 = within(min2, center, max2);
var axisProp = axis;
state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
}
function effect2(_ref2) {
var state = _ref2.state, options = _ref2.options;
var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
if (arrowElement == null) {
return;
}
if (typeof arrowElement === "string") {
arrowElement = state.elements.popper.querySelector(arrowElement);
if (!arrowElement) {
return;
}
}
if (!contains(state.elements.popper, arrowElement)) {
return;
}
state.elements.arrow = arrowElement;
}
var arrow_default = {
name: "arrow",
enabled: true,
phase: "main",
fn: arrow,
effect: effect2,
requires: ["popperOffsets"],
requiresIfExists: ["preventOverflow"]
};
// node_modules/@popperjs/core/lib/utils/getVariation.js
function getVariation(placement) {
return placement.split("-")[1];
}
// node_modules/@popperjs/core/lib/modifiers/computeStyles.js
var unsetSides = {
top: "auto",
right: "auto",
bottom: "auto",
left: "auto"
};
function roundOffsetsByDPR(_ref, win) {
var x = _ref.x, y = _ref.y;
var dpr = win.devicePixelRatio || 1;
return {
x: round(x * dpr) / dpr || 0,
y: round(y * dpr) / dpr || 0
};
}
function mapToStyles(_ref2) {
var _Object$assign2;
var popper2 = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets, isFixed = _ref2.isFixed;
var _offsets$x = offsets.x, x = _offsets$x === void 0 ? 0 : _offsets$x, _offsets$y = offsets.y, y = _offsets$y === void 0 ? 0 : _offsets$y;
var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
x,
y
}) : {
x,
y
};
x = _ref3.x;
y = _ref3.y;
var hasX = offsets.hasOwnProperty("x");
var hasY = offsets.hasOwnProperty("y");
var sideX = left;
var sideY = top;
var win = window;
if (adaptive) {
var offsetParent = getOffsetParent(popper2);
var heightProp = "clientHeight";
var widthProp = "clientWidth";
if (offsetParent === getWindow(popper2)) {
offsetParent = getDocumentElement(popper2);
if (getComputedStyle2(offsetParent).position !== "static" && position === "absolute") {
heightProp = "scrollHeight";
widthProp = "scrollWidth";
}
}
offsetParent = offsetParent;
if (placement === top || (placement === left || placement === right) && variation === end) {
sideY = bottom;
var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : (
// $FlowFixMe[prop-missing]
offsetParent[heightProp]
);
y -= offsetY - popperRect.height;
y *= gpuAcceleration ? 1 : -1;
}
if (placement === left || (placement === top || placement === bottom) && variation === end) {
sideX = right;
var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : (
// $FlowFixMe[prop-missing]
offsetParent[widthProp]
);
x -= offsetX - popperRect.width;
x *= gpuAcceleration ? 1 : -1;
}
}
var commonStyles = Object.assign({
position
}, adaptive && unsetSides);
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
x,
y
}, getWindow(popper2)) : {
x,
y
};
x = _ref4.x;
y = _ref4.y;
if (gpuAcceleration) {
var _Object$assign;
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
}
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
}
function computeStyles(_ref5) {
var state = _ref5.state, options = _ref5.options;
var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
var commonStyles = {
placement: getBasePlacement(state.placement),
variation: getVariation(state.placement),
popper: state.elements.popper,
popperRect: state.rects.popper,
gpuAcceleration,
isFixed: state.options.strategy === "fixed"
};
if (state.modifiersData.popperOffsets != null) {
state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
offsets: state.modifiersData.popperOffsets,
position: state.options.strategy,
adaptive,
roundOffsets
})));
}
if (state.modifiersData.arrow != null) {
state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
offsets: state.modifiersData.arrow,
position: "absolute",
adaptive: false,
roundOffsets
})));
}
state.attributes.popper = Object.assign({}, state.attributes.popper, {
"data-popper-placement": state.placement
});
}
var computeStyles_default = {
name: "computeStyles",
enabled: true,
phase: "beforeWrite",
fn: computeStyles,
data: {}
};
// node_modules/@popperjs/core/lib/modifiers/eventListeners.js
var passive = {
passive: true
};
function effect3(_ref) {
var state = _ref.state, instance = _ref.instance, options = _ref.options;
var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize;
var window2 = getWindow(state.elements.popper);
var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
if (scroll) {
scrollParents.forEach(function(scrollParent) {
scrollParent.addEventListener("scroll", instance.update, passive);
});
}
if (resize) {
window2.addEventListener("resize", instance.update, passive);
}
return function() {
if (scroll) {
scrollParents.forEach(function(scrollParent) {
scrollParent.removeEventListener("scroll", instance.update, passive);
});
}
if (resize) {
window2.removeEventListener("resize", instance.update, passive);
}
};
}
var eventListeners_default = {
name: "eventListeners",
enabled: true,
phase: "write",
fn: function fn() {
},
effect: effect3,
data: {}
};
// node_modules/@popperjs/core/lib/utils/getOppositePlacement.js
var hash = {
left: "right",
right: "left",
bottom: "top",
top: "bottom"
};
function getOppositePlacement(placement) {
return placement.replace(/left|right|bottom|top/g, function(matched) {
return hash[matched];
});
}
// node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js
var hash2 = {
start: "end",
end: "start"
};
function getOppositeVariationPlacement(placement) {
return placement.replace(/start|end/g, function(matched) {
return hash2[matched];
});
}
// node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js
function getWindowScroll(node) {
var win = getWindow(node);
var scrollLeft = win.pageXOffset;
var scrollTop = win.pageYOffset;
return {
scrollLeft,
scrollTop
};
}
// node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js
function getWindowScrollBarX(element) {
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
}
// node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js
function getViewportRect(element, strategy) {
var win = getWindow(element);
var html = getDocumentElement(element);
var visualViewport = win.visualViewport;
var width = html.clientWidth;
var height = html.clientHeight;
var x = 0;
var y = 0;
if (visualViewport) {
width = visualViewport.width;
height = visualViewport.height;
var layoutViewport = isLayoutViewport();
if (layoutViewport || !layoutViewport && strategy === "fixed") {
x = visualViewport.offsetLeft;
y = visualViewport.offsetTop;
}
}
return {
width,
height,
x: x + getWindowScrollBarX(element),
y
};
}
// node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js
function getDocumentRect(element) {
var _element$ownerDocumen;
var html = getDocumentElement(element);
var winScroll = getWindowScroll(element);
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
var y = -winScroll.scrollTop;
if (getComputedStyle2(body || html).direction === "rtl") {
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
}
return {
width,
height,
x,
y
};
}
// node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js
function isScrollParent(element) {
var _getComputedStyle = getComputedStyle2(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
}
// node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js
function getScrollParent(node) {
if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
return node.ownerDocument.body;
}
if (isHTMLElement(node) && isScrollParent(node)) {
return node;
}
return getScrollParent(getParentNode(node));
}
// node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js
function listScrollParents(element, list) {
var _element$ownerDocumen;
if (list === void 0) {
list = [];
}
var scrollParent = getScrollParent(element);
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
var win = getWindow(scrollParent);
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
var updatedList = list.concat(target);
return isBody ? updatedList : (
// $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
updatedList.concat(listScrollParents(getParentNode(target)))
);
}
// node_modules/@popperjs/core/lib/utils/rectToClientRect.js
function rectToClientRect(rect) {
return Object.assign({}, rect, {
left: rect.x,
top: rect.y,
right: rect.x + rect.width,
bottom: rect.y + rect.height
});
}
// node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js
function getInnerBoundingClientRect(element, strategy) {
var rect = getBoundingClientRect(element, false, strategy === "fixed");
rect.top = rect.top + element.clientTop;
rect.left = rect.left + element.clientLeft;
rect.bottom = rect.top + element.clientHeight;
rect.right = rect.left + element.clientWidth;
rect.width = element.clientWidth;
rect.height = element.clientHeight;
rect.x = rect.left;
rect.y = rect.top;
return rect;
}
function getClientRectFromMixedType(element, clippingParent, strategy) {
return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
}
function getClippingParents(element) {
var clippingParents2 = listScrollParents(getParentNode(element));
var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle2(element).position) >= 0;
var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
if (!isElement(clipperElement)) {
return [];
}
return clippingParents2.filter(function(clippingParent) {
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
});
}
function getClippingRect(element, boundary, rootBoundary, strategy) {
var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
var firstClippingParent = clippingParents2[0];
var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
var rect = getClientRectFromMixedType(element, clippingParent, strategy);
accRect.top = max(rect.top, accRect.top);
accRect.right = min(rect.right, accRect.right);
accRect.bottom = min(rect.bottom, accRect.bottom);
accRect.left = max(rect.left, accRect.left);
return accRect;
}, getClientRectFromMixedType(element, firstClippingParent, strategy));
clippingRect.width = clippingRect.right - clippingRect.left;
clippingRect.height = clippingRect.bottom - clippingRect.top;
clippingRect.x = clippingRect.left;
clippingRect.y = clippingRect.top;
return clippingRect;
}
// node_modules/@popperjs/core/lib/utils/computeOffsets.js
function computeOffsets(_ref) {
var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
var basePlacement = placement ? getBasePlacement(placement) : null;
var variation = placement ? getVariation(placement) : null;
var commonX = reference2.x + reference2.width / 2 - element.width / 2;
var commonY = reference2.y + reference2.height / 2 - element.height / 2;
var offsets;
switch (basePlacement) {
case top:
offsets = {
x: commonX,
y: reference2.y - element.height
};
break;
case bottom:
offsets = {
x: commonX,
y: reference2.y + reference2.height
};
break;
case right:
offsets = {
x: reference2.x + reference2.width,
y: commonY
};
break;
case left:
offsets = {
x: reference2.x - element.width,
y: commonY
};
break;
default:
offsets = {
x: reference2.x,
y: reference2.y
};
}
var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
if (mainAxis != null) {
var len = mainAxis === "y" ? "height" : "width";
switch (variation) {
case start:
offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2);
break;
case end:
offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2);
break;
default:
}
}
return offsets;
}
// node_modules/@popperjs/core/lib/utils/detectOverflow.js
function detectOverflow(state, options) {
if (options === void 0) {
options = {};
}
var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$strategy = _options.strategy, strategy = _options$strategy === void 0 ? state.strategy : _options$strategy, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding;
var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
var altContext = elementContext === popper ? reference : popper;
var popperRect = state.rects.popper;
var element = state.elements[altBoundary ? altContext : elementContext];
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
var referenceClientRect = getBoundingClientRect(state.elements.reference);
var popperOffsets2 = computeOffsets({
reference: referenceClientRect,
element: popperRect,
strategy: "absolute",
placement
});
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
var overflowOffsets = {
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
right: elementClientRect.right - clippingClientRect.right + paddingObject.right
};
var offsetData = state.modifiersData.offset;
if (elementContext === popper && offsetData) {
var offset2 = offsetData[placement];
Object.keys(overflowOffsets).forEach(function(key) {
var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
overflowOffsets[key] += offset2[axis] * multiply;
});
}
return overflowOffsets;
}
// node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js
function computeAutoPlacement(state, options) {
if (options === void 0) {
options = {};
}
var _options = options, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
var variation = getVariation(placement);
var placements2 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
return getVariation(placement2) === variation;
}) : basePlacements;
var allowedPlacements = placements2.filter(function(placement2) {
return allowedAutoPlacements.indexOf(placement2) >= 0;
});
if (allowedPlacements.length === 0) {
allowedPlacements = placements2;
}
var overflows = allowedPlacements.reduce(function(acc, placement2) {
acc[placement2] = detectOverflow(state, {
placement: placement2,
boundary,
rootBoundary,
padding
})[getBasePlacement(placement2)];
return acc;
}, {});
return Object.keys(overflows).sort(function(a, b) {
return overflows[a] - overflows[b];
});
}
// node_modules/@popperjs/core/lib/modifiers/flip.js
function getExpandedFallbackPlacements(placement) {
if (getBasePlacement(placement) === auto) {
return [];
}
var oppositePlacement = getOppositePlacement(placement);
return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
}
function flip(_ref) {
var state = _ref.state, options = _ref.options, name = _ref.name;
if (state.modifiersData[name]._skip) {
return;
}
var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, specifiedFallbackPlacements = options.fallbackPlacements, padding = options.padding, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, _options$flipVariatio = options.flipVariations, flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, allowedAutoPlacements = options.allowedAutoPlacements;
var preferredPlacement = state.options.placement;
var basePlacement = getBasePlacement(preferredPlacement);
var isBasePlacement = basePlacement === preferredPlacement;
var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
return acc.concat(getBasePlacement(placement2) === auto ? computeAutoPlacement(state, {
placement: placement2,
boundary,
rootBoundary,
padding,
flipVariations,
allowedAutoPlacements
}) : placement2);
}, []);
var referenceRect = state.rects.reference;
var popperRect = state.rects.popper;
var checksMap = /* @__PURE__ */ new Map();
var makeFallbackChecks = true;
var firstFittingPlacement = placements2[0];
for (var i = 0; i < placements2.length; i++) {
var placement = placements2[i];
var _basePlacement = getBasePlacement(placement);
var isStartVariation = getVariation(placement) === start;
var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
var len = isVertical ? "width" : "height";
var overflow = detectOverflow(state, {
placement,
boundary,
rootBoundary,
altBoundary,
padding
});
var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
if (referenceRect[len] > popperRect[len]) {
mainVariationSide = getOppositePlacement(mainVariationSide);
}
var altVariationSide = getOppositePlacement(mainVariationSide);
var checks = [];
if (checkMainAxis) {
checks.push(overflow[_basePlacement] <= 0);
}
if (checkAltAxis) {
checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
}
if (checks.every(function(check) {
return check;
})) {
firstFittingPlacement = placement;
makeFallbackChecks = false;
break;
}
checksMap.set(placement, checks);
}
if (makeFallbackChecks) {
var numberOfChecks = flipVariations ? 3 : 1;
var _loop = function _loop2(_i2) {
var fittingPlacement = placements2.find(function(placement2) {
var checks2 = checksMap.get(placement2);
if (checks2) {
return checks2.slice(0, _i2).every(function(check) {
return check;
});
}
});
if (fittingPlacement) {
firstFittingPlacement = fittingPlacement;
return "break";
}
};
for (var _i = numberOfChecks; _i > 0; _i--) {
var _ret = _loop(_i);
if (_ret === "break")
break;
}
}
if (state.placement !== firstFittingPlacement) {
state.modifiersData[name]._skip = true;
state.placement = firstFittingPlacement;
state.reset = true;
}
}
var flip_default = {
name: "flip",
enabled: true,
phase: "main",
fn: flip,
requiresIfExists: ["offset"],
data: {
_skip: false
}
};
// node_modules/@popperjs/core/lib/modifiers/hide.js
function getSideOffsets(overflow, rect, preventedOffsets) {
if (preventedOffsets === void 0) {
preventedOffsets = {
x: 0,
y: 0
};
}
return {
top: overflow.top - rect.height - preventedOffsets.y,
right: overflow.right - rect.width + preventedOffsets.x,
bottom: overflow.bottom - rect.height + preventedOffsets.y,
left: overflow.left - rect.width - preventedOffsets.x
};
}
function isAnySideFullyClipped(overflow) {
return [top, right, bottom, left].some(function(side) {
return overflow[side] >= 0;
});
}
function hide(_ref) {
var state = _ref.state, name = _ref.name;
var referenceRect = state.rects.reference;
var popperRect = state.rects.popper;
var preventedOffsets = state.modifiersData.preventOverflow;
var referenceOverflow = detectOverflow(state, {
elementContext: "reference"
});
var popperAltOverflow = detectOverflow(state, {
altBoundary: true
});
var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
state.modifiersData[name] = {
referenceClippingOffsets,
popperEscapeOffsets,
isReferenceHidden,
hasPopperEscaped
};
state.attributes.popper = Object.assign({}, state.attributes.popper, {
"data-popper-reference-hidden": isReferenceHidden,
"data-popper-escaped": hasPopperEscaped
});
}
var hide_default = {
name: "hide",
enabled: true,
phase: "main",
requiresIfExists: ["preventOverflow"],
fn: hide
};
// node_modules/@popperjs/core/lib/modifiers/offset.js
function distanceAndSkiddingToXY(placement, rects, offset2) {
var basePlacement = getBasePlacement(placement);
var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
placement
})) : offset2, skidding = _ref[0], distance = _ref[1];
skidding = skidding || 0;
distance = (distance || 0) * invertDistance;
return [left, right].indexOf(basePlacement) >= 0 ? {
x: distance,
y: skidding
} : {
x: skidding,
y: distance
};
}
function offset(_ref2) {
var state = _ref2.state, options = _ref2.options, name = _ref2.name;
var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
var data = placements.reduce(function(acc, placement) {
acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
return acc;
}, {});
var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y;
if (state.modifiersData.popperOffsets != null) {
state.modifiersData.popperOffsets.x += x;
state.modifiersData.popperOffsets.y += y;
}
state.modifiersData[name] = data;
}
var offset_default = {
name: "offset",
enabled: true,
phase: "main",
requires: ["popperOffsets"],
fn: offset
};
// node_modules/@popperjs/core/lib/modifiers/popperOffsets.js
function popperOffsets(_ref) {
var state = _ref.state, name = _ref.name;
state.modifiersData[name] = computeOffsets({
reference: state.rects.reference,
element: state.rects.popper,
strategy: "absolute",
placement: state.placement
});
}
var popperOffsets_default = {
name: "popperOffsets",
enabled: true,
phase: "read",
fn: popperOffsets,
data: {}
};
// node_modules/@popperjs/core/lib/utils/getAltAxis.js
function getAltAxis(axis) {
return axis === "x" ? "y" : "x";
}
// node_modules/@popperjs/core/lib/modifiers/preventOverflow.js
function preventOverflow(_ref) {
var state = _ref.state, options = _ref.options, name = _ref.name;
var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, padding = options.padding, _options$tether = options.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
var overflow = detectOverflow(state, {
boundary,
rootBoundary,
padding,
altBoundary
});
var basePlacement = getBasePlacement(state.placement);
var variation = getVariation(state.placement);
var isBasePlacement = !variation;
var mainAxis = getMainAxisFromPlacement(basePlacement);
var altAxis = getAltAxis(mainAxis);
var popperOffsets2 = state.modifiersData.popperOffsets;
var referenceRect = state.rects.reference;
var popperRect = state.rects.popper;
var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
placement: state.placement
})) : tetherOffset;
var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
mainAxis: tetherOffsetValue,
altAxis: tetherOffsetValue
} : Object.assign({
mainAxis: 0,
altAxis: 0
}, tetherOffsetValue);
var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
var data = {
x: 0,
y: 0
};
if (!popperOffsets2) {
return;
}
if (checkMainAxis) {
var _offsetModifierState$;
var mainSide = mainAxis === "y" ? top : left;
var altSide = mainAxis === "y" ? bottom : right;
var len = mainAxis === "y" ? "height" : "width";
var offset2 = popperOffsets2[mainAxis];
var min2 = offset2 + overflow[mainSide];
var max2 = offset2 - overflow[altSide];
var additive = tether ? -popperRect[len] / 2 : 0;
var minLen = variation === start ? referenceRect[len] : popperRect[len];
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
var arrowElement = state.elements.arrow;
var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
width: 0,
height: 0
};
var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
var arrowPaddingMin = arrowPaddingObject[mainSide];
var arrowPaddingMax = arrowPaddingObject[altSide];
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
var tetherMax = offset2 + maxOffset - offsetModifierValue;
var preventedOffset = within(tether ? min(min2, tetherMin) : min2, offset2, tether ? max(max2, tetherMax) : max2);
popperOffsets2[mainAxis] = preventedOffset;
data[mainAxis] = preventedOffset - offset2;
}
if (checkAltAxis) {
var _offsetModifierState$2;
var _mainSide = mainAxis === "x" ? top : left;
var _altSide = mainAxis === "x" ? bottom : right;
var _offset = popperOffsets2[altAxis];
var _len = altAxis === "y" ? "height" : "width";
var _min = _offset + overflow[_mainSide];
var _max = _offset - overflow[_altSide];
var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
popperOffsets2[altAxis] = _preventedOffset;
data[altAxis] = _preventedOffset - _offset;
}
state.modifiersData[name] = data;
}
var preventOverflow_default = {
name: "preventOverflow",
enabled: true,
phase: "main",
fn: preventOverflow,
requiresIfExists: ["offset"]
};
// node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js
function getHTMLElementScroll(element) {
return {
scrollLeft: element.scrollLeft,
scrollTop: element.scrollTop
};
}
// node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js
function getNodeScroll(node) {
if (node === getWindow(node) || !isHTMLElement(node)) {
return getWindowScroll(node);
} else {
return getHTMLElementScroll(node);
}
}
// node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js
function isElementScaled(element) {
var rect = element.getBoundingClientRect();
var scaleX = round(rect.width) / element.offsetWidth || 1;
var scaleY = round(rect.height) / element.offsetHeight || 1;
return scaleX !== 1 || scaleY !== 1;
}
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
if (isFixed === void 0) {
isFixed = false;
}
var isOffsetParentAnElement = isHTMLElement(offsetParent);
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
var documentElement = getDocumentElement(offsetParent);
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
var scroll = {
scrollLeft: 0,
scrollTop: 0
};
var offsets = {
x: 0,
y: 0
};
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
if (getNodeName(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
isScrollParent(documentElement)) {
scroll = getNodeScroll(offsetParent);
}
if (isHTMLElement(offsetParent)) {
offsets = getBoundingClientRect(offsetParent, true);
offsets.x += offsetParent.clientLeft;
offsets.y += offsetParent.clientTop;
} else if (documentElement) {
offsets.x = getWindowScrollBarX(documentElement);
}
}
return {
x: rect.left + scroll.scrollLeft - offsets.x,
y: rect.top + scroll.scrollTop - offsets.y,
width: rect.width,
height: rect.height
};
}
// node_modules/@popperjs/core/lib/utils/orderModifiers.js
function order(modifiers) {
var map = /* @__PURE__ */ new Map();
var visited = /* @__PURE__ */ new Set();
var result = [];
modifiers.forEach(function(modifier) {
map.set(modifier.name, modifier);
});
function sort(modifier) {
visited.add(modifier.name);
var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
requires.forEach(function(dep) {
if (!visited.has(dep)) {
var depModifier = map.get(dep);
if (depModifier) {
sort(depModifier);
}
}
});
result.push(modifier);
}
modifiers.forEach(function(modifier) {
if (!visited.has(modifier.name)) {
sort(modifier);
}
});
return result;
}
function orderModifiers(modifiers) {
var orderedModifiers = order(modifiers);
return modifierPhases.reduce(function(acc, phase) {
return acc.concat(orderedModifiers.filter(function(modifier) {
return modifier.phase === phase;
}));
}, []);
}
// node_modules/@popperjs/core/lib/utils/debounce.js
function debounce(fn2) {
var pending;
return function() {
if (!pending) {
pending = new Promise(function(resolve) {
Promise.resolve().then(function() {
pending = void 0;
resolve(fn2());
});
});
}
return pending;
};
}
// node_modules/@popperjs/core/lib/utils/mergeByName.js
function mergeByName(modifiers) {
var merged = modifiers.reduce(function(merged2, current) {
var existing = merged2[current.name];
merged2[current.name] = existing ? Object.assign({}, existing, current, {
options: Object.assign({}, existing.options, current.options),
data: Object.assign({}, existing.data, current.data)
}) : current;
return merged2;
}, {});
return Object.keys(merged).map(function(key) {
return merged[key];
});
}
// node_modules/@popperjs/core/lib/createPopper.js
var DEFAULT_OPTIONS = {
placement: "bottom",
modifiers: [],
strategy: "absolute"
};
function areValidElements() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return !args.some(function(element) {
return !(element && typeof element.getBoundingClientRect === "function");
});
}
function popperGenerator(generatorOptions) {
if (generatorOptions === void 0) {
generatorOptions = {};
}
var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers3 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
return function createPopper4(reference2, popper2, options) {
if (options === void 0) {
options = defaultOptions;
}
var state = {
placement: "bottom",
orderedModifiers: [],
options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
modifiersData: {},
elements: {
reference: reference2,
popper: popper2
},
attributes: {},
styles: {}
};
var effectCleanupFns = [];
var isDestroyed = false;
var instance = {
state,
setOptions: function setOptions(setOptionsAction) {
var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
cleanupModifierEffects();
state.options = Object.assign({}, defaultOptions, state.options, options2);
state.scrollParents = {
reference: isElement(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
popper: listScrollParents(popper2)
};
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers3, state.options.modifiers)));
state.orderedModifiers = orderedModifiers.filter(function(m) {
return m.enabled;
});
runModifierEffects();
return instance.update();
},
// Sync update – it will always be executed, even if not necessary. This
// is useful for low frequency updates where sync behavior simplifies the
// logic.
// For high frequency updates (e.g. `resize` and `scroll` events), always
// prefer the async Popper#update method
forceUpdate: function forceUpdate() {
if (isDestroyed) {
return;
}
var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
if (!areValidElements(reference3, popper3)) {
return;
}
state.rects = {
reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
popper: getLayoutRect(popper3)
};
state.reset = false;
state.placement = state.options.placement;
state.orderedModifiers.forEach(function(modifier) {
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
});
for (var index = 0; index < state.orderedModifiers.length; index++) {
if (state.reset === true) {
state.reset = false;
index = -1;
continue;
}
var _state$orderedModifie = state.orderedModifiers[index], fn2 = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name = _state$orderedModifie.name;
if (typeof fn2 === "function") {
state = fn2({
state,
options: _options,
name,
instance
}) || state;
}
}
},
// Async and optimistically optimized update – it will not be executed if
// not necessary (debounced to run at most once-per-tick)
update: debounce(function() {
return new Promise(function(resolve) {
instance.forceUpdate();
resolve(state);
});
}),
destroy: function destroy() {
cleanupModifierEffects();
isDestroyed = true;
}
};
if (!areValidElements(reference2, popper2)) {
return instance;
}
instance.setOptions(options).then(function(state2) {
if (!isDestroyed && options.onFirstUpdate) {
options.onFirstUpdate(state2);
}
});
function runModifierEffects() {
state.orderedModifiers.forEach(function(_ref) {
var name = _ref.name, _ref$options = _ref.options, options2 = _ref$options === void 0 ? {} : _ref$options, effect4 = _ref.effect;
if (typeof effect4 === "function") {
var cleanupFn = effect4({
state,
name,
instance,
options: options2
});
var noopFn = function noopFn2() {
};
effectCleanupFns.push(cleanupFn || noopFn);
}
});
}
function cleanupModifierEffects() {
effectCleanupFns.forEach(function(fn2) {
return fn2();
});
effectCleanupFns = [];
}
return instance;
};
}
var createPopper = /* @__PURE__ */ popperGenerator();
// node_modules/@popperjs/core/lib/popper-lite.js
var defaultModifiers = [eventListeners_default, popperOffsets_default, computeStyles_default, applyStyles_default];
var createPopper2 = /* @__PURE__ */ popperGenerator({
defaultModifiers
});
// node_modules/@popperjs/core/lib/popper.js
var defaultModifiers2 = [eventListeners_default, popperOffsets_default, computeStyles_default, applyStyles_default, offset_default, flip_default, preventOverflow_default, arrow_default, hide_default];
var createPopper3 = /* @__PURE__ */ popperGenerator({
defaultModifiers: defaultModifiers2
});
// node_modules/bootstrap/dist/js/bootstrap.esm.js
var elementMap = /* @__PURE__ */ new Map();
var Data = {
set(element, key, instance) {
if (!elementMap.has(element)) {
elementMap.set(element, /* @__PURE__ */ new Map());
}
const instanceMap = elementMap.get(element);
if (!instanceMap.has(key) && instanceMap.size !== 0) {
console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
return;
}
instanceMap.set(key, instance);
},
get(element, key) {
if (elementMap.has(element)) {
return elementMap.get(element).get(key) || null;
}
return null;
},
remove(element, key) {
if (!elementMap.has(element)) {
return;
}
const instanceMap = elementMap.get(element);
instanceMap.delete(key);
if (instanceMap.size === 0) {
elementMap.delete(element);
}
}
};
var MAX_UID = 1e6;
var MILLISECONDS_MULTIPLIER = 1e3;
var TRANSITION_END = "transitionend";
var parseSelector = (selector) => {
if (selector && window.CSS && window.CSS.escape) {
selector = selector.replace(/#([^\s"#']+)/g, (match, id) => `#${CSS.escape(id)}`);
}
return selector;
};
var toType = (object) => {
if (object === null || object === void 0) {
return `${object}`;
}
return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase();
};
var getUID = (prefix) => {
do {
prefix += Math.floor(Math.random() * MAX_UID);
} while (document.getElementById(prefix));
return prefix;
};
var getTransitionDurationFromElement = (element) => {
if (!element) {
return 0;
}
let {
transitionDuration,
transitionDelay
} = window.getComputedStyle(element);
const floatTransitionDuration = Number.parseFloat(transitionDuration);
const floatTransitionDelay = Number.parseFloat(transitionDelay);
if (!floatTransitionDuration && !floatTransitionDelay) {
return 0;
}
transitionDuration = transitionDuration.split(",")[0];
transitionDelay = transitionDelay.split(",")[0];
return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
};
var triggerTransitionEnd = (element) => {
element.dispatchEvent(new Event(TRANSITION_END));
};
var isElement2 = (object) => {
if (!object || typeof object !== "object") {
return false;
}
if (typeof object.jquery !== "undefined") {
object = object[0];
}
return typeof object.nodeType !== "undefined";
};
var getElement = (object) => {
if (isElement2(object)) {
return object.jquery ? object[0] : object;
}
if (typeof object === "string" && object.length > 0) {
return document.querySelector(parseSelector(object));
}
return null;
};
var isVisible = (element) => {
if (!isElement2(element) || element.getClientRects().length === 0) {
return false;
}
const elementIsVisible = getComputedStyle(element).getPropertyValue("visibility") === "visible";
const closedDetails = element.closest("details:not([open])");
if (!closedDetails) {
return elementIsVisible;
}
if (closedDetails !== element) {
const summary = element.closest("summary");
if (summary && summary.parentNode !== closedDetails) {
return false;
}
if (summary === null) {
return false;
}
}
return elementIsVisible;
};
var isDisabled = (element) => {
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
return true;
}
if (element.classList.contains("disabled")) {
return true;
}
if (typeof element.disabled !== "undefined") {
return element.disabled;
}
return element.hasAttribute("disabled") && element.getAttribute("disabled") !== "false";
};
var findShadowRoot = (element) => {
if (!document.documentElement.attachShadow) {
return null;
}
if (typeof element.getRootNode === "function") {
const root = element.getRootNode();
return root instanceof ShadowRoot ? root : null;
}
if (element instanceof ShadowRoot) {
return element;
}
if (!element.parentNode) {
return null;
}
return findShadowRoot(element.parentNode);
};
var noop = () => {
};
var reflow = (element) => {
element.offsetHeight;
};
var getjQuery = () => {
if (window.jQuery && !document.body.hasAttribute("data-bs-no-jquery")) {
return window.jQuery;
}
return null;
};
var DOMContentLoadedCallbacks = [];
var onDOMContentLoaded = (callback) => {
if (document.readyState === "loading") {
if (!DOMContentLoadedCallbacks.length) {
document.addEventListener("DOMContentLoaded", () => {
for (const callback2 of DOMContentLoadedCallbacks) {
callback2();
}
});
}
DOMContentLoadedCallbacks.push(callback);
} else {
callback();
}
};
var isRTL = () => document.documentElement.dir === "rtl";
var defineJQueryPlugin = (plugin) => {
onDOMContentLoaded(() => {
const $4 = getjQuery();
if ($4) {
const name = plugin.NAME;
const JQUERY_NO_CONFLICT = $4.fn[name];
$4.fn[name] = plugin.jQueryInterface;
$4.fn[name].Constructor = plugin;
$4.fn[name].noConflict = () => {
$4.fn[name] = JQUERY_NO_CONFLICT;
return plugin.jQueryInterface;
};
}
});
};
var execute = (possibleCallback, args = [], defaultValue = possibleCallback) => {
return typeof possibleCallback === "function" ? possibleCallback(...args) : defaultValue;
};
var executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
if (!waitForTransition) {
execute(callback);
return;
}
const durationPadding = 5;
const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
let called = false;
const handler = ({
target
}) => {
if (target !== transitionElement) {
return;
}
called = true;
transitionElement.removeEventListener(TRANSITION_END, handler);
execute(callback);
};
transitionElement.addEventListener(TRANSITION_END, handler);
setTimeout(() => {
if (!called) {
triggerTransitionEnd(transitionElement);
}
}, emulatedDuration);
};
var getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
const listLength = list.length;
let index = list.indexOf(activeElement);
if (index === -1) {
return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0];
}
index += shouldGetNext ? 1 : -1;
if (isCycleAllowed) {
index = (index + listLength) % listLength;
}
return list[Math.max(0, Math.min(index, listLength - 1))];
};
var namespaceRegex = /[^.]*(?=\..*)\.|.*/;
var stripNameRegex = /\..*/;
var stripUidRegex = /::\d+$/;
var eventRegistry = {};
var uidEvent = 1;
var customEvents = {
mouseenter: "mouseover",
mouseleave: "mouseout"
};
var nativeEvents = /* @__PURE__ */ new Set(["click", "dblclick", "mouseup", "mousedown", "contextmenu", "mousewheel", "DOMMouseScroll", "mouseover", "mouseout", "mousemove", "selectstart", "selectend", "keydown", "keypress", "keyup", "orientationchange", "touchstart", "touchmove", "touchend", "touchcancel", "pointerdown", "pointermove", "pointerup", "pointerleave", "pointercancel", "gesturestart", "gesturechange", "gestureend", "focus", "blur", "change", "reset", "select", "submit", "focusin", "focusout", "load", "unload", "beforeunload", "resize", "move", "DOMContentLoaded", "readystatechange", "error", "abort", "scroll"]);
function makeEventUid(element, uid) {
return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++;
}
function getElementEvents(element) {
const uid = makeEventUid(element);
element.uidEvent = uid;
eventRegistry[uid] = eventRegistry[uid] || {};
return eventRegistry[uid];
}
function bootstrapHandler(element, fn2) {
return function handler(event) {
hydrateObj(event, {
delegateTarget: element
});
if (handler.oneOff) {
EventHandler.off(element, event.type, fn2);
}
return fn2.apply(element, [event]);
};
}
function bootstrapDelegationHandler(element, selector, fn2) {
return function handler(event) {
const domElements = element.querySelectorAll(selector);
for (let {
target
} = event; target && target !== this; target = target.parentNode) {
for (const domElement of domElements) {
if (domElement !== target) {
continue;
}
hydrateObj(event, {
delegateTarget: target
});
if (handler.oneOff) {
EventHandler.off(element, event.type, selector, fn2);
}
return fn2.apply(target, [event]);
}
}
};
}
function findHandler(events, callable, delegationSelector = null) {
return Object.values(events).find((event) => event.callable === callable && event.delegationSelector === delegationSelector);
}
function normalizeParameters(originalTypeEvent, handler, delegationFunction) {
const isDelegated = typeof handler === "string";
const callable = isDelegated ? delegationFunction : handler || delegationFunction;
let typeEvent = getTypeEvent(originalTypeEvent);
if (!nativeEvents.has(typeEvent)) {
typeEvent = originalTypeEvent;
}
return [isDelegated, callable, typeEvent];
}
function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) {
if (typeof originalTypeEvent !== "string" || !element) {
return;
}
let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
if (originalTypeEvent in customEvents) {
const wrapFunction = (fn3) => {
return function(event) {
if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
return fn3.call(this, event);
}
};
};
callable = wrapFunction(callable);
}
const events = getElementEvents(element);
const handlers = events[typeEvent] || (events[typeEvent] = {});
const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null);
if (previousFunction) {
previousFunction.oneOff = previousFunction.oneOff && oneOff;
return;
}
const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, ""));
const fn2 = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable);
fn2.delegationSelector = isDelegated ? handler : null;
fn2.callable = callable;
fn2.oneOff = oneOff;
fn2.uidEvent = uid;
handlers[uid] = fn2;
element.addEventListener(typeEvent, fn2, isDelegated);
}
function removeHandler(element, events, typeEvent, handler, delegationSelector) {
const fn2 = findHandler(events[typeEvent], handler, delegationSelector);
if (!fn2) {
return;
}
element.removeEventListener(typeEvent, fn2, Boolean(delegationSelector));
delete events[typeEvent][fn2.uidEvent];
}
function removeNamespacedHandlers(element, events, typeEvent, namespace) {
const storeElementEvent = events[typeEvent] || {};
for (const [handlerKey, event] of Object.entries(storeElementEvent)) {
if (handlerKey.includes(namespace)) {
removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
}
}
}
function getTypeEvent(event) {
event = event.replace(stripNameRegex, "");
return customEvents[event] || event;
}
var EventHandler = {
on(element, event, handler, delegationFunction) {
addHandler(element, event, handler, delegationFunction, false);
},
one(element, event, handler, delegationFunction) {
addHandler(element, event, handler, delegationFunction, true);
},
off(element, originalTypeEvent, handler, delegationFunction) {
if (typeof originalTypeEvent !== "string" || !element) {
return;
}
const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
const inNamespace = typeEvent !== originalTypeEvent;
const events = getElementEvents(element);
const storeElementEvent = events[typeEvent] || {};
const isNamespace = originalTypeEvent.startsWith(".");
if (typeof callable !== "undefined") {
if (!Object.keys(storeElementEvent).length) {
return;
}
removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null);
return;
}
if (isNamespace) {
for (const elementEvent of Object.keys(events)) {
removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
}
}
for (const [keyHandlers, event] of Object.entries(storeElementEvent)) {
const handlerKey = keyHandlers.replace(stripUidRegex, "");
if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
}
}
},
trigger(element, event, args) {
if (typeof event !== "string" || !element) {
return null;
}
const $4 = getjQuery();
const typeEvent = getTypeEvent(event);
const inNamespace = event !== typeEvent;
let jQueryEvent = null;
let bubbles = true;
let nativeDispatch = true;
let defaultPrevented = false;
if (inNamespace && $4) {
jQueryEvent = $4.Event(event, args);
$4(element).trigger(jQueryEvent);
bubbles = !jQueryEvent.isPropagationStopped();
nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
defaultPrevented = jQueryEvent.isDefaultPrevented();
}
const evt = hydrateObj(new Event(event, {
bubbles,
cancelable: true
}), args);
if (defaultPrevented) {
evt.preventDefault();
}
if (nativeDispatch) {
element.dispatchEvent(evt);
}
if (evt.defaultPrevented && jQueryEvent) {
jQueryEvent.preventDefault();
}
return evt;
}
};
function hydrateObj(obj, meta = {}) {
for (const [key, value] of Object.entries(meta)) {
try {
obj[key] = value;
} catch (_unused) {
Object.defineProperty(obj, key, {
configurable: true,
get() {
return value;
}
});
}
}
return obj;
}
function normalizeData(value) {
if (value === "true") {
return true;
}
if (value === "false") {
return false;
}
if (value === Number(value).toString()) {
return Number(value);
}
if (value === "" || value === "null") {
return null;
}
if (typeof value !== "string") {
return value;
}
try {
return JSON.parse(decodeURIComponent(value));
} catch (_unused) {
return value;
}
}
function normalizeDataKey(key) {
return key.replace(/[A-Z]/g, (chr) => `-${chr.toLowerCase()}`);
}
var Manipulator = {
setDataAttribute(element, key, value) {
element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
},
removeDataAttribute(element, key) {
element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
},
getDataAttributes(element) {
if (!element) {
return {};
}
const attributes = {};
const bsKeys = Object.keys(element.dataset).filter((key) => key.startsWith("bs") && !key.startsWith("bsConfig"));
for (const key of bsKeys) {
let pureKey = key.replace(/^bs/, "");
pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
attributes[pureKey] = normalizeData(element.dataset[key]);
}
return attributes;
},
getDataAttribute(element, key) {
return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
}
};
var Config = class {
// Getters
static get Default() {
return {};
}
static get DefaultType() {
return {};
}
static get NAME() {
throw new Error('You have to implement the static method "NAME", for each component!');
}
_getConfig(config) {
config = this._mergeConfigObj(config);
config = this._configAfterMerge(config);
this._typeCheckConfig(config);
return config;
}
_configAfterMerge(config) {
return config;
}
_mergeConfigObj(config, element) {
const jsonConfig = isElement2(element) ? Manipulator.getDataAttribute(element, "config") : {};
return __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, this.constructor.Default), typeof jsonConfig === "object" ? jsonConfig : {}), isElement2(element) ? Manipulator.getDataAttributes(element) : {}), typeof config === "object" ? config : {});
}
_typeCheckConfig(config, configTypes = this.constructor.DefaultType) {
for (const [property, expectedTypes] of Object.entries(configTypes)) {
const value = config[property];
const valueType = isElement2(value) ? "element" : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) {
throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
}
}
}
};
var VERSION = "5.3.3";
var BaseComponent = class extends Config {
constructor(element, config) {
super();
element = getElement(element);
if (!element) {
return;
}
this._element = element;
this._config = this._getConfig(config);
Data.set(this._element, this.constructor.DATA_KEY, this);
}
// Public
dispose() {
Data.remove(this._element, this.constructor.DATA_KEY);
EventHandler.off(this._element, this.constructor.EVENT_KEY);
for (const propertyName of Object.getOwnPropertyNames(this)) {
this[propertyName] = null;
}
}
_queueCallback(callback, element, isAnimated = true) {
executeAfterTransition(callback, element, isAnimated);
}
_getConfig(config) {
config = this._mergeConfigObj(config, this._element);
config = this._configAfterMerge(config);
this._typeCheckConfig(config);
return config;
}
// Static
static getInstance(element) {
return Data.get(getElement(element), this.DATA_KEY);
}
static getOrCreateInstance(element, config = {}) {
return this.getInstance(element) || new this(element, typeof config === "object" ? config : null);
}
static get VERSION() {
return VERSION;
}
static get DATA_KEY() {
return `bs.${this.NAME}`;
}
static get EVENT_KEY() {
return `.${this.DATA_KEY}`;
}
static eventName(name) {
return `${name}${this.EVENT_KEY}`;
}
};
var getSelector = (element) => {
let selector = element.getAttribute("data-bs-target");
if (!selector || selector === "#") {
let hrefAttribute = element.getAttribute("href");
if (!hrefAttribute || !hrefAttribute.includes("#") && !hrefAttribute.startsWith(".")) {
return null;
}
if (hrefAttribute.includes("#") && !hrefAttribute.startsWith("#")) {
hrefAttribute = `#${hrefAttribute.split("#")[1]}`;
}
selector = hrefAttribute && hrefAttribute !== "#" ? hrefAttribute.trim() : null;
}
return selector ? selector.split(",").map((sel) => parseSelector(sel)).join(",") : null;
};
var SelectorEngine = {
find(selector, element = document.documentElement) {
return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
},
findOne(selector, element = document.documentElement) {
return Element.prototype.querySelector.call(element, selector);
},
children(element, selector) {
return [].concat(...element.children).filter((child) => child.matches(selector));
},
parents(element, selector) {
const parents = [];
let ancestor = element.parentNode.closest(selector);
while (ancestor) {
parents.push(ancestor);
ancestor = ancestor.parentNode.closest(selector);
}
return parents;
},
prev(element, selector) {
let previous = element.previousElementSibling;
while (previous) {
if (previous.matches(selector)) {
return [previous];
}
previous = previous.previousElementSibling;
}
return [];
},
// TODO: this is now unused; remove later along with prev()
next(element, selector) {
let next = element.nextElementSibling;
while (next) {
if (next.matches(selector)) {
return [next];
}
next = next.nextElementSibling;
}
return [];
},
focusableChildren(element) {
const focusables = ["a", "button", "input", "textarea", "select", "details", "[tabindex]", '[contenteditable="true"]'].map((selector) => `${selector}:not([tabindex^="-"])`).join(",");
return this.find(focusables, element).filter((el) => !isDisabled(el) && isVisible(el));
},
getSelectorFromElement(element) {
const selector = getSelector(element);
if (selector) {
return SelectorEngine.findOne(selector) ? selector : null;
}
return null;
},
getElementFromSelector(element) {
const selector = getSelector(element);
return selector ? SelectorEngine.findOne(selector) : null;
},
getMultipleElementsFromSelector(element) {
const selector = getSelector(element);
return selector ? SelectorEngine.find(selector) : [];
}
};
var enableDismissTrigger = (component, method = "hide") => {
const clickEvent = `click.dismiss${component.EVENT_KEY}`;
const name = component.NAME;
EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function(event) {
if (["A", "AREA"].includes(this.tagName)) {
event.preventDefault();
}
if (isDisabled(this)) {
return;
}
const target = SelectorEngine.getElementFromSelector(this) || this.closest(`.${name}`);
const instance = component.getOrCreateInstance(target);
instance[method]();
});
};
var NAME$f = "alert";
var DATA_KEY$a = "bs.alert";
var EVENT_KEY$b = `.${DATA_KEY$a}`;
var EVENT_CLOSE = `close${EVENT_KEY$b}`;
var EVENT_CLOSED = `closed${EVENT_KEY$b}`;
var CLASS_NAME_FADE$5 = "fade";
var CLASS_NAME_SHOW$8 = "show";
var Alert = class _Alert extends BaseComponent {
// Getters
static get NAME() {
return NAME$f;
}
// Public
close() {
const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE);
if (closeEvent.defaultPrevented) {
return;
}
this._element.classList.remove(CLASS_NAME_SHOW$8);
const isAnimated = this._element.classList.contains(CLASS_NAME_FADE$5);
this._queueCallback(() => this._destroyElement(), this._element, isAnimated);
}
// Private
_destroyElement() {
this._element.remove();
EventHandler.trigger(this._element, EVENT_CLOSED);
this.dispose();
}
// Static
static jQueryInterface(config) {
return this.each(function() {
const data = _Alert.getOrCreateInstance(this);
if (typeof config !== "string") {
return;
}
if (data[config] === void 0 || config.startsWith("_") || config === "constructor") {
throw new TypeError(`No method named "${config}"`);
}
data[config](this);
});
}
};
enableDismissTrigger(Alert, "close");
defineJQueryPlugin(Alert);
var NAME$e = "button";
var DATA_KEY$9 = "bs.button";
var EVENT_KEY$a = `.${DATA_KEY$9}`;
var DATA_API_KEY$6 = ".data-api";
var CLASS_NAME_ACTIVE$3 = "active";
var SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]';
var EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`;
var Button = class _Button extends BaseComponent {
// Getters
static get NAME() {
return NAME$e;
}
// Public
toggle() {
this._element.setAttribute("aria-pressed", this._element.classList.toggle(CLASS_NAME_ACTIVE$3));
}
// Static
static jQueryInterface(config) {
return this.each(function() {
const data = _Button.getOrCreateInstance(this);
if (config === "toggle") {
data[config]();
}
});
}
};
EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, (event) => {
event.preventDefault();
const button = event.target.closest(SELECTOR_DATA_TOGGLE$5);
const data = Button.getOrCreateInstance(button);
data.toggle();
});
defineJQueryPlugin(Button);
var NAME$d = "swipe";
var EVENT_KEY$9 = ".bs.swipe";
var EVENT_TOUCHSTART = `touchstart${EVENT_KEY$9}`;
var EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$9}`;
var EVENT_TOUCHEND = `touchend${EVENT_KEY$9}`;
var EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$9}`;
var EVENT_POINTERUP = `pointerup${EVENT_KEY$9}`;
var POINTER_TYPE_TOUCH = "touch";
var POINTER_TYPE_PEN = "pen";
var CLASS_NAME_POINTER_EVENT = "pointer-event";
var SWIPE_THRESHOLD = 40;
var Default$c = {
endCallback: null,
leftCallback: null,
rightCallback: null
};
var DefaultType$c = {
endCallback: "(function|null)",
leftCallback: "(function|null)",
rightCallback: "(function|null)"
};
var Swipe = class _Swipe extends Config {
constructor(element, config) {
super();
this._element = element;
if (!element || !_Swipe.isSupported()) {
return;
}
this._config = this._getConfig(config);
this._deltaX = 0;
this._supportPointerEvents = Boolean(window.PointerEvent);
this._initEvents();
}
// Getters
static get Default() {
return Default$c;
}
static get DefaultType() {
return DefaultType$c;
}
static get NAME() {
return NAME$d;
}
// Public
dispose() {
EventHandler.off(this._element, EVENT_KEY$9);
}
// Private
_start(event) {
if (!this._supportPointerEvents) {
this._deltaX = event.touches[0].clientX;
return;
}
if (this._eventIsPointerPenTouch(event)) {
this._deltaX = event.clientX;
}
}
_end(event) {
if (this._eventIsPointerPenTouch(event)) {
this._deltaX = event.clientX - this._deltaX;
}
this._handleSwipe();
execute(this._config.endCallback);
}
_move(event) {
this._deltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this._deltaX;
}
_handleSwipe() {
const absDeltaX = Math.abs(this._deltaX);
if (absDeltaX <= SWIPE_THRESHOLD) {
return;
}
const direction = absDeltaX / this._deltaX;
this._deltaX = 0;
if (!direction) {
return;
}
execute(direction > 0 ? this._config.rightCallback : this._config.leftCallback);
}
_initEvents() {
if (this._supportPointerEvents) {
EventHandler.on(this._element, EVENT_POINTERDOWN, (event) => this._start(event));
EventHandler.on(this._element, EVENT_POINTERUP, (event) => this._end(event));
this._element.classList.add(CLASS_NAME_POINTER_EVENT);
} else {
EventHandler.on(this._element, EVENT_TOUCHSTART, (event) => this._start(event));
EventHandler.on(this._element, EVENT_TOUCHMOVE, (event) => this._move(event));
EventHandler.on(this._element, EVENT_TOUCHEND, (event) => this._end(event));
}
}
_eventIsPointerPenTouch(event) {
return this._supportPointerEvents && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH);
}
// Static
static isSupported() {
return "ontouchstart" in document.documentElement || navigator.maxTouchPoints > 0;
}
};
var NAME$c = "carousel";
var DATA_KEY$8 = "bs.carousel";
var EVENT_KEY$8 = `.${DATA_KEY$8}`;
var DATA_API_KEY$5 = ".data-api";
var ARROW_LEFT_KEY$1 = "ArrowLeft";
var ARROW_RIGHT_KEY$1 = "ArrowRight";
var TOUCHEVENT_COMPAT_WAIT = 500;
var ORDER_NEXT = "next";
var ORDER_PREV = "prev";
var DIRECTION_LEFT = "left";
var DIRECTION_RIGHT = "right";
var EVENT_SLIDE = `slide${EVENT_KEY$8}`;
var EVENT_SLID = `slid${EVENT_KEY$8}`;
var EVENT_KEYDOWN$1 = `keydown${EVENT_KEY$8}`;
var EVENT_MOUSEENTER$1 = `mouseenter${EVENT_KEY$8}`;
var EVENT_MOUSELEAVE$1 = `mouseleave${EVENT_KEY$8}`;
var EVENT_DRAG_START = `dragstart${EVENT_KEY$8}`;
var EVENT_LOAD_DATA_API$3 = `load${EVENT_KEY$8}${DATA_API_KEY$5}`;
var EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`;
var CLASS_NAME_CAROUSEL = "carousel";
var CLASS_NAME_ACTIVE$2 = "active";
var CLASS_NAME_SLIDE = "slide";
var CLASS_NAME_END = "carousel-item-end";
var CLASS_NAME_START = "carousel-item-start";
var CLASS_NAME_NEXT = "carousel-item-next";
var CLASS_NAME_PREV = "carousel-item-prev";
var SELECTOR_ACTIVE = ".active";
var SELECTOR_ITEM = ".carousel-item";
var SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM;
var SELECTOR_ITEM_IMG = ".carousel-item img";
var SELECTOR_INDICATORS = ".carousel-indicators";
var SELECTOR_DATA_SLIDE = "[data-bs-slide], [data-bs-slide-to]";
var SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
var KEY_TO_DIRECTION = {
[ARROW_LEFT_KEY$1]: DIRECTION_RIGHT,
[ARROW_RIGHT_KEY$1]: DIRECTION_LEFT
};
var Default$b = {
interval: 5e3,
keyboard: true,
pause: "hover",
ride: false,
touch: true,
wrap: true
};
var DefaultType$b = {
interval: "(number|boolean)",
// TODO:v6 remove boolean support
keyboard: "boolean",
pause: "(string|boolean)",
ride: "(boolean|string)",
touch: "boolean",
wrap: "boolean"
};
var Carousel = class _Carousel extends BaseComponent {
constructor(element, config) {
super(element, config);
this._interval = null;
this._activeElement = null;
this._isSliding = false;
this.touchTimeout = null;
this._swipeHelper = null;
this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
this._addEventListeners();
if (this._config.ride === CLASS_NAME_CAROUSEL) {
this.cycle();
}
}
// Getters
static get Default() {
return Default$b;
}
static get DefaultType() {
return DefaultType$b;
}
static get NAME() {
return NAME$c;
}
// Public
next() {
this._slide(ORDER_NEXT);
}
nextWhenVisible() {
if (!document.hidden && isVisible(this._element)) {
this.next();
}
}
prev() {
this._slide(ORDER_PREV);
}
pause() {
if (this._isSliding) {
triggerTransitionEnd(this._element);
}
this._clearInterval();
}
cycle() {
this._clearInterval();
this._updateInterval();
this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval);
}
_maybeEnableCycle() {
if (!this._config.ride) {
return;
}
if (this._isSliding) {
EventHandler.one(this._element, EVENT_SLID, () => this.cycle());
return;
}
this.cycle();
}
to(index) {
const items = this._getItems();
if (index > items.length - 1 || index < 0) {
return;
}
if (this._isSliding) {
EventHandler.one(this._element, EVENT_SLID, () => this.to(index));
return;
}
const activeIndex = this._getItemIndex(this._getActive());
if (activeIndex === index) {
return;
}
const order2 = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
this._slide(order2, items[index]);
}
dispose() {
if (this._swipeHelper) {
this._swipeHelper.dispose();
}
super.dispose();
}
// Private
_configAfterMerge(config) {
config.defaultInterval = config.interval;
return config;
}
_addEventListeners() {
if (this._config.keyboard) {
EventHandler.on(this._element, EVENT_KEYDOWN$1, (event) => this._keydown(event));
}
if (this._config.pause === "hover") {
EventHandler.on(this._element, EVENT_MOUSEENTER$1, () => this.pause());
EventHandler.on(this._element, EVENT_MOUSELEAVE$1, () => this._maybeEnableCycle());
}
if (this._config.touch && Swipe.isSupported()) {
this._addTouchEventListeners();
}
}
_addTouchEventListeners() {
for (const img of SelectorEngine.find(SELECTOR_ITEM_IMG, this._element)) {
EventHandler.on(img, EVENT_DRAG_START, (event) => event.preventDefault());
}
const endCallBack = () => {
if (this._config.pause !== "hover") {
return;
}
this.pause();
if (this.touchTimeout) {
clearTimeout(this.touchTimeout);
}
this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval);
};
const swipeConfig = {
leftCallback: () => this._slide(this._directionToOrder(DIRECTION_LEFT)),
rightCallback: () => this._slide(this._directionToOrder(DIRECTION_RIGHT)),
endCallback: endCallBack
};
this._swipeHelper = new Swipe(this._element, swipeConfig);
}
_keydown(event) {
if (/input|textarea/i.test(event.target.tagName)) {
return;
}
const direction = KEY_TO_DIRECTION[event.key];
if (direction) {
event.preventDefault();
this._slide(this._directionToOrder(direction));
}
}
_getItemIndex(element) {
return this._getItems().indexOf(element);
}
_setActiveIndicatorElement(index) {
if (!this._indicatorsElement) {
return;
}
const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement);
activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2);
activeIndicator.removeAttribute("aria-current");
const newActiveIndicator = SelectorEngine.findOne(`[data-bs-slide-to="${index}"]`, this._indicatorsElement);
if (newActiveIndicator) {
newActiveIndicator.classList.add(CLASS_NAME_ACTIVE$2);
newActiveIndicator.setAttribute("aria-current", "true");
}
}
_updateInterval() {
const element = this._activeElement || this._getActive();
if (!element) {
return;
}
const elementInterval = Number.parseInt(element.getAttribute("data-bs-interval"), 10);
this._config.interval = elementInterval || this._config.defaultInterval;
}
_slide(order2, element = null) {
if (this._isSliding) {
return;
}
const activeElement = this._getActive();
const isNext = order2 === ORDER_NEXT;
const nextElement = element || getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap);
if (nextElement === activeElement) {
return;
}
const nextElementIndex = this._getItemIndex(nextElement);
const triggerEvent = (eventName) => {
return EventHandler.trigger(this._element, eventName, {
relatedTarget: nextElement,
direction: this._orderToDirection(order2),
from: this._getItemIndex(activeElement),
to: nextElementIndex
});
};
const slideEvent = triggerEvent(EVENT_SLIDE);
if (slideEvent.defaultPrevented) {
return;
}
if (!activeElement || !nextElement) {
return;
}
const isCycling = Boolean(this._interval);
this.pause();
this._isSliding = true;
this._setActiveIndicatorElement(nextElementIndex);
this._activeElement = nextElement;
const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END;
const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
nextElement.classList.add(orderClassName);
reflow(nextElement);
activeElement.classList.add(directionalClassName);
nextElement.classList.add(directionalClassName);
const completeCallBack = () => {
nextElement.classList.remove(directionalClassName, orderClassName);
nextElement.classList.add(CLASS_NAME_ACTIVE$2);
activeElement.classList.remove(CLASS_NAME_ACTIVE$2, orderClassName, directionalClassName);
this._isSliding = false;
triggerEvent(EVENT_SLID);
};
this._queueCallback(completeCallBack, activeElement, this._isAnimated());
if (isCycling) {
this.cycle();
}
}
_isAnimated() {
return this._element.classList.contains(CLASS_NAME_SLIDE);
}
_getActive() {
return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
}
_getItems() {
return SelectorEngine.find(SELECTOR_ITEM, this._element);
}
_clearInterval() {
if (this._interval) {
clearInterval(this._interval);
this._interval = null;
}
}
_directionToOrder(direction) {
if (isRTL()) {
return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT;
}
return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV;
}
_orderToDirection(order2) {
if (isRTL()) {
return order2 === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT;
}
return order2 === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT;
}
// Static
static jQueryInterface(config) {
return this.each(function() {
const data = _Carousel.getOrCreateInstance(this, config);
if (typeof config === "number") {
data.to(config);
return;
}
if (typeof config === "string") {
if (data[config] === void 0 || config.startsWith("_") || config === "constructor") {
throw new TypeError(`No method named "${config}"`);
}
data[config]();
}
});
}
};
EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_SLIDE, function(event) {
const target = SelectorEngine.getElementFromSelector(this);
if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
return;
}
event.preventDefault();
const carousel = Carousel.getOrCreateInstance(target);
const slideIndex = this.getAttribute("data-bs-slide-to");
if (slideIndex) {
carousel.to(slideIndex);
carousel._maybeEnableCycle();
return;
}
if (Manipulator.getDataAttribute(this, "slide") === "next") {
carousel.next();
carousel._maybeEnableCycle();
return;
}
carousel.prev();
carousel._maybeEnableCycle();
});
EventHandler.on(window, EVENT_LOAD_DATA_API$3, () => {
const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
for (const carousel of carousels) {
Carousel.getOrCreateInstance(carousel);
}
});
defineJQueryPlugin(Carousel);
var NAME$b = "collapse";
var DATA_KEY$7 = "bs.collapse";
var EVENT_KEY$7 = `.${DATA_KEY$7}`;
var DATA_API_KEY$4 = ".data-api";
var EVENT_SHOW$6 = `show${EVENT_KEY$7}`;
var EVENT_SHOWN$6 = `shown${EVENT_KEY$7}`;
var EVENT_HIDE$6 = `hide${EVENT_KEY$7}`;
var EVENT_HIDDEN$6 = `hidden${EVENT_KEY$7}`;
var EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`;
var CLASS_NAME_SHOW$7 = "show";
var CLASS_NAME_COLLAPSE = "collapse";
var CLASS_NAME_COLLAPSING = "collapsing";
var CLASS_NAME_COLLAPSED = "collapsed";
var CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`;
var CLASS_NAME_HORIZONTAL = "collapse-horizontal";
var WIDTH = "width";
var HEIGHT = "height";
var SELECTOR_ACTIVES = ".collapse.show, .collapse.collapsing";
var SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]';
var Default$a = {
parent: null,
toggle: true
};
var DefaultType$a = {
parent: "(null|element)",
toggle: "boolean"
};
var Collapse = class _Collapse extends BaseComponent {
constructor(element, config) {
super(element, config);
this._isTransitioning = false;
this._triggerArray = [];
const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4);
for (const elem of toggleList) {
const selector = SelectorEngine.getSelectorFromElement(elem);
const filterElement = SelectorEngine.find(selector).filter((foundElement) => foundElement === this._element);
if (selector !== null && filterElement.length) {
this._triggerArray.push(elem);
}
}
this._initializeChildren();
if (!this._config.parent) {
this._addAriaAndCollapsedClass(this._triggerArray, this._isShown());
}
if (this._config.toggle) {
this.toggle();
}
}
// Getters
static get Default() {
return Default$a;
}
static get DefaultType() {
return DefaultType$a;
}
static get NAME() {
return NAME$b;
}
// Public
toggle() {
if (this._isShown()) {
this.hide();
} else {
this.show();
}
}
show() {
if (this._isTransitioning || this._isShown()) {
return;
}
let activeChildren = [];
if (this._config.parent) {
activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES).filter((element) => element !== this._element).map((element) => _Collapse.getOrCreateInstance(element, {
toggle: false
}));
}
if (activeChildren.length && activeChildren[0]._isTransitioning) {
return;
}
const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$6);
if (startEvent.defaultPrevented) {
return;
}
for (const activeInstance of activeChildren) {
activeInstance.hide();
}
const dimension = this._getDimension();
this._element.classList.remove(CLASS_NAME_COLLAPSE);
this._element.classList.add(CLASS_NAME_COLLAPSING);
this._element.style[dimension] = 0;
this._addAriaAndCollapsedClass(this._triggerArray, true);
this._isTransitioning = true;
const complete = () => {
this._isTransitioning = false;
this._element.classList.remove(CLASS_NAME_COLLAPSING);
this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
this._element.style[dimension] = "";
EventHandler.trigger(this._element, EVENT_SHOWN$6);
};
const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
const scrollSize = `scroll${capitalizedDimension}`;
this._queueCallback(complete, this._element, true);
this._element.style[dimension] = `${this._element[scrollSize]}px`;
}
hide() {
if (this._isTransitioning || !this._isShown()) {
return;
}
const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$6);
if (startEvent.defaultPrevented) {
return;
}
const dimension = this._getDimension();
this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`;
reflow(this._element);
this._element.classList.add(CLASS_NAME_COLLAPSING);
this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
for (const trigger of this._triggerArray) {
const element = SelectorEngine.getElementFromSelector(trigger);
if (element && !this._isShown(element)) {
this._addAriaAndCollapsedClass([trigger], false);
}
}
this._isTransitioning = true;
const complete = () => {
this._isTransitioning = false;
this._element.classList.remove(CLASS_NAME_COLLAPSING);
this._element.classList.add(CLASS_NAME_COLLAPSE);
EventHandler.trigger(this._element, EVENT_HIDDEN$6);
};
this._element.style[dimension] = "";
this._queueCallback(complete, this._element, true);
}
_isShown(element = this._element) {
return element.classList.contains(CLASS_NAME_SHOW$7);
}
// Private
_configAfterMerge(config) {
config.toggle = Boolean(config.toggle);
config.parent = getElement(config.parent);
return config;
}
_getDimension() {
return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT;
}
_initializeChildren() {
if (!this._config.parent) {
return;
}
const children = this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE$4);
for (const element of children) {
const selected = SelectorEngine.getElementFromSelector(element);
if (selected) {
this._addAriaAndCollapsedClass([element], this._isShown(selected));
}
}
}
_getFirstLevelChildren(selector) {
const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent);
return SelectorEngine.find(selector, this._config.parent).filter((element) => !children.includes(element));
}
_addAriaAndCollapsedClass(triggerArray, isOpen) {
if (!triggerArray.length) {
return;
}
for (const element of triggerArray) {
element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen);
element.setAttribute("aria-expanded", isOpen);
}
}
// Static
static jQueryInterface(config) {
const _config = {};
if (typeof config === "string" && /show|hide/.test(config)) {
_config.toggle = false;
}
return this.each(function() {
const data = _Collapse.getOrCreateInstance(this, _config);
if (typeof config === "string") {
if (typeof data[config] === "undefined") {
throw new TypeError(`No method named "${config}"`);
}
data[config]();
}
});
}
};
EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$4, function(event) {
if (event.target.tagName === "A" || event.delegateTarget && event.delegateTarget.tagName === "A") {
event.preventDefault();
}
for (const element of SelectorEngine.getMultipleElementsFromSelector(this)) {
Collapse.getOrCreateInstance(element, {
toggle: false
}).toggle();
}
});
defineJQueryPlugin(Collapse);
var NAME$a = "dropdown";
var DATA_KEY$6 = "bs.dropdown";
var EVENT_KEY$6 = `.${DATA_KEY$6}`;
var DATA_API_KEY$3 = ".data-api";
var ESCAPE_KEY$2 = "Escape";
var TAB_KEY$1 = "Tab";
var ARROW_UP_KEY$1 = "ArrowUp";
var ARROW_DOWN_KEY$1 = "ArrowDown";
var RIGHT_MOUSE_BUTTON = 2;
var EVENT_HIDE$5 = `hide${EVENT_KEY$6}`;
var EVENT_HIDDEN$5 = `hidden${EVENT_KEY$6}`;
var EVENT_SHOW$5 = `show${EVENT_KEY$6}`;
var EVENT_SHOWN$5 = `shown${EVENT_KEY$6}`;
var EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
var EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$6}${DATA_API_KEY$3}`;
var EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$6}${DATA_API_KEY$3}`;
var CLASS_NAME_SHOW$6 = "show";
var CLASS_NAME_DROPUP = "dropup";
var CLASS_NAME_DROPEND = "dropend";
var CLASS_NAME_DROPSTART = "dropstart";
var CLASS_NAME_DROPUP_CENTER = "dropup-center";
var CLASS_NAME_DROPDOWN_CENTER = "dropdown-center";
var SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)';
var SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE$3}.${CLASS_NAME_SHOW$6}`;
var SELECTOR_MENU = ".dropdown-menu";
var SELECTOR_NAVBAR = ".navbar";
var SELECTOR_NAVBAR_NAV = ".navbar-nav";
var SELECTOR_VISIBLE_ITEMS = ".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)";
var PLACEMENT_TOP = isRTL() ? "top-end" : "top-start";
var PLACEMENT_TOPEND = isRTL() ? "top-start" : "top-end";
var PLACEMENT_BOTTOM = isRTL() ? "bottom-end" : "bottom-start";
var PLACEMENT_BOTTOMEND = isRTL() ? "bottom-start" : "bottom-end";
var PLACEMENT_RIGHT = isRTL() ? "left-start" : "right-start";
var PLACEMENT_LEFT = isRTL() ? "right-start" : "left-start";
var PLACEMENT_TOPCENTER = "top";
var PLACEMENT_BOTTOMCENTER = "bottom";
var Default$9 = {
autoClose: true,
boundary: "clippingParents",
display: "dynamic",
offset: [0, 2],
popperConfig: null,
reference: "toggle"
};
var DefaultType$9 = {
autoClose: "(boolean|string)",
boundary: "(string|element)",
display: "string",
offset: "(array|string|function)",
popperConfig: "(null|object|function)",
reference: "(string|element|object)"
};
var Dropdown = class _Dropdown extends BaseComponent {
constructor(element, config) {
super(element, config);
this._popper = null;
this._parent = this._element.parentNode;
this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] || SelectorEngine.prev(this._element, SELECTOR_MENU)[0] || SelectorEngine.findOne(SELECTOR_MENU, this._parent);
this._inNavbar = this._detectNavbar();
}
// Getters
static get Default() {
return Default$9;
}
static get DefaultType() {
return DefaultType$9;
}
static get NAME() {
return NAME$a;
}
// Public
toggle() {
return this._isShown() ? this.hide() : this.show();
}
show() {
if (isDisabled(this._element) || this._isShown()) {
return;
}
const relatedTarget = {
relatedTarget: this._element
};
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$5, relatedTarget);
if (showEvent.defaultPrevented) {
return;
}
this._createPopper();
if ("ontouchstart" in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) {
for (const element of [].concat(...document.body.children)) {
EventHandler.on(element, "mouseover", noop);
}
}
this._element.focus();
this._element.setAttribute("aria-expanded", true);
this._menu.classList.add(CLASS_NAME_SHOW$6);
this._element.classList.add(CLASS_NAME_SHOW$6);
EventHandler.trigger(this._element, EVENT_SHOWN$5, relatedTarget);
}
hide() {
if (isDisabled(this._element) || !this._isShown()) {
return;
}
const relatedTarget = {
relatedTarget: this._element
};
this._completeHide(relatedTarget);
}
dispose() {
if (this._popper) {
this._popper.destroy();
}
super.dispose();
}
update() {
this._inNavbar = this._detectNavbar();
if (this._popper) {
this._popper.update();
}
}
// Private
_completeHide(relatedTarget) {
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$5, relatedTarget);
if (hideEvent.defaultPrevented) {
return;
}
if ("ontouchstart" in document.documentElement) {
for (const element of [].concat(...document.body.children)) {
EventHandler.off(element, "mouseover", noop);
}
}
if (this._popper) {
this._popper.destroy();
}
this._menu.classList.remove(CLASS_NAME_SHOW$6);
this._element.classList.remove(CLASS_NAME_SHOW$6);
this._element.setAttribute("aria-expanded", "false");
Manipulator.removeDataAttribute(this._menu, "popper");
EventHandler.trigger(this._element, EVENT_HIDDEN$5, relatedTarget);
}
_getConfig(config) {
config = super._getConfig(config);
if (typeof config.reference === "object" && !isElement2(config.reference) && typeof config.reference.getBoundingClientRect !== "function") {
throw new TypeError(`${NAME$a.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
}
return config;
}
_createPopper() {
if (typeof lib_exports === "undefined") {
throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");
}
let referenceElement = this._element;
if (this._config.reference === "parent") {
referenceElement = this._parent;
} else if (isElement2(this._config.reference)) {
referenceElement = getElement(this._config.reference);
} else if (typeof this._config.reference === "object") {
referenceElement = this._config.reference;
}
const popperConfig = this._getPopperConfig();
this._popper = createPopper3(referenceElement, this._menu, popperConfig);
}
_isShown() {
return this._menu.classList.contains(CLASS_NAME_SHOW$6);
}
_getPlacement() {
const parentDropdown = this._parent;
if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {
return PLACEMENT_RIGHT;
}
if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {
return PLACEMENT_LEFT;
}
if (parentDropdown.classList.contains(CLASS_NAME_DROPUP_CENTER)) {
return PLACEMENT_TOPCENTER;
}
if (parentDropdown.classList.contains(CLASS_NAME_DROPDOWN_CENTER)) {
return PLACEMENT_BOTTOMCENTER;
}
const isEnd = getComputedStyle(this._menu).getPropertyValue("--bs-position").trim() === "end";
if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP;
}
return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM;
}
_detectNavbar() {
return this._element.closest(SELECTOR_NAVBAR) !== null;
}
_getOffset() {
const {
offset: offset2
} = this._config;
if (typeof offset2 === "string") {
return offset2.split(",").map((value) => Number.parseInt(value, 10));
}
if (typeof offset2 === "function") {
return (popperData) => offset2(popperData, this._element);
}
return offset2;
}
_getPopperConfig() {
const defaultBsPopperConfig = {
placement: this._getPlacement(),
modifiers: [{
name: "preventOverflow",
options: {
boundary: this._config.boundary
}
}, {
name: "offset",
options: {
offset: this._getOffset()
}
}]
};
if (this._inNavbar || this._config.display === "static") {
Manipulator.setDataAttribute(this._menu, "popper", "static");
defaultBsPopperConfig.modifiers = [{
name: "applyStyles",
enabled: false
}];
}
return __spreadValues(__spreadValues({}, defaultBsPopperConfig), execute(this._config.popperConfig, [defaultBsPopperConfig]));
}
_selectMenuItem({
key,
target
}) {
const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter((element) => isVisible(element));
if (!items.length) {
return;
}
getNextActiveElement(items, target, key === ARROW_DOWN_KEY$1, !items.includes(target)).focus();
}
// Static
static jQueryInterface(config) {
return this.each(function() {
const data = _Dropdown.getOrCreateInstance(this, config);
if (typeof config !== "string") {
return;
}
if (typeof data[config] === "undefined") {
throw new TypeError(`No method named "${config}"`);
}
data[config]();
});
}
static clearMenus(event) {
if (event.button === RIGHT_MOUSE_BUTTON || event.type === "keyup" && event.key !== TAB_KEY$1) {
return;
}
const openToggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN);
for (const toggle of openToggles) {
const context = _Dropdown.getInstance(toggle);
if (!context || context._config.autoClose === false) {
continue;
}
const composedPath = event.composedPath();
const isMenuTarget = composedPath.includes(context._menu);
if (composedPath.includes(context._element) || context._config.autoClose === "inside" && !isMenuTarget || context._config.autoClose === "outside" && isMenuTarget) {
continue;
}
if (context._menu.contains(event.target) && (event.type === "keyup" && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) {
continue;
}
const relatedTarget = {
relatedTarget: context._element
};
if (event.type === "click") {
relatedTarget.clickEvent = event;
}
context._completeHide(relatedTarget);
}
}
static dataApiKeydownHandler(event) {
const isInput = /input|textarea/i.test(event.target.tagName);
const isEscapeEvent = event.key === ESCAPE_KEY$2;
const isUpOrDownEvent = [ARROW_UP_KEY$1, ARROW_DOWN_KEY$1].includes(event.key);
if (!isUpOrDownEvent && !isEscapeEvent) {
return;
}
if (isInput && !isEscapeEvent) {
return;
}
event.preventDefault();
const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0] || SelectorEngine.next(this, SELECTOR_DATA_TOGGLE$3)[0] || SelectorEngine.findOne(SELECTOR_DATA_TOGGLE$3, event.delegateTarget.parentNode);
const instance = _Dropdown.getOrCreateInstance(getToggleButton);
if (isUpOrDownEvent) {
event.stopPropagation();
instance.show();
instance._selectMenuItem(event);
return;
}
if (instance._isShown()) {
event.stopPropagation();
instance.hide();
getToggleButton.focus();
}
}
};
EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$3, Dropdown.dataApiKeydownHandler);
EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler);
EventHandler.on(document, EVENT_CLICK_DATA_API$3, Dropdown.clearMenus);
EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function(event) {
event.preventDefault();
Dropdown.getOrCreateInstance(this).toggle();
});
defineJQueryPlugin(Dropdown);
var NAME$9 = "backdrop";
var CLASS_NAME_FADE$4 = "fade";
var CLASS_NAME_SHOW$5 = "show";
var EVENT_MOUSEDOWN = `mousedown.bs.${NAME$9}`;
var Default$8 = {
className: "modal-backdrop",
clickCallback: null,
isAnimated: false,
isVisible: true,
// if false, we use the backdrop helper without adding any element to the dom
rootElement: "body"
// give the choice to place backdrop under different elements
};
var DefaultType$8 = {
className: "string",
clickCallback: "(function|null)",
isAnimated: "boolean",
isVisible: "boolean",
rootElement: "(element|string)"
};
var Backdrop = class extends Config {
constructor(config) {
super();
this._config = this._getConfig(config);
this._isAppended = false;
this._element = null;
}
// Getters
static get Default() {
return Default$8;
}
static get DefaultType() {
return DefaultType$8;
}
static get NAME() {
return NAME$9;
}
// Public
show(callback) {
if (!this._config.isVisible) {
execute(callback);
return;
}
this._append();
const element = this._getElement();
if (this._config.isAnimated) {
reflow(element);
}
element.classList.add(CLASS_NAME_SHOW$5);
this._emulateAnimation(() => {
execute(callback);
});
}
hide(callback) {
if (!this._config.isVisible) {
execute(callback);
return;
}
this._getElement().classList.remove(CLASS_NAME_SHOW$5);
this._emulateAnimation(() => {
this.dispose();
execute(callback);
});
}
dispose() {
if (!this._isAppended) {
return;
}
EventHandler.off(this._element, EVENT_MOUSEDOWN);
this._element.remove();
this._isAppended = false;
}
// Private
_getElement() {
if (!this._element) {
const backdrop = document.createElement("div");
backdrop.className = this._config.className;
if (this._config.isAnimated) {
backdrop.classList.add(CLASS_NAME_FADE$4);
}
this._element = backdrop;
}
return this._element;
}
_configAfterMerge(config) {
config.rootElement = getElement(config.rootElement);
return config;
}
_append() {
if (this._isAppended) {
return;
}
const element = this._getElement();
this._config.rootElement.append(element);
EventHandler.on(element, EVENT_MOUSEDOWN, () => {
execute(this._config.clickCallback);
});
this._isAppended = true;
}
_emulateAnimation(callback) {
executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
}
};
var NAME$8 = "focustrap";
var DATA_KEY$5 = "bs.focustrap";
var EVENT_KEY$5 = `.${DATA_KEY$5}`;
var EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$5}`;
var EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$5}`;
var TAB_KEY = "Tab";
var TAB_NAV_FORWARD = "forward";
var TAB_NAV_BACKWARD = "backward";
var Default$7 = {
autofocus: true,
trapElement: null
// The element to trap focus inside of
};
var DefaultType$7 = {
autofocus: "boolean",
trapElement: "element"
};
var FocusTrap = class extends Config {
constructor(config) {
super();
this._config = this._getConfig(config);
this._isActive = false;
this._lastTabNavDirection = null;
}
// Getters
static get Default() {
return Default$7;
}
static get DefaultType() {
return DefaultType$7;
}
static get NAME() {
return NAME$8;
}
// Public
activate() {
if (this._isActive) {
return;
}
if (this._config.autofocus) {
this._config.trapElement.focus();
}
EventHandler.off(document, EVENT_KEY$5);
EventHandler.on(document, EVENT_FOCUSIN$2, (event) => this._handleFocusin(event));
EventHandler.on(document, EVENT_KEYDOWN_TAB, (event) => this._handleKeydown(event));
this._isActive = true;
}
deactivate() {
if (!this._isActive) {
return;
}
this._isActive = false;
EventHandler.off(document, EVENT_KEY$5);
}
// Private
_handleFocusin(event) {
const {
trapElement
} = this._config;
if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) {
return;
}
const elements = SelectorEngine.focusableChildren(trapElement);
if (elements.length === 0) {
trapElement.focus();
} else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
elements[elements.length - 1].focus();
} else {
elements[0].focus();
}
}
_handleKeydown(event) {
if (event.key !== TAB_KEY) {
return;
}
this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
}
};
var SELECTOR_FIXED_CONTENT = ".fixed-top, .fixed-bottom, .is-fixed, .sticky-top";
var SELECTOR_STICKY_CONTENT = ".sticky-top";
var PROPERTY_PADDING = "padding-right";
var PROPERTY_MARGIN = "margin-right";
var ScrollBarHelper = class {
constructor() {
this._element = document.body;
}
// Public
getWidth() {
const documentWidth = document.documentElement.clientWidth;
return Math.abs(window.innerWidth - documentWidth);
}
hide() {
const width = this.getWidth();
this._disableOverFlow();
this._setElementAttributes(this._element, PROPERTY_PADDING, (calculatedValue) => calculatedValue + width);
this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, (calculatedValue) => calculatedValue + width);
this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, (calculatedValue) => calculatedValue - width);
}
reset() {
this._resetElementAttributes(this._element, "overflow");
this._resetElementAttributes(this._element, PROPERTY_PADDING);
this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING);
this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN);
}
isOverflowing() {
return this.getWidth() > 0;
}
// Private
_disableOverFlow() {
this._saveInitialAttribute(this._element, "overflow");
this._element.style.overflow = "hidden";
}
_setElementAttributes(selector, styleProperty, callback) {
const scrollbarWidth = this.getWidth();
const manipulationCallBack = (element) => {
if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
return;
}
this._saveInitialAttribute(element, styleProperty);
const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty);
element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`);
};
this._applyManipulationCallback(selector, manipulationCallBack);
}
_saveInitialAttribute(element, styleProperty) {
const actualValue = element.style.getPropertyValue(styleProperty);
if (actualValue) {
Manipulator.setDataAttribute(element, styleProperty, actualValue);
}
}
_resetElementAttributes(selector, styleProperty) {
const manipulationCallBack = (element) => {
const value = Manipulator.getDataAttribute(element, styleProperty);
if (value === null) {
element.style.removeProperty(styleProperty);
return;
}
Manipulator.removeDataAttribute(element, styleProperty);
element.style.setProperty(styleProperty, value);
};
this._applyManipulationCallback(selector, manipulationCallBack);
}
_applyManipulationCallback(selector, callBack) {
if (isElement2(selector)) {
callBack(selector);
return;
}
for (const sel of SelectorEngine.find(selector, this._element)) {
callBack(sel);
}
}
};
var NAME$7 = "modal";
var DATA_KEY$4 = "bs.modal";
var EVENT_KEY$4 = `.${DATA_KEY$4}`;
var DATA_API_KEY$2 = ".data-api";
var ESCAPE_KEY$1 = "Escape";
var EVENT_HIDE$4 = `hide${EVENT_KEY$4}`;
var EVENT_HIDE_PREVENTED$1 = `hidePrevented${EVENT_KEY$4}`;
var EVENT_HIDDEN$4 = `hidden${EVENT_KEY$4}`;
var EVENT_SHOW$4 = `show${EVENT_KEY$4}`;
var EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`;
var EVENT_RESIZE$1 = `resize${EVENT_KEY$4}`;
var EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$4}`;
var EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$4}`;
var EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$4}`;
var EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`;
var CLASS_NAME_OPEN = "modal-open";
var CLASS_NAME_FADE$3 = "fade";
var CLASS_NAME_SHOW$4 = "show";
var CLASS_NAME_STATIC = "modal-static";
var OPEN_SELECTOR$1 = ".modal.show";
var SELECTOR_DIALOG = ".modal-dialog";
var SELECTOR_MODAL_BODY = ".modal-body";
var SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
var Default$6 = {
backdrop: true,
focus: true,
keyboard: true
};
var DefaultType$6 = {
backdrop: "(boolean|string)",
focus: "boolean",
keyboard: "boolean"
};
var Modal = class _Modal extends BaseComponent {
constructor(element, config) {
super(element, config);
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
this._backdrop = this._initializeBackDrop();
this._focustrap = this._initializeFocusTrap();
this._isShown = false;
this._isTransitioning = false;
this._scrollBar = new ScrollBarHelper();
this._addEventListeners();
}
// Getters
static get Default() {
return Default$6;
}
static get DefaultType() {
return DefaultType$6;
}
static get NAME() {
return NAME$7;
}
// Public
toggle(relatedTarget) {
return this._isShown ? this.hide() : this.show(relatedTarget);
}
show(relatedTarget) {
if (this._isShown || this._isTransitioning) {
return;
}
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, {
relatedTarget
});
if (showEvent.defaultPrevented) {
return;
}
this._isShown = true;
this._isTransitioning = true;
this._scrollBar.hide();
document.body.classList.add(CLASS_NAME_OPEN);
this._adjustDialog();
this._backdrop.show(() => this._showElement(relatedTarget));
}
hide() {
if (!this._isShown || this._isTransitioning) {
return;
}
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4);
if (hideEvent.defaultPrevented) {
return;
}
this._isShown = false;
this._isTransitioning = true;
this._focustrap.deactivate();
this._element.classList.remove(CLASS_NAME_SHOW$4);
this._queueCallback(() => this._hideModal(), this._element, this._isAnimated());
}
dispose() {
EventHandler.off(window, EVENT_KEY$4);
EventHandler.off(this._dialog, EVENT_KEY$4);
this._backdrop.dispose();
this._focustrap.deactivate();
super.dispose();
}
handleUpdate() {
this._adjustDialog();
}
// Private
_initializeBackDrop() {
return new Backdrop({
isVisible: Boolean(this._config.backdrop),
// 'static' option will be translated to true, and booleans will keep their value,
isAnimated: this._isAnimated()
});
}
_initializeFocusTrap() {
return new FocusTrap({
trapElement: this._element
});
}
_showElement(relatedTarget) {
if (!document.body.contains(this._element)) {
document.body.append(this._element);
}
this._element.style.display = "block";
this._element.removeAttribute("aria-hidden");
this._element.setAttribute("aria-modal", true);
this._element.setAttribute("role", "dialog");
this._element.scrollTop = 0;
const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
if (modalBody) {
modalBody.scrollTop = 0;
}
reflow(this._element);
this._element.classList.add(CLASS_NAME_SHOW$4);
const transitionComplete = () => {
if (this._config.focus) {
this._focustrap.activate();
}
this._isTransitioning = false;
EventHandler.trigger(this._element, EVENT_SHOWN$4, {
relatedTarget
});
};
this._queueCallback(transitionComplete, this._dialog, this._isAnimated());
}
_addEventListeners() {
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, (event) => {
if (event.key !== ESCAPE_KEY$1) {
return;
}
if (this._config.keyboard) {
this.hide();
return;
}
this._triggerBackdropTransition();
});
EventHandler.on(window, EVENT_RESIZE$1, () => {
if (this._isShown && !this._isTransitioning) {
this._adjustDialog();
}
});
EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, (event) => {
EventHandler.one(this._element, EVENT_CLICK_DISMISS, (event2) => {
if (this._element !== event.target || this._element !== event2.target) {
return;
}
if (this._config.backdrop === "static") {
this._triggerBackdropTransition();
return;
}
if (this._config.backdrop) {
this.hide();
}
});
});
}
_hideModal() {
this._element.style.display = "none";
this._element.setAttribute("aria-hidden", true);
this._element.removeAttribute("aria-modal");
this._element.removeAttribute("role");
this._isTransitioning = false;
this._backdrop.hide(() => {
document.body.classList.remove(CLASS_NAME_OPEN);
this._resetAdjustments();
this._scrollBar.reset();
EventHandler.trigger(this._element, EVENT_HIDDEN$4);
});
}
_isAnimated() {
return this._element.classList.contains(CLASS_NAME_FADE$3);
}
_triggerBackdropTransition() {
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED$1);
if (hideEvent.defaultPrevented) {
return;
}
const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
const initialOverflowY = this._element.style.overflowY;
if (initialOverflowY === "hidden" || this._element.classList.contains(CLASS_NAME_STATIC)) {
return;
}
if (!isModalOverflowing) {
this._element.style.overflowY = "hidden";
}
this._element.classList.add(CLASS_NAME_STATIC);
this._queueCallback(() => {
this._element.classList.remove(CLASS_NAME_STATIC);
this._queueCallback(() => {
this._element.style.overflowY = initialOverflowY;
}, this._dialog);
}, this._dialog);
this._element.focus();
}
/**
* The following methods are used to handle overflowing modals
*/
_adjustDialog() {
const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
const scrollbarWidth = this._scrollBar.getWidth();
const isBodyOverflowing = scrollbarWidth > 0;
if (isBodyOverflowing && !isModalOverflowing) {
const property = isRTL() ? "paddingLeft" : "paddingRight";
this._element.style[property] = `${scrollbarWidth}px`;
}
if (!isBodyOverflowing && isModalOverflowing) {
const property = isRTL() ? "paddingRight" : "paddingLeft";
this._element.style[property] = `${scrollbarWidth}px`;
}
}
_resetAdjustments() {
this._element.style.paddingLeft = "";
this._element.style.paddingRight = "";
}
// Static
static jQueryInterface(config, relatedTarget) {
return this.each(function() {
const data = _Modal.getOrCreateInstance(this, config);
if (typeof config !== "string") {
return;
}
if (typeof data[config] === "undefined") {
throw new TypeError(`No method named "${config}"`);
}
data[config](relatedTarget);
});
}
};
EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function(event) {
const target = SelectorEngine.getElementFromSelector(this);
if (["A", "AREA"].includes(this.tagName)) {
event.preventDefault();
}
EventHandler.one(target, EVENT_SHOW$4, (showEvent) => {
if (showEvent.defaultPrevented) {
return;
}
EventHandler.one(target, EVENT_HIDDEN$4, () => {
if (isVisible(this)) {
this.focus();
}
});
});
const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1);
if (alreadyOpen) {
Modal.getInstance(alreadyOpen).hide();
}
const data = Modal.getOrCreateInstance(target);
data.toggle(this);
});
enableDismissTrigger(Modal);
defineJQueryPlugin(Modal);
var NAME$6 = "offcanvas";
var DATA_KEY$3 = "bs.offcanvas";
var EVENT_KEY$3 = `.${DATA_KEY$3}`;
var DATA_API_KEY$1 = ".data-api";
var EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$3}${DATA_API_KEY$1}`;
var ESCAPE_KEY = "Escape";
var CLASS_NAME_SHOW$3 = "show";
var CLASS_NAME_SHOWING$1 = "showing";
var CLASS_NAME_HIDING = "hiding";
var CLASS_NAME_BACKDROP = "offcanvas-backdrop";
var OPEN_SELECTOR = ".offcanvas.show";
var EVENT_SHOW$3 = `show${EVENT_KEY$3}`;
var EVENT_SHOWN$3 = `shown${EVENT_KEY$3}`;
var EVENT_HIDE$3 = `hide${EVENT_KEY$3}`;
var EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$3}`;
var EVENT_HIDDEN$3 = `hidden${EVENT_KEY$3}`;
var EVENT_RESIZE = `resize${EVENT_KEY$3}`;
var EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$3}${DATA_API_KEY$1}`;
var EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$3}`;
var SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
var Default$5 = {
backdrop: true,
keyboard: true,
scroll: false
};
var DefaultType$5 = {
backdrop: "(boolean|string)",
keyboard: "boolean",
scroll: "boolean"
};
var Offcanvas = class _Offcanvas extends BaseComponent {
constructor(element, config) {
super(element, config);
this._isShown = false;
this._backdrop = this._initializeBackDrop();
this._focustrap = this._initializeFocusTrap();
this._addEventListeners();
}
// Getters
static get Default() {
return Default$5;
}
static get DefaultType() {
return DefaultType$5;
}
static get NAME() {
return NAME$6;
}
// Public
toggle(relatedTarget) {
return this._isShown ? this.hide() : this.show(relatedTarget);
}
show(relatedTarget) {
if (this._isShown) {
return;
}
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
relatedTarget
});
if (showEvent.defaultPrevented) {
return;
}
this._isShown = true;
this._backdrop.show();
if (!this._config.scroll) {
new ScrollBarHelper().hide();
}
this._element.setAttribute("aria-modal", true);
this._element.setAttribute("role", "dialog");
this._element.classList.add(CLASS_NAME_SHOWING$1);
const completeCallBack = () => {
if (!this._config.scroll || this._config.backdrop) {
this._focustrap.activate();
}
this._element.classList.add(CLASS_NAME_SHOW$3);
this._element.classList.remove(CLASS_NAME_SHOWING$1);
EventHandler.trigger(this._element, EVENT_SHOWN$3, {
relatedTarget
});
};
this._queueCallback(completeCallBack, this._element, true);
}
hide() {
if (!this._isShown) {
return;
}
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3);
if (hideEvent.defaultPrevented) {
return;
}
this._focustrap.deactivate();
this._element.blur();
this._isShown = false;
this._element.classList.add(CLASS_NAME_HIDING);
this._backdrop.hide();
const completeCallback = () => {
this._element.classList.remove(CLASS_NAME_SHOW$3, CLASS_NAME_HIDING);
this._element.removeAttribute("aria-modal");
this._element.removeAttribute("role");
if (!this._config.scroll) {
new ScrollBarHelper().reset();
}
EventHandler.trigger(this._element, EVENT_HIDDEN$3);
};
this._queueCallback(completeCallback, this._element, true);
}
dispose() {
this._backdrop.dispose();
this._focustrap.deactivate();
super.dispose();
}
// Private
_initializeBackDrop() {
const clickCallback = () => {
if (this._config.backdrop === "static") {
EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
return;
}
this.hide();
};
const isVisible2 = Boolean(this._config.backdrop);
return new Backdrop({
className: CLASS_NAME_BACKDROP,
isVisible: isVisible2,
isAnimated: true,
rootElement: this._element.parentNode,
clickCallback: isVisible2 ? clickCallback : null
});
}
_initializeFocusTrap() {
return new FocusTrap({
trapElement: this._element
});
}
_addEventListeners() {
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, (event) => {
if (event.key !== ESCAPE_KEY) {
return;
}
if (this._config.keyboard) {
this.hide();
return;
}
EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
});
}
// Static
static jQueryInterface(config) {
return this.each(function() {
const data = _Offcanvas.getOrCreateInstance(this, config);
if (typeof config !== "string") {
return;
}
if (data[config] === void 0 || config.startsWith("_") || config === "constructor") {
throw new TypeError(`No method named "${config}"`);
}
data[config](this);
});
}
};
EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function(event) {
const target = SelectorEngine.getElementFromSelector(this);
if (["A", "AREA"].includes(this.tagName)) {
event.preventDefault();
}
if (isDisabled(this)) {
return;
}
EventHandler.one(target, EVENT_HIDDEN$3, () => {
if (isVisible(this)) {
this.focus();
}
});
const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
if (alreadyOpen && alreadyOpen !== target) {
Offcanvas.getInstance(alreadyOpen).hide();
}
const data = Offcanvas.getOrCreateInstance(target);
data.toggle(this);
});
EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => {
for (const selector of SelectorEngine.find(OPEN_SELECTOR)) {
Offcanvas.getOrCreateInstance(selector).show();
}
});
EventHandler.on(window, EVENT_RESIZE, () => {
for (const element of SelectorEngine.find("[aria-modal][class*=show][class*=offcanvas-]")) {
if (getComputedStyle(element).position !== "fixed") {
Offcanvas.getOrCreateInstance(element).hide();
}
}
});
enableDismissTrigger(Offcanvas);
defineJQueryPlugin(Offcanvas);
var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
var DefaultAllowlist = {
// Global attributes allowed on any supplied element below.
"*": ["class", "dir", "id", "lang", "role", ARIA_ATTRIBUTE_PATTERN],
a: ["target", "href", "title", "rel"],
area: [],
b: [],
br: [],
col: [],
code: [],
dd: [],
div: [],
dl: [],
dt: [],
em: [],
hr: [],
h1: [],
h2: [],
h3: [],
h4: [],
h5: [],
h6: [],
i: [],
img: ["src", "srcset", "alt", "title", "width", "height"],
li: [],
ol: [],
p: [],
pre: [],
s: [],
small: [],
span: [],
sub: [],
sup: [],
strong: [],
u: [],
ul: []
};
var uriAttributes = /* @__PURE__ */ new Set(["background", "cite", "href", "itemtype", "longdesc", "poster", "src", "xlink:href"]);
var SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i;
var allowedAttribute = (attribute, allowedAttributeList) => {
const attributeName = attribute.nodeName.toLowerCase();
if (allowedAttributeList.includes(attributeName)) {
if (uriAttributes.has(attributeName)) {
return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue));
}
return true;
}
return allowedAttributeList.filter((attributeRegex) => attributeRegex instanceof RegExp).some((regex) => regex.test(attributeName));
};
function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
if (!unsafeHtml.length) {
return unsafeHtml;
}
if (sanitizeFunction && typeof sanitizeFunction === "function") {
return sanitizeFunction(unsafeHtml);
}
const domParser = new window.DOMParser();
const createdDocument = domParser.parseFromString(unsafeHtml, "text/html");
const elements = [].concat(...createdDocument.body.querySelectorAll("*"));
for (const element of elements) {
const elementName = element.nodeName.toLowerCase();
if (!Object.keys(allowList).includes(elementName)) {
element.remove();
continue;
}
const attributeList = [].concat(...element.attributes);
const allowedAttributes = [].concat(allowList["*"] || [], allowList[elementName] || []);
for (const attribute of attributeList) {
if (!allowedAttribute(attribute, allowedAttributes)) {
element.removeAttribute(attribute.nodeName);
}
}
}
return createdDocument.body.innerHTML;
}
var NAME$5 = "TemplateFactory";
var Default$4 = {
allowList: DefaultAllowlist,
content: {},
// { selector : text , selector2 : text2 , }
extraClass: "",
html: false,
sanitize: true,
sanitizeFn: null,
template: "<div></div>"
};
var DefaultType$4 = {
allowList: "object",
content: "object",
extraClass: "(string|function)",
html: "boolean",
sanitize: "boolean",
sanitizeFn: "(null|function)",
template: "string"
};
var DefaultContentType = {
entry: "(string|element|function|null)",
selector: "(string|element)"
};
var TemplateFactory = class extends Config {
constructor(config) {
super();
this._config = this._getConfig(config);
}
// Getters
static get Default() {
return Default$4;
}
static get DefaultType() {
return DefaultType$4;
}
static get NAME() {
return NAME$5;
}
// Public
getContent() {
return Object.values(this._config.content).map((config) => this._resolvePossibleFunction(config)).filter(Boolean);
}
hasContent() {
return this.getContent().length > 0;
}
changeContent(content) {
this._checkContent(content);
this._config.content = __spreadValues(__spreadValues({}, this._config.content), content);
return this;
}
toHtml() {
const templateWrapper = document.createElement("div");
templateWrapper.innerHTML = this._maybeSanitize(this._config.template);
for (const [selector, text] of Object.entries(this._config.content)) {
this._setContent(templateWrapper, text, selector);
}
const template = templateWrapper.children[0];
const extraClass = this._resolvePossibleFunction(this._config.extraClass);
if (extraClass) {
template.classList.add(...extraClass.split(" "));
}
return template;
}
// Private
_typeCheckConfig(config) {
super._typeCheckConfig(config);
this._checkContent(config.content);
}
_checkContent(arg) {
for (const [selector, content] of Object.entries(arg)) {
super._typeCheckConfig({
selector,
entry: content
}, DefaultContentType);
}
}
_setContent(template, content, selector) {
const templateElement = SelectorEngine.findOne(selector, template);
if (!templateElement) {
return;
}
content = this._resolvePossibleFunction(content);
if (!content) {
templateElement.remove();
return;
}
if (isElement2(content)) {
this._putElementInTemplate(getElement(content), templateElement);
return;
}
if (this._config.html) {
templateElement.innerHTML = this._maybeSanitize(content);
return;
}
templateElement.textContent = content;
}
_maybeSanitize(arg) {
return this._config.sanitize ? sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg;
}
_resolvePossibleFunction(arg) {
return execute(arg, [this]);
}
_putElementInTemplate(element, templateElement) {
if (this._config.html) {
templateElement.innerHTML = "";
templateElement.append(element);
return;
}
templateElement.textContent = element.textContent;
}
};
var NAME$4 = "tooltip";
var DISALLOWED_ATTRIBUTES = /* @__PURE__ */ new Set(["sanitize", "allowList", "sanitizeFn"]);
var CLASS_NAME_FADE$2 = "fade";
var CLASS_NAME_MODAL = "modal";
var CLASS_NAME_SHOW$2 = "show";
var SELECTOR_TOOLTIP_INNER = ".tooltip-inner";
var SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
var EVENT_MODAL_HIDE = "hide.bs.modal";
var TRIGGER_HOVER = "hover";
var TRIGGER_FOCUS = "focus";
var TRIGGER_CLICK = "click";
var TRIGGER_MANUAL = "manual";
var EVENT_HIDE$2 = "hide";
var EVENT_HIDDEN$2 = "hidden";
var EVENT_SHOW$2 = "show";
var EVENT_SHOWN$2 = "shown";
var EVENT_INSERTED = "inserted";
var EVENT_CLICK$1 = "click";
var EVENT_FOCUSIN$1 = "focusin";
var EVENT_FOCUSOUT$1 = "focusout";
var EVENT_MOUSEENTER = "mouseenter";
var EVENT_MOUSELEAVE = "mouseleave";
var AttachmentMap = {
AUTO: "auto",
TOP: "top",
RIGHT: isRTL() ? "left" : "right",
BOTTOM: "bottom",
LEFT: isRTL() ? "right" : "left"
};
var Default$3 = {
allowList: DefaultAllowlist,
animation: true,
boundary: "clippingParents",
container: false,
customClass: "",
delay: 0,
fallbackPlacements: ["top", "right", "bottom", "left"],
html: false,
offset: [0, 6],
placement: "top",
popperConfig: null,
sanitize: true,
sanitizeFn: null,
selector: false,
template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
title: "",
trigger: "hover focus"
};
var DefaultType$3 = {
allowList: "object",
animation: "boolean",
boundary: "(string|element)",
container: "(string|element|boolean)",
customClass: "(string|function)",
delay: "(number|object)",
fallbackPlacements: "array",
html: "boolean",
offset: "(array|string|function)",
placement: "(string|function)",
popperConfig: "(null|object|function)",
sanitize: "boolean",
sanitizeFn: "(null|function)",
selector: "(string|boolean)",
template: "string",
title: "(string|element|function)",
trigger: "string"
};
var Tooltip = class _Tooltip extends BaseComponent {
constructor(element, config) {
if (typeof lib_exports === "undefined") {
throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");
}
super(element, config);
this._isEnabled = true;
this._timeout = 0;
this._isHovered = null;
this._activeTrigger = {};
this._popper = null;
this._templateFactory = null;
this._newContent = null;
this.tip = null;
this._setListeners();
if (!this._config.selector) {
this._fixTitle();
}
}
// Getters
static get Default() {
return Default$3;
}
static get DefaultType() {
return DefaultType$3;
}
static get NAME() {
return NAME$4;
}
// Public
enable() {
this._isEnabled = true;
}
disable() {
this._isEnabled = false;
}
toggleEnabled() {
this._isEnabled = !this._isEnabled;
}
toggle() {
if (!this._isEnabled) {
return;
}
this._activeTrigger.click = !this._activeTrigger.click;
if (this._isShown()) {
this._leave();
return;
}
this._enter();
}
dispose() {
clearTimeout(this._timeout);
EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
if (this._element.getAttribute("data-bs-original-title")) {
this._element.setAttribute("title", this._element.getAttribute("data-bs-original-title"));
}
this._disposePopper();
super.dispose();
}
show() {
if (this._element.style.display === "none") {
throw new Error("Please use show on visible elements");
}
if (!(this._isWithContent() && this._isEnabled)) {
return;
}
const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW$2));
const shadowRoot = findShadowRoot(this._element);
const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element);
if (showEvent.defaultPrevented || !isInTheDom) {
return;
}
this._disposePopper();
const tip = this._getTipElement();
this._element.setAttribute("aria-describedby", tip.getAttribute("id"));
const {
container
} = this._config;
if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
container.append(tip);
EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED));
}
this._popper = this._createPopper(tip);
tip.classList.add(CLASS_NAME_SHOW$2);
if ("ontouchstart" in document.documentElement) {
for (const element of [].concat(...document.body.children)) {
EventHandler.on(element, "mouseover", noop);
}
}
const complete = () => {
EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN$2));
if (this._isHovered === false) {
this._leave();
}
this._isHovered = false;
};
this._queueCallback(complete, this.tip, this._isAnimated());
}
hide() {
if (!this._isShown()) {
return;
}
const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE$2));
if (hideEvent.defaultPrevented) {
return;
}
const tip = this._getTipElement();
tip.classList.remove(CLASS_NAME_SHOW$2);
if ("ontouchstart" in document.documentElement) {
for (const element of [].concat(...document.body.children)) {
EventHandler.off(element, "mouseover", noop);
}
}
this._activeTrigger[TRIGGER_CLICK] = false;
this._activeTrigger[TRIGGER_FOCUS] = false;
this._activeTrigger[TRIGGER_HOVER] = false;
this._isHovered = null;
const complete = () => {
if (this._isWithActiveTrigger()) {
return;
}
if (!this._isHovered) {
this._disposePopper();
}
this._element.removeAttribute("aria-describedby");
EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN$2));
};
this._queueCallback(complete, this.tip, this._isAnimated());
}
update() {
if (this._popper) {
this._popper.update();
}
}
// Protected
_isWithContent() {
return Boolean(this._getTitle());
}
_getTipElement() {
if (!this.tip) {
this.tip = this._createTipElement(this._newContent || this._getContentForTemplate());
}
return this.tip;
}
_createTipElement(content) {
const tip = this._getTemplateFactory(content).toHtml();
if (!tip) {
return null;
}
tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
tip.classList.add(`bs-${this.constructor.NAME}-auto`);
const tipId = getUID(this.constructor.NAME).toString();
tip.setAttribute("id", tipId);
if (this._isAnimated()) {
tip.classList.add(CLASS_NAME_FADE$2);
}
return tip;
}
setContent(content) {
this._newContent = content;
if (this._isShown()) {
this._disposePopper();
this.show();
}
}
_getTemplateFactory(content) {
if (this._templateFactory) {
this._templateFactory.changeContent(content);
} else {
this._templateFactory = new TemplateFactory(__spreadProps(__spreadValues({}, this._config), {
// the `content` var has to be after `this._config`
// to override config.content in case of popover
content,
extraClass: this._resolvePossibleFunction(this._config.customClass)
}));
}
return this._templateFactory;
}
_getContentForTemplate() {
return {
[SELECTOR_TOOLTIP_INNER]: this._getTitle()
};
}
_getTitle() {
return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute("data-bs-original-title");
}
// Private
_initializeOnDelegatedTarget(event) {
return this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
}
_isAnimated() {
return this._config.animation || this.tip && this.tip.classList.contains(CLASS_NAME_FADE$2);
}
_isShown() {
return this.tip && this.tip.classList.contains(CLASS_NAME_SHOW$2);
}
_createPopper(tip) {
const placement = execute(this._config.placement, [this, tip, this._element]);
const attachment = AttachmentMap[placement.toUpperCase()];
return createPopper3(this._element, tip, this._getPopperConfig(attachment));
}
_getOffset() {
const {
offset: offset2
} = this._config;
if (typeof offset2 === "string") {
return offset2.split(",").map((value) => Number.parseInt(value, 10));
}
if (typeof offset2 === "function") {
return (popperData) => offset2(popperData, this._element);
}
return offset2;
}
_resolvePossibleFunction(arg) {
return execute(arg, [this._element]);
}
_getPopperConfig(attachment) {
const defaultBsPopperConfig = {
placement: attachment,
modifiers: [{
name: "flip",
options: {
fallbackPlacements: this._config.fallbackPlacements
}
}, {
name: "offset",
options: {
offset: this._getOffset()
}
}, {
name: "preventOverflow",
options: {
boundary: this._config.boundary
}
}, {
name: "arrow",
options: {
element: `.${this.constructor.NAME}-arrow`
}
}, {
name: "preSetPlacement",
enabled: true,
phase: "beforeMain",
fn: (data) => {
this._getTipElement().setAttribute("data-popper-placement", data.state.placement);
}
}]
};
return __spreadValues(__spreadValues({}, defaultBsPopperConfig), execute(this._config.popperConfig, [defaultBsPopperConfig]));
}
_setListeners() {
const triggers = this._config.trigger.split(" ");
for (const trigger of triggers) {
if (trigger === "click") {
EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK$1), this._config.selector, (event) => {
const context = this._initializeOnDelegatedTarget(event);
context.toggle();
});
} else if (trigger !== TRIGGER_MANUAL) {
const eventIn = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSEENTER) : this.constructor.eventName(EVENT_FOCUSIN$1);
const eventOut = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSELEAVE) : this.constructor.eventName(EVENT_FOCUSOUT$1);
EventHandler.on(this._element, eventIn, this._config.selector, (event) => {
const context = this._initializeOnDelegatedTarget(event);
context._activeTrigger[event.type === "focusin" ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
context._enter();
});
EventHandler.on(this._element, eventOut, this._config.selector, (event) => {
const context = this._initializeOnDelegatedTarget(event);
context._activeTrigger[event.type === "focusout" ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget);
context._leave();
});
}
}
this._hideModalHandler = () => {
if (this._element) {
this.hide();
}
};
EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
}
_fixTitle() {
const title = this._element.getAttribute("title");
if (!title) {
return;
}
if (!this._element.getAttribute("aria-label") && !this._element.textContent.trim()) {
this._element.setAttribute("aria-label", title);
}
this._element.setAttribute("data-bs-original-title", title);
this._element.removeAttribute("title");
}
_enter() {
if (this._isShown() || this._isHovered) {
this._isHovered = true;
return;
}
this._isHovered = true;
this._setTimeout(() => {
if (this._isHovered) {
this.show();
}
}, this._config.delay.show);
}
_leave() {
if (this._isWithActiveTrigger()) {
return;
}
this._isHovered = false;
this._setTimeout(() => {
if (!this._isHovered) {
this.hide();
}
}, this._config.delay.hide);
}
_setTimeout(handler, timeout) {
clearTimeout(this._timeout);
this._timeout = setTimeout(handler, timeout);
}
_isWithActiveTrigger() {
return Object.values(this._activeTrigger).includes(true);
}
_getConfig(config) {
const dataAttributes = Manipulator.getDataAttributes(this._element);
for (const dataAttribute of Object.keys(dataAttributes)) {
if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) {
delete dataAttributes[dataAttribute];
}
}
config = __spreadValues(__spreadValues({}, dataAttributes), typeof config === "object" && config ? config : {});
config = this._mergeConfigObj(config);
config = this._configAfterMerge(config);
this._typeCheckConfig(config);
return config;
}
_configAfterMerge(config) {
config.container = config.container === false ? document.body : getElement(config.container);
if (typeof config.delay === "number") {
config.delay = {
show: config.delay,
hide: config.delay
};
}
if (typeof config.title === "number") {
config.title = config.title.toString();
}
if (typeof config.content === "number") {
config.content = config.content.toString();
}
return config;
}
_getDelegateConfig() {
const config = {};
for (const [key, value] of Object.entries(this._config)) {
if (this.constructor.Default[key] !== value) {
config[key] = value;
}
}
config.selector = false;
config.trigger = "manual";
return config;
}
_disposePopper() {
if (this._popper) {
this._popper.destroy();
this._popper = null;
}
if (this.tip) {
this.tip.remove();
this.tip = null;
}
}
// Static
static jQueryInterface(config) {
return this.each(function() {
const data = _Tooltip.getOrCreateInstance(this, config);
if (typeof config !== "string") {
return;
}
if (typeof data[config] === "undefined") {
throw new TypeError(`No method named "${config}"`);
}
data[config]();
});
}
};
defineJQueryPlugin(Tooltip);
var NAME$3 = "popover";
var SELECTOR_TITLE = ".popover-header";
var SELECTOR_CONTENT = ".popover-body";
var Default$2 = __spreadProps(__spreadValues({}, Tooltip.Default), {
content: "",
offset: [0, 8],
placement: "right",
template: '<div class="popover" role="tooltip"><div class="popover-arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>',
trigger: "click"
});
var DefaultType$2 = __spreadProps(__spreadValues({}, Tooltip.DefaultType), {
content: "(null|string|element|function)"
});
var Popover = class _Popover extends Tooltip {
// Getters
static get Default() {
return Default$2;
}
static get DefaultType() {
return DefaultType$2;
}
static get NAME() {
return NAME$3;
}
// Overrides
_isWithContent() {
return this._getTitle() || this._getContent();
}
// Private
_getContentForTemplate() {
return {
[SELECTOR_TITLE]: this._getTitle(),
[SELECTOR_CONTENT]: this._getContent()
};
}
_getContent() {
return this._resolvePossibleFunction(this._config.content);
}
// Static
static jQueryInterface(config) {
return this.each(function() {
const data = _Popover.getOrCreateInstance(this, config);
if (typeof config !== "string") {
return;
}
if (typeof data[config] === "undefined") {
throw new TypeError(`No method named "${config}"`);
}
data[config]();
});
}
};
defineJQueryPlugin(Popover);
var NAME$2 = "scrollspy";
var DATA_KEY$2 = "bs.scrollspy";
var EVENT_KEY$2 = `.${DATA_KEY$2}`;
var DATA_API_KEY = ".data-api";
var EVENT_ACTIVATE = `activate${EVENT_KEY$2}`;
var EVENT_CLICK = `click${EVENT_KEY$2}`;
var EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$2}${DATA_API_KEY}`;
var CLASS_NAME_DROPDOWN_ITEM = "dropdown-item";
var CLASS_NAME_ACTIVE$1 = "active";
var SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
var SELECTOR_TARGET_LINKS = "[href]";
var SELECTOR_NAV_LIST_GROUP = ".nav, .list-group";
var SELECTOR_NAV_LINKS = ".nav-link";
var SELECTOR_NAV_ITEMS = ".nav-item";
var SELECTOR_LIST_ITEMS = ".list-group-item";
var SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`;
var SELECTOR_DROPDOWN = ".dropdown";
var SELECTOR_DROPDOWN_TOGGLE$1 = ".dropdown-toggle";
var Default$1 = {
offset: null,
// TODO: v6 @deprecated, keep it for backwards compatibility reasons
rootMargin: "0px 0px -25%",
smoothScroll: false,
target: null,
threshold: [0.1, 0.5, 1]
};
var DefaultType$1 = {
offset: "(number|null)",
// TODO v6 @deprecated, keep it for backwards compatibility reasons
rootMargin: "string",
smoothScroll: "boolean",
target: "element",
threshold: "array"
};
var ScrollSpy = class _ScrollSpy extends BaseComponent {
constructor(element, config) {
super(element, config);
this._targetLinks = /* @__PURE__ */ new Map();
this._observableSections = /* @__PURE__ */ new Map();
this._rootElement = getComputedStyle(this._element).overflowY === "visible" ? null : this._element;
this._activeTarget = null;
this._observer = null;
this._previousScrollData = {
visibleEntryTop: 0,
parentScrollTop: 0
};
this.refresh();
}
// Getters
static get Default() {
return Default$1;
}
static get DefaultType() {
return DefaultType$1;
}
static get NAME() {
return NAME$2;
}
// Public
refresh() {
this._initializeTargetsAndObservables();
this._maybeEnableSmoothScroll();
if (this._observer) {
this._observer.disconnect();
} else {
this._observer = this._getNewObserver();
}
for (const section of this._observableSections.values()) {
this._observer.observe(section);
}
}
dispose() {
this._observer.disconnect();
super.dispose();
}
// Private
_configAfterMerge(config) {
config.target = getElement(config.target) || document.body;
config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin;
if (typeof config.threshold === "string") {
config.threshold = config.threshold.split(",").map((value) => Number.parseFloat(value));
}
return config;
}
_maybeEnableSmoothScroll() {
if (!this._config.smoothScroll) {
return;
}
EventHandler.off(this._config.target, EVENT_CLICK);
EventHandler.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, (event) => {
const observableSection = this._observableSections.get(event.target.hash);
if (observableSection) {
event.preventDefault();
const root = this._rootElement || window;
const height = observableSection.offsetTop - this._element.offsetTop;
if (root.scrollTo) {
root.scrollTo({
top: height,
behavior: "smooth"
});
return;
}
root.scrollTop = height;
}
});
}
_getNewObserver() {
const options = {
root: this._rootElement,
threshold: this._config.threshold,
rootMargin: this._config.rootMargin
};
return new IntersectionObserver((entries) => this._observerCallback(entries), options);
}
// The logic of selection
_observerCallback(entries) {
const targetElement = (entry) => this._targetLinks.get(`#${entry.target.id}`);
const activate = (entry) => {
this._previousScrollData.visibleEntryTop = entry.target.offsetTop;
this._process(targetElement(entry));
};
const parentScrollTop = (this._rootElement || document.documentElement).scrollTop;
const userScrollsDown = parentScrollTop >= this._previousScrollData.parentScrollTop;
this._previousScrollData.parentScrollTop = parentScrollTop;
for (const entry of entries) {
if (!entry.isIntersecting) {
this._activeTarget = null;
this._clearActiveClass(targetElement(entry));
continue;
}
const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop;
if (userScrollsDown && entryIsLowerThanPrevious) {
activate(entry);
if (!parentScrollTop) {
return;
}
continue;
}
if (!userScrollsDown && !entryIsLowerThanPrevious) {
activate(entry);
}
}
}
_initializeTargetsAndObservables() {
this._targetLinks = /* @__PURE__ */ new Map();
this._observableSections = /* @__PURE__ */ new Map();
const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target);
for (const anchor of targetLinks) {
if (!anchor.hash || isDisabled(anchor)) {
continue;
}
const observableSection = SelectorEngine.findOne(decodeURI(anchor.hash), this._element);
if (isVisible(observableSection)) {
this._targetLinks.set(decodeURI(anchor.hash), anchor);
this._observableSections.set(anchor.hash, observableSection);
}
}
}
_process(target) {
if (this._activeTarget === target) {
return;
}
this._clearActiveClass(this._config.target);
this._activeTarget = target;
target.classList.add(CLASS_NAME_ACTIVE$1);
this._activateParents(target);
EventHandler.trigger(this._element, EVENT_ACTIVATE, {
relatedTarget: target
});
}
_activateParents(target) {
if (target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$1);
return;
}
for (const listGroup of SelectorEngine.parents(target, SELECTOR_NAV_LIST_GROUP)) {
for (const item of SelectorEngine.prev(listGroup, SELECTOR_LINK_ITEMS)) {
item.classList.add(CLASS_NAME_ACTIVE$1);
}
}
}
_clearActiveClass(parent) {
parent.classList.remove(CLASS_NAME_ACTIVE$1);
const activeNodes = SelectorEngine.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE$1}`, parent);
for (const node of activeNodes) {
node.classList.remove(CLASS_NAME_ACTIVE$1);
}
}
// Static
static jQueryInterface(config) {
return this.each(function() {
const data = _ScrollSpy.getOrCreateInstance(this, config);
if (typeof config !== "string") {
return;
}
if (data[config] === void 0 || config.startsWith("_") || config === "constructor") {
throw new TypeError(`No method named "${config}"`);
}
data[config]();
});
}
};
EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => {
for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) {
ScrollSpy.getOrCreateInstance(spy);
}
});
defineJQueryPlugin(ScrollSpy);
var NAME$1 = "tab";
var DATA_KEY$1 = "bs.tab";
var EVENT_KEY$1 = `.${DATA_KEY$1}`;
var EVENT_HIDE$1 = `hide${EVENT_KEY$1}`;
var EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`;
var EVENT_SHOW$1 = `show${EVENT_KEY$1}`;
var EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`;
var EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}`;
var EVENT_KEYDOWN = `keydown${EVENT_KEY$1}`;
var EVENT_LOAD_DATA_API = `load${EVENT_KEY$1}`;
var ARROW_LEFT_KEY = "ArrowLeft";
var ARROW_RIGHT_KEY = "ArrowRight";
var ARROW_UP_KEY = "ArrowUp";
var ARROW_DOWN_KEY = "ArrowDown";
var HOME_KEY = "Home";
var END_KEY = "End";
var CLASS_NAME_ACTIVE = "active";
var CLASS_NAME_FADE$1 = "fade";
var CLASS_NAME_SHOW$1 = "show";
var CLASS_DROPDOWN = "dropdown";
var SELECTOR_DROPDOWN_TOGGLE = ".dropdown-toggle";
var SELECTOR_DROPDOWN_MENU = ".dropdown-menu";
var NOT_SELECTOR_DROPDOWN_TOGGLE = `:not(${SELECTOR_DROPDOWN_TOGGLE})`;
var SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]';
var SELECTOR_OUTER = ".nav-item, .list-group-item";
var SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`;
var SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]';
var SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`;
var SELECTOR_DATA_TOGGLE_ACTIVE = `.${CLASS_NAME_ACTIVE}[data-bs-toggle="tab"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="pill"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="list"]`;
var Tab = class _Tab extends BaseComponent {
constructor(element) {
super(element);
this._parent = this._element.closest(SELECTOR_TAB_PANEL);
if (!this._parent) {
return;
}
this._setInitialAttributes(this._parent, this._getChildren());
EventHandler.on(this._element, EVENT_KEYDOWN, (event) => this._keydown(event));
}
// Getters
static get NAME() {
return NAME$1;
}
// Public
show() {
const innerElem = this._element;
if (this._elemIsActive(innerElem)) {
return;
}
const active = this._getActiveElem();
const hideEvent = active ? EventHandler.trigger(active, EVENT_HIDE$1, {
relatedTarget: innerElem
}) : null;
const showEvent = EventHandler.trigger(innerElem, EVENT_SHOW$1, {
relatedTarget: active
});
if (showEvent.defaultPrevented || hideEvent && hideEvent.defaultPrevented) {
return;
}
this._deactivate(active, innerElem);
this._activate(innerElem, active);
}
// Private
_activate(element, relatedElem) {
if (!element) {
return;
}
element.classList.add(CLASS_NAME_ACTIVE);
this._activate(SelectorEngine.getElementFromSelector(element));
const complete = () => {
if (element.getAttribute("role") !== "tab") {
element.classList.add(CLASS_NAME_SHOW$1);
return;
}
element.removeAttribute("tabindex");
element.setAttribute("aria-selected", true);
this._toggleDropDown(element, true);
EventHandler.trigger(element, EVENT_SHOWN$1, {
relatedTarget: relatedElem
});
};
this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
}
_deactivate(element, relatedElem) {
if (!element) {
return;
}
element.classList.remove(CLASS_NAME_ACTIVE);
element.blur();
this._deactivate(SelectorEngine.getElementFromSelector(element));
const complete = () => {
if (element.getAttribute("role") !== "tab") {
element.classList.remove(CLASS_NAME_SHOW$1);
return;
}
element.setAttribute("aria-selected", false);
element.setAttribute("tabindex", "-1");
this._toggleDropDown(element, false);
EventHandler.trigger(element, EVENT_HIDDEN$1, {
relatedTarget: relatedElem
});
};
this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
}
_keydown(event) {
if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY, HOME_KEY, END_KEY].includes(event.key)) {
return;
}
event.stopPropagation();
event.preventDefault();
const children = this._getChildren().filter((element) => !isDisabled(element));
let nextActiveElement;
if ([HOME_KEY, END_KEY].includes(event.key)) {
nextActiveElement = children[event.key === HOME_KEY ? 0 : children.length - 1];
} else {
const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key);
nextActiveElement = getNextActiveElement(children, event.target, isNext, true);
}
if (nextActiveElement) {
nextActiveElement.focus({
preventScroll: true
});
_Tab.getOrCreateInstance(nextActiveElement).show();
}
}
_getChildren() {
return SelectorEngine.find(SELECTOR_INNER_ELEM, this._parent);
}
_getActiveElem() {
return this._getChildren().find((child) => this._elemIsActive(child)) || null;
}
_setInitialAttributes(parent, children) {
this._setAttributeIfNotExists(parent, "role", "tablist");
for (const child of children) {
this._setInitialAttributesOnChild(child);
}
}
_setInitialAttributesOnChild(child) {
child = this._getInnerElement(child);
const isActive = this._elemIsActive(child);
const outerElem = this._getOuterElement(child);
child.setAttribute("aria-selected", isActive);
if (outerElem !== child) {
this._setAttributeIfNotExists(outerElem, "role", "presentation");
}
if (!isActive) {
child.setAttribute("tabindex", "-1");
}
this._setAttributeIfNotExists(child, "role", "tab");
this._setInitialAttributesOnTargetPanel(child);
}
_setInitialAttributesOnTargetPanel(child) {
const target = SelectorEngine.getElementFromSelector(child);
if (!target) {
return;
}
this._setAttributeIfNotExists(target, "role", "tabpanel");
if (child.id) {
this._setAttributeIfNotExists(target, "aria-labelledby", `${child.id}`);
}
}
_toggleDropDown(element, open) {
const outerElem = this._getOuterElement(element);
if (!outerElem.classList.contains(CLASS_DROPDOWN)) {
return;
}
const toggle = (selector, className) => {
const element2 = SelectorEngine.findOne(selector, outerElem);
if (element2) {
element2.classList.toggle(className, open);
}
};
toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE);
toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW$1);
outerElem.setAttribute("aria-expanded", open);
}
_setAttributeIfNotExists(element, attribute, value) {
if (!element.hasAttribute(attribute)) {
element.setAttribute(attribute, value);
}
}
_elemIsActive(elem) {
return elem.classList.contains(CLASS_NAME_ACTIVE);
}
// Try to get the inner element (usually the .nav-link)
_getInnerElement(elem) {
return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine.findOne(SELECTOR_INNER_ELEM, elem);
}
// Try to get the outer element (usually the .nav-item)
_getOuterElement(elem) {
return elem.closest(SELECTOR_OUTER) || elem;
}
// Static
static jQueryInterface(config) {
return this.each(function() {
const data = _Tab.getOrCreateInstance(this);
if (typeof config !== "string") {
return;
}
if (data[config] === void 0 || config.startsWith("_") || config === "constructor") {
throw new TypeError(`No method named "${config}"`);
}
data[config]();
});
}
};
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function(event) {
if (["A", "AREA"].includes(this.tagName)) {
event.preventDefault();
}
if (isDisabled(this)) {
return;
}
Tab.getOrCreateInstance(this).show();
});
EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)) {
Tab.getOrCreateInstance(element);
}
});
defineJQueryPlugin(Tab);
var NAME = "toast";
var DATA_KEY = "bs.toast";
var EVENT_KEY = `.${DATA_KEY}`;
var EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
var EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
var EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
var EVENT_FOCUSOUT = `focusout${EVENT_KEY}`;
var EVENT_HIDE = `hide${EVENT_KEY}`;
var EVENT_HIDDEN = `hidden${EVENT_KEY}`;
var EVENT_SHOW = `show${EVENT_KEY}`;
var EVENT_SHOWN = `shown${EVENT_KEY}`;
var CLASS_NAME_FADE = "fade";
var CLASS_NAME_HIDE = "hide";
var CLASS_NAME_SHOW = "show";
var CLASS_NAME_SHOWING = "showing";
var DefaultType = {
animation: "boolean",
autohide: "boolean",
delay: "number"
};
var Default = {
animation: true,
autohide: true,
delay: 5e3
};
var Toast = class _Toast extends BaseComponent {
constructor(element, config) {
super(element, config);
this._timeout = null;
this._hasMouseInteraction = false;
this._hasKeyboardInteraction = false;
this._setListeners();
}
// Getters
static get Default() {
return Default;
}
static get DefaultType() {
return DefaultType;
}
static get NAME() {
return NAME;
}
// Public
show() {
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW);
if (showEvent.defaultPrevented) {
return;
}
this._clearTimeout();
if (this._config.animation) {
this._element.classList.add(CLASS_NAME_FADE);
}
const complete = () => {
this._element.classList.remove(CLASS_NAME_SHOWING);
EventHandler.trigger(this._element, EVENT_SHOWN);
this._maybeScheduleHide();
};
this._element.classList.remove(CLASS_NAME_HIDE);
reflow(this._element);
this._element.classList.add(CLASS_NAME_SHOW, CLASS_NAME_SHOWING);
this._queueCallback(complete, this._element, this._config.animation);
}
hide() {
if (!this.isShown()) {
return;
}
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
if (hideEvent.defaultPrevented) {
return;
}
const complete = () => {
this._element.classList.add(CLASS_NAME_HIDE);
this._element.classList.remove(CLASS_NAME_SHOWING, CLASS_NAME_SHOW);
EventHandler.trigger(this._element, EVENT_HIDDEN);
};
this._element.classList.add(CLASS_NAME_SHOWING);
this._queueCallback(complete, this._element, this._config.animation);
}
dispose() {
this._clearTimeout();
if (this.isShown()) {
this._element.classList.remove(CLASS_NAME_SHOW);
}
super.dispose();
}
isShown() {
return this._element.classList.contains(CLASS_NAME_SHOW);
}
// Private
_maybeScheduleHide() {
if (!this._config.autohide) {
return;
}
if (this._hasMouseInteraction || this._hasKeyboardInteraction) {
return;
}
this._timeout = setTimeout(() => {
this.hide();
}, this._config.delay);
}
_onInteraction(event, isInteracting) {
switch (event.type) {
case "mouseover":
case "mouseout": {
this._hasMouseInteraction = isInteracting;
break;
}
case "focusin":
case "focusout": {
this._hasKeyboardInteraction = isInteracting;
break;
}
}
if (isInteracting) {
this._clearTimeout();
return;
}
const nextElement = event.relatedTarget;
if (this._element === nextElement || this._element.contains(nextElement)) {
return;
}
this._maybeScheduleHide();
}
_setListeners() {
EventHandler.on(this._element, EVENT_MOUSEOVER, (event) => this._onInteraction(event, true));
EventHandler.on(this._element, EVENT_MOUSEOUT, (event) => this._onInteraction(event, false));
EventHandler.on(this._element, EVENT_FOCUSIN, (event) => this._onInteraction(event, true));
EventHandler.on(this._element, EVENT_FOCUSOUT, (event) => this._onInteraction(event, false));
}
_clearTimeout() {
clearTimeout(this._timeout);
this._timeout = null;
}
// Static
static jQueryInterface(config) {
return this.each(function() {
const data = _Toast.getOrCreateInstance(this, config);
if (typeof config === "string") {
if (typeof data[config] === "undefined") {
throw new TypeError(`No method named "${config}"`);
}
data[config](this);
}
});
}
};
enableDismissTrigger(Toast);
defineJQueryPlugin(Toast);
// js/app.js
var import_prism = __toESM(require_prism());
// js/repository.js
var import_jquery = __toESM(require_jquery());
(0, import_jquery.default)(function() {
(0, import_jquery.default)("select.tree").change(function() {
document.location = this.value;
});
});
// js/kmx_anim.js
var import_jquery2 = __toESM(require_jquery());
// js/kmx_colors.js
var kmx_colors = {
"kmx-black": "#1e1f1d",
"kmx-blue": "#5a60f9",
"kmx-blue1": "#6f72f9",
"kmx-blue2": "#9c99fd",
"kmx-blue3": "#5a60f9",
"kmx-blue4": "#6f72f9",
"kmx-blue5": "#9c99fd",
"index": [
"kmx-black",
"kmx-blue",
"kmx-blue1",
"kmx-blue2",
"kmx-blue3",
"kmx-blue4",
"kmx-blue5",
"kmx-cyan",
"kmx-cyan1",
"kmx-green",
"kmx-green1",
"kmx-orange",
"kmx-orange1",
"kmx-orange2",
"kmx-pink",
"kmx-white",
"kmx-white1",
"kmx-white2",
"kmx-yellow",
"kmx-yellow1",
"kmx-yellow2",
"kmx-yellow3"
],
"kmx-cyan": "#d4f3f6",
"kmx-cyan1": "#d4f3f6",
"kmx-green": "#c4ed3a",
"kmx-green1": "#c4ed3a",
"kmx-orange": "#f8681c",
"kmx-orange1": "#fa7734",
"kmx-orange2": "#ffa532",
"kmx-pink": "#fc9ef9",
"kmx-white": "#f5f8f4",
"kmx-white1": "#fff9f2",
"kmx-white2": "#ffffff",
"kmx-yellow": "#ecfe49",
"kmx-yellow1": "#fff43e",
"kmx-yellow2": "#ecfe49",
"kmx-yellow3": "#fff43e"
};
var kmx_colors_default = kmx_colors;
// js/kmx_anim.js
function getRandomInt(max2) {
return Math.floor(Math.random() * max2);
}
(0, import_jquery2.default)(function() {
setInterval(function() {
const i = getRandomInt(kmx_colors_default.index.length);
const name = kmx_colors_default.index[i];
const color = kmx_colors_default[name];
const x = (getRandomInt(99) - 48) * 2e-3;
(0, import_jquery2.default)("a").css("text-shadow", "0 0 0");
(0, import_jquery2.default)("a:hover").css("text-shadow", x + "em 0 0 " + color);
}, 200);
});
// ../deps/phoenix_html/priv/static/phoenix_html.js
(function() {
var PolyfillEvent = eventConstructor();
function eventConstructor() {
if (typeof window.CustomEvent === "function")
return window.CustomEvent;
function CustomEvent2(event, params) {
params = params || { bubbles: false, cancelable: false, detail: void 0 };
var evt = document.createEvent("CustomEvent");
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
return evt;
}
CustomEvent2.prototype = window.Event.prototype;
return CustomEvent2;
}
function buildHiddenInput(name, value) {
var input = document.createElement("input");
input.type = "hidden";
input.name = name;
input.value = value;
return input;
}
function handleClick(element, targetModifierKey) {
var to = element.getAttribute("data-to"), method = buildHiddenInput("_method", element.getAttribute("data-method")), csrf = buildHiddenInput("_csrf_token", element.getAttribute("data-csrf")), form = document.createElement("form"), submit = document.createElement("input"), target = element.getAttribute("target");
form.method = element.getAttribute("data-method") === "get" ? "get" : "post";
form.action = to;
form.style.display = "none";
if (target)
form.target = target;
else if (targetModifierKey)
form.target = "_blank";
form.appendChild(csrf);
form.appendChild(method);
document.body.appendChild(form);
submit.type = "submit";
form.appendChild(submit);
submit.click();
}
window.addEventListener("click", function(e) {
var element = e.target;
if (e.defaultPrevented)
return;
while (element && element.getAttribute) {
var phoenixLinkEvent = new PolyfillEvent("phoenix.link.click", {
"bubbles": true,
"cancelable": true
});
if (!element.dispatchEvent(phoenixLinkEvent)) {
e.preventDefault();
e.stopImmediatePropagation();
return false;
}
if (element.getAttribute("data-method")) {
handleClick(element, e.metaKey || e.shiftKey);
e.preventDefault();
return false;
} else {
element = element.parentNode;
}
}
}, false);
window.addEventListener("phoenix.link.click", function(e) {
var message = e.target.getAttribute("data-confirm");
if (message && !window.confirm(message)) {
e.preventDefault();
}
}, false);
})();
// ../deps/phoenix/priv/static/phoenix.mjs
var closure = (value) => {
if (typeof value === "function") {
return value;
} else {
let closure22 = function() {
return value;
};
return closure22;
}
};
var globalSelf = typeof self !== "undefined" ? self : null;
var phxWindow = typeof window !== "undefined" ? window : null;
var global2 = globalSelf || phxWindow || global2;
var DEFAULT_VSN = "2.0.0";
var SOCKET_STATES = { connecting: 0, open: 1, closing: 2, closed: 3 };
var DEFAULT_TIMEOUT = 1e4;
var WS_CLOSE_NORMAL = 1e3;
var CHANNEL_STATES = {
closed: "closed",
errored: "errored",
joined: "joined",
joining: "joining",
leaving: "leaving"
};
var CHANNEL_EVENTS = {
close: "phx_close",
error: "phx_error",
join: "phx_join",
reply: "phx_reply",
leave: "phx_leave"
};
var TRANSPORTS = {
longpoll: "longpoll",
websocket: "websocket"
};
var XHR_STATES = {
complete: 4
};
var Push = class {
constructor(channel, event, payload, timeout) {
this.channel = channel;
this.event = event;
this.payload = payload || function() {
return {};
};
this.receivedResp = null;
this.timeout = timeout;
this.timeoutTimer = null;
this.recHooks = [];
this.sent = false;
}
resend(timeout) {
this.timeout = timeout;
this.reset();
this.send();
}
send() {
if (this.hasReceived("timeout")) {
return;
}
this.startTimeout();
this.sent = true;
this.channel.socket.push({
topic: this.channel.topic,
event: this.event,
payload: this.payload(),
ref: this.ref,
join_ref: this.channel.joinRef()
});
}
receive(status, callback) {
if (this.hasReceived(status)) {
callback(this.receivedResp.response);
}
this.recHooks.push({ status, callback });
return this;
}
reset() {
this.cancelRefEvent();
this.ref = null;
this.refEvent = null;
this.receivedResp = null;
this.sent = false;
}
matchReceive({ status, response, _ref }) {
this.recHooks.filter((h) => h.status === status).forEach((h) => h.callback(response));
}
cancelRefEvent() {
if (!this.refEvent) {
return;
}
this.channel.off(this.refEvent);
}
cancelTimeout() {
clearTimeout(this.timeoutTimer);
this.timeoutTimer = null;
}
startTimeout() {
if (this.timeoutTimer) {
this.cancelTimeout();
}
this.ref = this.channel.socket.makeRef();
this.refEvent = this.channel.replyEventName(this.ref);
this.channel.on(this.refEvent, (payload) => {
this.cancelRefEvent();
this.cancelTimeout();
this.receivedResp = payload;
this.matchReceive(payload);
});
this.timeoutTimer = setTimeout(() => {
this.trigger("timeout", {});
}, this.timeout);
}
hasReceived(status) {
return this.receivedResp && this.receivedResp.status === status;
}
trigger(status, response) {
this.channel.trigger(this.refEvent, { status, response });
}
};
var Timer = class {
constructor(callback, timerCalc) {
this.callback = callback;
this.timerCalc = timerCalc;
this.timer = null;
this.tries = 0;
}
reset() {
this.tries = 0;
clearTimeout(this.timer);
}
scheduleTimeout() {
clearTimeout(this.timer);
this.timer = setTimeout(() => {
this.tries = this.tries + 1;
this.callback();
}, this.timerCalc(this.tries + 1));
}
};
var Channel = class {
constructor(topic, params, socket) {
this.state = CHANNEL_STATES.closed;
this.topic = topic;
this.params = closure(params || {});
this.socket = socket;
this.bindings = [];
this.bindingRef = 0;
this.timeout = this.socket.timeout;
this.joinedOnce = false;
this.joinPush = new Push(this, CHANNEL_EVENTS.join, this.params, this.timeout);
this.pushBuffer = [];
this.stateChangeRefs = [];
this.rejoinTimer = new Timer(() => {
if (this.socket.isConnected()) {
this.rejoin();
}
}, this.socket.rejoinAfterMs);
this.stateChangeRefs.push(this.socket.onError(() => this.rejoinTimer.reset()));
this.stateChangeRefs.push(this.socket.onOpen(() => {
this.rejoinTimer.reset();
if (this.isErrored()) {
this.rejoin();
}
}));
this.joinPush.receive("ok", () => {
this.state = CHANNEL_STATES.joined;
this.rejoinTimer.reset();
this.pushBuffer.forEach((pushEvent) => pushEvent.send());
this.pushBuffer = [];
});
this.joinPush.receive("error", () => {
this.state = CHANNEL_STATES.errored;
if (this.socket.isConnected()) {
this.rejoinTimer.scheduleTimeout();
}
});
this.onClose(() => {
this.rejoinTimer.reset();
if (this.socket.hasLogger())
this.socket.log("channel", `close ${this.topic} ${this.joinRef()}`);
this.state = CHANNEL_STATES.closed;
this.socket.remove(this);
});
this.onError((reason) => {
if (this.socket.hasLogger())
this.socket.log("channel", `error ${this.topic}`, reason);
if (this.isJoining()) {
this.joinPush.reset();
}
this.state = CHANNEL_STATES.errored;
if (this.socket.isConnected()) {
this.rejoinTimer.scheduleTimeout();
}
});
this.joinPush.receive("timeout", () => {
if (this.socket.hasLogger())
this.socket.log("channel", `timeout ${this.topic} (${this.joinRef()})`, this.joinPush.timeout);
let leavePush = new Push(this, CHANNEL_EVENTS.leave, closure({}), this.timeout);
leavePush.send();
this.state = CHANNEL_STATES.errored;
this.joinPush.reset();
if (this.socket.isConnected()) {
this.rejoinTimer.scheduleTimeout();
}
});
this.on(CHANNEL_EVENTS.reply, (payload, ref) => {
this.trigger(this.replyEventName(ref), payload);
});
}
join(timeout = this.timeout) {
if (this.joinedOnce) {
throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");
} else {
this.timeout = timeout;
this.joinedOnce = true;
this.rejoin();
return this.joinPush;
}
}
onClose(callback) {
this.on(CHANNEL_EVENTS.close, callback);
}
onError(callback) {
return this.on(CHANNEL_EVENTS.error, (reason) => callback(reason));
}
on(event, callback) {
let ref = this.bindingRef++;
this.bindings.push({ event, ref, callback });
return ref;
}
off(event, ref) {
this.bindings = this.bindings.filter((bind) => {
return !(bind.event === event && (typeof ref === "undefined" || ref === bind.ref));
});
}
canPush() {
return this.socket.isConnected() && this.isJoined();
}
push(event, payload, timeout = this.timeout) {
payload = payload || {};
if (!this.joinedOnce) {
throw new Error(`tried to push '${event}' to '${this.topic}' before joining. Use channel.join() before pushing events`);
}
let pushEvent = new Push(this, event, function() {
return payload;
}, timeout);
if (this.canPush()) {
pushEvent.send();
} else {
pushEvent.startTimeout();
this.pushBuffer.push(pushEvent);
}
return pushEvent;
}
leave(timeout = this.timeout) {
this.rejoinTimer.reset();
this.joinPush.cancelTimeout();
this.state = CHANNEL_STATES.leaving;
let onClose = () => {
if (this.socket.hasLogger())
this.socket.log("channel", `leave ${this.topic}`);
this.trigger(CHANNEL_EVENTS.close, "leave");
};
let leavePush = new Push(this, CHANNEL_EVENTS.leave, closure({}), timeout);
leavePush.receive("ok", () => onClose()).receive("timeout", () => onClose());
leavePush.send();
if (!this.canPush()) {
leavePush.trigger("ok", {});
}
return leavePush;
}
onMessage(_event, payload, _ref) {
return payload;
}
isMember(topic, event, payload, joinRef) {
if (this.topic !== topic) {
return false;
}
if (joinRef && joinRef !== this.joinRef()) {
if (this.socket.hasLogger())
this.socket.log("channel", "dropping outdated message", { topic, event, payload, joinRef });
return false;
} else {
return true;
}
}
joinRef() {
return this.joinPush.ref;
}
rejoin(timeout = this.timeout) {
if (this.isLeaving()) {
return;
}
this.socket.leaveOpenTopic(this.topic);
this.state = CHANNEL_STATES.joining;
this.joinPush.resend(timeout);
}
trigger(event, payload, ref, joinRef) {
let handledPayload = this.onMessage(event, payload, ref, joinRef);
if (payload && !handledPayload) {
throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");
}
let eventBindings = this.bindings.filter((bind) => bind.event === event);
for (let i = 0; i < eventBindings.length; i++) {
let bind = eventBindings[i];
bind.callback(handledPayload, ref, joinRef || this.joinRef());
}
}
replyEventName(ref) {
return `chan_reply_${ref}`;
}
isClosed() {
return this.state === CHANNEL_STATES.closed;
}
isErrored() {
return this.state === CHANNEL_STATES.errored;
}
isJoined() {
return this.state === CHANNEL_STATES.joined;
}
isJoining() {
return this.state === CHANNEL_STATES.joining;
}
isLeaving() {
return this.state === CHANNEL_STATES.leaving;
}
};
var Ajax = class {
static request(method, endPoint, accept, body, timeout, ontimeout, callback) {
if (global2.XDomainRequest) {
let req = new global2.XDomainRequest();
return this.xdomainRequest(req, method, endPoint, body, timeout, ontimeout, callback);
} else {
let req = new global2.XMLHttpRequest();
return this.xhrRequest(req, method, endPoint, accept, body, timeout, ontimeout, callback);
}
}
static xdomainRequest(req, method, endPoint, body, timeout, ontimeout, callback) {
req.timeout = timeout;
req.open(method, endPoint);
req.onload = () => {
let response = this.parseJSON(req.responseText);
callback && callback(response);
};
if (ontimeout) {
req.ontimeout = ontimeout;
}
req.onprogress = () => {
};
req.send(body);
return req;
}
static xhrRequest(req, method, endPoint, accept, body, timeout, ontimeout, callback) {
req.open(method, endPoint, true);
req.timeout = timeout;
req.setRequestHeader("Content-Type", accept);
req.onerror = () => callback && callback(null);
req.onreadystatechange = () => {
if (req.readyState === XHR_STATES.complete && callback) {
let response = this.parseJSON(req.responseText);
callback(response);
}
};
if (ontimeout) {
req.ontimeout = ontimeout;
}
req.send(body);
return req;
}
static parseJSON(resp) {
if (!resp || resp === "") {
return null;
}
try {
return JSON.parse(resp);
} catch (e) {
console && console.log("failed to parse JSON response", resp);
return null;
}
}
static serialize(obj, parentKey) {
let queryStr = [];
for (var key in obj) {
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
continue;
}
let paramKey = parentKey ? `${parentKey}[${key}]` : key;
let paramVal = obj[key];
if (typeof paramVal === "object") {
queryStr.push(this.serialize(paramVal, paramKey));
} else {
queryStr.push(encodeURIComponent(paramKey) + "=" + encodeURIComponent(paramVal));
}
}
return queryStr.join("&");
}
static appendParams(url, params) {
if (Object.keys(params).length === 0) {
return url;
}
let prefix = url.match(/\?/) ? "&" : "?";
return `${url}${prefix}${this.serialize(params)}`;
}
};
var LongPoll = class {
constructor(endPoint) {
this.endPoint = null;
this.token = null;
this.skipHeartbeat = true;
this.reqs = /* @__PURE__ */ new Set();
this.onopen = function() {
};
this.onerror = function() {
};
this.onmessage = function() {
};
this.onclose = function() {
};
this.pollEndpoint = this.normalizeEndpoint(endPoint);
this.readyState = SOCKET_STATES.connecting;
this.poll();
}
normalizeEndpoint(endPoint) {
return endPoint.replace("ws://", "http://").replace("wss://", "https://").replace(new RegExp("(.*)/" + TRANSPORTS.websocket), "$1/" + TRANSPORTS.longpoll);
}
endpointURL() {
return Ajax.appendParams(this.pollEndpoint, { token: this.token });
}
closeAndRetry(code, reason, wasClean) {
this.close(code, reason, wasClean);
this.readyState = SOCKET_STATES.connecting;
}
ontimeout() {
this.onerror("timeout");
this.closeAndRetry(1005, "timeout", false);
}
isActive() {
return this.readyState === SOCKET_STATES.open || this.readyState === SOCKET_STATES.connecting;
}
poll() {
this.ajax("GET", null, () => this.ontimeout(), (resp) => {
if (resp) {
var { status, token, messages } = resp;
this.token = token;
} else {
status = 0;
}
switch (status) {
case 200:
messages.forEach((msg) => {
setTimeout(() => this.onmessage({ data: msg }), 0);
});
this.poll();
break;
case 204:
this.poll();
break;
case 410:
this.readyState = SOCKET_STATES.open;
this.onopen({});
this.poll();
break;
case 403:
this.onerror(403);
this.close(1008, "forbidden", false);
break;
case 0:
case 500:
this.onerror(500);
this.closeAndRetry(1011, "internal server error", 500);
break;
default:
throw new Error(`unhandled poll status ${status}`);
}
});
}
send(body) {
this.ajax("POST", body, () => this.onerror("timeout"), (resp) => {
if (!resp || resp.status !== 200) {
this.onerror(resp && resp.status);
this.closeAndRetry(1011, "internal server error", false);
}
});
}
close(code, reason, wasClean) {
for (let req of this.reqs) {
req.abort();
}
this.readyState = SOCKET_STATES.closed;
let opts = Object.assign({ code: 1e3, reason: void 0, wasClean: true }, { code, reason, wasClean });
if (typeof CloseEvent !== "undefined") {
this.onclose(new CloseEvent("close", opts));
} else {
this.onclose(opts);
}
}
ajax(method, body, onCallerTimeout, callback) {
let req;
let ontimeout = () => {
this.reqs.delete(req);
onCallerTimeout();
};
req = Ajax.request(method, this.endpointURL(), "application/json", body, this.timeout, ontimeout, (resp) => {
this.reqs.delete(req);
if (this.isActive()) {
callback(resp);
}
});
this.reqs.add(req);
}
};
var serializer_default = {
HEADER_LENGTH: 1,
META_LENGTH: 4,
KINDS: { push: 0, reply: 1, broadcast: 2 },
encode(msg, callback) {
if (msg.payload.constructor === ArrayBuffer) {
return callback(this.binaryEncode(msg));
} else {
let payload = [msg.join_ref, msg.ref, msg.topic, msg.event, msg.payload];
return callback(JSON.stringify(payload));
}
},
decode(rawPayload, callback) {
if (rawPayload.constructor === ArrayBuffer) {
return callback(this.binaryDecode(rawPayload));
} else {
let [join_ref, ref, topic, event, payload] = JSON.parse(rawPayload);
return callback({ join_ref, ref, topic, event, payload });
}
},
binaryEncode(message) {
let { join_ref, ref, event, topic, payload } = message;
let metaLength = this.META_LENGTH + join_ref.length + ref.length + topic.length + event.length;
let header = new ArrayBuffer(this.HEADER_LENGTH + metaLength);
let view = new DataView(header);
let offset2 = 0;
view.setUint8(offset2++, this.KINDS.push);
view.setUint8(offset2++, join_ref.length);
view.setUint8(offset2++, ref.length);
view.setUint8(offset2++, topic.length);
view.setUint8(offset2++, event.length);
Array.from(join_ref, (char) => view.setUint8(offset2++, char.charCodeAt(0)));
Array.from(ref, (char) => view.setUint8(offset2++, char.charCodeAt(0)));
Array.from(topic, (char) => view.setUint8(offset2++, char.charCodeAt(0)));
Array.from(event, (char) => view.setUint8(offset2++, char.charCodeAt(0)));
var combined = new Uint8Array(header.byteLength + payload.byteLength);
combined.set(new Uint8Array(header), 0);
combined.set(new Uint8Array(payload), header.byteLength);
return combined.buffer;
},
binaryDecode(buffer) {
let view = new DataView(buffer);
let kind = view.getUint8(0);
let decoder = new TextDecoder();
switch (kind) {
case this.KINDS.push:
return this.decodePush(buffer, view, decoder);
case this.KINDS.reply:
return this.decodeReply(buffer, view, decoder);
case this.KINDS.broadcast:
return this.decodeBroadcast(buffer, view, decoder);
}
},
decodePush(buffer, view, decoder) {
let joinRefSize = view.getUint8(1);
let topicSize = view.getUint8(2);
let eventSize = view.getUint8(3);
let offset2 = this.HEADER_LENGTH + this.META_LENGTH - 1;
let joinRef = decoder.decode(buffer.slice(offset2, offset2 + joinRefSize));
offset2 = offset2 + joinRefSize;
let topic = decoder.decode(buffer.slice(offset2, offset2 + topicSize));
offset2 = offset2 + topicSize;
let event = decoder.decode(buffer.slice(offset2, offset2 + eventSize));
offset2 = offset2 + eventSize;
let data = buffer.slice(offset2, buffer.byteLength);
return { join_ref: joinRef, ref: null, topic, event, payload: data };
},
decodeReply(buffer, view, decoder) {
let joinRefSize = view.getUint8(1);
let refSize = view.getUint8(2);
let topicSize = view.getUint8(3);
let eventSize = view.getUint8(4);
let offset2 = this.HEADER_LENGTH + this.META_LENGTH;
let joinRef = decoder.decode(buffer.slice(offset2, offset2 + joinRefSize));
offset2 = offset2 + joinRefSize;
let ref = decoder.decode(buffer.slice(offset2, offset2 + refSize));
offset2 = offset2 + refSize;
let topic = decoder.decode(buffer.slice(offset2, offset2 + topicSize));
offset2 = offset2 + topicSize;
let event = decoder.decode(buffer.slice(offset2, offset2 + eventSize));
offset2 = offset2 + eventSize;
let data = buffer.slice(offset2, buffer.byteLength);
let payload = { status: event, response: data };
return { join_ref: joinRef, ref, topic, event: CHANNEL_EVENTS.reply, payload };
},
decodeBroadcast(buffer, view, decoder) {
let topicSize = view.getUint8(1);
let eventSize = view.getUint8(2);
let offset2 = this.HEADER_LENGTH + 2;
let topic = decoder.decode(buffer.slice(offset2, offset2 + topicSize));
offset2 = offset2 + topicSize;
let event = decoder.decode(buffer.slice(offset2, offset2 + eventSize));
offset2 = offset2 + eventSize;
let data = buffer.slice(offset2, buffer.byteLength);
return { join_ref: null, ref: null, topic, event, payload: data };
}
};
var Socket = class {
constructor(endPoint, opts = {}) {
this.stateChangeCallbacks = { open: [], close: [], error: [], message: [] };
this.channels = [];
this.sendBuffer = [];
this.ref = 0;
this.timeout = opts.timeout || DEFAULT_TIMEOUT;
this.transport = opts.transport || global2.WebSocket || LongPoll;
this.establishedConnections = 0;
this.defaultEncoder = serializer_default.encode.bind(serializer_default);
this.defaultDecoder = serializer_default.decode.bind(serializer_default);
this.closeWasClean = false;
this.binaryType = opts.binaryType || "arraybuffer";
this.connectClock = 1;
if (this.transport !== LongPoll) {
this.encode = opts.encode || this.defaultEncoder;
this.decode = opts.decode || this.defaultDecoder;
} else {
this.encode = this.defaultEncoder;
this.decode = this.defaultDecoder;
}
let awaitingConnectionOnPageShow = null;
if (phxWindow && phxWindow.addEventListener) {
phxWindow.addEventListener("pagehide", (_e) => {
if (this.conn) {
this.disconnect();
awaitingConnectionOnPageShow = this.connectClock;
}
});
phxWindow.addEventListener("pageshow", (_e) => {
if (awaitingConnectionOnPageShow === this.connectClock) {
awaitingConnectionOnPageShow = null;
this.connect();
}
});
}
this.heartbeatIntervalMs = opts.heartbeatIntervalMs || 3e4;
this.rejoinAfterMs = (tries) => {
if (opts.rejoinAfterMs) {
return opts.rejoinAfterMs(tries);
} else {
return [1e3, 2e3, 5e3][tries - 1] || 1e4;
}
};
this.reconnectAfterMs = (tries) => {
if (opts.reconnectAfterMs) {
return opts.reconnectAfterMs(tries);
} else {
return [10, 50, 100, 150, 200, 250, 500, 1e3, 2e3][tries - 1] || 5e3;
}
};
this.logger = opts.logger || null;
this.longpollerTimeout = opts.longpollerTimeout || 2e4;
this.params = closure(opts.params || {});
this.endPoint = `${endPoint}/${TRANSPORTS.websocket}`;
this.vsn = opts.vsn || DEFAULT_VSN;
this.heartbeatTimeoutTimer = null;
this.heartbeatTimer = null;
this.pendingHeartbeatRef = null;
this.reconnectTimer = new Timer(() => {
this.teardown(() => this.connect());
}, this.reconnectAfterMs);
}
getLongPollTransport() {
return LongPoll;
}
replaceTransport(newTransport) {
this.connectClock++;
this.closeWasClean = true;
this.reconnectTimer.reset();
this.sendBuffer = [];
if (this.conn) {
this.conn.close();
this.conn = null;
}
this.transport = newTransport;
}
protocol() {
return location.protocol.match(/^https/) ? "wss" : "ws";
}
endPointURL() {
let uri = Ajax.appendParams(Ajax.appendParams(this.endPoint, this.params()), { vsn: this.vsn });
if (uri.charAt(0) !== "/") {
return uri;
}
if (uri.charAt(1) === "/") {
return `${this.protocol()}:${uri}`;
}
return `${this.protocol()}://${location.host}${uri}`;
}
disconnect(callback, code, reason) {
this.connectClock++;
this.closeWasClean = true;
this.reconnectTimer.reset();
this.teardown(callback, code, reason);
}
connect(params) {
if (params) {
console && console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor");
this.params = closure(params);
}
if (this.conn) {
return;
}
this.connectClock++;
this.closeWasClean = false;
this.conn = new this.transport(this.endPointURL());
this.conn.binaryType = this.binaryType;
this.conn.timeout = this.longpollerTimeout;
this.conn.onopen = () => this.onConnOpen();
this.conn.onerror = (error) => this.onConnError(error);
this.conn.onmessage = (event) => this.onConnMessage(event);
this.conn.onclose = (event) => this.onConnClose(event);
}
log(kind, msg, data) {
this.logger(kind, msg, data);
}
hasLogger() {
return this.logger !== null;
}
onOpen(callback) {
let ref = this.makeRef();
this.stateChangeCallbacks.open.push([ref, callback]);
return ref;
}
onClose(callback) {
let ref = this.makeRef();
this.stateChangeCallbacks.close.push([ref, callback]);
return ref;
}
onError(callback) {
let ref = this.makeRef();
this.stateChangeCallbacks.error.push([ref, callback]);
return ref;
}
onMessage(callback) {
let ref = this.makeRef();
this.stateChangeCallbacks.message.push([ref, callback]);
return ref;
}
ping(callback) {
if (!this.isConnected()) {
return false;
}
let ref = this.makeRef();
let startTime = Date.now();
this.push({ topic: "phoenix", event: "heartbeat", payload: {}, ref });
let onMsgRef = this.onMessage((msg) => {
if (msg.ref === ref) {
this.off([onMsgRef]);
callback(Date.now() - startTime);
}
});
return true;
}
clearHeartbeats() {
clearTimeout(this.heartbeatTimer);
clearTimeout(this.heartbeatTimeoutTimer);
}
onConnOpen() {
if (this.hasLogger())
this.log("transport", `connected to ${this.endPointURL()}`);
this.closeWasClean = false;
this.establishedConnections++;
this.flushSendBuffer();
this.reconnectTimer.reset();
this.resetHeartbeat();
this.stateChangeCallbacks.open.forEach(([, callback]) => callback());
}
heartbeatTimeout() {
if (this.pendingHeartbeatRef) {
this.pendingHeartbeatRef = null;
if (this.hasLogger()) {
this.log("transport", "heartbeat timeout. Attempting to re-establish connection");
}
this.triggerChanError();
this.closeWasClean = false;
this.teardown(() => this.reconnectTimer.scheduleTimeout(), WS_CLOSE_NORMAL, "heartbeat timeout");
}
}
resetHeartbeat() {
if (this.conn && this.conn.skipHeartbeat) {
return;
}
this.pendingHeartbeatRef = null;
this.clearHeartbeats();
this.heartbeatTimer = setTimeout(() => this.sendHeartbeat(), this.heartbeatIntervalMs);
}
teardown(callback, code, reason) {
if (!this.conn) {
return callback && callback();
}
this.waitForBufferDone(() => {
if (this.conn) {
if (code) {
this.conn.close(code, reason || "");
} else {
this.conn.close();
}
}
this.waitForSocketClosed(() => {
if (this.conn) {
this.conn.onopen = function() {
};
this.conn.onerror = function() {
};
this.conn.onmessage = function() {
};
this.conn.onclose = function() {
};
this.conn = null;
}
callback && callback();
});
});
}
waitForBufferDone(callback, tries = 1) {
if (tries === 5 || !this.conn || !this.conn.bufferedAmount) {
callback();
return;
}
setTimeout(() => {
this.waitForBufferDone(callback, tries + 1);
}, 150 * tries);
}
waitForSocketClosed(callback, tries = 1) {
if (tries === 5 || !this.conn || this.conn.readyState === SOCKET_STATES.closed) {
callback();
return;
}
setTimeout(() => {
this.waitForSocketClosed(callback, tries + 1);
}, 150 * tries);
}
onConnClose(event) {
let closeCode = event && event.code;
if (this.hasLogger())
this.log("transport", "close", event);
this.triggerChanError();
this.clearHeartbeats();
if (!this.closeWasClean && closeCode !== 1e3) {
this.reconnectTimer.scheduleTimeout();
}
this.stateChangeCallbacks.close.forEach(([, callback]) => callback(event));
}
onConnError(error) {
if (this.hasLogger())
this.log("transport", error);
let transportBefore = this.transport;
let establishedBefore = this.establishedConnections;
this.stateChangeCallbacks.error.forEach(([, callback]) => {
callback(error, transportBefore, establishedBefore);
});
if (transportBefore === this.transport || establishedBefore > 0) {
this.triggerChanError();
}
}
triggerChanError() {
this.channels.forEach((channel) => {
if (!(channel.isErrored() || channel.isLeaving() || channel.isClosed())) {
channel.trigger(CHANNEL_EVENTS.error);
}
});
}
connectionState() {
switch (this.conn && this.conn.readyState) {
case SOCKET_STATES.connecting:
return "connecting";
case SOCKET_STATES.open:
return "open";
case SOCKET_STATES.closing:
return "closing";
default:
return "closed";
}
}
isConnected() {
return this.connectionState() === "open";
}
remove(channel) {
this.off(channel.stateChangeRefs);
this.channels = this.channels.filter((c) => c.joinRef() !== channel.joinRef());
}
off(refs) {
for (let key in this.stateChangeCallbacks) {
this.stateChangeCallbacks[key] = this.stateChangeCallbacks[key].filter(([ref]) => {
return refs.indexOf(ref) === -1;
});
}
}
channel(topic, chanParams = {}) {
let chan = new Channel(topic, chanParams, this);
this.channels.push(chan);
return chan;
}
push(data) {
if (this.hasLogger()) {
let { topic, event, payload, ref, join_ref } = data;
this.log("push", `${topic} ${event} (${join_ref}, ${ref})`, payload);
}
if (this.isConnected()) {
this.encode(data, (result) => this.conn.send(result));
} else {
this.sendBuffer.push(() => this.encode(data, (result) => this.conn.send(result)));
}
}
makeRef() {
let newRef = this.ref + 1;
if (newRef === this.ref) {
this.ref = 0;
} else {
this.ref = newRef;
}
return this.ref.toString();
}
sendHeartbeat() {
if (this.pendingHeartbeatRef && !this.isConnected()) {
return;
}
this.pendingHeartbeatRef = this.makeRef();
this.push({ topic: "phoenix", event: "heartbeat", payload: {}, ref: this.pendingHeartbeatRef });
this.heartbeatTimeoutTimer = setTimeout(() => this.heartbeatTimeout(), this.heartbeatIntervalMs);
}
flushSendBuffer() {
if (this.isConnected() && this.sendBuffer.length > 0) {
this.sendBuffer.forEach((callback) => callback());
this.sendBuffer = [];
}
}
onConnMessage(rawMessage) {
this.decode(rawMessage.data, (msg) => {
let { topic, event, payload, ref, join_ref } = msg;
if (ref && ref === this.pendingHeartbeatRef) {
this.clearHeartbeats();
this.pendingHeartbeatRef = null;
this.heartbeatTimer = setTimeout(() => this.sendHeartbeat(), this.heartbeatIntervalMs);
}
if (this.hasLogger())
this.log("receive", `${payload.status || ""} ${topic} ${event} ${ref && "(" + ref + ")" || ""}`, payload);
for (let i = 0; i < this.channels.length; i++) {
const channel = this.channels[i];
if (!channel.isMember(topic, event, payload, join_ref)) {
continue;
}
channel.trigger(event, payload, ref, join_ref);
}
for (let i = 0; i < this.stateChangeCallbacks.message.length; i++) {
let [, callback] = this.stateChangeCallbacks.message[i];
callback(msg);
}
});
}
leaveOpenTopic(topic) {
let dupChannel = this.channels.find((c) => c.topic === topic && (c.isJoined() || c.isJoining()));
if (dupChannel) {
if (this.hasLogger())
this.log("transport", `leaving duplicate topic "${topic}"`);
dupChannel.leave();
}
}
};
// ../deps/phoenix_live_view/priv/static/phoenix_live_view.esm.js
var CONSECUTIVE_RELOADS = "consecutive-reloads";
var MAX_RELOADS = 10;
var RELOAD_JITTER_MIN = 5e3;
var RELOAD_JITTER_MAX = 1e4;
var FAILSAFE_JITTER = 3e4;
var PHX_EVENT_CLASSES = [
"phx-click-loading",
"phx-change-loading",
"phx-submit-loading",
"phx-keydown-loading",
"phx-keyup-loading",
"phx-blur-loading",
"phx-focus-loading"
];
var PHX_COMPONENT = "data-phx-component";
var PHX_LIVE_LINK = "data-phx-link";
var PHX_TRACK_STATIC = "track-static";
var PHX_LINK_STATE = "data-phx-link-state";
var PHX_REF = "data-phx-ref";
var PHX_REF_SRC = "data-phx-ref-src";
var PHX_TRACK_UPLOADS = "track-uploads";
var PHX_UPLOAD_REF = "data-phx-upload-ref";
var PHX_PREFLIGHTED_REFS = "data-phx-preflighted-refs";
var PHX_DONE_REFS = "data-phx-done-refs";
var PHX_DROP_TARGET = "drop-target";
var PHX_ACTIVE_ENTRY_REFS = "data-phx-active-refs";
var PHX_LIVE_FILE_UPDATED = "phx:live-file:updated";
var PHX_SKIP = "data-phx-skip";
var PHX_PRUNE = "data-phx-prune";
var PHX_PAGE_LOADING = "page-loading";
var PHX_CONNECTED_CLASS = "phx-connected";
var PHX_DISCONNECTED_CLASS = "phx-loading";
var PHX_NO_FEEDBACK_CLASS = "phx-no-feedback";
var PHX_ERROR_CLASS = "phx-error";
var PHX_PARENT_ID = "data-phx-parent-id";
var PHX_MAIN = "data-phx-main";
var PHX_ROOT_ID = "data-phx-root-id";
var PHX_TRIGGER_ACTION = "trigger-action";
var PHX_FEEDBACK_FOR = "feedback-for";
var PHX_HAS_FOCUSED = "phx-has-focused";
var FOCUSABLE_INPUTS = ["text", "textarea", "number", "email", "password", "search", "tel", "url", "date", "time", "datetime-local", "color", "range"];
var CHECKABLE_INPUTS = ["checkbox", "radio"];
var PHX_HAS_SUBMITTED = "phx-has-submitted";
var PHX_SESSION = "data-phx-session";
var PHX_VIEW_SELECTOR = `[${PHX_SESSION}]`;
var PHX_STICKY = "data-phx-sticky";
var PHX_STATIC = "data-phx-static";
var PHX_READONLY = "data-phx-readonly";
var PHX_DISABLED = "data-phx-disabled";
var PHX_DISABLE_WITH = "disable-with";
var PHX_DISABLE_WITH_RESTORE = "data-phx-disable-with-restore";
var PHX_HOOK = "hook";
var PHX_DEBOUNCE = "debounce";
var PHX_THROTTLE = "throttle";
var PHX_UPDATE = "update";
var PHX_KEY = "key";
var PHX_PRIVATE = "phxPrivate";
var PHX_AUTO_RECOVER = "auto-recover";
var PHX_LV_DEBUG = "phx:live-socket:debug";
var PHX_LV_PROFILE = "phx:live-socket:profiling";
var PHX_LV_LATENCY_SIM = "phx:live-socket:latency-sim";
var PHX_PROGRESS = "progress";
var LOADER_TIMEOUT = 1;
var BEFORE_UNLOAD_LOADER_TIMEOUT = 200;
var BINDING_PREFIX = "phx-";
var PUSH_TIMEOUT = 3e4;
var DEBOUNCE_TRIGGER = "debounce-trigger";
var THROTTLED = "throttled";
var DEBOUNCE_PREV_KEY = "debounce-prev-key";
var DEFAULTS = {
debounce: 300,
throttle: 300
};
var DYNAMICS = "d";
var STATIC = "s";
var COMPONENTS = "c";
var EVENTS = "e";
var REPLY = "r";
var TITLE = "t";
var TEMPLATES = "p";
var EntryUploader = class {
constructor(entry, chunkSize, liveSocket2) {
this.liveSocket = liveSocket2;
this.entry = entry;
this.offset = 0;
this.chunkSize = chunkSize;
this.chunkTimer = null;
this.uploadChannel = liveSocket2.channel(`lvu:${entry.ref}`, { token: entry.metadata() });
}
error(reason) {
clearTimeout(this.chunkTimer);
this.uploadChannel.leave();
this.entry.error(reason);
}
upload() {
this.uploadChannel.onError((reason) => this.error(reason));
this.uploadChannel.join().receive("ok", (_data) => this.readNextChunk()).receive("error", (reason) => this.error(reason));
}
isDone() {
return this.offset >= this.entry.file.size;
}
readNextChunk() {
let reader = new window.FileReader();
let blob = this.entry.file.slice(this.offset, this.chunkSize + this.offset);
reader.onload = (e) => {
if (e.target.error === null) {
this.offset += e.target.result.byteLength;
this.pushChunk(e.target.result);
} else {
return logError("Read error: " + e.target.error);
}
};
reader.readAsArrayBuffer(blob);
}
pushChunk(chunk) {
if (!this.uploadChannel.isJoined()) {
return;
}
this.uploadChannel.push("chunk", chunk).receive("ok", () => {
this.entry.progress(this.offset / this.entry.file.size * 100);
if (!this.isDone()) {
this.chunkTimer = setTimeout(() => this.readNextChunk(), this.liveSocket.getLatencySim() || 0);
}
});
}
};
var logError = (msg, obj) => console.error && console.error(msg, obj);
var isCid = (cid) => {
let type = typeof cid;
return type === "number" || type === "string" && /^(0|[1-9]\d*)$/.test(cid);
};
function detectDuplicateIds() {
let ids = /* @__PURE__ */ new Set();
let elems = document.querySelectorAll("*[id]");
for (let i = 0, len = elems.length; i < len; i++) {
if (ids.has(elems[i].id)) {
console.error(`Multiple IDs detected: ${elems[i].id}. Ensure unique element ids.`);
} else {
ids.add(elems[i].id);
}
}
}
var debug = (view, kind, msg, obj) => {
if (view.liveSocket.isDebugEnabled()) {
console.log(`${view.id} ${kind}: ${msg} - `, obj);
}
};
var closure2 = (val) => typeof val === "function" ? val : function() {
return val;
};
var clone = (obj) => {
return JSON.parse(JSON.stringify(obj));
};
var closestPhxBinding = (el, binding, borderEl) => {
do {
if (el.matches(`[${binding}]`)) {
return el;
}
el = el.parentElement || el.parentNode;
} while (el !== null && el.nodeType === 1 && !(borderEl && borderEl.isSameNode(el) || el.matches(PHX_VIEW_SELECTOR)));
return null;
};
var isObject = (obj) => {
return obj !== null && typeof obj === "object" && !(obj instanceof Array);
};
var isEqualObj = (obj1, obj2) => JSON.stringify(obj1) === JSON.stringify(obj2);
var isEmpty = (obj) => {
for (let x in obj) {
return false;
}
return true;
};
var maybe = (el, callback) => el && callback(el);
var channelUploader = function(entries, onError, resp, liveSocket2) {
entries.forEach((entry) => {
let entryUploader = new EntryUploader(entry, resp.config.chunk_size, liveSocket2);
entryUploader.upload();
});
};
var Browser = {
canPushState() {
return typeof history.pushState !== "undefined";
},
dropLocal(localStorage, namespace, subkey) {
return localStorage.removeItem(this.localKey(namespace, subkey));
},
updateLocal(localStorage, namespace, subkey, initial, func) {
let current = this.getLocal(localStorage, namespace, subkey);
let key = this.localKey(namespace, subkey);
let newVal = current === null ? initial : func(current);
localStorage.setItem(key, JSON.stringify(newVal));
return newVal;
},
getLocal(localStorage, namespace, subkey) {
return JSON.parse(localStorage.getItem(this.localKey(namespace, subkey)));
},
updateCurrentState(callback) {
if (!this.canPushState()) {
return;
}
history.replaceState(callback(history.state || {}), "", window.location.href);
},
pushState(kind, meta, to) {
if (this.canPushState()) {
if (to !== window.location.href) {
if (meta.type == "redirect" && meta.scroll) {
let currentState = history.state || {};
currentState.scroll = meta.scroll;
history.replaceState(currentState, "", window.location.href);
}
delete meta.scroll;
history[kind + "State"](meta, "", to || null);
let hashEl = this.getHashTargetEl(window.location.hash);
if (hashEl) {
hashEl.scrollIntoView();
} else if (meta.type === "redirect") {
window.scroll(0, 0);
}
}
} else {
this.redirect(to);
}
},
setCookie(name, value) {
document.cookie = `${name}=${value}`;
},
getCookie(name) {
return document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${name}s*=s*([^;]*).*$)|^.*$`), "$1");
},
redirect(toURL, flash) {
if (flash) {
Browser.setCookie("__phoenix_flash__", flash + "; max-age=60000; path=/");
}
window.location = toURL;
},
localKey(namespace, subkey) {
return `${namespace}-${subkey}`;
},
getHashTargetEl(maybeHash) {
let hash3 = maybeHash.toString().substring(1);
if (hash3 === "") {
return;
}
return document.getElementById(hash3) || document.querySelector(`a[name="${hash3}"]`);
}
};
var browser_default = Browser;
var DOM = {
byId(id) {
return document.getElementById(id) || logError(`no id found for ${id}`);
},
removeClass(el, className) {
el.classList.remove(className);
if (el.classList.length === 0) {
el.removeAttribute("class");
}
},
all(node, query, callback) {
if (!node) {
return [];
}
let array = Array.from(node.querySelectorAll(query));
return callback ? array.forEach(callback) : array;
},
childNodeLength(html) {
let template = document.createElement("template");
template.innerHTML = html;
return template.content.childElementCount;
},
isUploadInput(el) {
return el.type === "file" && el.getAttribute(PHX_UPLOAD_REF) !== null;
},
findUploadInputs(node) {
return this.all(node, `input[type="file"][${PHX_UPLOAD_REF}]`);
},
findComponentNodeList(node, cid) {
return this.filterWithinSameLiveView(this.all(node, `[${PHX_COMPONENT}="${cid}"]`), node);
},
isPhxDestroyed(node) {
return node.id && DOM.private(node, "destroyed") ? true : false;
},
markPhxChildDestroyed(el) {
if (this.isPhxChild(el)) {
el.setAttribute(PHX_SESSION, "");
}
this.putPrivate(el, "destroyed", true);
},
findPhxChildrenInFragment(html, parentId) {
let template = document.createElement("template");
template.innerHTML = html;
return this.findPhxChildren(template.content, parentId);
},
isIgnored(el, phxUpdate) {
return (el.getAttribute(phxUpdate) || el.getAttribute("data-phx-update")) === "ignore";
},
isPhxUpdate(el, phxUpdate, updateTypes) {
return el.getAttribute && updateTypes.indexOf(el.getAttribute(phxUpdate)) >= 0;
},
findPhxSticky(el) {
return this.all(el, `[${PHX_STICKY}]`);
},
findPhxChildren(el, parentId) {
return this.all(el, `${PHX_VIEW_SELECTOR}[${PHX_PARENT_ID}="${parentId}"]`);
},
findParentCIDs(node, cids) {
let initial = new Set(cids);
return cids.reduce((acc, cid) => {
let selector = `[${PHX_COMPONENT}="${cid}"] [${PHX_COMPONENT}]`;
this.filterWithinSameLiveView(this.all(node, selector), node).map((el) => parseInt(el.getAttribute(PHX_COMPONENT))).forEach((childCID) => acc.delete(childCID));
return acc;
}, initial);
},
filterWithinSameLiveView(nodes, parent) {
if (parent.querySelector(PHX_VIEW_SELECTOR)) {
return nodes.filter((el) => this.withinSameLiveView(el, parent));
} else {
return nodes;
}
},
withinSameLiveView(node, parent) {
while (node = node.parentNode) {
if (node.isSameNode(parent)) {
return true;
}
if (node.getAttribute(PHX_SESSION) !== null) {
return false;
}
}
},
private(el, key) {
return el[PHX_PRIVATE] && el[PHX_PRIVATE][key];
},
deletePrivate(el, key) {
el[PHX_PRIVATE] && delete el[PHX_PRIVATE][key];
},
putPrivate(el, key, value) {
if (!el[PHX_PRIVATE]) {
el[PHX_PRIVATE] = {};
}
el[PHX_PRIVATE][key] = value;
},
updatePrivate(el, key, defaultVal, updateFunc) {
let existing = this.private(el, key);
if (existing === void 0) {
this.putPrivate(el, key, updateFunc(defaultVal));
} else {
this.putPrivate(el, key, updateFunc(existing));
}
},
copyPrivates(target, source) {
if (source[PHX_PRIVATE]) {
target[PHX_PRIVATE] = source[PHX_PRIVATE];
}
},
putTitle(str) {
let titleEl = document.querySelector("title");
let { prefix, suffix } = titleEl.dataset;
document.title = `${prefix || ""}${str}${suffix || ""}`;
},
debounce(el, event, phxDebounce, defaultDebounce, phxThrottle, defaultThrottle, asyncFilter, callback) {
let debounce2 = el.getAttribute(phxDebounce);
let throttle = el.getAttribute(phxThrottle);
if (debounce2 === "") {
debounce2 = defaultDebounce;
}
if (throttle === "") {
throttle = defaultThrottle;
}
let value = debounce2 || throttle;
switch (value) {
case null:
return callback();
case "blur":
if (this.once(el, "debounce-blur")) {
el.addEventListener("blur", () => callback());
}
return;
default:
let timeout = parseInt(value);
let trigger = () => throttle ? this.deletePrivate(el, THROTTLED) : callback();
let currentCycle = this.incCycle(el, DEBOUNCE_TRIGGER, trigger);
if (isNaN(timeout)) {
return logError(`invalid throttle/debounce value: ${value}`);
}
if (throttle) {
let newKeyDown = false;
if (event.type === "keydown") {
let prevKey = this.private(el, DEBOUNCE_PREV_KEY);
this.putPrivate(el, DEBOUNCE_PREV_KEY, event.key);
newKeyDown = prevKey !== event.key;
}
if (!newKeyDown && this.private(el, THROTTLED)) {
return false;
} else {
callback();
this.putPrivate(el, THROTTLED, true);
setTimeout(() => {
if (asyncFilter()) {
this.triggerCycle(el, DEBOUNCE_TRIGGER);
}
}, timeout);
}
} else {
setTimeout(() => {
if (asyncFilter()) {
this.triggerCycle(el, DEBOUNCE_TRIGGER, currentCycle);
}
}, timeout);
}
let form = el.form;
if (form && this.once(form, "bind-debounce")) {
form.addEventListener("submit", () => {
Array.from(new FormData(form).entries(), ([name]) => {
let input = form.querySelector(`[name="${name}"]`);
this.incCycle(input, DEBOUNCE_TRIGGER);
this.deletePrivate(input, THROTTLED);
});
});
}
if (this.once(el, "bind-debounce")) {
el.addEventListener("blur", () => this.triggerCycle(el, DEBOUNCE_TRIGGER));
}
}
},
triggerCycle(el, key, currentCycle) {
let [cycle, trigger] = this.private(el, key);
if (!currentCycle) {
currentCycle = cycle;
}
if (currentCycle === cycle) {
this.incCycle(el, key);
trigger();
}
},
once(el, key) {
if (this.private(el, key) === true) {
return false;
}
this.putPrivate(el, key, true);
return true;
},
incCycle(el, key, trigger = function() {
}) {
let [currentCycle] = this.private(el, key) || [0, trigger];
currentCycle++;
this.putPrivate(el, key, [currentCycle, trigger]);
return currentCycle;
},
discardError(container, el, phxFeedbackFor) {
let field = el.getAttribute && el.getAttribute(phxFeedbackFor);
let input = field && container.querySelector(`[id="${field}"], [name="${field}"]`);
if (!input) {
return;
}
if (!(this.private(input, PHX_HAS_FOCUSED) || this.private(input.form, PHX_HAS_SUBMITTED))) {
el.classList.add(PHX_NO_FEEDBACK_CLASS);
}
},
showError(inputEl, phxFeedbackFor) {
if (inputEl.id || inputEl.name) {
this.all(inputEl.form, `[${phxFeedbackFor}="${inputEl.id}"], [${phxFeedbackFor}="${inputEl.name}"]`, (el) => {
this.removeClass(el, PHX_NO_FEEDBACK_CLASS);
});
}
},
isPhxChild(node) {
return node.getAttribute && node.getAttribute(PHX_PARENT_ID);
},
isPhxSticky(node) {
return node.getAttribute && node.getAttribute(PHX_STICKY) !== null;
},
firstPhxChild(el) {
return this.isPhxChild(el) ? el : this.all(el, `[${PHX_PARENT_ID}]`)[0];
},
dispatchEvent(target, name, opts = {}) {
let bubbles = opts.bubbles === void 0 ? true : !!opts.bubbles;
let eventOpts = { bubbles, cancelable: true, detail: opts.detail || {} };
let event = name === "click" ? new MouseEvent("click", eventOpts) : new CustomEvent(name, eventOpts);
target.dispatchEvent(event);
},
cloneNode(node, html) {
if (typeof html === "undefined") {
return node.cloneNode(true);
} else {
let cloned = node.cloneNode(false);
cloned.innerHTML = html;
return cloned;
}
},
mergeAttrs(target, source, opts = {}) {
let exclude = opts.exclude || [];
let isIgnored = opts.isIgnored;
let sourceAttrs = source.attributes;
for (let i = sourceAttrs.length - 1; i >= 0; i--) {
let name = sourceAttrs[i].name;
if (exclude.indexOf(name) < 0) {
target.setAttribute(name, source.getAttribute(name));
}
}
let targetAttrs = target.attributes;
for (let i = targetAttrs.length - 1; i >= 0; i--) {
let name = targetAttrs[i].name;
if (isIgnored) {
if (name.startsWith("data-") && !source.hasAttribute(name)) {
target.removeAttribute(name);
}
} else {
if (!source.hasAttribute(name)) {
target.removeAttribute(name);
}
}
}
},
mergeFocusedInput(target, source) {
if (!(target instanceof HTMLSelectElement)) {
DOM.mergeAttrs(target, source, { exclude: ["value"] });
}
if (source.readOnly) {
target.setAttribute("readonly", true);
} else {
target.removeAttribute("readonly");
}
},
hasSelectionRange(el) {
return el.setSelectionRange && (el.type === "text" || el.type === "textarea");
},
restoreFocus(focused, selectionStart, selectionEnd) {
if (!DOM.isTextualInput(focused)) {
return;
}
let wasFocused = focused.matches(":focus");
if (focused.readOnly) {
focused.blur();
}
if (!wasFocused) {
focused.focus();
}
if (this.hasSelectionRange(focused)) {
focused.setSelectionRange(selectionStart, selectionEnd);
}
},
isFormInput(el) {
return /^(?:input|select|textarea)$/i.test(el.tagName) && el.type !== "button";
},
syncAttrsToProps(el) {
if (el instanceof HTMLInputElement && CHECKABLE_INPUTS.indexOf(el.type.toLocaleLowerCase()) >= 0) {
el.checked = el.getAttribute("checked") !== null;
}
},
isTextualInput(el) {
return FOCUSABLE_INPUTS.indexOf(el.type) >= 0;
},
isNowTriggerFormExternal(el, phxTriggerExternal) {
return el.getAttribute && el.getAttribute(phxTriggerExternal) !== null;
},
syncPendingRef(fromEl, toEl, disableWith) {
let ref = fromEl.getAttribute(PHX_REF);
if (ref === null) {
return true;
}
let refSrc = fromEl.getAttribute(PHX_REF_SRC);
if (DOM.isFormInput(fromEl) || fromEl.getAttribute(disableWith) !== null) {
if (DOM.isUploadInput(fromEl)) {
DOM.mergeAttrs(fromEl, toEl, { isIgnored: true });
}
DOM.putPrivate(fromEl, PHX_REF, toEl);
return false;
} else {
PHX_EVENT_CLASSES.forEach((className) => {
fromEl.classList.contains(className) && toEl.classList.add(className);
});
toEl.setAttribute(PHX_REF, ref);
toEl.setAttribute(PHX_REF_SRC, refSrc);
return true;
}
},
cleanChildNodes(container, phxUpdate) {
if (DOM.isPhxUpdate(container, phxUpdate, ["append", "prepend"])) {
let toRemove = [];
container.childNodes.forEach((childNode) => {
if (!childNode.id) {
let isEmptyTextNode = childNode.nodeType === Node.TEXT_NODE && childNode.nodeValue.trim() === "";
if (!isEmptyTextNode) {
logError(`only HTML element tags with an id are allowed inside containers with phx-update.
removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
`);
}
toRemove.push(childNode);
}
});
toRemove.forEach((childNode) => childNode.remove());
}
},
replaceRootContainer(container, tagName, attrs) {
let retainedAttrs = /* @__PURE__ */ new Set(["id", PHX_SESSION, PHX_STATIC, PHX_MAIN, PHX_ROOT_ID]);
if (container.tagName.toLowerCase() === tagName.toLowerCase()) {
Array.from(container.attributes).filter((attr) => !retainedAttrs.has(attr.name.toLowerCase())).forEach((attr) => container.removeAttribute(attr.name));
Object.keys(attrs).filter((name) => !retainedAttrs.has(name.toLowerCase())).forEach((attr) => container.setAttribute(attr, attrs[attr]));
return container;
} else {
let newContainer = document.createElement(tagName);
Object.keys(attrs).forEach((attr) => newContainer.setAttribute(attr, attrs[attr]));
retainedAttrs.forEach((attr) => newContainer.setAttribute(attr, container.getAttribute(attr)));
newContainer.innerHTML = container.innerHTML;
container.replaceWith(newContainer);
return newContainer;
}
},
getSticky(el, name, defaultVal) {
let op = (DOM.private(el, "sticky") || []).find(([existingName]) => name === existingName);
if (op) {
let [_name, _op, stashedResult] = op;
return stashedResult;
} else {
return typeof defaultVal === "function" ? defaultVal() : defaultVal;
}
},
deleteSticky(el, name) {
this.updatePrivate(el, "sticky", [], (ops) => {
return ops.filter(([existingName, _]) => existingName !== name);
});
},
putSticky(el, name, op) {
let stashedResult = op(el);
this.updatePrivate(el, "sticky", [], (ops) => {
let existingIndex = ops.findIndex(([existingName]) => name === existingName);
if (existingIndex >= 0) {
ops[existingIndex] = [name, op, stashedResult];
} else {
ops.push([name, op, stashedResult]);
}
return ops;
});
},
applyStickyOperations(el) {
let ops = DOM.private(el, "sticky");
if (!ops) {
return;
}
ops.forEach(([name, op, _stashed]) => this.putSticky(el, name, op));
}
};
var dom_default = DOM;
var UploadEntry = class {
static isActive(fileEl, file) {
let isNew = file._phxRef === void 0;
let activeRefs = fileEl.getAttribute(PHX_ACTIVE_ENTRY_REFS).split(",");
let isActive = activeRefs.indexOf(LiveUploader.genFileRef(file)) >= 0;
return file.size > 0 && (isNew || isActive);
}
static isPreflighted(fileEl, file) {
let preflightedRefs = fileEl.getAttribute(PHX_PREFLIGHTED_REFS).split(",");
let isPreflighted = preflightedRefs.indexOf(LiveUploader.genFileRef(file)) >= 0;
return isPreflighted && this.isActive(fileEl, file);
}
constructor(fileEl, file, view) {
this.ref = LiveUploader.genFileRef(file);
this.fileEl = fileEl;
this.file = file;
this.view = view;
this.meta = null;
this._isCancelled = false;
this._isDone = false;
this._progress = 0;
this._lastProgressSent = -1;
this._onDone = function() {
};
this._onElUpdated = this.onElUpdated.bind(this);
this.fileEl.addEventListener(PHX_LIVE_FILE_UPDATED, this._onElUpdated);
}
metadata() {
return this.meta;
}
progress(progress) {
this._progress = Math.floor(progress);
if (this._progress > this._lastProgressSent) {
if (this._progress >= 100) {
this._progress = 100;
this._lastProgressSent = 100;
this._isDone = true;
this.view.pushFileProgress(this.fileEl, this.ref, 100, () => {
LiveUploader.untrackFile(this.fileEl, this.file);
this._onDone();
});
} else {
this._lastProgressSent = this._progress;
this.view.pushFileProgress(this.fileEl, this.ref, this._progress);
}
}
}
cancel() {
this._isCancelled = true;
this._isDone = true;
this._onDone();
}
isDone() {
return this._isDone;
}
error(reason = "failed") {
this.view.pushFileProgress(this.fileEl, this.ref, { error: reason });
LiveUploader.clearFiles(this.fileEl);
}
onDone(callback) {
this._onDone = () => {
this.fileEl.removeEventListener(PHX_LIVE_FILE_UPDATED, this._onElUpdated);
callback();
};
}
onElUpdated() {
let activeRefs = this.fileEl.getAttribute(PHX_ACTIVE_ENTRY_REFS).split(",");
if (activeRefs.indexOf(this.ref) === -1) {
this.cancel();
}
}
toPreflightPayload() {
return {
last_modified: this.file.lastModified,
name: this.file.name,
size: this.file.size,
type: this.file.type,
ref: this.ref
};
}
uploader(uploaders) {
if (this.meta.uploader) {
let callback = uploaders[this.meta.uploader] || logError(`no uploader configured for ${this.meta.uploader}`);
return { name: this.meta.uploader, callback };
} else {
return { name: "channel", callback: channelUploader };
}
}
zipPostFlight(resp) {
this.meta = resp.entries[this.ref];
if (!this.meta) {
logError(`no preflight upload response returned with ref ${this.ref}`, { input: this.fileEl, response: resp });
}
}
};
var liveUploaderFileRef = 0;
var LiveUploader = class {
static genFileRef(file) {
let ref = file._phxRef;
if (ref !== void 0) {
return ref;
} else {
file._phxRef = (liveUploaderFileRef++).toString();
return file._phxRef;
}
}
static getEntryDataURL(inputEl, ref, callback) {
let file = this.activeFiles(inputEl).find((file2) => this.genFileRef(file2) === ref);
callback(URL.createObjectURL(file));
}
static hasUploadsInProgress(formEl) {
let active = 0;
dom_default.findUploadInputs(formEl).forEach((input) => {
if (input.getAttribute(PHX_PREFLIGHTED_REFS) !== input.getAttribute(PHX_DONE_REFS)) {
active++;
}
});
return active > 0;
}
static serializeUploads(inputEl) {
let files = this.activeFiles(inputEl);
let fileData = {};
files.forEach((file) => {
let entry = { path: inputEl.name };
let uploadRef = inputEl.getAttribute(PHX_UPLOAD_REF);
fileData[uploadRef] = fileData[uploadRef] || [];
entry.ref = this.genFileRef(file);
entry.name = file.name || entry.ref;
entry.type = file.type;
entry.size = file.size;
fileData[uploadRef].push(entry);
});
return fileData;
}
static clearFiles(inputEl) {
inputEl.value = null;
inputEl.removeAttribute(PHX_UPLOAD_REF);
dom_default.putPrivate(inputEl, "files", []);
}
static untrackFile(inputEl, file) {
dom_default.putPrivate(inputEl, "files", dom_default.private(inputEl, "files").filter((f) => !Object.is(f, file)));
}
static trackFiles(inputEl, files) {
if (inputEl.getAttribute("multiple") !== null) {
let newFiles = files.filter((file) => !this.activeFiles(inputEl).find((f) => Object.is(f, file)));
dom_default.putPrivate(inputEl, "files", this.activeFiles(inputEl).concat(newFiles));
inputEl.value = null;
} else {
dom_default.putPrivate(inputEl, "files", files);
}
}
static activeFileInputs(formEl) {
let fileInputs = dom_default.findUploadInputs(formEl);
return Array.from(fileInputs).filter((el) => el.files && this.activeFiles(el).length > 0);
}
static activeFiles(input) {
return (dom_default.private(input, "files") || []).filter((f) => UploadEntry.isActive(input, f));
}
static inputsAwaitingPreflight(formEl) {
let fileInputs = dom_default.findUploadInputs(formEl);
return Array.from(fileInputs).filter((input) => this.filesAwaitingPreflight(input).length > 0);
}
static filesAwaitingPreflight(input) {
return this.activeFiles(input).filter((f) => !UploadEntry.isPreflighted(input, f));
}
constructor(inputEl, view, onComplete) {
this.view = view;
this.onComplete = onComplete;
this._entries = Array.from(LiveUploader.filesAwaitingPreflight(inputEl) || []).map((file) => new UploadEntry(inputEl, file, view));
this.numEntriesInProgress = this._entries.length;
}
entries() {
return this._entries;
}
initAdapterUpload(resp, onError, liveSocket2) {
this._entries = this._entries.map((entry) => {
entry.zipPostFlight(resp);
entry.onDone(() => {
this.numEntriesInProgress--;
if (this.numEntriesInProgress === 0) {
this.onComplete();
}
});
return entry;
});
let groupedEntries = this._entries.reduce((acc, entry) => {
let { name, callback } = entry.uploader(liveSocket2.uploaders);
acc[name] = acc[name] || { callback, entries: [] };
acc[name].entries.push(entry);
return acc;
}, {});
for (let name in groupedEntries) {
let { callback, entries } = groupedEntries[name];
callback(entries, onError, resp, liveSocket2);
}
}
};
var Hooks = {
LiveFileUpload: {
activeRefs() {
return this.el.getAttribute(PHX_ACTIVE_ENTRY_REFS);
},
preflightedRefs() {
return this.el.getAttribute(PHX_PREFLIGHTED_REFS);
},
mounted() {
this.preflightedWas = this.preflightedRefs();
},
updated() {
let newPreflights = this.preflightedRefs();
if (this.preflightedWas !== newPreflights) {
this.preflightedWas = newPreflights;
if (newPreflights === "") {
this.__view.cancelSubmit(this.el.form);
}
}
if (this.activeRefs() === "") {
this.el.value = null;
}
this.el.dispatchEvent(new CustomEvent(PHX_LIVE_FILE_UPDATED));
}
},
LiveImgPreview: {
mounted() {
this.ref = this.el.getAttribute("data-phx-entry-ref");
this.inputEl = document.getElementById(this.el.getAttribute(PHX_UPLOAD_REF));
LiveUploader.getEntryDataURL(this.inputEl, this.ref, (url) => {
this.url = url;
this.el.src = url;
});
},
destroyed() {
URL.revokeObjectURL(this.url);
}
}
};
var hooks_default = Hooks;
var DOMPostMorphRestorer = class {
constructor(containerBefore, containerAfter, updateType) {
let idsBefore = /* @__PURE__ */ new Set();
let idsAfter = new Set([...containerAfter.children].map((child) => child.id));
let elementsToModify = [];
Array.from(containerBefore.children).forEach((child) => {
if (child.id) {
idsBefore.add(child.id);
if (idsAfter.has(child.id)) {
let previousElementId = child.previousElementSibling && child.previousElementSibling.id;
elementsToModify.push({ elementId: child.id, previousElementId });
}
}
});
this.containerId = containerAfter.id;
this.updateType = updateType;
this.elementsToModify = elementsToModify;
this.elementIdsToAdd = [...idsAfter].filter((id) => !idsBefore.has(id));
}
perform() {
let container = dom_default.byId(this.containerId);
this.elementsToModify.forEach((elementToModify) => {
if (elementToModify.previousElementId) {
maybe(document.getElementById(elementToModify.previousElementId), (previousElem) => {
maybe(document.getElementById(elementToModify.elementId), (elem) => {
let isInRightPlace = elem.previousElementSibling && elem.previousElementSibling.id == previousElem.id;
if (!isInRightPlace) {
previousElem.insertAdjacentElement("afterend", elem);
}
});
});
} else {
maybe(document.getElementById(elementToModify.elementId), (elem) => {
let isInRightPlace = elem.previousElementSibling == null;
if (!isInRightPlace) {
container.insertAdjacentElement("afterbegin", elem);
}
});
}
});
if (this.updateType == "prepend") {
this.elementIdsToAdd.reverse().forEach((elemId) => {
maybe(document.getElementById(elemId), (elem) => container.insertAdjacentElement("afterbegin", elem));
});
}
}
};
var DOCUMENT_FRAGMENT_NODE = 11;
function morphAttrs(fromNode, toNode) {
var toNodeAttrs = toNode.attributes;
var attr;
var attrName;
var attrNamespaceURI;
var attrValue;
var fromValue;
if (toNode.nodeType === DOCUMENT_FRAGMENT_NODE || fromNode.nodeType === DOCUMENT_FRAGMENT_NODE) {
return;
}
for (var i = toNodeAttrs.length - 1; i >= 0; i--) {
attr = toNodeAttrs[i];
attrName = attr.name;
attrNamespaceURI = attr.namespaceURI;
attrValue = attr.value;
if (attrNamespaceURI) {
attrName = attr.localName || attrName;
fromValue = fromNode.getAttributeNS(attrNamespaceURI, attrName);
if (fromValue !== attrValue) {
if (attr.prefix === "xmlns") {
attrName = attr.name;
}
fromNode.setAttributeNS(attrNamespaceURI, attrName, attrValue);
}
} else {
fromValue = fromNode.getAttribute(attrName);
if (fromValue !== attrValue) {
fromNode.setAttribute(attrName, attrValue);
}
}
}
var fromNodeAttrs = fromNode.attributes;
for (var d = fromNodeAttrs.length - 1; d >= 0; d--) {
attr = fromNodeAttrs[d];
attrName = attr.name;
attrNamespaceURI = attr.namespaceURI;
if (attrNamespaceURI) {
attrName = attr.localName || attrName;
if (!toNode.hasAttributeNS(attrNamespaceURI, attrName)) {
fromNode.removeAttributeNS(attrNamespaceURI, attrName);
}
} else {
if (!toNode.hasAttribute(attrName)) {
fromNode.removeAttribute(attrName);
}
}
}
}
var range;
var NS_XHTML = "http://www.w3.org/1999/xhtml";
var doc = typeof document === "undefined" ? void 0 : document;
var HAS_TEMPLATE_SUPPORT = !!doc && "content" in doc.createElement("template");
var HAS_RANGE_SUPPORT = !!doc && doc.createRange && "createContextualFragment" in doc.createRange();
function createFragmentFromTemplate(str) {
var template = doc.createElement("template");
template.innerHTML = str;
return template.content.childNodes[0];
}
function createFragmentFromRange(str) {
if (!range) {
range = doc.createRange();
range.selectNode(doc.body);
}
var fragment = range.createContextualFragment(str);
return fragment.childNodes[0];
}
function createFragmentFromWrap(str) {
var fragment = doc.createElement("body");
fragment.innerHTML = str;
return fragment.childNodes[0];
}
function toElement(str) {
str = str.trim();
if (HAS_TEMPLATE_SUPPORT) {
return createFragmentFromTemplate(str);
} else if (HAS_RANGE_SUPPORT) {
return createFragmentFromRange(str);
}
return createFragmentFromWrap(str);
}
function compareNodeNames(fromEl, toEl) {
var fromNodeName = fromEl.nodeName;
var toNodeName = toEl.nodeName;
var fromCodeStart, toCodeStart;
if (fromNodeName === toNodeName) {
return true;
}
fromCodeStart = fromNodeName.charCodeAt(0);
toCodeStart = toNodeName.charCodeAt(0);
if (fromCodeStart <= 90 && toCodeStart >= 97) {
return fromNodeName === toNodeName.toUpperCase();
} else if (toCodeStart <= 90 && fromCodeStart >= 97) {
return toNodeName === fromNodeName.toUpperCase();
} else {
return false;
}
}
function createElementNS(name, namespaceURI) {
return !namespaceURI || namespaceURI === NS_XHTML ? doc.createElement(name) : doc.createElementNS(namespaceURI, name);
}
function moveChildren(fromEl, toEl) {
var curChild = fromEl.firstChild;
while (curChild) {
var nextChild = curChild.nextSibling;
toEl.appendChild(curChild);
curChild = nextChild;
}
return toEl;
}
function syncBooleanAttrProp(fromEl, toEl, name) {
if (fromEl[name] !== toEl[name]) {
fromEl[name] = toEl[name];
if (fromEl[name]) {
fromEl.setAttribute(name, "");
} else {
fromEl.removeAttribute(name);
}
}
}
var specialElHandlers = {
OPTION: function(fromEl, toEl) {
var parentNode = fromEl.parentNode;
if (parentNode) {
var parentName = parentNode.nodeName.toUpperCase();
if (parentName === "OPTGROUP") {
parentNode = parentNode.parentNode;
parentName = parentNode && parentNode.nodeName.toUpperCase();
}
if (parentName === "SELECT" && !parentNode.hasAttribute("multiple")) {
if (fromEl.hasAttribute("selected") && !toEl.selected) {
fromEl.setAttribute("selected", "selected");
fromEl.removeAttribute("selected");
}
parentNode.selectedIndex = -1;
}
}
syncBooleanAttrProp(fromEl, toEl, "selected");
},
INPUT: function(fromEl, toEl) {
syncBooleanAttrProp(fromEl, toEl, "checked");
syncBooleanAttrProp(fromEl, toEl, "disabled");
if (fromEl.value !== toEl.value) {
fromEl.value = toEl.value;
}
if (!toEl.hasAttribute("value")) {
fromEl.removeAttribute("value");
}
},
TEXTAREA: function(fromEl, toEl) {
var newValue = toEl.value;
if (fromEl.value !== newValue) {
fromEl.value = newValue;
}
var firstChild = fromEl.firstChild;
if (firstChild) {
var oldValue = firstChild.nodeValue;
if (oldValue == newValue || !newValue && oldValue == fromEl.placeholder) {
return;
}
firstChild.nodeValue = newValue;
}
},
SELECT: function(fromEl, toEl) {
if (!toEl.hasAttribute("multiple")) {
var selectedIndex = -1;
var i = 0;
var curChild = fromEl.firstChild;
var optgroup;
var nodeName;
while (curChild) {
nodeName = curChild.nodeName && curChild.nodeName.toUpperCase();
if (nodeName === "OPTGROUP") {
optgroup = curChild;
curChild = optgroup.firstChild;
} else {
if (nodeName === "OPTION") {
if (curChild.hasAttribute("selected")) {
selectedIndex = i;
break;
}
i++;
}
curChild = curChild.nextSibling;
if (!curChild && optgroup) {
curChild = optgroup.nextSibling;
optgroup = null;
}
}
}
fromEl.selectedIndex = selectedIndex;
}
}
};
var ELEMENT_NODE = 1;
var DOCUMENT_FRAGMENT_NODE$1 = 11;
var TEXT_NODE = 3;
var COMMENT_NODE = 8;
function noop2() {
}
function defaultGetNodeKey(node) {
if (node) {
return node.getAttribute && node.getAttribute("id") || node.id;
}
}
function morphdomFactory(morphAttrs2) {
return function morphdom2(fromNode, toNode, options) {
if (!options) {
options = {};
}
if (typeof toNode === "string") {
if (fromNode.nodeName === "#document" || fromNode.nodeName === "HTML" || fromNode.nodeName === "BODY") {
var toNodeHtml = toNode;
toNode = doc.createElement("html");
toNode.innerHTML = toNodeHtml;
} else {
toNode = toElement(toNode);
}
}
var getNodeKey = options.getNodeKey || defaultGetNodeKey;
var onBeforeNodeAdded = options.onBeforeNodeAdded || noop2;
var onNodeAdded = options.onNodeAdded || noop2;
var onBeforeElUpdated = options.onBeforeElUpdated || noop2;
var onElUpdated = options.onElUpdated || noop2;
var onBeforeNodeDiscarded = options.onBeforeNodeDiscarded || noop2;
var onNodeDiscarded = options.onNodeDiscarded || noop2;
var onBeforeElChildrenUpdated = options.onBeforeElChildrenUpdated || noop2;
var childrenOnly = options.childrenOnly === true;
var fromNodesLookup = /* @__PURE__ */ Object.create(null);
var keyedRemovalList = [];
function addKeyedRemoval(key) {
keyedRemovalList.push(key);
}
function walkDiscardedChildNodes(node, skipKeyedNodes) {
if (node.nodeType === ELEMENT_NODE) {
var curChild = node.firstChild;
while (curChild) {
var key = void 0;
if (skipKeyedNodes && (key = getNodeKey(curChild))) {
addKeyedRemoval(key);
} else {
onNodeDiscarded(curChild);
if (curChild.firstChild) {
walkDiscardedChildNodes(curChild, skipKeyedNodes);
}
}
curChild = curChild.nextSibling;
}
}
}
function removeNode(node, parentNode, skipKeyedNodes) {
if (onBeforeNodeDiscarded(node) === false) {
return;
}
if (parentNode) {
parentNode.removeChild(node);
}
onNodeDiscarded(node);
walkDiscardedChildNodes(node, skipKeyedNodes);
}
function indexTree(node) {
if (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE$1) {
var curChild = node.firstChild;
while (curChild) {
var key = getNodeKey(curChild);
if (key) {
fromNodesLookup[key] = curChild;
}
indexTree(curChild);
curChild = curChild.nextSibling;
}
}
}
indexTree(fromNode);
function handleNodeAdded(el) {
onNodeAdded(el);
var curChild = el.firstChild;
while (curChild) {
var nextSibling = curChild.nextSibling;
var key = getNodeKey(curChild);
if (key) {
var unmatchedFromEl = fromNodesLookup[key];
if (unmatchedFromEl && compareNodeNames(curChild, unmatchedFromEl)) {
curChild.parentNode.replaceChild(unmatchedFromEl, curChild);
morphEl(unmatchedFromEl, curChild);
} else {
handleNodeAdded(curChild);
}
} else {
handleNodeAdded(curChild);
}
curChild = nextSibling;
}
}
function cleanupFromEl(fromEl, curFromNodeChild, curFromNodeKey) {
while (curFromNodeChild) {
var fromNextSibling = curFromNodeChild.nextSibling;
if (curFromNodeKey = getNodeKey(curFromNodeChild)) {
addKeyedRemoval(curFromNodeKey);
} else {
removeNode(curFromNodeChild, fromEl, true);
}
curFromNodeChild = fromNextSibling;
}
}
function morphEl(fromEl, toEl, childrenOnly2) {
var toElKey = getNodeKey(toEl);
if (toElKey) {
delete fromNodesLookup[toElKey];
}
if (!childrenOnly2) {
if (onBeforeElUpdated(fromEl, toEl) === false) {
return;
}
morphAttrs2(fromEl, toEl);
onElUpdated(fromEl);
if (onBeforeElChildrenUpdated(fromEl, toEl) === false) {
return;
}
}
if (fromEl.nodeName !== "TEXTAREA") {
morphChildren(fromEl, toEl);
} else {
specialElHandlers.TEXTAREA(fromEl, toEl);
}
}
function morphChildren(fromEl, toEl) {
var curToNodeChild = toEl.firstChild;
var curFromNodeChild = fromEl.firstChild;
var curToNodeKey;
var curFromNodeKey;
var fromNextSibling;
var toNextSibling;
var matchingFromEl;
outer:
while (curToNodeChild) {
toNextSibling = curToNodeChild.nextSibling;
curToNodeKey = getNodeKey(curToNodeChild);
while (curFromNodeChild) {
fromNextSibling = curFromNodeChild.nextSibling;
if (curToNodeChild.isSameNode && curToNodeChild.isSameNode(curFromNodeChild)) {
curToNodeChild = toNextSibling;
curFromNodeChild = fromNextSibling;
continue outer;
}
curFromNodeKey = getNodeKey(curFromNodeChild);
var curFromNodeType = curFromNodeChild.nodeType;
var isCompatible = void 0;
if (curFromNodeType === curToNodeChild.nodeType) {
if (curFromNodeType === ELEMENT_NODE) {
if (curToNodeKey) {
if (curToNodeKey !== curFromNodeKey) {
if (matchingFromEl = fromNodesLookup[curToNodeKey]) {
if (fromNextSibling === matchingFromEl) {
isCompatible = false;
} else {
fromEl.insertBefore(matchingFromEl, curFromNodeChild);
if (curFromNodeKey) {
addKeyedRemoval(curFromNodeKey);
} else {
removeNode(curFromNodeChild, fromEl, true);
}
curFromNodeChild = matchingFromEl;
}
} else {
isCompatible = false;
}
}
} else if (curFromNodeKey) {
isCompatible = false;
}
isCompatible = isCompatible !== false && compareNodeNames(curFromNodeChild, curToNodeChild);
if (isCompatible) {
morphEl(curFromNodeChild, curToNodeChild);
}
} else if (curFromNodeType === TEXT_NODE || curFromNodeType == COMMENT_NODE) {
isCompatible = true;
if (curFromNodeChild.nodeValue !== curToNodeChild.nodeValue) {
curFromNodeChild.nodeValue = curToNodeChild.nodeValue;
}
}
}
if (isCompatible) {
curToNodeChild = toNextSibling;
curFromNodeChild = fromNextSibling;
continue outer;
}
if (curFromNodeKey) {
addKeyedRemoval(curFromNodeKey);
} else {
removeNode(curFromNodeChild, fromEl, true);
}
curFromNodeChild = fromNextSibling;
}
if (curToNodeKey && (matchingFromEl = fromNodesLookup[curToNodeKey]) && compareNodeNames(matchingFromEl, curToNodeChild)) {
fromEl.appendChild(matchingFromEl);
morphEl(matchingFromEl, curToNodeChild);
} else {
var onBeforeNodeAddedResult = onBeforeNodeAdded(curToNodeChild);
if (onBeforeNodeAddedResult !== false) {
if (onBeforeNodeAddedResult) {
curToNodeChild = onBeforeNodeAddedResult;
}
if (curToNodeChild.actualize) {
curToNodeChild = curToNodeChild.actualize(fromEl.ownerDocument || doc);
}
fromEl.appendChild(curToNodeChild);
handleNodeAdded(curToNodeChild);
}
}
curToNodeChild = toNextSibling;
curFromNodeChild = fromNextSibling;
}
cleanupFromEl(fromEl, curFromNodeChild, curFromNodeKey);
var specialElHandler = specialElHandlers[fromEl.nodeName];
if (specialElHandler) {
specialElHandler(fromEl, toEl);
}
}
var morphedNode = fromNode;
var morphedNodeType = morphedNode.nodeType;
var toNodeType = toNode.nodeType;
if (!childrenOnly) {
if (morphedNodeType === ELEMENT_NODE) {
if (toNodeType === ELEMENT_NODE) {
if (!compareNodeNames(fromNode, toNode)) {
onNodeDiscarded(fromNode);
morphedNode = moveChildren(fromNode, createElementNS(toNode.nodeName, toNode.namespaceURI));
}
} else {
morphedNode = toNode;
}
} else if (morphedNodeType === TEXT_NODE || morphedNodeType === COMMENT_NODE) {
if (toNodeType === morphedNodeType) {
if (morphedNode.nodeValue !== toNode.nodeValue) {
morphedNode.nodeValue = toNode.nodeValue;
}
return morphedNode;
} else {
morphedNode = toNode;
}
}
}
if (morphedNode === toNode) {
onNodeDiscarded(fromNode);
} else {
if (toNode.isSameNode && toNode.isSameNode(morphedNode)) {
return;
}
morphEl(morphedNode, toNode, childrenOnly);
if (keyedRemovalList) {
for (var i = 0, len = keyedRemovalList.length; i < len; i++) {
var elToRemove = fromNodesLookup[keyedRemovalList[i]];
if (elToRemove) {
removeNode(elToRemove, elToRemove.parentNode, false);
}
}
}
}
if (!childrenOnly && morphedNode !== fromNode && fromNode.parentNode) {
if (morphedNode.actualize) {
morphedNode = morphedNode.actualize(fromNode.ownerDocument || doc);
}
fromNode.parentNode.replaceChild(morphedNode, fromNode);
}
return morphedNode;
};
}
var morphdom = morphdomFactory(morphAttrs);
var morphdom_esm_default = morphdom;
var DOMPatch = class {
static patchEl(fromEl, toEl, activeElement) {
morphdom_esm_default(fromEl, toEl, {
childrenOnly: false,
onBeforeElUpdated: (fromEl2, toEl2) => {
if (activeElement && activeElement.isSameNode(fromEl2) && dom_default.isFormInput(fromEl2)) {
dom_default.mergeFocusedInput(fromEl2, toEl2);
return false;
}
}
});
}
constructor(view, container, id, html, targetCID) {
this.view = view;
this.liveSocket = view.liveSocket;
this.container = container;
this.id = id;
this.rootID = view.root.id;
this.html = html;
this.targetCID = targetCID;
this.cidPatch = isCid(this.targetCID);
this.callbacks = {
beforeadded: [],
beforeupdated: [],
beforephxChildAdded: [],
afteradded: [],
afterupdated: [],
afterdiscarded: [],
afterphxChildAdded: [],
aftertransitionsDiscarded: []
};
}
before(kind, callback) {
this.callbacks[`before${kind}`].push(callback);
}
after(kind, callback) {
this.callbacks[`after${kind}`].push(callback);
}
trackBefore(kind, ...args) {
this.callbacks[`before${kind}`].forEach((callback) => callback(...args));
}
trackAfter(kind, ...args) {
this.callbacks[`after${kind}`].forEach((callback) => callback(...args));
}
markPrunableContentForRemoval() {
dom_default.all(this.container, "[phx-update=append] > *, [phx-update=prepend] > *", (el) => {
el.setAttribute(PHX_PRUNE, "");
});
}
perform() {
let { view, liveSocket: liveSocket2, container, html } = this;
let targetContainer = this.isCIDPatch() ? this.targetCIDContainer(html) : container;
if (this.isCIDPatch() && !targetContainer) {
return;
}
let focused = liveSocket2.getActiveElement();
let { selectionStart, selectionEnd } = focused && dom_default.hasSelectionRange(focused) ? focused : {};
let phxUpdate = liveSocket2.binding(PHX_UPDATE);
let phxFeedbackFor = liveSocket2.binding(PHX_FEEDBACK_FOR);
let disableWith = liveSocket2.binding(PHX_DISABLE_WITH);
let phxTriggerExternal = liveSocket2.binding(PHX_TRIGGER_ACTION);
let phxRemove = liveSocket2.binding("remove");
let added = [];
let updates = [];
let appendPrependUpdates = [];
let pendingRemoves = [];
let externalFormTriggered = null;
let diffHTML = liveSocket2.time("premorph container prep", () => {
return this.buildDiffHTML(container, html, phxUpdate, targetContainer);
});
this.trackBefore("added", container);
this.trackBefore("updated", container, container);
liveSocket2.time("morphdom", () => {
morphdom_esm_default(targetContainer, diffHTML, {
childrenOnly: targetContainer.getAttribute(PHX_COMPONENT) === null,
getNodeKey: (node) => {
return dom_default.isPhxDestroyed(node) ? null : node.id;
},
onBeforeNodeAdded: (el) => {
this.trackBefore("added", el);
return el;
},
onNodeAdded: (el) => {
if (el instanceof HTMLImageElement && el.srcset) {
el.srcset = el.srcset;
} else if (el instanceof HTMLVideoElement && el.autoplay) {
el.play();
}
if (dom_default.isNowTriggerFormExternal(el, phxTriggerExternal)) {
externalFormTriggered = el;
}
dom_default.discardError(targetContainer, el, phxFeedbackFor);
if (dom_default.isPhxChild(el) && view.ownsElement(el) || dom_default.isPhxSticky(el) && view.ownsElement(el.parentNode)) {
this.trackAfter("phxChildAdded", el);
}
added.push(el);
},
onNodeDiscarded: (el) => {
if (dom_default.isPhxChild(el) || dom_default.isPhxSticky(el)) {
liveSocket2.destroyViewByEl(el);
}
this.trackAfter("discarded", el);
},
onBeforeNodeDiscarded: (el) => {
if (el.getAttribute && el.getAttribute(PHX_PRUNE) !== null) {
return true;
}
if (el.parentNode !== null && dom_default.isPhxUpdate(el.parentNode, phxUpdate, ["append", "prepend"]) && el.id) {
return false;
}
if (el.getAttribute && el.getAttribute(phxRemove)) {
pendingRemoves.push(el);
return false;
}
if (this.skipCIDSibling(el)) {
return false;
}
return true;
},
onElUpdated: (el) => {
if (dom_default.isNowTriggerFormExternal(el, phxTriggerExternal)) {
externalFormTriggered = el;
}
updates.push(el);
},
onBeforeElUpdated: (fromEl, toEl) => {
dom_default.cleanChildNodes(toEl, phxUpdate);
if (this.skipCIDSibling(toEl)) {
return false;
}
if (dom_default.isPhxSticky(fromEl)) {
return false;
}
if (dom_default.isIgnored(fromEl, phxUpdate)) {
this.trackBefore("updated", fromEl, toEl);
dom_default.mergeAttrs(fromEl, toEl, { isIgnored: true });
updates.push(fromEl);
dom_default.applyStickyOperations(fromEl);
return false;
}
if (fromEl.type === "number" && (fromEl.validity && fromEl.validity.badInput)) {
return false;
}
if (!dom_default.syncPendingRef(fromEl, toEl, disableWith)) {
if (dom_default.isUploadInput(fromEl)) {
this.trackBefore("updated", fromEl, toEl);
updates.push(fromEl);
}
dom_default.applyStickyOperations(fromEl);
return false;
}
if (dom_default.isPhxChild(toEl)) {
let prevSession = fromEl.getAttribute(PHX_SESSION);
dom_default.mergeAttrs(fromEl, toEl, { exclude: [PHX_STATIC] });
if (prevSession !== "") {
fromEl.setAttribute(PHX_SESSION, prevSession);
}
fromEl.setAttribute(PHX_ROOT_ID, this.rootID);
dom_default.applyStickyOperations(fromEl);
return false;
}
dom_default.copyPrivates(toEl, fromEl);
dom_default.discardError(targetContainer, toEl, phxFeedbackFor);
let isFocusedFormEl = focused && fromEl.isSameNode(focused) && dom_default.isFormInput(fromEl);
if (isFocusedFormEl) {
this.trackBefore("updated", fromEl, toEl);
dom_default.mergeFocusedInput(fromEl, toEl);
dom_default.syncAttrsToProps(fromEl);
updates.push(fromEl);
dom_default.applyStickyOperations(fromEl);
return false;
} else {
if (dom_default.isPhxUpdate(toEl, phxUpdate, ["append", "prepend"])) {
appendPrependUpdates.push(new DOMPostMorphRestorer(fromEl, toEl, toEl.getAttribute(phxUpdate)));
}
dom_default.syncAttrsToProps(toEl);
dom_default.applyStickyOperations(toEl);
this.trackBefore("updated", fromEl, toEl);
return true;
}
}
});
});
if (liveSocket2.isDebugEnabled()) {
detectDuplicateIds();
}
if (appendPrependUpdates.length > 0) {
liveSocket2.time("post-morph append/prepend restoration", () => {
appendPrependUpdates.forEach((update) => update.perform());
});
}
liveSocket2.silenceEvents(() => dom_default.restoreFocus(focused, selectionStart, selectionEnd));
dom_default.dispatchEvent(document, "phx:update");
added.forEach((el) => this.trackAfter("added", el));
updates.forEach((el) => this.trackAfter("updated", el));
if (pendingRemoves.length > 0) {
liveSocket2.transitionRemoves(pendingRemoves);
liveSocket2.requestDOMUpdate(() => {
pendingRemoves.forEach((el) => {
let child = dom_default.firstPhxChild(el);
if (child) {
liveSocket2.destroyViewByEl(child);
}
el.remove();
});
this.trackAfter("transitionsDiscarded", pendingRemoves);
});
}
if (externalFormTriggered) {
liveSocket2.disconnect();
externalFormTriggered.submit();
}
return true;
}
isCIDPatch() {
return this.cidPatch;
}
skipCIDSibling(el) {
return el.nodeType === Node.ELEMENT_NODE && el.getAttribute(PHX_SKIP) !== null;
}
targetCIDContainer(html) {
if (!this.isCIDPatch()) {
return;
}
let [first, ...rest] = dom_default.findComponentNodeList(this.container, this.targetCID);
if (rest.length === 0 && dom_default.childNodeLength(html) === 1) {
return first;
} else {
return first && first.parentNode;
}
}
buildDiffHTML(container, html, phxUpdate, targetContainer) {
let isCIDPatch = this.isCIDPatch();
let isCIDWithSingleRoot = isCIDPatch && targetContainer.getAttribute(PHX_COMPONENT) === this.targetCID.toString();
if (!isCIDPatch || isCIDWithSingleRoot) {
return html;
} else {
let diffContainer = null;
let template = document.createElement("template");
diffContainer = dom_default.cloneNode(targetContainer);
let [firstComponent, ...rest] = dom_default.findComponentNodeList(diffContainer, this.targetCID);
template.innerHTML = html;
rest.forEach((el) => el.remove());
Array.from(diffContainer.childNodes).forEach((child) => {
if (child.id && child.nodeType === Node.ELEMENT_NODE && child.getAttribute(PHX_COMPONENT) !== this.targetCID.toString()) {
child.setAttribute(PHX_SKIP, "");
child.innerHTML = "";
}
});
Array.from(template.content.childNodes).forEach((el) => diffContainer.insertBefore(el, firstComponent));
firstComponent.remove();
return diffContainer.outerHTML;
}
}
};
var Rendered = class {
static extract(diff) {
let { [REPLY]: reply, [EVENTS]: events, [TITLE]: title } = diff;
delete diff[REPLY];
delete diff[EVENTS];
delete diff[TITLE];
return { diff, title, reply: reply || null, events: events || [] };
}
constructor(viewId, rendered) {
this.viewId = viewId;
this.rendered = {};
this.mergeDiff(rendered);
}
parentViewId() {
return this.viewId;
}
toString(onlyCids) {
return this.recursiveToString(this.rendered, this.rendered[COMPONENTS], onlyCids);
}
recursiveToString(rendered, components = rendered[COMPONENTS], onlyCids) {
onlyCids = onlyCids ? new Set(onlyCids) : null;
let output = { buffer: "", components, onlyCids };
this.toOutputBuffer(rendered, null, output);
return output.buffer;
}
componentCIDs(diff) {
return Object.keys(diff[COMPONENTS] || {}).map((i) => parseInt(i));
}
isComponentOnlyDiff(diff) {
if (!diff[COMPONENTS]) {
return false;
}
return Object.keys(diff).length === 1;
}
getComponent(diff, cid) {
return diff[COMPONENTS][cid];
}
mergeDiff(diff) {
let newc = diff[COMPONENTS];
let cache = {};
delete diff[COMPONENTS];
this.rendered = this.mutableMerge(this.rendered, diff);
this.rendered[COMPONENTS] = this.rendered[COMPONENTS] || {};
if (newc) {
let oldc = this.rendered[COMPONENTS];
for (let cid in newc) {
newc[cid] = this.cachedFindComponent(cid, newc[cid], oldc, newc, cache);
}
for (let cid in newc) {
oldc[cid] = newc[cid];
}
diff[COMPONENTS] = newc;
}
}
cachedFindComponent(cid, cdiff, oldc, newc, cache) {
if (cache[cid]) {
return cache[cid];
} else {
let ndiff, stat, scid = cdiff[STATIC];
if (isCid(scid)) {
let tdiff;
if (scid > 0) {
tdiff = this.cachedFindComponent(scid, newc[scid], oldc, newc, cache);
} else {
tdiff = oldc[-scid];
}
stat = tdiff[STATIC];
ndiff = this.cloneMerge(tdiff, cdiff);
ndiff[STATIC] = stat;
} else {
ndiff = cdiff[STATIC] !== void 0 ? cdiff : this.cloneMerge(oldc[cid] || {}, cdiff);
}
cache[cid] = ndiff;
return ndiff;
}
}
mutableMerge(target, source) {
if (source[STATIC] !== void 0) {
return source;
} else {
this.doMutableMerge(target, source);
return target;
}
}
doMutableMerge(target, source) {
for (let key in source) {
let val = source[key];
let targetVal = target[key];
if (isObject(val) && val[STATIC] === void 0 && isObject(targetVal)) {
this.doMutableMerge(targetVal, val);
} else {
target[key] = val;
}
}
}
cloneMerge(target, source) {
let merged = __spreadValues(__spreadValues({}, target), source);
for (let key in merged) {
let val = source[key];
let targetVal = target[key];
if (isObject(val) && val[STATIC] === void 0 && isObject(targetVal)) {
merged[key] = this.cloneMerge(targetVal, val);
}
}
return merged;
}
componentToString(cid) {
return this.recursiveCIDToString(this.rendered[COMPONENTS], cid);
}
pruneCIDs(cids) {
cids.forEach((cid) => delete this.rendered[COMPONENTS][cid]);
}
get() {
return this.rendered;
}
isNewFingerprint(diff = {}) {
return !!diff[STATIC];
}
templateStatic(part, templates) {
if (typeof part === "number") {
return templates[part];
} else {
return part;
}
}
toOutputBuffer(rendered, templates, output) {
if (rendered[DYNAMICS]) {
return this.comprehensionToBuffer(rendered, templates, output);
}
let { [STATIC]: statics } = rendered;
statics = this.templateStatic(statics, templates);
output.buffer += statics[0];
for (let i = 1; i < statics.length; i++) {
this.dynamicToBuffer(rendered[i - 1], templates, output);
output.buffer += statics[i];
}
}
comprehensionToBuffer(rendered, templates, output) {
let { [DYNAMICS]: dynamics, [STATIC]: statics } = rendered;
statics = this.templateStatic(statics, templates);
let compTemplates = templates || rendered[TEMPLATES];
for (let d = 0; d < dynamics.length; d++) {
let dynamic = dynamics[d];
output.buffer += statics[0];
for (let i = 1; i < statics.length; i++) {
this.dynamicToBuffer(dynamic[i - 1], compTemplates, output);
output.buffer += statics[i];
}
}
}
dynamicToBuffer(rendered, templates, output) {
if (typeof rendered === "number") {
output.buffer += this.recursiveCIDToString(output.components, rendered, output.onlyCids);
} else if (isObject(rendered)) {
this.toOutputBuffer(rendered, templates, output);
} else {
output.buffer += rendered;
}
}
recursiveCIDToString(components, cid, onlyCids) {
let component = components[cid] || logError(`no component for CID ${cid}`, components);
let template = document.createElement("template");
template.innerHTML = this.recursiveToString(component, components, onlyCids);
let container = template.content;
let skip = onlyCids && !onlyCids.has(cid);
let [hasChildNodes, hasChildComponents] = Array.from(container.childNodes).reduce(([hasNodes, hasComponents], child, i) => {
if (child.nodeType === Node.ELEMENT_NODE) {
if (child.getAttribute(PHX_COMPONENT)) {
return [hasNodes, true];
}
child.setAttribute(PHX_COMPONENT, cid);
if (!child.id) {
child.id = `${this.parentViewId()}-${cid}-${i}`;
}
if (skip) {
child.setAttribute(PHX_SKIP, "");
child.innerHTML = "";
}
return [true, hasComponents];
} else {
if (child.nodeValue.trim() !== "") {
logError(`only HTML element tags are allowed at the root of components.
got: "${child.nodeValue.trim()}"
within:
`, template.innerHTML.trim());
child.replaceWith(this.createSpan(child.nodeValue, cid));
return [true, hasComponents];
} else {
child.remove();
return [hasNodes, hasComponents];
}
}
}, [false, false]);
if (!hasChildNodes && !hasChildComponents) {
logError("expected at least one HTML element tag inside a component, but the component is empty:\n", template.innerHTML.trim());
return this.createSpan("", cid).outerHTML;
} else if (!hasChildNodes && hasChildComponents) {
logError("expected at least one HTML element tag directly inside a component, but only subcomponents were found. A component must render at least one HTML tag directly inside itself.", template.innerHTML.trim());
return template.innerHTML;
} else {
return template.innerHTML;
}
}
createSpan(text, cid) {
let span = document.createElement("span");
span.innerText = text;
span.setAttribute(PHX_COMPONENT, cid);
return span;
}
};
var viewHookID = 1;
var ViewHook = class {
static makeID() {
return viewHookID++;
}
static elementID(el) {
return el.phxHookId;
}
constructor(view, el, callbacks) {
this.__view = view;
this.liveSocket = view.liveSocket;
this.__callbacks = callbacks;
this.__listeners = /* @__PURE__ */ new Set();
this.__isDisconnected = false;
this.el = el;
this.el.phxHookId = this.constructor.makeID();
for (let key in this.__callbacks) {
this[key] = this.__callbacks[key];
}
}
__mounted() {
this.mounted && this.mounted();
}
__updated() {
this.updated && this.updated();
}
__beforeUpdate() {
this.beforeUpdate && this.beforeUpdate();
}
__destroyed() {
this.destroyed && this.destroyed();
}
__reconnected() {
if (this.__isDisconnected) {
this.__isDisconnected = false;
this.reconnected && this.reconnected();
}
}
__disconnected() {
this.__isDisconnected = true;
this.disconnected && this.disconnected();
}
pushEvent(event, payload = {}, onReply = function() {
}) {
return this.__view.pushHookEvent(null, event, payload, onReply);
}
pushEventTo(phxTarget, event, payload = {}, onReply = function() {
}) {
return this.__view.withinTargets(phxTarget, (view, targetCtx) => {
return view.pushHookEvent(targetCtx, event, payload, onReply);
});
}
handleEvent(event, callback) {
let callbackRef = (customEvent, bypass) => bypass ? event : callback(customEvent.detail);
window.addEventListener(`phx:${event}`, callbackRef);
this.__listeners.add(callbackRef);
return callbackRef;
}
removeHandleEvent(callbackRef) {
let event = callbackRef(null, true);
window.removeEventListener(`phx:${event}`, callbackRef);
this.__listeners.delete(callbackRef);
}
upload(name, files) {
return this.__view.dispatchUploads(name, files);
}
uploadTo(phxTarget, name, files) {
return this.__view.withinTargets(phxTarget, (view) => view.dispatchUploads(name, files));
}
__cleanup__() {
this.__listeners.forEach((callbackRef) => this.removeHandleEvent(callbackRef));
}
};
var JS = {
exec(eventType, phxEvent, view, sourceEl, defaults) {
let [defaultKind, defaultArgs] = defaults || [null, {}];
let commands = phxEvent.charAt(0) === "[" ? JSON.parse(phxEvent) : [[defaultKind, defaultArgs]];
commands.forEach(([kind, args]) => {
if (kind === defaultKind && defaultArgs.data) {
args.data = Object.assign(args.data || {}, defaultArgs.data);
}
this.filterToEls(sourceEl, args).forEach((el) => {
this[`exec_${kind}`](eventType, phxEvent, view, sourceEl, el, args);
});
});
},
isVisible(el) {
return !!(el.offsetWidth || el.offsetHeight || el.getClientRects().length > 0);
},
exec_dispatch(eventType, phxEvent, view, sourceEl, el, { to, event, detail, bubbles }) {
detail = detail || {};
detail.dispatcher = sourceEl;
dom_default.dispatchEvent(el, event, { detail, bubbles });
},
exec_push(eventType, phxEvent, view, sourceEl, el, args) {
if (!view.isConnected()) {
return;
}
let { event, data, target, page_loading, loading, value, dispatcher } = args;
let pushOpts = { loading, value, target, page_loading: !!page_loading };
let targetSrc = eventType === "change" && dispatcher ? dispatcher : sourceEl;
let phxTarget = target || targetSrc.getAttribute(view.binding("target")) || targetSrc;
view.withinTargets(phxTarget, (targetView, targetCtx) => {
if (eventType === "change") {
let { newCid, _target, callback } = args;
_target = _target || (sourceEl instanceof HTMLInputElement ? sourceEl.name : void 0);
if (_target) {
pushOpts._target = _target;
}
targetView.pushInput(sourceEl, targetCtx, newCid, event || phxEvent, pushOpts, callback);
} else if (eventType === "submit") {
targetView.submitForm(sourceEl, targetCtx, event || phxEvent, pushOpts);
} else {
targetView.pushEvent(eventType, sourceEl, targetCtx, event || phxEvent, data, pushOpts);
}
});
},
exec_add_class(eventType, phxEvent, view, sourceEl, el, { names, transition, time }) {
this.addOrRemoveClasses(el, names, [], transition, time, view);
},
exec_remove_class(eventType, phxEvent, view, sourceEl, el, { names, transition, time }) {
this.addOrRemoveClasses(el, [], names, transition, time, view);
},
exec_transition(eventType, phxEvent, view, sourceEl, el, { time, transition }) {
let [transition_start, running, transition_end] = transition;
let onStart = () => this.addOrRemoveClasses(el, transition_start.concat(running), []);
let onDone = () => this.addOrRemoveClasses(el, transition_end, transition_start.concat(running));
view.transition(time, onStart, onDone);
},
exec_toggle(eventType, phxEvent, view, sourceEl, el, { display, ins, outs, time }) {
this.toggle(eventType, view, el, display, ins, outs, time);
},
exec_show(eventType, phxEvent, view, sourceEl, el, { display, transition, time }) {
this.show(eventType, view, el, display, transition, time);
},
exec_hide(eventType, phxEvent, view, sourceEl, el, { display, transition, time }) {
this.hide(eventType, view, el, display, transition, time);
},
exec_set_attr(eventType, phxEvent, view, sourceEl, el, { attr: [attr, val] }) {
this.setOrRemoveAttrs(el, [[attr, val]], []);
},
exec_remove_attr(eventType, phxEvent, view, sourceEl, el, { attr }) {
this.setOrRemoveAttrs(el, [], [attr]);
},
show(eventType, view, el, display, transition, time) {
if (!this.isVisible(el)) {
this.toggle(eventType, view, el, display, transition, null, time);
}
},
hide(eventType, view, el, display, transition, time) {
if (this.isVisible(el)) {
this.toggle(eventType, view, el, display, null, transition, time);
}
},
toggle(eventType, view, el, display, ins, outs, time) {
let [inClasses, inStartClasses, inEndClasses] = ins || [[], [], []];
let [outClasses, outStartClasses, outEndClasses] = outs || [[], [], []];
if (inClasses.length > 0 || outClasses.length > 0) {
if (this.isVisible(el)) {
let onStart = () => {
this.addOrRemoveClasses(el, outStartClasses, inClasses.concat(inStartClasses).concat(inEndClasses));
window.requestAnimationFrame(() => {
this.addOrRemoveClasses(el, outClasses, []);
window.requestAnimationFrame(() => this.addOrRemoveClasses(el, outEndClasses, outStartClasses));
});
};
el.dispatchEvent(new Event("phx:hide-start"));
view.transition(time, onStart, () => {
this.addOrRemoveClasses(el, [], outClasses.concat(outEndClasses));
dom_default.putSticky(el, "toggle", (currentEl) => currentEl.style.display = "none");
el.dispatchEvent(new Event("phx:hide-end"));
});
} else {
if (eventType === "remove") {
return;
}
let onStart = () => {
this.addOrRemoveClasses(el, inStartClasses, outClasses.concat(outStartClasses).concat(outEndClasses));
dom_default.putSticky(el, "toggle", (currentEl) => currentEl.style.display = display || "block");
window.requestAnimationFrame(() => {
this.addOrRemoveClasses(el, inClasses, []);
window.requestAnimationFrame(() => this.addOrRemoveClasses(el, inEndClasses, inStartClasses));
});
};
el.dispatchEvent(new Event("phx:show-start"));
view.transition(time, onStart, () => {
this.addOrRemoveClasses(el, [], inClasses.concat(inEndClasses));
el.dispatchEvent(new Event("phx:show-end"));
});
}
} else {
if (this.isVisible(el)) {
window.requestAnimationFrame(() => {
el.dispatchEvent(new Event("phx:hide-start"));
dom_default.putSticky(el, "toggle", (currentEl) => currentEl.style.display = "none");
el.dispatchEvent(new Event("phx:hide-end"));
});
} else {
window.requestAnimationFrame(() => {
el.dispatchEvent(new Event("phx:show-start"));
dom_default.putSticky(el, "toggle", (currentEl) => currentEl.style.display = display || "block");
el.dispatchEvent(new Event("phx:show-end"));
});
}
}
},
addOrRemoveClasses(el, adds, removes, transition, time, view) {
let [transition_run, transition_start, transition_end] = transition || [[], [], []];
if (transition_run.length > 0) {
let onStart = () => this.addOrRemoveClasses(el, transition_start.concat(transition_run), []);
let onDone = () => this.addOrRemoveClasses(el, adds.concat(transition_end), removes.concat(transition_run).concat(transition_start));
return view.transition(time, onStart, onDone);
}
window.requestAnimationFrame(() => {
let [prevAdds, prevRemoves] = dom_default.getSticky(el, "classes", [[], []]);
let keepAdds = adds.filter((name) => prevAdds.indexOf(name) < 0 && !el.classList.contains(name));
let keepRemoves = removes.filter((name) => prevRemoves.indexOf(name) < 0 && el.classList.contains(name));
let newAdds = prevAdds.filter((name) => removes.indexOf(name) < 0).concat(keepAdds);
let newRemoves = prevRemoves.filter((name) => adds.indexOf(name) < 0).concat(keepRemoves);
dom_default.putSticky(el, "classes", (currentEl) => {
currentEl.classList.remove(...newRemoves);
currentEl.classList.add(...newAdds);
return [newAdds, newRemoves];
});
});
},
setOrRemoveAttrs(el, sets, removes) {
let [prevSets, prevRemoves] = dom_default.getSticky(el, "attrs", [[], []]);
let alteredAttrs = sets.map(([attr, _val]) => attr).concat(removes);
let newSets = prevSets.filter(([attr, _val]) => !alteredAttrs.includes(attr)).concat(sets);
let newRemoves = prevRemoves.filter((attr) => !alteredAttrs.includes(attr)).concat(removes);
dom_default.putSticky(el, "attrs", (currentEl) => {
newRemoves.forEach((attr) => currentEl.removeAttribute(attr));
newSets.forEach(([attr, val]) => currentEl.setAttribute(attr, val));
return [newSets, newRemoves];
});
},
hasAllClasses(el, classes) {
return classes.every((name) => el.classList.contains(name));
},
isToggledOut(el, outClasses) {
return !this.isVisible(el) || this.hasAllClasses(el, outClasses);
},
filterToEls(sourceEl, { to }) {
return to ? dom_default.all(document, to) : [sourceEl];
}
};
var js_default = JS;
var serializeForm = (form, meta, onlyNames = []) => {
let formData = new FormData(form);
let toRemove = [];
formData.forEach((val, key, _index) => {
if (val instanceof File) {
toRemove.push(key);
}
});
toRemove.forEach((key) => formData.delete(key));
let params = new URLSearchParams();
for (let [key, val] of formData.entries()) {
if (onlyNames.length === 0 || onlyNames.indexOf(key) >= 0) {
params.append(key, val);
}
}
for (let metaKey in meta) {
params.append(metaKey, meta[metaKey]);
}
return params.toString();
};
var View = class {
constructor(el, liveSocket2, parentView, flash) {
this.liveSocket = liveSocket2;
this.flash = flash;
this.parent = parentView;
this.root = parentView ? parentView.root : this;
this.el = el;
this.id = this.el.id;
this.ref = 0;
this.childJoins = 0;
this.loaderTimer = null;
this.pendingDiffs = [];
this.pruningCIDs = [];
this.redirect = false;
this.href = null;
this.joinCount = this.parent ? this.parent.joinCount - 1 : 0;
this.joinPending = true;
this.destroyed = false;
this.joinCallback = function(onDone) {
onDone && onDone();
};
this.stopCallback = function() {
};
this.pendingJoinOps = this.parent ? null : [];
this.viewHooks = {};
this.uploaders = {};
this.formSubmits = [];
this.children = this.parent ? null : {};
this.root.children[this.id] = {};
this.channel = this.liveSocket.channel(`lv:${this.id}`, () => {
return {
redirect: this.redirect ? this.href : void 0,
url: this.redirect ? void 0 : this.href || void 0,
params: this.connectParams(),
session: this.getSession(),
static: this.getStatic(),
flash: this.flash
};
});
this.showLoader(this.liveSocket.loaderTimeout);
this.bindChannel();
}
setHref(href) {
this.href = href;
}
setRedirect(href) {
this.redirect = true;
this.href = href;
}
isMain() {
return this.el.hasAttribute(PHX_MAIN);
}
connectParams() {
let params = this.liveSocket.params(this.el);
let manifest = dom_default.all(document, `[${this.binding(PHX_TRACK_STATIC)}]`).map((node) => node.src || node.href).filter((url) => typeof url === "string");
if (manifest.length > 0) {
params["_track_static"] = manifest;
}
params["_mounts"] = this.joinCount;
return params;
}
isConnected() {
return this.channel.canPush();
}
getSession() {
return this.el.getAttribute(PHX_SESSION);
}
getStatic() {
let val = this.el.getAttribute(PHX_STATIC);
return val === "" ? null : val;
}
destroy(callback = function() {
}) {
this.destroyAllChildren();
this.destroyed = true;
delete this.root.children[this.id];
if (this.parent) {
delete this.root.children[this.parent.id][this.id];
}
clearTimeout(this.loaderTimer);
let onFinished = () => {
callback();
for (let id in this.viewHooks) {
this.destroyHook(this.viewHooks[id]);
}
};
dom_default.markPhxChildDestroyed(this.el);
this.log("destroyed", () => ["the child has been removed from the parent"]);
this.channel.leave().receive("ok", onFinished).receive("error", onFinished).receive("timeout", onFinished);
}
setContainerClasses(...classes) {
this.el.classList.remove(PHX_CONNECTED_CLASS, PHX_DISCONNECTED_CLASS, PHX_ERROR_CLASS);
this.el.classList.add(...classes);
}
showLoader(timeout) {
clearTimeout(this.loaderTimer);
if (timeout) {
this.loaderTimer = setTimeout(() => this.showLoader(), timeout);
} else {
for (let id in this.viewHooks) {
this.viewHooks[id].__disconnected();
}
this.setContainerClasses(PHX_DISCONNECTED_CLASS);
}
}
hideLoader() {
clearTimeout(this.loaderTimer);
this.setContainerClasses(PHX_CONNECTED_CLASS);
}
triggerReconnected() {
for (let id in this.viewHooks) {
this.viewHooks[id].__reconnected();
}
}
log(kind, msgCallback) {
this.liveSocket.log(this, kind, msgCallback);
}
transition(time, onStart, onDone = function() {
}) {
this.liveSocket.transition(time, onStart, onDone);
}
withinTargets(phxTarget, callback) {
if (phxTarget instanceof HTMLElement || phxTarget instanceof SVGElement) {
return this.liveSocket.owner(phxTarget, (view) => callback(view, phxTarget));
}
if (isCid(phxTarget)) {
let targets = dom_default.findComponentNodeList(this.el, phxTarget);
if (targets.length === 0) {
logError(`no component found matching phx-target of ${phxTarget}`);
} else {
callback(this, parseInt(phxTarget));
}
} else {
let targets = Array.from(document.querySelectorAll(phxTarget));
if (targets.length === 0) {
logError(`nothing found matching the phx-target selector "${phxTarget}"`);
}
targets.forEach((target) => this.liveSocket.owner(target, (view) => callback(view, target)));
}
}
applyDiff(type, rawDiff, callback) {
this.log(type, () => ["", clone(rawDiff)]);
let { diff, reply, events, title } = Rendered.extract(rawDiff);
if (title) {
dom_default.putTitle(title);
}
callback({ diff, reply, events });
return reply;
}
onJoin(resp) {
let { rendered, container } = resp;
if (container) {
let [tag, attrs] = container;
this.el = dom_default.replaceRootContainer(this.el, tag, attrs);
}
this.childJoins = 0;
this.joinPending = true;
this.flash = null;
browser_default.dropLocal(this.liveSocket.localStorage, window.location.pathname, CONSECUTIVE_RELOADS);
this.applyDiff("mount", rendered, ({ diff, events }) => {
this.rendered = new Rendered(this.id, diff);
let html = this.renderContainer(null, "join");
this.dropPendingRefs();
let forms = this.formsForRecovery(html);
this.joinCount++;
if (forms.length > 0) {
forms.forEach(([form, newForm, newCid], i) => {
this.pushFormRecovery(form, newCid, (resp2) => {
if (i === forms.length - 1) {
this.onJoinComplete(resp2, html, events);
}
});
});
} else {
this.onJoinComplete(resp, html, events);
}
});
}
dropPendingRefs() {
dom_default.all(document, `[${PHX_REF_SRC}="${this.id}"][${PHX_REF}]`, (el) => {
el.removeAttribute(PHX_REF);
el.removeAttribute(PHX_REF_SRC);
});
}
onJoinComplete({ live_patch }, html, events) {
if (this.joinCount > 1 || this.parent && !this.parent.isJoinPending()) {
return this.applyJoinPatch(live_patch, html, events);
}
let newChildren = dom_default.findPhxChildrenInFragment(html, this.id).filter((toEl) => {
let fromEl = toEl.id && this.el.querySelector(`[id="${toEl.id}"]`);
let phxStatic = fromEl && fromEl.getAttribute(PHX_STATIC);
if (phxStatic) {
toEl.setAttribute(PHX_STATIC, phxStatic);
}
return this.joinChild(toEl);
});
if (newChildren.length === 0) {
if (this.parent) {
this.root.pendingJoinOps.push([this, () => this.applyJoinPatch(live_patch, html, events)]);
this.parent.ackJoin(this);
} else {
this.onAllChildJoinsComplete();
this.applyJoinPatch(live_patch, html, events);
}
} else {
this.root.pendingJoinOps.push([this, () => this.applyJoinPatch(live_patch, html, events)]);
}
}
attachTrueDocEl() {
this.el = dom_default.byId(this.id);
this.el.setAttribute(PHX_ROOT_ID, this.root.id);
}
applyJoinPatch(live_patch, html, events) {
this.attachTrueDocEl();
let patch = new DOMPatch(this, this.el, this.id, html, null);
patch.markPrunableContentForRemoval();
this.performPatch(patch, false);
this.joinNewChildren();
dom_default.all(this.el, `[${this.binding(PHX_HOOK)}], [data-phx-${PHX_HOOK}]`, (hookEl) => {
let hook = this.addHook(hookEl);
if (hook) {
hook.__mounted();
}
});
this.joinPending = false;
this.liveSocket.dispatchEvents(events);
this.applyPendingUpdates();
if (live_patch) {
let { kind, to } = live_patch;
this.liveSocket.historyPatch(to, kind);
}
this.hideLoader();
if (this.joinCount > 1) {
this.triggerReconnected();
}
this.stopCallback();
}
triggerBeforeUpdateHook(fromEl, toEl) {
this.liveSocket.triggerDOM("onBeforeElUpdated", [fromEl, toEl]);
let hook = this.getHook(fromEl);
let isIgnored = hook && dom_default.isIgnored(fromEl, this.binding(PHX_UPDATE));
if (hook && !fromEl.isEqualNode(toEl) && !(isIgnored && isEqualObj(fromEl.dataset, toEl.dataset))) {
hook.__beforeUpdate();
return hook;
}
}
performPatch(patch, pruneCids) {
let removedEls = [];
let phxChildrenAdded = false;
let updatedHookIds = /* @__PURE__ */ new Set();
patch.after("added", (el) => {
this.liveSocket.triggerDOM("onNodeAdded", [el]);
let newHook = this.addHook(el);
if (newHook) {
newHook.__mounted();
}
});
patch.after("phxChildAdded", (el) => {
if (dom_default.isPhxSticky(el)) {
this.liveSocket.joinRootViews();
} else {
phxChildrenAdded = true;
}
});
patch.before("updated", (fromEl, toEl) => {
let hook = this.triggerBeforeUpdateHook(fromEl, toEl);
if (hook) {
updatedHookIds.add(fromEl.id);
}
});
patch.after("updated", (el) => {
if (updatedHookIds.has(el.id)) {
this.getHook(el).__updated();
}
});
patch.after("discarded", (el) => {
if (el.nodeType === Node.ELEMENT_NODE) {
removedEls.push(el);
}
});
patch.after("transitionsDiscarded", (els) => this.afterElementsRemoved(els, pruneCids));
patch.perform();
this.afterElementsRemoved(removedEls, pruneCids);
return phxChildrenAdded;
}
afterElementsRemoved(elements, pruneCids) {
let destroyedCIDs = [];
elements.forEach((parent) => {
let components = dom_default.all(parent, `[${PHX_COMPONENT}]`);
let hooks = dom_default.all(parent, `[${this.binding(PHX_HOOK)}]`);
components.concat(parent).forEach((el) => {
let cid = this.componentID(el);
if (isCid(cid) && destroyedCIDs.indexOf(cid) === -1) {
destroyedCIDs.push(cid);
}
});
hooks.concat(parent).forEach((hookEl) => {
let hook = this.getHook(hookEl);
hook && this.destroyHook(hook);
});
});
if (pruneCids) {
this.maybePushComponentsDestroyed(destroyedCIDs);
}
}
joinNewChildren() {
dom_default.findPhxChildren(this.el, this.id).forEach((el) => this.joinChild(el));
}
getChildById(id) {
return this.root.children[this.id][id];
}
getDescendentByEl(el) {
if (el.id === this.id) {
return this;
} else {
return this.children[el.getAttribute(PHX_PARENT_ID)][el.id];
}
}
destroyDescendent(id) {
for (let parentId in this.root.children) {
for (let childId in this.root.children[parentId]) {
if (childId === id) {
return this.root.children[parentId][childId].destroy();
}
}
}
}
joinChild(el) {
let child = this.getChildById(el.id);
if (!child) {
let view = new View(el, this.liveSocket, this);
this.root.children[this.id][view.id] = view;
view.join();
this.childJoins++;
return true;
}
}
isJoinPending() {
return this.joinPending;
}
ackJoin(_child) {
this.childJoins--;
if (this.childJoins === 0) {
if (this.parent) {
this.parent.ackJoin(this);
} else {
this.onAllChildJoinsComplete();
}
}
}
onAllChildJoinsComplete() {
this.joinCallback(() => {
this.pendingJoinOps.forEach(([view, op]) => {
if (!view.isDestroyed()) {
op();
}
});
this.pendingJoinOps = [];
});
}
update(diff, events) {
if (this.isJoinPending() || this.liveSocket.hasPendingLink() && !dom_default.isPhxSticky(this.el)) {
return this.pendingDiffs.push({ diff, events });
}
this.rendered.mergeDiff(diff);
let phxChildrenAdded = false;
if (this.rendered.isComponentOnlyDiff(diff)) {
this.liveSocket.time("component patch complete", () => {
let parentCids = dom_default.findParentCIDs(this.el, this.rendered.componentCIDs(diff));
parentCids.forEach((parentCID) => {
if (this.componentPatch(this.rendered.getComponent(diff, parentCID), parentCID)) {
phxChildrenAdded = true;
}
});
});
} else if (!isEmpty(diff)) {
this.liveSocket.time("full patch complete", () => {
let html = this.renderContainer(diff, "update");
let patch = new DOMPatch(this, this.el, this.id, html, null);
phxChildrenAdded = this.performPatch(patch, true);
});
}
this.liveSocket.dispatchEvents(events);
if (phxChildrenAdded) {
this.joinNewChildren();
}
}
renderContainer(diff, kind) {
return this.liveSocket.time(`toString diff (${kind})`, () => {
let tag = this.el.tagName;
let cids = diff ? this.rendered.componentCIDs(diff).concat(this.pruningCIDs) : null;
let html = this.rendered.toString(cids);
return `<${tag}>${html}</${tag}>`;
});
}
componentPatch(diff, cid) {
if (isEmpty(diff))
return false;
let html = this.rendered.componentToString(cid);
let patch = new DOMPatch(this, this.el, this.id, html, cid);
let childrenAdded = this.performPatch(patch, true);
return childrenAdded;
}
getHook(el) {
return this.viewHooks[ViewHook.elementID(el)];
}
addHook(el) {
if (ViewHook.elementID(el) || !el.getAttribute) {
return;
}
let hookName = el.getAttribute(`data-phx-${PHX_HOOK}`) || el.getAttribute(this.binding(PHX_HOOK));
if (hookName && !this.ownsElement(el)) {
return;
}
let callbacks = this.liveSocket.getHookCallbacks(hookName);
if (callbacks) {
if (!el.id) {
logError(`no DOM ID for hook "${hookName}". Hooks require a unique ID on each element.`, el);
}
let hook = new ViewHook(this, el, callbacks);
this.viewHooks[ViewHook.elementID(hook.el)] = hook;
return hook;
} else if (hookName !== null) {
logError(`unknown hook found for "${hookName}"`, el);
}
}
destroyHook(hook) {
hook.__destroyed();
hook.__cleanup__();
delete this.viewHooks[ViewHook.elementID(hook.el)];
}
applyPendingUpdates() {
this.pendingDiffs.forEach(({ diff, events }) => this.update(diff, events));
this.pendingDiffs = [];
}
onChannel(event, cb) {
this.liveSocket.onChannel(this.channel, event, (resp) => {
if (this.isJoinPending()) {
this.root.pendingJoinOps.push([this, () => cb(resp)]);
} else {
this.liveSocket.requestDOMUpdate(() => cb(resp));
}
});
}
bindChannel() {
this.liveSocket.onChannel(this.channel, "diff", (rawDiff) => {
this.liveSocket.requestDOMUpdate(() => {
this.applyDiff("update", rawDiff, ({ diff, events }) => this.update(diff, events));
});
});
this.onChannel("redirect", ({ to, flash }) => this.onRedirect({ to, flash }));
this.onChannel("live_patch", (redir) => this.onLivePatch(redir));
this.onChannel("live_redirect", (redir) => this.onLiveRedirect(redir));
this.channel.onError((reason) => this.onError(reason));
this.channel.onClose((reason) => this.onClose(reason));
}
destroyAllChildren() {
for (let id in this.root.children[this.id]) {
this.getChildById(id).destroy();
}
}
onLiveRedirect(redir) {
let { to, kind, flash } = redir;
let url = this.expandURL(to);
this.liveSocket.historyRedirect(url, kind, flash);
}
onLivePatch(redir) {
let { to, kind } = redir;
this.href = this.expandURL(to);
this.liveSocket.historyPatch(to, kind);
}
expandURL(to) {
return to.startsWith("/") ? `${window.location.protocol}//${window.location.host}${to}` : to;
}
onRedirect({ to, flash }) {
this.liveSocket.redirect(to, flash);
}
isDestroyed() {
return this.destroyed;
}
join(callback) {
if (this.isMain()) {
this.stopCallback = this.liveSocket.withPageLoading({ to: this.href, kind: "initial" });
}
this.joinCallback = (onDone) => {
onDone = onDone || function() {
};
callback ? callback(this.joinCount, onDone) : onDone();
};
this.liveSocket.wrapPush(this, { timeout: false }, () => {
return this.channel.join().receive("ok", (data) => {
if (!this.isDestroyed()) {
this.liveSocket.requestDOMUpdate(() => this.onJoin(data));
}
}).receive("error", (resp) => !this.isDestroyed() && this.onJoinError(resp)).receive("timeout", () => !this.isDestroyed() && this.onJoinError({ reason: "timeout" }));
});
}
onJoinError(resp) {
if (resp.reason === "unauthorized" || resp.reason === "stale") {
this.log("error", () => ["unauthorized live_redirect. Falling back to page request", resp]);
return this.onRedirect({ to: this.href });
}
if (resp.redirect || resp.live_redirect) {
this.joinPending = false;
this.channel.leave();
}
if (resp.redirect) {
return this.onRedirect(resp.redirect);
}
if (resp.live_redirect) {
return this.onLiveRedirect(resp.live_redirect);
}
this.log("error", () => ["unable to join", resp]);
if (this.liveSocket.isConnected()) {
this.liveSocket.reloadWithJitter(this);
}
}
onClose(reason) {
if (this.isDestroyed()) {
return;
}
if (this.liveSocket.hasPendingLink() && reason !== "leave") {
return this.liveSocket.reloadWithJitter(this);
}
this.destroyAllChildren();
this.liveSocket.dropActiveElement(this);
if (document.activeElement) {
document.activeElement.blur();
}
if (this.liveSocket.isUnloaded()) {
this.showLoader(BEFORE_UNLOAD_LOADER_TIMEOUT);
}
}
onError(reason) {
this.onClose(reason);
if (this.liveSocket.isConnected()) {
this.log("error", () => ["view crashed", reason]);
}
if (!this.liveSocket.isUnloaded()) {
this.displayError();
}
}
displayError() {
if (this.isMain()) {
dom_default.dispatchEvent(window, "phx:page-loading-start", { detail: { to: this.href, kind: "error" } });
}
this.showLoader();
this.setContainerClasses(PHX_DISCONNECTED_CLASS, PHX_ERROR_CLASS);
}
pushWithReply(refGenerator, event, payload, onReply = function() {
}) {
if (!this.isConnected()) {
return;
}
let [ref, [el], opts] = refGenerator ? refGenerator() : [null, [], {}];
let onLoadingDone = function() {
};
if (opts.page_loading || el && el.getAttribute(this.binding(PHX_PAGE_LOADING)) !== null) {
onLoadingDone = this.liveSocket.withPageLoading({ kind: "element", target: el });
}
if (typeof payload.cid !== "number") {
delete payload.cid;
}
return this.liveSocket.wrapPush(this, { timeout: true }, () => {
return this.channel.push(event, payload, PUSH_TIMEOUT).receive("ok", (resp) => {
if (ref !== null) {
this.undoRefs(ref);
}
let finish = (hookReply) => {
if (resp.redirect) {
this.onRedirect(resp.redirect);
}
if (resp.live_patch) {
this.onLivePatch(resp.live_patch);
}
if (resp.live_redirect) {
this.onLiveRedirect(resp.live_redirect);
}
onLoadingDone();
onReply(resp, hookReply);
};
if (resp.diff) {
this.liveSocket.requestDOMUpdate(() => {
let hookReply = this.applyDiff("update", resp.diff, ({ diff, events }) => {
this.update(diff, events);
});
finish(hookReply);
});
} else {
finish(null);
}
});
});
}
undoRefs(ref) {
dom_default.all(document, `[${PHX_REF_SRC}="${this.id}"][${PHX_REF}="${ref}"]`, (el) => {
let disabledVal = el.getAttribute(PHX_DISABLED);
el.removeAttribute(PHX_REF);
el.removeAttribute(PHX_REF_SRC);
if (el.getAttribute(PHX_READONLY) !== null) {
el.readOnly = false;
el.removeAttribute(PHX_READONLY);
}
if (disabledVal !== null) {
el.disabled = disabledVal === "true" ? true : false;
el.removeAttribute(PHX_DISABLED);
}
PHX_EVENT_CLASSES.forEach((className) => dom_default.removeClass(el, className));
let disableRestore = el.getAttribute(PHX_DISABLE_WITH_RESTORE);
if (disableRestore !== null) {
el.innerText = disableRestore;
el.removeAttribute(PHX_DISABLE_WITH_RESTORE);
}
let toEl = dom_default.private(el, PHX_REF);
if (toEl) {
let hook = this.triggerBeforeUpdateHook(el, toEl);
DOMPatch.patchEl(el, toEl, this.liveSocket.getActiveElement());
if (hook) {
hook.__updated();
}
dom_default.deletePrivate(el, PHX_REF);
}
});
}
putRef(elements, event, opts = {}) {
let newRef = this.ref++;
let disableWith = this.binding(PHX_DISABLE_WITH);
if (opts.loading) {
elements = elements.concat(dom_default.all(document, opts.loading));
}
elements.forEach((el) => {
el.classList.add(`phx-${event}-loading`);
el.setAttribute(PHX_REF, newRef);
el.setAttribute(PHX_REF_SRC, this.el.id);
let disableText = el.getAttribute(disableWith);
if (disableText !== null) {
if (!el.getAttribute(PHX_DISABLE_WITH_RESTORE)) {
el.setAttribute(PHX_DISABLE_WITH_RESTORE, el.innerText);
}
if (disableText !== "") {
el.innerText = disableText;
}
el.setAttribute("disabled", "");
}
});
return [newRef, elements, opts];
}
componentID(el) {
let cid = el.getAttribute && el.getAttribute(PHX_COMPONENT);
return cid ? parseInt(cid) : null;
}
targetComponentID(target, targetCtx, opts = {}) {
if (isCid(targetCtx)) {
return targetCtx;
}
let cidOrSelector = target.getAttribute(this.binding("target"));
if (isCid(cidOrSelector)) {
return parseInt(cidOrSelector);
} else if (targetCtx && (cidOrSelector !== null || opts.target)) {
return this.closestComponentID(targetCtx);
} else {
return null;
}
}
closestComponentID(targetCtx) {
if (isCid(targetCtx)) {
return targetCtx;
} else if (targetCtx) {
return maybe(targetCtx.closest(`[${PHX_COMPONENT}]`), (el) => this.ownsElement(el) && this.componentID(el));
} else {
return null;
}
}
pushHookEvent(targetCtx, event, payload, onReply) {
if (!this.isConnected()) {
this.log("hook", () => ["unable to push hook event. LiveView not connected", event, payload]);
return false;
}
let [ref, els, opts] = this.putRef([], "hook");
this.pushWithReply(() => [ref, els, opts], "event", {
type: "hook",
event,
value: payload,
cid: this.closestComponentID(targetCtx)
}, (resp, reply) => onReply(reply, ref));
return ref;
}
extractMeta(el, meta, value) {
let prefix = this.binding("value-");
for (let i = 0; i < el.attributes.length; i++) {
if (!meta) {
meta = {};
}
let name = el.attributes[i].name;
if (name.startsWith(prefix)) {
meta[name.replace(prefix, "")] = el.getAttribute(name);
}
}
if (el.value !== void 0) {
if (!meta) {
meta = {};
}
meta.value = el.value;
if (el.tagName === "INPUT" && CHECKABLE_INPUTS.indexOf(el.type) >= 0 && !el.checked) {
delete meta.value;
}
}
if (value) {
if (!meta) {
meta = {};
}
for (let key in value) {
meta[key] = value[key];
}
}
return meta;
}
pushEvent(type, el, targetCtx, phxEvent, meta, opts = {}) {
this.pushWithReply(() => this.putRef([el], type, opts), "event", {
type,
event: phxEvent,
value: this.extractMeta(el, meta, opts.value),
cid: this.targetComponentID(el, targetCtx, opts)
});
}
pushFileProgress(fileEl, entryRef, progress, onReply = function() {
}) {
this.liveSocket.withinOwners(fileEl.form, (view, targetCtx) => {
view.pushWithReply(null, "progress", {
event: fileEl.getAttribute(view.binding(PHX_PROGRESS)),
ref: fileEl.getAttribute(PHX_UPLOAD_REF),
entry_ref: entryRef,
progress,
cid: view.targetComponentID(fileEl.form, targetCtx)
}, onReply);
});
}
pushInput(inputEl, targetCtx, forceCid, phxEvent, opts, callback) {
let uploads;
let cid = isCid(forceCid) ? forceCid : this.targetComponentID(inputEl.form, targetCtx);
let refGenerator = () => this.putRef([inputEl, inputEl.form], "change", opts);
let formData;
if (inputEl.getAttribute(this.binding("change"))) {
formData = serializeForm(inputEl.form, { _target: opts._target }, [inputEl.name]);
} else {
formData = serializeForm(inputEl.form, { _target: opts._target });
}
if (dom_default.isUploadInput(inputEl) && inputEl.files && inputEl.files.length > 0) {
LiveUploader.trackFiles(inputEl, Array.from(inputEl.files));
}
uploads = LiveUploader.serializeUploads(inputEl);
let event = {
type: "form",
event: phxEvent,
value: formData,
uploads,
cid
};
this.pushWithReply(refGenerator, "event", event, (resp) => {
dom_default.showError(inputEl, this.liveSocket.binding(PHX_FEEDBACK_FOR));
if (dom_default.isUploadInput(inputEl) && inputEl.getAttribute("data-phx-auto-upload") !== null) {
if (LiveUploader.filesAwaitingPreflight(inputEl).length > 0) {
let [ref, _els] = refGenerator();
this.uploadFiles(inputEl.form, targetCtx, ref, cid, (_uploads) => {
callback && callback(resp);
this.triggerAwaitingSubmit(inputEl.form);
});
}
} else {
callback && callback(resp);
}
});
}
triggerAwaitingSubmit(formEl) {
let awaitingSubmit = this.getScheduledSubmit(formEl);
if (awaitingSubmit) {
let [_el, _ref, _opts, callback] = awaitingSubmit;
this.cancelSubmit(formEl);
callback();
}
}
getScheduledSubmit(formEl) {
return this.formSubmits.find(([el, _ref, _opts, _callback]) => el.isSameNode(formEl));
}
scheduleSubmit(formEl, ref, opts, callback) {
if (this.getScheduledSubmit(formEl)) {
return true;
}
this.formSubmits.push([formEl, ref, opts, callback]);
}
cancelSubmit(formEl) {
this.formSubmits = this.formSubmits.filter(([el, ref, _callback]) => {
if (el.isSameNode(formEl)) {
this.undoRefs(ref);
return false;
} else {
return true;
}
});
}
pushFormSubmit(formEl, targetCtx, phxEvent, opts, onReply) {
let filterIgnored = (el) => {
let userIgnored = closestPhxBinding(el, `${this.binding(PHX_UPDATE)}=ignore`, el.form);
return !(userIgnored || closestPhxBinding(el, "data-phx-update=ignore", el.form));
};
let filterDisables = (el) => {
return el.hasAttribute(this.binding(PHX_DISABLE_WITH));
};
let filterButton = (el) => el.tagName == "BUTTON";
let filterInput = (el) => ["INPUT", "TEXTAREA", "SELECT"].includes(el.tagName);
let refGenerator = () => {
let formElements = Array.from(formEl.elements);
let disables = formElements.filter(filterDisables);
let buttons = formElements.filter(filterButton).filter(filterIgnored);
let inputs = formElements.filter(filterInput).filter(filterIgnored);
buttons.forEach((button) => {
button.setAttribute(PHX_DISABLED, button.disabled);
button.disabled = true;
});
inputs.forEach((input) => {
input.setAttribute(PHX_READONLY, input.readOnly);
input.readOnly = true;
if (input.files) {
input.setAttribute(PHX_DISABLED, input.disabled);
input.disabled = true;
}
});
formEl.setAttribute(this.binding(PHX_PAGE_LOADING), "");
return this.putRef([formEl].concat(disables).concat(buttons).concat(inputs), "submit", opts);
};
let cid = this.targetComponentID(formEl, targetCtx);
if (LiveUploader.hasUploadsInProgress(formEl)) {
let [ref, _els] = refGenerator();
let push = () => this.pushFormSubmit(formEl, targetCtx, phxEvent, opts, onReply);
return this.scheduleSubmit(formEl, ref, opts, push);
} else if (LiveUploader.inputsAwaitingPreflight(formEl).length > 0) {
let [ref, els] = refGenerator();
let proxyRefGen = () => [ref, els, opts];
this.uploadFiles(formEl, targetCtx, ref, cid, (_uploads) => {
let formData = serializeForm(formEl, {});
this.pushWithReply(proxyRefGen, "event", {
type: "form",
event: phxEvent,
value: formData,
cid
}, onReply);
});
} else {
let formData = serializeForm(formEl, {});
this.pushWithReply(refGenerator, "event", {
type: "form",
event: phxEvent,
value: formData,
cid
}, onReply);
}
}
uploadFiles(formEl, targetCtx, ref, cid, onComplete) {
let joinCountAtUpload = this.joinCount;
let inputEls = LiveUploader.activeFileInputs(formEl);
let numFileInputsInProgress = inputEls.length;
inputEls.forEach((inputEl) => {
let uploader = new LiveUploader(inputEl, this, () => {
numFileInputsInProgress--;
if (numFileInputsInProgress === 0) {
onComplete();
}
});
this.uploaders[inputEl] = uploader;
let entries = uploader.entries().map((entry) => entry.toPreflightPayload());
let payload = {
ref: inputEl.getAttribute(PHX_UPLOAD_REF),
entries,
cid: this.targetComponentID(inputEl.form, targetCtx)
};
this.log("upload", () => ["sending preflight request", payload]);
this.pushWithReply(null, "allow_upload", payload, (resp) => {
this.log("upload", () => ["got preflight response", resp]);
if (resp.error) {
this.undoRefs(ref);
let [entry_ref, reason] = resp.error;
this.log("upload", () => [`error for entry ${entry_ref}`, reason]);
} else {
let onError = (callback) => {
this.channel.onError(() => {
if (this.joinCount === joinCountAtUpload) {
callback();
}
});
};
uploader.initAdapterUpload(resp, onError, this.liveSocket);
}
});
});
}
dispatchUploads(name, filesOrBlobs) {
let inputs = dom_default.findUploadInputs(this.el).filter((el) => el.name === name);
if (inputs.length === 0) {
logError(`no live file inputs found matching the name "${name}"`);
} else if (inputs.length > 1) {
logError(`duplicate live file inputs found matching the name "${name}"`);
} else {
dom_default.dispatchEvent(inputs[0], PHX_TRACK_UPLOADS, { detail: { files: filesOrBlobs } });
}
}
pushFormRecovery(form, newCid, callback) {
this.liveSocket.withinOwners(form, (view, targetCtx) => {
let input = form.elements[0];
let phxEvent = form.getAttribute(this.binding(PHX_AUTO_RECOVER)) || form.getAttribute(this.binding("change"));
js_default.exec("change", phxEvent, view, input, ["push", { _target: input.name, newCid, callback }]);
});
}
pushLinkPatch(href, targetEl, callback) {
let linkRef = this.liveSocket.setPendingLink(href);
let refGen = targetEl ? () => this.putRef([targetEl], "click") : null;
let fallback = () => this.liveSocket.redirect(window.location.href);
let push = this.pushWithReply(refGen, "live_patch", { url: href }, (resp) => {
this.liveSocket.requestDOMUpdate(() => {
if (resp.link_redirect) {
this.liveSocket.replaceMain(href, null, callback, linkRef);
} else {
if (this.liveSocket.commitPendingLink(linkRef)) {
this.href = href;
}
this.applyPendingUpdates();
callback && callback(linkRef);
}
});
});
if (push) {
push.receive("timeout", fallback);
} else {
fallback();
}
}
formsForRecovery(html) {
if (this.joinCount === 0) {
return [];
}
let phxChange = this.binding("change");
let template = document.createElement("template");
template.innerHTML = html;
return dom_default.all(this.el, `form[${phxChange}]`).filter((form) => form.id && this.ownsElement(form)).filter((form) => form.elements.length > 0).filter((form) => form.getAttribute(this.binding(PHX_AUTO_RECOVER)) !== "ignore").map((form) => {
let newForm = template.content.querySelector(`form[id="${form.id}"][${phxChange}="${form.getAttribute(phxChange)}"]`);
if (newForm) {
return [form, newForm, this.targetComponentID(newForm)];
} else {
return [form, null, null];
}
}).filter(([form, newForm, newCid]) => newForm);
}
maybePushComponentsDestroyed(destroyedCIDs) {
let willDestroyCIDs = destroyedCIDs.filter((cid) => {
return dom_default.findComponentNodeList(this.el, cid).length === 0;
});
if (willDestroyCIDs.length > 0) {
this.pruningCIDs.push(...willDestroyCIDs);
this.pushWithReply(null, "cids_will_destroy", { cids: willDestroyCIDs }, () => {
this.pruningCIDs = this.pruningCIDs.filter((cid) => willDestroyCIDs.indexOf(cid) !== -1);
let completelyDestroyCIDs = willDestroyCIDs.filter((cid) => {
return dom_default.findComponentNodeList(this.el, cid).length === 0;
});
if (completelyDestroyCIDs.length > 0) {
this.pushWithReply(null, "cids_destroyed", { cids: completelyDestroyCIDs }, (resp) => {
this.rendered.pruneCIDs(resp.cids);
});
}
});
}
}
ownsElement(el) {
return el.getAttribute(PHX_PARENT_ID) === this.id || maybe(el.closest(PHX_VIEW_SELECTOR), (node) => node.id) === this.id;
}
submitForm(form, targetCtx, phxEvent, opts = {}) {
dom_default.putPrivate(form, PHX_HAS_SUBMITTED, true);
let phxFeedback = this.liveSocket.binding(PHX_FEEDBACK_FOR);
let inputs = Array.from(form.elements);
this.liveSocket.blurActiveElement(this);
this.pushFormSubmit(form, targetCtx, phxEvent, opts, () => {
inputs.forEach((input) => dom_default.showError(input, phxFeedback));
this.liveSocket.restorePreviouslyActiveFocus();
});
}
binding(kind) {
return this.liveSocket.binding(kind);
}
};
var LiveSocket = class {
constructor(url, phxSocket, opts = {}) {
this.unloaded = false;
if (!phxSocket || phxSocket.constructor.name === "Object") {
throw new Error(`
a phoenix Socket must be provided as the second argument to the LiveSocket constructor. For example:
import {Socket} from "phoenix"
import {LiveSocket} from "phoenix_live_view"
let liveSocket = new LiveSocket("/live", Socket, {...})
`);
}
this.socket = new phxSocket(url, opts);
this.bindingPrefix = opts.bindingPrefix || BINDING_PREFIX;
this.opts = opts;
this.params = closure2(opts.params || {});
this.viewLogger = opts.viewLogger;
this.metadataCallbacks = opts.metadata || {};
this.defaults = Object.assign(clone(DEFAULTS), opts.defaults || {});
this.activeElement = null;
this.prevActive = null;
this.silenced = false;
this.main = null;
this.outgoingMainEl = null;
this.clickStartedAtTarget = null;
this.linkRef = 1;
this.roots = {};
this.href = window.location.href;
this.pendingLink = null;
this.currentLocation = clone(window.location);
this.hooks = opts.hooks || {};
this.uploaders = opts.uploaders || {};
this.loaderTimeout = opts.loaderTimeout || LOADER_TIMEOUT;
this.reloadWithJitterTimer = null;
this.maxReloads = opts.maxReloads || MAX_RELOADS;
this.reloadJitterMin = opts.reloadJitterMin || RELOAD_JITTER_MIN;
this.reloadJitterMax = opts.reloadJitterMax || RELOAD_JITTER_MAX;
this.failsafeJitter = opts.failsafeJitter || FAILSAFE_JITTER;
this.localStorage = opts.localStorage || window.localStorage;
this.sessionStorage = opts.sessionStorage || window.sessionStorage;
this.boundTopLevelEvents = false;
this.domCallbacks = Object.assign({ onNodeAdded: closure2(), onBeforeElUpdated: closure2() }, opts.dom || {});
this.transitions = new TransitionSet();
window.addEventListener("pagehide", (_e) => {
this.unloaded = true;
});
this.socket.onOpen(() => {
if (this.isUnloaded()) {
window.location.reload();
}
});
}
isProfileEnabled() {
return this.sessionStorage.getItem(PHX_LV_PROFILE) === "true";
}
isDebugEnabled() {
return this.sessionStorage.getItem(PHX_LV_DEBUG) === "true";
}
isDebugDisabled() {
return this.sessionStorage.getItem(PHX_LV_DEBUG) === "false";
}
enableDebug() {
this.sessionStorage.setItem(PHX_LV_DEBUG, "true");
}
enableProfiling() {
this.sessionStorage.setItem(PHX_LV_PROFILE, "true");
}
disableDebug() {
this.sessionStorage.setItem(PHX_LV_DEBUG, "false");
}
disableProfiling() {
this.sessionStorage.removeItem(PHX_LV_PROFILE);
}
enableLatencySim(upperBoundMs) {
this.enableDebug();
console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable");
this.sessionStorage.setItem(PHX_LV_LATENCY_SIM, upperBoundMs);
}
disableLatencySim() {
this.sessionStorage.removeItem(PHX_LV_LATENCY_SIM);
}
getLatencySim() {
let str = this.sessionStorage.getItem(PHX_LV_LATENCY_SIM);
return str ? parseInt(str) : null;
}
getSocket() {
return this.socket;
}
connect() {
if (window.location.hostname === "localhost" && !this.isDebugDisabled()) {
this.enableDebug();
}
let doConnect = () => {
if (this.joinRootViews()) {
this.bindTopLevelEvents();
this.socket.connect();
} else if (this.main) {
this.socket.connect();
}
};
if (["complete", "loaded", "interactive"].indexOf(document.readyState) >= 0) {
doConnect();
} else {
document.addEventListener("DOMContentLoaded", () => doConnect());
}
}
disconnect(callback) {
clearTimeout(this.reloadWithJitterTimer);
this.socket.disconnect(callback);
}
replaceTransport(transport) {
clearTimeout(this.reloadWithJitterTimer);
this.socket.replaceTransport(transport);
this.connect();
}
execJS(el, encodedJS, eventType = null) {
this.owner(el, (view) => js_default.exec(eventType, encodedJS, view, el));
}
triggerDOM(kind, args) {
this.domCallbacks[kind](...args);
}
time(name, func) {
if (!this.isProfileEnabled() || !console.time) {
return func();
}
console.time(name);
let result = func();
console.timeEnd(name);
return result;
}
log(view, kind, msgCallback) {
if (this.viewLogger) {
let [msg, obj] = msgCallback();
this.viewLogger(view, kind, msg, obj);
} else if (this.isDebugEnabled()) {
let [msg, obj] = msgCallback();
debug(view, kind, msg, obj);
}
}
requestDOMUpdate(callback) {
this.transitions.after(callback);
}
transition(time, onStart, onDone = function() {
}) {
this.transitions.addTransition(time, onStart, onDone);
}
onChannel(channel, event, cb) {
channel.on(event, (data) => {
let latency = this.getLatencySim();
if (!latency) {
cb(data);
} else {
console.log(`simulating ${latency}ms of latency from server to client`);
setTimeout(() => cb(data), latency);
}
});
}
wrapPush(view, opts, push) {
let latency = this.getLatencySim();
let oldJoinCount = view.joinCount;
if (!latency) {
if (this.isConnected() && opts.timeout) {
return push().receive("timeout", () => {
if (view.joinCount === oldJoinCount && !view.isDestroyed()) {
this.reloadWithJitter(view, () => {
this.log(view, "timeout", () => ["received timeout while communicating with server. Falling back to hard refresh for recovery"]);
});
}
});
} else {
return push();
}
}
console.log(`simulating ${latency}ms of latency from client to server`);
let fakePush = {
receives: [],
receive(kind, cb) {
this.receives.push([kind, cb]);
}
};
setTimeout(() => {
if (view.isDestroyed()) {
return;
}
fakePush.receives.reduce((acc, [kind, cb]) => acc.receive(kind, cb), push());
}, latency);
return fakePush;
}
reloadWithJitter(view, log) {
clearTimeout(this.reloadWithJitterTimer);
this.disconnect();
let minMs = this.reloadJitterMin;
let maxMs = this.reloadJitterMax;
let afterMs = Math.floor(Math.random() * (maxMs - minMs + 1)) + minMs;
let tries = browser_default.updateLocal(this.localStorage, window.location.pathname, CONSECUTIVE_RELOADS, 0, (count) => count + 1);
if (tries > this.maxReloads) {
afterMs = this.failsafeJitter;
}
this.reloadWithJitterTimer = setTimeout(() => {
if (view.isDestroyed() || view.isConnected()) {
return;
}
view.destroy();
log ? log() : this.log(view, "join", () => [`encountered ${tries} consecutive reloads`]);
if (tries > this.maxReloads) {
this.log(view, "join", () => [`exceeded ${this.maxReloads} consecutive reloads. Entering failsafe mode`]);
}
if (this.hasPendingLink()) {
window.location = this.pendingLink;
} else {
window.location.reload();
}
}, afterMs);
}
getHookCallbacks(name) {
return name && name.startsWith("Phoenix.") ? hooks_default[name.split(".")[1]] : this.hooks[name];
}
isUnloaded() {
return this.unloaded;
}
isConnected() {
return this.socket.isConnected();
}
getBindingPrefix() {
return this.bindingPrefix;
}
binding(kind) {
return `${this.getBindingPrefix()}${kind}`;
}
channel(topic, params) {
return this.socket.channel(topic, params);
}
joinRootViews() {
let rootsFound = false;
dom_default.all(document, `${PHX_VIEW_SELECTOR}:not([${PHX_PARENT_ID}])`, (rootEl) => {
if (!this.getRootById(rootEl.id)) {
let view = this.newRootView(rootEl);
view.setHref(this.getHref());
view.join();
if (rootEl.hasAttribute(PHX_MAIN)) {
this.main = view;
}
}
rootsFound = true;
});
return rootsFound;
}
redirect(to, flash) {
this.disconnect();
browser_default.redirect(to, flash);
}
replaceMain(href, flash, callback = null, linkRef = this.setPendingLink(href)) {
this.outgoingMainEl = this.outgoingMainEl || this.main.el;
let newMainEl = dom_default.cloneNode(this.outgoingMainEl, "");
this.main.showLoader(this.loaderTimeout);
this.main.destroy();
this.main = this.newRootView(newMainEl, flash);
this.main.setRedirect(href);
this.transitionRemoves();
this.main.join((joinCount, onDone) => {
if (joinCount === 1 && this.commitPendingLink(linkRef)) {
this.requestDOMUpdate(() => {
dom_default.findPhxSticky(document).forEach((el) => newMainEl.appendChild(el));
this.outgoingMainEl.replaceWith(newMainEl);
this.outgoingMainEl = null;
callback && requestAnimationFrame(callback);
onDone();
});
}
});
}
transitionRemoves(elements) {
let removeAttr = this.binding("remove");
elements = elements || dom_default.all(document, `[${removeAttr}]`);
elements.forEach((el) => {
if (document.body.contains(el)) {
this.execJS(el, el.getAttribute(removeAttr), "remove");
}
});
}
isPhxView(el) {
return el.getAttribute && el.getAttribute(PHX_SESSION) !== null;
}
newRootView(el, flash) {
let view = new View(el, this, null, flash);
this.roots[view.id] = view;
return view;
}
owner(childEl, callback) {
let view = maybe(childEl.closest(PHX_VIEW_SELECTOR), (el) => this.getViewByEl(el)) || this.main;
if (view) {
callback(view);
}
}
withinOwners(childEl, callback) {
this.owner(childEl, (view) => callback(view, childEl));
}
getViewByEl(el) {
let rootId = el.getAttribute(PHX_ROOT_ID);
return maybe(this.getRootById(rootId), (root) => root.getDescendentByEl(el));
}
getRootById(id) {
return this.roots[id];
}
destroyAllViews() {
for (let id in this.roots) {
this.roots[id].destroy();
delete this.roots[id];
}
this.main = null;
}
destroyViewByEl(el) {
let root = this.getRootById(el.getAttribute(PHX_ROOT_ID));
if (root && root.id === el.id) {
root.destroy();
delete this.roots[root.id];
} else if (root) {
root.destroyDescendent(el.id);
}
}
setActiveElement(target) {
if (this.activeElement === target) {
return;
}
this.activeElement = target;
let cancel = () => {
if (target === this.activeElement) {
this.activeElement = null;
}
target.removeEventListener("mouseup", this);
target.removeEventListener("touchend", this);
};
target.addEventListener("mouseup", cancel);
target.addEventListener("touchend", cancel);
}
getActiveElement() {
if (document.activeElement === document.body) {
return this.activeElement || document.activeElement;
} else {
return document.activeElement || document.body;
}
}
dropActiveElement(view) {
if (this.prevActive && view.ownsElement(this.prevActive)) {
this.prevActive = null;
}
}
restorePreviouslyActiveFocus() {
if (this.prevActive && this.prevActive !== document.body) {
this.prevActive.focus();
}
}
blurActiveElement() {
this.prevActive = this.getActiveElement();
if (this.prevActive !== document.body) {
this.prevActive.blur();
}
}
bindTopLevelEvents() {
if (this.boundTopLevelEvents) {
return;
}
this.boundTopLevelEvents = true;
this.socket.onClose((event) => {
if (event && event.code === 1e3 && this.main) {
this.reloadWithJitter(this.main);
}
});
document.body.addEventListener("click", function() {
});
window.addEventListener("pageshow", (e) => {
if (e.persisted) {
this.getSocket().disconnect();
this.withPageLoading({ to: window.location.href, kind: "redirect" });
window.location.reload();
}
}, true);
this.bindNav();
this.bindClicks();
this.bindForms();
this.bind({ keyup: "keyup", keydown: "keydown" }, (e, type, view, targetEl, phxEvent, eventTarget) => {
let matchKey = targetEl.getAttribute(this.binding(PHX_KEY));
let pressedKey = e.key && e.key.toLowerCase();
if (matchKey && matchKey.toLowerCase() !== pressedKey) {
return;
}
let data = __spreadValues({ key: e.key }, this.eventMeta(type, e, targetEl));
js_default.exec(type, phxEvent, view, targetEl, ["push", { data }]);
});
this.bind({ blur: "focusout", focus: "focusin" }, (e, type, view, targetEl, phxEvent, eventTarget) => {
if (!eventTarget) {
let data = __spreadValues({ key: e.key }, this.eventMeta(type, e, targetEl));
js_default.exec(type, phxEvent, view, targetEl, ["push", { data }]);
}
});
this.bind({ blur: "blur", focus: "focus" }, (e, type, view, targetEl, targetCtx, phxEvent, phxTarget) => {
if (phxTarget === "window") {
let data = this.eventMeta(type, e, targetEl);
js_default.exec(type, phxEvent, view, targetEl, ["push", { data }]);
}
});
window.addEventListener("dragover", (e) => e.preventDefault());
window.addEventListener("drop", (e) => {
e.preventDefault();
let dropTargetId = maybe(closestPhxBinding(e.target, this.binding(PHX_DROP_TARGET)), (trueTarget) => {
return trueTarget.getAttribute(this.binding(PHX_DROP_TARGET));
});
let dropTarget = dropTargetId && document.getElementById(dropTargetId);
let files = Array.from(e.dataTransfer.files || []);
if (!dropTarget || dropTarget.disabled || files.length === 0 || !(dropTarget.files instanceof FileList)) {
return;
}
LiveUploader.trackFiles(dropTarget, files);
dropTarget.dispatchEvent(new Event("input", { bubbles: true }));
});
this.on(PHX_TRACK_UPLOADS, (e) => {
let uploadTarget = e.target;
if (!dom_default.isUploadInput(uploadTarget)) {
return;
}
let files = Array.from(e.detail.files || []).filter((f) => f instanceof File || f instanceof Blob);
LiveUploader.trackFiles(uploadTarget, files);
uploadTarget.dispatchEvent(new Event("input", { bubbles: true }));
});
}
eventMeta(eventName, e, targetEl) {
let callback = this.metadataCallbacks[eventName];
return callback ? callback(e, targetEl) : {};
}
setPendingLink(href) {
this.linkRef++;
this.pendingLink = href;
return this.linkRef;
}
commitPendingLink(linkRef) {
if (this.linkRef !== linkRef) {
return false;
} else {
this.href = this.pendingLink;
this.pendingLink = null;
return true;
}
}
getHref() {
return this.href;
}
hasPendingLink() {
return !!this.pendingLink;
}
bind(events, callback) {
for (let event in events) {
let browserEventName = events[event];
this.on(browserEventName, (e) => {
let binding = this.binding(event);
let windowBinding = this.binding(`window-${event}`);
let targetPhxEvent = e.target.getAttribute && e.target.getAttribute(binding);
if (targetPhxEvent) {
this.debounce(e.target, e, browserEventName, () => {
this.withinOwners(e.target, (view) => {
callback(e, event, view, e.target, targetPhxEvent, null);
});
});
} else {
dom_default.all(document, `[${windowBinding}]`, (el) => {
let phxEvent = el.getAttribute(windowBinding);
this.debounce(el, e, browserEventName, () => {
this.withinOwners(el, (view) => {
callback(e, event, view, el, phxEvent, "window");
});
});
});
}
});
}
}
bindClicks() {
window.addEventListener("mousedown", (e) => this.clickStartedAtTarget = e.target);
this.bindClick("click", "click", false);
this.bindClick("mousedown", "capture-click", true);
}
bindClick(eventName, bindingName, capture) {
let click = this.binding(bindingName);
window.addEventListener(eventName, (e) => {
let target = null;
if (capture) {
target = e.target.matches(`[${click}]`) ? e.target : e.target.querySelector(`[${click}]`);
} else {
let clickStartedAtTarget = this.clickStartedAtTarget || e.target;
target = closestPhxBinding(clickStartedAtTarget, click);
this.dispatchClickAway(e, clickStartedAtTarget);
this.clickStartedAtTarget = null;
}
let phxEvent = target && target.getAttribute(click);
if (!phxEvent) {
return;
}
if (target.getAttribute("href") === "#") {
e.preventDefault();
}
this.debounce(target, e, "click", () => {
this.withinOwners(target, (view) => {
js_default.exec("click", phxEvent, view, target, ["push", { data: this.eventMeta("click", e, target) }]);
});
});
}, capture);
}
dispatchClickAway(e, clickStartedAt) {
let phxClickAway = this.binding("click-away");
dom_default.all(document, `[${phxClickAway}]`, (el) => {
if (!(el.isSameNode(clickStartedAt) || el.contains(clickStartedAt))) {
this.withinOwners(e.target, (view) => {
let phxEvent = el.getAttribute(phxClickAway);
if (js_default.isVisible(el)) {
js_default.exec("click", phxEvent, view, el, ["push", { data: this.eventMeta("click", e, e.target) }]);
}
});
}
});
}
bindNav() {
if (!browser_default.canPushState()) {
return;
}
if (history.scrollRestoration) {
history.scrollRestoration = "manual";
}
let scrollTimer = null;
window.addEventListener("scroll", (_e) => {
clearTimeout(scrollTimer);
scrollTimer = setTimeout(() => {
browser_default.updateCurrentState((state) => Object.assign(state, { scroll: window.scrollY }));
}, 100);
});
window.addEventListener("popstate", (event) => {
if (!this.registerNewLocation(window.location)) {
return;
}
let { type, id, root, scroll } = event.state || {};
let href = window.location.href;
this.requestDOMUpdate(() => {
if (this.main.isConnected() && (type === "patch" && id === this.main.id)) {
this.main.pushLinkPatch(href, null);
} else {
this.replaceMain(href, null, () => {
if (root) {
this.replaceRootHistory();
}
if (typeof scroll === "number") {
setTimeout(() => {
window.scrollTo(0, scroll);
}, 0);
}
});
}
});
}, false);
window.addEventListener("click", (e) => {
let target = closestPhxBinding(e.target, PHX_LIVE_LINK);
let type = target && target.getAttribute(PHX_LIVE_LINK);
let wantsNewTab = e.metaKey || e.ctrlKey || e.button === 1;
if (!type || !this.isConnected() || !this.main || wantsNewTab) {
return;
}
let href = target.href;
let linkState = target.getAttribute(PHX_LINK_STATE);
e.preventDefault();
e.stopImmediatePropagation();
if (this.pendingLink === href) {
return;
}
this.requestDOMUpdate(() => {
if (type === "patch") {
this.pushHistoryPatch(href, linkState, target);
} else if (type === "redirect") {
this.historyRedirect(href, linkState);
} else {
throw new Error(`expected ${PHX_LIVE_LINK} to be "patch" or "redirect", got: ${type}`);
}
});
}, false);
}
dispatchEvent(event, payload = {}) {
dom_default.dispatchEvent(window, `phx:${event}`, { detail: payload });
}
dispatchEvents(events) {
events.forEach(([event, payload]) => this.dispatchEvent(event, payload));
}
withPageLoading(info, callback) {
dom_default.dispatchEvent(window, "phx:page-loading-start", { detail: info });
let done = () => dom_default.dispatchEvent(window, "phx:page-loading-stop", { detail: info });
return callback ? callback(done) : done;
}
pushHistoryPatch(href, linkState, targetEl) {
this.withPageLoading({ to: href, kind: "patch" }, (done) => {
this.main.pushLinkPatch(href, targetEl, (linkRef) => {
this.historyPatch(href, linkState, linkRef);
done();
});
});
}
historyPatch(href, linkState, linkRef = this.setPendingLink(href)) {
if (!this.commitPendingLink(linkRef)) {
return;
}
browser_default.pushState(linkState, { type: "patch", id: this.main.id }, href);
this.registerNewLocation(window.location);
}
historyRedirect(href, linkState, flash) {
let scroll = window.scrollY;
this.withPageLoading({ to: href, kind: "redirect" }, (done) => {
this.replaceMain(href, flash, () => {
browser_default.pushState(linkState, { type: "redirect", id: this.main.id, scroll }, href);
this.registerNewLocation(window.location);
done();
});
});
}
replaceRootHistory() {
browser_default.pushState("replace", { root: true, type: "patch", id: this.main.id });
}
registerNewLocation(newLocation) {
let { pathname, search } = this.currentLocation;
if (pathname + search === newLocation.pathname + newLocation.search) {
return false;
} else {
this.currentLocation = clone(newLocation);
return true;
}
}
bindForms() {
let iterations = 0;
this.on("submit", (e) => {
let phxEvent = e.target.getAttribute(this.binding("submit"));
if (!phxEvent) {
return;
}
e.preventDefault();
e.target.disabled = true;
this.withinOwners(e.target, (view) => {
js_default.exec("submit", phxEvent, view, e.target, ["push", {}]);
});
}, false);
for (let type of ["change", "input"]) {
this.on(type, (e) => {
let phxChange = this.binding("change");
let input = e.target;
let inputEvent = input.getAttribute(phxChange);
let formEvent = input.form && input.form.getAttribute(phxChange);
let phxEvent = inputEvent || formEvent;
if (!phxEvent) {
return;
}
if (input.type === "number" && input.validity && input.validity.badInput) {
return;
}
let dispatcher = inputEvent ? input : input.form;
let currentIterations = iterations;
iterations++;
let { at, type: lastType } = dom_default.private(input, "prev-iteration") || {};
if (at === currentIterations - 1 && type !== lastType) {
return;
}
dom_default.putPrivate(input, "prev-iteration", { at: currentIterations, type });
this.debounce(input, e, type, () => {
this.withinOwners(dispatcher, (view) => {
dom_default.putPrivate(input, PHX_HAS_FOCUSED, true);
if (!dom_default.isTextualInput(input)) {
this.setActiveElement(input);
}
js_default.exec("change", phxEvent, view, input, ["push", { _target: e.target.name, dispatcher }]);
});
});
}, false);
}
}
debounce(el, event, eventType, callback) {
if (eventType === "blur" || eventType === "focusout") {
return callback();
}
let phxDebounce = this.binding(PHX_DEBOUNCE);
let phxThrottle = this.binding(PHX_THROTTLE);
let defaultDebounce = this.defaults.debounce.toString();
let defaultThrottle = this.defaults.throttle.toString();
this.withinOwners(el, (view) => {
let asyncFilter = () => !view.isDestroyed() && document.body.contains(el);
dom_default.debounce(el, event, phxDebounce, defaultDebounce, phxThrottle, defaultThrottle, asyncFilter, () => {
callback();
});
});
}
silenceEvents(callback) {
this.silenced = true;
callback();
this.silenced = false;
}
on(event, callback) {
window.addEventListener(event, (e) => {
if (!this.silenced) {
callback(e);
}
});
}
};
var TransitionSet = class {
constructor() {
this.transitions = /* @__PURE__ */ new Set();
this.pendingOps = [];
this.reset();
}
reset() {
this.transitions.forEach((timer) => {
cancelTimeout(timer);
this.transitions.delete(timer);
});
this.flushPendingOps();
}
after(callback) {
if (this.size() === 0) {
callback();
} else {
this.pushPendingOp(callback);
}
}
addTransition(time, onStart, onDone) {
onStart();
let timer = setTimeout(() => {
this.transitions.delete(timer);
onDone();
if (this.size() === 0) {
this.flushPendingOps();
}
}, time);
this.transitions.add(timer);
}
pushPendingOp(op) {
this.pendingOps.push(op);
}
size() {
return this.transitions.size;
}
flushPendingOps() {
this.pendingOps.forEach((op) => op());
this.pendingOps = [];
}
};
// js/app.js
var import_topbar = __toESM(require_topbar());
window.$ = import_jquery3.default;
window.jQuery = import_jquery3.default;
var csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content");
var liveSocket = new LiveSocket("/live", Socket, { params: { _csrf_token: csrfToken } });
import_topbar.default.config({ barColors: { 0: "#29d" }, shadowColor: "rgba(0, 0, 0, .3)" });
window.addEventListener("phx:page-loading-start", (info) => import_topbar.default.show());
window.addEventListener("phx:page-loading-stop", (info) => import_topbar.default.hide());
liveSocket.connect();
window.liveSocket = liveSocket;
})();
/**
* Prism: Lightweight, robust, elegant syntax highlighting
*
* @license MIT <https://opensource.org/licenses/MIT>
* @author Lea Verou <https://lea.verou.me>
* @namespace
* @public
*/
/**
* @license MIT
* topbar 1.0.0, 2021-01-06
* http://buunguyen.github.io/topbar
* Copyright (c) 2021 Buu Nguyen
*/
/*! Bundled license information:
jquery/dist/jquery.js:
(*!
* jQuery JavaScript Library v3.7.1
* https://jquery.com/
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2023-08-28T13:37Z
*)
bootstrap/dist/js/bootstrap.esm.js:
(*!
* Bootstrap v5.3.3 (https://getbootstrap.com/)
* Copyright 2011-2024 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*)
*/