reactjs-tiptap-editor
Version:
A modern WYSIWYG rich text editor based on tiptap and shadcn ui for React
1,186 lines • 150 kB
JavaScript
import { h as ta, j as Te, N as na, t as Pt, k as aa, m as ra } from "./clsx-DaPvp9ji.js";
import { jsx as C, Fragment as ia, jsxs as tt } from "react/jsx-runtime";
import { u as sa, d as oa, A as la, G as ca, I as Ee } from "./index-RcSPeQHn.js";
import { useRef as $t, useCallback as nt, useEffect as Dt } from "react";
import "./theme.js";
import { S as Ft, a as Ut, b as da, c as Bt, d as Gt } from "./select-CmV5uTXr.js";
import { d as ua } from "./delete-node-IyVmiRbI.js";
function br() {
const e = sa(ea.name), {
icon: t = void 0,
tooltip: n = void 0,
tooltipOptions: s = {},
action: l = void 0,
isActive: u = void 0
} = (e == null ? void 0 : e.componentProps) ?? {}, { dataState: f, disabled: E, update: y } = oa(u), v = () => {
E || l && (l(), y());
};
return e ? /* @__PURE__ */ C(
la,
{
action: v,
dataState: f,
disabled: E,
icon: t,
tooltip: n,
tooltipOptions: s
}
) : /* @__PURE__ */ C(ia, {});
}
var xe = {}, j = Symbol(), J = Symbol(), St = (e) => typeof e == "string" ? _[e] : e, _ = {
plain: xe,
plaintext: xe,
text: xe,
txt: xe
}, ke = (e, t) => (t[J] || Se)(e, t), Se = (e, t) => {
for (var n = [e], s, l = [], u = 0; s = St(t[j]); )
delete t[j], Object.assign(t, s);
for (xn(e, t, n, 0); l[u++] = n[0], n = n[1]; ) ;
return l;
}, zt = "</span>", Oe = "", ye = "", Sn = (e) => {
for (var t = "", n = e.length, s = 0; s < n; ) t += Tn(e[s++]);
return t;
}, Tn = (e) => {
if (e instanceof ue) {
var { type: t, alias: n, content: s } = e, l = Oe, u = ye, f = `<span class="token ${t + (n ? " " + n : "") + (t == "keyword" && typeof s == "string" ? " keyword-" + s : "")}">`;
ye += zt, Oe += f;
var E = Tn(s);
return Oe = l, ye = u, f + E + zt;
}
return typeof e != "string" ? Sn(e) : (e = e.replace(/&/g, "&").replace(/</g, "<"), ye && e.includes(`
`) ? e.replace(/\n/g, ye + `
` + Oe) : e);
}, xn = (e, t, n, s, l) => {
for (var u in t)
if (t[u]) for (var f = 0, E = t[u], y = Array.isArray(E) ? E : [E]; f < y.length; ++f) {
if (l && l[0] == u && l[1] == f)
return;
for (var v = y[f], m = v.pattern || v, p = St(v.inside), c = v.lookbehind, b = v.greedy && m.global, g = v.alias, a = n, r = s; a && (!l || r < l[2]); r += a[0].length, a = a[1]) {
var d = a[0], o = 0, i, h;
if (!(d instanceof ue)) {
if (m.lastIndex = b ? r : 0, i = m.exec(b ? e : d), i && c && i[1] && (h = i[1].length, i.index += h, i[0] = i[0].slice(h)), b) {
if (!i)
break;
if (i[0]) {
for (var S = i.index, k = S + i[0].length, I; S >= r + (I = a[0].length); a = a[1], r += I) ;
if (a[0] instanceof ue)
continue;
for (var w = a, E = r; (E += w[0].length) < k; w = w[1], o++) ;
d = e.slice(r, E), i.index -= r;
}
}
if (i && i[0]) {
for (var S = i.index, x = i[0], T = d.slice(S + x.length), N = r + d.length, P = new ue(u, p ? ke(x, p) : x, x, g), M = a, V = 0, z; M = M[1], V++ < o; ) ;
T && (!M || M[0] instanceof ue ? M = [T, M] : M[0] = T + M[0]), r += S, a[0] = S ? d.slice(0, S) : P, S ? a = a[1] = [P, M] : a[1] = M, o && (xn(e, t, a, r, z = [u, f, N]), N = z[2]), l && N > l[2] && (l[2] = N);
}
}
}
}
};
function ue(e, t, n, s) {
this.type = e, this.content = t, this.alias = s, this.length = n.length;
}
var Ge = "\\b(?:BASH(?:OPTS|_ALIASES|_ARG[CV]|_CMDS|_COMPLETION_COMPAT_DIR|_LINENO|_REMATCH|_SOURCE|_VERSINFO|_VERSION)?|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|E?UID|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|ALL|IDENTIFICATION|MEASUREMENT|MONETARY|NAME|NUMERIC|PAPER|TELEPHONE|TIME)|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS[1-4]|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_(?:CONFIG_DIRS|CURRENT_DESKTOP|DATA_DIRS|GREETER_DATA_DIR|MENU_PREFIX|RUNTIME_DIR|SEAT|SEAT_PATH|SESSION_DESKTOP|SESSION_ID|SESSION_PATH|SESSION_TYPE|VTNR)|XMODIFIERS)\\b", pt = {
pattern: /(^(["']?)\w+\2)[ ]+\S.*/,
lookbehind: !0,
alias: "punctuation"
// this looks reasonably well in all themes
}, On = {
variable: /^\$\(|^`|\)$|`$/
}, Ne = {
bash: pt,
environment: {
pattern: RegExp("\\$" + Ge),
alias: "constant"
},
variable: [
// [0]: Arithmetic Environment
{
pattern: /\$?\(\([^]*?\)\)/g,
greedy: !0,
inside: {
// If there is a $ sign at the beginning highlight $(( and )) as variable
variable: [
{
pattern: /(^\$[^]+)../,
lookbehind: !0
},
/^\$\(\(/
],
number: /\b0x[a-fA-F\d]+\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: /\$\((?:[^()]|\([^)]*\))*\)|`[^`]+`/g,
greedy: !0,
inside: On
},
// [2]: Brace expansion
{
pattern: /\$\{[^}]*\}/g,
greedy: !0,
inside: {
operator: /:[?=+-]?|[!/]|##?|%%?|\^\^?|,,?/,
punctuation: /[[\]]/,
environment: {
pattern: RegExp("(\\{)" + Ge),
lookbehind: !0,
alias: "constant"
}
}
},
/\$(?:\w+|[#?*!@$])/
],
// Escape sequences from echo and printf's manuals, and escaped quotes.
entity: /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[a-fA-F\d]{8}|u[a-fA-F\d]{4}|x[a-fA-F\d]{1,2})/
}, pa = pt.inside = _.sh = _.shell = _.bash = {
shebang: {
pattern: /^#!\s*\/.*/,
alias: "important"
},
comment: {
pattern: /(^|[^"{\\$])#.*/,
lookbehind: !0
},
"function-name": [
// a) function foo {
// b) foo() {
// c) function foo() {
// but not “foo {”
{
// a) and c)
pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
lookbehind: !0,
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)/,
lookbehind: !0,
alias: "variable"
},
// Highlight variable names as variables in the left-hand part
// of assignments (“=” and “+=”).
"assign-left": {
pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
lookbehind: !0,
alias: "variable",
inside: {
environment: {
pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + Ge),
lookbehind: !0,
alias: "constant"
}
}
},
// Highlight parameter names as variables
parameter: {
pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?![^\s=])/,
lookbehind: !0,
alias: "variable"
},
string: [
// Support for Here-documents https://en.wikipedia.org/wiki/Here_document
{
pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[^]*?\n\2/g,
lookbehind: !0,
greedy: !0,
inside: Ne
},
// Here-document with quotes around the tag
// → No expansion (so no “inside”).
{
pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[^]*?\n\3/g,
lookbehind: !0,
greedy: !0,
inside: {
bash: pt
}
},
// “Normal” string
{
// https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
pattern: /(^|[^\\](?:\\\\)*)"(?:\\[^]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^\\"`$])*"/g,
lookbehind: !0,
greedy: !0,
inside: Ne
},
{
// https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
pattern: /(^|[^$\\])'[^']*'/g,
lookbehind: !0,
greedy: !0
},
{
// https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html
pattern: /\$'(?:\\[^]|[^\\'])*'/g,
greedy: !0,
inside: {
entity: Ne.entity
}
}
],
environment: {
pattern: RegExp("\\$?" + Ge),
alias: "constant"
},
variable: Ne.variable,
function: {
pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|c?fdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cron|crontab|c?split|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff3?|dig|dircolors|dirname|dirs?|dmesg|docker|docker-compose|du|[ef]?grep|eject|env|ethtool|expand|expect|expr|fdformat|fg|file|find|fmt|fold|format|free|fsck|fuser|g?awk|git|g?parted|groupadd|groupdel|groupmod|groups|grub-mkconfig|halt|head|hg|history|host|hostname|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|killall|less|link|ln|logname|logrotate|look|lpc|lprint[dq]?|lprm?|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mm?v|more|most|mtools|m?tr|mutt|nano|nc|netstat|nice|nl|node|nohup|notify-send|nslookup|op|open|passwd|paste|pathchk|ping|p?kill|p?npm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ra[mr]|reboot|remsync|rename|renice|rev|rmdir|rp?m|r?sync|[sr]?cp|screen|sdiff|se[dq]|sendmail|service|s?ftp|shellcheck|shuf|shutdown|sleep|s?locate|[sz]?sh|stat|strace|sudo|sum?|suspend|swapon|sysctl|tac|tail|tar|tee|time|timeout|h?top|touch|traceroute|t?sort|tty|u?mount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vim?|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|g?zip|zsh|zypper)(?=$|[)\s;|&])/,
lookbehind: !0
},
keyword: {
pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
lookbehind: !0
},
// 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|[ls]et|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,
lookbehind: !0,
// Alias added to make those easier to distinguish from strings.
alias: "class-name"
},
boolean: {
pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
lookbehind: !0
},
"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: !0
}
};
[
"comment",
"function-name",
"for-or-select",
"assign-left",
"parameter",
"string",
"environment",
"function",
"keyword",
"builtin",
"boolean",
"file-descriptor",
"operator",
"punctuation",
"number"
].forEach((e) => On[e] = pa[e]);
var Nn = /(?:"(?:\\[^]|[^\\\n"])*"|'(?:\\[^]|[^\\\n'])*')/g, Le = Nn.source, Ht = {
rule: /^@[\w-]+/,
"selector-function-argument": {
pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^)]*\))*\))+(?=\s*\))/,
lookbehind: !0,
alias: "selector"
},
keyword: {
pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
lookbehind: !0
}
// See rest below
};
Ht[j] = _.css = {
comment: /\/\*[^]*?\*\//,
atrule: {
pattern: RegExp(`@[\\w-](?:[^;{\\s"']|\\s+(?!\\s)|${Le})*?(?:;|(?=\\s*\\{))`),
inside: Ht
},
url: {
// https://drafts.csswg.org/css-values-3/#urls
pattern: RegExp(`\\burl\\((?:${Le}|(?:[^\\\\
"')=]|\\\\[^])*)\\)`, "gi"),
greedy: !0,
inside: {
function: /^url/i,
punctuation: /^\(|\)$/,
string: {
pattern: RegExp("^" + Le + "$"),
alias: "url"
}
}
},
selector: {
pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|${Le})*(?=\\s*\\{)`),
lookbehind: !0
},
string: {
pattern: Nn,
greedy: !0
},
property: {
pattern: /(^|[^-\w\xa0-\uffff])(?!\d)(?:(?!\s)[-\w\xa0-\uffff])+(?=\s*:)/i,
lookbehind: !0
},
important: /!important\b/i,
function: {
pattern: /(^|[^-a-z\d])[-a-z\d]+(?=\()/i,
lookbehind: !0
},
punctuation: /[(){},:;]/
};
var $e = (e, t) => {
if (t.has(e)) return t.get(e);
var n = e, s = ba.call(e).slice(8, -1);
if (s == "Object") {
t.set(e, n = {});
for (var l in e)
n[l] = $e(e[l], t);
e[j] && (n[j] = $e(e[j], t)), e[J] && (n[J] = e[J]);
} else if (s == "Array") {
t.set(e, n = []);
for (var u = 0, f = e.length; u < f; u++)
n[u] = $e(e[u], t);
}
return n;
}, Ye = (e) => $e(e, /* @__PURE__ */ new Map()), ae = (e, t) => Object.assign(Ye(_[e]), t), $ = (e, t, n) => {
var s = {};
for (var l in e)
s[l] = e[l], delete e[l];
for (var l in s)
l == t && Object.assign(e, n), n.hasOwnProperty(l) || (e[l] = s[l]);
}, ba = {}.toString, ze = _.css, Vt = {
pattern: /(\b\d+)(?:%|[a-z]+(?![\w-]))/,
lookbehind: !0
}, Zt = {
pattern: /(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,
lookbehind: !0
};
ze.selector.inside = ze.atrule.inside["selector-function-argument"].inside = {
"pseudo-element": /:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,
"pseudo-class": /:[-\w]+/,
class: /\.[-\w]+/,
id: /#[-\w]+/,
attribute: {
pattern: /\[(?:[^[\]"']|(["'])(?:\\[^]|(?!\1)[^\\\n])*\1)*\]/g,
greedy: !0,
inside: {
punctuation: /^\[|\]$/,
"case-sensitivity": {
pattern: /(\s)[si]$/i,
lookbehind: !0,
alias: "keyword"
},
namespace: {
pattern: /^(\s*)(?:(?!\s)[-*\w\xa0-\uffff])*\|(?!=)/,
lookbehind: !0,
inside: {
punctuation: /\|$/
}
},
"attr-name": {
pattern: /^(\s*)(?:(?!\s)[-\w\xa0-\uffff])+/,
lookbehind: !0
},
"attr-value": {
pattern: /(=\s*)(?:(?!\s)[-\w\xa0-\uffff])+(?=\s*$)|(["'])(?:\\[^]|(?!\2)[^\\\n])*\2/,
lookbehind: !0
},
operator: /[|~*^$]?=/
}
},
"n-th": [
{
pattern: /(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,
lookbehind: !0,
inside: {
number: /[\dn]+/,
operator: /[+-]/
}
},
{
pattern: /(\(\s*)(?:even|odd)(?=\s*\))/i,
lookbehind: !0
}
],
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: /[(),]/
};
$(ze, "property", {
variable: {
pattern: /(^|[^-\w\xa0-\uffff])--(?!\d)(?:(?!\s)[-\w\xa0-\uffff])*/i,
lookbehind: !0
}
});
$(ze, "function", {
operator: {
pattern: /(\s)[/*+-](?!\S)/,
lookbehind: !0
},
// CAREFUL!
// Previewers and Inline color use hexcode and color.
hexcode: {
pattern: /\B#[a-f\d]{3,8}\b/i,
alias: "color"
},
color: [
{
pattern: /(^|[^\w-])(?:(?:alice|cadet|cornflower|deepsky|dodger|midnight|powder|royal|sky|steel)blue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blueviolet|brown|burlywood|chartreuse|chocolate|coral|cornsilk|crimson|(?:dark)?(?:blue|cyan|goldenrod|gr[ae]y|green|khaki|magenta|olivegreen|orange|orchid|red|salmon|seagreen|slateblue|slategr[ae]y|turquoise|violet)|deeppink|dimgr[ae]y|firebrick|floralwhite|(?:forest|lawn|lime|pale|spring)green|fuchsia|gainsboro|ghostwhite|gold|greenyellow|honeydew|hotpink|indianred|indigo|ivory|lavender|lavenderblush|lemonchiffon|light(?:blue|coral|cyan|goldenrodyellow|gr[ae]y|green|pink|salmon|seagreen|skyblue|slategr[ae]y|steelblue|yellow)|lime|linen|maroon|medium(?:aquamarine|blue|orchid|purple|seagreen|slateblue|springgreen|turquoise|violetred)|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orangered|palegoldenrod|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|purple|rebeccapurple|rosybrown|saddlebrown|sandybrown|seashell|sienna|silver|snow|tan|teal|thistle|tomato|transparent|wheat|white|whitesmoke|yellow|yellowgreen)(?![\w-])/i,
lookbehind: !0
},
{
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: {
function: /^[^(]+/,
unit: Vt,
number: Zt,
punctuation: /[(),]/
}
}
],
// it's important that there is no boundary assertion after the hex digits
entity: /\\[a-f\d]{1,8}/i,
unit: Vt,
number: Zt
});
_.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 \v]*)[#;].*/m,
lookbehind: !0
},
section: {
pattern: /(^[ \f \v]*)\[[^\n\]]*\]?/m,
lookbehind: !0,
inside: {
"section-name": {
pattern: /(^\[[ \f \v]*)[^ \f \v\]]+(?:[ \f \v]+[^ \f \v\]]+)*/,
lookbehind: !0,
alias: "selector"
},
punctuation: /[[\]]/
}
},
key: {
pattern: /(^[ \f \v]*)[^ \f\n \v=]+(?:[ \f \v]+[^ \f\n \v=]+)*(?=[ \f \v]*=)/m,
lookbehind: !0,
alias: "attr-name"
},
value: {
pattern: /(=[ \f \v]*)[^ \f\n \v]+(?:[ \f \v]+[^ \f\n \v]+)*/,
lookbehind: !0,
alias: "attr-value",
inside: {
"inner-value": {
pattern: /^(["']).+(?=\1$)/,
lookbehind: !0
}
}
},
punctuation: /=/
};
var re = () => ({
pattern: /\/\/.*|\/\*[^]*?(?:\*\/|$)/g,
greedy: !0
}), Tt = () => ({
pattern: /(["'])(?:\\[^]|(?!\1)[^\\\n])*\1/g,
greedy: !0
}), Ln = /\b0x[a-f\d]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i, te = /[()[\]{}.,:;]/, q = /\b(?:false|true)\b/, at = {
"interpolation-punctuation": {
pattern: /^\$\{?|\}$/,
alias: "punctuation"
},
expression: {
pattern: /[^]+/
}
};
at.expression.inside = _.kts = _.kt = _.kotlin = {
// https://kotlinlang.org/spec/expressions.html#string-interpolation-expressions
"string-literal": [
{
pattern: /"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,
alias: "multiline",
inside: {
interpolation: {
pattern: /\$(?:[a-z_]\w*|\{[^{}]*\})/i,
inside: at
},
string: /[^]+/
}
},
{
pattern: /"(?:\\.|[^\\\n"$]|\$(?:(?!\{)|\{[^{}]*\}))*"/,
alias: "singleline",
inside: {
interpolation: {
pattern: /((?:^|[^\\])(?:\\\\)*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,
lookbehind: !0,
inside: at
},
string: /[^]+/
}
}
],
char: {
// https://kotlinlang.org/spec/expressions.html#character-literals
pattern: /'(?:[^\\\n']|\\(?:.|u[a-fA-F\d]{0,4}))'/g,
greedy: !0
},
comment: re(),
annotation: {
pattern: /\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,
alias: "builtin"
},
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: !0
},
boolean: q,
label: {
pattern: /\b\w+@|@\w+/,
alias: "symbol"
},
function: {
pattern: /(?:`[^\n`]+`|\b\w+)(?=\s*\()|(\.)(?:`[^\n`]+`|\w+)(?=\s*\{)/g,
lookbehind: !0,
greedy: !0
},
number: /\b(?:0[xX][a-fA-F\d]+(?:_[a-fA-F\d]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,
operator: /--|\+\+|&&|\|\||->|[!=]==|!!|[%!=<>/*+-]=?|[?:]:?|\.\.|\b(?:and|inv|shl|u?shr|x?or)\b/,
punctuation: te
};
var Cn = [
{
pattern: /&[a-z\d]{1,8};/i,
alias: "named-entity"
},
/&#x?[a-f\d]{1,8};/i
], fa = {
pattern: /<\/?(?!\d)[^\s/=>$<%]+(?:\s(?:\s*[^\s/=>]+(?:\s*=\s*(?!\s)(?:"[^"]*"|'[^']*'|[^\s"'=>]+(?=[\s>]))?|(?=[\s/>])))+)?\s*\/?>/g,
greedy: !0,
inside: {
punctuation: /^<\/?|\/?>$/,
tag: {
pattern: /^\S+/,
inside: {
namespace: /^[^:]+:/
}
},
"attr-value": [{
pattern: /(=\s*)(?:"[^"]*"|'[^']*'|[^\s"'=>]+)/g,
lookbehind: !0,
greedy: !0,
inside: {
punctuation: /^["']|["']$/,
entity: Cn
}
}],
"attr-equals": /=/,
"attr-name": {
pattern: /\S+/,
inside: {
namespace: /^[^:]+:/
}
}
}
};
_.rss = _.atom = _.ssml = _.xml = {
comment: {
pattern: /<!--(?:(?!<!--)[^])*?-->/g,
greedy: !0
},
prolog: {
pattern: /<\?[^]+?\?>/g,
greedy: !0
},
doctype: {
// https://www.w3.org/TR/xml/#NT-doctypedecl
pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/gi,
greedy: !0,
inside: {
"internal-subset": {
pattern: /(\[)[^]+(?=\]\s*>$)/,
lookbehind: !0,
inside: "xml"
},
string: /"[^"]*"|'[^']*'/,
punctuation: /^<!|[>[\]]/,
"doctype-tag": /^DOCTYPE/i,
name: /\S+/
}
},
cdata: {
pattern: /<!\[CDATA\[[^]*?\]\]>/gi,
greedy: !0
},
tag: fa,
entity: Cn,
"markup-bracket": {
pattern: /[()[\]{}]/,
alias: "punctuation"
}
};
var bt = (e, t) => (e["language-" + t] = {
pattern: /[^]+/,
inside: t
}, e), qt = (e, t) => ({
pattern: RegExp(`(<${e}[^>]*>)(?!</${e}>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[^])+?(?=</${e}>)`, "gi"),
lookbehind: !0,
greedy: !0,
inside: bt({
"included-cdata": {
pattern: /<!\[CDATA\[[^]*?\]\]>/i,
inside: bt({
cdata: /^<!\[CDATA\[|\]\]>$/i
}, t)
}
}, t)
}), Kt = (e, t) => ({
pattern: RegExp(`((?:^|["'\\s])(?:${e})\\s*=\\s*)(?:"[^"]*"|'[^']*'|[^\\s"'=>]+)`, "gi"),
lookbehind: !0,
greedy: !0,
inside: bt({
punctuation: /^["']|["']$/
}, t)
}), Mn = _.svg = _.mathml = _.html = _.markup = Ye(_.xml);
Mn.tag.inside["attr-value"].unshift(
Kt("style", "css"),
Kt("on[a-z]+", "javascript")
);
$(Mn, "cdata", {
style: qt("style", "css"),
script: qt("script", "javascript")
});
_.r = {
comment: /#.*/,
string: {
pattern: /(["'])(?:\\.|(?!\1)[^\\\n])*\1/g,
greedy: !0
},
"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[a-fA-F\d]+(?:\.\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: /[()[\]{},;]/
};
_.basic = {
comment: {
pattern: /(?:!|rem\b).+/i,
inside: {
keyword: /^rem/i
}
},
string: {
pattern: /"(?:""|[#$%&'().,:;\w ?^!=<>/*+-])*"/g,
greedy: !0
},
number: /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
keyword: /\b(?:as|beep|bload|bsave|call absolute|call|case|chain|chdir|clear|close|cls|com|common|const|data|declare|def(?: fn| seg|dbl|int|[ls]ng|str)|dim|do|double|else|elseif|environ|erase|error|exit|field|files|for|function|get|gosub|goto|if|input|integer|ioctl|key|kill|line input|locate|lock|long|loop|[lr]set|mkdir|name|next|off|on(?: com| error| key| timer)?|open|option base|[op]ut|poke|read|redim|rem|restore|resume|return|rmdir|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|w?end|while|write)(?:\$|\b)/i,
function: /\b(?:abs|access|a?cos|angle|area|arithmetic|array|a?sin|ask|atn?|base|begin|break|cause|ceil|chr|clip|collate|color|co[nst]|cosh|csc|date|datum|debug|decimal|de[fgt]|degrees|delete|device|display|dot|elapsed|eps|erasable|exline|exp|external|extype|filetype|fixed|fp|go|graph|handler|idn|image|int?|internal|ip|is|keyed|[lu]bound|[lu]case|left|le[nt]|length|lines?|log2?|log10|[lr]trim|margin|ma[tx]|maxnum|mi[dn]|missing|mod|native|nul|numeric|of|option|ord|organization|outin|output|pi|pointer|points?|pos|print|program|prompt|rad|radians|randomize|record|recsize|rectype|relative|remainder|repeat|rest|retry|rewrite|right|rnd|round|same|se[ct]|select|sequential|setter|sgn|sinh|size|skip|s[qt]r|standard|status|stream|style|tab|tanh?|template|text|there|time|timeout|trace|transform|truncate|use|val|variable|viewport|when|window|with|zer|zonewidth)(?:\$|\b)/i,
operator: /<=|<>|>=|[&^=<>/*+-]|\b(?:and|eqv|imp|not|x?or)\b/i,
punctuation: /[(),:;]/
};
_.vbnet = ae("basic", {
comment: {
pattern: /(?:!|'|rem\b).*/i,
inside: {
keyword: /^rem/i
}
},
string: {
pattern: /(^|[^"])"(?:""|[^"])*"(?!")/g,
lookbehind: !0,
greedy: !0
},
keyword: /(?:\b(?:addhandler|addressof|alias|and|andalso|as|beep|bload|boolean|bsave|byref|byval|call absolute|call|case|catch|cbool|c?byte|cc?har|c?date|cdbl|cdec|chain|chdir|cu?int|class|clear|close|cls|cobj|com|common|const|continue|c?sbyte|c?u?short|c?sng|cstr|c?type|cu?lng|data|decimal|declare|def(?: fn| seg|dbl|int|lng|sng|str)|default|delegate|dim|directcast|do|double|else|elseif|enum|environ|erase|error|event|exit|false|true|field|files|finally|for each|for|friend|function|[gls]et|gettype|getxmlnamespace|global|gosub|goto|handles|i[fns]|implements|imports|inherits|input|interface|ioctl|isnot|key|kill|lib|like|line input|locate|lock|loop|[lr]set|me|mkdir|mod|module|mustinherit|mustoverride|mybase|myclass|name|namespace|narrowing|new|next|not|nothing|notinheritable|notoverridable|object|off?|on (?:com|error|key|timer)|on|open|operator|option base|option|optional|orelse|out|overloads|overridable|overrides|paramarray|partial|poke|private|property|protected|public|put|raiseevent|read|readonly|redim|removehandler|restore|resume|return|rmdir|run|select case|select|shadows|shared|shell|single|sleep|static|step|stop|string|structure|sub|swap|synclock|system|[tw]hen|throw|timer|to|troff|tron|try|trycast|typeof|u?integer|u?long|unlock|until|using|view print|wait|w?end|while|widening|with|withevents|write|writeonly|x?or)|\B#(?:const|else|elseif|end|if))(?:\$|\b)/i,
punctuation: /[(){},:;]/
});
var Wt = {
// https://en.cppreference.com/w/c/language/character_constant
pattern: /'(?:\\[^]|[^\\\n']){0,32}'/g,
greedy: !0
}, jt = {
pattern: /\/\/(?:[^\\\n]|\\\n?)*|\/\*[^]*?(?:\*\/|$)/g,
greedy: !0
}, Yt = {
// https://en.cppreference.com/w/c/language/string_literal
pattern: /"(?:\\[^]|[^\\\n"])*"/g,
greedy: !0
}, Xt = {
pattern: /\S[^]*/
};
Xt.inside = _.c = {
comment: jt,
char: Wt,
macro: {
// allow for multiline macro definitions
// spaces after the # character compile fine with gcc
pattern: /(^[ ]*)#\s*[a-z](?:[^\\\n/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\[^])*/img,
lookbehind: !0,
greedy: !0,
alias: "property",
inside: {
string: [
{
// highlight the path of the include statement as a string
pattern: /^(#\s*include\s*)<[^>]+>/,
lookbehind: !0
},
Yt
],
char: Wt,
comment: jt,
"macro-name": [
{
pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
lookbehind: !0
},
{
pattern: /(^#\s*define\s+)\w+/i,
lookbehind: !0,
alias: "function"
}
],
// highlight macro directives as keywords
directive: {
pattern: /^(#\s*)[a-z]+/,
lookbehind: !0,
alias: "keyword"
},
"directive-hash": /^#/,
punctuation: /##|\\(?=\n)/,
expression: Xt
}
},
string: Yt,
"class-name": {
pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([^]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
lookbehind: !0
},
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/,
// 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/,
function: /\b[a-z_]\w*(?=\s*\()/i,
number: /(?:\b0x(?:[a-f\d]+(?:\.[a-f\d]*)?|\.[a-f\d]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
operator: /->|([&|:+-])\1|[?:~]|>>=?|<<=?|[%&|^!=<>/*+-]=?/,
punctuation: te
};
$(
_.opencl = ae("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(?:[a-f\d]+(?:\.[a-f\d]*)?|\.[a-f\d]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[fuhl]{0,4}/i,
boolean: q,
"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|LN2|LN10|LOG2E?|LOG10E?|PI(?:_[24])?|SQRT(?:1_2|2))(?:_F|_H)?|NAN|(?:UCHAR|UINT|ULONG|USHRT)_MAX)\b/,
alias: "constant"
}
}),
"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)|ndrange_t|ptrdiff_t|queue_t|reserve_id_t|sampler_t|size_t|u?intptr_t)\b/,
alias: "keyword"
}
}
);
var ft = {
// 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)(?:[2348]|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|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)|RA?|READ_(?:ONLY|WRITE)_CACHE|RG|RGB[Ax]?|RG?x|RUNNING|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_5[56]5|VERSION_(?:1_[012]|2_[01])|s?BGRA|sRGB[Ax]?)\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|Image[23]D|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"
}
};
$(_.c, "keyword", ft);
_.cpp && (ft["type-opencl-host-cpp"] = {
pattern: /\b(?:Buffer|BufferGL|BufferRenderGL|CommandQueue|Context|Device|DeviceCommandQueue|EnqueueArgs|Event|Image(?:[123]D|[12]DArray|1DBuffer|[23]DGL|Format|GL)?|Kernel|KernelFunctor|LocalSpaceArg|Memory|NDRange|Pipe|Platform|Program|SVMAllocator|SVMTrait(?:Atomic|Coarse|Fine|ReadOnly|ReadWrite|WriteOnly)|Sampler|UserEvent)\b/,
alias: "keyword"
}, $(_.cpp, "keyword", ft));
var ga = _.diff = {
// Match all kinds of coord lines (prefixed by "+++", "---" or "***").
// Match "@@ ... @@" coord lines in unified diff.
// Match coord lines in normal diff (starts with a number).
coord: /^(?:\*{3}|-{3}|\+{3}|\d).*$|^@@.*@@$/m
// deleted, inserted, unchanged, diff
}, rt = {
"deleted-sign": "-",
"deleted-arrow": "<",
"inserted-sign": "+",
"inserted-arrow": ">",
unchanged: " ",
diff: "!"
};
for (var ce in rt) {
var it = ce.split("-")[0];
ga[ce] = {
pattern: RegExp("^(?:[" + rt[ce] + `].*$
?)+`, "m"),
alias: it != ce ? it : ce == "diff" ? "bold" : void 0,
inside: {
prefix: {
pattern: RegExp("^[" + rt[ce] + "]", "mg"),
greedy: !0,
alias: it
}
}
};
}
var st = /\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|opens?|package|permits|private|protected|provides|public|record(?!\s*[()[\]{}%~.,:;?%&|^=<>/*+-])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throws?|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/, Ae = "(?:[a-z]\\w*\\s*\\.\\s*)*(?:[A-Z]\\w*\\s*\\.\\s*)*", gt = {
pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
inside: {
punctuation: /\./
}
}, mt = {
namespace: gt,
punctuation: /\./
}, Qt = {
pattern: RegExp(`(^|[^\\w.])${Ae}[A-Z](?:[\\d_A-Z]*[a-z]\\w*)?\\b`),
lookbehind: !0,
inside: mt
};
_.java = {
"doc-comment": {
pattern: /\/\*\*(?!\/)[^]*?(?:\*\/|$)/g,
greedy: !0,
alias: "comment",
inside: "javadoc"
},
comment: re(),
"triple-quoted-string": {
// http://openjdk.java.net/jeps/355#Description
pattern: /"""[ ]*\n(?:\\.|[^\\])*?"""/g,
greedy: !0,
alias: "string"
},
char: {
pattern: /'(?:\\.|[^\\\n']){1,6}'/g,
greedy: !0
},
string: {
pattern: /(^|[^\\])"(?:\\.|[^\\\n"])*"/g,
lookbehind: !0,
greedy: !0
},
annotation: {
pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/,
lookbehind: !0,
alias: "punctuation"
},
generics: {
pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,
inside: {
"class-name": Qt,
keyword: st,
punctuation: /[().,:<>]/,
operator: /[?&|]/
}
},
import: [
{
pattern: RegExp(`(\\bimport\\s+)${Ae}(?:[A-Z]\\w*|\\*)(?=\\s*;)`),
lookbehind: !0,
inside: {
namespace: gt,
punctuation: /\./,
operator: /\*/,
"class-name": /\w+/
}
},
{
pattern: RegExp(`(\\bimport\\s+static\\s+)${Ae}(?:\\w+|\\*)(?=\\s*;)`),
lookbehind: !0,
alias: "static",
inside: {
namespace: gt,
static: /\b\w+$/,
punctuation: /\./,
operator: /\*/,
"class-name": /\w+/
}
}
],
namespace: {
pattern: RegExp(
`(\\b(?:exports|import(?:\\s+static)?|module|opens?|package|provides|requires|to|transitive|uses|with)\\s+)(?!${st.source})[a-z]\\w*(?:\\.[a-z]\\w*)*\\.?`
),
lookbehind: !0,
inside: {
punctuation: /\./
}
},
"class-name": [
Qt,
{
// 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.])${Ae}[A-Z]\\w*(?=\\s+\\w+\\s*[;,=()]|\\s*(?:\\[[\\s,]*\\]\\s*)?::\\s*new\\b)`),
lookbehind: !0,
inside: mt
},
{
// 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+)${Ae}[A-Z]\\w*\\b`),
lookbehind: !0,
inside: mt
}
],
keyword: st,
boolean: q,
function: {
pattern: /\b\w+(?=\()|(::\s*)[a-z_]\w*/,
lookbehind: !0
},
number: /\b0b[01][01_]*l?\b|\b0x(?:\.[a-f\d_p+-]+|[a-f\d_]+(?:\.[a-f\d_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,
constant: /\b[A-Z][A-Z_\d]+\b/,
operator: {
pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[%&|^!=<>/*+-]=?)/m,
lookbehind: !0
},
punctuation: te
};
$(
_.less = ae("css", {
comment: re(),
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: /[/*+-]/
}),
"property",
{
variable: [
// Variable declaration (the colon must be consumed!)
{
pattern: /@[\w-]+\s*:/,
inside: {
punctuation: /:/
}
},
// Variable usage
/@@?[\w-]+/
],
"mixin-usage": {
pattern: /([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,
lookbehind: !0,
alias: "function"
}
}
);
_.objc = _.objectivec = ae("c", {
string: {
pattern: /@?"(?:\\[^]|[^\\\n"])*"/g,
greedy: !0
},
keyword: /\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|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 _.objc["class-name"];
var Pn = {
pattern: /^(..)[^]+(?=.)/,
lookbehind: !0
}, ot = "(?:([^a-zA-Z\\d\\s{(\\[<=])(?:\\\\[\\s\\S]|(?!\\1)[^\\\\])*\\1|\\((?:\\\\[\\s\\S]|[^\\\\()]|\\((?:\\\\[\\s\\S]|[^\\\\()])*\\))*\\)|\\{(?:\\\\[\\s\\S]|[^\\\\{}]|\\{(?:\\\\[\\s\\S]|[^\\\\{}])*\\})*\\}|\\[(?:\\\\[\\s\\S]|[^\\\\[\\]]|\\[(?:\\\\[\\s\\S]|[^\\\\[\\]])*\\])*\\]|<(?:\\\\[\\s\\S]|[^\\\\<>]|<(?:\\\\[\\s\\S]|[^\\\\<>])*>)*>)", Jt = `(?:"(?:\\\\.|[^\\\\
"])*"|(?:\\b(?!\\d)\\w+|[^\\s\0-\\x7f]+)[?!]?|\\$.)`, ie = {
pattern: /((?:^|[^\\])(?:\\\\)*)#\{(?:[^{}]|\{[^}]*\})*\}/,
lookbehind: !0,
inside: {
content: Pn,
delimiter: {
pattern: /.+/,
alias: "punctuation"
}
}
};
Pn.inside = _.rb = _.ruby = {
comment: {
pattern: /#.*|^=begin\s[^]*?^=end/mg,
greedy: !0
},
"string-literal": [
{
pattern: RegExp("%[qQiIwWs]?" + ot, "g"),
greedy: !0,
inside: {
interpolation: ie,
string: /[^]+/
}
},
{
pattern: /(["'])(?:#\{[^}]+\}|#(?!\{)|\\[^]|(?!\1)[^\\#\n])*\1/g,
greedy: !0,
inside: {
interpolation: ie,
string: /[^]+/
}
},
{
pattern: /<<[-~]?([a-z_]\w*)\n(?:.*\n)*?[ ]*\1/gi,
alias: "heredoc-string",
greedy: !0,
inside: {
delimiter: {
pattern: /^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,
inside: {
symbol: /\w+/,
punctuation: /^<<[-~]?/
}
},
interpolation: ie,
string: /[^]+/
}
},
{
pattern: /<<[-~]?'([a-z_]\w*)'\n(?:.*\n)*?[ ]*\1/gi,
alias: "heredoc-string",
greedy: !0,
inside: {
delimiter: {
pattern: /^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,
inside: {
symbol: /\w+/,
punctuation: /^<<[-~]?'|'$/
}
},
string: /[^]+/
}
}
],
"command-literal": [
{
pattern: RegExp("%x" + ot, "g"),
greedy: !0,
inside: {
interpolation: ie,
command: {
pattern: /[^]+/,
alias: "string"
}
}
},
{
pattern: /`(?:#\{[^}]+\}|#(?!\{)|\\[^]|[^\\`#\n])*`/g,
greedy: !0,
inside: {
interpolation: ie,
command: {
pattern: /[^]+/,
alias: "string"
}
}
}
],
"class-name": {
pattern: /(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,
lookbehind: !0,
inside: {
punctuation: /[.\\]/
}
},
"regex-literal": [
{
pattern: RegExp(`%r${ot}[egimnosux]{0,6}`, "g"),
greedy: !0,
inside: {
interpolation: ie,
regex: /[^]+/
}
},
{
pattern: /(^|[^/])\/(?!\/)(?:\[[^\n\]]+\]|\\.|[^\\\n/[])+\/[egimnosux]{0,6}(?=\s*(?:$|[\n,.;})#]))/g,
lookbehind: !0,
greedy: !0,
inside: {
interpolation: ie,
regex: /[^]+/
}
}
],
variable: /[@$]+(?!\d)\w+(?:[?!]|\b)/,
symbol: [
{
pattern: RegExp("(^|[^:]):" + Jt, "g"),
lookbehind: !0,
greedy: !0
},
{
pattern: RegExp(`([
{(,][ ]*)` + Jt + "(?=:(?!:))", "g"),
lookbehind: !0,
greedy: !0
}
],
"method-definition": {
pattern: /(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,
lookbehind: !0,
inside: {
function: /\b\w+$/,
keyword: /^self\b/,
"class-name": /^\w+/,
punctuation: /\./
}
},
keyword: /\b(?:BEGI