Update prism/tomorrow-theme-custom/js/prism-plugins.js

This commit is contained in:
nyaong 2025-01-23 11:44:34 +09:00
parent 9dac019aaa
commit a2a272c84f

View File

@ -1,480 +1,480 @@
// Versions: 1.29.0 // Versions: 1.29.0
// Toolbar // Toolbar
!function() { !function() {
if ('undefined' != typeof Prism && 'undefined' != typeof document) { if ('undefined' != typeof Prism && 'undefined' != typeof document) {
var e = [], t = {}, n = function() { var e = [], t = {}, n = function() {
}; };
Prism.plugins.toolbar = {}; Prism.plugins.toolbar = {};
var a = Prism.plugins.toolbar.registerButton = function(n, a) { var a = Prism.plugins.toolbar.registerButton = function(n, a) {
var r; var r;
r = 'function' == typeof a ? a : function(e) { r = 'function' == typeof a ? a : function(e) {
var t; var t;
return 'function' == typeof a.onClick ? ((t = document.createElement('button')).type = 'button', t.addEventListener('click', (function() { return 'function' == typeof a.onClick ? ((t = document.createElement('button')).type = 'button', t.addEventListener('click', (function() {
a.onClick.call(this, e); a.onClick.call(this, e);
}))) : 'string' == typeof a.url ? (t = document.createElement('a')).href = a.url : t = document.createElement('span'), a.className && t.classList.add(a.className), t.textContent = a.text, t; }))) : 'string' == typeof a.url ? (t = document.createElement('a')).href = a.url : t = document.createElement('span'), a.className && t.classList.add(a.className), t.textContent = a.text, t;
}, n in t ? console.warn('There is a button with the key "' + n + '" registered already.') : e.push(t[n] = r); }, n in t ? console.warn('There is a button with the key "' + n + '" registered already.') : e.push(t[n] = r);
}, r = Prism.plugins.toolbar.hook = function(a) { }, r = Prism.plugins.toolbar.hook = function(a) {
var r = a.element.parentNode; var r = a.element.parentNode;
if (r && /pre/i.test(r.nodeName) && !r.parentNode.classList.contains('code-toolbar')) { if (r && /pre/i.test(r.nodeName) && !r.parentNode.classList.contains('code-toolbar')) {
var o = document.createElement('div'); var o = document.createElement('div');
o.classList.add('code-toolbar'), r.parentNode.insertBefore(o, r), o.appendChild(r); o.classList.add('code-toolbar'), r.parentNode.insertBefore(o, r), o.appendChild(r);
var i = document.createElement('div'); var i = document.createElement('div');
i.classList.add('toolbar'); i.classList.add('toolbar');
var l = e, d = function(e) { var l = e, d = function(e) {
for (; e;) { for (; e;) {
var t = e.getAttribute('data-toolbar-order'); var t = e.getAttribute('data-toolbar-order');
if (null != t) return (t = t.trim()).length ? t.split(/\s*,\s*/g) : []; if (null != t) return (t = t.trim()).length ? t.split(/\s*,\s*/g) : [];
e = e.parentElement; e = e.parentElement;
} }
}(a.element); }(a.element);
d && (l = d.map((function(e) { d && (l = d.map((function(e) {
return t[e] || n; return t[e] || n;
}))), l.forEach((function(e) { }))), l.forEach((function(e) {
var t = e(a); var t = e(a);
if (t) { if (t) {
var n = document.createElement('div'); var n = document.createElement('div');
n.classList.add('toolbar-item'), n.appendChild(t), i.appendChild(n); n.classList.add('toolbar-item'), n.appendChild(t), i.appendChild(n);
} }
})), o.appendChild(i); })), o.appendChild(i);
} }
}; };
a('label', (function(e) { a('label', (function(e) {
var t = e.element.parentNode; var t = e.element.parentNode;
if (t && /pre/i.test(t.nodeName) && t.hasAttribute('data-label')) { if (t && /pre/i.test(t.nodeName) && t.hasAttribute('data-label')) {
var n, a, r = t.getAttribute('data-label'); var n, a, r = t.getAttribute('data-label');
try { try {
a = document.querySelector('template#' + r); a = document.querySelector('template#' + r);
} catch (e) { } catch (e) {
} }
return a ? n = a.content : (t.hasAttribute('data-url') ? (n = document.createElement('a')).href = t.getAttribute('data-url') : n = document.createElement('span'), n.textContent = r), n; return a ? n = a.content : (t.hasAttribute('data-url') ? (n = document.createElement('a')).href = t.getAttribute('data-url') : n = document.createElement('span'), n.textContent = r), n;
} }
})), Prism.hooks.add('complete', r); })), Prism.hooks.add('complete', r);
} }
}(); }();
// Show Language // Show Language
!function() { !function() {
if ('undefined' != typeof Prism && 'undefined' != typeof document) if (Prism.plugins.toolbar) { if ('undefined' != typeof Prism && 'undefined' != typeof document) if (Prism.plugins.toolbar) {
var e = { var e = {
none: 'Plain text', none: 'Plain text',
plain: 'Plain text', plain: 'Plain text',
plaintext: 'Plain text', plaintext: 'Plain text',
text: 'Plain text', text: 'Plain text',
txt: 'Plain text', txt: 'Plain text',
html: 'HTML', html: 'HTML',
xml: 'XML', xml: 'XML',
svg: 'SVG', svg: 'SVG',
mathml: 'MathML', mathml: 'MathML',
ssml: 'SSML', ssml: 'SSML',
rss: 'RSS', rss: 'RSS',
css: 'CSS', css: 'CSS',
clike: 'C-like', clike: 'C-like',
js: 'JavaScript', js: 'JavaScript',
abap: 'ABAP', abap: 'ABAP',
abnf: 'ABNF', abnf: 'ABNF',
al: 'AL', al: 'AL',
antlr4: 'ANTLR4', antlr4: 'ANTLR4',
g4: 'ANTLR4', g4: 'ANTLR4',
apacheconf: 'Apache Configuration', apacheconf: 'Apache Configuration',
apl: 'APL', apl: 'APL',
aql: 'AQL', aql: 'AQL',
ino: 'Arduino', ino: 'Arduino',
arff: 'ARFF', arff: 'ARFF',
armasm: 'ARM Assembly', armasm: 'ARM Assembly',
'arm-asm': 'ARM Assembly', 'arm-asm': 'ARM Assembly',
art: 'Arturo', art: 'Arturo',
asciidoc: 'AsciiDoc', asciidoc: 'AsciiDoc',
adoc: 'AsciiDoc', adoc: 'AsciiDoc',
aspnet: 'ASP.NET (C#)', aspnet: 'ASP.NET (C#)',
asm6502: '6502 Assembly', asm6502: '6502 Assembly',
asmatmel: 'Atmel AVR Assembly', asmatmel: 'Atmel AVR Assembly',
autohotkey: 'AutoHotkey', autohotkey: 'AutoHotkey',
autoit: 'AutoIt', autoit: 'AutoIt',
avisynth: 'AviSynth', avisynth: 'AviSynth',
avs: 'AviSynth', avs: 'AviSynth',
'avro-idl': 'Avro IDL', 'avro-idl': 'Avro IDL',
avdl: 'Avro IDL', avdl: 'Avro IDL',
awk: 'AWK', awk: 'AWK',
gawk: 'GAWK', gawk: 'GAWK',
sh: 'Shell', sh: 'Shell',
basic: 'BASIC', basic: 'BASIC',
bbcode: 'BBcode', bbcode: 'BBcode',
bbj: 'BBj', bbj: 'BBj',
bnf: 'BNF', bnf: 'BNF',
rbnf: 'RBNF', rbnf: 'RBNF',
bqn: 'BQN', bqn: 'BQN',
bsl: 'BSL (1C:Enterprise)', bsl: 'BSL (1C:Enterprise)',
oscript: 'OneScript', oscript: 'OneScript',
csharp: 'C#', csharp: 'C#',
cs: 'C#', cs: 'C#',
dotnet: 'C#', dotnet: 'C#',
cpp: 'C++', cpp: 'C++',
cfscript: 'CFScript', cfscript: 'CFScript',
cfc: 'CFScript', cfc: 'CFScript',
cil: 'CIL', cil: 'CIL',
cilkc: 'Cilk/C', cilkc: 'Cilk/C',
'cilk-c': 'Cilk/C', 'cilk-c': 'Cilk/C',
cilkcpp: 'Cilk/C++', cilkcpp: 'Cilk/C++',
'cilk-cpp': 'Cilk/C++', 'cilk-cpp': 'Cilk/C++',
cilk: 'Cilk/C++', cilk: 'Cilk/C++',
cmake: 'CMake', cmake: 'CMake',
cobol: 'COBOL', cobol: 'COBOL',
coffee: 'CoffeeScript', coffee: 'CoffeeScript',
conc: 'Concurnas', conc: 'Concurnas',
csp: 'Content-Security-Policy', csp: 'Content-Security-Policy',
'css-extras': 'CSS Extras', 'css-extras': 'CSS Extras',
csv: 'CSV', csv: 'CSV',
cue: 'CUE', cue: 'CUE',
dataweave: 'DataWeave', dataweave: 'DataWeave',
dax: 'DAX', dax: 'DAX',
django: 'Django/Jinja2', django: 'Django/Jinja2',
jinja2: 'Django/Jinja2', jinja2: 'Django/Jinja2',
'dns-zone-file': 'DNS zone file', 'dns-zone-file': 'DNS zone file',
'dns-zone': 'DNS zone file', 'dns-zone': 'DNS zone file',
dockerfile: 'Docker', dockerfile: 'Docker',
dot: 'DOT (Graphviz)', dot: 'DOT (Graphviz)',
gv: 'DOT (Graphviz)', gv: 'DOT (Graphviz)',
ebnf: 'EBNF', ebnf: 'EBNF',
editorconfig: 'EditorConfig', editorconfig: 'EditorConfig',
ejs: 'EJS', ejs: 'EJS',
etlua: 'Embedded Lua templating', etlua: 'Embedded Lua templating',
erb: 'ERB', erb: 'ERB',
'excel-formula': 'Excel Formula', 'excel-formula': 'Excel Formula',
xlsx: 'Excel Formula', xlsx: 'Excel Formula',
xls: 'Excel Formula', xls: 'Excel Formula',
fsharp: 'F#', fsharp: 'F#',
'firestore-security-rules': 'Firestore security rules', 'firestore-security-rules': 'Firestore security rules',
ftl: 'FreeMarker Template Language', ftl: 'FreeMarker Template Language',
gml: 'GameMaker Language', gml: 'GameMaker Language',
gamemakerlanguage: 'GameMaker Language', gamemakerlanguage: 'GameMaker Language',
gap: 'GAP (CAS)', gap: 'GAP (CAS)',
gcode: 'G-code', gcode: 'G-code',
gdscript: 'GDScript', gdscript: 'GDScript',
gedcom: 'GEDCOM', gedcom: 'GEDCOM',
gettext: 'gettext', gettext: 'gettext',
po: 'gettext', po: 'gettext',
glsl: 'GLSL', glsl: 'GLSL',
gn: 'GN', gn: 'GN',
gni: 'GN', gni: 'GN',
'linker-script': 'GNU Linker Script', 'linker-script': 'GNU Linker Script',
ld: 'GNU Linker Script', ld: 'GNU Linker Script',
'go-module': 'Go module', 'go-module': 'Go module',
'go-mod': 'Go module', 'go-mod': 'Go module',
graphql: 'GraphQL', graphql: 'GraphQL',
hbs: 'Handlebars', hbs: 'Handlebars',
hs: 'Haskell', hs: 'Haskell',
hcl: 'HCL', hcl: 'HCL',
hlsl: 'HLSL', hlsl: 'HLSL',
http: 'HTTP', http: 'HTTP',
hpkp: 'HTTP Public-Key-Pins', hpkp: 'HTTP Public-Key-Pins',
hsts: 'HTTP Strict-Transport-Security', hsts: 'HTTP Strict-Transport-Security',
ichigojam: 'IchigoJam', ichigojam: 'IchigoJam',
'icu-message-format': 'ICU Message Format', 'icu-message-format': 'ICU Message Format',
idr: 'Idris', idr: 'Idris',
ignore: '.ignore', ignore: '.ignore',
gitignore: '.gitignore', gitignore: '.gitignore',
hgignore: '.hgignore', hgignore: '.hgignore',
npmignore: '.npmignore', npmignore: '.npmignore',
inform7: 'Inform 7', inform7: 'Inform 7',
javadoc: 'JavaDoc', javadoc: 'JavaDoc',
javadoclike: 'JavaDoc-like', javadoclike: 'JavaDoc-like',
javastacktrace: 'Java stack trace', javastacktrace: 'Java stack trace',
jq: 'JQ', jq: 'JQ',
jsdoc: 'JSDoc', jsdoc: 'JSDoc',
'js-extras': 'JS Extras', 'js-extras': 'JS Extras',
json: 'JSON', json: 'JSON',
webmanifest: 'Web App Manifest', webmanifest: 'Web App Manifest',
json5: 'JSON5', json5: 'JSON5',
jsonp: 'JSONP', jsonp: 'JSONP',
jsstacktrace: 'JS stack trace', jsstacktrace: 'JS stack trace',
'js-templates': 'JS Templates', 'js-templates': 'JS Templates',
keepalived: 'Keepalived Configure', keepalived: 'Keepalived Configure',
kts: 'Kotlin Script', kts: 'Kotlin Script',
kt: 'Kotlin', kt: 'Kotlin',
kumir: 'KuMir (КуМир)', kumir: 'KuMir (КуМир)',
kum: 'KuMir (КуМир)', kum: 'KuMir (КуМир)',
latex: 'LaTeX', latex: 'LaTeX',
tex: 'TeX', tex: 'TeX',
context: 'ConTeXt', context: 'ConTeXt',
lilypond: 'LilyPond', lilypond: 'LilyPond',
ly: 'LilyPond', ly: 'LilyPond',
emacs: 'Lisp', emacs: 'Lisp',
elisp: 'Lisp', elisp: 'Lisp',
'emacs-lisp': 'Lisp', 'emacs-lisp': 'Lisp',
llvm: 'LLVM IR', llvm: 'LLVM IR',
log: 'Log file', log: 'Log file',
lolcode: 'LOLCODE', lolcode: 'LOLCODE',
magma: 'Magma (CAS)', magma: 'Magma (CAS)',
md: 'Markdown', md: 'Markdown',
'markup-templating': 'Markup templating', 'markup-templating': 'Markup templating',
matlab: 'MATLAB', matlab: 'MATLAB',
maxscript: 'MAXScript', maxscript: 'MAXScript',
mel: 'MEL', mel: 'MEL',
metafont: 'METAFONT', metafont: 'METAFONT',
mongodb: 'MongoDB', mongodb: 'MongoDB',
moon: 'MoonScript', moon: 'MoonScript',
n1ql: 'N1QL', n1ql: 'N1QL',
n4js: 'N4JS', n4js: 'N4JS',
n4jsd: 'N4JS', n4jsd: 'N4JS',
'nand2tetris-hdl': 'Nand To Tetris HDL', 'nand2tetris-hdl': 'Nand To Tetris HDL',
naniscript: 'Naninovel Script', naniscript: 'Naninovel Script',
nani: 'Naninovel Script', nani: 'Naninovel Script',
nasm: 'NASM', nasm: 'NASM',
neon: 'NEON', neon: 'NEON',
nginx: 'nginx', nginx: 'nginx',
nsis: 'NSIS', nsis: 'NSIS',
objectivec: 'Objective-C', objectivec: 'Objective-C',
objc: 'Objective-C', objc: 'Objective-C',
ocaml: 'OCaml', ocaml: 'OCaml',
opencl: 'OpenCL', opencl: 'OpenCL',
openqasm: 'OpenQasm', openqasm: 'OpenQasm',
qasm: 'OpenQasm', qasm: 'OpenQasm',
parigp: 'PARI/GP', parigp: 'PARI/GP',
objectpascal: 'Object Pascal', objectpascal: 'Object Pascal',
psl: 'PATROL Scripting Language', psl: 'PATROL Scripting Language',
pcaxis: 'PC-Axis', pcaxis: 'PC-Axis',
px: 'PC-Axis', px: 'PC-Axis',
peoplecode: 'PeopleCode', peoplecode: 'PeopleCode',
pcode: 'PeopleCode', pcode: 'PeopleCode',
php: 'PHP', php: 'PHP',
phpdoc: 'PHPDoc', phpdoc: 'PHPDoc',
'php-extras': 'PHP Extras', 'php-extras': 'PHP Extras',
'plant-uml': 'PlantUML', 'plant-uml': 'PlantUML',
plantuml: 'PlantUML', plantuml: 'PlantUML',
plsql: 'PL/SQL', plsql: 'PL/SQL',
powerquery: 'PowerQuery', powerquery: 'PowerQuery',
pq: 'PowerQuery', pq: 'PowerQuery',
mscript: 'PowerQuery', mscript: 'PowerQuery',
powershell: 'PowerShell', powershell: 'PowerShell',
promql: 'PromQL', promql: 'PromQL',
properties: '.properties', properties: '.properties',
protobuf: 'Protocol Buffers', protobuf: 'Protocol Buffers',
purebasic: 'PureBasic', purebasic: 'PureBasic',
pbfasm: 'PureBasic', pbfasm: 'PureBasic',
purs: 'PureScript', purs: 'PureScript',
py: 'Python', py: 'Python',
qsharp: 'Q#', qsharp: 'Q#',
qs: 'Q#', qs: 'Q#',
q: 'Q (kdb+ database)', q: 'Q (kdb+ database)',
qml: 'QML', qml: 'QML',
rkt: 'Racket', rkt: 'Racket',
cshtml: 'Razor C#', cshtml: 'Razor C#',
razor: 'Razor C#', razor: 'Razor C#',
jsx: 'React JSX', jsx: 'React JSX',
tsx: 'React TSX', tsx: 'React TSX',
renpy: 'Ren\'py', renpy: 'Ren\'py',
rpy: 'Ren\'py', rpy: 'Ren\'py',
res: 'ReScript', res: 'ReScript',
rest: 'reST (reStructuredText)', rest: 'reST (reStructuredText)',
robotframework: 'Robot Framework', robotframework: 'Robot Framework',
robot: 'Robot Framework', robot: 'Robot Framework',
rb: 'Ruby', rb: 'Ruby',
sas: 'SAS', sas: 'SAS',
sass: 'Sass (Sass)', sass: 'Sass (Sass)',
scss: 'Sass (SCSS)', scss: 'Sass (SCSS)',
'shell-session': 'Shell session', 'shell-session': 'Shell session',
'sh-session': 'Shell session', 'sh-session': 'Shell session',
shellsession: 'Shell session', shellsession: 'Shell session',
sml: 'SML', sml: 'SML',
smlnj: 'SML/NJ', smlnj: 'SML/NJ',
solidity: 'Solidity (Ethereum)', solidity: 'Solidity (Ethereum)',
sol: 'Solidity (Ethereum)', sol: 'Solidity (Ethereum)',
'solution-file': 'Solution file', 'solution-file': 'Solution file',
sln: 'Solution file', sln: 'Solution file',
soy: 'Soy (Closure Template)', soy: 'Soy (Closure Template)',
sparql: 'SPARQL', sparql: 'SPARQL',
rq: 'SPARQL', rq: 'SPARQL',
'splunk-spl': 'Splunk SPL', 'splunk-spl': 'Splunk SPL',
sqf: 'SQF: Status Quo Function (Arma 3)', sqf: 'SQF: Status Quo Function (Arma 3)',
sql: 'SQL', sql: 'SQL',
stata: 'Stata Ado', stata: 'Stata Ado',
iecst: 'Structured Text (IEC 61131-3)', iecst: 'Structured Text (IEC 61131-3)',
supercollider: 'SuperCollider', supercollider: 'SuperCollider',
sclang: 'SuperCollider', sclang: 'SuperCollider',
systemd: 'Systemd configuration file', systemd: 'Systemd configuration file',
't4-templating': 'T4 templating', 't4-templating': 'T4 templating',
't4-cs': 'T4 Text Templates (C#)', 't4-cs': 'T4 Text Templates (C#)',
t4: 'T4 Text Templates (C#)', t4: 'T4 Text Templates (C#)',
't4-vb': 'T4 Text Templates (VB)', 't4-vb': 'T4 Text Templates (VB)',
tap: 'TAP', tap: 'TAP',
tt2: 'Template Toolkit 2', tt2: 'Template Toolkit 2',
toml: 'TOML', toml: 'TOML',
trickle: 'trickle', trickle: 'trickle',
troy: 'troy', troy: 'troy',
trig: 'TriG', trig: 'TriG',
ts: 'TypeScript', ts: 'TypeScript',
tsconfig: 'TSConfig', tsconfig: 'TSConfig',
uscript: 'UnrealScript', uscript: 'UnrealScript',
uc: 'UnrealScript', uc: 'UnrealScript',
uorazor: 'UO Razor Script', uorazor: 'UO Razor Script',
uri: 'URI', uri: 'URI',
url: 'URL', url: 'URL',
vbnet: 'VB.Net', vbnet: 'VB.Net',
vhdl: 'VHDL', vhdl: 'VHDL',
vim: 'vim', vim: 'vim',
'visual-basic': 'Visual Basic', 'visual-basic': 'Visual Basic',
vba: 'VBA', vba: 'VBA',
vb: 'Visual Basic', vb: 'Visual Basic',
wasm: 'WebAssembly', wasm: 'WebAssembly',
'web-idl': 'Web IDL', 'web-idl': 'Web IDL',
webidl: 'Web IDL', webidl: 'Web IDL',
wgsl: 'WGSL', wgsl: 'WGSL',
wiki: 'Wiki markup', wiki: 'Wiki markup',
wolfram: 'Wolfram language', wolfram: 'Wolfram language',
nb: 'Mathematica Notebook', nb: 'Mathematica Notebook',
wl: 'Wolfram language', wl: 'Wolfram language',
xeoracube: 'XeoraCube', xeoracube: 'XeoraCube',
'xml-doc': 'XML doc (.net)', 'xml-doc': 'XML doc (.net)',
xojo: 'Xojo (REALbasic)', xojo: 'Xojo (REALbasic)',
xquery: 'XQuery', xquery: 'XQuery',
yaml: 'YAML', yaml: 'YAML',
yml: 'YAML', yml: 'YAML',
yang: 'YANG', yang: 'YANG',
}; };
Prism.plugins.toolbar.registerButton('show-language', (function(a) { Prism.plugins.toolbar.registerButton('show-language', (function(a) {
var t = a.element.parentNode; var t = a.element.parentNode;
if (t && /pre/i.test(t.nodeName)) { if (t && /pre/i.test(t.nodeName)) {
var o, var o,
i = t.getAttribute('data-language') || e[a.language] || ((o = a.language) ? (o.substring(0, 1).toUpperCase() + o.substring(1)).replace(/s(?=cript)/, 'S') : o); i = t.getAttribute('data-language') || e[a.language] || ((o = a.language) ? (o.substring(0, 1).toUpperCase() + o.substring(1)).replace(/s(?=cript)/, 'S') : o);
if (i) { if (i) {
var s = document.createElement('span'); var s = document.createElement('span');
return s.textContent = i, s; return s.textContent = i, s;
} }
} }
})); }));
} else console.warn('Show Languages plugin loaded before Toolbar plugin.'); } else console.warn('Show Languages plugin loaded before Toolbar plugin.');
}(); }();
// Copy Button // Copy Button
!function() { !function() {
function t(t) { function t(t) {
var e = document.createElement('textarea'); var e = document.createElement('textarea');
e.value = t.getText(), e.style.top = '0', e.style.left = '0', e.style.position = 'fixed', document.body.appendChild(e), e.focus(), e.select(); e.value = t.getText(), e.style.top = '0', e.style.left = '0', e.style.position = 'fixed', document.body.appendChild(e), e.focus(), e.select();
try { try {
var o = document.execCommand('copy'); var o = document.execCommand('copy');
setTimeout((function() { setTimeout((function() {
o ? t.success() : t.error(); o ? t.success() : t.error();
}), 1); }), 1);
} catch (e) { } catch (e) {
setTimeout((function() { setTimeout((function() {
t.error(e); t.error(e);
}), 1); }), 1);
} }
document.body.removeChild(e); document.body.removeChild(e);
} }
'undefined' != typeof Prism && 'undefined' != typeof document && (Prism.plugins.toolbar ? Prism.plugins.toolbar.registerButton('copy-to-clipboard', (function(e) { 'undefined' != typeof Prism && 'undefined' != typeof document && (Prism.plugins.toolbar ? Prism.plugins.toolbar.registerButton('copy-to-clipboard', (function(e) {
var o = e.element, n = function(t) { var o = e.element, n = function(t) {
var e = { var e = {
copy: 'Copy', copy: 'Copy',
'copy-error': 'Press Ctrl+C to copy', 'copy-error': 'Press Ctrl+C to copy',
'copy-success': 'Copied!', 'copy-success': 'Copied!',
'copy-timeout': 5e3, 'copy-timeout': 5e3,
}; };
for (var o in e) { for (var o in e) {
for (var n = 'data-prismjs-' + o, c = t; c && !c.hasAttribute(n);) c = c.parentElement; for (var n = 'data-prismjs-' + o, c = t; c && !c.hasAttribute(n);) c = c.parentElement;
c && (e[o] = c.getAttribute(n)); c && (e[o] = c.getAttribute(n));
} }
return e; return e;
}(o), c = document.createElement('button'); }(o), c = document.createElement('button');
c.className = 'copy-to-clipboard-button', c.setAttribute('type', 'button'); c.className = 'copy-to-clipboard-button', c.setAttribute('type', 'button');
var r = document.createElement('span'); var r = document.createElement('span');
return c.appendChild(r), u('copy'), function(e, o) { return c.appendChild(r), u('copy'), function(e, o) {
e.addEventListener('click', (function() { e.addEventListener('click', (function() {
!function(e) { !function(e) {
navigator.clipboard ? navigator.clipboard.writeText(e.getText()).then(e.success, (function() { navigator.clipboard ? navigator.clipboard.writeText(e.getText()).then(e.success, (function() {
t(e); t(e);
})) : t(e); })) : t(e);
}(o); }(o);
})); }));
}(c, { }(c, {
getText: function() { getText: function() {
return o.textContent; return o.textContent;
}, success: function() { }, success: function() {
u('copy-success'), i(); u('copy-success'), i();
}, error: function() { }, error: function() {
u('copy-error'), setTimeout((function() { u('copy-error'), setTimeout((function() {
!function(t) { !function(t) {
window.getSelection().selectAllChildren(t); window.getSelection().selectAllChildren(t);
}(o); }(o);
}), 1), i(); }), 1), i();
}, },
}), c; }), c;
function i() { function i() {
setTimeout((function() { setTimeout((function() {
u('copy'); u('copy');
}), n['copy-timeout']); }), n['copy-timeout']);
} }
function u(t) { function u(t) {
r.textContent = n[t], c.setAttribute('data-copy-state', t); r.textContent = n[t], c.setAttribute('data-copy-state', t);
} }
})) : console.warn('Copy to Clipboard plugin loaded before Toolbar plugin.')); })) : console.warn('Copy to Clipboard plugin loaded before Toolbar plugin.'));
}(); }();
// Line Numbers // Line Numbers
!function() { !function() {
if ('undefined' != typeof Prism && 'undefined' != typeof document) { if ('undefined' != typeof Prism && 'undefined' != typeof document) {
var e = 'line-numbers', n = /\n(?!$)/g, t = Prism.plugins.lineNumbers = { var e = 'line-numbers', n = /\n(?!$)/g, t = Prism.plugins.lineNumbers = {
getLine: function(n, t) { getLine: function(n, t) {
if ('PRE' === n.tagName && n.classList.contains(e)) { if ('PRE' === n.tagName && n.classList.contains(e)) {
var i = n.querySelector('.line-numbers-rows'); var i = n.querySelector('.line-numbers-rows');
if (i) { if (i) {
var r = parseInt(n.getAttribute('data-start'), 10) || 1, s = r + (i.children.length - 1); var r = parseInt(n.getAttribute('data-start'), 10) || 1, s = r + (i.children.length - 1);
t < r && (t = r), t > s && (t = s); t < r && (t = r), t > s && (t = s);
var l = t - r; var l = t - r;
return i.children[l]; return i.children[l];
} }
} }
}, resize: function(e) { }, resize: function(e) {
r([e]); r([e]);
}, assumeViewportIndependence: !0, }, assumeViewportIndependence: !0,
}, i = void 0; }, i = void 0;
window.addEventListener('resize', (function() { window.addEventListener('resize', (function() {
t.assumeViewportIndependence && i === window.innerWidth || (i = window.innerWidth, r(Array.prototype.slice.call(document.querySelectorAll('pre.line-numbers')))); t.assumeViewportIndependence && i === window.innerWidth || (i = window.innerWidth, r(Array.prototype.slice.call(document.querySelectorAll('pre.line-numbers'))));
})), Prism.hooks.add('complete', (function(t) { })), Prism.hooks.add('complete', (function(t) {
if (t.code) { if (t.code) {
var i = t.element, s = i.parentNode; var i = t.element, s = i.parentNode;
if (s && /pre/i.test(s.nodeName) && !i.querySelector('.line-numbers-rows') && Prism.util.isActive(i, e)) { if (s && /pre/i.test(s.nodeName) && !i.querySelector('.line-numbers-rows') && Prism.util.isActive(i, e)) {
i.classList.remove(e), s.classList.add(e); i.classList.remove(e), s.classList.add(e);
var l, o = t.code.match(n), a = o ? o.length + 1 : 1, u = new Array(a + 1).join('<span></span>'); var l, o = t.code.match(n), a = o ? o.length + 1 : 1, u = new Array(a + 1).join('<span></span>');
(l = document.createElement('span')).setAttribute('aria-hidden', 'true'), l.className = 'line-numbers-rows', l.innerHTML = u, s.hasAttribute('data-start') && (s.style.counterReset = 'linenumber ' + (parseInt(s.getAttribute('data-start'), 10) - 1)), t.element.appendChild(l), r([s]), Prism.hooks.run('line-numbers', t); (l = document.createElement('span')).setAttribute('aria-hidden', 'true'), l.className = 'line-numbers-rows', l.innerHTML = u, s.hasAttribute('data-start') && (s.style.counterReset = 'linenumber ' + (parseInt(s.getAttribute('data-start'), 10) - 1)), t.element.appendChild(l), r([s]), Prism.hooks.run('line-numbers', t);
} }
} }
})), Prism.hooks.add('line-numbers', (function(e) { })), Prism.hooks.add('line-numbers', (function(e) {
e.plugins = e.plugins || {}, e.plugins.lineNumbers = !0; e.plugins = e.plugins || {}, e.plugins.lineNumbers = !0;
})); }));
} }
function r(e) { function r(e) {
if (0 != (e = e.filter((function(e) { if (0 != (e = e.filter((function(e) {
var n, var n,
t = (n = e, n ? window.getComputedStyle ? getComputedStyle(n) : n.currentStyle || null : null)['white-space']; t = (n = e, n ? window.getComputedStyle ? getComputedStyle(n) : n.currentStyle || null : null)['white-space'];
return 'pre-wrap' === t || 'pre-line' === t; return 'pre-wrap' === t || 'pre-line' === t;
}))).length) { }))).length) {
var t = e.map((function(e) { var t = e.map((function(e) {
var t = e.querySelector('code'), i = e.querySelector('.line-numbers-rows'); var t = e.querySelector('code'), i = e.querySelector('.line-numbers-rows');
if (t && i) { if (t && i) {
var r = e.querySelector('.line-numbers-sizer'), s = t.textContent.split(n); var r = e.querySelector('.line-numbers-sizer'), s = t.textContent.split(n);
r || ((r = document.createElement('span')).className = 'line-numbers-sizer', t.appendChild(r)), r.innerHTML = '0', r.style.display = 'block'; r || ((r = document.createElement('span')).className = 'line-numbers-sizer', t.appendChild(r)), r.innerHTML = '0', r.style.display = 'block';
var l = r.getBoundingClientRect().height; var l = r.getBoundingClientRect().height;
return r.innerHTML = '', { element: e, lines: s, lineHeights: [], oneLinerHeight: l, sizer: r }; return r.innerHTML = '', { element: e, lines: s, lineHeights: [], oneLinerHeight: l, sizer: r };
} }
})).filter(Boolean); })).filter(Boolean);
t.forEach((function(e) { t.forEach((function(e) {
var n = e.sizer, t = e.lines, i = e.lineHeights, r = e.oneLinerHeight; var n = e.sizer, t = e.lines, i = e.lineHeights, r = e.oneLinerHeight;
i[t.length - 1] = void 0, t.forEach((function(e, t) { i[t.length - 1] = void 0, t.forEach((function(e, t) {
if (e && e.length > 1) { if (e && e.length > 1) {
var s = n.appendChild(document.createElement('span')); var s = n.appendChild(document.createElement('span'));
s.style.display = 'block', s.textContent = e; s.style.display = 'block', s.textContent = e;
} else i[t] = r; } else i[t] = r;
})); }));
})), t.forEach((function(e) { })), t.forEach((function(e) {
for (var n = e.sizer, t = e.lineHeights, i = 0, r = 0; r < t.length; r++) void 0 === t[r] && (t[r] = n.children[i++].getBoundingClientRect().height); for (var n = e.sizer, t = e.lineHeights, i = 0, r = 0; r < t.length; r++) void 0 === t[r] && (t[r] = n.children[i++].getBoundingClientRect().height);
})), t.forEach((function(e) { })), t.forEach((function(e) {
var n = e.sizer, t = e.element.querySelector('.line-numbers-rows'); var n = e.sizer, t = e.element.querySelector('.line-numbers-rows');
n.style.display = 'none', n.innerHTML = '', e.lineHeights.forEach((function(e, n) { n.style.display = 'none', n.innerHTML = '', e.lineHeights.forEach((function(e, n) {
t.children[n].style.height = e + 'px'; t.children[n].style.height = e + 'px';
})); }));
})); }));
} }
} }
}(); }();