@splunk/react-ui 4.21.0 → 4.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/Accordion.js +425 -325
  2. package/Anchor.js +147 -117
  3. package/Animation.js +142 -94
  4. package/AnimationToggle.js +197 -193
  5. package/Box.js +145 -118
  6. package/Breadcrumbs.js +288 -206
  7. package/Button.js +488 -465
  8. package/ButtonGroup.js +160 -128
  9. package/ButtonSimple.js +543 -462
  10. package/CHANGELOG.md +24 -3
  11. package/Calendar.js +1111 -1001
  12. package/Card.js +771 -598
  13. package/CardLayout.js +205 -147
  14. package/Chip.js +509 -488
  15. package/Clickable.js +414 -352
  16. package/CloseButton.js +165 -142
  17. package/Code.js +1807 -2084
  18. package/CollapsiblePanel.js +586 -519
  19. package/Color.js +1068 -1068
  20. package/ColumnLayout.js +402 -363
  21. package/ComboBox.js +903 -794
  22. package/Concertina.js +997 -802
  23. package/ControlGroup.js +687 -594
  24. package/Date.js +567 -547
  25. package/DefinitionList.js +308 -234
  26. package/Divider.js +149 -118
  27. package/Dropdown.js +459 -416
  28. package/DualListbox.js +1479 -1541
  29. package/EventListener.js +94 -97
  30. package/File.js +1051 -969
  31. package/FormRows.js +883 -696
  32. package/Heading.js +216 -193
  33. package/Image.js +446 -402
  34. package/JSONTree.js +690 -551
  35. package/Layer.js +437 -410
  36. package/Link.js +336 -255
  37. package/List.js +213 -161
  38. package/Markdown.js +509 -487
  39. package/Menu.js +1104 -1056
  40. package/Message.js +475 -441
  41. package/MessageBar.js +387 -373
  42. package/Modal.js +810 -634
  43. package/ModalLayer.js +326 -243
  44. package/Monogram.js +308 -276
  45. package/Multiselect.js +3564 -3364
  46. package/Number.js +729 -687
  47. package/Paginator.js +510 -449
  48. package/Paragraph.js +145 -112
  49. package/Popover.js +1459 -1432
  50. package/Progress.js +301 -246
  51. package/RadioBar.js +634 -527
  52. package/RadioList.js +483 -444
  53. package/Resize.js +530 -489
  54. package/ResultsMenu.js +479 -455
  55. package/ScreenReaderContent.js +142 -111
  56. package/Scroll.js +595 -456
  57. package/ScrollContainerContext.js +197 -206
  58. package/Search.js +756 -650
  59. package/Select.js +2446 -2345
  60. package/SidePanel.js +390 -284
  61. package/Slider.js +680 -676
  62. package/SlidingPanels.js +639 -503
  63. package/SplitButton.js +464 -367
  64. package/StaticContent.js +161 -133
  65. package/StepBar.js +386 -358
  66. package/Switch.js +710 -640
  67. package/TabBar.js +741 -680
  68. package/TabLayout.js +406 -322
  69. package/Table.js +4974 -4616
  70. package/Text.js +1170 -1138
  71. package/TextArea.js +1102 -1090
  72. package/Tooltip.js +624 -581
  73. package/TransitionOpen.js +489 -422
  74. package/Typography.js +176 -153
  75. package/WaitSpinner.js +230 -206
  76. package/package.json +7 -7
  77. package/types/src/Color/Color.d.ts +0 -1
  78. package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
  79. package/types/src/JSONTree/TreeNode.d.ts +5 -0
  80. package/types/src/RadioBar/RadioBar.d.ts +1 -0
  81. package/types/src/ResultsMenu/ResultsMenu.d.ts +0 -2
  82. package/types/src/Select/docs/examples/Icons.d.ts +1 -9
  83. package/types/src/Slider/Slider.d.ts +1 -0
  84. package/types/src/TabBar/Tab.d.ts +10 -1
  85. package/types/src/TabBar/TabBar.d.ts +4 -2
  86. package/types/src/Table/Head.d.ts +7 -3
  87. package/types/src/Table/Table.d.ts +3 -2
  88. package/types/src/Table/TableContext.d.ts +2 -0
  89. package/useForceUpdate.js +112 -82
  90. package/useKeyPress.js +74 -71
  91. package/usePrevious.js +65 -65
  92. package/useRovingFocus.js +122 -138
package/Code.js CHANGED
@@ -1,43 +1,28 @@
1
- /******/ (() => { // webpackBootstrap
2
- /******/ var __webpack_modules__ = ({
3
-
4
- /***/ 74:
5
- /***/ ((module) => {
6
-
7
-
8
- (function() {
9
- var window = undefined;
10
- var global = undefined;
11
- /// <reference lib="WebWorker"/>
12
-
13
- var _self = (typeof window !== 'undefined')
14
- ? window // if in browser
15
- : (
16
- (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
17
- ? self // if in worker
18
- : {} // if in node js
19
- );
20
-
21
- /**
1
+ /******/ (() => {
2
+ // webpackBootstrap
3
+ /******/ var e = {
4
+ /***/ 74:
5
+ /***/ e => {
6
+ (function() {
7
+ var t = undefined;
8
+ var a = undefined;
9
+ /// <reference lib="WebWorker"/>
10
+ var n = typeof t !== "undefined" ? t : typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope ? self : {};
11
+ /**
22
12
  * Prism: Lightweight, robust, elegant syntax highlighting
23
13
  *
24
14
  * @license MIT <https://opensource.org/licenses/MIT>
25
15
  * @author Lea Verou <https://lea.verou.me>
26
16
  * @namespace
27
17
  * @public
28
- */
29
- var Prism = (function (_self) {
30
-
31
- // Private helper vars
32
- var lang = /\blang(?:uage)?-([\w-]+)\b/i;
33
- var uniqueId = 0;
34
-
35
- // The grammar object for plaintext
36
- var plainTextGrammar = {};
37
-
38
-
39
- var _ = {
40
- /**
18
+ */ var r = function(e) {
19
+ // Private helper vars
20
+ var a = /\blang(?:uage)?-([\w-]+)\b/i;
21
+ var n = 0;
22
+ // The grammar object for plaintext
23
+ var r = {};
24
+ var s = {
25
+ /**
41
26
  * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
42
27
  * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
43
28
  * additional languages or plugins yourself.
@@ -58,10 +43,9 @@ var Prism = (function (_self) {
58
43
  * @memberof Prism
59
44
  * @public
60
45
  */
61
- manual: _self.Prism && _self.Prism.manual,
62
- disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
63
-
64
- /**
46
+ manual: e.Prism && e.Prism.manual,
47
+ disableWorkerMessageHandler: e.Prism && e.Prism.disableWorkerMessageHandler,
48
+ /**
65
49
  * A namespace for utility methods.
66
50
  *
67
51
  * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
@@ -70,18 +54,17 @@ var Prism = (function (_self) {
70
54
  * @namespace
71
55
  * @memberof Prism
72
56
  */
73
- util: {
74
- encode: function encode(tokens) {
75
- if (tokens instanceof Token) {
76
- return new Token(tokens.type, encode(tokens.content), tokens.alias);
77
- } else if (Array.isArray(tokens)) {
78
- return tokens.map(encode);
79
- } else {
80
- return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\u00a0/g, ' ');
81
- }
82
- },
83
-
84
- /**
57
+ util: {
58
+ encode: function e(t) {
59
+ if (t instanceof i) {
60
+ return new i(t.type, e(t.content), t.alias);
61
+ } else if (Array.isArray(t)) {
62
+ return t.map(e);
63
+ } else {
64
+ return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ");
65
+ }
66
+ },
67
+ /**
85
68
  * Returns the name of the type of the given value.
86
69
  *
87
70
  * @param {any} o
@@ -97,24 +80,24 @@ var Prism = (function (_self) {
97
80
  * type(String) === 'Function'
98
81
  * type(/abc+/) === 'RegExp'
99
82
  */
100
- type: function (o) {
101
- return Object.prototype.toString.call(o).slice(8, -1);
102
- },
103
-
104
- /**
83
+ type: function(e) {
84
+ return Object.prototype.toString.call(e).slice(8, -1);
85
+ },
86
+ /**
105
87
  * Returns a unique number for the given object. Later calls will still return the same number.
106
88
  *
107
89
  * @param {Object} obj
108
90
  * @returns {number}
109
91
  */
110
- objId: function (obj) {
111
- if (!obj['__id']) {
112
- Object.defineProperty(obj, '__id', { value: ++uniqueId });
113
- }
114
- return obj['__id'];
115
- },
116
-
117
- /**
92
+ objId: function(e) {
93
+ if (!e["__id"]) {
94
+ Object.defineProperty(e, "__id", {
95
+ value: ++n
96
+ });
97
+ }
98
+ return e["__id"];
99
+ },
100
+ /**
118
101
  * Creates a deep clone of the given object.
119
102
  *
120
103
  * The main intended use of this function is to clone language definitions.
@@ -124,47 +107,44 @@ var Prism = (function (_self) {
124
107
  * @returns {T}
125
108
  * @template T
126
109
  */
127
- clone: function deepClone(o, visited) {
128
- visited = visited || {};
129
-
130
- var clone; var id;
131
- switch (_.util.type(o)) {
132
- case 'Object':
133
- id = _.util.objId(o);
134
- if (visited[id]) {
135
- return visited[id];
136
- }
137
- clone = /** @type {Record<string, any>} */ ({});
138
- visited[id] = clone;
139
-
140
- for (var key in o) {
141
- if (o.hasOwnProperty(key)) {
142
- clone[key] = deepClone(o[key], visited);
143
- }
144
- }
145
-
146
- return /** @type {any} */ (clone);
147
-
148
- case 'Array':
149
- id = _.util.objId(o);
150
- if (visited[id]) {
151
- return visited[id];
152
- }
153
- clone = [];
154
- visited[id] = clone;
155
-
156
- (/** @type {Array} */(/** @type {any} */(o))).forEach(function (v, i) {
157
- clone[i] = deepClone(v, visited);
158
- });
159
-
160
- return /** @type {any} */ (clone);
161
-
162
- default:
163
- return o;
164
- }
165
- },
166
-
167
- /**
110
+ clone: function e(t, a) {
111
+ a = a || {};
112
+ var n;
113
+ var r;
114
+ switch (s.util.type(t)) {
115
+ case "Object":
116
+ r = s.util.objId(t);
117
+ if (a[r]) {
118
+ return a[r];
119
+ }
120
+ n = /** @type {Record<string, any>} */ {};
121
+ a[r] = n;
122
+ for (var i in t) {
123
+ if (t.hasOwnProperty(i)) {
124
+ n[i] = e(t[i], a);
125
+ }
126
+ }
127
+ /** @type {any} */
128
+ return n;
129
+
130
+ case "Array":
131
+ r = s.util.objId(t);
132
+ if (a[r]) {
133
+ return a[r];
134
+ }
135
+ n = [];
136
+ a[r] = n;
137
+ /** @type {Array} */ /** @type {any} */ t.forEach((function(t, r) {
138
+ n[r] = e(t, a);
139
+ }));
140
+ /** @type {any} */
141
+ return n;
142
+
143
+ default:
144
+ return t;
145
+ }
146
+ },
147
+ /**
168
148
  * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
169
149
  *
170
150
  * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
@@ -172,59 +152,54 @@ var Prism = (function (_self) {
172
152
  * @param {Element} element
173
153
  * @returns {string}
174
154
  */
175
- getLanguage: function (element) {
176
- while (element && !lang.test(element.className)) {
177
- element = element.parentElement;
178
- }
179
- if (element) {
180
- return (element.className.match(lang) || [, 'none'])[1].toLowerCase();
181
- }
182
- return 'none';
183
- },
184
-
185
- /**
155
+ getLanguage: function(e) {
156
+ while (e && !a.test(e.className)) {
157
+ e = e.parentElement;
158
+ }
159
+ if (e) {
160
+ return (e.className.match(a) || [ , "none" ])[1].toLowerCase();
161
+ }
162
+ return "none";
163
+ },
164
+ /**
186
165
  * Returns the script element that is currently executing.
187
166
  *
188
167
  * This does __not__ work for line script element.
189
168
  *
190
169
  * @returns {HTMLScriptElement | null}
191
170
  */
192
- currentScript: function () {
193
- if (typeof document === 'undefined') {
194
- return null;
195
- }
196
- if ('currentScript' in document && 1 < 2 /* hack to trip TS' flow analysis */) {
197
- return /** @type {any} */ (document.currentScript);
198
- }
199
-
200
- // IE11 workaround
201
- // we'll get the src of the current script by parsing IE11's error stack trace
202
- // this will not work for inline scripts
203
-
204
- try {
205
- throw new Error();
206
- } catch (err) {
207
- // Get file src url from stack. Specifically works with the format of stack traces in IE.
208
- // A stack will look like this:
209
- //
210
- // Error
211
- // at _.util.currentScript (http://localhost/components/prism-core.js:119:5)
212
- // at Global code (http://localhost/components/prism-core.js:606:1)
213
-
214
- var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
215
- if (src) {
216
- var scripts = document.getElementsByTagName('script');
217
- for (var i in scripts) {
218
- if (scripts[i].src == src) {
219
- return scripts[i];
220
- }
221
- }
222
- }
223
- return null;
224
- }
225
- },
226
-
227
- /**
171
+ currentScript: function() {
172
+ if (typeof document === "undefined") {
173
+ return null;
174
+ }
175
+ if ("currentScript" in document && 1 < 2 /* hack to trip TS' flow analysis */) {
176
+ /** @type {any} */
177
+ return document.currentScript;
178
+ }
179
+ // IE11 workaround
180
+ // we'll get the src of the current script by parsing IE11's error stack trace
181
+ // this will not work for inline scripts
182
+ try {
183
+ throw new Error;
184
+ } catch (n) {
185
+ // Get file src url from stack. Specifically works with the format of stack traces in IE.
186
+ // A stack will look like this:
187
+ // Error
188
+ // at _.util.currentScript (http://localhost/components/prism-core.js:119:5)
189
+ // at Global code (http://localhost/components/prism-core.js:606:1)
190
+ var e = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(n.stack) || [])[1];
191
+ if (e) {
192
+ var t = document.getElementsByTagName("script");
193
+ for (var a in t) {
194
+ if (t[a].src == e) {
195
+ return t[a];
196
+ }
197
+ }
198
+ }
199
+ return null;
200
+ }
201
+ },
202
+ /**
228
203
  * Returns whether a given class is active for `element`.
229
204
  *
230
205
  * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
@@ -243,40 +218,37 @@ var Prism = (function (_self) {
243
218
  * @param {boolean} [defaultActivation=false]
244
219
  * @returns {boolean}
245
220
  */
246
- isActive: function (element, className, defaultActivation) {
247
- var no = 'no-' + className;
248
-
249
- while (element) {
250
- var classList = element.classList;
251
- if (classList.contains(className)) {
252
- return true;
253
- }
254
- if (classList.contains(no)) {
255
- return false;
256
- }
257
- element = element.parentElement;
258
- }
259
- return !!defaultActivation;
260
- }
261
- },
262
-
263
- /**
221
+ isActive: function(e, t, a) {
222
+ var n = "no-" + t;
223
+ while (e) {
224
+ var r = e.classList;
225
+ if (r.contains(t)) {
226
+ return true;
227
+ }
228
+ if (r.contains(n)) {
229
+ return false;
230
+ }
231
+ e = e.parentElement;
232
+ }
233
+ return !!a;
234
+ }
235
+ },
236
+ /**
264
237
  * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
265
238
  *
266
239
  * @namespace
267
240
  * @memberof Prism
268
241
  * @public
269
242
  */
270
- languages: {
271
- /**
243
+ languages: {
244
+ /**
272
245
  * The grammar for plain, unformatted text.
273
246
  */
274
- plain: plainTextGrammar,
275
- plaintext: plainTextGrammar,
276
- text: plainTextGrammar,
277
- txt: plainTextGrammar,
278
-
279
- /**
247
+ plain: r,
248
+ plaintext: r,
249
+ text: r,
250
+ txt: r,
251
+ /**
280
252
  * Creates a deep copy of the language with the given id and appends the given tokens.
281
253
  *
282
254
  * If a token in `redef` also appears in the copied language, then the existing token in the copied language
@@ -304,17 +276,14 @@ var Prism = (function (_self) {
304
276
  * 'color': /\b(?:red|green|blue)\b/
305
277
  * });
306
278
  */
307
- extend: function (id, redef) {
308
- var lang = _.util.clone(_.languages[id]);
309
-
310
- for (var key in redef) {
311
- lang[key] = redef[key];
312
- }
313
-
314
- return lang;
315
- },
316
-
317
- /**
279
+ extend: function(e, t) {
280
+ var a = s.util.clone(s.languages[e]);
281
+ for (var n in t) {
282
+ a[n] = t[n];
283
+ }
284
+ return a;
285
+ },
286
+ /**
318
287
  * Inserts tokens _before_ another token in a language definition or any other grammar.
319
288
  *
320
289
  * ## Usage
@@ -389,71 +358,57 @@ var Prism = (function (_self) {
389
358
  * @returns {Grammar} The new grammar object.
390
359
  * @public
391
360
  */
392
- insertBefore: function (inside, before, insert, root) {
393
- root = root || /** @type {any} */ (_.languages);
394
- var grammar = root[inside];
395
- /** @type {Grammar} */
396
- var ret = {};
397
-
398
- for (var token in grammar) {
399
- if (grammar.hasOwnProperty(token)) {
400
-
401
- if (token == before) {
402
- for (var newToken in insert) {
403
- if (insert.hasOwnProperty(newToken)) {
404
- ret[newToken] = insert[newToken];
405
- }
406
- }
407
- }
408
-
409
- // Do not insert token which also occur in insert. See #1525
410
- if (!insert.hasOwnProperty(token)) {
411
- ret[token] = grammar[token];
412
- }
413
- }
414
- }
415
-
416
- var old = root[inside];
417
- root[inside] = ret;
418
-
419
- // Update references in other language definitions
420
- _.languages.DFS(_.languages, function (key, value) {
421
- if (value === old && key != inside) {
422
- this[key] = ret;
423
- }
424
- });
425
-
426
- return ret;
427
- },
428
-
429
- // Traverse a language definition with Depth First Search
430
- DFS: function DFS(o, callback, type, visited) {
431
- visited = visited || {};
432
-
433
- var objId = _.util.objId;
434
-
435
- for (var i in o) {
436
- if (o.hasOwnProperty(i)) {
437
- callback.call(o, i, o[i], type || i);
438
-
439
- var property = o[i];
440
- var propertyType = _.util.type(property);
441
-
442
- if (propertyType === 'Object' && !visited[objId(property)]) {
443
- visited[objId(property)] = true;
444
- DFS(property, callback, null, visited);
445
- } else if (propertyType === 'Array' && !visited[objId(property)]) {
446
- visited[objId(property)] = true;
447
- DFS(property, callback, i, visited);
448
- }
449
- }
450
- }
451
- }
452
- },
453
-
454
- plugins: {},
455
-
456
- /**
361
+ insertBefore: function(e, t, a, n) {
362
+ n = n || /** @type {any} */ s.languages;
363
+ var r = n[e];
364
+ /** @type {Grammar} */ var i = {};
365
+ for (var o in r) {
366
+ if (r.hasOwnProperty(o)) {
367
+ if (o == t) {
368
+ for (var l in a) {
369
+ if (a.hasOwnProperty(l)) {
370
+ i[l] = a[l];
371
+ }
372
+ }
373
+ }
374
+ // Do not insert token which also occur in insert. See #1525
375
+ if (!a.hasOwnProperty(o)) {
376
+ i[o] = r[o];
377
+ }
378
+ }
379
+ }
380
+ var u = n[e];
381
+ n[e] = i;
382
+ // Update references in other language definitions
383
+ s.languages.DFS(s.languages, (function(t, a) {
384
+ if (a === u && t != e) {
385
+ this[t] = i;
386
+ }
387
+ }));
388
+ return i;
389
+ },
390
+ // Traverse a language definition with Depth First Search
391
+ DFS: function e(t, a, n, r) {
392
+ r = r || {};
393
+ var i = s.util.objId;
394
+ for (var o in t) {
395
+ if (t.hasOwnProperty(o)) {
396
+ a.call(t, o, t[o], n || o);
397
+ var l = t[o];
398
+ var u = s.util.type(l);
399
+ if (u === "Object" && !r[i(l)]) {
400
+ r[i(l)] = true;
401
+ e(l, a, null, r);
402
+ } else if (u === "Array" && !r[i(l)]) {
403
+ r[i(l)] = true;
404
+ e(l, a, o, r);
405
+ }
406
+ }
407
+ }
408
+ }
409
+ },
410
+ plugins: {},
411
+ /**
457
412
  * This is the most high-level function in Prism’s API.
458
413
  * It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
459
414
  * each one of them.
@@ -465,11 +420,10 @@ var Prism = (function (_self) {
465
420
  * @memberof Prism
466
421
  * @public
467
422
  */
468
- highlightAll: function (async, callback) {
469
- _.highlightAllUnder(document, async, callback);
470
- },
471
-
472
- /**
423
+ highlightAll: function(e, t) {
424
+ s.highlightAllUnder(document, e, t);
425
+ },
426
+ /**
473
427
  * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
474
428
  * {@link Prism.highlightElement} on each one of them.
475
429
  *
@@ -484,25 +438,20 @@ var Prism = (function (_self) {
484
438
  * @memberof Prism
485
439
  * @public
486
440
  */
487
- highlightAllUnder: function (container, async, callback) {
488
- var env = {
489
- callback: callback,
490
- container: container,
491
- selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
492
- };
493
-
494
- _.hooks.run('before-highlightall', env);
495
-
496
- env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
497
-
498
- _.hooks.run('before-all-elements-highlight', env);
499
-
500
- for (var i = 0, element; (element = env.elements[i++]);) {
501
- _.highlightElement(element, async === true, env.callback);
502
- }
503
- },
504
-
505
- /**
441
+ highlightAllUnder: function(e, t, a) {
442
+ var n = {
443
+ callback: a,
444
+ container: e,
445
+ selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
446
+ };
447
+ s.hooks.run("before-highlightall", n);
448
+ n.elements = Array.prototype.slice.apply(n.container.querySelectorAll(n.selector));
449
+ s.hooks.run("before-all-elements-highlight", n);
450
+ for (var r = 0, i; i = n.elements[r++]; ) {
451
+ s.highlightElement(i, t === true, n.callback);
452
+ }
453
+ },
454
+ /**
506
455
  * Highlights the code inside a single element.
507
456
  *
508
457
  * The following hooks will be run:
@@ -530,80 +479,63 @@ var Prism = (function (_self) {
530
479
  * @memberof Prism
531
480
  * @public
532
481
  */
533
- highlightElement: function (element, async, callback) {
534
- // Find language
535
- var language = _.util.getLanguage(element);
536
- var grammar = _.languages[language];
537
-
538
- // Set language on the element, if not present
539
- element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
540
-
541
- // Set language on the parent, for styling
542
- var parent = element.parentElement;
543
- if (parent && parent.nodeName.toLowerCase() === 'pre') {
544
- parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
545
- }
546
-
547
- var code = element.textContent;
548
-
549
- var env = {
550
- element: element,
551
- language: language,
552
- grammar: grammar,
553
- code: code
554
- };
555
-
556
- function insertHighlightedCode(highlightedCode) {
557
- env.highlightedCode = highlightedCode;
558
-
559
- _.hooks.run('before-insert', env);
560
-
561
- env.element.innerHTML = env.highlightedCode;
562
-
563
- _.hooks.run('after-highlight', env);
564
- _.hooks.run('complete', env);
565
- callback && callback.call(env.element);
566
- }
567
-
568
- _.hooks.run('before-sanity-check', env);
569
-
570
- // plugins may change/add the parent/element
571
- parent = env.element.parentElement;
572
- if (parent && parent.nodeName.toLowerCase() === 'pre' && !parent.hasAttribute('tabindex')) {
573
- parent.setAttribute('tabindex', '0');
574
- }
575
-
576
- if (!env.code) {
577
- _.hooks.run('complete', env);
578
- callback && callback.call(env.element);
579
- return;
580
- }
581
-
582
- _.hooks.run('before-highlight', env);
583
-
584
- if (!env.grammar) {
585
- insertHighlightedCode(_.util.encode(env.code));
586
- return;
587
- }
588
-
589
- if (async && _self.Worker) {
590
- var worker = new Worker(_.filename);
591
-
592
- worker.onmessage = function (evt) {
593
- insertHighlightedCode(evt.data);
594
- };
595
-
596
- worker.postMessage(JSON.stringify({
597
- language: env.language,
598
- code: env.code,
599
- immediateClose: true
600
- }));
601
- } else {
602
- insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
603
- }
604
- },
605
-
606
- /**
482
+ highlightElement: function(t, n, r) {
483
+ // Find language
484
+ var i = s.util.getLanguage(t);
485
+ var o = s.languages[i];
486
+ // Set language on the element, if not present
487
+ t.className = t.className.replace(a, "").replace(/\s+/g, " ") + " language-" + i;
488
+ // Set language on the parent, for styling
489
+ var l = t.parentElement;
490
+ if (l && l.nodeName.toLowerCase() === "pre") {
491
+ l.className = l.className.replace(a, "").replace(/\s+/g, " ") + " language-" + i;
492
+ }
493
+ var u = t.textContent;
494
+ var c = {
495
+ element: t,
496
+ language: i,
497
+ grammar: o,
498
+ code: u
499
+ };
500
+ function p(e) {
501
+ c.highlightedCode = e;
502
+ s.hooks.run("before-insert", c);
503
+ c.element.innerHTML = c.highlightedCode;
504
+ s.hooks.run("after-highlight", c);
505
+ s.hooks.run("complete", c);
506
+ r && r.call(c.element);
507
+ }
508
+ s.hooks.run("before-sanity-check", c);
509
+ // plugins may change/add the parent/element
510
+ l = c.element.parentElement;
511
+ if (l && l.nodeName.toLowerCase() === "pre" && !l.hasAttribute("tabindex")) {
512
+ l.setAttribute("tabindex", "0");
513
+ }
514
+ if (!c.code) {
515
+ s.hooks.run("complete", c);
516
+ r && r.call(c.element);
517
+ return;
518
+ }
519
+ s.hooks.run("before-highlight", c);
520
+ if (!c.grammar) {
521
+ p(s.util.encode(c.code));
522
+ return;
523
+ }
524
+ if (n && e.Worker) {
525
+ var d = new Worker(s.filename);
526
+ d.onmessage = function(e) {
527
+ p(e.data);
528
+ };
529
+ d.postMessage(JSON.stringify({
530
+ language: c.language,
531
+ code: c.code,
532
+ immediateClose: true
533
+ }));
534
+ } else {
535
+ p(s.highlight(c.code, c.grammar, c.language));
536
+ }
537
+ },
538
+ /**
607
539
  * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
608
540
  * and the language definitions to use, and returns a string with the HTML produced.
609
541
  *
@@ -623,19 +555,18 @@ var Prism = (function (_self) {
623
555
  * @example
624
556
  * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
625
557
  */
626
- highlight: function (text, grammar, language) {
627
- var env = {
628
- code: text,
629
- grammar: grammar,
630
- language: language
631
- };
632
- _.hooks.run('before-tokenize', env);
633
- env.tokens = _.tokenize(env.code, env.grammar);
634
- _.hooks.run('after-tokenize', env);
635
- return Token.stringify(_.util.encode(env.tokens), env.language);
636
- },
637
-
638
- /**
558
+ highlight: function(e, t, a) {
559
+ var n = {
560
+ code: e,
561
+ grammar: t,
562
+ language: a
563
+ };
564
+ s.hooks.run("before-tokenize", n);
565
+ n.tokens = s.tokenize(n.code, n.grammar);
566
+ s.hooks.run("after-tokenize", n);
567
+ return i.stringify(s.util.encode(n.tokens), n.language);
568
+ },
569
+ /**
639
570
  * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
640
571
  * and the language definitions to use, and returns an array with the tokenized code.
641
572
  *
@@ -659,33 +590,27 @@ var Prism = (function (_self) {
659
590
  * }
660
591
  * });
661
592
  */
662
- tokenize: function (text, grammar) {
663
- var rest = grammar.rest;
664
- if (rest) {
665
- for (var token in rest) {
666
- grammar[token] = rest[token];
667
- }
668
-
669
- delete grammar.rest;
670
- }
671
-
672
- var tokenList = new LinkedList();
673
- addAfter(tokenList, tokenList.head, text);
674
-
675
- matchGrammar(text, tokenList, grammar, tokenList.head, 0);
676
-
677
- return toArray(tokenList);
678
- },
679
-
680
- /**
593
+ tokenize: function(e, t) {
594
+ var a = t.rest;
595
+ if (a) {
596
+ for (var n in a) {
597
+ t[n] = a[n];
598
+ }
599
+ delete t.rest;
600
+ }
601
+ var r = new u;
602
+ c(r, r.head, e);
603
+ l(e, r, t, r.head, 0);
604
+ return d(r);
605
+ },
606
+ /**
681
607
  * @namespace
682
608
  * @memberof Prism
683
609
  * @public
684
610
  */
685
- hooks: {
686
- all: {},
687
-
688
- /**
611
+ hooks: {
612
+ all: {},
613
+ /**
689
614
  * Adds the given callback to the list of callbacks for the given hook.
690
615
  *
691
616
  * The callback will be invoked when the hook it is registered for is run.
@@ -697,15 +622,12 @@ var Prism = (function (_self) {
697
622
  * @param {HookCallback} callback The callback function which is given environment variables.
698
623
  * @public
699
624
  */
700
- add: function (name, callback) {
701
- var hooks = _.hooks.all;
702
-
703
- hooks[name] = hooks[name] || [];
704
-
705
- hooks[name].push(callback);
706
- },
707
-
708
- /**
625
+ add: function(e, t) {
626
+ var a = s.hooks.all;
627
+ a[e] = a[e] || [];
628
+ a[e].push(t);
629
+ },
630
+ /**
709
631
  * Runs a hook invoking all registered callbacks with the given environment variables.
710
632
  *
711
633
  * Callbacks will be invoked synchronously and in the order in which they were registered.
@@ -714,30 +636,24 @@ var Prism = (function (_self) {
714
636
  * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
715
637
  * @public
716
638
  */
717
- run: function (name, env) {
718
- var callbacks = _.hooks.all[name];
719
-
720
- if (!callbacks || !callbacks.length) {
721
- return;
722
- }
723
-
724
- for (var i = 0, callback; (callback = callbacks[i++]);) {
725
- callback(env);
726
- }
727
- }
728
- },
729
-
730
- Token: Token
731
- };
732
- _self.Prism = _;
733
-
734
-
735
- // Typescript note:
736
- // The following can be used to import the Token type in JSDoc:
737
- //
738
- // @typedef {InstanceType<import("./prism-core")["Token"]>} Token
739
-
740
- /**
639
+ run: function(e, t) {
640
+ var a = s.hooks.all[e];
641
+ if (!a || !a.length) {
642
+ return;
643
+ }
644
+ for (var n = 0, r; r = a[n++]; ) {
645
+ r(t);
646
+ }
647
+ }
648
+ },
649
+ Token: i
650
+ };
651
+ e.Prism = s;
652
+ // Typescript note:
653
+ // The following can be used to import the Token type in JSDoc:
654
+
655
+ // @typedef {InstanceType<import("./prism-core")["Token"]>} Token
656
+ /**
741
657
  * Creates a new token.
742
658
  *
743
659
  * @param {string} type See {@link Token#type type}
@@ -747,9 +663,8 @@ var Prism = (function (_self) {
747
663
  * @class
748
664
  * @global
749
665
  * @public
750
- */
751
- function Token(type, content, alias, matchedStr) {
752
- /**
666
+ */ function i(e, t, a, n) {
667
+ /**
753
668
  * The type of the token.
754
669
  *
755
670
  * This is usually the key of a pattern in a {@link Grammar}.
@@ -758,29 +673,26 @@ var Prism = (function (_self) {
758
673
  * @see GrammarToken
759
674
  * @public
760
675
  */
761
- this.type = type;
762
- /**
676
+ this.type = e;
677
+ /**
763
678
  * The strings or tokens contained by this token.
764
679
  *
765
680
  * This will be a token stream if the pattern matched also defined an `inside` grammar.
766
681
  *
767
682
  * @type {string | TokenStream}
768
683
  * @public
769
- */
770
- this.content = content;
771
- /**
684
+ */ this.content = t;
685
+ /**
772
686
  * The alias(es) of the token.
773
687
  *
774
688
  * @type {string|string[]}
775
689
  * @see GrammarToken
776
690
  * @public
777
- */
778
- this.alias = alias;
779
- // Copy of the full string this token was created from
780
- this.length = (matchedStr || '').length | 0;
781
- }
782
-
783
- /**
691
+ */ this.alias = a;
692
+ // Copy of the full string this token was created from
693
+ this.length = (n || "").length | 0;
694
+ }
695
+ /**
784
696
  * A token stream is an array of strings and {@link Token Token} objects.
785
697
  *
786
698
  * Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process
@@ -795,8 +707,7 @@ var Prism = (function (_self) {
795
707
  * @global
796
708
  * @public
797
709
  */
798
-
799
- /**
710
+ /**
800
711
  * Converts the given token or token stream to an HTML representation.
801
712
  *
802
713
  * The following hooks will be run:
@@ -807,67 +718,58 @@ var Prism = (function (_self) {
807
718
  * @returns {string} The HTML representation of the token or token stream.
808
719
  * @memberof Token
809
720
  * @static
810
- */
811
- Token.stringify = function stringify(o, language) {
812
- if (typeof o == 'string') {
813
- return o;
814
- }
815
- if (Array.isArray(o)) {
816
- var s = '';
817
- o.forEach(function (e) {
818
- s += stringify(e, language);
819
- });
820
- return s;
821
- }
822
-
823
- var env = {
824
- type: o.type,
825
- content: stringify(o.content, language),
826
- tag: 'span',
827
- classes: ['token', o.type],
828
- attributes: {},
829
- language: language
830
- };
831
-
832
- var aliases = o.alias;
833
- if (aliases) {
834
- if (Array.isArray(aliases)) {
835
- Array.prototype.push.apply(env.classes, aliases);
836
- } else {
837
- env.classes.push(aliases);
838
- }
839
- }
840
-
841
- _.hooks.run('wrap', env);
842
-
843
- var attributes = '';
844
- for (var name in env.attributes) {
845
- attributes += ' ' + name + '="' + (env.attributes[name] || '').replace(/"/g, '&quot;') + '"';
846
- }
847
-
848
- return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>';
849
- };
850
-
851
- /**
721
+ */ i.stringify = function e(t, a) {
722
+ if (typeof t == "string") {
723
+ return t;
724
+ }
725
+ if (Array.isArray(t)) {
726
+ var n = "";
727
+ t.forEach((function(t) {
728
+ n += e(t, a);
729
+ }));
730
+ return n;
731
+ }
732
+ var r = {
733
+ type: t.type,
734
+ content: e(t.content, a),
735
+ tag: "span",
736
+ classes: [ "token", t.type ],
737
+ attributes: {},
738
+ language: a
739
+ };
740
+ var i = t.alias;
741
+ if (i) {
742
+ if (Array.isArray(i)) {
743
+ Array.prototype.push.apply(r.classes, i);
744
+ } else {
745
+ r.classes.push(i);
746
+ }
747
+ }
748
+ s.hooks.run("wrap", r);
749
+ var o = "";
750
+ for (var l in r.attributes) {
751
+ o += " " + l + '="' + (r.attributes[l] || "").replace(/"/g, "&quot;") + '"';
752
+ }
753
+ return "<" + r.tag + ' class="' + r.classes.join(" ") + '"' + o + ">" + r.content + "</" + r.tag + ">";
754
+ };
755
+ /**
852
756
  * @param {RegExp} pattern
853
757
  * @param {number} pos
854
758
  * @param {string} text
855
759
  * @param {boolean} lookbehind
856
760
  * @returns {RegExpExecArray | null}
857
- */
858
- function matchPattern(pattern, pos, text, lookbehind) {
859
- pattern.lastIndex = pos;
860
- var match = pattern.exec(text);
861
- if (match && lookbehind && match[1]) {
862
- // change the match to remove the text matched by the Prism lookbehind group
863
- var lookbehindLength = match[1].length;
864
- match.index += lookbehindLength;
865
- match[0] = match[0].slice(lookbehindLength);
866
- }
867
- return match;
868
- }
869
-
870
- /**
761
+ */ function o(e, t, a, n) {
762
+ e.lastIndex = t;
763
+ var r = e.exec(a);
764
+ if (r && n && r[1]) {
765
+ // change the match to remove the text matched by the Prism lookbehind group
766
+ var s = r[1].length;
767
+ r.index += s;
768
+ r[0] = r[0].slice(s);
769
+ }
770
+ return r;
771
+ }
772
+ /**
871
773
  * @param {string} text
872
774
  * @param {LinkedList<string | Token>} tokenList
873
775
  * @param {any} grammar
@@ -880,155 +782,119 @@ var Prism = (function (_self) {
880
782
  * @typedef RematchOptions
881
783
  * @property {string} cause
882
784
  * @property {number} reach
883
- */
884
- function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
885
- for (var token in grammar) {
886
- if (!grammar.hasOwnProperty(token) || !grammar[token]) {
887
- continue;
888
- }
889
-
890
- var patterns = grammar[token];
891
- patterns = Array.isArray(patterns) ? patterns : [patterns];
892
-
893
- for (var j = 0; j < patterns.length; ++j) {
894
- if (rematch && rematch.cause == token + ',' + j) {
895
- return;
896
- }
897
-
898
- var patternObj = patterns[j];
899
- var inside = patternObj.inside;
900
- var lookbehind = !!patternObj.lookbehind;
901
- var greedy = !!patternObj.greedy;
902
- var alias = patternObj.alias;
903
-
904
- if (greedy && !patternObj.pattern.global) {
905
- // Without the global flag, lastIndex won't work
906
- var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
907
- patternObj.pattern = RegExp(patternObj.pattern.source, flags + 'g');
908
- }
909
-
910
- /** @type {RegExp} */
911
- var pattern = patternObj.pattern || patternObj;
912
-
913
- for ( // iterate the token list and keep track of the current token/string position
914
- var currentNode = startNode.next, pos = startPos;
915
- currentNode !== tokenList.tail;
916
- pos += currentNode.value.length, currentNode = currentNode.next
917
- ) {
918
-
919
- if (rematch && pos >= rematch.reach) {
920
- break;
921
- }
922
-
923
- var str = currentNode.value;
924
-
925
- if (tokenList.length > text.length) {
926
- // Something went terribly wrong, ABORT, ABORT!
927
- return;
928
- }
929
-
930
- if (str instanceof Token) {
931
- continue;
932
- }
933
-
934
- var removeCount = 1; // this is the to parameter of removeBetween
935
- var match;
936
-
937
- if (greedy) {
938
- match = matchPattern(pattern, pos, text, lookbehind);
939
- if (!match) {
940
- break;
941
- }
942
-
943
- var from = match.index;
944
- var to = match.index + match[0].length;
945
- var p = pos;
946
-
947
- // find the node that contains the match
948
- p += currentNode.value.length;
949
- while (from >= p) {
950
- currentNode = currentNode.next;
951
- p += currentNode.value.length;
952
- }
953
- // adjust pos (and p)
954
- p -= currentNode.value.length;
955
- pos = p;
956
-
957
- // the current node is a Token, then the match starts inside another Token, which is invalid
958
- if (currentNode.value instanceof Token) {
959
- continue;
960
- }
961
-
962
- // find the last node which is affected by this match
963
- for (
964
- var k = currentNode;
965
- k !== tokenList.tail && (p < to || typeof k.value === 'string');
966
- k = k.next
967
- ) {
968
- removeCount++;
969
- p += k.value.length;
970
- }
971
- removeCount--;
972
-
973
- // replace with the new match
974
- str = text.slice(pos, p);
975
- match.index -= pos;
976
- } else {
977
- match = matchPattern(pattern, 0, str, lookbehind);
978
- if (!match) {
979
- continue;
980
- }
981
- }
982
-
983
- // eslint-disable-next-line no-redeclare
984
- var from = match.index;
985
- var matchStr = match[0];
986
- var before = str.slice(0, from);
987
- var after = str.slice(from + matchStr.length);
988
-
989
- var reach = pos + str.length;
990
- if (rematch && reach > rematch.reach) {
991
- rematch.reach = reach;
992
- }
993
-
994
- var removeFrom = currentNode.prev;
995
-
996
- if (before) {
997
- removeFrom = addAfter(tokenList, removeFrom, before);
998
- pos += before.length;
999
- }
1000
-
1001
- removeRange(tokenList, removeFrom, removeCount);
1002
-
1003
- var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
1004
- currentNode = addAfter(tokenList, removeFrom, wrapped);
1005
-
1006
- if (after) {
1007
- addAfter(tokenList, currentNode, after);
1008
- }
1009
-
1010
- if (removeCount > 1) {
1011
- // at least one Token object was removed, so we have to do some rematching
1012
- // this can only happen if the current pattern is greedy
1013
-
1014
- /** @type {RematchOptions} */
1015
- var nestedRematch = {
1016
- cause: token + ',' + j,
1017
- reach: reach
1018
- };
1019
- matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
1020
-
1021
- // the reach might have been extended because of the rematching
1022
- if (rematch && nestedRematch.reach > rematch.reach) {
1023
- rematch.reach = nestedRematch.reach;
1024
- }
1025
- }
1026
- }
1027
- }
1028
- }
1029
- }
1030
-
1031
- /**
785
+ */ function l(e, t, a, n, r, u) {
786
+ for (var d in a) {
787
+ if (!a.hasOwnProperty(d) || !a[d]) {
788
+ continue;
789
+ }
790
+ var g = a[d];
791
+ g = Array.isArray(g) ? g : [ g ];
792
+ for (var f = 0; f < g.length; ++f) {
793
+ if (u && u.cause == d + "," + f) {
794
+ return;
795
+ }
796
+ var m = g[f];
797
+ var h = m.inside;
798
+ var v = !!m.lookbehind;
799
+ var b = !!m.greedy;
800
+ var y = m.alias;
801
+ if (b && !m.pattern.global) {
802
+ // Without the global flag, lastIndex won't work
803
+ var k = m.pattern.toString().match(/[imsuy]*$/)[0];
804
+ m.pattern = RegExp(m.pattern.source, k + "g");
805
+ }
806
+ /** @type {RegExp} */ var x = m.pattern || m;
807
+ for (// iterate the token list and keep track of the current token/string position
808
+ var S = n.next, A = r; S !== t.tail; A += S.value.length, S = S.next) {
809
+ if (u && A >= u.reach) {
810
+ break;
811
+ }
812
+ var F = S.value;
813
+ if (t.length > e.length) {
814
+ // Something went terribly wrong, ABORT, ABORT!
815
+ return;
816
+ }
817
+ if (F instanceof i) {
818
+ continue;
819
+ }
820
+ var w = 1;
821
+ // this is the to parameter of removeBetween
822
+ var E;
823
+ if (b) {
824
+ E = o(x, A, e, v);
825
+ if (!E) {
826
+ break;
827
+ }
828
+ var _ = E.index;
829
+ var O = E.index + E[0].length;
830
+ var T = A;
831
+ // find the node that contains the match
832
+ T += S.value.length;
833
+ while (_ >= T) {
834
+ S = S.next;
835
+ T += S.value.length;
836
+ }
837
+ // adjust pos (and p)
838
+ T -= S.value.length;
839
+ A = T;
840
+ // the current node is a Token, then the match starts inside another Token, which is invalid
841
+ if (S.value instanceof i) {
842
+ continue;
843
+ }
844
+ // find the last node which is affected by this match
845
+ for (var I = S; I !== t.tail && (T < O || typeof I.value === "string"); I = I.next) {
846
+ w++;
847
+ T += I.value.length;
848
+ }
849
+ w--;
850
+ // replace with the new match
851
+ F = e.slice(A, T);
852
+ E.index -= A;
853
+ } else {
854
+ E = o(x, 0, F, v);
855
+ if (!E) {
856
+ continue;
857
+ }
858
+ }
859
+ // eslint-disable-next-line no-redeclare
860
+ var _ = E.index;
861
+ var $ = E[0];
862
+ var N = F.slice(0, _);
863
+ var P = F.slice(_ + $.length);
864
+ var R = A + F.length;
865
+ if (u && R > u.reach) {
866
+ u.reach = R;
867
+ }
868
+ var C = S.prev;
869
+ if (N) {
870
+ C = c(t, C, N);
871
+ A += N.length;
872
+ }
873
+ p(t, C, w);
874
+ var D = new i(d, h ? s.tokenize($, h) : $, y, $);
875
+ S = c(t, C, D);
876
+ if (P) {
877
+ c(t, S, P);
878
+ }
879
+ if (w > 1) {
880
+ // at least one Token object was removed, so we have to do some rematching
881
+ // this can only happen if the current pattern is greedy
882
+ /** @type {RematchOptions} */
883
+ var j = {
884
+ cause: d + "," + f,
885
+ reach: R
886
+ };
887
+ l(e, t, a, S.prev, A, j);
888
+ // the reach might have been extended because of the rematching
889
+ if (u && j.reach > u.reach) {
890
+ u.reach = j.reach;
891
+ }
892
+ }
893
+ }
894
+ }
895
+ }
896
+ }
897
+ /**
1032
898
  * @typedef LinkedListNode
1033
899
  * @property {T} value
1034
900
  * @property {LinkedListNode<T> | null} prev The previous node.
@@ -1036,26 +902,27 @@ var Prism = (function (_self) {
1036
902
  * @template T
1037
903
  * @private
1038
904
  */
1039
-
1040
- /**
905
+ /**
1041
906
  * @template T
1042
907
  * @private
1043
- */
1044
- function LinkedList() {
1045
- /** @type {LinkedListNode<T>} */
1046
- var head = { value: null, prev: null, next: null };
1047
- /** @type {LinkedListNode<T>} */
1048
- var tail = { value: null, prev: head, next: null };
1049
- head.next = tail;
1050
-
1051
- /** @type {LinkedListNode<T>} */
1052
- this.head = head;
1053
- /** @type {LinkedListNode<T>} */
1054
- this.tail = tail;
1055
- this.length = 0;
1056
- }
1057
-
1058
- /**
908
+ */ function u() {
909
+ /** @type {LinkedListNode<T>} */
910
+ var e = {
911
+ value: null,
912
+ prev: null,
913
+ next: null
914
+ };
915
+ /** @type {LinkedListNode<T>} */ var t = {
916
+ value: null,
917
+ prev: e,
918
+ next: null
919
+ };
920
+ e.next = t;
921
+ /** @type {LinkedListNode<T>} */ this.head = e;
922
+ /** @type {LinkedListNode<T>} */ this.tail = t;
923
+ this.length = 0;
924
+ }
925
+ /**
1059
926
  * Adds a new node with the given value to the list.
1060
927
  *
1061
928
  * @param {LinkedList<T>} list
@@ -1063,127 +930,110 @@ var Prism = (function (_self) {
1063
930
  * @param {T} value
1064
931
  * @returns {LinkedListNode<T>} The added node.
1065
932
  * @template T
1066
- */
1067
- function addAfter(list, node, value) {
1068
- // assumes that node != list.tail && values.length >= 0
1069
- var next = node.next;
1070
-
1071
- var newNode = { value: value, prev: node, next: next };
1072
- node.next = newNode;
1073
- next.prev = newNode;
1074
- list.length++;
1075
-
1076
- return newNode;
1077
- }
1078
- /**
933
+ */ function c(e, t, a) {
934
+ // assumes that node != list.tail && values.length >= 0
935
+ var n = t.next;
936
+ var r = {
937
+ value: a,
938
+ prev: t,
939
+ next: n
940
+ };
941
+ t.next = r;
942
+ n.prev = r;
943
+ e.length++;
944
+ return r;
945
+ }
946
+ /**
1079
947
  * Removes `count` nodes after the given node. The given node will not be removed.
1080
948
  *
1081
949
  * @param {LinkedList<T>} list
1082
950
  * @param {LinkedListNode<T>} node
1083
951
  * @param {number} count
1084
952
  * @template T
1085
- */
1086
- function removeRange(list, node, count) {
1087
- var next = node.next;
1088
- for (var i = 0; i < count && next !== list.tail; i++) {
1089
- next = next.next;
1090
- }
1091
- node.next = next;
1092
- next.prev = node;
1093
- list.length -= i;
1094
- }
1095
- /**
953
+ */ function p(e, t, a) {
954
+ var n = t.next;
955
+ for (var r = 0; r < a && n !== e.tail; r++) {
956
+ n = n.next;
957
+ }
958
+ t.next = n;
959
+ n.prev = t;
960
+ e.length -= r;
961
+ }
962
+ /**
1096
963
  * @param {LinkedList<T>} list
1097
964
  * @returns {T[]}
1098
965
  * @template T
1099
- */
1100
- function toArray(list) {
1101
- var array = [];
1102
- var node = list.head.next;
1103
- while (node !== list.tail) {
1104
- array.push(node.value);
1105
- node = node.next;
1106
- }
1107
- return array;
1108
- }
1109
-
1110
-
1111
- if (!_self.document) {
1112
- if (!_self.addEventListener) {
1113
- // in Node.js
1114
- return _;
1115
- }
1116
-
1117
- if (!_.disableWorkerMessageHandler) {
1118
- // In worker
1119
- _self.addEventListener('message', function (evt) {
1120
- var message = JSON.parse(evt.data);
1121
- var lang = message.language;
1122
- var code = message.code;
1123
- var immediateClose = message.immediateClose;
1124
-
1125
- _self.postMessage(_.highlight(code, _.languages[lang], lang));
1126
- if (immediateClose) {
1127
- _self.close();
1128
- }
1129
- }, false);
1130
- }
1131
-
1132
- return _;
1133
- }
1134
-
1135
- // Get current script and highlight
1136
- var script = _.util.currentScript();
1137
-
1138
- if (script) {
1139
- _.filename = script.src;
1140
-
1141
- if (script.hasAttribute('data-manual')) {
1142
- _.manual = true;
1143
- }
1144
- }
1145
-
1146
- function highlightAutomaticallyCallback() {
1147
- if (!_.manual) {
1148
- _.highlightAll();
1149
- }
1150
- }
1151
-
1152
- if (!_.manual) {
1153
- // If the document state is "loading", then we'll use DOMContentLoaded.
1154
- // If the document state is "interactive" and the prism.js script is deferred, then we'll also use the
1155
- // DOMContentLoaded event because there might be some plugins or languages which have also been deferred and they
1156
- // might take longer one animation frame to execute which can create a race condition where only some plugins have
1157
- // been loaded when Prism.highlightAll() is executed, depending on how fast resources are loaded.
1158
- // See https://github.com/PrismJS/prism/issues/2102
1159
- var readyState = document.readyState;
1160
- if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) {
1161
- document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback);
1162
- } else {
1163
- if (window.requestAnimationFrame) {
1164
- window.requestAnimationFrame(highlightAutomaticallyCallback);
1165
- } else {
1166
- window.setTimeout(highlightAutomaticallyCallback, 16);
1167
- }
1168
- }
1169
- }
1170
-
1171
- return _;
1172
-
1173
- }(_self));
1174
-
1175
- if ( true && module.exports) {
1176
- module.exports = Prism;
1177
- }
1178
-
1179
- // hack for components to work correctly in node.js
1180
- if (typeof global !== 'undefined') {
1181
- global.Prism = Prism;
1182
- }
1183
-
1184
- // some additional documentation/types
1185
-
1186
- /**
966
+ */ function d(e) {
967
+ var t = [];
968
+ var a = e.head.next;
969
+ while (a !== e.tail) {
970
+ t.push(a.value);
971
+ a = a.next;
972
+ }
973
+ return t;
974
+ }
975
+ if (!e.document) {
976
+ if (!e.addEventListener) {
977
+ // in Node.js
978
+ return s;
979
+ }
980
+ if (!s.disableWorkerMessageHandler) {
981
+ // In worker
982
+ e.addEventListener("message", (function(t) {
983
+ var a = JSON.parse(t.data);
984
+ var n = a.language;
985
+ var r = a.code;
986
+ var i = a.immediateClose;
987
+ e.postMessage(s.highlight(r, s.languages[n], n));
988
+ if (i) {
989
+ e.close();
990
+ }
991
+ }), false);
992
+ }
993
+ return s;
994
+ }
995
+ // Get current script and highlight
996
+ var g = s.util.currentScript();
997
+ if (g) {
998
+ s.filename = g.src;
999
+ if (g.hasAttribute("data-manual")) {
1000
+ s.manual = true;
1001
+ }
1002
+ }
1003
+ function f() {
1004
+ if (!s.manual) {
1005
+ s.highlightAll();
1006
+ }
1007
+ }
1008
+ if (!s.manual) {
1009
+ // If the document state is "loading", then we'll use DOMContentLoaded.
1010
+ // If the document state is "interactive" and the prism.js script is deferred, then we'll also use the
1011
+ // DOMContentLoaded event because there might be some plugins or languages which have also been deferred and they
1012
+ // might take longer one animation frame to execute which can create a race condition where only some plugins have
1013
+ // been loaded when Prism.highlightAll() is executed, depending on how fast resources are loaded.
1014
+ // See https://github.com/PrismJS/prism/issues/2102
1015
+ var m = document.readyState;
1016
+ if (m === "loading" || m === "interactive" && g && g.defer) {
1017
+ document.addEventListener("DOMContentLoaded", f);
1018
+ } else {
1019
+ if (t.requestAnimationFrame) {
1020
+ t.requestAnimationFrame(f);
1021
+ } else {
1022
+ t.setTimeout(f, 16);
1023
+ }
1024
+ }
1025
+ }
1026
+ return s;
1027
+ }(n);
1028
+ if (true && e.exports) {
1029
+ e.exports = r;
1030
+ }
1031
+ // hack for components to work correctly in node.js
1032
+ if (typeof a !== "undefined") {
1033
+ a.Prism = r;
1034
+ }
1035
+ // some additional documentation/types
1036
+ /**
1187
1037
  * The expansion of a simple `RegExp` literal to support additional properties.
1188
1038
  *
1189
1039
  * @typedef GrammarToken
@@ -1203,16 +1053,14 @@ if (typeof global !== 'undefined') {
1203
1053
  * @global
1204
1054
  * @public
1205
1055
  */
1206
-
1207
- /**
1056
+ /**
1208
1057
  * @typedef Grammar
1209
1058
  * @type {Object<string, RegExp | GrammarToken | Array<RegExp | GrammarToken>>}
1210
1059
  * @property {Grammar} [rest] An optional grammar object that will be appended to this grammar.
1211
1060
  * @global
1212
1061
  * @public
1213
1062
  */
1214
-
1215
- /**
1063
+ /**
1216
1064
  * A function which will invoked after an element was successfully highlighted.
1217
1065
  *
1218
1066
  * @callback HighlightCallback
@@ -1221,133 +1069,117 @@ if (typeof global !== 'undefined') {
1221
1069
  * @global
1222
1070
  * @public
1223
1071
  */
1224
-
1225
- /**
1072
+ /**
1226
1073
  * @callback HookCallback
1227
1074
  * @param {Object<string, any>} env The environment variables of the hook.
1228
1075
  * @returns {void}
1229
1076
  * @global
1230
1077
  * @public
1231
1078
  */
1232
-
1233
- // https://www.json.org/json-en.html
1234
- Prism.languages.json = {
1235
- 'property': {
1236
- pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
1237
- lookbehind: true,
1238
- greedy: true
1239
- },
1240
- 'string': {
1241
- pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
1242
- lookbehind: true,
1243
- greedy: true
1244
- },
1245
- 'comment': {
1246
- pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
1247
- greedy: true
1248
- },
1249
- 'number': /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
1250
- 'punctuation': /[{}[\],]/,
1251
- 'operator': /:/,
1252
- 'boolean': /\b(?:true|false)\b/,
1253
- 'null': {
1254
- pattern: /\bnull\b/,
1255
- alias: 'keyword'
1256
- }
1257
- };
1258
-
1259
- Prism.languages.webmanifest = Prism.languages.json;
1260
-
1261
- Prism.languages.markup = {
1262
- 'comment': {
1263
- pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
1264
- greedy: true
1265
- },
1266
- 'prolog': {
1267
- pattern: /<\?[\s\S]+?\?>/,
1268
- greedy: true
1269
- },
1270
- 'doctype': {
1271
- // https://www.w3.org/TR/xml/#NT-doctypedecl
1272
- pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
1273
- greedy: true,
1274
- inside: {
1275
- 'internal-subset': {
1276
- pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
1277
- lookbehind: true,
1278
- greedy: true,
1279
- inside: null // see below
1280
- },
1281
- 'string': {
1282
- pattern: /"[^"]*"|'[^']*'/,
1283
- greedy: true
1284
- },
1285
- 'punctuation': /^<!|>$|[[\]]/,
1286
- 'doctype-tag': /^DOCTYPE/i,
1287
- 'name': /[^\s<>'"]+/
1288
- }
1289
- },
1290
- 'cdata': {
1291
- pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1292
- greedy: true
1293
- },
1294
- 'tag': {
1295
- pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
1296
- greedy: true,
1297
- inside: {
1298
- 'tag': {
1299
- pattern: /^<\/?[^\s>\/]+/,
1300
- inside: {
1301
- 'punctuation': /^<\/?/,
1302
- 'namespace': /^[^\s>\/:]+:/
1303
- }
1304
- },
1305
- 'special-attr': [],
1306
- 'attr-value': {
1307
- pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
1308
- inside: {
1309
- 'punctuation': [
1310
- {
1311
- pattern: /^=/,
1312
- alias: 'attr-equals'
1313
- },
1314
- /"|'/
1315
- ]
1316
- }
1317
- },
1318
- 'punctuation': /\/?>/,
1319
- 'attr-name': {
1320
- pattern: /[^\s>\/]+/,
1321
- inside: {
1322
- 'namespace': /^[^\s>\/:]+:/
1323
- }
1324
- }
1325
-
1326
- }
1327
- },
1328
- 'entity': [
1329
- {
1330
- pattern: /&[\da-z]{1,8};/i,
1331
- alias: 'named-entity'
1332
- },
1333
- /&#x?[\da-f]{1,8};/i
1334
- ]
1335
- };
1336
-
1337
- Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
1338
- Prism.languages.markup['entity'];
1339
- Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;
1340
-
1341
- // Plugin to make entity title show the real entity, idea by Roman Komarov
1342
- Prism.hooks.add('wrap', function (env) {
1343
-
1344
- if (env.type === 'entity') {
1345
- env.attributes['title'] = env.content.replace(/&amp;/, '&');
1346
- }
1347
- });
1348
-
1349
- Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
1350
- /**
1079
+ // https://www.json.org/json-en.html
1080
+ r.languages.json = {
1081
+ property: {
1082
+ pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
1083
+ lookbehind: true,
1084
+ greedy: true
1085
+ },
1086
+ string: {
1087
+ pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
1088
+ lookbehind: true,
1089
+ greedy: true
1090
+ },
1091
+ comment: {
1092
+ pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
1093
+ greedy: true
1094
+ },
1095
+ number: /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
1096
+ punctuation: /[{}[\],]/,
1097
+ operator: /:/,
1098
+ boolean: /\b(?:true|false)\b/,
1099
+ null: {
1100
+ pattern: /\bnull\b/,
1101
+ alias: "keyword"
1102
+ }
1103
+ };
1104
+ r.languages.webmanifest = r.languages.json;
1105
+ r.languages.markup = {
1106
+ comment: {
1107
+ pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
1108
+ greedy: true
1109
+ },
1110
+ prolog: {
1111
+ pattern: /<\?[\s\S]+?\?>/,
1112
+ greedy: true
1113
+ },
1114
+ doctype: {
1115
+ // https://www.w3.org/TR/xml/#NT-doctypedecl
1116
+ pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
1117
+ greedy: true,
1118
+ inside: {
1119
+ "internal-subset": {
1120
+ pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
1121
+ lookbehind: true,
1122
+ greedy: true,
1123
+ inside: null
1124
+ },
1125
+ string: {
1126
+ pattern: /"[^"]*"|'[^']*'/,
1127
+ greedy: true
1128
+ },
1129
+ punctuation: /^<!|>$|[[\]]/,
1130
+ "doctype-tag": /^DOCTYPE/i,
1131
+ name: /[^\s<>'"]+/
1132
+ }
1133
+ },
1134
+ cdata: {
1135
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1136
+ greedy: true
1137
+ },
1138
+ tag: {
1139
+ pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
1140
+ greedy: true,
1141
+ inside: {
1142
+ tag: {
1143
+ pattern: /^<\/?[^\s>\/]+/,
1144
+ inside: {
1145
+ punctuation: /^<\/?/,
1146
+ namespace: /^[^\s>\/:]+:/
1147
+ }
1148
+ },
1149
+ "special-attr": [],
1150
+ "attr-value": {
1151
+ pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
1152
+ inside: {
1153
+ punctuation: [ {
1154
+ pattern: /^=/,
1155
+ alias: "attr-equals"
1156
+ }, /"|'/ ]
1157
+ }
1158
+ },
1159
+ punctuation: /\/?>/,
1160
+ "attr-name": {
1161
+ pattern: /[^\s>\/]+/,
1162
+ inside: {
1163
+ namespace: /^[^\s>\/:]+:/
1164
+ }
1165
+ }
1166
+ }
1167
+ },
1168
+ entity: [ {
1169
+ pattern: /&[\da-z]{1,8};/i,
1170
+ alias: "named-entity"
1171
+ }, /&#x?[\da-f]{1,8};/i ]
1172
+ };
1173
+ r.languages.markup["tag"].inside["attr-value"].inside["entity"] = r.languages.markup["entity"];
1174
+ r.languages.markup["doctype"].inside["internal-subset"].inside = r.languages.markup;
1175
+ // Plugin to make entity title show the real entity, idea by Roman Komarov
1176
+ r.hooks.add("wrap", (function(e) {
1177
+ if (e.type === "entity") {
1178
+ e.attributes["title"] = e.content.replace(/&amp;/, "&");
1179
+ }
1180
+ }));
1181
+ Object.defineProperty(r.languages.markup.tag, "addInlined", {
1182
+ /**
1351
1183
  * Adds an inlined language to markup.
1352
1184
  *
1353
1185
  * An example of an inlined language is CSS with `<style>` tags.
@@ -1358,39 +1190,38 @@ Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
1358
1190
  * @example
1359
1191
  * addInlined('style', 'css');
1360
1192
  */
1361
- value: function addInlined(tagName, lang) {
1362
- var includedCdataInside = {};
1363
- includedCdataInside['language-' + lang] = {
1364
- pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
1365
- lookbehind: true,
1366
- inside: Prism.languages[lang]
1367
- };
1368
- includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
1369
-
1370
- var inside = {
1371
- 'included-cdata': {
1372
- pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1373
- inside: includedCdataInside
1374
- }
1375
- };
1376
- inside['language-' + lang] = {
1377
- pattern: /[\s\S]+/,
1378
- inside: Prism.languages[lang]
1379
- };
1380
-
1381
- var def = {};
1382
- def[tagName] = {
1383
- pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () { return tagName; }), 'i'),
1384
- lookbehind: true,
1385
- greedy: true,
1386
- inside: inside
1387
- };
1388
-
1389
- Prism.languages.insertBefore('markup', 'cdata', def);
1390
- }
1391
- });
1392
- Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
1393
- /**
1193
+ value: function e(t, a) {
1194
+ var n = {};
1195
+ n["language-" + a] = {
1196
+ pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
1197
+ lookbehind: true,
1198
+ inside: r.languages[a]
1199
+ };
1200
+ n["cdata"] = /^<!\[CDATA\[|\]\]>$/i;
1201
+ var s = {
1202
+ "included-cdata": {
1203
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1204
+ inside: n
1205
+ }
1206
+ };
1207
+ s["language-" + a] = {
1208
+ pattern: /[\s\S]+/,
1209
+ inside: r.languages[a]
1210
+ };
1211
+ var i = {};
1212
+ i[t] = {
1213
+ pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, (function() {
1214
+ return t;
1215
+ })), "i"),
1216
+ lookbehind: true,
1217
+ greedy: true,
1218
+ inside: s
1219
+ };
1220
+ r.languages.insertBefore("markup", "cdata", i);
1221
+ }
1222
+ });
1223
+ Object.defineProperty(r.languages.markup.tag, "addAttribute", {
1224
+ /**
1394
1225
  * Adds an pattern to highlight languages embedded in HTML attributes.
1395
1226
  *
1396
1227
  * An example of an inlined language is CSS with `style` attributes.
@@ -1401,1166 +1232,1058 @@ Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
1401
1232
  * @example
1402
1233
  * addAttribute('style', 'css');
1403
1234
  */
1404
- value: function (attrName, lang) {
1405
- Prism.languages.markup.tag.inside['special-attr'].push({
1406
- pattern: RegExp(
1407
- /(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
1408
- 'i'
1409
- ),
1410
- lookbehind: true,
1411
- inside: {
1412
- 'attr-name': /^[^\s=]+/,
1413
- 'attr-value': {
1414
- pattern: /=[\s\S]+/,
1415
- inside: {
1416
- 'value': {
1417
- pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
1418
- lookbehind: true,
1419
- alias: [lang, 'language-' + lang],
1420
- inside: Prism.languages[lang]
1421
- },
1422
- 'punctuation': [
1423
- {
1424
- pattern: /^=/,
1425
- alias: 'attr-equals'
1426
- },
1427
- /"|'/
1428
- ]
1429
- }
1430
- }
1431
- }
1432
- });
1433
- }
1434
- });
1435
-
1436
- Prism.languages.html = Prism.languages.markup;
1437
- Prism.languages.mathml = Prism.languages.markup;
1438
- Prism.languages.svg = Prism.languages.markup;
1439
-
1440
- Prism.languages.xml = Prism.languages.extend('markup', {});
1441
- Prism.languages.ssml = Prism.languages.xml;
1442
- Prism.languages.atom = Prism.languages.xml;
1443
- Prism.languages.rss = Prism.languages.xml;
1444
-
1445
- Prism.languages.clike = {
1446
- 'comment': [
1447
- {
1448
- pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
1449
- lookbehind: true,
1450
- greedy: true
1451
- },
1452
- {
1453
- pattern: /(^|[^\\:])\/\/.*/,
1454
- lookbehind: true,
1455
- greedy: true
1456
- }
1457
- ],
1458
- 'string': {
1459
- pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1460
- greedy: true
1461
- },
1462
- 'class-name': {
1463
- pattern: /(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,
1464
- lookbehind: true,
1465
- inside: {
1466
- 'punctuation': /[.\\]/
1467
- }
1468
- },
1469
- 'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
1470
- 'boolean': /\b(?:true|false)\b/,
1471
- 'function': /\b\w+(?=\()/,
1472
- 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
1473
- 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
1474
- 'punctuation': /[{}[\];(),.:]/
1475
- };
1476
-
1477
- Prism.languages.javascript = Prism.languages.extend('clike', {
1478
- 'class-name': [
1479
- Prism.languages.clike['class-name'],
1480
- {
1481
- pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:prototype|constructor))/,
1482
- lookbehind: true
1483
- }
1484
- ],
1485
- 'keyword': [
1486
- {
1487
- pattern: /((?:^|\})\s*)catch\b/,
1488
- lookbehind: true
1489
- },
1490
- {
1491
- 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/,
1492
- lookbehind: true
1493
- },
1494
- ],
1495
- // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
1496
- 'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1497
- 'number': /\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,
1498
- 'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1499
- });
1500
-
1501
- Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/;
1502
-
1503
- Prism.languages.insertBefore('javascript', 'keyword', {
1504
- 'regex': {
1505
- // eslint-disable-next-line regexp/no-dupe-characters-character-class
1506
- pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,
1507
- lookbehind: true,
1508
- greedy: true,
1509
- inside: {
1510
- 'regex-source': {
1511
- pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1512
- lookbehind: true,
1513
- alias: 'language-regex',
1514
- inside: Prism.languages.regex
1515
- },
1516
- 'regex-delimiter': /^\/|\/$/,
1517
- 'regex-flags': /^[a-z]+$/,
1518
- }
1519
- },
1520
- // This must be declared before keyword because we use "function" inside the look-forward
1521
- 'function-variable': {
1522
- 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*=>))/,
1523
- alias: 'function'
1524
- },
1525
- 'parameter': [
1526
- {
1527
- pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1528
- lookbehind: true,
1529
- inside: Prism.languages.javascript
1530
- },
1531
- {
1532
- pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1533
- lookbehind: true,
1534
- inside: Prism.languages.javascript
1535
- },
1536
- {
1537
- pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1538
- lookbehind: true,
1539
- inside: Prism.languages.javascript
1540
- },
1541
- {
1542
- 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*\{)/,
1543
- lookbehind: true,
1544
- inside: Prism.languages.javascript
1545
- }
1546
- ],
1547
- 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1548
- });
1549
-
1550
- Prism.languages.insertBefore('javascript', 'string', {
1551
- 'hashbang': {
1552
- pattern: /^#!.*/,
1553
- greedy: true,
1554
- alias: 'comment'
1555
- },
1556
- 'template-string': {
1557
- pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1558
- greedy: true,
1559
- inside: {
1560
- 'template-punctuation': {
1561
- pattern: /^`|`$/,
1562
- alias: 'string'
1563
- },
1564
- 'interpolation': {
1565
- pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1566
- lookbehind: true,
1567
- inside: {
1568
- 'interpolation-punctuation': {
1569
- pattern: /^\$\{|\}$/,
1570
- alias: 'punctuation'
1571
- },
1572
- rest: Prism.languages.javascript
1573
- }
1574
- },
1575
- 'string': /[\s\S]+/
1576
- }
1577
- }
1578
- });
1579
-
1580
- if (Prism.languages.markup) {
1581
- Prism.languages.markup.tag.addInlined('script', 'javascript');
1582
-
1583
- // add attribute support for all DOM events.
1584
- // https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events
1585
- Prism.languages.markup.tag.addAttribute(
1586
- /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,
1587
- 'javascript'
1588
- );
1589
- }
1590
-
1591
- Prism.languages.js = Prism.languages.javascript;
1592
-
1593
- (function (Prism) {
1594
-
1595
- var javascript = Prism.util.clone(Prism.languages.javascript);
1596
-
1597
- var space = /(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source;
1598
- var braces = /(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source;
1599
- var spread = /(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;
1600
-
1601
- /**
1235
+ value: function(e, t) {
1236
+ r.languages.markup.tag.inside["special-attr"].push({
1237
+ pattern: RegExp(/(^|["'\s])/.source + "(?:" + e + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source, "i"),
1238
+ lookbehind: true,
1239
+ inside: {
1240
+ "attr-name": /^[^\s=]+/,
1241
+ "attr-value": {
1242
+ pattern: /=[\s\S]+/,
1243
+ inside: {
1244
+ value: {
1245
+ pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
1246
+ lookbehind: true,
1247
+ alias: [ t, "language-" + t ],
1248
+ inside: r.languages[t]
1249
+ },
1250
+ punctuation: [ {
1251
+ pattern: /^=/,
1252
+ alias: "attr-equals"
1253
+ }, /"|'/ ]
1254
+ }
1255
+ }
1256
+ }
1257
+ });
1258
+ }
1259
+ });
1260
+ r.languages.html = r.languages.markup;
1261
+ r.languages.mathml = r.languages.markup;
1262
+ r.languages.svg = r.languages.markup;
1263
+ r.languages.xml = r.languages.extend("markup", {});
1264
+ r.languages.ssml = r.languages.xml;
1265
+ r.languages.atom = r.languages.xml;
1266
+ r.languages.rss = r.languages.xml;
1267
+ r.languages.clike = {
1268
+ comment: [ {
1269
+ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
1270
+ lookbehind: true,
1271
+ greedy: true
1272
+ }, {
1273
+ pattern: /(^|[^\\:])\/\/.*/,
1274
+ lookbehind: true,
1275
+ greedy: true
1276
+ } ],
1277
+ string: {
1278
+ pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1279
+ greedy: true
1280
+ },
1281
+ "class-name": {
1282
+ pattern: /(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,
1283
+ lookbehind: true,
1284
+ inside: {
1285
+ punctuation: /[.\\]/
1286
+ }
1287
+ },
1288
+ keyword: /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
1289
+ boolean: /\b(?:true|false)\b/,
1290
+ function: /\b\w+(?=\()/,
1291
+ number: /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
1292
+ operator: /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
1293
+ punctuation: /[{}[\];(),.:]/
1294
+ };
1295
+ r.languages.javascript = r.languages.extend("clike", {
1296
+ "class-name": [ r.languages.clike["class-name"], {
1297
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:prototype|constructor))/,
1298
+ lookbehind: true
1299
+ } ],
1300
+ keyword: [ {
1301
+ pattern: /((?:^|\})\s*)catch\b/,
1302
+ lookbehind: true
1303
+ }, {
1304
+ 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/,
1305
+ lookbehind: true
1306
+ } ],
1307
+ // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
1308
+ function: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1309
+ number: /\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,
1310
+ operator: /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1311
+ });
1312
+ r.languages.javascript["class-name"][0].pattern = /(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/;
1313
+ r.languages.insertBefore("javascript", "keyword", {
1314
+ regex: {
1315
+ // eslint-disable-next-line regexp/no-dupe-characters-character-class
1316
+ pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,
1317
+ lookbehind: true,
1318
+ greedy: true,
1319
+ inside: {
1320
+ "regex-source": {
1321
+ pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1322
+ lookbehind: true,
1323
+ alias: "language-regex",
1324
+ inside: r.languages.regex
1325
+ },
1326
+ "regex-delimiter": /^\/|\/$/,
1327
+ "regex-flags": /^[a-z]+$/
1328
+ }
1329
+ },
1330
+ // This must be declared before keyword because we use "function" inside the look-forward
1331
+ "function-variable": {
1332
+ 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*=>))/,
1333
+ alias: "function"
1334
+ },
1335
+ parameter: [ {
1336
+ pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1337
+ lookbehind: true,
1338
+ inside: r.languages.javascript
1339
+ }, {
1340
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1341
+ lookbehind: true,
1342
+ inside: r.languages.javascript
1343
+ }, {
1344
+ pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1345
+ lookbehind: true,
1346
+ inside: r.languages.javascript
1347
+ }, {
1348
+ 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*\{)/,
1349
+ lookbehind: true,
1350
+ inside: r.languages.javascript
1351
+ } ],
1352
+ constant: /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1353
+ });
1354
+ r.languages.insertBefore("javascript", "string", {
1355
+ hashbang: {
1356
+ pattern: /^#!.*/,
1357
+ greedy: true,
1358
+ alias: "comment"
1359
+ },
1360
+ "template-string": {
1361
+ pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1362
+ greedy: true,
1363
+ inside: {
1364
+ "template-punctuation": {
1365
+ pattern: /^`|`$/,
1366
+ alias: "string"
1367
+ },
1368
+ interpolation: {
1369
+ pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1370
+ lookbehind: true,
1371
+ inside: {
1372
+ "interpolation-punctuation": {
1373
+ pattern: /^\$\{|\}$/,
1374
+ alias: "punctuation"
1375
+ },
1376
+ rest: r.languages.javascript
1377
+ }
1378
+ },
1379
+ string: /[\s\S]+/
1380
+ }
1381
+ }
1382
+ });
1383
+ if (r.languages.markup) {
1384
+ r.languages.markup.tag.addInlined("script", "javascript");
1385
+ // add attribute support for all DOM events.
1386
+ // https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events
1387
+ r.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");
1388
+ }
1389
+ r.languages.js = r.languages.javascript;
1390
+ (function(e) {
1391
+ var t = e.util.clone(e.languages.javascript);
1392
+ var a = /(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source;
1393
+ var n = /(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source;
1394
+ var r = /(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;
1395
+ /**
1602
1396
  * @param {string} source
1603
1397
  * @param {string} [flags]
1604
- */
1605
- function re(source, flags) {
1606
- source = source
1607
- .replace(/<S>/g, function () { return space; })
1608
- .replace(/<BRACES>/g, function () { return braces; })
1609
- .replace(/<SPREAD>/g, function () { return spread; });
1610
- return RegExp(source, flags);
1611
- }
1612
-
1613
- spread = re(spread).source;
1614
-
1615
-
1616
- Prism.languages.jsx = Prism.languages.extend('markup', javascript);
1617
- Prism.languages.jsx.tag.pattern = re(
1618
- /<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source
1619
- );
1620
-
1621
- Prism.languages.jsx.tag.inside['tag'].pattern = /^<\/?[^\s>\/]*/i;
1622
- Prism.languages.jsx.tag.inside['attr-value'].pattern = /=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/i;
1623
- Prism.languages.jsx.tag.inside['tag'].inside['class-name'] = /^[A-Z]\w*(?:\.[A-Z]\w*)*$/;
1624
- Prism.languages.jsx.tag.inside['comment'] = javascript['comment'];
1625
-
1626
- Prism.languages.insertBefore('inside', 'attr-name', {
1627
- 'spread': {
1628
- pattern: re(/<SPREAD>/.source),
1629
- inside: Prism.languages.jsx
1630
- }
1631
- }, Prism.languages.jsx.tag);
1632
-
1633
- Prism.languages.insertBefore('inside', 'special-attr', {
1634
- 'script': {
1635
- // Allow for two levels of nesting
1636
- pattern: re(/=<BRACES>/.source),
1637
- inside: {
1638
- 'script-punctuation': {
1639
- pattern: /^=(?=\{)/,
1640
- alias: 'punctuation'
1641
- },
1642
- rest: Prism.languages.jsx
1643
- },
1644
- 'alias': 'language-javascript'
1645
- }
1646
- }, Prism.languages.jsx.tag);
1647
-
1648
- // The following will handle plain text inside tags
1649
- var stringifyToken = function (token) {
1650
- if (!token) {
1651
- return '';
1652
- }
1653
- if (typeof token === 'string') {
1654
- return token;
1655
- }
1656
- if (typeof token.content === 'string') {
1657
- return token.content;
1658
- }
1659
- return token.content.map(stringifyToken).join('');
1660
- };
1661
-
1662
- var walkTokens = function (tokens) {
1663
- var openedTags = [];
1664
- for (var i = 0; i < tokens.length; i++) {
1665
- var token = tokens[i];
1666
- var notTagNorBrace = false;
1667
-
1668
- if (typeof token !== 'string') {
1669
- if (token.type === 'tag' && token.content[0] && token.content[0].type === 'tag') {
1670
- // We found a tag, now find its kind
1671
-
1672
- if (token.content[0].content[0].content === '</') {
1673
- // Closing tag
1674
- if (openedTags.length > 0 && openedTags[openedTags.length - 1].tagName === stringifyToken(token.content[0].content[1])) {
1675
- // Pop matching opening tag
1676
- openedTags.pop();
1677
- }
1678
- } else {
1679
- if (token.content[token.content.length - 1].content === '/>') {
1680
- // Autoclosed tag, ignore
1681
- } else {
1682
- // Opening tag
1683
- openedTags.push({
1684
- tagName: stringifyToken(token.content[0].content[1]),
1685
- openedBraces: 0
1686
- });
1687
- }
1688
- }
1689
- } else if (openedTags.length > 0 && token.type === 'punctuation' && token.content === '{') {
1690
-
1691
- // Here we might have entered a JSX context inside a tag
1692
- openedTags[openedTags.length - 1].openedBraces++;
1693
-
1694
- } else if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces > 0 && token.type === 'punctuation' && token.content === '}') {
1695
-
1696
- // Here we might have left a JSX context inside a tag
1697
- openedTags[openedTags.length - 1].openedBraces--;
1698
-
1699
- } else {
1700
- notTagNorBrace = true;
1701
- }
1702
- }
1703
- if (notTagNorBrace || typeof token === 'string') {
1704
- if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces === 0) {
1705
- // Here we are inside a tag, and not inside a JSX context.
1706
- // That's plain text: drop any tokens matched.
1707
- var plainText = stringifyToken(token);
1708
-
1709
- // And merge text with adjacent text
1710
- if (i < tokens.length - 1 && (typeof tokens[i + 1] === 'string' || tokens[i + 1].type === 'plain-text')) {
1711
- plainText += stringifyToken(tokens[i + 1]);
1712
- tokens.splice(i + 1, 1);
1713
- }
1714
- if (i > 0 && (typeof tokens[i - 1] === 'string' || tokens[i - 1].type === 'plain-text')) {
1715
- plainText = stringifyToken(tokens[i - 1]) + plainText;
1716
- tokens.splice(i - 1, 1);
1717
- i--;
1718
- }
1719
-
1720
- tokens[i] = new Prism.Token('plain-text', plainText, null, plainText);
1721
- }
1722
- }
1723
-
1724
- if (token.content && typeof token.content !== 'string') {
1725
- walkTokens(token.content);
1726
- }
1727
- }
1728
- };
1729
-
1730
- Prism.hooks.add('after-tokenize', function (env) {
1731
- if (env.language !== 'jsx' && env.language !== 'tsx') {
1732
- return;
1733
- }
1734
- walkTokens(env.tokens);
1735
- });
1736
-
1737
- }(Prism));
1738
-
1739
- (function (Prism) {
1740
-
1741
- Prism.languages.typescript = Prism.languages.extend('javascript', {
1742
- 'class-name': {
1743
- pattern: /(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,
1744
- lookbehind: true,
1745
- greedy: true,
1746
- inside: null // see below
1747
- },
1748
- 'builtin': /\b(?:string|Function|any|number|boolean|Array|symbol|console|Promise|unknown|never)\b/,
1749
- });
1750
-
1751
- // The keywords TypeScript adds to JavaScript
1752
- Prism.languages.typescript.keyword.push(
1753
- /\b(?:abstract|as|declare|implements|is|keyof|readonly|require)\b/,
1754
- // keywords that have to be followed by an identifier
1755
- /\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,
1756
- // This is for `import type *, {}`
1757
- /\btype\b(?=\s*(?:[\{*]|$))/
1758
- );
1759
-
1760
- // doesn't work with TS because TS is too complex
1761
- delete Prism.languages.typescript['parameter'];
1762
-
1763
- // a version of typescript specifically for highlighting types
1764
- var typeInside = Prism.languages.extend('typescript', {});
1765
- delete typeInside['class-name'];
1766
-
1767
- Prism.languages.typescript['class-name'].inside = typeInside;
1768
-
1769
- Prism.languages.insertBefore('typescript', 'function', {
1770
- 'decorator': {
1771
- pattern: /@[$\w\xA0-\uFFFF]+/,
1772
- inside: {
1773
- 'at': {
1774
- pattern: /^@/,
1775
- alias: 'operator'
1776
- },
1777
- 'function': /^[\s\S]+/
1778
- }
1779
- },
1780
- 'generic-function': {
1781
- // e.g. foo<T extends "bar" | "baz">( ...
1782
- pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,
1783
- greedy: true,
1784
- inside: {
1785
- 'function': /^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,
1786
- 'generic': {
1787
- pattern: /<[\s\S]+/, // everything after the first <
1788
- alias: 'class-name',
1789
- inside: typeInside
1790
- }
1791
- }
1792
- }
1793
- });
1794
-
1795
- Prism.languages.ts = Prism.languages.typescript;
1796
-
1797
- }(Prism));
1798
-
1799
- (function (Prism) {
1800
- var typescript = Prism.util.clone(Prism.languages.typescript);
1801
- Prism.languages.tsx = Prism.languages.extend('jsx', typescript);
1802
-
1803
- // This will prevent collisions between TSX tags and TS generic types.
1804
- // Idea by https://github.com/karlhorky
1805
- // Discussion: https://github.com/PrismJS/prism/issues/2594#issuecomment-710666928
1806
- var tag = Prism.languages.tsx.tag;
1807
- tag.pattern = RegExp(/(^|[^\w$]|(?=<\/))/.source + '(?:' + tag.pattern.source + ')', tag.pattern.flags);
1808
- tag.lookbehind = true;
1809
- }(Prism));
1810
-
1811
- (function (Prism) {
1812
-
1813
- var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
1814
-
1815
- Prism.languages.css = {
1816
- 'comment': /\/\*[\s\S]*?\*\//,
1817
- 'atrule': {
1818
- pattern: /@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,
1819
- inside: {
1820
- 'rule': /^@[\w-]+/,
1821
- 'selector-function-argument': {
1822
- pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
1823
- lookbehind: true,
1824
- alias: 'selector'
1825
- },
1826
- 'keyword': {
1827
- pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
1828
- lookbehind: true
1829
- }
1830
- // See rest below
1831
- }
1832
- },
1833
- 'url': {
1834
- // https://drafts.csswg.org/css-values-3/#urls
1835
- pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
1836
- greedy: true,
1837
- inside: {
1838
- 'function': /^url/i,
1839
- 'punctuation': /^\(|\)$/,
1840
- 'string': {
1841
- pattern: RegExp('^' + string.source + '$'),
1842
- alias: 'url'
1843
- }
1844
- }
1845
- },
1846
- 'selector': {
1847
- pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
1848
- lookbehind: true
1849
- },
1850
- 'string': {
1851
- pattern: string,
1852
- greedy: true
1853
- },
1854
- 'property': {
1855
- pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
1856
- lookbehind: true
1857
- },
1858
- 'important': /!important\b/i,
1859
- 'function': {
1860
- pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
1861
- lookbehind: true
1862
- },
1863
- 'punctuation': /[(){};:,]/
1864
- };
1865
-
1866
- Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
1867
-
1868
- var markup = Prism.languages.markup;
1869
- if (markup) {
1870
- markup.tag.addInlined('style', 'css');
1871
- markup.tag.addAttribute('style', 'css');
1872
- }
1873
-
1874
- }(Prism));
1875
-
1876
- (function (Prism) {
1877
- // $ set | grep '^[A-Z][^[:space:]]*=' | cut -d= -f1 | tr '\n' '|'
1878
- // + LC_ALL, RANDOM, REPLY, SECONDS.
1879
- // + make sure PS1..4 are here as they are not always set,
1880
- // - some useless things.
1881
- 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';
1882
-
1883
- var commandAfterHeredoc = {
1884
- pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
1885
- lookbehind: true,
1886
- alias: 'punctuation', // this looks reasonably well in all themes
1887
- inside: null // see below
1888
- };
1889
-
1890
- var insideString = {
1891
- 'bash': commandAfterHeredoc,
1892
- 'environment': {
1893
- pattern: RegExp('\\$' + envVars),
1894
- alias: 'constant'
1895
- },
1896
- 'variable': [
1897
- // [0]: Arithmetic Environment
1898
- {
1899
- pattern: /\$?\(\([\s\S]+?\)\)/,
1900
- greedy: true,
1901
- inside: {
1902
- // If there is a $ sign at the beginning highlight $(( and )) as variable
1903
- 'variable': [
1904
- {
1905
- pattern: /(^\$\(\([\s\S]+)\)\)/,
1906
- lookbehind: true
1907
- },
1908
- /^\$\(\(/
1909
- ],
1910
- 'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
1911
- // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
1912
- 'operator': /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
1913
- // If there is no $ sign at the beginning highlight (( and )) as punctuation
1914
- 'punctuation': /\(\(?|\)\)?|,|;/
1915
- }
1916
- },
1917
- // [1]: Command Substitution
1918
- {
1919
- pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
1920
- greedy: true,
1921
- inside: {
1922
- 'variable': /^\$\(|^`|\)$|`$/
1923
- }
1924
- },
1925
- // [2]: Brace expansion
1926
- {
1927
- pattern: /\$\{[^}]+\}/,
1928
- greedy: true,
1929
- inside: {
1930
- 'operator': /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
1931
- 'punctuation': /[\[\]]/,
1932
- 'environment': {
1933
- pattern: RegExp('(\\{)' + envVars),
1934
- lookbehind: true,
1935
- alias: 'constant'
1936
- }
1937
- }
1938
- },
1939
- /\$(?:\w+|[#?*!@$])/
1940
- ],
1941
- // Escape sequences from echo and printf's manuals, and escaped quotes.
1942
- 'entity': /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})/
1943
- };
1944
-
1945
- Prism.languages.bash = {
1946
- 'shebang': {
1947
- pattern: /^#!\s*\/.*/,
1948
- alias: 'important'
1949
- },
1950
- 'comment': {
1951
- pattern: /(^|[^"{\\$])#.*/,
1952
- lookbehind: true
1953
- },
1954
- 'function-name': [
1955
- // a) function foo {
1956
- // b) foo() {
1957
- // c) function foo() {
1958
- // but not “foo {”
1959
- {
1960
- // a) and c)
1961
- pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
1962
- lookbehind: true,
1963
- alias: 'function'
1964
- },
1965
- {
1966
- // b)
1967
- pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
1968
- alias: 'function'
1969
- }
1970
- ],
1971
- // Highlight variable names as variables in for and select beginnings.
1972
- 'for-or-select': {
1973
- pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
1974
- alias: 'variable',
1975
- lookbehind: true
1976
- },
1977
- // Highlight variable names as variables in the left-hand part
1978
- // of assignments (“=” and “+=”).
1979
- 'assign-left': {
1980
- pattern: /(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,
1981
- inside: {
1982
- 'environment': {
1983
- pattern: RegExp('(^|[\\s;|&]|[<>]\\()' + envVars),
1984
- lookbehind: true,
1985
- alias: 'constant'
1986
- }
1987
- },
1988
- alias: 'variable',
1989
- lookbehind: true
1990
- },
1991
- 'string': [
1992
- // Support for Here-documents https://en.wikipedia.org/wiki/Here_document
1993
- {
1994
- pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
1995
- lookbehind: true,
1996
- greedy: true,
1997
- inside: insideString
1998
- },
1999
- // Here-document with quotes around the tag
2000
- // → No expansion (so no “inside”).
2001
- {
2002
- pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
2003
- lookbehind: true,
2004
- greedy: true,
2005
- inside: {
2006
- 'bash': commandAfterHeredoc
2007
- }
2008
- },
2009
- // “Normal” string
2010
- {
2011
- // https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
2012
- pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
2013
- lookbehind: true,
2014
- greedy: true,
2015
- inside: insideString
2016
- },
2017
- {
2018
- // https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
2019
- pattern: /(^|[^$\\])'[^']*'/,
2020
- lookbehind: true,
2021
- greedy: true
2022
- },
2023
- {
2024
- // https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html
2025
- pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
2026
- greedy: true,
2027
- inside: {
2028
- 'entity': insideString.entity
2029
- }
2030
- }
2031
- ],
2032
- 'environment': {
2033
- pattern: RegExp('\\$?' + envVars),
2034
- alias: 'constant'
2035
- },
2036
- 'variable': insideString.variable,
2037
- 'function': {
2038
- pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|aptitude|apt-cache|apt-get|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|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|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|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|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
2039
- lookbehind: true
2040
- },
2041
- 'keyword': {
2042
- pattern: /(^|[\s;|&]|[<>]\()(?:if|then|else|elif|fi|for|while|in|case|esac|function|select|do|done|until)(?=$|[)\s;|&])/,
2043
- lookbehind: true
2044
- },
2045
- // https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
2046
- 'builtin': {
2047
- pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|break|cd|continue|eval|exec|exit|export|getopts|hash|pwd|readonly|return|shift|test|times|trap|umask|unset|alias|bind|builtin|caller|command|declare|echo|enable|help|let|local|logout|mapfile|printf|read|readarray|source|type|typeset|ulimit|unalias|set|shopt)(?=$|[)\s;|&])/,
2048
- lookbehind: true,
2049
- // Alias added to make those easier to distinguish from strings.
2050
- alias: 'class-name'
2051
- },
2052
- 'boolean': {
2053
- pattern: /(^|[\s;|&]|[<>]\()(?:true|false)(?=$|[)\s;|&])/,
2054
- lookbehind: true
2055
- },
2056
- 'file-descriptor': {
2057
- pattern: /\B&\d\b/,
2058
- alias: 'important'
2059
- },
2060
- 'operator': {
2061
- // Lots of redirections here, but not just that.
2062
- pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
2063
- inside: {
2064
- 'file-descriptor': {
2065
- pattern: /^\d/,
2066
- alias: 'important'
2067
- }
2068
- }
2069
- },
2070
- 'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
2071
- 'number': {
2072
- pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
2073
- lookbehind: true
2074
- }
2075
- };
2076
-
2077
- commandAfterHeredoc.inside = Prism.languages.bash;
2078
-
2079
- /* Patterns in command substitution. */
2080
- var toBeCopied = [
2081
- 'comment',
2082
- 'function-name',
2083
- 'for-or-select',
2084
- 'assign-left',
2085
- 'string',
2086
- 'environment',
2087
- 'function',
2088
- 'keyword',
2089
- 'builtin',
2090
- 'boolean',
2091
- 'file-descriptor',
2092
- 'operator',
2093
- 'punctuation',
2094
- 'number'
2095
- ];
2096
- var inside = insideString.variable[1].inside;
2097
- for (var i = 0; i < toBeCopied.length; i++) {
2098
- inside[toBeCopied[i]] = Prism.languages.bash[toBeCopied[i]];
2099
- }
2100
-
2101
- Prism.languages.shell = Prism.languages.bash;
2102
- }(Prism));
2103
-
2104
- (function (Prism) {
2105
-
2106
- // https://yaml.org/spec/1.2/spec.html#c-ns-anchor-property
2107
- // https://yaml.org/spec/1.2/spec.html#c-ns-alias-node
2108
- var anchorOrAlias = /[*&][^\s[\]{},]+/;
2109
- // https://yaml.org/spec/1.2/spec.html#c-ns-tag-property
2110
- var tag = /!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/;
2111
- // https://yaml.org/spec/1.2/spec.html#c-ns-properties(n,c)
2112
- var properties = '(?:' + tag.source + '(?:[ \t]+' + anchorOrAlias.source + ')?|'
2113
- + anchorOrAlias.source + '(?:[ \t]+' + tag.source + ')?)';
2114
- // https://yaml.org/spec/1.2/spec.html#ns-plain(n,c)
2115
- // This is a simplified version that doesn't support "#" and multiline keys
2116
- // All these long scarry character classes are simplified versions of YAML's characters
2117
- var plainKey = /(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source
2118
- .replace(/<PLAIN>/g, function () { return /[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source; });
2119
- var string = /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;
2120
-
2121
- /**
1398
+ */ function s(e, t) {
1399
+ e = e.replace(/<S>/g, (function() {
1400
+ return a;
1401
+ })).replace(/<BRACES>/g, (function() {
1402
+ return n;
1403
+ })).replace(/<SPREAD>/g, (function() {
1404
+ return r;
1405
+ }));
1406
+ return RegExp(e, t);
1407
+ }
1408
+ r = s(r).source;
1409
+ e.languages.jsx = e.languages.extend("markup", t);
1410
+ e.languages.jsx.tag.pattern = s(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source);
1411
+ e.languages.jsx.tag.inside["tag"].pattern = /^<\/?[^\s>\/]*/i;
1412
+ e.languages.jsx.tag.inside["attr-value"].pattern = /=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/i;
1413
+ e.languages.jsx.tag.inside["tag"].inside["class-name"] = /^[A-Z]\w*(?:\.[A-Z]\w*)*$/;
1414
+ e.languages.jsx.tag.inside["comment"] = t["comment"];
1415
+ e.languages.insertBefore("inside", "attr-name", {
1416
+ spread: {
1417
+ pattern: s(/<SPREAD>/.source),
1418
+ inside: e.languages.jsx
1419
+ }
1420
+ }, e.languages.jsx.tag);
1421
+ e.languages.insertBefore("inside", "special-attr", {
1422
+ script: {
1423
+ // Allow for two levels of nesting
1424
+ pattern: s(/=<BRACES>/.source),
1425
+ inside: {
1426
+ "script-punctuation": {
1427
+ pattern: /^=(?=\{)/,
1428
+ alias: "punctuation"
1429
+ },
1430
+ rest: e.languages.jsx
1431
+ },
1432
+ alias: "language-javascript"
1433
+ }
1434
+ }, e.languages.jsx.tag);
1435
+ // The following will handle plain text inside tags
1436
+ var i = function(e) {
1437
+ if (!e) {
1438
+ return "";
1439
+ }
1440
+ if (typeof e === "string") {
1441
+ return e;
1442
+ }
1443
+ if (typeof e.content === "string") {
1444
+ return e.content;
1445
+ }
1446
+ return e.content.map(i).join("");
1447
+ };
1448
+ var o = function(t) {
1449
+ var a = [];
1450
+ for (var n = 0; n < t.length; n++) {
1451
+ var r = t[n];
1452
+ var s = false;
1453
+ if (typeof r !== "string") {
1454
+ if (r.type === "tag" && r.content[0] && r.content[0].type === "tag") {
1455
+ // We found a tag, now find its kind
1456
+ if (r.content[0].content[0].content === "</") {
1457
+ // Closing tag
1458
+ if (a.length > 0 && a[a.length - 1].tagName === i(r.content[0].content[1])) {
1459
+ // Pop matching opening tag
1460
+ a.pop();
1461
+ }
1462
+ } else {
1463
+ if (r.content[r.content.length - 1].content === "/>") {
1464
+ // Autoclosed tag, ignore
1465
+ } else {
1466
+ // Opening tag
1467
+ a.push({
1468
+ tagName: i(r.content[0].content[1]),
1469
+ openedBraces: 0
1470
+ });
1471
+ }
1472
+ }
1473
+ } else if (a.length > 0 && r.type === "punctuation" && r.content === "{") {
1474
+ // Here we might have entered a JSX context inside a tag
1475
+ a[a.length - 1].openedBraces++;
1476
+ } else if (a.length > 0 && a[a.length - 1].openedBraces > 0 && r.type === "punctuation" && r.content === "}") {
1477
+ // Here we might have left a JSX context inside a tag
1478
+ a[a.length - 1].openedBraces--;
1479
+ } else {
1480
+ s = true;
1481
+ }
1482
+ }
1483
+ if (s || typeof r === "string") {
1484
+ if (a.length > 0 && a[a.length - 1].openedBraces === 0) {
1485
+ // Here we are inside a tag, and not inside a JSX context.
1486
+ // That's plain text: drop any tokens matched.
1487
+ var l = i(r);
1488
+ // And merge text with adjacent text
1489
+ if (n < t.length - 1 && (typeof t[n + 1] === "string" || t[n + 1].type === "plain-text")) {
1490
+ l += i(t[n + 1]);
1491
+ t.splice(n + 1, 1);
1492
+ }
1493
+ if (n > 0 && (typeof t[n - 1] === "string" || t[n - 1].type === "plain-text")) {
1494
+ l = i(t[n - 1]) + l;
1495
+ t.splice(n - 1, 1);
1496
+ n--;
1497
+ }
1498
+ t[n] = new e.Token("plain-text", l, null, l);
1499
+ }
1500
+ }
1501
+ if (r.content && typeof r.content !== "string") {
1502
+ o(r.content);
1503
+ }
1504
+ }
1505
+ };
1506
+ e.hooks.add("after-tokenize", (function(e) {
1507
+ if (e.language !== "jsx" && e.language !== "tsx") {
1508
+ return;
1509
+ }
1510
+ o(e.tokens);
1511
+ }));
1512
+ })(r);
1513
+ (function(e) {
1514
+ e.languages.typescript = e.languages.extend("javascript", {
1515
+ "class-name": {
1516
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,
1517
+ lookbehind: true,
1518
+ greedy: true,
1519
+ inside: null
1520
+ },
1521
+ builtin: /\b(?:string|Function|any|number|boolean|Array|symbol|console|Promise|unknown|never)\b/
1522
+ });
1523
+ // The keywords TypeScript adds to JavaScript
1524
+ e.languages.typescript.keyword.push(/\b(?:abstract|as|declare|implements|is|keyof|readonly|require)\b/,
1525
+ // keywords that have to be followed by an identifier
1526
+ /\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,
1527
+ // This is for `import type *, {}`
1528
+ /\btype\b(?=\s*(?:[\{*]|$))/);
1529
+ // doesn't work with TS because TS is too complex
1530
+ delete e.languages.typescript["parameter"];
1531
+ // a version of typescript specifically for highlighting types
1532
+ var t = e.languages.extend("typescript", {});
1533
+ delete t["class-name"];
1534
+ e.languages.typescript["class-name"].inside = t;
1535
+ e.languages.insertBefore("typescript", "function", {
1536
+ decorator: {
1537
+ pattern: /@[$\w\xA0-\uFFFF]+/,
1538
+ inside: {
1539
+ at: {
1540
+ pattern: /^@/,
1541
+ alias: "operator"
1542
+ },
1543
+ function: /^[\s\S]+/
1544
+ }
1545
+ },
1546
+ "generic-function": {
1547
+ // e.g. foo<T extends "bar" | "baz">( ...
1548
+ pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,
1549
+ greedy: true,
1550
+ inside: {
1551
+ function: /^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,
1552
+ generic: {
1553
+ pattern: /<[\s\S]+/,
1554
+ // everything after the first <
1555
+ alias: "class-name",
1556
+ inside: t
1557
+ }
1558
+ }
1559
+ }
1560
+ });
1561
+ e.languages.ts = e.languages.typescript;
1562
+ })(r);
1563
+ (function(e) {
1564
+ var t = e.util.clone(e.languages.typescript);
1565
+ e.languages.tsx = e.languages.extend("jsx", t);
1566
+ // This will prevent collisions between TSX tags and TS generic types.
1567
+ // Idea by https://github.com/karlhorky
1568
+ // Discussion: https://github.com/PrismJS/prism/issues/2594#issuecomment-710666928
1569
+ var a = e.languages.tsx.tag;
1570
+ a.pattern = RegExp(/(^|[^\w$]|(?=<\/))/.source + "(?:" + a.pattern.source + ")", a.pattern.flags);
1571
+ a.lookbehind = true;
1572
+ })(r);
1573
+ (function(e) {
1574
+ var t = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
1575
+ e.languages.css = {
1576
+ comment: /\/\*[\s\S]*?\*\//,
1577
+ atrule: {
1578
+ pattern: /@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,
1579
+ inside: {
1580
+ rule: /^@[\w-]+/,
1581
+ "selector-function-argument": {
1582
+ pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
1583
+ lookbehind: true,
1584
+ alias: "selector"
1585
+ },
1586
+ keyword: {
1587
+ pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
1588
+ lookbehind: true
1589
+ }
1590
+ }
1591
+ },
1592
+ url: {
1593
+ // https://drafts.csswg.org/css-values-3/#urls
1594
+ pattern: RegExp("\\burl\\((?:" + t.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
1595
+ greedy: true,
1596
+ inside: {
1597
+ function: /^url/i,
1598
+ punctuation: /^\(|\)$/,
1599
+ string: {
1600
+ pattern: RegExp("^" + t.source + "$"),
1601
+ alias: "url"
1602
+ }
1603
+ }
1604
+ },
1605
+ selector: {
1606
+ pattern: RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|" + t.source + ")*(?=\\s*\\{)"),
1607
+ lookbehind: true
1608
+ },
1609
+ string: {
1610
+ pattern: t,
1611
+ greedy: true
1612
+ },
1613
+ property: {
1614
+ pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
1615
+ lookbehind: true
1616
+ },
1617
+ important: /!important\b/i,
1618
+ function: {
1619
+ pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
1620
+ lookbehind: true
1621
+ },
1622
+ punctuation: /[(){};:,]/
1623
+ };
1624
+ e.languages.css["atrule"].inside.rest = e.languages.css;
1625
+ var a = e.languages.markup;
1626
+ if (a) {
1627
+ a.tag.addInlined("style", "css");
1628
+ a.tag.addAttribute("style", "css");
1629
+ }
1630
+ })(r);
1631
+ (function(e) {
1632
+ // $ set | grep '^[A-Z][^[:space:]]*=' | cut -d= -f1 | tr '\n' '|'
1633
+ // + LC_ALL, RANDOM, REPLY, SECONDS.
1634
+ // + make sure PS1..4 are here as they are not always set,
1635
+ // - some useless things.
1636
+ var t = "\\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";
1637
+ var a = {
1638
+ pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
1639
+ lookbehind: true,
1640
+ alias: "punctuation",
1641
+ // this looks reasonably well in all themes
1642
+ inside: null
1643
+ };
1644
+ var n = {
1645
+ bash: a,
1646
+ environment: {
1647
+ pattern: RegExp("\\$" + t),
1648
+ alias: "constant"
1649
+ },
1650
+ variable: [
1651
+ // [0]: Arithmetic Environment
1652
+ {
1653
+ pattern: /\$?\(\([\s\S]+?\)\)/,
1654
+ greedy: true,
1655
+ inside: {
1656
+ // If there is a $ sign at the beginning highlight $(( and )) as variable
1657
+ variable: [ {
1658
+ pattern: /(^\$\(\([\s\S]+)\)\)/,
1659
+ lookbehind: true
1660
+ }, /^\$\(\(/ ],
1661
+ number: /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
1662
+ // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
1663
+ operator: /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
1664
+ // If there is no $ sign at the beginning highlight (( and )) as punctuation
1665
+ punctuation: /\(\(?|\)\)?|,|;/
1666
+ }
1667
+ },
1668
+ // [1]: Command Substitution
1669
+ {
1670
+ pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
1671
+ greedy: true,
1672
+ inside: {
1673
+ variable: /^\$\(|^`|\)$|`$/
1674
+ }
1675
+ },
1676
+ // [2]: Brace expansion
1677
+ {
1678
+ pattern: /\$\{[^}]+\}/,
1679
+ greedy: true,
1680
+ inside: {
1681
+ operator: /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
1682
+ punctuation: /[\[\]]/,
1683
+ environment: {
1684
+ pattern: RegExp("(\\{)" + t),
1685
+ lookbehind: true,
1686
+ alias: "constant"
1687
+ }
1688
+ }
1689
+ }, /\$(?:\w+|[#?*!@$])/ ],
1690
+ // Escape sequences from echo and printf's manuals, and escaped quotes.
1691
+ entity: /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})/
1692
+ };
1693
+ e.languages.bash = {
1694
+ shebang: {
1695
+ pattern: /^#!\s*\/.*/,
1696
+ alias: "important"
1697
+ },
1698
+ comment: {
1699
+ pattern: /(^|[^"{\\$])#.*/,
1700
+ lookbehind: true
1701
+ },
1702
+ "function-name": [
1703
+ // a) function foo {
1704
+ // b) foo() {
1705
+ // c) function foo() {
1706
+ // but not “foo {”
1707
+ {
1708
+ // a) and c)
1709
+ pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
1710
+ lookbehind: true,
1711
+ alias: "function"
1712
+ }, {
1713
+ // b)
1714
+ pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
1715
+ alias: "function"
1716
+ } ],
1717
+ // Highlight variable names as variables in for and select beginnings.
1718
+ "for-or-select": {
1719
+ pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
1720
+ alias: "variable",
1721
+ lookbehind: true
1722
+ },
1723
+ // Highlight variable names as variables in the left-hand part
1724
+ // of assignments (“=” and “+=”).
1725
+ "assign-left": {
1726
+ pattern: /(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,
1727
+ inside: {
1728
+ environment: {
1729
+ pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + t),
1730
+ lookbehind: true,
1731
+ alias: "constant"
1732
+ }
1733
+ },
1734
+ alias: "variable",
1735
+ lookbehind: true
1736
+ },
1737
+ string: [
1738
+ // Support for Here-documents https://en.wikipedia.org/wiki/Here_document
1739
+ {
1740
+ pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
1741
+ lookbehind: true,
1742
+ greedy: true,
1743
+ inside: n
1744
+ },
1745
+ // Here-document with quotes around the tag
1746
+ // → No expansion (so no “inside”).
1747
+ {
1748
+ pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
1749
+ lookbehind: true,
1750
+ greedy: true,
1751
+ inside: {
1752
+ bash: a
1753
+ }
1754
+ },
1755
+ // “Normal” string
1756
+ {
1757
+ // https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
1758
+ pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
1759
+ lookbehind: true,
1760
+ greedy: true,
1761
+ inside: n
1762
+ }, {
1763
+ // https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
1764
+ pattern: /(^|[^$\\])'[^']*'/,
1765
+ lookbehind: true,
1766
+ greedy: true
1767
+ }, {
1768
+ // https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html
1769
+ pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
1770
+ greedy: true,
1771
+ inside: {
1772
+ entity: n.entity
1773
+ }
1774
+ } ],
1775
+ environment: {
1776
+ pattern: RegExp("\\$?" + t),
1777
+ alias: "constant"
1778
+ },
1779
+ variable: n.variable,
1780
+ function: {
1781
+ pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|aptitude|apt-cache|apt-get|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|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|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|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|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
1782
+ lookbehind: true
1783
+ },
1784
+ keyword: {
1785
+ pattern: /(^|[\s;|&]|[<>]\()(?:if|then|else|elif|fi|for|while|in|case|esac|function|select|do|done|until)(?=$|[)\s;|&])/,
1786
+ lookbehind: true
1787
+ },
1788
+ // https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
1789
+ builtin: {
1790
+ pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|break|cd|continue|eval|exec|exit|export|getopts|hash|pwd|readonly|return|shift|test|times|trap|umask|unset|alias|bind|builtin|caller|command|declare|echo|enable|help|let|local|logout|mapfile|printf|read|readarray|source|type|typeset|ulimit|unalias|set|shopt)(?=$|[)\s;|&])/,
1791
+ lookbehind: true,
1792
+ // Alias added to make those easier to distinguish from strings.
1793
+ alias: "class-name"
1794
+ },
1795
+ boolean: {
1796
+ pattern: /(^|[\s;|&]|[<>]\()(?:true|false)(?=$|[)\s;|&])/,
1797
+ lookbehind: true
1798
+ },
1799
+ "file-descriptor": {
1800
+ pattern: /\B&\d\b/,
1801
+ alias: "important"
1802
+ },
1803
+ operator: {
1804
+ // Lots of redirections here, but not just that.
1805
+ pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
1806
+ inside: {
1807
+ "file-descriptor": {
1808
+ pattern: /^\d/,
1809
+ alias: "important"
1810
+ }
1811
+ }
1812
+ },
1813
+ punctuation: /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
1814
+ number: {
1815
+ pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
1816
+ lookbehind: true
1817
+ }
1818
+ };
1819
+ a.inside = e.languages.bash;
1820
+ /* Patterns in command substitution. */ var r = [ "comment", "function-name", "for-or-select", "assign-left", "string", "environment", "function", "keyword", "builtin", "boolean", "file-descriptor", "operator", "punctuation", "number" ];
1821
+ var s = n.variable[1].inside;
1822
+ for (var i = 0; i < r.length; i++) {
1823
+ s[r[i]] = e.languages.bash[r[i]];
1824
+ }
1825
+ e.languages.shell = e.languages.bash;
1826
+ })(r);
1827
+ (function(e) {
1828
+ // https://yaml.org/spec/1.2/spec.html#c-ns-anchor-property
1829
+ // https://yaml.org/spec/1.2/spec.html#c-ns-alias-node
1830
+ var t = /[*&][^\s[\]{},]+/;
1831
+ // https://yaml.org/spec/1.2/spec.html#c-ns-tag-property
1832
+ var a = /!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/;
1833
+ // https://yaml.org/spec/1.2/spec.html#c-ns-properties(n,c)
1834
+ var n = "(?:" + a.source + "(?:[ \t]+" + t.source + ")?|" + t.source + "(?:[ \t]+" + a.source + ")?)";
1835
+ // https://yaml.org/spec/1.2/spec.html#ns-plain(n,c)
1836
+ // This is a simplified version that doesn't support "#" and multiline keys
1837
+ // All these long scarry character classes are simplified versions of YAML's characters
1838
+ var r = /(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g, (function() {
1839
+ return /[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source;
1840
+ }));
1841
+ var s = /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;
1842
+ /**
2122
1843
  *
2123
1844
  * @param {string} value
2124
1845
  * @param {string} [flags]
2125
1846
  * @returns {RegExp}
2126
- */
2127
- function createValuePattern(value, flags) {
2128
- flags = (flags || '').replace(/m/g, '') + 'm'; // add m flag
2129
- var pattern = /([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source
2130
- .replace(/<<prop>>/g, function () { return properties; }).replace(/<<value>>/g, function () { return value; });
2131
- return RegExp(pattern, flags);
2132
- }
2133
-
2134
- Prism.languages.yaml = {
2135
- 'scalar': {
2136
- pattern: RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source
2137
- .replace(/<<prop>>/g, function () { return properties; })),
2138
- lookbehind: true,
2139
- alias: 'string'
2140
- },
2141
- 'comment': /#.*/,
2142
- 'key': {
2143
- pattern: RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source
2144
- .replace(/<<prop>>/g, function () { return properties; })
2145
- .replace(/<<key>>/g, function () { return '(?:' + plainKey + '|' + string + ')'; })),
2146
- lookbehind: true,
2147
- greedy: true,
2148
- alias: 'atrule'
2149
- },
2150
- 'directive': {
2151
- pattern: /(^[ \t]*)%.+/m,
2152
- lookbehind: true,
2153
- alias: 'important'
2154
- },
2155
- 'datetime': {
2156
- 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),
2157
- lookbehind: true,
2158
- alias: 'number'
2159
- },
2160
- 'boolean': {
2161
- pattern: createValuePattern(/true|false/.source, 'i'),
2162
- lookbehind: true,
2163
- alias: 'important'
2164
- },
2165
- 'null': {
2166
- pattern: createValuePattern(/null|~/.source, 'i'),
2167
- lookbehind: true,
2168
- alias: 'important'
2169
- },
2170
- 'string': {
2171
- pattern: createValuePattern(string),
2172
- lookbehind: true,
2173
- greedy: true
2174
- },
2175
- 'number': {
2176
- pattern: createValuePattern(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source, 'i'),
2177
- lookbehind: true
2178
- },
2179
- 'tag': tag,
2180
- 'important': anchorOrAlias,
2181
- 'punctuation': /---|[:[\]{}\-,|>?]|\.\.\./
2182
- };
2183
-
2184
- Prism.languages.yml = Prism.languages.yaml;
2185
-
2186
- }(Prism));
2187
-
2188
- Prism.languages['splunk-spl'] = {
2189
- 'comment': /`comment\("(?:\\.|[^\\"])*"\)`/,
2190
- 'string': {
2191
- pattern: /"(?:\\.|[^\\"])*"/,
2192
- greedy: true
2193
- },
2194
- // https://docs.splunk.com/Documentation/Splunk/7.3.0/SearchReference/ListOfSearchCommands
2195
- 'keyword': /\b(?:abstract|accum|addcoltotals|addinfo|addtotals|analyzefields|anomalies|anomalousvalue|anomalydetection|append|appendcols|appendcsv|appendlookup|appendpipe|arules|associate|audit|autoregress|bin|bucket|bucketdir|chart|cluster|cofilter|collect|concurrency|contingency|convert|correlate|datamodel|dbinspect|dedup|delete|delta|diff|erex|eval|eventcount|eventstats|extract|fieldformat|fields|fieldsummary|filldown|fillnull|findtypes|folderize|foreach|format|from|gauge|gentimes|geom|geomfilter|geostats|head|highlight|history|iconify|input|inputcsv|inputlookup|iplocation|join|kmeans|kv|kvform|loadjob|localize|localop|lookup|makecontinuous|makemv|makeresults|map|mcollect|metadata|metasearch|meventcollect|mstats|multikv|multisearch|mvcombine|mvexpand|nomv|outlier|outputcsv|outputlookup|outputtext|overlap|pivot|predict|rangemap|rare|regex|relevancy|reltime|rename|replace|rest|return|reverse|rex|rtorder|run|savedsearch|script|scrub|search|searchtxn|selfjoin|sendemail|set|setfields|sichart|sirare|sistats|sitimechart|sitop|sort|spath|stats|strcat|streamstats|table|tags|tail|timechart|timewrap|top|transaction|transpose|trendline|tscollect|tstats|typeahead|typelearner|typer|union|uniq|untable|where|x11|xmlkv|xmlunescape|xpath|xyseries)\b/i,
2196
- 'operator-word': {
2197
- pattern: /\b(?:and|as|by|not|or|xor)\b/i,
2198
- alias: 'operator'
2199
- },
2200
- 'function': /\b\w+(?=\s*\()/,
2201
- 'property': /\b\w+(?=\s*=(?!=))/,
2202
- 'date': {
2203
- // MM/DD/YYYY(:HH:MM:SS)?
2204
- pattern: /\b\d{1,2}\/\d{1,2}\/\d{1,4}(?:(?::\d{1,2}){3})?\b/,
2205
- alias: 'number'
2206
- },
2207
- 'number': /\b\d+(?:\.\d+)?\b/,
2208
- 'boolean': /\b(?:f|false|t|true)\b/i,
2209
- 'operator': /[<>=]=?|[-+*/%|]/,
2210
- 'punctuation': /[()[\],]/
2211
- };
2212
-
1847
+ */ function i(e, t) {
1848
+ t = (t || "").replace(/m/g, "") + "m";
1849
+ // add m flag
1850
+ var a = /([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g, (function() {
1851
+ return n;
1852
+ })).replace(/<<value>>/g, (function() {
1853
+ return e;
1854
+ }));
1855
+ return RegExp(a, t);
1856
+ }
1857
+ e.languages.yaml = {
1858
+ scalar: {
1859
+ pattern: RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g, (function() {
1860
+ return n;
1861
+ }))),
1862
+ lookbehind: true,
1863
+ alias: "string"
1864
+ },
1865
+ comment: /#.*/,
1866
+ key: {
1867
+ pattern: RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g, (function() {
1868
+ return n;
1869
+ })).replace(/<<key>>/g, (function() {
1870
+ return "(?:" + r + "|" + s + ")";
1871
+ }))),
1872
+ lookbehind: true,
1873
+ greedy: true,
1874
+ alias: "atrule"
1875
+ },
1876
+ directive: {
1877
+ pattern: /(^[ \t]*)%.+/m,
1878
+ lookbehind: true,
1879
+ alias: "important"
1880
+ },
1881
+ datetime: {
1882
+ pattern: i(/\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),
1883
+ lookbehind: true,
1884
+ alias: "number"
1885
+ },
1886
+ boolean: {
1887
+ pattern: i(/true|false/.source, "i"),
1888
+ lookbehind: true,
1889
+ alias: "important"
1890
+ },
1891
+ null: {
1892
+ pattern: i(/null|~/.source, "i"),
1893
+ lookbehind: true,
1894
+ alias: "important"
1895
+ },
1896
+ string: {
1897
+ pattern: i(s),
1898
+ lookbehind: true,
1899
+ greedy: true
1900
+ },
1901
+ number: {
1902
+ pattern: i(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source, "i"),
1903
+ lookbehind: true
1904
+ },
1905
+ tag: a,
1906
+ important: t,
1907
+ punctuation: /---|[:[\]{}\-,|>?]|\.\.\./
1908
+ };
1909
+ e.languages.yml = e.languages.yaml;
1910
+ })(r);
1911
+ r.languages["splunk-spl"] = {
1912
+ comment: /`comment\("(?:\\.|[^\\"])*"\)`/,
1913
+ string: {
1914
+ pattern: /"(?:\\.|[^\\"])*"/,
1915
+ greedy: true
1916
+ },
1917
+ // https://docs.splunk.com/Documentation/Splunk/7.3.0/SearchReference/ListOfSearchCommands
1918
+ keyword: /\b(?:abstract|accum|addcoltotals|addinfo|addtotals|analyzefields|anomalies|anomalousvalue|anomalydetection|append|appendcols|appendcsv|appendlookup|appendpipe|arules|associate|audit|autoregress|bin|bucket|bucketdir|chart|cluster|cofilter|collect|concurrency|contingency|convert|correlate|datamodel|dbinspect|dedup|delete|delta|diff|erex|eval|eventcount|eventstats|extract|fieldformat|fields|fieldsummary|filldown|fillnull|findtypes|folderize|foreach|format|from|gauge|gentimes|geom|geomfilter|geostats|head|highlight|history|iconify|input|inputcsv|inputlookup|iplocation|join|kmeans|kv|kvform|loadjob|localize|localop|lookup|makecontinuous|makemv|makeresults|map|mcollect|metadata|metasearch|meventcollect|mstats|multikv|multisearch|mvcombine|mvexpand|nomv|outlier|outputcsv|outputlookup|outputtext|overlap|pivot|predict|rangemap|rare|regex|relevancy|reltime|rename|replace|rest|return|reverse|rex|rtorder|run|savedsearch|script|scrub|search|searchtxn|selfjoin|sendemail|set|setfields|sichart|sirare|sistats|sitimechart|sitop|sort|spath|stats|strcat|streamstats|table|tags|tail|timechart|timewrap|top|transaction|transpose|trendline|tscollect|tstats|typeahead|typelearner|typer|union|uniq|untable|where|x11|xmlkv|xmlunescape|xpath|xyseries)\b/i,
1919
+ "operator-word": {
1920
+ pattern: /\b(?:and|as|by|not|or|xor)\b/i,
1921
+ alias: "operator"
1922
+ },
1923
+ function: /\b\w+(?=\s*\()/,
1924
+ property: /\b\w+(?=\s*=(?!=))/,
1925
+ date: {
1926
+ // MM/DD/YYYY(:HH:MM:SS)?
1927
+ pattern: /\b\d{1,2}\/\d{1,2}\/\d{1,4}(?:(?::\d{1,2}){3})?\b/,
1928
+ alias: "number"
1929
+ },
1930
+ number: /\b\d+(?:\.\d+)?\b/,
1931
+ boolean: /\b(?:f|false|t|true)\b/i,
1932
+ operator: /[<>=]=?|[-+*/%|]/,
1933
+ punctuation: /[()[\],]/
1934
+ };
1935
+ })();
1936
+ /***/
1937
+ /******/ }
1938
+ };
1939
+ /************************************************************************/
1940
+ /******/ // The module cache
1941
+ /******/ var t = {};
1942
+ /******/
1943
+ /******/ // The require function
1944
+ /******/ function a(n) {
1945
+ /******/ // Check if module is in cache
1946
+ /******/ var r = t[n];
1947
+ /******/ if (r !== undefined) {
1948
+ /******/ return r.exports;
1949
+ /******/ }
1950
+ /******/ // Create a new module (and put it into the cache)
1951
+ /******/ var s = t[n] = {
1952
+ /******/ // no module.id needed
1953
+ /******/ // no module.loaded needed
1954
+ /******/ exports: {}
1955
+ /******/ };
1956
+ /******/
1957
+ /******/ // Execute the module function
1958
+ /******/ e[n](s, s.exports, a);
1959
+ /******/
1960
+ /******/ // Return the exports of the module
1961
+ /******/ return s.exports;
1962
+ /******/ }
1963
+ /******/
1964
+ /************************************************************************/
1965
+ /******/ /* webpack/runtime/compat get default export */
1966
+ /******/ (() => {
1967
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
1968
+ /******/ a.n = e => {
1969
+ /******/ var t = e && e.__esModule ?
1970
+ /******/ () => e["default"]
1971
+ /******/ : () => e
1972
+ /******/;
1973
+ a.d(t, {
1974
+ a: t
1975
+ });
1976
+ /******/ return t;
1977
+ /******/ };
1978
+ /******/ })();
1979
+ /******/
1980
+ /******/ /* webpack/runtime/define property getters */
1981
+ /******/ (() => {
1982
+ /******/ // define getter functions for harmony exports
1983
+ /******/ a.d = (e, t) => {
1984
+ /******/ for (var n in t) {
1985
+ /******/ if (a.o(t, n) && !a.o(e, n)) {
1986
+ /******/ Object.defineProperty(e, n, {
1987
+ enumerable: true,
1988
+ get: t[n]
1989
+ });
1990
+ /******/ }
1991
+ /******/ }
1992
+ /******/ };
1993
+ /******/ })();
1994
+ /******/
1995
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
1996
+ /******/ (() => {
1997
+ /******/ a.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)
1998
+ /******/;
2213
1999
  })();
2214
-
2215
-
2216
- /***/ })
2217
-
2218
- /******/ });
2219
- /************************************************************************/
2220
- /******/ // The module cache
2221
- /******/ var __webpack_module_cache__ = {};
2222
- /******/
2223
- /******/ // The require function
2224
- /******/ function __webpack_require__(moduleId) {
2225
- /******/ // Check if module is in cache
2226
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
2227
- /******/ if (cachedModule !== undefined) {
2228
- /******/ return cachedModule.exports;
2229
- /******/ }
2230
- /******/ // Create a new module (and put it into the cache)
2231
- /******/ var module = __webpack_module_cache__[moduleId] = {
2232
- /******/ // no module.id needed
2233
- /******/ // no module.loaded needed
2234
- /******/ exports: {}
2235
- /******/ };
2236
- /******/
2237
- /******/ // Execute the module function
2238
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
2239
- /******/
2240
- /******/ // Return the exports of the module
2241
- /******/ return module.exports;
2242
- /******/ }
2243
- /******/
2244
- /************************************************************************/
2245
- /******/ /* webpack/runtime/compat get default export */
2246
- /******/ (() => {
2247
- /******/ // getDefaultExport function for compatibility with non-harmony modules
2248
- /******/ __webpack_require__.n = (module) => {
2249
- /******/ var getter = module && module.__esModule ?
2250
- /******/ () => (module['default']) :
2251
- /******/ () => (module);
2252
- /******/ __webpack_require__.d(getter, { a: getter });
2253
- /******/ return getter;
2254
- /******/ };
2255
- /******/ })();
2256
- /******/
2257
- /******/ /* webpack/runtime/define property getters */
2258
- /******/ (() => {
2259
- /******/ // define getter functions for harmony exports
2260
- /******/ __webpack_require__.d = (exports, definition) => {
2261
- /******/ for(var key in definition) {
2262
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
2263
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
2264
- /******/ }
2265
- /******/ }
2266
- /******/ };
2267
- /******/ })();
2268
- /******/
2269
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
2270
- /******/ (() => {
2271
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
2272
- /******/ })();
2273
- /******/
2274
- /******/ /* webpack/runtime/make namespace object */
2275
- /******/ (() => {
2276
- /******/ // define __esModule on exports
2277
- /******/ __webpack_require__.r = (exports) => {
2278
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
2279
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2280
- /******/ }
2281
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
2282
- /******/ };
2283
- /******/ })();
2284
- /******/
2285
- /************************************************************************/
2286
- var __webpack_exports__ = {};
2287
- // This entry need to be wrapped in an IIFE because it need to be in strict mode.
2288
- (() => {
2289
- "use strict";
2290
- // ESM COMPAT FLAG
2291
- __webpack_require__.r(__webpack_exports__);
2292
-
2293
- // EXPORTS
2294
- __webpack_require__.d(__webpack_exports__, {
2295
- "default": () => (/* reexport */ Code_Code)
2296
- });
2297
-
2298
- ;// CONCATENATED MODULE: external "react"
2299
- const external_react_namespaceObject = require("react");
2300
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_namespaceObject);
2301
- ;// CONCATENATED MODULE: external "prop-types"
2302
- const external_prop_types_namespaceObject = require("prop-types");
2303
- var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_namespaceObject);
2304
- ;// CONCATENATED MODULE: external "lodash/castArray"
2305
- const castArray_namespaceObject = require("lodash/castArray");
2306
- var castArray_default = /*#__PURE__*/__webpack_require__.n(castArray_namespaceObject);
2307
- ;// CONCATENATED MODULE: external "lodash/flatten"
2308
- const flatten_namespaceObject = require("lodash/flatten");
2309
- var flatten_default = /*#__PURE__*/__webpack_require__.n(flatten_namespaceObject);
2310
- ;// CONCATENATED MODULE: external "lodash/indexOf"
2311
- const indexOf_namespaceObject = require("lodash/indexOf");
2312
- var indexOf_default = /*#__PURE__*/__webpack_require__.n(indexOf_namespaceObject);
2313
- ;// CONCATENATED MODULE: external "lodash/repeat"
2314
- const repeat_namespaceObject = require("lodash/repeat");
2315
- var repeat_default = /*#__PURE__*/__webpack_require__.n(repeat_namespaceObject);
2316
- ;// CONCATENATED MODULE: external "lodash/times"
2317
- const times_namespaceObject = require("lodash/times");
2318
- var times_default = /*#__PURE__*/__webpack_require__.n(times_namespaceObject);
2319
- // EXTERNAL MODULE: ./src/Code/prism/prism.empty
2320
- var prism_empty = __webpack_require__(74);
2321
- var prism_empty_default = /*#__PURE__*/__webpack_require__.n(prism_empty);
2322
- ;// CONCATENATED MODULE: external "styled-components"
2323
- const external_styled_components_namespaceObject = require("styled-components");
2324
- var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_namespaceObject);
2325
- ;// CONCATENATED MODULE: external "@splunk/themes"
2326
- const themes_namespaceObject = require("@splunk/themes");
2327
- ;// CONCATENATED MODULE: ./src/Code/CodeStyles.ts
2328
-
2329
-
2330
- var Styled = external_styled_components_default().pre.withConfig({
2331
- displayName: "CodeStyles__Styled",
2332
- componentId: "sc-1eq4k68-0"
2333
- })(["", ";", " line-height:", ";text-align:left;tab-size:4;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;hyphens:none;overflow-x:auto;margin-bottom:1.3em;&:focus-visible{outline:solid ", ";}"], themes_namespaceObject.mixins.reset('block'), (0,themes_namespaceObject.pick)({
2334
- enterprise: {
2335
- dark: (0,external_styled_components_namespaceObject.css)(["color:", ";"], themes_namespaceObject.variables.gray92)
2336
- }
2337
- }), (0,themes_namespaceObject.pick)({
2338
- enterprise: '17px',
2339
- prisma: themes_namespaceObject.variables.lineHeight
2340
- }), themes_namespaceObject.variables.focusColor);
2341
- var StyledCode = external_styled_components_default().code.withConfig({
2342
- displayName: "CodeStyles__StyledCode",
2343
- componentId: "sc-1eq4k68-1"
2344
- })(["font-family:", ";"], themes_namespaceObject.variables.monoFontFamily);
2345
- var StyledIndent = external_styled_components_default().span.withConfig({
2346
- displayName: "CodeStyles__StyledIndent",
2347
- componentId: "sc-1eq4k68-2"
2348
- })(["&:not(:last-child){background-image:linear-gradient( to left,rgba(0,0,0,0.15) 1px,transparent 1px,transparent );}"]);
2349
- var gray = (0,themes_namespaceObject.pick)({
2350
- prisma: themes_namespaceObject.variables.syntaxGray,
2351
- enterprise: {
2352
- dark: themes_namespaceObject.variables.gray60,
2353
- light: themes_namespaceObject.variables.syntaxGray
2354
- }
2355
- });
2356
- var purple = (0,themes_namespaceObject.pick)({
2357
- prisma: themes_namespaceObject.variables.syntaxPurple,
2358
- enterprise: {
2359
- dark: themes_namespaceObject.variables.syntaxPurpleLight,
2360
- light: themes_namespaceObject.variables.syntaxPurple
2361
- }
2362
- });
2363
- var green = (0,themes_namespaceObject.pick)({
2364
- prisma: themes_namespaceObject.variables.syntaxGreen,
2365
- enterprise: {
2366
- dark: themes_namespaceObject.variables.syntaxGreenLight,
2367
- light: themes_namespaceObject.variables.syntaxGreen
2368
- }
2369
- });
2370
- var blue = (0,themes_namespaceObject.pick)({
2371
- prisma: themes_namespaceObject.variables.syntaxBlue,
2372
- enterprise: {
2373
- dark: themes_namespaceObject.variables.syntaxBlueLight,
2374
- light: themes_namespaceObject.variables.syntaxBlue
2375
- }
2376
- });
2377
- var red = (0,themes_namespaceObject.pick)({
2378
- prisma: themes_namespaceObject.variables.syntaxRed,
2379
- enterprise: {
2380
- dark: themes_namespaceObject.variables.syntaxRedLight,
2381
- light: themes_namespaceObject.variables.syntaxRed
2382
- }
2383
- });
2384
- var TokenColors = {
2385
- comment: gray,
2386
- prolog: gray,
2387
- doctype: gray,
2388
- cdata: gray,
2389
- punctuation: gray,
2390
- property: purple,
2391
- tag: purple,
2392
- "boolean": purple,
2393
- number: purple,
2394
- constant: purple,
2395
- symbol: purple,
2396
- deleted: purple,
2397
- key: purple,
2398
- selector: green,
2399
- 'attr-name': green,
2400
- string: green,
2401
- "char": green,
2402
- builtin: green,
2403
- inserted: green,
2404
- operator: themes_namespaceObject.variables.syntaxBrown,
2405
- entity: themes_namespaceObject.variables.syntaxBrown,
2406
- url: themes_namespaceObject.variables.syntaxBrown,
2407
- atrule: blue,
2408
- 'attr-value': blue,
2409
- keyword: blue,
2410
- "function": red,
2411
- regex: themes_namespaceObject.variables.syntaxOrange,
2412
- important: themes_namespaceObject.variables.syntaxOrange,
2413
- variable: themes_namespaceObject.variables.syntaxOrange
2414
- };
2415
- var StyledToken = external_styled_components_default().span.withConfig({
2416
- displayName: "CodeStyles__StyledToken",
2417
- componentId: "sc-1eq4k68-3"
2418
- })(["color:", ";cursor:", ";opacity:", ";font-style:", ";font-weight:", ";"], function (_ref) {
2419
- var partType = _ref.partType;
2420
- return TokenColors[partType];
2421
- }, function (_ref2) {
2422
- var partType = _ref2.partType;
2423
- return partType === 'entity' ? 'help' : null;
2424
- }, function (_ref3) {
2425
- var partType = _ref3.partType;
2426
- return partType === 'namespace' ? 0.7 : null;
2427
- }, function (_ref4) {
2428
- var partType = _ref4.partType;
2429
- return partType === 'italic' ? 'italic' : null;
2430
- }, function (_ref5) {
2431
- var partType = _ref5.partType;
2432
- return partType === 'important' || partType === 'bold' ? 'bold' : null;
2433
- });
2434
-
2435
- ;// CONCATENATED MODULE: ./src/Code/Code.tsx
2436
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2437
-
2438
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
2439
-
2440
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
2441
-
2442
-
2443
-
2444
-
2445
-
2446
-
2447
-
2448
- // Prism requires special handling to work around issues related to global scope and
2449
- // auto formatting. The import below points to an empty file which is replaced at build
2450
- // time, see ./prism/build-isolated-prism.js for details.
2451
-
2452
- // typed as 'prismjs'
2453
-
2454
-
2455
- var supportedLanguages = ['bash', 'clike', 'css', 'html', 'json', 'javascript', 'js', 'jsx', 'typescript', 'ts', 'tsx', 'markup', 'mathml', 'splunk-spl', 'svg', 'xml', 'yaml', 'yml'];
2456
-
2457
- function tokenize(text, language) {
2458
- return prism_empty_default().tokenize(text, (prism_empty_default()).languages[language]);
2459
- }
2460
-
2461
- var propTypes = {
2462
- elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
2463
- indentChars: (external_prop_types_default()).number,
2464
- language: external_prop_types_default().oneOf(supportedLanguages),
2465
- languageFallback: external_prop_types_default().oneOf(supportedLanguages),
2466
- showIndentGuide: (external_prop_types_default()).bool,
2467
- value: (external_prop_types_default()).string
2468
- };
2469
-
2470
- function Code(_ref) {
2471
- var elementRef = _ref.elementRef,
2472
- _ref$indentChars = _ref.indentChars,
2473
- indentChars = _ref$indentChars === void 0 ? 4 : _ref$indentChars,
2474
- language = _ref.language,
2475
- _ref$languageFallback = _ref.languageFallback,
2476
- languageFallback = _ref$languageFallback === void 0 ? 'javascript' : _ref$languageFallback,
2477
- _ref$showIndentGuide = _ref.showIndentGuide,
2478
- showIndentGuide = _ref$showIndentGuide === void 0 ? true : _ref$showIndentGuide,
2479
- _ref$value = _ref.value,
2480
- value = _ref$value === void 0 ? '' : _ref$value,
2481
- otherProps = _objectWithoutProperties(_ref, ["elementRef", "indentChars", "language", "languageFallback", "showIndentGuide", "value"]);
2482
-
2483
- // @docs-props-type CodePropsBase
2484
- var indentBlock = repeat_default()(' ', indentChars);
2485
-
2486
- var makeIndentGuide = function makeIndentGuide(spaces) {
2487
- var level = Math.floor(spaces / indentChars);
2488
- var rest = spaces % indentChars;
2489
- var spans = times_default()(level, function (idx) {
2490
- return /*#__PURE__*/external_react_default().createElement(StyledIndent, {
2491
- key: idx.toString()
2492
- }, indentBlock);
2493
- });
2494
-
2495
- if (rest) {
2496
- spans.push(repeat_default()(' ', rest));
2497
- }
2498
-
2499
- return spans;
2500
- }; // a fix for SUI-5425, where the Markdown component doesn't pass a valid language in some circumstances
2501
-
2502
-
2503
- var isSupportedLanguage = indexOf_default()(supportedLanguages, language) > -1;
2504
-
2505
- if (false) {}
2506
-
2507
- var languageUsed = isSupportedLanguage && language ? language : languageFallback;
2508
- var tokens = tokenize(value, languageUsed);
2509
-
2510
- var render = function render(tks) {
2511
- return castArray_default()(tks).map(function (part, idx) {
2512
- if (typeof part === 'string') {
2513
- if (!showIndentGuide) {
2514
- return part;
2000
+ /******/
2001
+ /******/ /* webpack/runtime/make namespace object */
2002
+ /******/ (() => {
2003
+ /******/ // define __esModule on exports
2004
+ /******/ a.r = e => {
2005
+ /******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
2006
+ /******/ Object.defineProperty(e, Symbol.toStringTag, {
2007
+ value: "Module"
2008
+ });
2009
+ /******/ }
2010
+ /******/ Object.defineProperty(e, "__esModule", {
2011
+ value: true
2012
+ });
2013
+ /******/ };
2014
+ /******/ })();
2015
+ /******/
2016
+ /************************************************************************/ var n = {};
2017
+ // This entry need to be wrapped in an IIFE because it need to be in strict mode.
2018
+ (() => {
2019
+ "use strict";
2020
+ // ESM COMPAT FLAG
2021
+ a.r(n);
2022
+ // EXPORTS
2023
+ a.d(n, {
2024
+ default: () => /* reexport */ L
2025
+ });
2026
+ // CONCATENATED MODULE: external "react"
2027
+ const e = require("react");
2028
+ var t = a.n(e);
2029
+ // CONCATENATED MODULE: external "prop-types"
2030
+ const r = require("prop-types");
2031
+ var s = a.n(r);
2032
+ // CONCATENATED MODULE: external "lodash/castArray"
2033
+ const i = require("lodash/castArray");
2034
+ var o = a.n(i);
2035
+ // CONCATENATED MODULE: external "lodash/flatten"
2036
+ const l = require("lodash/flatten");
2037
+ var u = a.n(l);
2038
+ // CONCATENATED MODULE: external "lodash/indexOf"
2039
+ const c = require("lodash/indexOf");
2040
+ var p = a.n(c);
2041
+ // CONCATENATED MODULE: external "lodash/repeat"
2042
+ const d = require("lodash/repeat");
2043
+ var g = a.n(d);
2044
+ // CONCATENATED MODULE: external "lodash/times"
2045
+ const f = require("lodash/times");
2046
+ var m = a.n(f);
2047
+ // EXTERNAL MODULE: ./src/Code/prism/prism.empty
2048
+ var h = a(74);
2049
+ var v = a.n(h);
2050
+ // CONCATENATED MODULE: external "styled-components"
2051
+ const b = require("styled-components");
2052
+ var y = a.n(b);
2053
+ // CONCATENATED MODULE: external "@splunk/themes"
2054
+ const k = require("@splunk/themes");
2055
+ // CONCATENATED MODULE: ./src/Code/CodeStyles.ts
2056
+ var x = y().pre.withConfig({
2057
+ displayName: "CodeStyles__Styled",
2058
+ componentId: "sc-1eq4k68-0"
2059
+ })([ "", ";", " line-height:", ";text-align:left;tab-size:4;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;hyphens:none;overflow-x:auto;margin-bottom:1.3em;&:focus-visible{outline:solid ", ";}" ], k.mixins.reset("block"), (0,
2060
+ k.pick)({
2061
+ enterprise: {
2062
+ dark: (0, b.css)([ "color:", ";" ], k.variables.gray92)
2063
+ }
2064
+ }), (0, k.pick)({
2065
+ enterprise: "17px",
2066
+ prisma: k.variables.lineHeight
2067
+ }), k.variables.focusColor);
2068
+ var S = y().code.withConfig({
2069
+ displayName: "CodeStyles__StyledCode",
2070
+ componentId: "sc-1eq4k68-1"
2071
+ })([ "font-family:", ";" ], k.variables.monoFontFamily);
2072
+ var A = y().span.withConfig({
2073
+ displayName: "CodeStyles__StyledIndent",
2074
+ componentId: "sc-1eq4k68-2"
2075
+ })([ "&:not(:last-child){background-image:linear-gradient( to left,rgba(0,0,0,0.15) 1px,transparent 1px,transparent );}" ]);
2076
+ var F = (0, k.pick)({
2077
+ prisma: k.variables.syntaxGray,
2078
+ enterprise: {
2079
+ dark: k.variables.gray60,
2080
+ light: k.variables.syntaxGray
2081
+ }
2082
+ });
2083
+ var w = (0, k.pick)({
2084
+ prisma: k.variables.syntaxPurple,
2085
+ enterprise: {
2086
+ dark: k.variables.syntaxPurpleLight,
2087
+ light: k.variables.syntaxPurple
2088
+ }
2089
+ });
2090
+ var E = (0, k.pick)({
2091
+ prisma: k.variables.syntaxGreen,
2092
+ enterprise: {
2093
+ dark: k.variables.syntaxGreenLight,
2094
+ light: k.variables.syntaxGreen
2095
+ }
2096
+ });
2097
+ var _ = (0, k.pick)({
2098
+ prisma: k.variables.syntaxBlue,
2099
+ enterprise: {
2100
+ dark: k.variables.syntaxBlueLight,
2101
+ light: k.variables.syntaxBlue
2102
+ }
2103
+ });
2104
+ var O = (0, k.pick)({
2105
+ prisma: k.variables.syntaxRed,
2106
+ enterprise: {
2107
+ dark: k.variables.syntaxRedLight,
2108
+ light: k.variables.syntaxRed
2109
+ }
2110
+ });
2111
+ var T = {
2112
+ comment: F,
2113
+ prolog: F,
2114
+ doctype: F,
2115
+ cdata: F,
2116
+ punctuation: F,
2117
+ property: w,
2118
+ tag: w,
2119
+ boolean: w,
2120
+ number: w,
2121
+ constant: w,
2122
+ symbol: w,
2123
+ deleted: w,
2124
+ key: w,
2125
+ selector: E,
2126
+ "attr-name": E,
2127
+ string: E,
2128
+ char: E,
2129
+ builtin: E,
2130
+ inserted: E,
2131
+ operator: k.variables.syntaxBrown,
2132
+ entity: k.variables.syntaxBrown,
2133
+ url: k.variables.syntaxBrown,
2134
+ atrule: _,
2135
+ "attr-value": _,
2136
+ keyword: _,
2137
+ function: O,
2138
+ regex: k.variables.syntaxOrange,
2139
+ important: k.variables.syntaxOrange,
2140
+ variable: k.variables.syntaxOrange
2141
+ };
2142
+ var I = y().span.withConfig({
2143
+ displayName: "CodeStyles__StyledToken",
2144
+ componentId: "sc-1eq4k68-3"
2145
+ })([ "color:", ";cursor:", ";opacity:", ";font-style:", ";font-weight:", ";" ], (function(e) {
2146
+ var t = e.partType;
2147
+ return T[t];
2148
+ }), (function(e) {
2149
+ var t = e.partType;
2150
+ return t === "entity" ? "help" : null;
2151
+ }), (function(e) {
2152
+ var t = e.partType;
2153
+ return t === "namespace" ? .7 : null;
2154
+ }), (function(e) {
2155
+ var t = e.partType;
2156
+ return t === "italic" ? "italic" : null;
2157
+ }), (function(e) {
2158
+ var t = e.partType;
2159
+ return t === "important" || t === "bold" ? "bold" : null;
2160
+ }));
2161
+ // CONCATENATED MODULE: ./src/Code/Code.tsx
2162
+ function $() {
2163
+ $ = Object.assign || function(e) {
2164
+ for (var t = 1; t < arguments.length; t++) {
2165
+ var a = arguments[t];
2166
+ for (var n in a) {
2167
+ if (Object.prototype.hasOwnProperty.call(a, n)) {
2168
+ e[n] = a[n];
2169
+ }
2170
+ }
2171
+ }
2172
+ return e;
2173
+ };
2174
+ return $.apply(this, arguments);
2515
2175
  }
2516
-
2517
- var lines = part.split('\n');
2518
-
2519
- if (lines.length === 1) {
2520
- return part;
2176
+ function N(e, t) {
2177
+ if (e == null) return {};
2178
+ var a = P(e, t);
2179
+ var n, r;
2180
+ if (Object.getOwnPropertySymbols) {
2181
+ var s = Object.getOwnPropertySymbols(e);
2182
+ for (r = 0; r < s.length; r++) {
2183
+ n = s[r];
2184
+ if (t.indexOf(n) >= 0) continue;
2185
+ if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
2186
+ a[n] = e[n];
2187
+ }
2188
+ }
2189
+ return a;
2521
2190
  }
2522
-
2523
- return flatten_default()(lines.map(function (line, lineNo) {
2524
- var res = lineNo === 0 ? [] : ['\n'];
2525
- var indentMatch = line.match(/^(\s+)(.*)/);
2526
-
2527
- if (!indentMatch) {
2528
- res.push(line);
2529
- } else {
2530
- res.push( /*#__PURE__*/external_react_default().createElement("span", {
2531
- key: "".concat(idx.toString(), ":").concat(lineNo.toString())
2532
- }, makeIndentGuide(indentMatch[1].length)), indentMatch[2]);
2533
- }
2534
-
2535
- return res;
2536
- }));
2537
- }
2538
-
2539
- var content = typeof part.content === 'string' ? part.content : render(part.content);
2540
- return /*#__PURE__*/external_react_default().createElement(StyledToken, {
2541
- "data-part-type": part.type,
2542
- partType: part.type,
2543
- key: idx.toString()
2544
- }, content);
2545
- });
2546
- };
2547
-
2548
- var codeContent = render(tokens);
2549
- return /*#__PURE__*/external_react_default().createElement(Styled, _extends({
2550
- "data-test": "code",
2551
- ref: elementRef,
2552
- tabIndex: 0
2553
- }, otherProps), /*#__PURE__*/external_react_default().createElement(StyledCode, {
2554
- className: "language-".concat(languageUsed)
2555
- }, codeContent));
2556
- }
2557
-
2558
- Code.propTypes = propTypes;
2559
- /* harmony default export */ const Code_Code = (Code);
2560
- ;// CONCATENATED MODULE: ./src/Code/index.ts
2561
-
2562
- })();
2563
-
2564
- module.exports = __webpack_exports__;
2565
- /******/ })()
2566
- ;
2191
+ function P(e, t) {
2192
+ if (e == null) return {};
2193
+ var a = {};
2194
+ var n = Object.keys(e);
2195
+ var r, s;
2196
+ for (s = 0; s < n.length; s++) {
2197
+ r = n[s];
2198
+ if (t.indexOf(r) >= 0) continue;
2199
+ a[r] = e[r];
2200
+ }
2201
+ return a;
2202
+ }
2203
+ // Prism requires special handling to work around issues related to global scope and
2204
+ // auto formatting. The import below points to an empty file which is replaced at build
2205
+ // time, see ./prism/build-isolated-prism.js for details.
2206
+ // typed as 'prismjs'
2207
+ var R = [ "bash", "clike", "css", "html", "json", "javascript", "js", "jsx", "typescript", "ts", "tsx", "markup", "mathml", "splunk-spl", "svg", "xml", "yaml", "yml" ];
2208
+ function C(e, t) {
2209
+ return v().tokenize(e, v().languages[t]);
2210
+ }
2211
+ var D = {
2212
+ elementRef: s().oneOfType([ s().func, s().object ]),
2213
+ indentChars: s().number,
2214
+ language: s().oneOf(R),
2215
+ languageFallback: s().oneOf(R),
2216
+ showIndentGuide: s().bool,
2217
+ value: s().string
2218
+ };
2219
+ function j(e) {
2220
+ var a = e.elementRef, n = e.indentChars, r = n === void 0 ? 4 : n, s = e.language, i = e.languageFallback, l = i === void 0 ? "javascript" : i, c = e.showIndentGuide, d = c === void 0 ? true : c, f = e.value, h = f === void 0 ? "" : f, v = N(e, [ "elementRef", "indentChars", "language", "languageFallback", "showIndentGuide", "value" ]);
2221
+ // @docs-props-type CodePropsBase
2222
+ var b = g()(" ", r);
2223
+ var y = function e(a) {
2224
+ var n = Math.floor(a / r);
2225
+ var s = a % r;
2226
+ var i = m()(n, (function(e) {
2227
+
2228
+ return t().createElement(A, {
2229
+ key: e.toString()
2230
+ }, b);
2231
+ }));
2232
+ if (s) {
2233
+ i.push(g()(" ", s));
2234
+ }
2235
+ return i;
2236
+ };
2237
+ // a fix for SUI-5425, where the Markdown component doesn't pass a valid language in some circumstances
2238
+ var k = p()(R, s) > -1;
2239
+ if (false) {}
2240
+ var F = k && s ? s : l;
2241
+ var w = C(h, F);
2242
+ var E = function e(a) {
2243
+ return o()(a).map((function(a, n) {
2244
+ if (typeof a === "string") {
2245
+ if (!d) {
2246
+ return a;
2247
+ }
2248
+ var r = a.split("\n");
2249
+ if (r.length === 1) {
2250
+ return a;
2251
+ }
2252
+ return u()(r.map((function(e, a) {
2253
+ var r = a === 0 ? [] : [ "\n" ];
2254
+ var s = e.match(/^(\s+)(.*)/);
2255
+ if (!s) {
2256
+ r.push(e);
2257
+ } else {
2258
+ r.push( t().createElement("span", {
2259
+ key: "".concat(n.toString(), ":").concat(a.toString())
2260
+ }, y(s[1].length)), s[2]);
2261
+ }
2262
+ return r;
2263
+ })));
2264
+ }
2265
+ var s = typeof a.content === "string" ? a.content : e(a.content);
2266
+
2267
+ return t().createElement(I, {
2268
+ "data-part-type": a.type,
2269
+ partType: a.type,
2270
+ key: n.toString()
2271
+ }, s);
2272
+ }));
2273
+ };
2274
+ var _ = E(w);
2275
+
2276
+ return t().createElement(x, $({
2277
+ "data-test": "code",
2278
+ ref: a,
2279
+ tabIndex: 0
2280
+ }, v), t().createElement(S, {
2281
+ className: "language-".concat(F)
2282
+ }, _));
2283
+ }
2284
+ j.propTypes = D;
2285
+ /* harmony default export */ const L = j;
2286
+ }) // CONCATENATED MODULE: ./src/Code/index.ts
2287
+ ();
2288
+ module.exports = n;
2289
+ /******/})();