UNPKG

137 kBJavaScriptView Raw
1/**
2 * Prism: Lightweight, robust, elegant syntax highlighting
3 *
4 * @license MIT <https://opensource.org/licenses/MIT>
5 * @author Lea Verou <https://lea.verou.me>
6 * @namespace
7 * @public
8 */
9/**
10 * prism-react-renderer:
11 * This file has been modified to remove:
12 * - globals and window dependency
13 * - worker support
14 * - highlightAll and other element dependent methods
15 * - _.hooks helpers
16 * - UMD/node-specific hacks
17 * It has also been run through prettier
18 */
19
20 var Prism = (function () {
21
22 // Private helper vars
23 var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
24 var uniqueId = 0;
25
26 // The grammar object for plaintext
27 var plainTextGrammar = {};
28
29
30 var _ = {
31 /**
32 * A namespace for utility methods.
33 *
34 * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
35 * change or disappear at any time.
36 *
37 * @namespace
38 * @memberof Prism
39 */
40 util: {
41 encode: function encode(tokens) {
42 if (tokens instanceof Token) {
43 return new Token(tokens.type, encode(tokens.content), tokens.alias);
44 } else if (Array.isArray(tokens)) {
45 return tokens.map(encode);
46 } else {
47 return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\u00a0/g, ' ');
48 }
49 },
50
51 /**
52 * Returns the name of the type of the given value.
53 *
54 * @param {any} o
55 * @returns {string}
56 * @example
57 * type(null) === 'Null'
58 * type(undefined) === 'Undefined'
59 * type(123) === 'Number'
60 * type('foo') === 'String'
61 * type(true) === 'Boolean'
62 * type([1, 2]) === 'Array'
63 * type({}) === 'Object'
64 * type(String) === 'Function'
65 * type(/abc+/) === 'RegExp'
66 */
67 type: function (o) {
68 return Object.prototype.toString.call(o).slice(8, -1);
69 },
70
71 /**
72 * Returns a unique number for the given object. Later calls will still return the same number.
73 *
74 * @param {Object} obj
75 * @returns {number}
76 */
77 objId: function (obj) {
78 if (!obj['__id']) {
79 Object.defineProperty(obj, '__id', { value: ++uniqueId });
80 }
81 return obj['__id'];
82 },
83
84 /**
85 * Creates a deep clone of the given object.
86 *
87 * The main intended use of this function is to clone language definitions.
88 *
89 * @param {T} o
90 * @param {Record<number, any>} [visited]
91 * @returns {T}
92 * @template T
93 */
94 clone: function deepClone(o, visited) {
95 visited = visited || {};
96
97 var clone; var id;
98 switch (_.util.type(o)) {
99 case 'Object':
100 id = _.util.objId(o);
101 if (visited[id]) {
102 return visited[id];
103 }
104 clone = /** @type {Record<string, any>} */ ({});
105 visited[id] = clone;
106
107 for (var key in o) {
108 if (o.hasOwnProperty(key)) {
109 clone[key] = deepClone(o[key], visited);
110 }
111 }
112
113 return /** @type {any} */ (clone);
114
115 case 'Array':
116 id = _.util.objId(o);
117 if (visited[id]) {
118 return visited[id];
119 }
120 clone = [];
121 visited[id] = clone;
122
123 (/** @type {Array} */(/** @type {any} */(o))).forEach(function (v, i) {
124 clone[i] = deepClone(v, visited);
125 });
126
127 return /** @type {any} */ (clone);
128
129 default:
130 return o;
131 }
132 },
133
134 /**
135 * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
136 *
137 * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
138 *
139 * @param {Element} element
140 * @returns {string}
141 */
142 getLanguage: function (element) {
143 while (element) {
144 var m = lang.exec(element.className);
145 if (m) {
146 return m[1].toLowerCase();
147 }
148 element = element.parentElement;
149 }
150 return 'none';
151 },
152
153 /**
154 * Sets the Prism `language-xxxx` class of the given element.
155 *
156 * @param {Element} element
157 * @param {string} language
158 * @returns {void}
159 */
160 setLanguage: function (element, language) {
161 // remove all `language-xxxx` classes
162 // (this might leave behind a leading space)
163 element.className = element.className.replace(RegExp(lang, 'gi'), '');
164
165 // add the new `language-xxxx` class
166 // (using `classList` will automatically clean up spaces for us)
167 element.classList.add('language-' + language);
168 },
169
170 /**
171 * Returns whether a given class is active for `element`.
172 *
173 * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
174 * if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
175 * given class is just the given class with a `no-` prefix.
176 *
177 * Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
178 * closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
179 * ancestors have the given class or the negated version of it, then the default activation will be returned.
180 *
181 * In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
182 * version of it, the class is considered active.
183 *
184 * @param {Element} element
185 * @param {string} className
186 * @param {boolean} [defaultActivation=false]
187 * @returns {boolean}
188 */
189 isActive: function (element, className, defaultActivation) {
190 var no = 'no-' + className;
191
192 while (element) {
193 var classList = element.classList;
194 if (classList.contains(className)) {
195 return true;
196 }
197 if (classList.contains(no)) {
198 return false;
199 }
200 element = element.parentElement;
201 }
202 return !!defaultActivation;
203 }
204 },
205
206 /**
207 * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
208 *
209 * @namespace
210 * @memberof Prism
211 * @public
212 */
213 languages: {
214 /**
215 * The grammar for plain, unformatted text.
216 */
217 plain: plainTextGrammar,
218 plaintext: plainTextGrammar,
219 text: plainTextGrammar,
220 txt: plainTextGrammar,
221
222 /**
223 * Creates a deep copy of the language with the given id and appends the given tokens.
224 *
225 * If a token in `redef` also appears in the copied language, then the existing token in the copied language
226 * will be overwritten at its original position.
227 *
228 * ## Best practices
229 *
230 * Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
231 * doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
232 * understand the language definition because, normally, the order of tokens matters in Prism grammars.
233 *
234 * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
235 * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
236 *
237 * @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
238 * @param {Grammar} redef The new tokens to append.
239 * @returns {Grammar} The new language created.
240 * @public
241 * @example
242 * Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
243 * // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
244 * // at its original position
245 * 'comment': { ... },
246 * // CSS doesn't have a 'color' token, so this token will be appended
247 * 'color': /\b(?:red|green|blue)\b/
248 * });
249 */
250 extend: function (id, redef) {
251 var lang = _.util.clone(_.languages[id]);
252
253 for (var key in redef) {
254 lang[key] = redef[key];
255 }
256
257 return lang;
258 },
259
260 /**
261 * Inserts tokens _before_ another token in a language definition or any other grammar.
262 *
263 * ## Usage
264 *
265 * This helper method makes it easy to modify existing languages. For example, the CSS language definition
266 * not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
267 * in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
268 * appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
269 * this:
270 *
271 * ```js
272 * Prism.languages.markup.style = {
273 * // token
274 * };
275 * ```
276 *
277 * then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
278 * before existing tokens. For the CSS example above, you would use it like this:
279 *
280 * ```js
281 * Prism.languages.insertBefore('markup', 'cdata', {
282 * 'style': {
283 * // token
284 * }
285 * });
286 * ```
287 *
288 * ## Special cases
289 *
290 * If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
291 * will be ignored.
292 *
293 * This behavior can be used to insert tokens after `before`:
294 *
295 * ```js
296 * Prism.languages.insertBefore('markup', 'comment', {
297 * 'comment': Prism.languages.markup.comment,
298 * // tokens after 'comment'
299 * });
300 * ```
301 *
302 * ## Limitations
303 *
304 * The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
305 * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
306 * differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
307 * deleting properties which is necessary to insert at arbitrary positions.
308 *
309 * To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
310 * Instead, it will create a new object and replace all references to the target object with the new one. This
311 * can be done without temporarily deleting properties, so the iteration order is well-defined.
312 *
313 * However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
314 * you hold the target object in a variable, then the value of the variable will not change.
315 *
316 * ```js
317 * var oldMarkup = Prism.languages.markup;
318 * var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
319 *
320 * assert(oldMarkup !== Prism.languages.markup);
321 * assert(newMarkup === Prism.languages.markup);
322 * ```
323 *
324 * @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
325 * object to be modified.
326 * @param {string} before The key to insert before.
327 * @param {Grammar} insert An object containing the key-value pairs to be inserted.
328 * @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
329 * object to be modified.
330 *
331 * Defaults to `Prism.languages`.
332 * @returns {Grammar} The new grammar object.
333 * @public
334 */
335 insertBefore: function (inside, before, insert, root) {
336 root = root || /** @type {any} */ (_.languages);
337 var grammar = root[inside];
338 /** @type {Grammar} */
339 var ret = {};
340
341 for (var token in grammar) {
342 if (grammar.hasOwnProperty(token)) {
343
344 if (token == before) {
345 for (var newToken in insert) {
346 if (insert.hasOwnProperty(newToken)) {
347 ret[newToken] = insert[newToken];
348 }
349 }
350 }
351
352 // Do not insert token which also occur in insert. See #1525
353 if (!insert.hasOwnProperty(token)) {
354 ret[token] = grammar[token];
355 }
356 }
357 }
358
359 var old = root[inside];
360 root[inside] = ret;
361
362 // Update references in other language definitions
363 _.languages.DFS(_.languages, function (key, value) {
364 if (value === old && key != inside) {
365 this[key] = ret;
366 }
367 });
368
369 return ret;
370 },
371
372 // Traverse a language definition with Depth First Search
373 DFS: function DFS(o, callback, type, visited) {
374 visited = visited || {};
375
376 var objId = _.util.objId;
377
378 for (var i in o) {
379 if (o.hasOwnProperty(i)) {
380 callback.call(o, i, o[i], type || i);
381
382 var property = o[i];
383 var propertyType = _.util.type(property);
384
385 if (propertyType === 'Object' && !visited[objId(property)]) {
386 visited[objId(property)] = true;
387 DFS(property, callback, null, visited);
388 } else if (propertyType === 'Array' && !visited[objId(property)]) {
389 visited[objId(property)] = true;
390 DFS(property, callback, i, visited);
391 }
392 }
393 }
394 }
395 },
396
397 plugins: {},
398
399
400 /**
401 * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
402 * and the language definitions to use, and returns a string with the HTML produced.
403 *
404 * The following hooks will be run:
405 * 1. `before-tokenize`
406 * 2. `after-tokenize`
407 * 3. `wrap`: On each {@link Token}.
408 *
409 * @param {string} text A string with the code to be highlighted.
410 * @param {Grammar} grammar An object containing the tokens to use.
411 *
412 * Usually a language definition like `Prism.languages.markup`.
413 * @param {string} language The name of the language definition passed to `grammar`.
414 * @returns {string} The highlighted HTML.
415 * @memberof Prism
416 * @public
417 * @example
418 * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
419 */
420 highlight: function (text, grammar, language) {
421 var env = {
422 code: text,
423 grammar: grammar,
424 language: language
425 };
426 _.hooks.run('before-tokenize', env);
427 env.tokens = _.tokenize(env.code, env.grammar);
428 _.hooks.run('after-tokenize', env);
429 return Token.stringify(_.util.encode(env.tokens), env.language);
430 },
431
432 /**
433 * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
434 * and the language definitions to use, and returns an array with the tokenized code.
435 *
436 * When the language definition includes nested tokens, the function is called recursively on each of these tokens.
437 *
438 * This method could be useful in other contexts as well, as a very crude parser.
439 *
440 * @param {string} text A string with the code to be highlighted.
441 * @param {Grammar} grammar An object containing the tokens to use.
442 *
443 * Usually a language definition like `Prism.languages.markup`.
444 * @returns {TokenStream} An array of strings and tokens, a token stream.
445 * @memberof Prism
446 * @public
447 * @example
448 * let code = `var foo = 0;`;
449 * let tokens = Prism.tokenize(code, Prism.languages.javascript);
450 * tokens.forEach(token => {
451 * if (token instanceof Prism.Token && token.type === 'number') {
452 * console.log(`Found numeric literal: ${token.content}`);
453 * }
454 * });
455 */
456 tokenize: function (text, grammar) {
457 var rest = grammar.rest;
458 if (rest) {
459 for (var token in rest) {
460 grammar[token] = rest[token];
461 }
462
463 delete grammar.rest;
464 }
465
466 var tokenList = new LinkedList();
467 addAfter(tokenList, tokenList.head, text);
468
469 matchGrammar(text, tokenList, grammar, tokenList.head, 0);
470
471 return toArray(tokenList);
472 },
473
474 /**
475 * @namespace
476 * @memberof Prism
477 * @public
478 */
479 hooks: {
480 all: {},
481
482 /**
483 * Adds the given callback to the list of callbacks for the given hook.
484 *
485 * The callback will be invoked when the hook it is registered for is run.
486 * Hooks are usually directly run by a highlight function but you can also run hooks yourself.
487 *
488 * One callback function can be registered to multiple hooks and the same hook multiple times.
489 *
490 * @param {string} name The name of the hook.
491 * @param {HookCallback} callback The callback function which is given environment variables.
492 * @public
493 */
494 add: function (name, callback) {
495 var hooks = _.hooks.all;
496
497 hooks[name] = hooks[name] || [];
498
499 hooks[name].push(callback);
500 },
501
502 /**
503 * Runs a hook invoking all registered callbacks with the given environment variables.
504 *
505 * Callbacks will be invoked synchronously and in the order in which they were registered.
506 *
507 * @param {string} name The name of the hook.
508 * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
509 * @public
510 */
511 run: function (name, env) {
512 var callbacks = _.hooks.all[name];
513
514 if (!callbacks || !callbacks.length) {
515 return;
516 }
517
518 for (var i = 0, callback; (callback = callbacks[i++]);) {
519 callback(env);
520 }
521 }
522 },
523
524 Token: Token
525 };
526
527
528 // Typescript note:
529 // The following can be used to import the Token type in JSDoc:
530 //
531 // @typedef {InstanceType<import("./prism-core")["Token"]>} Token
532
533 /**
534 * Creates a new token.
535 *
536 * @param {string} type See {@link Token#type type}
537 * @param {string | TokenStream} content See {@link Token#content content}
538 * @param {string|string[]} [alias] The alias(es) of the token.
539 * @param {string} [matchedStr=""] A copy of the full string this token was created from.
540 * @class
541 * @global
542 * @public
543 */
544 function Token(type, content, alias, matchedStr) {
545 /**
546 * The type of the token.
547 *
548 * This is usually the key of a pattern in a {@link Grammar}.
549 *
550 * @type {string}
551 * @see GrammarToken
552 * @public
553 */
554 this.type = type;
555 /**
556 * The strings or tokens contained by this token.
557 *
558 * This will be a token stream if the pattern matched also defined an `inside` grammar.
559 *
560 * @type {string | TokenStream}
561 * @public
562 */
563 this.content = content;
564 /**
565 * The alias(es) of the token.
566 *
567 * @type {string|string[]}
568 * @see GrammarToken
569 * @public
570 */
571 this.alias = alias;
572 // Copy of the full string this token was created from
573 this.length = (matchedStr || '').length | 0;
574 }
575
576 /**
577 * A token stream is an array of strings and {@link Token Token} objects.
578 *
579 * Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process
580 * them.
581 *
582 * 1. No adjacent strings.
583 * 2. No empty strings.
584 *
585 * The only exception here is the token stream that only contains the empty string and nothing else.
586 *
587 * @typedef {Array<string | Token>} TokenStream
588 * @global
589 * @public
590 */
591
592 /**
593 * Converts the given token or token stream to an HTML representation.
594 *
595 * The following hooks will be run:
596 * 1. `wrap`: On each {@link Token}.
597 *
598 * @param {string | Token | TokenStream} o The token or token stream to be converted.
599 * @param {string} language The name of current language.
600 * @returns {string} The HTML representation of the token or token stream.
601 * @memberof Token
602 * @static
603 */
604 Token.stringify = function stringify(o, language) {
605 if (typeof o == 'string') {
606 return o;
607 }
608 if (Array.isArray(o)) {
609 var s = '';
610 o.forEach(function (e) {
611 s += stringify(e, language);
612 });
613 return s;
614 }
615
616 var env = {
617 type: o.type,
618 content: stringify(o.content, language),
619 tag: 'span',
620 classes: ['token', o.type],
621 attributes: {},
622 language: language
623 };
624
625 var aliases = o.alias;
626 if (aliases) {
627 if (Array.isArray(aliases)) {
628 Array.prototype.push.apply(env.classes, aliases);
629 } else {
630 env.classes.push(aliases);
631 }
632 }
633
634 _.hooks.run('wrap', env);
635
636 var attributes = '';
637 for (var name in env.attributes) {
638 attributes += ' ' + name + '="' + (env.attributes[name] || '').replace(/"/g, '&quot;') + '"';
639 }
640
641 return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>';
642 };
643
644 /**
645 * @param {RegExp} pattern
646 * @param {number} pos
647 * @param {string} text
648 * @param {boolean} lookbehind
649 * @returns {RegExpExecArray | null}
650 */
651 function matchPattern(pattern, pos, text, lookbehind) {
652 pattern.lastIndex = pos;
653 var match = pattern.exec(text);
654 if (match && lookbehind && match[1]) {
655 // change the match to remove the text matched by the Prism lookbehind group
656 var lookbehindLength = match[1].length;
657 match.index += lookbehindLength;
658 match[0] = match[0].slice(lookbehindLength);
659 }
660 return match;
661 }
662
663 /**
664 * @param {string} text
665 * @param {LinkedList<string | Token>} tokenList
666 * @param {any} grammar
667 * @param {LinkedListNode<string | Token>} startNode
668 * @param {number} startPos
669 * @param {RematchOptions} [rematch]
670 * @returns {void}
671 * @private
672 *
673 * @typedef RematchOptions
674 * @property {string} cause
675 * @property {number} reach
676 */
677 function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
678 for (var token in grammar) {
679 if (!grammar.hasOwnProperty(token) || !grammar[token]) {
680 continue;
681 }
682
683 var patterns = grammar[token];
684 patterns = Array.isArray(patterns) ? patterns : [patterns];
685
686 for (var j = 0; j < patterns.length; ++j) {
687 if (rematch && rematch.cause == token + ',' + j) {
688 return;
689 }
690
691 var patternObj = patterns[j];
692 var inside = patternObj.inside;
693 var lookbehind = !!patternObj.lookbehind;
694 var greedy = !!patternObj.greedy;
695 var alias = patternObj.alias;
696
697 if (greedy && !patternObj.pattern.global) {
698 // Without the global flag, lastIndex won't work
699 var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
700 patternObj.pattern = RegExp(patternObj.pattern.source, flags + 'g');
701 }
702
703 /** @type {RegExp} */
704 var pattern = patternObj.pattern || patternObj;
705
706 for ( // iterate the token list and keep track of the current token/string position
707 var currentNode = startNode.next, pos = startPos;
708 currentNode !== tokenList.tail;
709 pos += currentNode.value.length, currentNode = currentNode.next
710 ) {
711
712 if (rematch && pos >= rematch.reach) {
713 break;
714 }
715
716 var str = currentNode.value;
717
718 if (tokenList.length > text.length) {
719 // Something went terribly wrong, ABORT, ABORT!
720 return;
721 }
722
723 if (str instanceof Token) {
724 continue;
725 }
726
727 var removeCount = 1; // this is the to parameter of removeBetween
728 var match;
729
730 if (greedy) {
731 match = matchPattern(pattern, pos, text, lookbehind);
732 if (!match || match.index >= text.length) {
733 break;
734 }
735
736 var from = match.index;
737 var to = match.index + match[0].length;
738 var p = pos;
739
740 // find the node that contains the match
741 p += currentNode.value.length;
742 while (from >= p) {
743 currentNode = currentNode.next;
744 p += currentNode.value.length;
745 }
746 // adjust pos (and p)
747 p -= currentNode.value.length;
748 pos = p;
749
750 // the current node is a Token, then the match starts inside another Token, which is invalid
751 if (currentNode.value instanceof Token) {
752 continue;
753 }
754
755 // find the last node which is affected by this match
756 for (
757 var k = currentNode;
758 k !== tokenList.tail && (p < to || typeof k.value === 'string');
759 k = k.next
760 ) {
761 removeCount++;
762 p += k.value.length;
763 }
764 removeCount--;
765
766 // replace with the new match
767 str = text.slice(pos, p);
768 match.index -= pos;
769 } else {
770 match = matchPattern(pattern, 0, str, lookbehind);
771 if (!match) {
772 continue;
773 }
774 }
775
776 // eslint-disable-next-line no-redeclare
777 var from = match.index;
778 var matchStr = match[0];
779 var before = str.slice(0, from);
780 var after = str.slice(from + matchStr.length);
781
782 var reach = pos + str.length;
783 if (rematch && reach > rematch.reach) {
784 rematch.reach = reach;
785 }
786
787 var removeFrom = currentNode.prev;
788
789 if (before) {
790 removeFrom = addAfter(tokenList, removeFrom, before);
791 pos += before.length;
792 }
793
794 removeRange(tokenList, removeFrom, removeCount);
795
796 var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
797 currentNode = addAfter(tokenList, removeFrom, wrapped);
798
799 if (after) {
800 addAfter(tokenList, currentNode, after);
801 }
802
803 if (removeCount > 1) {
804 // at least one Token object was removed, so we have to do some rematching
805 // this can only happen if the current pattern is greedy
806
807 /** @type {RematchOptions} */
808 var nestedRematch = {
809 cause: token + ',' + j,
810 reach: reach
811 };
812 matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
813
814 // the reach might have been extended because of the rematching
815 if (rematch && nestedRematch.reach > rematch.reach) {
816 rematch.reach = nestedRematch.reach;
817 }
818 }
819 }
820 }
821 }
822 }
823
824 /**
825 * @typedef LinkedListNode
826 * @property {T} value
827 * @property {LinkedListNode<T> | null} prev The previous node.
828 * @property {LinkedListNode<T> | null} next The next node.
829 * @template T
830 * @private
831 */
832
833 /**
834 * @template T
835 * @private
836 */
837 function LinkedList() {
838 /** @type {LinkedListNode<T>} */
839 var head = { value: null, prev: null, next: null };
840 /** @type {LinkedListNode<T>} */
841 var tail = { value: null, prev: head, next: null };
842 head.next = tail;
843
844 /** @type {LinkedListNode<T>} */
845 this.head = head;
846 /** @type {LinkedListNode<T>} */
847 this.tail = tail;
848 this.length = 0;
849 }
850
851 /**
852 * Adds a new node with the given value to the list.
853 *
854 * @param {LinkedList<T>} list
855 * @param {LinkedListNode<T>} node
856 * @param {T} value
857 * @returns {LinkedListNode<T>} The added node.
858 * @template T
859 */
860 function addAfter(list, node, value) {
861 // assumes that node != list.tail && values.length >= 0
862 var next = node.next;
863
864 var newNode = { value: value, prev: node, next: next };
865 node.next = newNode;
866 next.prev = newNode;
867 list.length++;
868
869 return newNode;
870 }
871 /**
872 * Removes `count` nodes after the given node. The given node will not be removed.
873 *
874 * @param {LinkedList<T>} list
875 * @param {LinkedListNode<T>} node
876 * @param {number} count
877 * @template T
878 */
879 function removeRange(list, node, count) {
880 var next = node.next;
881 for (var i = 0; i < count && next !== list.tail; i++) {
882 next = next.next;
883 }
884 node.next = next;
885 next.prev = node;
886 list.length -= i;
887 }
888 /**
889 * @param {LinkedList<T>} list
890 * @returns {T[]}
891 * @template T
892 */
893 function toArray(list) {
894 var array = [];
895 var node = list.head.next;
896 while (node !== list.tail) {
897 array.push(node.value);
898 node = node.next;
899 }
900 return array;
901 }
902
903 return _;
904
905}());
906
907var prism = Prism;
908Prism.default = Prism;
909
910/* This content is auto-generated to include some prismjs language components: */
911
912/* "prismjs/components/prism-markup" */
913
914prism.languages.markup = {
915 'comment': {
916 pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
917 greedy: true
918 },
919 'prolog': {
920 pattern: /<\?[\s\S]+?\?>/,
921 greedy: true
922 },
923 'doctype': {
924 // https://www.w3.org/TR/xml/#NT-doctypedecl
925 pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
926 greedy: true,
927 inside: {
928 'internal-subset': {
929 pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
930 lookbehind: true,
931 greedy: true,
932 inside: null // see below
933
934 },
935 'string': {
936 pattern: /"[^"]*"|'[^']*'/,
937 greedy: true
938 },
939 'punctuation': /^<!|>$|[[\]]/,
940 'doctype-tag': /^DOCTYPE/i,
941 'name': /[^\s<>'"]+/
942 }
943 },
944 'cdata': {
945 pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
946 greedy: true
947 },
948 'tag': {
949 pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
950 greedy: true,
951 inside: {
952 'tag': {
953 pattern: /^<\/?[^\s>\/]+/,
954 inside: {
955 'punctuation': /^<\/?/,
956 'namespace': /^[^\s>\/:]+:/
957 }
958 },
959 'special-attr': [],
960 'attr-value': {
961 pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
962 inside: {
963 'punctuation': [{
964 pattern: /^=/,
965 alias: 'attr-equals'
966 }, /"|'/]
967 }
968 },
969 'punctuation': /\/?>/,
970 'attr-name': {
971 pattern: /[^\s>\/]+/,
972 inside: {
973 'namespace': /^[^\s>\/:]+:/
974 }
975 }
976 }
977 },
978 'entity': [{
979 pattern: /&[\da-z]{1,8};/i,
980 alias: 'named-entity'
981 }, /&#x?[\da-f]{1,8};/i]
982};
983prism.languages.markup['tag'].inside['attr-value'].inside['entity'] = prism.languages.markup['entity'];
984prism.languages.markup['doctype'].inside['internal-subset'].inside = prism.languages.markup; // Plugin to make entity title show the real entity, idea by Roman Komarov
985
986prism.hooks.add('wrap', function (env) {
987 if (env.type === 'entity') {
988 env.attributes['title'] = env.content.replace(/&amp;/, '&');
989 }
990});
991Object.defineProperty(prism.languages.markup.tag, 'addInlined', {
992 /**
993 * Adds an inlined language to markup.
994 *
995 * An example of an inlined language is CSS with `<style>` tags.
996 *
997 * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
998 * case insensitive.
999 * @param {string} lang The language key.
1000 * @example
1001 * addInlined('style', 'css');
1002 */
1003 value: function addInlined(tagName, lang) {
1004 var includedCdataInside = {};
1005 includedCdataInside['language-' + lang] = {
1006 pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
1007 lookbehind: true,
1008 inside: prism.languages[lang]
1009 };
1010 includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
1011 var inside = {
1012 'included-cdata': {
1013 pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1014 inside: includedCdataInside
1015 }
1016 };
1017 inside['language-' + lang] = {
1018 pattern: /[\s\S]+/,
1019 inside: prism.languages[lang]
1020 };
1021 var def = {};
1022 def[tagName] = {
1023 pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () {
1024 return tagName;
1025 }), 'i'),
1026 lookbehind: true,
1027 greedy: true,
1028 inside: inside
1029 };
1030 prism.languages.insertBefore('markup', 'cdata', def);
1031 }
1032});
1033Object.defineProperty(prism.languages.markup.tag, 'addAttribute', {
1034 /**
1035 * Adds an pattern to highlight languages embedded in HTML attributes.
1036 *
1037 * An example of an inlined language is CSS with `style` attributes.
1038 *
1039 * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
1040 * case insensitive.
1041 * @param {string} lang The language key.
1042 * @example
1043 * addAttribute('style', 'css');
1044 */
1045 value: function (attrName, lang) {
1046 prism.languages.markup.tag.inside['special-attr'].push({
1047 pattern: RegExp(/(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source, 'i'),
1048 lookbehind: true,
1049 inside: {
1050 'attr-name': /^[^\s=]+/,
1051 'attr-value': {
1052 pattern: /=[\s\S]+/,
1053 inside: {
1054 'value': {
1055 pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
1056 lookbehind: true,
1057 alias: [lang, 'language-' + lang],
1058 inside: prism.languages[lang]
1059 },
1060 'punctuation': [{
1061 pattern: /^=/,
1062 alias: 'attr-equals'
1063 }, /"|'/]
1064 }
1065 }
1066 }
1067 });
1068 }
1069});
1070prism.languages.html = prism.languages.markup;
1071prism.languages.mathml = prism.languages.markup;
1072prism.languages.svg = prism.languages.markup;
1073prism.languages.xml = prism.languages.extend('markup', {});
1074prism.languages.ssml = prism.languages.xml;
1075prism.languages.atom = prism.languages.xml;
1076prism.languages.rss = prism.languages.xml;
1077/* "prismjs/components/prism-bash" */
1078
1079(function (Prism) {
1080 // $ set | grep '^[A-Z][^[:space:]]*=' | cut -d= -f1 | tr '\n' '|'
1081 // + LC_ALL, RANDOM, REPLY, SECONDS.
1082 // + make sure PS1..4 are here as they are not always set,
1083 // - some useless things.
1084 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';
1085 var commandAfterHeredoc = {
1086 pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
1087 lookbehind: true,
1088 alias: 'punctuation',
1089 // this looks reasonably well in all themes
1090 inside: null // see below
1091
1092 };
1093 var insideString = {
1094 'bash': commandAfterHeredoc,
1095 'environment': {
1096 pattern: RegExp('\\$' + envVars),
1097 alias: 'constant'
1098 },
1099 'variable': [// [0]: Arithmetic Environment
1100 {
1101 pattern: /\$?\(\([\s\S]+?\)\)/,
1102 greedy: true,
1103 inside: {
1104 // If there is a $ sign at the beginning highlight $(( and )) as variable
1105 'variable': [{
1106 pattern: /(^\$\(\([\s\S]+)\)\)/,
1107 lookbehind: true
1108 }, /^\$\(\(/],
1109 'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
1110 // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
1111 'operator': /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
1112 // If there is no $ sign at the beginning highlight (( and )) as punctuation
1113 'punctuation': /\(\(?|\)\)?|,|;/
1114 }
1115 }, // [1]: Command Substitution
1116 {
1117 pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
1118 greedy: true,
1119 inside: {
1120 'variable': /^\$\(|^`|\)$|`$/
1121 }
1122 }, // [2]: Brace expansion
1123 {
1124 pattern: /\$\{[^}]+\}/,
1125 greedy: true,
1126 inside: {
1127 'operator': /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
1128 'punctuation': /[\[\]]/,
1129 'environment': {
1130 pattern: RegExp('(\\{)' + envVars),
1131 lookbehind: true,
1132 alias: 'constant'
1133 }
1134 }
1135 }, /\$(?:\w+|[#?*!@$])/],
1136 // Escape sequences from echo and printf's manuals, and escaped quotes.
1137 '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})/
1138 };
1139 Prism.languages.bash = {
1140 'shebang': {
1141 pattern: /^#!\s*\/.*/,
1142 alias: 'important'
1143 },
1144 'comment': {
1145 pattern: /(^|[^"{\\$])#.*/,
1146 lookbehind: true
1147 },
1148 'function-name': [// a) function foo {
1149 // b) foo() {
1150 // c) function foo() {
1151 // but not “foo {”
1152 {
1153 // a) and c)
1154 pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
1155 lookbehind: true,
1156 alias: 'function'
1157 }, {
1158 // b)
1159 pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
1160 alias: 'function'
1161 }],
1162 // Highlight variable names as variables in for and select beginnings.
1163 'for-or-select': {
1164 pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
1165 alias: 'variable',
1166 lookbehind: true
1167 },
1168 // Highlight variable names as variables in the left-hand part
1169 // of assignments (“=” and “+=”).
1170 'assign-left': {
1171 pattern: /(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,
1172 inside: {
1173 'environment': {
1174 pattern: RegExp('(^|[\\s;|&]|[<>]\\()' + envVars),
1175 lookbehind: true,
1176 alias: 'constant'
1177 }
1178 },
1179 alias: 'variable',
1180 lookbehind: true
1181 },
1182 'string': [// Support for Here-documents https://en.wikipedia.org/wiki/Here_document
1183 {
1184 pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
1185 lookbehind: true,
1186 greedy: true,
1187 inside: insideString
1188 }, // Here-document with quotes around the tag
1189 // → No expansion (so no “inside”).
1190 {
1191 pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
1192 lookbehind: true,
1193 greedy: true,
1194 inside: {
1195 'bash': commandAfterHeredoc
1196 }
1197 }, // “Normal” string
1198 {
1199 // https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
1200 pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
1201 lookbehind: true,
1202 greedy: true,
1203 inside: insideString
1204 }, {
1205 // https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
1206 pattern: /(^|[^$\\])'[^']*'/,
1207 lookbehind: true,
1208 greedy: true
1209 }, {
1210 // https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html
1211 pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
1212 greedy: true,
1213 inside: {
1214 'entity': insideString.entity
1215 }
1216 }],
1217 'environment': {
1218 pattern: RegExp('\\$?' + envVars),
1219 alias: 'constant'
1220 },
1221 'variable': insideString.variable,
1222 'function': {
1223 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;|&])/,
1224 lookbehind: true
1225 },
1226 'keyword': {
1227 pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
1228 lookbehind: true
1229 },
1230 // https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
1231 'builtin': {
1232 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;|&])/,
1233 lookbehind: true,
1234 // Alias added to make those easier to distinguish from strings.
1235 alias: 'class-name'
1236 },
1237 'boolean': {
1238 pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
1239 lookbehind: true
1240 },
1241 'file-descriptor': {
1242 pattern: /\B&\d\b/,
1243 alias: 'important'
1244 },
1245 'operator': {
1246 // Lots of redirections here, but not just that.
1247 pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
1248 inside: {
1249 'file-descriptor': {
1250 pattern: /^\d/,
1251 alias: 'important'
1252 }
1253 }
1254 },
1255 'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
1256 'number': {
1257 pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
1258 lookbehind: true
1259 }
1260 };
1261 commandAfterHeredoc.inside = Prism.languages.bash;
1262 /* Patterns in command substitution. */
1263
1264 var toBeCopied = ['comment', 'function-name', 'for-or-select', 'assign-left', 'string', 'environment', 'function', 'keyword', 'builtin', 'boolean', 'file-descriptor', 'operator', 'punctuation', 'number'];
1265 var inside = insideString.variable[1].inside;
1266
1267 for (var i = 0; i < toBeCopied.length; i++) {
1268 inside[toBeCopied[i]] = Prism.languages.bash[toBeCopied[i]];
1269 }
1270
1271 Prism.languages.shell = Prism.languages.bash;
1272})(prism);
1273/* "prismjs/components/prism-clike" */
1274
1275
1276prism.languages.clike = {
1277 'comment': [{
1278 pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
1279 lookbehind: true,
1280 greedy: true
1281 }, {
1282 pattern: /(^|[^\\:])\/\/.*/,
1283 lookbehind: true,
1284 greedy: true
1285 }],
1286 'string': {
1287 pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1288 greedy: true
1289 },
1290 'class-name': {
1291 pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
1292 lookbehind: true,
1293 inside: {
1294 'punctuation': /[.\\]/
1295 }
1296 },
1297 'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
1298 'boolean': /\b(?:false|true)\b/,
1299 'function': /\b\w+(?=\()/,
1300 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
1301 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
1302 'punctuation': /[{}[\];(),.:]/
1303};
1304/* "prismjs/components/prism-c" */
1305
1306prism.languages.c = prism.languages.extend('clike', {
1307 'comment': {
1308 pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,
1309 greedy: true
1310 },
1311 'string': {
1312 // https://en.cppreference.com/w/c/language/string_literal
1313 pattern: /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
1314 greedy: true
1315 },
1316 'class-name': {
1317 pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
1318 lookbehind: true
1319 },
1320 '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/,
1321 'function': /\b[a-z_]\w*(?=\s*\()/i,
1322 'number': /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
1323 'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/
1324});
1325prism.languages.insertBefore('c', 'string', {
1326 'char': {
1327 // https://en.cppreference.com/w/c/language/character_constant
1328 pattern: /'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,
1329 greedy: true
1330 }
1331});
1332prism.languages.insertBefore('c', 'string', {
1333 'macro': {
1334 // allow for multiline macro definitions
1335 // spaces after the # character compile fine with gcc
1336 pattern: /(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,
1337 lookbehind: true,
1338 greedy: true,
1339 alias: 'property',
1340 inside: {
1341 'string': [{
1342 // highlight the path of the include statement as a string
1343 pattern: /^(#\s*include\s*)<[^>]+>/,
1344 lookbehind: true
1345 }, prism.languages.c['string']],
1346 'char': prism.languages.c['char'],
1347 'comment': prism.languages.c['comment'],
1348 'macro-name': [{
1349 pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
1350 lookbehind: true
1351 }, {
1352 pattern: /(^#\s*define\s+)\w+\b(?=\()/i,
1353 lookbehind: true,
1354 alias: 'function'
1355 }],
1356 // highlight macro directives as keywords
1357 'directive': {
1358 pattern: /^(#\s*)[a-z]+/,
1359 lookbehind: true,
1360 alias: 'keyword'
1361 },
1362 'directive-hash': /^#/,
1363 'punctuation': /##|\\(?=[\r\n])/,
1364 'expression': {
1365 pattern: /\S[\s\S]*/,
1366 inside: prism.languages.c
1367 }
1368 }
1369 }
1370});
1371prism.languages.insertBefore('c', 'function', {
1372 // highlight predefined macros as constants
1373 'constant': /\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/
1374});
1375delete prism.languages.c['boolean'];
1376/* "prismjs/components/prism-cpp" */
1377
1378(function (Prism) {
1379 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/;
1380 var modName = /\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g, function () {
1381 return keyword.source;
1382 });
1383 Prism.languages.cpp = Prism.languages.extend('c', {
1384 'class-name': [{
1385 pattern: RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g, function () {
1386 return keyword.source;
1387 })),
1388 lookbehind: true
1389 }, // This is intended to capture the class name of method implementations like:
1390 // void foo::bar() const {}
1391 // However! The `foo` in the above example could also be a namespace, so we only capture the class name if
1392 // it starts with an uppercase letter. This approximation should give decent results.
1393 /\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/, // This will capture the class name before destructors like:
1394 // Foo::~Foo() {}
1395 /\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
1396 // parameters, so it can't be a namespace (until C++ adds generic namespaces).
1397 /\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],
1398 'keyword': keyword,
1399 'number': {
1400 pattern: /(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,
1401 greedy: true
1402 },
1403 'operator': />>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,
1404 'boolean': /\b(?:false|true)\b/
1405 });
1406 Prism.languages.insertBefore('cpp', 'string', {
1407 'module': {
1408 // https://en.cppreference.com/w/cpp/language/modules
1409 pattern: RegExp(/(\b(?:import|module)\s+)/.source + '(?:' + // header-name
1410 /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source + '|' + // module name or partition or both
1411 /<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g, function () {
1412 return modName;
1413 }) + ')'),
1414 lookbehind: true,
1415 greedy: true,
1416 inside: {
1417 'string': /^[<"][\s\S]+/,
1418 'operator': /:/,
1419 'punctuation': /\./
1420 }
1421 },
1422 'raw-string': {
1423 pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,
1424 alias: 'string',
1425 greedy: true
1426 }
1427 });
1428 Prism.languages.insertBefore('cpp', 'keyword', {
1429 'generic-function': {
1430 pattern: /\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,
1431 inside: {
1432 'function': /^\w+/,
1433 'generic': {
1434 pattern: /<[\s\S]+/,
1435 alias: 'class-name',
1436 inside: Prism.languages.cpp
1437 }
1438 }
1439 }
1440 });
1441 Prism.languages.insertBefore('cpp', 'operator', {
1442 'double-colon': {
1443 pattern: /::/,
1444 alias: 'punctuation'
1445 }
1446 });
1447 Prism.languages.insertBefore('cpp', 'class-name', {
1448 // the base clause is an optional list of parent classes
1449 // https://en.cppreference.com/w/cpp/language/class
1450 'base-clause': {
1451 pattern: /(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,
1452 lookbehind: true,
1453 greedy: true,
1454 inside: Prism.languages.extend('cpp', {})
1455 }
1456 });
1457 Prism.languages.insertBefore('inside', 'double-colon', {
1458 // All untokenized words that are not namespaces should be class names
1459 'class-name': /\b[a-z_]\w*\b(?!\s*::)/i
1460 }, Prism.languages.cpp['base-clause']);
1461})(prism);
1462/* "prismjs/components/prism-css" */
1463
1464
1465(function (Prism) {
1466 var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
1467 Prism.languages.css = {
1468 'comment': /\/\*[\s\S]*?\*\//,
1469 'atrule': {
1470 pattern: /@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,
1471 inside: {
1472 'rule': /^@[\w-]+/,
1473 'selector-function-argument': {
1474 pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
1475 lookbehind: true,
1476 alias: 'selector'
1477 },
1478 'keyword': {
1479 pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
1480 lookbehind: true
1481 } // See rest below
1482
1483 }
1484 },
1485 'url': {
1486 // https://drafts.csswg.org/css-values-3/#urls
1487 pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
1488 greedy: true,
1489 inside: {
1490 'function': /^url/i,
1491 'punctuation': /^\(|\)$/,
1492 'string': {
1493 pattern: RegExp('^' + string.source + '$'),
1494 alias: 'url'
1495 }
1496 }
1497 },
1498 'selector': {
1499 pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
1500 lookbehind: true
1501 },
1502 'string': {
1503 pattern: string,
1504 greedy: true
1505 },
1506 'property': {
1507 pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
1508 lookbehind: true
1509 },
1510 'important': /!important\b/i,
1511 'function': {
1512 pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
1513 lookbehind: true
1514 },
1515 'punctuation': /[(){};:,]/
1516 };
1517 Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
1518 var markup = Prism.languages.markup;
1519
1520 if (markup) {
1521 markup.tag.addInlined('style', 'css');
1522 markup.tag.addAttribute('style', 'css');
1523 }
1524})(prism);
1525/* "prismjs/components/prism-css-extras" */
1526
1527
1528(function (Prism) {
1529 var string = /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;
1530 var selectorInside;
1531 Prism.languages.css.selector = {
1532 pattern: Prism.languages.css.selector.pattern,
1533 lookbehind: true,
1534 inside: selectorInside = {
1535 'pseudo-element': /:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,
1536 'pseudo-class': /:[-\w]+/,
1537 'class': /\.[-\w]+/,
1538 'id': /#[-\w]+/,
1539 'attribute': {
1540 pattern: RegExp('\\[(?:[^[\\]"\']|' + string.source + ')*\\]'),
1541 greedy: true,
1542 inside: {
1543 'punctuation': /^\[|\]$/,
1544 'case-sensitivity': {
1545 pattern: /(\s)[si]$/i,
1546 lookbehind: true,
1547 alias: 'keyword'
1548 },
1549 'namespace': {
1550 pattern: /^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,
1551 lookbehind: true,
1552 inside: {
1553 'punctuation': /\|$/
1554 }
1555 },
1556 'attr-name': {
1557 pattern: /^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,
1558 lookbehind: true
1559 },
1560 'attr-value': [string, {
1561 pattern: /(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,
1562 lookbehind: true
1563 }],
1564 'operator': /[|~*^$]?=/
1565 }
1566 },
1567 'n-th': [{
1568 pattern: /(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,
1569 lookbehind: true,
1570 inside: {
1571 'number': /[\dn]+/,
1572 'operator': /[+-]/
1573 }
1574 }, {
1575 pattern: /(\(\s*)(?:even|odd)(?=\s*\))/i,
1576 lookbehind: true
1577 }],
1578 'combinator': />|\+|~|\|\|/,
1579 // the `tag` token has been existed and removed.
1580 // because we can't find a perfect tokenize to match it.
1581 // if you want to add it, please read https://github.com/PrismJS/prism/pull/2373 first.
1582 'punctuation': /[(),]/
1583 }
1584 };
1585 Prism.languages.css['atrule'].inside['selector-function-argument'].inside = selectorInside;
1586 Prism.languages.insertBefore('css', 'property', {
1587 'variable': {
1588 pattern: /(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,
1589 lookbehind: true
1590 }
1591 });
1592 var unit = {
1593 pattern: /(\b\d+)(?:%|[a-z]+(?![\w-]))/,
1594 lookbehind: true
1595 }; // 123 -123 .123 -.123 12.3 -12.3
1596
1597 var number = {
1598 pattern: /(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,
1599 lookbehind: true
1600 };
1601 Prism.languages.insertBefore('css', 'function', {
1602 'operator': {
1603 pattern: /(\s)[+\-*\/](?=\s)/,
1604 lookbehind: true
1605 },
1606 // CAREFUL!
1607 // Previewers and Inline color use hexcode and color.
1608 'hexcode': {
1609 pattern: /\B#[\da-f]{3,8}\b/i,
1610 alias: 'color'
1611 },
1612 'color': [{
1613 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|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,
1614 lookbehind: true
1615 }, {
1616 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,
1617 inside: {
1618 'unit': unit,
1619 'number': number,
1620 'function': /[\w-]+(?=\()/,
1621 'punctuation': /[(),]/
1622 }
1623 }],
1624 // it's important that there is no boundary assertion after the hex digits
1625 'entity': /\\[\da-f]{1,8}/i,
1626 'unit': unit,
1627 'number': number
1628 });
1629})(prism);
1630/* "prismjs/components/prism-javascript" */
1631
1632
1633prism.languages.javascript = prism.languages.extend('clike', {
1634 'class-name': [prism.languages.clike['class-name'], {
1635 pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
1636 lookbehind: true
1637 }],
1638 'keyword': [{
1639 pattern: /((?:^|\})\s*)catch\b/,
1640 lookbehind: true
1641 }, {
1642 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/,
1643 lookbehind: true
1644 }],
1645 // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
1646 'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1647 'number': {
1648 pattern: RegExp(/(^|[^\w$])/.source + '(?:' + ( // constant
1649 /NaN|Infinity/.source + '|' + // binary integer
1650 /0[bB][01]+(?:_[01]+)*n?/.source + '|' + // octal integer
1651 /0[oO][0-7]+(?:_[0-7]+)*n?/.source + '|' + // hexadecimal integer
1652 /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + '|' + // decimal bigint
1653 /\d+(?:_\d+)*n/.source + '|' + // decimal number (integer or float) but no bigint
1654 /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ')' + /(?![\w$])/.source),
1655 lookbehind: true
1656 },
1657 'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1658});
1659prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
1660prism.languages.insertBefore('javascript', 'keyword', {
1661 'regex': {
1662 // eslint-disable-next-line regexp/no-dupe-characters-character-class
1663 pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,
1664 lookbehind: true,
1665 greedy: true,
1666 inside: {
1667 'regex-source': {
1668 pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1669 lookbehind: true,
1670 alias: 'language-regex',
1671 inside: prism.languages.regex
1672 },
1673 'regex-delimiter': /^\/|\/$/,
1674 'regex-flags': /^[a-z]+$/
1675 }
1676 },
1677 // This must be declared before keyword because we use "function" inside the look-forward
1678 'function-variable': {
1679 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*=>))/,
1680 alias: 'function'
1681 },
1682 'parameter': [{
1683 pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1684 lookbehind: true,
1685 inside: prism.languages.javascript
1686 }, {
1687 pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1688 lookbehind: true,
1689 inside: prism.languages.javascript
1690 }, {
1691 pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1692 lookbehind: true,
1693 inside: prism.languages.javascript
1694 }, {
1695 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*\{)/,
1696 lookbehind: true,
1697 inside: prism.languages.javascript
1698 }],
1699 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1700});
1701prism.languages.insertBefore('javascript', 'string', {
1702 'hashbang': {
1703 pattern: /^#!.*/,
1704 greedy: true,
1705 alias: 'comment'
1706 },
1707 'template-string': {
1708 pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1709 greedy: true,
1710 inside: {
1711 'template-punctuation': {
1712 pattern: /^`|`$/,
1713 alias: 'string'
1714 },
1715 'interpolation': {
1716 pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1717 lookbehind: true,
1718 inside: {
1719 'interpolation-punctuation': {
1720 pattern: /^\$\{|\}$/,
1721 alias: 'punctuation'
1722 },
1723 rest: prism.languages.javascript
1724 }
1725 },
1726 'string': /[\s\S]+/
1727 }
1728 },
1729 'string-property': {
1730 pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
1731 lookbehind: true,
1732 greedy: true,
1733 alias: 'property'
1734 }
1735});
1736prism.languages.insertBefore('javascript', 'operator', {
1737 'literal-property': {
1738 pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
1739 lookbehind: true,
1740 alias: 'property'
1741 }
1742});
1743
1744if (prism.languages.markup) {
1745 prism.languages.markup.tag.addInlined('script', 'javascript'); // add attribute support for all DOM events.
1746 // https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events
1747
1748 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');
1749}
1750
1751prism.languages.js = prism.languages.javascript;
1752/* "prismjs/components/prism-coffeescript" */
1753
1754(function (Prism) {
1755 // Ignore comments starting with { to privilege string interpolation highlighting
1756 var comment = /#(?!\{).+/;
1757 var interpolation = {
1758 pattern: /#\{[^}]+\}/,
1759 alias: 'variable'
1760 };
1761 Prism.languages.coffeescript = Prism.languages.extend('javascript', {
1762 'comment': comment,
1763 'string': [// Strings are multiline
1764 {
1765 pattern: /'(?:\\[\s\S]|[^\\'])*'/,
1766 greedy: true
1767 }, {
1768 // Strings are multiline
1769 pattern: /"(?:\\[\s\S]|[^\\"])*"/,
1770 greedy: true,
1771 inside: {
1772 'interpolation': interpolation
1773 }
1774 }],
1775 '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/,
1776 'class-member': {
1777 pattern: /@(?!\d)\w+/,
1778 alias: 'variable'
1779 }
1780 });
1781 Prism.languages.insertBefore('coffeescript', 'comment', {
1782 'multiline-comment': {
1783 pattern: /###[\s\S]+?###/,
1784 alias: 'comment'
1785 },
1786 // Block regexp can contain comments and interpolation
1787 'block-regex': {
1788 pattern: /\/{3}[\s\S]*?\/{3}/,
1789 alias: 'regex',
1790 inside: {
1791 'comment': comment,
1792 'interpolation': interpolation
1793 }
1794 }
1795 });
1796 Prism.languages.insertBefore('coffeescript', 'string', {
1797 'inline-javascript': {
1798 pattern: /`(?:\\[\s\S]|[^\\`])*`/,
1799 inside: {
1800 'delimiter': {
1801 pattern: /^`|`$/,
1802 alias: 'punctuation'
1803 },
1804 'script': {
1805 pattern: /[\s\S]+/,
1806 alias: 'language-javascript',
1807 inside: Prism.languages.javascript
1808 }
1809 }
1810 },
1811 // Block strings
1812 'multiline-string': [{
1813 pattern: /'''[\s\S]*?'''/,
1814 greedy: true,
1815 alias: 'string'
1816 }, {
1817 pattern: /"""[\s\S]*?"""/,
1818 greedy: true,
1819 alias: 'string',
1820 inside: {
1821 interpolation: interpolation
1822 }
1823 }]
1824 });
1825 Prism.languages.insertBefore('coffeescript', 'keyword', {
1826 // Object property
1827 'property': /(?!\d)\w+(?=\s*:(?!:))/
1828 });
1829 delete Prism.languages.coffeescript['template-string'];
1830 Prism.languages.coffee = Prism.languages.coffeescript;
1831})(prism);
1832/* "prismjs/components/prism-yaml" */
1833
1834
1835(function (Prism) {
1836 // https://yaml.org/spec/1.2/spec.html#c-ns-anchor-property
1837 // https://yaml.org/spec/1.2/spec.html#c-ns-alias-node
1838 var anchorOrAlias = /[*&][^\s[\]{},]+/; // https://yaml.org/spec/1.2/spec.html#c-ns-tag-property
1839
1840 var tag = /!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/; // https://yaml.org/spec/1.2/spec.html#c-ns-properties(n,c)
1841
1842 var properties = '(?:' + tag.source + '(?:[ \t]+' + anchorOrAlias.source + ')?|' + anchorOrAlias.source + '(?:[ \t]+' + tag.source + ')?)'; // https://yaml.org/spec/1.2/spec.html#ns-plain(n,c)
1843 // This is a simplified version that doesn't support "#" and multiline keys
1844 // All these long scarry character classes are simplified versions of YAML's characters
1845
1846 var plainKey = /(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g, function () {
1847 return /[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source;
1848 });
1849 var string = /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;
1850 /**
1851 *
1852 * @param {string} value
1853 * @param {string} [flags]
1854 * @returns {RegExp}
1855 */
1856
1857 function createValuePattern(value, flags) {
1858 flags = (flags || '').replace(/m/g, '') + 'm'; // add m flag
1859
1860 var pattern = /([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g, function () {
1861 return properties;
1862 }).replace(/<<value>>/g, function () {
1863 return value;
1864 });
1865 return RegExp(pattern, flags);
1866 }
1867
1868 Prism.languages.yaml = {
1869 'scalar': {
1870 pattern: RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g, function () {
1871 return properties;
1872 })),
1873 lookbehind: true,
1874 alias: 'string'
1875 },
1876 'comment': /#.*/,
1877 'key': {
1878 pattern: RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g, function () {
1879 return properties;
1880 }).replace(/<<key>>/g, function () {
1881 return '(?:' + plainKey + '|' + string + ')';
1882 })),
1883 lookbehind: true,
1884 greedy: true,
1885 alias: 'atrule'
1886 },
1887 'directive': {
1888 pattern: /(^[ \t]*)%.+/m,
1889 lookbehind: true,
1890 alias: 'important'
1891 },
1892 'datetime': {
1893 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),
1894 lookbehind: true,
1895 alias: 'number'
1896 },
1897 'boolean': {
1898 pattern: createValuePattern(/false|true/.source, 'i'),
1899 lookbehind: true,
1900 alias: 'important'
1901 },
1902 'null': {
1903 pattern: createValuePattern(/null|~/.source, 'i'),
1904 lookbehind: true,
1905 alias: 'important'
1906 },
1907 'string': {
1908 pattern: createValuePattern(string),
1909 lookbehind: true,
1910 greedy: true
1911 },
1912 'number': {
1913 pattern: createValuePattern(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source, 'i'),
1914 lookbehind: true
1915 },
1916 'tag': tag,
1917 'important': anchorOrAlias,
1918 'punctuation': /---|[:[\]{}\-,|>?]|\.\.\./
1919 };
1920 Prism.languages.yml = Prism.languages.yaml;
1921})(prism);
1922/* "prismjs/components/prism-markdown" */
1923
1924
1925(function (Prism) {
1926 // Allow only one line break
1927 var inner = /(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;
1928 /**
1929 * This function is intended for the creation of the bold or italic pattern.
1930 *
1931 * This also adds a lookbehind group to the given pattern to ensure that the pattern is not backslash-escaped.
1932 *
1933 * _Note:_ Keep in mind that this adds a capturing group.
1934 *
1935 * @param {string} pattern
1936 * @returns {RegExp}
1937 */
1938
1939 function createInline(pattern) {
1940 pattern = pattern.replace(/<inner>/g, function () {
1941 return inner;
1942 });
1943 return RegExp(/((?:^|[^\\])(?:\\{2})*)/.source + '(?:' + pattern + ')');
1944 }
1945
1946 var tableCell = /(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source;
1947 var tableRow = /\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g, function () {
1948 return tableCell;
1949 });
1950 var tableLine = /\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;
1951 Prism.languages.markdown = Prism.languages.extend('markup', {});
1952 Prism.languages.insertBefore('markdown', 'prolog', {
1953 'front-matter-block': {
1954 pattern: /(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,
1955 lookbehind: true,
1956 greedy: true,
1957 inside: {
1958 'punctuation': /^---|---$/,
1959 'front-matter': {
1960 pattern: /\S+(?:\s+\S+)*/,
1961 alias: ['yaml', 'language-yaml'],
1962 inside: Prism.languages.yaml
1963 }
1964 }
1965 },
1966 'blockquote': {
1967 // > ...
1968 pattern: /^>(?:[\t ]*>)*/m,
1969 alias: 'punctuation'
1970 },
1971 'table': {
1972 pattern: RegExp('^' + tableRow + tableLine + '(?:' + tableRow + ')*', 'm'),
1973 inside: {
1974 'table-data-rows': {
1975 pattern: RegExp('^(' + tableRow + tableLine + ')(?:' + tableRow + ')*$'),
1976 lookbehind: true,
1977 inside: {
1978 'table-data': {
1979 pattern: RegExp(tableCell),
1980 inside: Prism.languages.markdown
1981 },
1982 'punctuation': /\|/
1983 }
1984 },
1985 'table-line': {
1986 pattern: RegExp('^(' + tableRow + ')' + tableLine + '$'),
1987 lookbehind: true,
1988 inside: {
1989 'punctuation': /\||:?-{3,}:?/
1990 }
1991 },
1992 'table-header-row': {
1993 pattern: RegExp('^' + tableRow + '$'),
1994 inside: {
1995 'table-header': {
1996 pattern: RegExp(tableCell),
1997 alias: 'important',
1998 inside: Prism.languages.markdown
1999 },
2000 'punctuation': /\|/
2001 }
2002 }
2003 }
2004 },
2005 'code': [{
2006 // Prefixed by 4 spaces or 1 tab and preceded by an empty line
2007 pattern: /((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,
2008 lookbehind: true,
2009 alias: 'keyword'
2010 }, {
2011 // ```optional language
2012 // code block
2013 // ```
2014 pattern: /^```[\s\S]*?^```$/m,
2015 greedy: true,
2016 inside: {
2017 'code-block': {
2018 pattern: /^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,
2019 lookbehind: true
2020 },
2021 'code-language': {
2022 pattern: /^(```).+/,
2023 lookbehind: true
2024 },
2025 'punctuation': /```/
2026 }
2027 }],
2028 'title': [{
2029 // title 1
2030 // =======
2031 // title 2
2032 // -------
2033 pattern: /\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,
2034 alias: 'important',
2035 inside: {
2036 punctuation: /==+$|--+$/
2037 }
2038 }, {
2039 // # title 1
2040 // ###### title 6
2041 pattern: /(^\s*)#.+/m,
2042 lookbehind: true,
2043 alias: 'important',
2044 inside: {
2045 punctuation: /^#+|#+$/
2046 }
2047 }],
2048 'hr': {
2049 // ***
2050 // ---
2051 // * * *
2052 // -----------
2053 pattern: /(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,
2054 lookbehind: true,
2055 alias: 'punctuation'
2056 },
2057 'list': {
2058 // * item
2059 // + item
2060 // - item
2061 // 1. item
2062 pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,
2063 lookbehind: true,
2064 alias: 'punctuation'
2065 },
2066 'url-reference': {
2067 // [id]: http://example.com "Optional title"
2068 // [id]: http://example.com 'Optional title'
2069 // [id]: http://example.com (Optional title)
2070 // [id]: <http://example.com> "Optional title"
2071 pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,
2072 inside: {
2073 'variable': {
2074 pattern: /^(!?\[)[^\]]+/,
2075 lookbehind: true
2076 },
2077 'string': /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,
2078 'punctuation': /^[\[\]!:]|[<>]/
2079 },
2080 alias: 'url'
2081 },
2082 'bold': {
2083 // **strong**
2084 // __strong__
2085 // allow one nested instance of italic text using the same delimiter
2086 pattern: createInline(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),
2087 lookbehind: true,
2088 greedy: true,
2089 inside: {
2090 'content': {
2091 pattern: /(^..)[\s\S]+(?=..$)/,
2092 lookbehind: true,
2093 inside: {} // see below
2094
2095 },
2096 'punctuation': /\*\*|__/
2097 }
2098 },
2099 'italic': {
2100 // *em*
2101 // _em_
2102 // allow one nested instance of bold text using the same delimiter
2103 pattern: createInline(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),
2104 lookbehind: true,
2105 greedy: true,
2106 inside: {
2107 'content': {
2108 pattern: /(^.)[\s\S]+(?=.$)/,
2109 lookbehind: true,
2110 inside: {} // see below
2111
2112 },
2113 'punctuation': /[*_]/
2114 }
2115 },
2116 'strike': {
2117 // ~~strike through~~
2118 // ~strike~
2119 // eslint-disable-next-line regexp/strict
2120 pattern: createInline(/(~~?)(?:(?!~)<inner>)+\2/.source),
2121 lookbehind: true,
2122 greedy: true,
2123 inside: {
2124 'content': {
2125 pattern: /(^~~?)[\s\S]+(?=\1$)/,
2126 lookbehind: true,
2127 inside: {} // see below
2128
2129 },
2130 'punctuation': /~~?/
2131 }
2132 },
2133 'code-snippet': {
2134 // `code`
2135 // ``code``
2136 pattern: /(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,
2137 lookbehind: true,
2138 greedy: true,
2139 alias: ['code', 'keyword']
2140 },
2141 'url': {
2142 // [example](http://example.com "Optional title")
2143 // [example][id]
2144 // [example] [id]
2145 pattern: createInline(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),
2146 lookbehind: true,
2147 greedy: true,
2148 inside: {
2149 'operator': /^!/,
2150 'content': {
2151 pattern: /(^\[)[^\]]+(?=\])/,
2152 lookbehind: true,
2153 inside: {} // see below
2154
2155 },
2156 'variable': {
2157 pattern: /(^\][ \t]?\[)[^\]]+(?=\]$)/,
2158 lookbehind: true
2159 },
2160 'url': {
2161 pattern: /(^\]\()[^\s)]+/,
2162 lookbehind: true
2163 },
2164 'string': {
2165 pattern: /(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,
2166 lookbehind: true
2167 }
2168 }
2169 }
2170 });
2171 ['url', 'bold', 'italic', 'strike'].forEach(function (token) {
2172 ['url', 'bold', 'italic', 'strike', 'code-snippet'].forEach(function (inside) {
2173 if (token !== inside) {
2174 Prism.languages.markdown[token].inside.content.inside[inside] = Prism.languages.markdown[inside];
2175 }
2176 });
2177 });
2178 Prism.hooks.add('after-tokenize', function (env) {
2179 if (env.language !== 'markdown' && env.language !== 'md') {
2180 return;
2181 }
2182
2183 function walkTokens(tokens) {
2184 if (!tokens || typeof tokens === 'string') {
2185 return;
2186 }
2187
2188 for (var i = 0, l = tokens.length; i < l; i++) {
2189 var token = tokens[i];
2190
2191 if (token.type !== 'code') {
2192 walkTokens(token.content);
2193 continue;
2194 }
2195 /*
2196 * Add the correct `language-xxxx` class to this code block. Keep in mind that the `code-language` token
2197 * is optional. But the grammar is defined so that there is only one case we have to handle:
2198 *
2199 * token.content = [
2200 * <span class="punctuation">```</span>,
2201 * <span class="code-language">xxxx</span>,
2202 * '\n', // exactly one new lines (\r or \n or \r\n)
2203 * <span class="code-block">...</span>,
2204 * '\n', // exactly one new lines again
2205 * <span class="punctuation">```</span>
2206 * ];
2207 */
2208
2209
2210 var codeLang = token.content[1];
2211 var codeBlock = token.content[3];
2212
2213 if (codeLang && codeBlock && codeLang.type === 'code-language' && codeBlock.type === 'code-block' && typeof codeLang.content === 'string') {
2214 // this might be a language that Prism does not support
2215 // do some replacements to support C++, C#, and F#
2216 var lang = codeLang.content.replace(/\b#/g, 'sharp').replace(/\b\+\+/g, 'pp'); // only use the first word
2217
2218 lang = (/[a-z][\w-]*/i.exec(lang) || [''])[0].toLowerCase();
2219 var alias = 'language-' + lang; // add alias
2220
2221 if (!codeBlock.alias) {
2222 codeBlock.alias = [alias];
2223 } else if (typeof codeBlock.alias === 'string') {
2224 codeBlock.alias = [codeBlock.alias, alias];
2225 } else {
2226 codeBlock.alias.push(alias);
2227 }
2228 }
2229 }
2230 }
2231
2232 walkTokens(env.tokens);
2233 });
2234 Prism.hooks.add('wrap', function (env) {
2235 if (env.type !== 'code-block') {
2236 return;
2237 }
2238
2239 var codeLang = '';
2240
2241 for (var i = 0, l = env.classes.length; i < l; i++) {
2242 var cls = env.classes[i];
2243 var match = /language-(.+)/.exec(cls);
2244
2245 if (match) {
2246 codeLang = match[1];
2247 break;
2248 }
2249 }
2250
2251 var grammar = Prism.languages[codeLang];
2252
2253 if (!grammar) {
2254 if (codeLang && codeLang !== 'none' && Prism.plugins.autoloader) {
2255 var id = 'md-' + new Date().valueOf() + '-' + Math.floor(Math.random() * 1e16);
2256 env.attributes['id'] = id;
2257 Prism.plugins.autoloader.loadLanguages(codeLang, function () {
2258 var ele = document.getElementById(id);
2259
2260 if (ele) {
2261 ele.innerHTML = Prism.highlight(ele.textContent, Prism.languages[codeLang], codeLang);
2262 }
2263 });
2264 }
2265 } else {
2266 env.content = Prism.highlight(textContent(env.content), grammar, codeLang);
2267 }
2268 });
2269 var tagPattern = RegExp(Prism.languages.markup.tag.pattern.source, 'gi');
2270 /**
2271 * A list of known entity names.
2272 *
2273 * This will always be incomplete to save space. The current list is the one used by lowdash's unescape function.
2274 *
2275 * @see {@link https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/unescape.js#L2}
2276 */
2277
2278 var KNOWN_ENTITY_NAMES = {
2279 'amp': '&',
2280 'lt': '<',
2281 'gt': '>',
2282 'quot': '"'
2283 }; // IE 11 doesn't support `String.fromCodePoint`
2284
2285 var fromCodePoint = String.fromCodePoint || String.fromCharCode;
2286 /**
2287 * Returns the text content of a given HTML source code string.
2288 *
2289 * @param {string} html
2290 * @returns {string}
2291 */
2292
2293 function textContent(html) {
2294 // remove all tags
2295 var text = html.replace(tagPattern, ''); // decode known entities
2296
2297 text = text.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi, function (m, code) {
2298 code = code.toLowerCase();
2299
2300 if (code[0] === '#') {
2301 var value;
2302
2303 if (code[1] === 'x') {
2304 value = parseInt(code.slice(2), 16);
2305 } else {
2306 value = Number(code.slice(1));
2307 }
2308
2309 return fromCodePoint(value);
2310 } else {
2311 var known = KNOWN_ENTITY_NAMES[code];
2312
2313 if (known) {
2314 return known;
2315 } // unable to decode
2316
2317
2318 return m;
2319 }
2320 });
2321 return text;
2322 }
2323
2324 Prism.languages.md = Prism.languages.markdown;
2325})(prism);
2326/* "prismjs/components/prism-graphql" */
2327
2328
2329prism.languages.graphql = {
2330 'comment': /#.*/,
2331 'description': {
2332 pattern: /(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,
2333 greedy: true,
2334 alias: 'string',
2335 inside: {
2336 'language-markdown': {
2337 pattern: /(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,
2338 lookbehind: true,
2339 inside: prism.languages.markdown
2340 }
2341 }
2342 },
2343 'string': {
2344 pattern: /"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,
2345 greedy: true
2346 },
2347 'number': /(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
2348 'boolean': /\b(?:false|true)\b/,
2349 'variable': /\$[a-z_]\w*/i,
2350 'directive': {
2351 pattern: /@[a-z_]\w*/i,
2352 alias: 'function'
2353 },
2354 'attr-name': {
2355 pattern: /\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,
2356 greedy: true
2357 },
2358 'atom-input': {
2359 pattern: /\b[A-Z]\w*Input\b/,
2360 alias: 'class-name'
2361 },
2362 'scalar': /\b(?:Boolean|Float|ID|Int|String)\b/,
2363 'constant': /\b[A-Z][A-Z_\d]*\b/,
2364 'class-name': {
2365 pattern: /(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,
2366 lookbehind: true
2367 },
2368 'fragment': {
2369 pattern: /(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,
2370 lookbehind: true,
2371 alias: 'function'
2372 },
2373 'definition-mutation': {
2374 pattern: /(\bmutation\s+)[a-zA-Z_]\w*/,
2375 lookbehind: true,
2376 alias: 'function'
2377 },
2378 'definition-query': {
2379 pattern: /(\bquery\s+)[a-zA-Z_]\w*/,
2380 lookbehind: true,
2381 alias: 'function'
2382 },
2383 'keyword': /\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,
2384 'operator': /[!=|&]|\.{3}/,
2385 'property-query': /\w+(?=\s*\()/,
2386 'object': /\w+(?=\s*\{)/,
2387 'punctuation': /[!(){}\[\]:=,]/,
2388 'property': /\w+/
2389};
2390prism.hooks.add('after-tokenize', function afterTokenizeGraphql(env) {
2391 if (env.language !== 'graphql') {
2392 return;
2393 }
2394 /**
2395 * get the graphql token stream that we want to customize
2396 *
2397 * @typedef {InstanceType<import("./prism-core")["Token"]>} Token
2398 * @type {Token[]}
2399 */
2400
2401
2402 var validTokens = env.tokens.filter(function (token) {
2403 return typeof token !== 'string' && token.type !== 'comment' && token.type !== 'scalar';
2404 });
2405 var currentIndex = 0;
2406 /**
2407 * Returns whether the token relative to the current index has the given type.
2408 *
2409 * @param {number} offset
2410 * @returns {Token | undefined}
2411 */
2412
2413 function getToken(offset) {
2414 return validTokens[currentIndex + offset];
2415 }
2416 /**
2417 * Returns whether the token relative to the current index has the given type.
2418 *
2419 * @param {readonly string[]} types
2420 * @param {number} [offset=0]
2421 * @returns {boolean}
2422 */
2423
2424
2425 function isTokenType(types, offset) {
2426 offset = offset || 0;
2427
2428 for (var i = 0; i < types.length; i++) {
2429 var token = getToken(i + offset);
2430
2431 if (!token || token.type !== types[i]) {
2432 return false;
2433 }
2434 }
2435
2436 return true;
2437 }
2438 /**
2439 * Returns the index of the closing bracket to an opening bracket.
2440 *
2441 * It is assumed that `token[currentIndex - 1]` is an opening bracket.
2442 *
2443 * If no closing bracket could be found, `-1` will be returned.
2444 *
2445 * @param {RegExp} open
2446 * @param {RegExp} close
2447 * @returns {number}
2448 */
2449
2450
2451 function findClosingBracket(open, close) {
2452 var stackHeight = 1;
2453
2454 for (var i = currentIndex; i < validTokens.length; i++) {
2455 var token = validTokens[i];
2456 var content = token.content;
2457
2458 if (token.type === 'punctuation' && typeof content === 'string') {
2459 if (open.test(content)) {
2460 stackHeight++;
2461 } else if (close.test(content)) {
2462 stackHeight--;
2463
2464 if (stackHeight === 0) {
2465 return i;
2466 }
2467 }
2468 }
2469 }
2470
2471 return -1;
2472 }
2473 /**
2474 * Adds an alias to the given token.
2475 *
2476 * @param {Token} token
2477 * @param {string} alias
2478 * @returns {void}
2479 */
2480
2481
2482 function addAlias(token, alias) {
2483 var aliases = token.alias;
2484
2485 if (!aliases) {
2486 token.alias = aliases = [];
2487 } else if (!Array.isArray(aliases)) {
2488 token.alias = aliases = [aliases];
2489 }
2490
2491 aliases.push(alias);
2492 }
2493
2494 for (; currentIndex < validTokens.length;) {
2495 var startToken = validTokens[currentIndex++]; // add special aliases for mutation tokens
2496
2497 if (startToken.type === 'keyword' && startToken.content === 'mutation') {
2498 // any array of the names of all input variables (if any)
2499 var inputVariables = [];
2500
2501 if (isTokenType(['definition-mutation', 'punctuation']) && getToken(1).content === '(') {
2502 // definition
2503 currentIndex += 2; // skip 'definition-mutation' and 'punctuation'
2504
2505 var definitionEnd = findClosingBracket(/^\($/, /^\)$/);
2506
2507 if (definitionEnd === -1) {
2508 continue;
2509 } // find all input variables
2510
2511
2512 for (; currentIndex < definitionEnd; currentIndex++) {
2513 var t = getToken(0);
2514
2515 if (t.type === 'variable') {
2516 addAlias(t, 'variable-input');
2517 inputVariables.push(t.content);
2518 }
2519 }
2520
2521 currentIndex = definitionEnd + 1;
2522 }
2523
2524 if (isTokenType(['punctuation', 'property-query']) && getToken(0).content === '{') {
2525 currentIndex++; // skip opening bracket
2526
2527 addAlias(getToken(0), 'property-mutation');
2528
2529 if (inputVariables.length > 0) {
2530 var mutationEnd = findClosingBracket(/^\{$/, /^\}$/);
2531
2532 if (mutationEnd === -1) {
2533 continue;
2534 } // give references to input variables a special alias
2535
2536
2537 for (var i = currentIndex; i < mutationEnd; i++) {
2538 var varToken = validTokens[i];
2539
2540 if (varToken.type === 'variable' && inputVariables.indexOf(varToken.content) >= 0) {
2541 addAlias(varToken, 'variable-input');
2542 }
2543 }
2544 }
2545 }
2546 }
2547 }
2548});
2549/* "prismjs/components/prism-sql" */
2550
2551prism.languages.sql = {
2552 'comment': {
2553 pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
2554 lookbehind: true
2555 },
2556 'variable': [{
2557 pattern: /@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,
2558 greedy: true
2559 }, /@[\w.$]+/],
2560 'string': {
2561 pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,
2562 greedy: true,
2563 lookbehind: true
2564 },
2565 'identifier': {
2566 pattern: /(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,
2567 greedy: true,
2568 lookbehind: true,
2569 inside: {
2570 'punctuation': /^`|`$/
2571 }
2572 },
2573 'function': /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,
2574 // Should we highlight user defined functions too?
2575 '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,
2576 'boolean': /\b(?:FALSE|NULL|TRUE)\b/i,
2577 'number': /\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,
2578 'operator': /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,
2579 'punctuation': /[;[\]()`,.]/
2580};
2581/* "prismjs/components/prism-js-templates" */
2582
2583(function (Prism) {
2584 var templateString = Prism.languages.javascript['template-string']; // see the pattern in prism-javascript.js
2585
2586 var templateLiteralPattern = templateString.pattern.source;
2587 var interpolationObject = templateString.inside['interpolation'];
2588 var interpolationPunctuationObject = interpolationObject.inside['interpolation-punctuation'];
2589 var interpolationPattern = interpolationObject.pattern.source;
2590 /**
2591 * Creates a new pattern to match a template string with a special tag.
2592 *
2593 * This will return `undefined` if there is no grammar with the given language id.
2594 *
2595 * @param {string} language The language id of the embedded language. E.g. `markdown`.
2596 * @param {string} tag The regex pattern to match the tag.
2597 * @returns {object | undefined}
2598 * @example
2599 * createTemplate('css', /\bcss/.source);
2600 */
2601
2602 function createTemplate(language, tag) {
2603 if (!Prism.languages[language]) {
2604 return undefined;
2605 }
2606
2607 return {
2608 pattern: RegExp('((?:' + tag + ')\\s*)' + templateLiteralPattern),
2609 lookbehind: true,
2610 greedy: true,
2611 inside: {
2612 'template-punctuation': {
2613 pattern: /^`|`$/,
2614 alias: 'string'
2615 },
2616 'embedded-code': {
2617 pattern: /[\s\S]+/,
2618 alias: language
2619 }
2620 }
2621 };
2622 }
2623
2624 Prism.languages.javascript['template-string'] = [// styled-jsx:
2625 // css`a { color: #25F; }`
2626 // styled-components:
2627 // styled.h1`color: red;`
2628 createTemplate('css', /\b(?:styled(?:\([^)]*\))?(?:\s*\.\s*\w+(?:\([^)]*\))*)*|css(?:\s*\.\s*(?:global|resolve))?|createGlobalStyle|keyframes)/.source), // html`<p></p>`
2629 // div.innerHTML = `<p></p>`
2630 createTemplate('html', /\bhtml|\.\s*(?:inner|outer)HTML\s*\+?=/.source), // svg`<path fill="#fff" d="M55.37 ..."/>`
2631 createTemplate('svg', /\bsvg/.source), // md`# h1`, markdown`## h2`
2632 createTemplate('markdown', /\b(?:markdown|md)/.source), // gql`...`, graphql`...`, graphql.experimental`...`
2633 createTemplate('graphql', /\b(?:gql|graphql(?:\s*\.\s*experimental)?)/.source), // sql`...`
2634 createTemplate('sql', /\bsql/.source), // vanilla template string
2635 templateString].filter(Boolean);
2636 /**
2637 * Returns a specific placeholder literal for the given language.
2638 *
2639 * @param {number} counter
2640 * @param {string} language
2641 * @returns {string}
2642 */
2643
2644 function getPlaceholder(counter, language) {
2645 return '___' + language.toUpperCase() + '_' + counter + '___';
2646 }
2647 /**
2648 * Returns the tokens of `Prism.tokenize` but also runs the `before-tokenize` and `after-tokenize` hooks.
2649 *
2650 * @param {string} code
2651 * @param {any} grammar
2652 * @param {string} language
2653 * @returns {(string|Token)[]}
2654 */
2655
2656
2657 function tokenizeWithHooks(code, grammar, language) {
2658 var env = {
2659 code: code,
2660 grammar: grammar,
2661 language: language
2662 };
2663 Prism.hooks.run('before-tokenize', env);
2664 env.tokens = Prism.tokenize(env.code, env.grammar);
2665 Prism.hooks.run('after-tokenize', env);
2666 return env.tokens;
2667 }
2668 /**
2669 * Returns the token of the given JavaScript interpolation expression.
2670 *
2671 * @param {string} expression The code of the expression. E.g. `"${42}"`
2672 * @returns {Token}
2673 */
2674
2675
2676 function tokenizeInterpolationExpression(expression) {
2677 var tempGrammar = {};
2678 tempGrammar['interpolation-punctuation'] = interpolationPunctuationObject;
2679 /** @type {Array} */
2680
2681 var tokens = Prism.tokenize(expression, tempGrammar);
2682
2683 if (tokens.length === 3) {
2684 /**
2685 * The token array will look like this
2686 * [
2687 * ["interpolation-punctuation", "${"]
2688 * "..." // JavaScript expression of the interpolation
2689 * ["interpolation-punctuation", "}"]
2690 * ]
2691 */
2692 var args = [1, 1];
2693 args.push.apply(args, tokenizeWithHooks(tokens[1], Prism.languages.javascript, 'javascript'));
2694 tokens.splice.apply(tokens, args);
2695 }
2696
2697 return new Prism.Token('interpolation', tokens, interpolationObject.alias, expression);
2698 }
2699 /**
2700 * Tokenizes the given code with support for JavaScript interpolation expressions mixed in.
2701 *
2702 * This function has 3 phases:
2703 *
2704 * 1. Replace all JavaScript interpolation expression with a placeholder.
2705 * The placeholder will have the syntax of a identify of the target language.
2706 * 2. Tokenize the code with placeholders.
2707 * 3. Tokenize the interpolation expressions and re-insert them into the tokenize code.
2708 * The insertion only works if a placeholder hasn't been "ripped apart" meaning that the placeholder has been
2709 * tokenized as two tokens by the grammar of the embedded language.
2710 *
2711 * @param {string} code
2712 * @param {object} grammar
2713 * @param {string} language
2714 * @returns {Token}
2715 */
2716
2717
2718 function tokenizeEmbedded(code, grammar, language) {
2719 // 1. First filter out all interpolations
2720 // because they might be escaped, we need a lookbehind, so we use Prism
2721
2722 /** @type {(Token|string)[]} */
2723 var _tokens = Prism.tokenize(code, {
2724 'interpolation': {
2725 pattern: RegExp(interpolationPattern),
2726 lookbehind: true
2727 }
2728 }); // replace all interpolations with a placeholder which is not in the code already
2729
2730
2731 var placeholderCounter = 0;
2732 /** @type {Object<string, string>} */
2733
2734 var placeholderMap = {};
2735
2736 var embeddedCode = _tokens.map(function (token) {
2737 if (typeof token === 'string') {
2738 return token;
2739 } else {
2740 var interpolationExpression = token.content;
2741 var placeholder;
2742
2743 while (code.indexOf(placeholder = getPlaceholder(placeholderCounter++, language)) !== -1) {
2744 /* noop */
2745 }
2746
2747 placeholderMap[placeholder] = interpolationExpression;
2748 return placeholder;
2749 }
2750 }).join(''); // 2. Tokenize the embedded code
2751
2752
2753 var embeddedTokens = tokenizeWithHooks(embeddedCode, grammar, language); // 3. Re-insert the interpolation
2754
2755 var placeholders = Object.keys(placeholderMap);
2756 placeholderCounter = 0;
2757 /**
2758 *
2759 * @param {(Token|string)[]} tokens
2760 * @returns {void}
2761 */
2762
2763 function walkTokens(tokens) {
2764 for (var i = 0; i < tokens.length; i++) {
2765 if (placeholderCounter >= placeholders.length) {
2766 return;
2767 }
2768
2769 var token = tokens[i];
2770
2771 if (typeof token === 'string' || typeof token.content === 'string') {
2772 var placeholder = placeholders[placeholderCounter];
2773 var s = typeof token === 'string' ? token :
2774 /** @type {string} */
2775 token.content;
2776 var index = s.indexOf(placeholder);
2777
2778 if (index !== -1) {
2779 ++placeholderCounter;
2780 var before = s.substring(0, index);
2781 var middle = tokenizeInterpolationExpression(placeholderMap[placeholder]);
2782 var after = s.substring(index + placeholder.length);
2783 var replacement = [];
2784
2785 if (before) {
2786 replacement.push(before);
2787 }
2788
2789 replacement.push(middle);
2790
2791 if (after) {
2792 var afterTokens = [after];
2793 walkTokens(afterTokens);
2794 replacement.push.apply(replacement, afterTokens);
2795 }
2796
2797 if (typeof token === 'string') {
2798 tokens.splice.apply(tokens, [i, 1].concat(replacement));
2799 i += replacement.length - 1;
2800 } else {
2801 token.content = replacement;
2802 }
2803 }
2804 } else {
2805 var content = token.content;
2806
2807 if (Array.isArray(content)) {
2808 walkTokens(content);
2809 } else {
2810 walkTokens([content]);
2811 }
2812 }
2813 }
2814 }
2815
2816 walkTokens(embeddedTokens);
2817 return new Prism.Token(language, embeddedTokens, 'language-' + language, code);
2818 }
2819 /**
2820 * The languages for which JS templating will handle tagged template literals.
2821 *
2822 * JS templating isn't active for only JavaScript but also related languages like TypeScript, JSX, and TSX.
2823 */
2824
2825
2826 var supportedLanguages = {
2827 'javascript': true,
2828 'js': true,
2829 'typescript': true,
2830 'ts': true,
2831 'jsx': true,
2832 'tsx': true
2833 };
2834 Prism.hooks.add('after-tokenize', function (env) {
2835 if (!(env.language in supportedLanguages)) {
2836 return;
2837 }
2838 /**
2839 * Finds and tokenizes all template strings with an embedded languages.
2840 *
2841 * @param {(Token | string)[]} tokens
2842 * @returns {void}
2843 */
2844
2845
2846 function findTemplateStrings(tokens) {
2847 for (var i = 0, l = tokens.length; i < l; i++) {
2848 var token = tokens[i];
2849
2850 if (typeof token === 'string') {
2851 continue;
2852 }
2853
2854 var content = token.content;
2855
2856 if (!Array.isArray(content)) {
2857 if (typeof content !== 'string') {
2858 findTemplateStrings([content]);
2859 }
2860
2861 continue;
2862 }
2863
2864 if (token.type === 'template-string') {
2865 /**
2866 * A JavaScript template-string token will look like this:
2867 *
2868 * ["template-string", [
2869 * ["template-punctuation", "`"],
2870 * (
2871 * An array of "string" and "interpolation" tokens. This is the simple string case.
2872 * or
2873 * ["embedded-code", "..."] This is the token containing the embedded code.
2874 * It also has an alias which is the language of the embedded code.
2875 * ),
2876 * ["template-punctuation", "`"]
2877 * ]]
2878 */
2879 var embedded = content[1];
2880
2881 if (content.length === 3 && typeof embedded !== 'string' && embedded.type === 'embedded-code') {
2882 // get string content
2883 var code = stringContent(embedded);
2884 var alias = embedded.alias;
2885 var language = Array.isArray(alias) ? alias[0] : alias;
2886 var grammar = Prism.languages[language];
2887
2888 if (!grammar) {
2889 // the embedded language isn't registered.
2890 continue;
2891 }
2892
2893 content[1] = tokenizeEmbedded(code, grammar, language);
2894 }
2895 } else {
2896 findTemplateStrings(content);
2897 }
2898 }
2899 }
2900
2901 findTemplateStrings(env.tokens);
2902 });
2903 /**
2904 * Returns the string content of a token or token stream.
2905 *
2906 * @param {string | Token | (string | Token)[]} value
2907 * @returns {string}
2908 */
2909
2910 function stringContent(value) {
2911 if (typeof value === 'string') {
2912 return value;
2913 } else if (Array.isArray(value)) {
2914 return value.map(stringContent).join('');
2915 } else {
2916 return stringContent(value.content);
2917 }
2918 }
2919})(prism);
2920/* "prismjs/components/prism-typescript" */
2921
2922
2923(function (Prism) {
2924 Prism.languages.typescript = Prism.languages.extend('javascript', {
2925 'class-name': {
2926 pattern: /(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,
2927 lookbehind: true,
2928 greedy: true,
2929 inside: null // see below
2930
2931 },
2932 'builtin': /\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/
2933 }); // The keywords TypeScript adds to JavaScript
2934
2935 Prism.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/, // keywords that have to be followed by an identifier
2936 /\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/, // This is for `import type *, {}`
2937 /\btype\b(?=\s*(?:[\{*]|$))/); // doesn't work with TS because TS is too complex
2938
2939 delete Prism.languages.typescript['parameter'];
2940 delete Prism.languages.typescript['literal-property']; // a version of typescript specifically for highlighting types
2941
2942 var typeInside = Prism.languages.extend('typescript', {});
2943 delete typeInside['class-name'];
2944 Prism.languages.typescript['class-name'].inside = typeInside;
2945 Prism.languages.insertBefore('typescript', 'function', {
2946 'decorator': {
2947 pattern: /@[$\w\xA0-\uFFFF]+/,
2948 inside: {
2949 'at': {
2950 pattern: /^@/,
2951 alias: 'operator'
2952 },
2953 'function': /^[\s\S]+/
2954 }
2955 },
2956 'generic-function': {
2957 // e.g. foo<T extends "bar" | "baz">( ...
2958 pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,
2959 greedy: true,
2960 inside: {
2961 'function': /^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,
2962 'generic': {
2963 pattern: /<[\s\S]+/,
2964 // everything after the first <
2965 alias: 'class-name',
2966 inside: typeInside
2967 }
2968 }
2969 }
2970 });
2971 Prism.languages.ts = Prism.languages.typescript;
2972})(prism);
2973/* "prismjs/components/prism-js-extras" */
2974
2975
2976(function (Prism) {
2977 Prism.languages.insertBefore('javascript', 'function-variable', {
2978 'method-variable': {
2979 pattern: RegExp('(\\.\\s*)' + Prism.languages.javascript['function-variable'].pattern.source),
2980 lookbehind: true,
2981 alias: ['function-variable', 'method', 'function', 'property-access']
2982 }
2983 });
2984 Prism.languages.insertBefore('javascript', 'function', {
2985 'method': {
2986 pattern: RegExp('(\\.\\s*)' + Prism.languages.javascript['function'].source),
2987 lookbehind: true,
2988 alias: ['function', 'property-access']
2989 }
2990 });
2991 Prism.languages.insertBefore('javascript', 'constant', {
2992 'known-class-name': [{
2993 // standard built-ins
2994 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
2995 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/,
2996 alias: 'class-name'
2997 }, {
2998 // errors
2999 pattern: /\b(?:[A-Z]\w*)Error\b/,
3000 alias: 'class-name'
3001 }]
3002 });
3003 /**
3004 * Replaces the `<ID>` placeholder in the given pattern with a pattern for general JS identifiers.
3005 *
3006 * @param {string} source
3007 * @param {string} [flags]
3008 * @returns {RegExp}
3009 */
3010
3011 function withId(source, flags) {
3012 return RegExp(source.replace(/<ID>/g, function () {
3013 return /(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/.source;
3014 }), flags);
3015 }
3016
3017 Prism.languages.insertBefore('javascript', 'keyword', {
3018 'imports': {
3019 // https://tc39.es/ecma262/#sec-imports
3020 pattern: withId(/(\bimport\b\s*)(?:<ID>(?:\s*,\s*(?:\*\s*as\s+<ID>|\{[^{}]*\}))?|\*\s*as\s+<ID>|\{[^{}]*\})(?=\s*\bfrom\b)/.source),
3021 lookbehind: true,
3022 inside: Prism.languages.javascript
3023 },
3024 'exports': {
3025 // https://tc39.es/ecma262/#sec-exports
3026 pattern: withId(/(\bexport\b\s*)(?:\*(?:\s*as\s+<ID>)?(?=\s*\bfrom\b)|\{[^{}]*\})/.source),
3027 lookbehind: true,
3028 inside: Prism.languages.javascript
3029 }
3030 });
3031 Prism.languages.javascript['keyword'].unshift({
3032 pattern: /\b(?:as|default|export|from|import)\b/,
3033 alias: 'module'
3034 }, {
3035 pattern: /\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,
3036 alias: 'control-flow'
3037 }, {
3038 pattern: /\bnull\b/,
3039 alias: ['null', 'nil']
3040 }, {
3041 pattern: /\bundefined\b/,
3042 alias: 'nil'
3043 });
3044 Prism.languages.insertBefore('javascript', 'operator', {
3045 'spread': {
3046 pattern: /\.{3}/,
3047 alias: 'operator'
3048 },
3049 'arrow': {
3050 pattern: /=>/,
3051 alias: 'operator'
3052 }
3053 });
3054 Prism.languages.insertBefore('javascript', 'punctuation', {
3055 'property-access': {
3056 pattern: withId(/(\.\s*)#?<ID>/.source),
3057 lookbehind: true
3058 },
3059 'maybe-class-name': {
3060 pattern: /(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,
3061 lookbehind: true
3062 },
3063 'dom': {
3064 // this contains only a few commonly used DOM variables
3065 pattern: /\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/,
3066 alias: 'variable'
3067 },
3068 'console': {
3069 pattern: /\bconsole(?=\s*\.)/,
3070 alias: 'class-name'
3071 }
3072 }); // add 'maybe-class-name' to tokens which might be a class name
3073
3074 var maybeClassNameTokens = ['function', 'function-variable', 'method', 'method-variable', 'property-access'];
3075
3076 for (var i = 0; i < maybeClassNameTokens.length; i++) {
3077 var token = maybeClassNameTokens[i];
3078 var value = Prism.languages.javascript[token]; // convert regex to object
3079
3080 if (Prism.util.type(value) === 'RegExp') {
3081 value = Prism.languages.javascript[token] = {
3082 pattern: value
3083 };
3084 } // keep in mind that we don't support arrays
3085
3086
3087 var inside = value.inside || {};
3088 value.inside = inside;
3089 inside['maybe-class-name'] = /^[A-Z][\s\S]*/;
3090 }
3091})(prism);
3092/* "prismjs/components/prism-jsx" */
3093
3094
3095(function (Prism) {
3096 var javascript = Prism.util.clone(Prism.languages.javascript);
3097 var space = /(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source;
3098 var braces = /(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source;
3099 var spread = /(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;
3100 /**
3101 * @param {string} source
3102 * @param {string} [flags]
3103 */
3104
3105 function re(source, flags) {
3106 source = source.replace(/<S>/g, function () {
3107 return space;
3108 }).replace(/<BRACES>/g, function () {
3109 return braces;
3110 }).replace(/<SPREAD>/g, function () {
3111 return spread;
3112 });
3113 return RegExp(source, flags);
3114 }
3115
3116 spread = re(spread).source;
3117 Prism.languages.jsx = Prism.languages.extend('markup', javascript);
3118 Prism.languages.jsx.tag.pattern = re(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source);
3119 Prism.languages.jsx.tag.inside['tag'].pattern = /^<\/?[^\s>\/]*/;
3120 Prism.languages.jsx.tag.inside['attr-value'].pattern = /=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/;
3121 Prism.languages.jsx.tag.inside['tag'].inside['class-name'] = /^[A-Z]\w*(?:\.[A-Z]\w*)*$/;
3122 Prism.languages.jsx.tag.inside['comment'] = javascript['comment'];
3123 Prism.languages.insertBefore('inside', 'attr-name', {
3124 'spread': {
3125 pattern: re(/<SPREAD>/.source),
3126 inside: Prism.languages.jsx
3127 }
3128 }, Prism.languages.jsx.tag);
3129 Prism.languages.insertBefore('inside', 'special-attr', {
3130 'script': {
3131 // Allow for two levels of nesting
3132 pattern: re(/=<BRACES>/.source),
3133 alias: 'language-javascript',
3134 inside: {
3135 'script-punctuation': {
3136 pattern: /^=(?=\{)/,
3137 alias: 'punctuation'
3138 },
3139 rest: Prism.languages.jsx
3140 }
3141 }
3142 }, Prism.languages.jsx.tag); // The following will handle plain text inside tags
3143
3144 var stringifyToken = function (token) {
3145 if (!token) {
3146 return '';
3147 }
3148
3149 if (typeof token === 'string') {
3150 return token;
3151 }
3152
3153 if (typeof token.content === 'string') {
3154 return token.content;
3155 }
3156
3157 return token.content.map(stringifyToken).join('');
3158 };
3159
3160 var walkTokens = function (tokens) {
3161 var openedTags = [];
3162
3163 for (var i = 0; i < tokens.length; i++) {
3164 var token = tokens[i];
3165 var notTagNorBrace = false;
3166
3167 if (typeof token !== 'string') {
3168 if (token.type === 'tag' && token.content[0] && token.content[0].type === 'tag') {
3169 // We found a tag, now find its kind
3170 if (token.content[0].content[0].content === '</') {
3171 // Closing tag
3172 if (openedTags.length > 0 && openedTags[openedTags.length - 1].tagName === stringifyToken(token.content[0].content[1])) {
3173 // Pop matching opening tag
3174 openedTags.pop();
3175 }
3176 } else {
3177 if (token.content[token.content.length - 1].content === '/>') ; else {
3178 // Opening tag
3179 openedTags.push({
3180 tagName: stringifyToken(token.content[0].content[1]),
3181 openedBraces: 0
3182 });
3183 }
3184 }
3185 } else if (openedTags.length > 0 && token.type === 'punctuation' && token.content === '{') {
3186 // Here we might have entered a JSX context inside a tag
3187 openedTags[openedTags.length - 1].openedBraces++;
3188 } else if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces > 0 && token.type === 'punctuation' && token.content === '}') {
3189 // Here we might have left a JSX context inside a tag
3190 openedTags[openedTags.length - 1].openedBraces--;
3191 } else {
3192 notTagNorBrace = true;
3193 }
3194 }
3195
3196 if (notTagNorBrace || typeof token === 'string') {
3197 if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces === 0) {
3198 // Here we are inside a tag, and not inside a JSX context.
3199 // That's plain text: drop any tokens matched.
3200 var plainText = stringifyToken(token); // And merge text with adjacent text
3201
3202 if (i < tokens.length - 1 && (typeof tokens[i + 1] === 'string' || tokens[i + 1].type === 'plain-text')) {
3203 plainText += stringifyToken(tokens[i + 1]);
3204 tokens.splice(i + 1, 1);
3205 }
3206
3207 if (i > 0 && (typeof tokens[i - 1] === 'string' || tokens[i - 1].type === 'plain-text')) {
3208 plainText = stringifyToken(tokens[i - 1]) + plainText;
3209 tokens.splice(i - 1, 1);
3210 i--;
3211 }
3212
3213 tokens[i] = new Prism.Token('plain-text', plainText, null, plainText);
3214 }
3215 }
3216
3217 if (token.content && typeof token.content !== 'string') {
3218 walkTokens(token.content);
3219 }
3220 }
3221 };
3222
3223 Prism.hooks.add('after-tokenize', function (env) {
3224 if (env.language !== 'jsx' && env.language !== 'tsx') {
3225 return;
3226 }
3227
3228 walkTokens(env.tokens);
3229 });
3230})(prism);
3231/* "prismjs/components/prism-diff" */
3232
3233
3234(function (Prism) {
3235 Prism.languages.diff = {
3236 'coord': [// Match all kinds of coord lines (prefixed by "+++", "---" or "***").
3237 /^(?:\*{3}|-{3}|\+{3}).*$/m, // Match "@@ ... @@" coord lines in unified diff.
3238 /^@@.*@@$/m, // Match coord lines in normal diff (starts with a number).
3239 /^\d.*$/m] // deleted, inserted, unchanged, diff
3240
3241 };
3242 /**
3243 * A map from the name of a block to its line prefix.
3244 *
3245 * @type {Object<string, string>}
3246 */
3247
3248 var PREFIXES = {
3249 'deleted-sign': '-',
3250 'deleted-arrow': '<',
3251 'inserted-sign': '+',
3252 'inserted-arrow': '>',
3253 'unchanged': ' ',
3254 'diff': '!'
3255 }; // add a token for each prefix
3256
3257 Object.keys(PREFIXES).forEach(function (name) {
3258 var prefix = PREFIXES[name];
3259 var alias = [];
3260
3261 if (!/^\w+$/.test(name)) {
3262 // "deleted-sign" -> "deleted"
3263 alias.push(/\w+/.exec(name)[0]);
3264 }
3265
3266 if (name === 'diff') {
3267 alias.push('bold');
3268 }
3269
3270 Prism.languages.diff[name] = {
3271 pattern: RegExp('^(?:[' + prefix + '].*(?:\r\n?|\n|(?![\\s\\S])))+', 'm'),
3272 alias: alias,
3273 inside: {
3274 'line': {
3275 pattern: /(.)(?=[\s\S]).*(?:\r\n?|\n)?/,
3276 lookbehind: true
3277 },
3278 'prefix': {
3279 pattern: /[\s\S]/,
3280 alias: /\w+/.exec(name)[0]
3281 }
3282 }
3283 };
3284 }); // make prefixes available to Diff plugin
3285
3286 Object.defineProperty(Prism.languages.diff, 'PREFIXES', {
3287 value: PREFIXES
3288 });
3289})(prism);
3290/* "prismjs/components/prism-git" */
3291
3292
3293prism.languages.git = {
3294 /*
3295 * A simple one line comment like in a git status command
3296 * For instance:
3297 * $ git status
3298 * # On branch infinite-scroll
3299 * # Your branch and 'origin/sharedBranches/frontendTeam/infinite-scroll' have diverged,
3300 * # and have 1 and 2 different commits each, respectively.
3301 * nothing to commit (working directory clean)
3302 */
3303 'comment': /^#.*/m,
3304
3305 /*
3306 * Regexp to match the changed lines in a git diff output. Check the example below.
3307 */
3308 'deleted': /^[-–].*/m,
3309 'inserted': /^\+.*/m,
3310
3311 /*
3312 * a string (double and simple quote)
3313 */
3314 'string': /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
3315
3316 /*
3317 * a git command. It starts with a random prompt finishing by a $, then "git" then some other parameters
3318 * For instance:
3319 * $ git add file.txt
3320 */
3321 'command': {
3322 pattern: /^.*\$ git .*$/m,
3323 inside: {
3324 /*
3325 * A git command can contain a parameter starting by a single or a double dash followed by a string
3326 * For instance:
3327 * $ git diff --cached
3328 * $ git log -p
3329 */
3330 'parameter': /\s--?\w+/
3331 }
3332 },
3333
3334 /*
3335 * Coordinates displayed in a git diff command
3336 * For instance:
3337 * $ git diff
3338 * diff --git file.txt file.txt
3339 * index 6214953..1d54a52 100644
3340 * --- file.txt
3341 * +++ file.txt
3342 * @@ -1 +1,2 @@
3343 * -Here's my tetx file
3344 * +Here's my text file
3345 * +And this is the second line
3346 */
3347 'coord': /^@@.*@@$/m,
3348
3349 /*
3350 * Match a "commit [SHA1]" line in a git log output.
3351 * For instance:
3352 * $ git log
3353 * commit a11a14ef7e26f2ca62d4b35eac455ce636d0dc09
3354 * Author: lgiraudel
3355 * Date: Mon Feb 17 11:18:34 2014 +0100
3356 *
3357 * Add of a new line
3358 */
3359 'commit-sha1': /^commit \w{40}$/m
3360};
3361/* "prismjs/components/prism-go" */
3362
3363prism.languages.go = prism.languages.extend('clike', {
3364 'string': {
3365 pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,
3366 lookbehind: true,
3367 greedy: true
3368 },
3369 '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/,
3370 'boolean': /\b(?:_|false|iota|nil|true)\b/,
3371 'number': [// binary and octal integers
3372 /\b0(?:b[01_]+|o[0-7_]+)i?\b/i, // hexadecimal integers and floats
3373 /\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i, // decimal integers and floats
3374 /(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],
3375 'operator': /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
3376 '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/
3377});
3378prism.languages.insertBefore('go', 'string', {
3379 'char': {
3380 pattern: /'(?:\\.|[^'\\\r\n]){0,10}'/,
3381 greedy: true
3382 }
3383});
3384delete prism.languages.go['class-name'];
3385/* "prismjs/components/prism-handlebars" */
3386
3387(function (Prism) {
3388 Prism.languages.handlebars = {
3389 'comment': /\{\{![\s\S]*?\}\}/,
3390 'delimiter': {
3391 pattern: /^\{\{\{?|\}\}\}?$/,
3392 alias: 'punctuation'
3393 },
3394 'string': /(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,
3395 'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][+-]?\d+)?/,
3396 'boolean': /\b(?:false|true)\b/,
3397 'block': {
3398 pattern: /^(\s*(?:~\s*)?)[#\/]\S+?(?=\s*(?:~\s*)?$|\s)/,
3399 lookbehind: true,
3400 alias: 'keyword'
3401 },
3402 'brackets': {
3403 pattern: /\[[^\]]+\]/,
3404 inside: {
3405 punctuation: /\[|\]/,
3406 variable: /[\s\S]+/
3407 }
3408 },
3409 'punctuation': /[!"#%&':()*+,.\/;<=>@\[\\\]^`{|}~]/,
3410 'variable': /[^!"#%&'()*+,\/;<=>@\[\\\]^`{|}~\s]+/
3411 };
3412 Prism.hooks.add('before-tokenize', function (env) {
3413 var handlebarsPattern = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/g;
3414 Prism.languages['markup-templating'].buildPlaceholders(env, 'handlebars', handlebarsPattern);
3415 });
3416 Prism.hooks.add('after-tokenize', function (env) {
3417 Prism.languages['markup-templating'].tokenizePlaceholders(env, 'handlebars');
3418 });
3419 Prism.languages.hbs = Prism.languages.handlebars;
3420})(prism);
3421/* "prismjs/components/prism-json" */
3422// https://www.json.org/json-en.html
3423
3424
3425prism.languages.json = {
3426 'property': {
3427 pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
3428 lookbehind: true,
3429 greedy: true
3430 },
3431 'string': {
3432 pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
3433 lookbehind: true,
3434 greedy: true
3435 },
3436 'comment': {
3437 pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
3438 greedy: true
3439 },
3440 'number': /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
3441 'punctuation': /[{}[\],]/,
3442 'operator': /:/,
3443 'boolean': /\b(?:false|true)\b/,
3444 'null': {
3445 pattern: /\bnull\b/,
3446 alias: 'keyword'
3447 }
3448};
3449prism.languages.webmanifest = prism.languages.json;
3450/* "prismjs/components/prism-less" */
3451
3452/* FIXME :
3453 :extend() is not handled specifically : its highlighting is buggy.
3454 Mixin usage must be inside a ruleset to be highlighted.
3455 At-rules (e.g. import) containing interpolations are buggy.
3456 Detached rulesets are highlighted as at-rules.
3457 A comment before a mixin usage prevents the latter to be properly highlighted.
3458 */
3459
3460prism.languages.less = prism.languages.extend('css', {
3461 'comment': [/\/\*[\s\S]*?\*\//, {
3462 pattern: /(^|[^\\])\/\/.*/,
3463 lookbehind: true
3464 }],
3465 'atrule': {
3466 pattern: /@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,
3467 inside: {
3468 'punctuation': /[:()]/
3469 }
3470 },
3471 // selectors and mixins are considered the same
3472 'selector': {
3473 pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,
3474 inside: {
3475 // mixin parameters
3476 'variable': /@+[\w-]+/
3477 }
3478 },
3479 'property': /(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,
3480 'operator': /[+\-*\/]/
3481});
3482prism.languages.insertBefore('less', 'property', {
3483 'variable': [// Variable declaration (the colon must be consumed!)
3484 {
3485 pattern: /@[\w-]+\s*:/,
3486 inside: {
3487 'punctuation': /:/
3488 }
3489 }, // Variable usage
3490 /@@?[\w-]+/],
3491 'mixin-usage': {
3492 pattern: /([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,
3493 lookbehind: true,
3494 alias: 'function'
3495 }
3496});
3497/* "prismjs/components/prism-makefile" */
3498
3499prism.languages.makefile = {
3500 'comment': {
3501 pattern: /(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,
3502 lookbehind: true
3503 },
3504 'string': {
3505 pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
3506 greedy: true
3507 },
3508 'builtin-target': {
3509 pattern: /\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,
3510 alias: 'builtin'
3511 },
3512 'target': {
3513 pattern: /^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,
3514 alias: 'symbol',
3515 inside: {
3516 'variable': /\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/
3517 }
3518 },
3519 'variable': /\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,
3520 // Directives
3521 'keyword': /-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,
3522 'function': {
3523 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])/,
3524 lookbehind: true
3525 },
3526 'operator': /(?:::|[?:+!])?=|[|@]/,
3527 'punctuation': /[:;(){}]/
3528};
3529/* "prismjs/components/prism-objectivec" */
3530
3531prism.languages.objectivec = prism.languages.extend('c', {
3532 'string': {
3533 pattern: /@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
3534 greedy: true
3535 },
3536 '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/,
3537 'operator': /-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/
3538});
3539delete prism.languages.objectivec['class-name'];
3540prism.languages.objc = prism.languages.objectivec;
3541/* "prismjs/components/prism-ocaml" */
3542// https://ocaml.org/manual/lex.html
3543
3544prism.languages.ocaml = {
3545 'comment': {
3546 pattern: /\(\*[\s\S]*?\*\)/,
3547 greedy: true
3548 },
3549 'char': {
3550 pattern: /'(?:[^\\\r\n']|\\(?:.|[ox]?[0-9a-f]{1,3}))'/i,
3551 greedy: true
3552 },
3553 'string': [{
3554 pattern: /"(?:\\(?:[\s\S]|\r\n)|[^\\\r\n"])*"/,
3555 greedy: true
3556 }, {
3557 pattern: /\{([a-z_]*)\|[\s\S]*?\|\1\}/,
3558 greedy: true
3559 }],
3560 'number': [// binary and octal
3561 /\b(?:0b[01][01_]*|0o[0-7][0-7_]*)\b/i, // hexadecimal
3562 /\b0x[a-f0-9][a-f0-9_]*(?:\.[a-f0-9_]*)?(?:p[+-]?\d[\d_]*)?(?!\w)/i, // decimal
3563 /\b\d[\d_]*(?:\.[\d_]*)?(?:e[+-]?\d[\d_]*)?(?!\w)/i],
3564 'directive': {
3565 pattern: /\B#\w+/,
3566 alias: 'property'
3567 },
3568 'label': {
3569 pattern: /\B~\w+/,
3570 alias: 'property'
3571 },
3572 'type-variable': {
3573 pattern: /\B'\w+/,
3574 alias: 'function'
3575 },
3576 'variant': {
3577 pattern: /`\w+/,
3578 alias: 'symbol'
3579 },
3580 // For the list of keywords and operators,
3581 // see: http://caml.inria.fr/pub/docs/manual-ocaml/lex.html#sec84
3582 '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/,
3583 'boolean': /\b(?:false|true)\b/,
3584 'operator-like-punctuation': {
3585 pattern: /\[[<>|]|[>|]\]|\{<|>\}/,
3586 alias: 'punctuation'
3587 },
3588 // Custom operators are allowed
3589 'operator': /\.[.~]|:[=>]|[=<>@^|&+\-*\/$%!?~][!$%&*+\-.\/:<=>?@^|~]*|\b(?:and|asr|land|lor|lsl|lsr|lxor|mod|or)\b/,
3590 'punctuation': /;;|::|[(){}\[\].,:;#]|\b_\b/
3591};
3592/* "prismjs/components/prism-python" */
3593
3594prism.languages.python = {
3595 'comment': {
3596 pattern: /(^|[^\\])#.*/,
3597 lookbehind: true,
3598 greedy: true
3599 },
3600 'string-interpolation': {
3601 pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
3602 greedy: true,
3603 inside: {
3604 'interpolation': {
3605 // "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
3606 pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
3607 lookbehind: true,
3608 inside: {
3609 'format-spec': {
3610 pattern: /(:)[^:(){}]+(?=\}$)/,
3611 lookbehind: true
3612 },
3613 'conversion-option': {
3614 pattern: /![sra](?=[:}]$)/,
3615 alias: 'punctuation'
3616 },
3617 rest: null
3618 }
3619 },
3620 'string': /[\s\S]+/
3621 }
3622 },
3623 'triple-quoted-string': {
3624 pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
3625 greedy: true,
3626 alias: 'string'
3627 },
3628 'string': {
3629 pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
3630 greedy: true
3631 },
3632 'function': {
3633 pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
3634 lookbehind: true
3635 },
3636 'class-name': {
3637 pattern: /(\bclass\s+)\w+/i,
3638 lookbehind: true
3639 },
3640 'decorator': {
3641 pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
3642 lookbehind: true,
3643 alias: ['annotation', 'punctuation'],
3644 inside: {
3645 'punctuation': /\./
3646 }
3647 },
3648 '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/,
3649 '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/,
3650 'boolean': /\b(?:False|None|True)\b/,
3651 '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,
3652 'operator': /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
3653 'punctuation': /[{}[\];(),.:]/
3654};
3655prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = prism.languages.python;
3656prism.languages.py = prism.languages.python;
3657/* "prismjs/components/prism-reason" */
3658
3659prism.languages.reason = prism.languages.extend('clike', {
3660 'string': {
3661 pattern: /"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,
3662 greedy: true
3663 },
3664 // 'class-name' must be matched *after* 'constructor' defined below
3665 'class-name': /\b[A-Z]\w*/,
3666 '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/,
3667 'operator': /\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/
3668});
3669prism.languages.insertBefore('reason', 'class-name', {
3670 'char': {
3671 pattern: /'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,
3672 greedy: true
3673 },
3674 // Negative look-ahead prevents from matching things like String.capitalize
3675 'constructor': /\b[A-Z]\w*\b(?!\s*\.)/,
3676 'label': {
3677 pattern: /\b[a-z]\w*(?=::)/,
3678 alias: 'symbol'
3679 }
3680}); // We can't match functions property, so let's not even try.
3681
3682delete prism.languages.reason.function;
3683/* "prismjs/components/prism-sass" */
3684
3685(function (Prism) {
3686 Prism.languages.sass = Prism.languages.extend('css', {
3687 // Sass comments don't need to be closed, only indented
3688 'comment': {
3689 pattern: /^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,
3690 lookbehind: true,
3691 greedy: true
3692 }
3693 });
3694 Prism.languages.insertBefore('sass', 'atrule', {
3695 // We want to consume the whole line
3696 'atrule-line': {
3697 // Includes support for = and + shortcuts
3698 pattern: /^(?:[ \t]*)[@+=].+/m,
3699 greedy: true,
3700 inside: {
3701 'atrule': /(?:@[\w-]+|[+=])/
3702 }
3703 }
3704 });
3705 delete Prism.languages.sass.atrule;
3706 var variable = /\$[-\w]+|#\{\$[-\w]+\}/;
3707 var operator = [/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/, {
3708 pattern: /(\s)-(?=\s)/,
3709 lookbehind: true
3710 }];
3711 Prism.languages.insertBefore('sass', 'property', {
3712 // We want to consume the whole line
3713 'variable-line': {
3714 pattern: /^[ \t]*\$.+/m,
3715 greedy: true,
3716 inside: {
3717 'punctuation': /:/,
3718 'variable': variable,
3719 'operator': operator
3720 }
3721 },
3722 // We want to consume the whole line
3723 'property-line': {
3724 pattern: /^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,
3725 greedy: true,
3726 inside: {
3727 'property': [/[^:\s]+(?=\s*:)/, {
3728 pattern: /(:)[^:\s]+/,
3729 lookbehind: true
3730 }],
3731 'punctuation': /:/,
3732 'variable': variable,
3733 'operator': operator,
3734 'important': Prism.languages.sass.important
3735 }
3736 }
3737 });
3738 delete Prism.languages.sass.property;
3739 delete Prism.languages.sass.important; // Now that whole lines for other patterns are consumed,
3740 // what's left should be selectors
3741
3742 Prism.languages.insertBefore('sass', 'punctuation', {
3743 'selector': {
3744 pattern: /^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,
3745 lookbehind: true,
3746 greedy: true
3747 }
3748 });
3749})(prism);
3750/* "prismjs/components/prism-scss" */
3751
3752
3753prism.languages.scss = prism.languages.extend('css', {
3754 'comment': {
3755 pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
3756 lookbehind: true
3757 },
3758 'atrule': {
3759 pattern: /@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,
3760 inside: {
3761 'rule': /@[\w-]+/ // See rest below
3762
3763 }
3764 },
3765 // url, compassified
3766 'url': /(?:[-a-z]+-)?url(?=\()/i,
3767 // CSS selector regex is not appropriate for Sass
3768 // since there can be lot more things (var, @ directive, nesting..)
3769 // a selector must start at the end of a property or after a brace (end of other rules or nesting)
3770 // it can contain some characters that aren't used for defining rules or end of selector, & (parent selector), or interpolated variable
3771 // 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
3772 // can "pass" as a selector- e.g: proper#{$erty})
3773 // this one was hard to do, so please be careful if you edit this one :)
3774 'selector': {
3775 // Initial look-ahead is used to prevent matching of blank selectors
3776 pattern: /(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,
3777 inside: {
3778 'parent': {
3779 pattern: /&/,
3780 alias: 'important'
3781 },
3782 'placeholder': /%[-\w]+/,
3783 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
3784 }
3785 },
3786 'property': {
3787 pattern: /(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,
3788 inside: {
3789 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
3790 }
3791 }
3792});
3793prism.languages.insertBefore('scss', 'atrule', {
3794 'keyword': [/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i, {
3795 pattern: /( )(?:from|through)(?= )/,
3796 lookbehind: true
3797 }]
3798});
3799prism.languages.insertBefore('scss', 'important', {
3800 // var and interpolated vars
3801 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
3802});
3803prism.languages.insertBefore('scss', 'function', {
3804 'module-modifier': {
3805 pattern: /\b(?:as|hide|show|with)\b/i,
3806 alias: 'keyword'
3807 },
3808 'placeholder': {
3809 pattern: /%[-\w]+/,
3810 alias: 'selector'
3811 },
3812 'statement': {
3813 pattern: /\B!(?:default|optional)\b/i,
3814 alias: 'keyword'
3815 },
3816 'boolean': /\b(?:false|true)\b/,
3817 'null': {
3818 pattern: /\bnull\b/,
3819 alias: 'keyword'
3820 },
3821 'operator': {
3822 pattern: /(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,
3823 lookbehind: true
3824 }
3825});
3826prism.languages.scss['atrule'].inside.rest = prism.languages.scss;
3827/* "prismjs/components/prism-stylus" */
3828
3829(function (Prism) {
3830 var unit = {
3831 pattern: /(\b\d+)(?:%|[a-z]+)/,
3832 lookbehind: true
3833 }; // 123 -123 .123 -.123 12.3 -12.3
3834
3835 var number = {
3836 pattern: /(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,
3837 lookbehind: true
3838 };
3839 var inside = {
3840 'comment': {
3841 pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
3842 lookbehind: true
3843 },
3844 'url': {
3845 pattern: /\burl\((["']?).*?\1\)/i,
3846 greedy: true
3847 },
3848 'string': {
3849 pattern: /("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,
3850 greedy: true
3851 },
3852 'interpolation': null,
3853 // See below
3854 'func': null,
3855 // See below
3856 'important': /\B!(?:important|optional)\b/i,
3857 'keyword': {
3858 pattern: /(^|\s+)(?:(?:else|for|if|return|unless)(?=\s|$)|@[\w-]+)/,
3859 lookbehind: true
3860 },
3861 'hexcode': /#[\da-f]{3,6}/i,
3862 '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, {
3863 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,
3864 inside: {
3865 'unit': unit,
3866 'number': number,
3867 'function': /[\w-]+(?=\()/,
3868 'punctuation': /[(),]/
3869 }
3870 }],
3871 'entity': /\\[\da-f]{1,8}/i,
3872 'unit': unit,
3873 'boolean': /\b(?:false|true)\b/,
3874 'operator': [// We want non-word chars around "-" because it is
3875 // accepted in property names.
3876 /~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.{2,3}|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],
3877 'number': number,
3878 'punctuation': /[{}()\[\];:,]/
3879 };
3880 inside['interpolation'] = {
3881 pattern: /\{[^\r\n}:]+\}/,
3882 alias: 'variable',
3883 inside: {
3884 'delimiter': {
3885 pattern: /^\{|\}$/,
3886 alias: 'punctuation'
3887 },
3888 rest: inside
3889 }
3890 };
3891 inside['func'] = {
3892 pattern: /[\w-]+\([^)]*\).*/,
3893 inside: {
3894 'function': /^[^(]+/,
3895 rest: inside
3896 }
3897 };
3898 Prism.languages.stylus = {
3899 'atrule-declaration': {
3900 pattern: /(^[ \t]*)@.+/m,
3901 lookbehind: true,
3902 inside: {
3903 'atrule': /^@[\w-]+/,
3904 rest: inside
3905 }
3906 },
3907 'variable-declaration': {
3908 pattern: /(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:\{[^{}]*\}|\S.*|$)/m,
3909 lookbehind: true,
3910 inside: {
3911 'variable': /^\S+/,
3912 rest: inside
3913 }
3914 },
3915 'statement': {
3916 pattern: /(^[ \t]*)(?:else|for|if|return|unless)[ \t].+/m,
3917 lookbehind: true,
3918 inside: {
3919 'keyword': /^\S+/,
3920 rest: inside
3921 }
3922 },
3923 // A property/value pair cannot end with a comma or a brace
3924 // It cannot have indented content unless it ended with a semicolon
3925 'property-declaration': {
3926 pattern: /((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)(?!\s)[^{\r\n]*(?:;|[^{\r\n,]$(?!(?:\r?\n|\r)(?:\{|\2[ \t])))/m,
3927 lookbehind: true,
3928 inside: {
3929 'property': {
3930 pattern: /^[^\s:]+/,
3931 inside: {
3932 'interpolation': inside.interpolation
3933 }
3934 },
3935 rest: inside
3936 }
3937 },
3938 // A selector can contain parentheses only as part of a pseudo-element
3939 // It can span multiple lines.
3940 // It must end with a comma or an accolade or have indented content.
3941 'selector': {
3942 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,
3943 lookbehind: true,
3944 inside: {
3945 'interpolation': inside.interpolation,
3946 'comment': inside.comment,
3947 'punctuation': /[{},]/
3948 }
3949 },
3950 'func': inside.func,
3951 'string': inside.string,
3952 'comment': {
3953 pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
3954 lookbehind: true,
3955 greedy: true
3956 },
3957 'interpolation': inside.interpolation,
3958 'punctuation': /[{}()\[\];:.]/
3959 };
3960})(prism);
3961/* "prismjs/components/prism-tsx" */
3962
3963
3964(function (Prism) {
3965 var typescript = Prism.util.clone(Prism.languages.typescript);
3966 Prism.languages.tsx = Prism.languages.extend('jsx', typescript); // doesn't work with TS because TS is too complex
3967
3968 delete Prism.languages.tsx['parameter'];
3969 delete Prism.languages.tsx['literal-property']; // This will prevent collisions between TSX tags and TS generic types.
3970 // Idea by https://github.com/karlhorky
3971 // Discussion: https://github.com/PrismJS/prism/issues/2594#issuecomment-710666928
3972
3973 var tag = Prism.languages.tsx.tag;
3974 tag.pattern = RegExp(/(^|[^\w$]|(?=<\/))/.source + '(?:' + tag.pattern.source + ')', tag.pattern.flags);
3975 tag.lookbehind = true;
3976})(prism);
3977/* "prismjs/components/prism-wasm" */
3978
3979
3980prism.languages.wasm = {
3981 'comment': [/\(;[\s\S]*?;\)/, {
3982 pattern: /;;.*/,
3983 greedy: true
3984 }],
3985 'string': {
3986 pattern: /"(?:\\[\s\S]|[^"\\])*"/,
3987 greedy: true
3988 },
3989 'keyword': [{
3990 pattern: /\b(?:align|offset)=/,
3991 inside: {
3992 'operator': /=/
3993 }
3994 }, {
3995 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/,
3996 inside: {
3997 'punctuation': /\./
3998 }
3999 }, /\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/],
4000 'variable': /\$[\w!#$%&'*+\-./:<=>?@\\^`|~]+/,
4001 '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/,
4002 'punctuation': /[()]/
4003};
4004
4005export default prism;