@containerbase/istanbul-reports-html 0.0.0-semantic-realease

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.
package/vendor/hljs.js ADDED
@@ -0,0 +1,2398 @@
1
+ /* eslint-disable */ // @ts-nocheck
2
+ "use strict";
3
+ (() => {
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __commonJS = (cb, mod) => function __require() {
11
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+
30
+ // node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/core.js
31
+ var require_core = __commonJS({
32
+ "node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/core.js"(exports, module) {
33
+ function deepFreeze(obj) {
34
+ if (obj instanceof Map) {
35
+ obj.clear = obj.delete = obj.set = function() {
36
+ throw new Error("map is read-only");
37
+ };
38
+ } else if (obj instanceof Set) {
39
+ obj.add = obj.clear = obj.delete = function() {
40
+ throw new Error("set is read-only");
41
+ };
42
+ }
43
+ Object.freeze(obj);
44
+ Object.getOwnPropertyNames(obj).forEach((name) => {
45
+ const prop = obj[name];
46
+ const type = typeof prop;
47
+ if ((type === "object" || type === "function") && !Object.isFrozen(prop)) {
48
+ deepFreeze(prop);
49
+ }
50
+ });
51
+ return obj;
52
+ }
53
+ var Response = class {
54
+ /**
55
+ * @param {CompiledMode} mode
56
+ */
57
+ constructor(mode) {
58
+ if (mode.data === void 0) mode.data = {};
59
+ this.data = mode.data;
60
+ this.isMatchIgnored = false;
61
+ }
62
+ ignoreMatch() {
63
+ this.isMatchIgnored = true;
64
+ }
65
+ };
66
+ function escapeHTML(value) {
67
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;");
68
+ }
69
+ function inherit$1(original, ...objects) {
70
+ const result = /* @__PURE__ */ Object.create(null);
71
+ for (const key in original) {
72
+ result[key] = original[key];
73
+ }
74
+ objects.forEach(function(obj) {
75
+ for (const key in obj) {
76
+ result[key] = obj[key];
77
+ }
78
+ });
79
+ return (
80
+ /** @type {T} */
81
+ result
82
+ );
83
+ }
84
+ var SPAN_CLOSE = "</span>";
85
+ var emitsWrappingTags = (node) => {
86
+ return !!node.scope;
87
+ };
88
+ var scopeToCSSClass = (name, { prefix }) => {
89
+ if (name.startsWith("language:")) {
90
+ return name.replace("language:", "language-");
91
+ }
92
+ if (name.includes(".")) {
93
+ const pieces = name.split(".");
94
+ return [
95
+ `${prefix}${pieces.shift()}`,
96
+ ...pieces.map((x, i) => `${x}${"_".repeat(i + 1)}`)
97
+ ].join(" ");
98
+ }
99
+ return `${prefix}${name}`;
100
+ };
101
+ var HTMLRenderer = class {
102
+ /**
103
+ * Creates a new HTMLRenderer
104
+ *
105
+ * @param {Tree} parseTree - the parse tree (must support `walk` API)
106
+ * @param {{classPrefix: string}} options
107
+ */
108
+ constructor(parseTree, options) {
109
+ this.buffer = "";
110
+ this.classPrefix = options.classPrefix;
111
+ parseTree.walk(this);
112
+ }
113
+ /**
114
+ * Adds texts to the output stream
115
+ *
116
+ * @param {string} text */
117
+ addText(text) {
118
+ this.buffer += escapeHTML(text);
119
+ }
120
+ /**
121
+ * Adds a node open to the output stream (if needed)
122
+ *
123
+ * @param {Node} node */
124
+ openNode(node) {
125
+ if (!emitsWrappingTags(node)) return;
126
+ const className = scopeToCSSClass(
127
+ node.scope,
128
+ { prefix: this.classPrefix }
129
+ );
130
+ this.span(className);
131
+ }
132
+ /**
133
+ * Adds a node close to the output stream (if needed)
134
+ *
135
+ * @param {Node} node */
136
+ closeNode(node) {
137
+ if (!emitsWrappingTags(node)) return;
138
+ this.buffer += SPAN_CLOSE;
139
+ }
140
+ /**
141
+ * returns the accumulated buffer
142
+ */
143
+ value() {
144
+ return this.buffer;
145
+ }
146
+ // helpers
147
+ /**
148
+ * Builds a span element
149
+ *
150
+ * @param {string} className */
151
+ span(className) {
152
+ this.buffer += `<span class="${className}">`;
153
+ }
154
+ };
155
+ var newNode = (opts = {}) => {
156
+ const result = { children: [] };
157
+ Object.assign(result, opts);
158
+ return result;
159
+ };
160
+ var TokenTree = class _TokenTree {
161
+ constructor() {
162
+ this.rootNode = newNode();
163
+ this.stack = [this.rootNode];
164
+ }
165
+ get top() {
166
+ return this.stack[this.stack.length - 1];
167
+ }
168
+ get root() {
169
+ return this.rootNode;
170
+ }
171
+ /** @param {Node} node */
172
+ add(node) {
173
+ this.top.children.push(node);
174
+ }
175
+ /** @param {string} scope */
176
+ openNode(scope) {
177
+ const node = newNode({ scope });
178
+ this.add(node);
179
+ this.stack.push(node);
180
+ }
181
+ closeNode() {
182
+ if (this.stack.length > 1) {
183
+ return this.stack.pop();
184
+ }
185
+ return void 0;
186
+ }
187
+ closeAllNodes() {
188
+ while (this.closeNode()) ;
189
+ }
190
+ toJSON() {
191
+ return JSON.stringify(this.rootNode, null, 4);
192
+ }
193
+ /**
194
+ * @typedef { import("./html_renderer").Renderer } Renderer
195
+ * @param {Renderer} builder
196
+ */
197
+ walk(builder) {
198
+ return this.constructor._walk(builder, this.rootNode);
199
+ }
200
+ /**
201
+ * @param {Renderer} builder
202
+ * @param {Node} node
203
+ */
204
+ static _walk(builder, node) {
205
+ if (typeof node === "string") {
206
+ builder.addText(node);
207
+ } else if (node.children) {
208
+ builder.openNode(node);
209
+ node.children.forEach((child) => this._walk(builder, child));
210
+ builder.closeNode(node);
211
+ }
212
+ return builder;
213
+ }
214
+ /**
215
+ * @param {Node} node
216
+ */
217
+ static _collapse(node) {
218
+ if (typeof node === "string") return;
219
+ if (!node.children) return;
220
+ if (node.children.every((el) => typeof el === "string")) {
221
+ node.children = [node.children.join("")];
222
+ } else {
223
+ node.children.forEach((child) => {
224
+ _TokenTree._collapse(child);
225
+ });
226
+ }
227
+ }
228
+ };
229
+ var TokenTreeEmitter = class extends TokenTree {
230
+ /**
231
+ * @param {*} options
232
+ */
233
+ constructor(options) {
234
+ super();
235
+ this.options = options;
236
+ }
237
+ /**
238
+ * @param {string} text
239
+ */
240
+ addText(text) {
241
+ if (text === "") {
242
+ return;
243
+ }
244
+ this.add(text);
245
+ }
246
+ /** @param {string} scope */
247
+ startScope(scope) {
248
+ this.openNode(scope);
249
+ }
250
+ endScope() {
251
+ this.closeNode();
252
+ }
253
+ /**
254
+ * @param {Emitter & {root: DataNode}} emitter
255
+ * @param {string} name
256
+ */
257
+ __addSublanguage(emitter, name) {
258
+ const node = emitter.root;
259
+ if (name) node.scope = `language:${name}`;
260
+ this.add(node);
261
+ }
262
+ toHTML() {
263
+ const renderer = new HTMLRenderer(this, this.options);
264
+ return renderer.value();
265
+ }
266
+ finalize() {
267
+ this.closeAllNodes();
268
+ return true;
269
+ }
270
+ };
271
+ function source(re) {
272
+ if (!re) return null;
273
+ if (typeof re === "string") return re;
274
+ return re.source;
275
+ }
276
+ function lookahead(re) {
277
+ return concat("(?=", re, ")");
278
+ }
279
+ function anyNumberOfTimes(re) {
280
+ return concat("(?:", re, ")*");
281
+ }
282
+ function optional(re) {
283
+ return concat("(?:", re, ")?");
284
+ }
285
+ function concat(...args) {
286
+ const joined = args.map((x) => source(x)).join("");
287
+ return joined;
288
+ }
289
+ function stripOptionsFromArgs(args) {
290
+ const opts = args[args.length - 1];
291
+ if (typeof opts === "object" && opts.constructor === Object) {
292
+ args.splice(args.length - 1, 1);
293
+ return opts;
294
+ } else {
295
+ return {};
296
+ }
297
+ }
298
+ function either(...args) {
299
+ const opts = stripOptionsFromArgs(args);
300
+ const joined = "(" + (opts.capture ? "" : "?:") + args.map((x) => source(x)).join("|") + ")";
301
+ return joined;
302
+ }
303
+ function countMatchGroups(re) {
304
+ return new RegExp(re.toString() + "|").exec("").length - 1;
305
+ }
306
+ function startsWith(re, lexeme) {
307
+ const match = re && re.exec(lexeme);
308
+ return match && match.index === 0;
309
+ }
310
+ var BACKREF_RE = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;
311
+ function _rewriteBackreferences(regexps, { joinWith }) {
312
+ let numCaptures = 0;
313
+ return regexps.map((regex) => {
314
+ numCaptures += 1;
315
+ const offset = numCaptures;
316
+ let re = source(regex);
317
+ let out = "";
318
+ while (re.length > 0) {
319
+ const match = BACKREF_RE.exec(re);
320
+ if (!match) {
321
+ out += re;
322
+ break;
323
+ }
324
+ out += re.substring(0, match.index);
325
+ re = re.substring(match.index + match[0].length);
326
+ if (match[0][0] === "\\" && match[1]) {
327
+ out += "\\" + String(Number(match[1]) + offset);
328
+ } else {
329
+ out += match[0];
330
+ if (match[0] === "(") {
331
+ numCaptures++;
332
+ }
333
+ }
334
+ }
335
+ return out;
336
+ }).map((re) => `(${re})`).join(joinWith);
337
+ }
338
+ var MATCH_NOTHING_RE = /\b\B/;
339
+ var IDENT_RE2 = "[a-zA-Z]\\w*";
340
+ var UNDERSCORE_IDENT_RE = "[a-zA-Z_]\\w*";
341
+ var NUMBER_RE = "\\b\\d+(\\.\\d+)?";
342
+ var C_NUMBER_RE = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";
343
+ var BINARY_NUMBER_RE = "\\b(0b[01]+)";
344
+ var RE_STARTERS_RE = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";
345
+ var SHEBANG = (opts = {}) => {
346
+ const beginShebang = /^#![ ]*\//;
347
+ if (opts.binary) {
348
+ opts.begin = concat(
349
+ beginShebang,
350
+ /.*\b/,
351
+ opts.binary,
352
+ /\b.*/
353
+ );
354
+ }
355
+ return inherit$1({
356
+ scope: "meta",
357
+ begin: beginShebang,
358
+ end: /$/,
359
+ relevance: 0,
360
+ /** @type {ModeCallback} */
361
+ "on:begin": (m, resp) => {
362
+ if (m.index !== 0) resp.ignoreMatch();
363
+ }
364
+ }, opts);
365
+ };
366
+ var BACKSLASH_ESCAPE = {
367
+ begin: "\\\\[\\s\\S]",
368
+ relevance: 0
369
+ };
370
+ var APOS_STRING_MODE = {
371
+ scope: "string",
372
+ begin: "'",
373
+ end: "'",
374
+ illegal: "\\n",
375
+ contains: [BACKSLASH_ESCAPE]
376
+ };
377
+ var QUOTE_STRING_MODE = {
378
+ scope: "string",
379
+ begin: '"',
380
+ end: '"',
381
+ illegal: "\\n",
382
+ contains: [BACKSLASH_ESCAPE]
383
+ };
384
+ var PHRASAL_WORDS_MODE = {
385
+ begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/
386
+ };
387
+ var COMMENT = function(begin, end, modeOptions = {}) {
388
+ const mode = inherit$1(
389
+ {
390
+ scope: "comment",
391
+ begin,
392
+ end,
393
+ contains: []
394
+ },
395
+ modeOptions
396
+ );
397
+ mode.contains.push({
398
+ scope: "doctag",
399
+ // hack to avoid the space from being included. the space is necessary to
400
+ // match here to prevent the plain text rule below from gobbling up doctags
401
+ begin: "[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",
402
+ end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,
403
+ excludeBegin: true,
404
+ relevance: 0
405
+ });
406
+ const ENGLISH_WORD = either(
407
+ // list of common 1 and 2 letter words in English
408
+ "I",
409
+ "a",
410
+ "is",
411
+ "so",
412
+ "us",
413
+ "to",
414
+ "at",
415
+ "if",
416
+ "in",
417
+ "it",
418
+ "on",
419
+ // note: this is not an exhaustive list of contractions, just popular ones
420
+ /[A-Za-z]+['](d|ve|re|ll|t|s|n)/,
421
+ // contractions - can't we'd they're let's, etc
422
+ /[A-Za-z]+[-][a-z]+/,
423
+ // `no-way`, etc.
424
+ /[A-Za-z][a-z]{2,}/
425
+ // allow capitalized words at beginning of sentences
426
+ );
427
+ mode.contains.push(
428
+ {
429
+ // TODO: how to include ", (, ) without breaking grammars that use these for
430
+ // comment delimiters?
431
+ // begin: /[ ]+([()"]?([A-Za-z'-]{3,}|is|a|I|so|us|[tT][oO]|at|if|in|it|on)[.]?[()":]?([.][ ]|[ ]|\))){3}/
432
+ // ---
433
+ // this tries to find sequences of 3 english words in a row (without any
434
+ // "programming" type syntax) this gives us a strong signal that we've
435
+ // TRULY found a comment - vs perhaps scanning with the wrong language.
436
+ // It's possible to find something that LOOKS like the start of the
437
+ // comment - but then if there is no readable text - good chance it is a
438
+ // false match and not a comment.
439
+ //
440
+ // for a visual example please see:
441
+ // https://github.com/highlightjs/highlight.js/issues/2827
442
+ begin: concat(
443
+ /[ ]+/,
444
+ // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */
445
+ "(",
446
+ ENGLISH_WORD,
447
+ /[.]?[:]?([.][ ]|[ ])/,
448
+ "){3}"
449
+ )
450
+ // look for 3 words in a row
451
+ }
452
+ );
453
+ return mode;
454
+ };
455
+ var C_LINE_COMMENT_MODE = COMMENT("//", "$");
456
+ var C_BLOCK_COMMENT_MODE = COMMENT("/\\*", "\\*/");
457
+ var HASH_COMMENT_MODE = COMMENT("#", "$");
458
+ var NUMBER_MODE = {
459
+ scope: "number",
460
+ begin: NUMBER_RE,
461
+ relevance: 0
462
+ };
463
+ var C_NUMBER_MODE = {
464
+ scope: "number",
465
+ begin: C_NUMBER_RE,
466
+ relevance: 0
467
+ };
468
+ var BINARY_NUMBER_MODE = {
469
+ scope: "number",
470
+ begin: BINARY_NUMBER_RE,
471
+ relevance: 0
472
+ };
473
+ var REGEXP_MODE = {
474
+ scope: "regexp",
475
+ begin: /\/(?=[^/\n]*\/)/,
476
+ end: /\/[gimuy]*/,
477
+ contains: [
478
+ BACKSLASH_ESCAPE,
479
+ {
480
+ begin: /\[/,
481
+ end: /\]/,
482
+ relevance: 0,
483
+ contains: [BACKSLASH_ESCAPE]
484
+ }
485
+ ]
486
+ };
487
+ var TITLE_MODE = {
488
+ scope: "title",
489
+ begin: IDENT_RE2,
490
+ relevance: 0
491
+ };
492
+ var UNDERSCORE_TITLE_MODE = {
493
+ scope: "title",
494
+ begin: UNDERSCORE_IDENT_RE,
495
+ relevance: 0
496
+ };
497
+ var METHOD_GUARD = {
498
+ // excludes method names from keyword processing
499
+ begin: "\\.\\s*" + UNDERSCORE_IDENT_RE,
500
+ relevance: 0
501
+ };
502
+ var END_SAME_AS_BEGIN = function(mode) {
503
+ return Object.assign(
504
+ mode,
505
+ {
506
+ /** @type {ModeCallback} */
507
+ "on:begin": (m, resp) => {
508
+ resp.data._beginMatch = m[1];
509
+ },
510
+ /** @type {ModeCallback} */
511
+ "on:end": (m, resp) => {
512
+ if (resp.data._beginMatch !== m[1]) resp.ignoreMatch();
513
+ }
514
+ }
515
+ );
516
+ };
517
+ var MODES = /* @__PURE__ */ Object.freeze({
518
+ __proto__: null,
519
+ APOS_STRING_MODE,
520
+ BACKSLASH_ESCAPE,
521
+ BINARY_NUMBER_MODE,
522
+ BINARY_NUMBER_RE,
523
+ COMMENT,
524
+ C_BLOCK_COMMENT_MODE,
525
+ C_LINE_COMMENT_MODE,
526
+ C_NUMBER_MODE,
527
+ C_NUMBER_RE,
528
+ END_SAME_AS_BEGIN,
529
+ HASH_COMMENT_MODE,
530
+ IDENT_RE: IDENT_RE2,
531
+ MATCH_NOTHING_RE,
532
+ METHOD_GUARD,
533
+ NUMBER_MODE,
534
+ NUMBER_RE,
535
+ PHRASAL_WORDS_MODE,
536
+ QUOTE_STRING_MODE,
537
+ REGEXP_MODE,
538
+ RE_STARTERS_RE,
539
+ SHEBANG,
540
+ TITLE_MODE,
541
+ UNDERSCORE_IDENT_RE,
542
+ UNDERSCORE_TITLE_MODE
543
+ });
544
+ function skipIfHasPrecedingDot(match, response) {
545
+ const before = match.input[match.index - 1];
546
+ if (before === ".") {
547
+ response.ignoreMatch();
548
+ }
549
+ }
550
+ function scopeClassName(mode, _parent) {
551
+ if (mode.className !== void 0) {
552
+ mode.scope = mode.className;
553
+ delete mode.className;
554
+ }
555
+ }
556
+ function beginKeywords(mode, parent) {
557
+ if (!parent) return;
558
+ if (!mode.beginKeywords) return;
559
+ mode.begin = "\\b(" + mode.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)";
560
+ mode.__beforeBegin = skipIfHasPrecedingDot;
561
+ mode.keywords = mode.keywords || mode.beginKeywords;
562
+ delete mode.beginKeywords;
563
+ if (mode.relevance === void 0) mode.relevance = 0;
564
+ }
565
+ function compileIllegal(mode, _parent) {
566
+ if (!Array.isArray(mode.illegal)) return;
567
+ mode.illegal = either(...mode.illegal);
568
+ }
569
+ function compileMatch(mode, _parent) {
570
+ if (!mode.match) return;
571
+ if (mode.begin || mode.end) throw new Error("begin & end are not supported with match");
572
+ mode.begin = mode.match;
573
+ delete mode.match;
574
+ }
575
+ function compileRelevance(mode, _parent) {
576
+ if (mode.relevance === void 0) mode.relevance = 1;
577
+ }
578
+ var beforeMatchExt = (mode, parent) => {
579
+ if (!mode.beforeMatch) return;
580
+ if (mode.starts) throw new Error("beforeMatch cannot be used with starts");
581
+ const originalMode = Object.assign({}, mode);
582
+ Object.keys(mode).forEach((key) => {
583
+ delete mode[key];
584
+ });
585
+ mode.keywords = originalMode.keywords;
586
+ mode.begin = concat(originalMode.beforeMatch, lookahead(originalMode.begin));
587
+ mode.starts = {
588
+ relevance: 0,
589
+ contains: [
590
+ Object.assign(originalMode, { endsParent: true })
591
+ ]
592
+ };
593
+ mode.relevance = 0;
594
+ delete originalMode.beforeMatch;
595
+ };
596
+ var COMMON_KEYWORDS = [
597
+ "of",
598
+ "and",
599
+ "for",
600
+ "in",
601
+ "not",
602
+ "or",
603
+ "if",
604
+ "then",
605
+ "parent",
606
+ // common variable name
607
+ "list",
608
+ // common variable name
609
+ "value"
610
+ // common variable name
611
+ ];
612
+ var DEFAULT_KEYWORD_SCOPE = "keyword";
613
+ function compileKeywords(rawKeywords, caseInsensitive, scopeName = DEFAULT_KEYWORD_SCOPE) {
614
+ const compiledKeywords = /* @__PURE__ */ Object.create(null);
615
+ if (typeof rawKeywords === "string") {
616
+ compileList(scopeName, rawKeywords.split(" "));
617
+ } else if (Array.isArray(rawKeywords)) {
618
+ compileList(scopeName, rawKeywords);
619
+ } else {
620
+ Object.keys(rawKeywords).forEach(function(scopeName2) {
621
+ Object.assign(
622
+ compiledKeywords,
623
+ compileKeywords(rawKeywords[scopeName2], caseInsensitive, scopeName2)
624
+ );
625
+ });
626
+ }
627
+ return compiledKeywords;
628
+ function compileList(scopeName2, keywordList) {
629
+ if (caseInsensitive) {
630
+ keywordList = keywordList.map((x) => x.toLowerCase());
631
+ }
632
+ keywordList.forEach(function(keyword) {
633
+ const pair = keyword.split("|");
634
+ compiledKeywords[pair[0]] = [scopeName2, scoreForKeyword(pair[0], pair[1])];
635
+ });
636
+ }
637
+ }
638
+ function scoreForKeyword(keyword, providedScore) {
639
+ if (providedScore) {
640
+ return Number(providedScore);
641
+ }
642
+ return commonKeyword(keyword) ? 0 : 1;
643
+ }
644
+ function commonKeyword(keyword) {
645
+ return COMMON_KEYWORDS.includes(keyword.toLowerCase());
646
+ }
647
+ var seenDeprecations = {};
648
+ var error = (message) => {
649
+ console.error(message);
650
+ };
651
+ var warn = (message, ...args) => {
652
+ console.log(`WARN: ${message}`, ...args);
653
+ };
654
+ var deprecated = (version2, message) => {
655
+ if (seenDeprecations[`${version2}/${message}`]) return;
656
+ console.log(`Deprecated as of ${version2}. ${message}`);
657
+ seenDeprecations[`${version2}/${message}`] = true;
658
+ };
659
+ var MultiClassError = new Error();
660
+ function remapScopeNames(mode, regexes, { key }) {
661
+ let offset = 0;
662
+ const scopeNames = mode[key];
663
+ const emit = {};
664
+ const positions = {};
665
+ for (let i = 1; i <= regexes.length; i++) {
666
+ positions[i + offset] = scopeNames[i];
667
+ emit[i + offset] = true;
668
+ offset += countMatchGroups(regexes[i - 1]);
669
+ }
670
+ mode[key] = positions;
671
+ mode[key]._emit = emit;
672
+ mode[key]._multi = true;
673
+ }
674
+ function beginMultiClass(mode) {
675
+ if (!Array.isArray(mode.begin)) return;
676
+ if (mode.skip || mode.excludeBegin || mode.returnBegin) {
677
+ error("skip, excludeBegin, returnBegin not compatible with beginScope: {}");
678
+ throw MultiClassError;
679
+ }
680
+ if (typeof mode.beginScope !== "object" || mode.beginScope === null) {
681
+ error("beginScope must be object");
682
+ throw MultiClassError;
683
+ }
684
+ remapScopeNames(mode, mode.begin, { key: "beginScope" });
685
+ mode.begin = _rewriteBackreferences(mode.begin, { joinWith: "" });
686
+ }
687
+ function endMultiClass(mode) {
688
+ if (!Array.isArray(mode.end)) return;
689
+ if (mode.skip || mode.excludeEnd || mode.returnEnd) {
690
+ error("skip, excludeEnd, returnEnd not compatible with endScope: {}");
691
+ throw MultiClassError;
692
+ }
693
+ if (typeof mode.endScope !== "object" || mode.endScope === null) {
694
+ error("endScope must be object");
695
+ throw MultiClassError;
696
+ }
697
+ remapScopeNames(mode, mode.end, { key: "endScope" });
698
+ mode.end = _rewriteBackreferences(mode.end, { joinWith: "" });
699
+ }
700
+ function scopeSugar(mode) {
701
+ if (mode.scope && typeof mode.scope === "object" && mode.scope !== null) {
702
+ mode.beginScope = mode.scope;
703
+ delete mode.scope;
704
+ }
705
+ }
706
+ function MultiClass(mode) {
707
+ scopeSugar(mode);
708
+ if (typeof mode.beginScope === "string") {
709
+ mode.beginScope = { _wrap: mode.beginScope };
710
+ }
711
+ if (typeof mode.endScope === "string") {
712
+ mode.endScope = { _wrap: mode.endScope };
713
+ }
714
+ beginMultiClass(mode);
715
+ endMultiClass(mode);
716
+ }
717
+ function compileLanguage(language) {
718
+ function langRe(value, global) {
719
+ return new RegExp(
720
+ source(value),
721
+ "m" + (language.case_insensitive ? "i" : "") + (language.unicodeRegex ? "u" : "") + (global ? "g" : "")
722
+ );
723
+ }
724
+ class MultiRegex {
725
+ constructor() {
726
+ this.matchIndexes = {};
727
+ this.regexes = [];
728
+ this.matchAt = 1;
729
+ this.position = 0;
730
+ }
731
+ // @ts-ignore
732
+ addRule(re, opts) {
733
+ opts.position = this.position++;
734
+ this.matchIndexes[this.matchAt] = opts;
735
+ this.regexes.push([opts, re]);
736
+ this.matchAt += countMatchGroups(re) + 1;
737
+ }
738
+ compile() {
739
+ if (this.regexes.length === 0) {
740
+ this.exec = () => null;
741
+ }
742
+ const terminators = this.regexes.map((el) => el[1]);
743
+ this.matcherRe = langRe(_rewriteBackreferences(terminators, { joinWith: "|" }), true);
744
+ this.lastIndex = 0;
745
+ }
746
+ /** @param {string} s */
747
+ exec(s) {
748
+ this.matcherRe.lastIndex = this.lastIndex;
749
+ const match = this.matcherRe.exec(s);
750
+ if (!match) {
751
+ return null;
752
+ }
753
+ const i = match.findIndex((el, i2) => i2 > 0 && el !== void 0);
754
+ const matchData = this.matchIndexes[i];
755
+ match.splice(0, i);
756
+ return Object.assign(match, matchData);
757
+ }
758
+ }
759
+ class ResumableMultiRegex {
760
+ constructor() {
761
+ this.rules = [];
762
+ this.multiRegexes = [];
763
+ this.count = 0;
764
+ this.lastIndex = 0;
765
+ this.regexIndex = 0;
766
+ }
767
+ // @ts-ignore
768
+ getMatcher(index) {
769
+ if (this.multiRegexes[index]) return this.multiRegexes[index];
770
+ const matcher = new MultiRegex();
771
+ this.rules.slice(index).forEach(([re, opts]) => matcher.addRule(re, opts));
772
+ matcher.compile();
773
+ this.multiRegexes[index] = matcher;
774
+ return matcher;
775
+ }
776
+ resumingScanAtSamePosition() {
777
+ return this.regexIndex !== 0;
778
+ }
779
+ considerAll() {
780
+ this.regexIndex = 0;
781
+ }
782
+ // @ts-ignore
783
+ addRule(re, opts) {
784
+ this.rules.push([re, opts]);
785
+ if (opts.type === "begin") this.count++;
786
+ }
787
+ /** @param {string} s */
788
+ exec(s) {
789
+ const m = this.getMatcher(this.regexIndex);
790
+ m.lastIndex = this.lastIndex;
791
+ let result = m.exec(s);
792
+ if (this.resumingScanAtSamePosition()) {
793
+ if (result && result.index === this.lastIndex) ;
794
+ else {
795
+ const m2 = this.getMatcher(0);
796
+ m2.lastIndex = this.lastIndex + 1;
797
+ result = m2.exec(s);
798
+ }
799
+ }
800
+ if (result) {
801
+ this.regexIndex += result.position + 1;
802
+ if (this.regexIndex === this.count) {
803
+ this.considerAll();
804
+ }
805
+ }
806
+ return result;
807
+ }
808
+ }
809
+ function buildModeRegex(mode) {
810
+ const mm = new ResumableMultiRegex();
811
+ mode.contains.forEach((term) => mm.addRule(term.begin, { rule: term, type: "begin" }));
812
+ if (mode.terminatorEnd) {
813
+ mm.addRule(mode.terminatorEnd, { type: "end" });
814
+ }
815
+ if (mode.illegal) {
816
+ mm.addRule(mode.illegal, { type: "illegal" });
817
+ }
818
+ return mm;
819
+ }
820
+ function compileMode(mode, parent) {
821
+ const cmode = (
822
+ /** @type CompiledMode */
823
+ mode
824
+ );
825
+ if (mode.isCompiled) return cmode;
826
+ [
827
+ scopeClassName,
828
+ // do this early so compiler extensions generally don't have to worry about
829
+ // the distinction between match/begin
830
+ compileMatch,
831
+ MultiClass,
832
+ beforeMatchExt
833
+ ].forEach((ext) => ext(mode, parent));
834
+ language.compilerExtensions.forEach((ext) => ext(mode, parent));
835
+ mode.__beforeBegin = null;
836
+ [
837
+ beginKeywords,
838
+ // do this later so compiler extensions that come earlier have access to the
839
+ // raw array if they wanted to perhaps manipulate it, etc.
840
+ compileIllegal,
841
+ // default to 1 relevance if not specified
842
+ compileRelevance
843
+ ].forEach((ext) => ext(mode, parent));
844
+ mode.isCompiled = true;
845
+ let keywordPattern = null;
846
+ if (typeof mode.keywords === "object" && mode.keywords.$pattern) {
847
+ mode.keywords = Object.assign({}, mode.keywords);
848
+ keywordPattern = mode.keywords.$pattern;
849
+ delete mode.keywords.$pattern;
850
+ }
851
+ keywordPattern = keywordPattern || /\w+/;
852
+ if (mode.keywords) {
853
+ mode.keywords = compileKeywords(mode.keywords, language.case_insensitive);
854
+ }
855
+ cmode.keywordPatternRe = langRe(keywordPattern, true);
856
+ if (parent) {
857
+ if (!mode.begin) mode.begin = /\B|\b/;
858
+ cmode.beginRe = langRe(cmode.begin);
859
+ if (!mode.end && !mode.endsWithParent) mode.end = /\B|\b/;
860
+ if (mode.end) cmode.endRe = langRe(cmode.end);
861
+ cmode.terminatorEnd = source(cmode.end) || "";
862
+ if (mode.endsWithParent && parent.terminatorEnd) {
863
+ cmode.terminatorEnd += (mode.end ? "|" : "") + parent.terminatorEnd;
864
+ }
865
+ }
866
+ if (mode.illegal) cmode.illegalRe = langRe(
867
+ /** @type {RegExp | string} */
868
+ mode.illegal
869
+ );
870
+ if (!mode.contains) mode.contains = [];
871
+ mode.contains = [].concat(...mode.contains.map(function(c) {
872
+ return expandOrCloneMode(c === "self" ? mode : c);
873
+ }));
874
+ mode.contains.forEach(function(c) {
875
+ compileMode(
876
+ /** @type Mode */
877
+ c,
878
+ cmode
879
+ );
880
+ });
881
+ if (mode.starts) {
882
+ compileMode(mode.starts, parent);
883
+ }
884
+ cmode.matcher = buildModeRegex(cmode);
885
+ return cmode;
886
+ }
887
+ if (!language.compilerExtensions) language.compilerExtensions = [];
888
+ if (language.contains && language.contains.includes("self")) {
889
+ throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");
890
+ }
891
+ language.classNameAliases = inherit$1(language.classNameAliases || {});
892
+ return compileMode(
893
+ /** @type Mode */
894
+ language
895
+ );
896
+ }
897
+ function dependencyOnParent(mode) {
898
+ if (!mode) return false;
899
+ return mode.endsWithParent || dependencyOnParent(mode.starts);
900
+ }
901
+ function expandOrCloneMode(mode) {
902
+ if (mode.variants && !mode.cachedVariants) {
903
+ mode.cachedVariants = mode.variants.map(function(variant) {
904
+ return inherit$1(mode, { variants: null }, variant);
905
+ });
906
+ }
907
+ if (mode.cachedVariants) {
908
+ return mode.cachedVariants;
909
+ }
910
+ if (dependencyOnParent(mode)) {
911
+ return inherit$1(mode, { starts: mode.starts ? inherit$1(mode.starts) : null });
912
+ }
913
+ if (Object.isFrozen(mode)) {
914
+ return inherit$1(mode);
915
+ }
916
+ return mode;
917
+ }
918
+ var version = "11.11.1";
919
+ var HTMLInjectionError = class extends Error {
920
+ constructor(reason, html) {
921
+ super(reason);
922
+ this.name = "HTMLInjectionError";
923
+ this.html = html;
924
+ }
925
+ };
926
+ var escape = escapeHTML;
927
+ var inherit = inherit$1;
928
+ var NO_MATCH = Symbol("nomatch");
929
+ var MAX_KEYWORD_HITS = 7;
930
+ var HLJS = function(hljs) {
931
+ const languages = /* @__PURE__ */ Object.create(null);
932
+ const aliases = /* @__PURE__ */ Object.create(null);
933
+ const plugins = [];
934
+ let SAFE_MODE = true;
935
+ const LANGUAGE_NOT_FOUND = "Could not find the language '{}', did you forget to load/include a language module?";
936
+ const PLAINTEXT_LANGUAGE = { disableAutodetect: true, name: "Plain text", contains: [] };
937
+ let options = {
938
+ ignoreUnescapedHTML: false,
939
+ throwUnescapedHTML: false,
940
+ noHighlightRe: /^(no-?highlight)$/i,
941
+ languageDetectRe: /\blang(?:uage)?-([\w-]+)\b/i,
942
+ classPrefix: "hljs-",
943
+ cssSelector: "pre code",
944
+ languages: null,
945
+ // beta configuration options, subject to change, welcome to discuss
946
+ // https://github.com/highlightjs/highlight.js/issues/1086
947
+ __emitter: TokenTreeEmitter
948
+ };
949
+ function shouldNotHighlight(languageName) {
950
+ return options.noHighlightRe.test(languageName);
951
+ }
952
+ function blockLanguage(block) {
953
+ let classes = block.className + " ";
954
+ classes += block.parentNode ? block.parentNode.className : "";
955
+ const match = options.languageDetectRe.exec(classes);
956
+ if (match) {
957
+ const language = getLanguage(match[1]);
958
+ if (!language) {
959
+ warn(LANGUAGE_NOT_FOUND.replace("{}", match[1]));
960
+ warn("Falling back to no-highlight mode for this block.", block);
961
+ }
962
+ return language ? match[1] : "no-highlight";
963
+ }
964
+ return classes.split(/\s+/).find((_class) => shouldNotHighlight(_class) || getLanguage(_class));
965
+ }
966
+ function highlight2(codeOrLanguageName, optionsOrCode, ignoreIllegals) {
967
+ let code = "";
968
+ let languageName = "";
969
+ if (typeof optionsOrCode === "object") {
970
+ code = codeOrLanguageName;
971
+ ignoreIllegals = optionsOrCode.ignoreIllegals;
972
+ languageName = optionsOrCode.language;
973
+ } else {
974
+ deprecated("10.7.0", "highlight(lang, code, ...args) has been deprecated.");
975
+ deprecated("10.7.0", "Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277");
976
+ languageName = codeOrLanguageName;
977
+ code = optionsOrCode;
978
+ }
979
+ if (ignoreIllegals === void 0) {
980
+ ignoreIllegals = true;
981
+ }
982
+ const context = {
983
+ code,
984
+ language: languageName
985
+ };
986
+ fire("before:highlight", context);
987
+ const result = context.result ? context.result : _highlight(context.language, context.code, ignoreIllegals);
988
+ result.code = context.code;
989
+ fire("after:highlight", result);
990
+ return result;
991
+ }
992
+ function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) {
993
+ const keywordHits = /* @__PURE__ */ Object.create(null);
994
+ function keywordData(mode, matchText) {
995
+ return mode.keywords[matchText];
996
+ }
997
+ function processKeywords() {
998
+ if (!top.keywords) {
999
+ emitter.addText(modeBuffer);
1000
+ return;
1001
+ }
1002
+ let lastIndex = 0;
1003
+ top.keywordPatternRe.lastIndex = 0;
1004
+ let match = top.keywordPatternRe.exec(modeBuffer);
1005
+ let buf = "";
1006
+ while (match) {
1007
+ buf += modeBuffer.substring(lastIndex, match.index);
1008
+ const word = language.case_insensitive ? match[0].toLowerCase() : match[0];
1009
+ const data = keywordData(top, word);
1010
+ if (data) {
1011
+ const [kind, keywordRelevance] = data;
1012
+ emitter.addText(buf);
1013
+ buf = "";
1014
+ keywordHits[word] = (keywordHits[word] || 0) + 1;
1015
+ if (keywordHits[word] <= MAX_KEYWORD_HITS) relevance += keywordRelevance;
1016
+ if (kind.startsWith("_")) {
1017
+ buf += match[0];
1018
+ } else {
1019
+ const cssClass = language.classNameAliases[kind] || kind;
1020
+ emitKeyword(match[0], cssClass);
1021
+ }
1022
+ } else {
1023
+ buf += match[0];
1024
+ }
1025
+ lastIndex = top.keywordPatternRe.lastIndex;
1026
+ match = top.keywordPatternRe.exec(modeBuffer);
1027
+ }
1028
+ buf += modeBuffer.substring(lastIndex);
1029
+ emitter.addText(buf);
1030
+ }
1031
+ function processSubLanguage() {
1032
+ if (modeBuffer === "") return;
1033
+ let result2 = null;
1034
+ if (typeof top.subLanguage === "string") {
1035
+ if (!languages[top.subLanguage]) {
1036
+ emitter.addText(modeBuffer);
1037
+ return;
1038
+ }
1039
+ result2 = _highlight(top.subLanguage, modeBuffer, true, continuations[top.subLanguage]);
1040
+ continuations[top.subLanguage] = /** @type {CompiledMode} */
1041
+ result2._top;
1042
+ } else {
1043
+ result2 = highlightAuto(modeBuffer, top.subLanguage.length ? top.subLanguage : null);
1044
+ }
1045
+ if (top.relevance > 0) {
1046
+ relevance += result2.relevance;
1047
+ }
1048
+ emitter.__addSublanguage(result2._emitter, result2.language);
1049
+ }
1050
+ function processBuffer() {
1051
+ if (top.subLanguage != null) {
1052
+ processSubLanguage();
1053
+ } else {
1054
+ processKeywords();
1055
+ }
1056
+ modeBuffer = "";
1057
+ }
1058
+ function emitKeyword(keyword, scope) {
1059
+ if (keyword === "") return;
1060
+ emitter.startScope(scope);
1061
+ emitter.addText(keyword);
1062
+ emitter.endScope();
1063
+ }
1064
+ function emitMultiClass(scope, match) {
1065
+ let i = 1;
1066
+ const max = match.length - 1;
1067
+ while (i <= max) {
1068
+ if (!scope._emit[i]) {
1069
+ i++;
1070
+ continue;
1071
+ }
1072
+ const klass = language.classNameAliases[scope[i]] || scope[i];
1073
+ const text = match[i];
1074
+ if (klass) {
1075
+ emitKeyword(text, klass);
1076
+ } else {
1077
+ modeBuffer = text;
1078
+ processKeywords();
1079
+ modeBuffer = "";
1080
+ }
1081
+ i++;
1082
+ }
1083
+ }
1084
+ function startNewMode(mode, match) {
1085
+ if (mode.scope && typeof mode.scope === "string") {
1086
+ emitter.openNode(language.classNameAliases[mode.scope] || mode.scope);
1087
+ }
1088
+ if (mode.beginScope) {
1089
+ if (mode.beginScope._wrap) {
1090
+ emitKeyword(modeBuffer, language.classNameAliases[mode.beginScope._wrap] || mode.beginScope._wrap);
1091
+ modeBuffer = "";
1092
+ } else if (mode.beginScope._multi) {
1093
+ emitMultiClass(mode.beginScope, match);
1094
+ modeBuffer = "";
1095
+ }
1096
+ }
1097
+ top = Object.create(mode, { parent: { value: top } });
1098
+ return top;
1099
+ }
1100
+ function endOfMode(mode, match, matchPlusRemainder) {
1101
+ let matched = startsWith(mode.endRe, matchPlusRemainder);
1102
+ if (matched) {
1103
+ if (mode["on:end"]) {
1104
+ const resp = new Response(mode);
1105
+ mode["on:end"](match, resp);
1106
+ if (resp.isMatchIgnored) matched = false;
1107
+ }
1108
+ if (matched) {
1109
+ while (mode.endsParent && mode.parent) {
1110
+ mode = mode.parent;
1111
+ }
1112
+ return mode;
1113
+ }
1114
+ }
1115
+ if (mode.endsWithParent) {
1116
+ return endOfMode(mode.parent, match, matchPlusRemainder);
1117
+ }
1118
+ }
1119
+ function doIgnore(lexeme) {
1120
+ if (top.matcher.regexIndex === 0) {
1121
+ modeBuffer += lexeme[0];
1122
+ return 1;
1123
+ } else {
1124
+ resumeScanAtSamePosition = true;
1125
+ return 0;
1126
+ }
1127
+ }
1128
+ function doBeginMatch(match) {
1129
+ const lexeme = match[0];
1130
+ const newMode = match.rule;
1131
+ const resp = new Response(newMode);
1132
+ const beforeCallbacks = [newMode.__beforeBegin, newMode["on:begin"]];
1133
+ for (const cb of beforeCallbacks) {
1134
+ if (!cb) continue;
1135
+ cb(match, resp);
1136
+ if (resp.isMatchIgnored) return doIgnore(lexeme);
1137
+ }
1138
+ if (newMode.skip) {
1139
+ modeBuffer += lexeme;
1140
+ } else {
1141
+ if (newMode.excludeBegin) {
1142
+ modeBuffer += lexeme;
1143
+ }
1144
+ processBuffer();
1145
+ if (!newMode.returnBegin && !newMode.excludeBegin) {
1146
+ modeBuffer = lexeme;
1147
+ }
1148
+ }
1149
+ startNewMode(newMode, match);
1150
+ return newMode.returnBegin ? 0 : lexeme.length;
1151
+ }
1152
+ function doEndMatch(match) {
1153
+ const lexeme = match[0];
1154
+ const matchPlusRemainder = codeToHighlight.substring(match.index);
1155
+ const endMode = endOfMode(top, match, matchPlusRemainder);
1156
+ if (!endMode) {
1157
+ return NO_MATCH;
1158
+ }
1159
+ const origin = top;
1160
+ if (top.endScope && top.endScope._wrap) {
1161
+ processBuffer();
1162
+ emitKeyword(lexeme, top.endScope._wrap);
1163
+ } else if (top.endScope && top.endScope._multi) {
1164
+ processBuffer();
1165
+ emitMultiClass(top.endScope, match);
1166
+ } else if (origin.skip) {
1167
+ modeBuffer += lexeme;
1168
+ } else {
1169
+ if (!(origin.returnEnd || origin.excludeEnd)) {
1170
+ modeBuffer += lexeme;
1171
+ }
1172
+ processBuffer();
1173
+ if (origin.excludeEnd) {
1174
+ modeBuffer = lexeme;
1175
+ }
1176
+ }
1177
+ do {
1178
+ if (top.scope) {
1179
+ emitter.closeNode();
1180
+ }
1181
+ if (!top.skip && !top.subLanguage) {
1182
+ relevance += top.relevance;
1183
+ }
1184
+ top = top.parent;
1185
+ } while (top !== endMode.parent);
1186
+ if (endMode.starts) {
1187
+ startNewMode(endMode.starts, match);
1188
+ }
1189
+ return origin.returnEnd ? 0 : lexeme.length;
1190
+ }
1191
+ function processContinuations() {
1192
+ const list = [];
1193
+ for (let current = top; current !== language; current = current.parent) {
1194
+ if (current.scope) {
1195
+ list.unshift(current.scope);
1196
+ }
1197
+ }
1198
+ list.forEach((item) => emitter.openNode(item));
1199
+ }
1200
+ let lastMatch = {};
1201
+ function processLexeme(textBeforeMatch, match) {
1202
+ const lexeme = match && match[0];
1203
+ modeBuffer += textBeforeMatch;
1204
+ if (lexeme == null) {
1205
+ processBuffer();
1206
+ return 0;
1207
+ }
1208
+ if (lastMatch.type === "begin" && match.type === "end" && lastMatch.index === match.index && lexeme === "") {
1209
+ modeBuffer += codeToHighlight.slice(match.index, match.index + 1);
1210
+ if (!SAFE_MODE) {
1211
+ const err = new Error(`0 width match regex (${languageName})`);
1212
+ err.languageName = languageName;
1213
+ err.badRule = lastMatch.rule;
1214
+ throw err;
1215
+ }
1216
+ return 1;
1217
+ }
1218
+ lastMatch = match;
1219
+ if (match.type === "begin") {
1220
+ return doBeginMatch(match);
1221
+ } else if (match.type === "illegal" && !ignoreIllegals) {
1222
+ const err = new Error('Illegal lexeme "' + lexeme + '" for mode "' + (top.scope || "<unnamed>") + '"');
1223
+ err.mode = top;
1224
+ throw err;
1225
+ } else if (match.type === "end") {
1226
+ const processed = doEndMatch(match);
1227
+ if (processed !== NO_MATCH) {
1228
+ return processed;
1229
+ }
1230
+ }
1231
+ if (match.type === "illegal" && lexeme === "") {
1232
+ modeBuffer += "\n";
1233
+ return 1;
1234
+ }
1235
+ if (iterations > 1e5 && iterations > match.index * 3) {
1236
+ const err = new Error("potential infinite loop, way more iterations than matches");
1237
+ throw err;
1238
+ }
1239
+ modeBuffer += lexeme;
1240
+ return lexeme.length;
1241
+ }
1242
+ const language = getLanguage(languageName);
1243
+ if (!language) {
1244
+ error(LANGUAGE_NOT_FOUND.replace("{}", languageName));
1245
+ throw new Error('Unknown language: "' + languageName + '"');
1246
+ }
1247
+ const md = compileLanguage(language);
1248
+ let result = "";
1249
+ let top = continuation || md;
1250
+ const continuations = {};
1251
+ const emitter = new options.__emitter(options);
1252
+ processContinuations();
1253
+ let modeBuffer = "";
1254
+ let relevance = 0;
1255
+ let index = 0;
1256
+ let iterations = 0;
1257
+ let resumeScanAtSamePosition = false;
1258
+ try {
1259
+ if (!language.__emitTokens) {
1260
+ top.matcher.considerAll();
1261
+ for (; ; ) {
1262
+ iterations++;
1263
+ if (resumeScanAtSamePosition) {
1264
+ resumeScanAtSamePosition = false;
1265
+ } else {
1266
+ top.matcher.considerAll();
1267
+ }
1268
+ top.matcher.lastIndex = index;
1269
+ const match = top.matcher.exec(codeToHighlight);
1270
+ if (!match) break;
1271
+ const beforeMatch = codeToHighlight.substring(index, match.index);
1272
+ const processedCount = processLexeme(beforeMatch, match);
1273
+ index = match.index + processedCount;
1274
+ }
1275
+ processLexeme(codeToHighlight.substring(index));
1276
+ } else {
1277
+ language.__emitTokens(codeToHighlight, emitter);
1278
+ }
1279
+ emitter.finalize();
1280
+ result = emitter.toHTML();
1281
+ return {
1282
+ language: languageName,
1283
+ value: result,
1284
+ relevance,
1285
+ illegal: false,
1286
+ _emitter: emitter,
1287
+ _top: top
1288
+ };
1289
+ } catch (err) {
1290
+ if (err.message && err.message.includes("Illegal")) {
1291
+ return {
1292
+ language: languageName,
1293
+ value: escape(codeToHighlight),
1294
+ illegal: true,
1295
+ relevance: 0,
1296
+ _illegalBy: {
1297
+ message: err.message,
1298
+ index,
1299
+ context: codeToHighlight.slice(index - 100, index + 100),
1300
+ mode: err.mode,
1301
+ resultSoFar: result
1302
+ },
1303
+ _emitter: emitter
1304
+ };
1305
+ } else if (SAFE_MODE) {
1306
+ return {
1307
+ language: languageName,
1308
+ value: escape(codeToHighlight),
1309
+ illegal: false,
1310
+ relevance: 0,
1311
+ errorRaised: err,
1312
+ _emitter: emitter,
1313
+ _top: top
1314
+ };
1315
+ } else {
1316
+ throw err;
1317
+ }
1318
+ }
1319
+ }
1320
+ function justTextHighlightResult(code) {
1321
+ const result = {
1322
+ value: escape(code),
1323
+ illegal: false,
1324
+ relevance: 0,
1325
+ _top: PLAINTEXT_LANGUAGE,
1326
+ _emitter: new options.__emitter(options)
1327
+ };
1328
+ result._emitter.addText(code);
1329
+ return result;
1330
+ }
1331
+ function highlightAuto(code, languageSubset) {
1332
+ languageSubset = languageSubset || options.languages || Object.keys(languages);
1333
+ const plaintext = justTextHighlightResult(code);
1334
+ const results = languageSubset.filter(getLanguage).filter(autoDetection).map(
1335
+ (name) => _highlight(name, code, false)
1336
+ );
1337
+ results.unshift(plaintext);
1338
+ const sorted = results.sort((a, b) => {
1339
+ if (a.relevance !== b.relevance) return b.relevance - a.relevance;
1340
+ if (a.language && b.language) {
1341
+ if (getLanguage(a.language).supersetOf === b.language) {
1342
+ return 1;
1343
+ } else if (getLanguage(b.language).supersetOf === a.language) {
1344
+ return -1;
1345
+ }
1346
+ }
1347
+ return 0;
1348
+ });
1349
+ const [best, secondBest] = sorted;
1350
+ const result = best;
1351
+ result.secondBest = secondBest;
1352
+ return result;
1353
+ }
1354
+ function updateClassName(element, currentLang, resultLang) {
1355
+ const language = currentLang && aliases[currentLang] || resultLang;
1356
+ element.classList.add("hljs");
1357
+ element.classList.add(`language-${language}`);
1358
+ }
1359
+ function highlightElement(element) {
1360
+ let node = null;
1361
+ const language = blockLanguage(element);
1362
+ if (shouldNotHighlight(language)) return;
1363
+ fire(
1364
+ "before:highlightElement",
1365
+ { el: element, language }
1366
+ );
1367
+ if (element.dataset.highlighted) {
1368
+ console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.", element);
1369
+ return;
1370
+ }
1371
+ if (element.children.length > 0) {
1372
+ if (!options.ignoreUnescapedHTML) {
1373
+ console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk.");
1374
+ console.warn("https://github.com/highlightjs/highlight.js/wiki/security");
1375
+ console.warn("The element with unescaped HTML:");
1376
+ console.warn(element);
1377
+ }
1378
+ if (options.throwUnescapedHTML) {
1379
+ const err = new HTMLInjectionError(
1380
+ "One of your code blocks includes unescaped HTML.",
1381
+ element.innerHTML
1382
+ );
1383
+ throw err;
1384
+ }
1385
+ }
1386
+ node = element;
1387
+ const text = node.textContent;
1388
+ const result = language ? highlight2(text, { language, ignoreIllegals: true }) : highlightAuto(text);
1389
+ element.innerHTML = result.value;
1390
+ element.dataset.highlighted = "yes";
1391
+ updateClassName(element, language, result.language);
1392
+ element.result = {
1393
+ language: result.language,
1394
+ // TODO: remove with version 11.0
1395
+ re: result.relevance,
1396
+ relevance: result.relevance
1397
+ };
1398
+ if (result.secondBest) {
1399
+ element.secondBest = {
1400
+ language: result.secondBest.language,
1401
+ relevance: result.secondBest.relevance
1402
+ };
1403
+ }
1404
+ fire("after:highlightElement", { el: element, result, text });
1405
+ }
1406
+ function configure(userOptions) {
1407
+ options = inherit(options, userOptions);
1408
+ }
1409
+ const initHighlighting = () => {
1410
+ highlightAll();
1411
+ deprecated("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
1412
+ };
1413
+ function initHighlightingOnLoad() {
1414
+ highlightAll();
1415
+ deprecated("10.6.0", "initHighlightingOnLoad() deprecated. Use highlightAll() now.");
1416
+ }
1417
+ let wantsHighlight = false;
1418
+ function highlightAll() {
1419
+ function boot() {
1420
+ highlightAll();
1421
+ }
1422
+ if (document.readyState === "loading") {
1423
+ if (!wantsHighlight) {
1424
+ window.addEventListener("DOMContentLoaded", boot, false);
1425
+ }
1426
+ wantsHighlight = true;
1427
+ return;
1428
+ }
1429
+ const blocks = document.querySelectorAll(options.cssSelector);
1430
+ blocks.forEach(highlightElement);
1431
+ }
1432
+ function registerLanguage(languageName, languageDefinition) {
1433
+ let lang = null;
1434
+ try {
1435
+ lang = languageDefinition(hljs);
1436
+ } catch (error$1) {
1437
+ error("Language definition for '{}' could not be registered.".replace("{}", languageName));
1438
+ if (!SAFE_MODE) {
1439
+ throw error$1;
1440
+ } else {
1441
+ error(error$1);
1442
+ }
1443
+ lang = PLAINTEXT_LANGUAGE;
1444
+ }
1445
+ if (!lang.name) lang.name = languageName;
1446
+ languages[languageName] = lang;
1447
+ lang.rawDefinition = languageDefinition.bind(null, hljs);
1448
+ if (lang.aliases) {
1449
+ registerAliases(lang.aliases, { languageName });
1450
+ }
1451
+ }
1452
+ function unregisterLanguage(languageName) {
1453
+ delete languages[languageName];
1454
+ for (const alias of Object.keys(aliases)) {
1455
+ if (aliases[alias] === languageName) {
1456
+ delete aliases[alias];
1457
+ }
1458
+ }
1459
+ }
1460
+ function listLanguages() {
1461
+ return Object.keys(languages);
1462
+ }
1463
+ function getLanguage(name) {
1464
+ name = (name || "").toLowerCase();
1465
+ return languages[name] || languages[aliases[name]];
1466
+ }
1467
+ function registerAliases(aliasList, { languageName }) {
1468
+ if (typeof aliasList === "string") {
1469
+ aliasList = [aliasList];
1470
+ }
1471
+ aliasList.forEach((alias) => {
1472
+ aliases[alias.toLowerCase()] = languageName;
1473
+ });
1474
+ }
1475
+ function autoDetection(name) {
1476
+ const lang = getLanguage(name);
1477
+ return lang && !lang.disableAutodetect;
1478
+ }
1479
+ function upgradePluginAPI(plugin) {
1480
+ if (plugin["before:highlightBlock"] && !plugin["before:highlightElement"]) {
1481
+ plugin["before:highlightElement"] = (data) => {
1482
+ plugin["before:highlightBlock"](
1483
+ Object.assign({ block: data.el }, data)
1484
+ );
1485
+ };
1486
+ }
1487
+ if (plugin["after:highlightBlock"] && !plugin["after:highlightElement"]) {
1488
+ plugin["after:highlightElement"] = (data) => {
1489
+ plugin["after:highlightBlock"](
1490
+ Object.assign({ block: data.el }, data)
1491
+ );
1492
+ };
1493
+ }
1494
+ }
1495
+ function addPlugin(plugin) {
1496
+ upgradePluginAPI(plugin);
1497
+ plugins.push(plugin);
1498
+ }
1499
+ function removePlugin(plugin) {
1500
+ const index = plugins.indexOf(plugin);
1501
+ if (index !== -1) {
1502
+ plugins.splice(index, 1);
1503
+ }
1504
+ }
1505
+ function fire(event, args) {
1506
+ const cb = event;
1507
+ plugins.forEach(function(plugin) {
1508
+ if (plugin[cb]) {
1509
+ plugin[cb](args);
1510
+ }
1511
+ });
1512
+ }
1513
+ function deprecateHighlightBlock(el) {
1514
+ deprecated("10.7.0", "highlightBlock will be removed entirely in v12.0");
1515
+ deprecated("10.7.0", "Please use highlightElement now.");
1516
+ return highlightElement(el);
1517
+ }
1518
+ Object.assign(hljs, {
1519
+ highlight: highlight2,
1520
+ highlightAuto,
1521
+ highlightAll,
1522
+ highlightElement,
1523
+ // TODO: Remove with v12 API
1524
+ highlightBlock: deprecateHighlightBlock,
1525
+ configure,
1526
+ initHighlighting,
1527
+ initHighlightingOnLoad,
1528
+ registerLanguage,
1529
+ unregisterLanguage,
1530
+ listLanguages,
1531
+ getLanguage,
1532
+ registerAliases,
1533
+ autoDetection,
1534
+ inherit,
1535
+ addPlugin,
1536
+ removePlugin
1537
+ });
1538
+ hljs.debugMode = function() {
1539
+ SAFE_MODE = false;
1540
+ };
1541
+ hljs.safeMode = function() {
1542
+ SAFE_MODE = true;
1543
+ };
1544
+ hljs.versionString = version;
1545
+ hljs.regex = {
1546
+ concat,
1547
+ lookahead,
1548
+ either,
1549
+ optional,
1550
+ anyNumberOfTimes
1551
+ };
1552
+ for (const key in MODES) {
1553
+ if (typeof MODES[key] === "object") {
1554
+ deepFreeze(MODES[key]);
1555
+ }
1556
+ }
1557
+ Object.assign(hljs, MODES);
1558
+ return hljs;
1559
+ };
1560
+ var highlight = HLJS({});
1561
+ highlight.newInstance = () => HLJS({});
1562
+ module.exports = highlight;
1563
+ highlight.HighlightJS = highlight;
1564
+ highlight.default = highlight;
1565
+ }
1566
+ });
1567
+
1568
+ // node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/core.js
1569
+ var import_core = __toESM(require_core(), 1);
1570
+ var core_default = import_core.default;
1571
+
1572
+ // node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/typescript.js
1573
+ var IDENT_RE = "[A-Za-z$_][0-9A-Za-z$_]*";
1574
+ var KEYWORDS = [
1575
+ "as",
1576
+ // for exports
1577
+ "in",
1578
+ "of",
1579
+ "if",
1580
+ "for",
1581
+ "while",
1582
+ "finally",
1583
+ "var",
1584
+ "new",
1585
+ "function",
1586
+ "do",
1587
+ "return",
1588
+ "void",
1589
+ "else",
1590
+ "break",
1591
+ "catch",
1592
+ "instanceof",
1593
+ "with",
1594
+ "throw",
1595
+ "case",
1596
+ "default",
1597
+ "try",
1598
+ "switch",
1599
+ "continue",
1600
+ "typeof",
1601
+ "delete",
1602
+ "let",
1603
+ "yield",
1604
+ "const",
1605
+ "class",
1606
+ // JS handles these with a special rule
1607
+ // "get",
1608
+ // "set",
1609
+ "debugger",
1610
+ "async",
1611
+ "await",
1612
+ "static",
1613
+ "import",
1614
+ "from",
1615
+ "export",
1616
+ "extends",
1617
+ // It's reached stage 3, which is "recommended for implementation":
1618
+ "using"
1619
+ ];
1620
+ var LITERALS = [
1621
+ "true",
1622
+ "false",
1623
+ "null",
1624
+ "undefined",
1625
+ "NaN",
1626
+ "Infinity"
1627
+ ];
1628
+ var TYPES = [
1629
+ // Fundamental objects
1630
+ "Object",
1631
+ "Function",
1632
+ "Boolean",
1633
+ "Symbol",
1634
+ // numbers and dates
1635
+ "Math",
1636
+ "Date",
1637
+ "Number",
1638
+ "BigInt",
1639
+ // text
1640
+ "String",
1641
+ "RegExp",
1642
+ // Indexed collections
1643
+ "Array",
1644
+ "Float32Array",
1645
+ "Float64Array",
1646
+ "Int8Array",
1647
+ "Uint8Array",
1648
+ "Uint8ClampedArray",
1649
+ "Int16Array",
1650
+ "Int32Array",
1651
+ "Uint16Array",
1652
+ "Uint32Array",
1653
+ "BigInt64Array",
1654
+ "BigUint64Array",
1655
+ // Keyed collections
1656
+ "Set",
1657
+ "Map",
1658
+ "WeakSet",
1659
+ "WeakMap",
1660
+ // Structured data
1661
+ "ArrayBuffer",
1662
+ "SharedArrayBuffer",
1663
+ "Atomics",
1664
+ "DataView",
1665
+ "JSON",
1666
+ // Control abstraction objects
1667
+ "Promise",
1668
+ "Generator",
1669
+ "GeneratorFunction",
1670
+ "AsyncFunction",
1671
+ // Reflection
1672
+ "Reflect",
1673
+ "Proxy",
1674
+ // Internationalization
1675
+ "Intl",
1676
+ // WebAssembly
1677
+ "WebAssembly"
1678
+ ];
1679
+ var ERROR_TYPES = [
1680
+ "Error",
1681
+ "EvalError",
1682
+ "InternalError",
1683
+ "RangeError",
1684
+ "ReferenceError",
1685
+ "SyntaxError",
1686
+ "TypeError",
1687
+ "URIError"
1688
+ ];
1689
+ var BUILT_IN_GLOBALS = [
1690
+ "setInterval",
1691
+ "setTimeout",
1692
+ "clearInterval",
1693
+ "clearTimeout",
1694
+ "require",
1695
+ "exports",
1696
+ "eval",
1697
+ "isFinite",
1698
+ "isNaN",
1699
+ "parseFloat",
1700
+ "parseInt",
1701
+ "decodeURI",
1702
+ "decodeURIComponent",
1703
+ "encodeURI",
1704
+ "encodeURIComponent",
1705
+ "escape",
1706
+ "unescape"
1707
+ ];
1708
+ var BUILT_IN_VARIABLES = [
1709
+ "arguments",
1710
+ "this",
1711
+ "super",
1712
+ "console",
1713
+ "window",
1714
+ "document",
1715
+ "localStorage",
1716
+ "sessionStorage",
1717
+ "module",
1718
+ "global"
1719
+ // Node.js
1720
+ ];
1721
+ var BUILT_INS = [].concat(
1722
+ BUILT_IN_GLOBALS,
1723
+ TYPES,
1724
+ ERROR_TYPES
1725
+ );
1726
+ function javascript(hljs) {
1727
+ const regex = hljs.regex;
1728
+ const hasClosingTag = (match, { after }) => {
1729
+ const tag = "</" + match[0].slice(1);
1730
+ const pos = match.input.indexOf(tag, after);
1731
+ return pos !== -1;
1732
+ };
1733
+ const IDENT_RE$1 = IDENT_RE;
1734
+ const FRAGMENT = {
1735
+ begin: "<>",
1736
+ end: "</>"
1737
+ };
1738
+ const XML_SELF_CLOSING = /<[A-Za-z0-9\\._:-]+\s*\/>/;
1739
+ const XML_TAG = {
1740
+ begin: /<[A-Za-z0-9\\._:-]+/,
1741
+ end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
1742
+ /**
1743
+ * @param {RegExpMatchArray} match
1744
+ * @param {CallbackResponse} response
1745
+ */
1746
+ isTrulyOpeningTag: (match, response) => {
1747
+ const afterMatchIndex = match[0].length + match.index;
1748
+ const nextChar = match.input[afterMatchIndex];
1749
+ if (
1750
+ // HTML should not include another raw `<` inside a tag
1751
+ // nested type?
1752
+ // `<Array<Array<number>>`, etc.
1753
+ nextChar === "<" || // the , gives away that this is not HTML
1754
+ // `<T, A extends keyof T, V>`
1755
+ nextChar === ","
1756
+ ) {
1757
+ response.ignoreMatch();
1758
+ return;
1759
+ }
1760
+ if (nextChar === ">") {
1761
+ if (!hasClosingTag(match, { after: afterMatchIndex })) {
1762
+ response.ignoreMatch();
1763
+ }
1764
+ }
1765
+ let m;
1766
+ const afterMatch = match.input.substring(afterMatchIndex);
1767
+ if (m = afterMatch.match(/^\s*=/)) {
1768
+ response.ignoreMatch();
1769
+ return;
1770
+ }
1771
+ if (m = afterMatch.match(/^\s+extends\s+/)) {
1772
+ if (m.index === 0) {
1773
+ response.ignoreMatch();
1774
+ return;
1775
+ }
1776
+ }
1777
+ }
1778
+ };
1779
+ const KEYWORDS$1 = {
1780
+ $pattern: IDENT_RE,
1781
+ keyword: KEYWORDS,
1782
+ literal: LITERALS,
1783
+ built_in: BUILT_INS,
1784
+ "variable.language": BUILT_IN_VARIABLES
1785
+ };
1786
+ const decimalDigits = "[0-9](_?[0-9])*";
1787
+ const frac = `\\.(${decimalDigits})`;
1788
+ const decimalInteger = `0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`;
1789
+ const NUMBER = {
1790
+ className: "number",
1791
+ variants: [
1792
+ // DecimalLiteral
1793
+ { begin: `(\\b(${decimalInteger})((${frac})|\\.)?|(${frac}))[eE][+-]?(${decimalDigits})\\b` },
1794
+ { begin: `\\b(${decimalInteger})\\b((${frac})\\b|\\.)?|(${frac})\\b` },
1795
+ // DecimalBigIntegerLiteral
1796
+ { begin: `\\b(0|[1-9](_?[0-9])*)n\\b` },
1797
+ // NonDecimalIntegerLiteral
1798
+ { begin: "\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b" },
1799
+ { begin: "\\b0[bB][0-1](_?[0-1])*n?\\b" },
1800
+ { begin: "\\b0[oO][0-7](_?[0-7])*n?\\b" },
1801
+ // LegacyOctalIntegerLiteral (does not include underscore separators)
1802
+ // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals
1803
+ { begin: "\\b0[0-7]+n?\\b" }
1804
+ ],
1805
+ relevance: 0
1806
+ };
1807
+ const SUBST = {
1808
+ className: "subst",
1809
+ begin: "\\$\\{",
1810
+ end: "\\}",
1811
+ keywords: KEYWORDS$1,
1812
+ contains: []
1813
+ // defined later
1814
+ };
1815
+ const HTML_TEMPLATE = {
1816
+ begin: ".?html`",
1817
+ end: "",
1818
+ starts: {
1819
+ end: "`",
1820
+ returnEnd: false,
1821
+ contains: [
1822
+ hljs.BACKSLASH_ESCAPE,
1823
+ SUBST
1824
+ ],
1825
+ subLanguage: "xml"
1826
+ }
1827
+ };
1828
+ const CSS_TEMPLATE = {
1829
+ begin: ".?css`",
1830
+ end: "",
1831
+ starts: {
1832
+ end: "`",
1833
+ returnEnd: false,
1834
+ contains: [
1835
+ hljs.BACKSLASH_ESCAPE,
1836
+ SUBST
1837
+ ],
1838
+ subLanguage: "css"
1839
+ }
1840
+ };
1841
+ const GRAPHQL_TEMPLATE = {
1842
+ begin: ".?gql`",
1843
+ end: "",
1844
+ starts: {
1845
+ end: "`",
1846
+ returnEnd: false,
1847
+ contains: [
1848
+ hljs.BACKSLASH_ESCAPE,
1849
+ SUBST
1850
+ ],
1851
+ subLanguage: "graphql"
1852
+ }
1853
+ };
1854
+ const TEMPLATE_STRING = {
1855
+ className: "string",
1856
+ begin: "`",
1857
+ end: "`",
1858
+ contains: [
1859
+ hljs.BACKSLASH_ESCAPE,
1860
+ SUBST
1861
+ ]
1862
+ };
1863
+ const JSDOC_COMMENT = hljs.COMMENT(
1864
+ /\/\*\*(?!\/)/,
1865
+ "\\*/",
1866
+ {
1867
+ relevance: 0,
1868
+ contains: [
1869
+ {
1870
+ begin: "(?=@[A-Za-z]+)",
1871
+ relevance: 0,
1872
+ contains: [
1873
+ {
1874
+ className: "doctag",
1875
+ begin: "@[A-Za-z]+"
1876
+ },
1877
+ {
1878
+ className: "type",
1879
+ begin: "\\{",
1880
+ end: "\\}",
1881
+ excludeEnd: true,
1882
+ excludeBegin: true,
1883
+ relevance: 0
1884
+ },
1885
+ {
1886
+ className: "variable",
1887
+ begin: IDENT_RE$1 + "(?=\\s*(-)|$)",
1888
+ endsParent: true,
1889
+ relevance: 0
1890
+ },
1891
+ // eat spaces (not newlines) so we can find
1892
+ // types or variables
1893
+ {
1894
+ begin: /(?=[^\n])\s/,
1895
+ relevance: 0
1896
+ }
1897
+ ]
1898
+ }
1899
+ ]
1900
+ }
1901
+ );
1902
+ const COMMENT = {
1903
+ className: "comment",
1904
+ variants: [
1905
+ JSDOC_COMMENT,
1906
+ hljs.C_BLOCK_COMMENT_MODE,
1907
+ hljs.C_LINE_COMMENT_MODE
1908
+ ]
1909
+ };
1910
+ const SUBST_INTERNALS = [
1911
+ hljs.APOS_STRING_MODE,
1912
+ hljs.QUOTE_STRING_MODE,
1913
+ HTML_TEMPLATE,
1914
+ CSS_TEMPLATE,
1915
+ GRAPHQL_TEMPLATE,
1916
+ TEMPLATE_STRING,
1917
+ // Skip numbers when they are part of a variable name
1918
+ { match: /\$\d+/ },
1919
+ NUMBER
1920
+ // This is intentional:
1921
+ // See https://github.com/highlightjs/highlight.js/issues/3288
1922
+ // hljs.REGEXP_MODE
1923
+ ];
1924
+ SUBST.contains = SUBST_INTERNALS.concat({
1925
+ // we need to pair up {} inside our subst to prevent
1926
+ // it from ending too early by matching another }
1927
+ begin: /\{/,
1928
+ end: /\}/,
1929
+ keywords: KEYWORDS$1,
1930
+ contains: [
1931
+ "self"
1932
+ ].concat(SUBST_INTERNALS)
1933
+ });
1934
+ const SUBST_AND_COMMENTS = [].concat(COMMENT, SUBST.contains);
1935
+ const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([
1936
+ // eat recursive parens in sub expressions
1937
+ {
1938
+ begin: /(\s*)\(/,
1939
+ end: /\)/,
1940
+ keywords: KEYWORDS$1,
1941
+ contains: ["self"].concat(SUBST_AND_COMMENTS)
1942
+ }
1943
+ ]);
1944
+ const PARAMS = {
1945
+ className: "params",
1946
+ // convert this to negative lookbehind in v12
1947
+ begin: /(\s*)\(/,
1948
+ // to match the parms with
1949
+ end: /\)/,
1950
+ excludeBegin: true,
1951
+ excludeEnd: true,
1952
+ keywords: KEYWORDS$1,
1953
+ contains: PARAMS_CONTAINS
1954
+ };
1955
+ const CLASS_OR_EXTENDS = {
1956
+ variants: [
1957
+ // class Car extends vehicle
1958
+ {
1959
+ match: [
1960
+ /class/,
1961
+ /\s+/,
1962
+ IDENT_RE$1,
1963
+ /\s+/,
1964
+ /extends/,
1965
+ /\s+/,
1966
+ regex.concat(IDENT_RE$1, "(", regex.concat(/\./, IDENT_RE$1), ")*")
1967
+ ],
1968
+ scope: {
1969
+ 1: "keyword",
1970
+ 3: "title.class",
1971
+ 5: "keyword",
1972
+ 7: "title.class.inherited"
1973
+ }
1974
+ },
1975
+ // class Car
1976
+ {
1977
+ match: [
1978
+ /class/,
1979
+ /\s+/,
1980
+ IDENT_RE$1
1981
+ ],
1982
+ scope: {
1983
+ 1: "keyword",
1984
+ 3: "title.class"
1985
+ }
1986
+ }
1987
+ ]
1988
+ };
1989
+ const CLASS_REFERENCE = {
1990
+ relevance: 0,
1991
+ match: regex.either(
1992
+ // Hard coded exceptions
1993
+ /\bJSON/,
1994
+ // Float32Array, OutT
1995
+ /\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,
1996
+ // CSSFactory, CSSFactoryT
1997
+ /\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,
1998
+ // FPs, FPsT
1999
+ /\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/
2000
+ // P
2001
+ // single letters are not highlighted
2002
+ // BLAH
2003
+ // this will be flagged as a UPPER_CASE_CONSTANT instead
2004
+ ),
2005
+ className: "title.class",
2006
+ keywords: {
2007
+ _: [
2008
+ // se we still get relevance credit for JS library classes
2009
+ ...TYPES,
2010
+ ...ERROR_TYPES
2011
+ ]
2012
+ }
2013
+ };
2014
+ const USE_STRICT = {
2015
+ label: "use_strict",
2016
+ className: "meta",
2017
+ relevance: 10,
2018
+ begin: /^\s*['"]use (strict|asm)['"]/
2019
+ };
2020
+ const FUNCTION_DEFINITION = {
2021
+ variants: [
2022
+ {
2023
+ match: [
2024
+ /function/,
2025
+ /\s+/,
2026
+ IDENT_RE$1,
2027
+ /(?=\s*\()/
2028
+ ]
2029
+ },
2030
+ // anonymous function
2031
+ {
2032
+ match: [
2033
+ /function/,
2034
+ /\s*(?=\()/
2035
+ ]
2036
+ }
2037
+ ],
2038
+ className: {
2039
+ 1: "keyword",
2040
+ 3: "title.function"
2041
+ },
2042
+ label: "func.def",
2043
+ contains: [PARAMS],
2044
+ illegal: /%/
2045
+ };
2046
+ const UPPER_CASE_CONSTANT = {
2047
+ relevance: 0,
2048
+ match: /\b[A-Z][A-Z_0-9]+\b/,
2049
+ className: "variable.constant"
2050
+ };
2051
+ function noneOf(list) {
2052
+ return regex.concat("(?!", list.join("|"), ")");
2053
+ }
2054
+ const FUNCTION_CALL = {
2055
+ match: regex.concat(
2056
+ /\b/,
2057
+ noneOf([
2058
+ ...BUILT_IN_GLOBALS,
2059
+ "super",
2060
+ "import"
2061
+ ].map((x) => `${x}\\s*\\(`)),
2062
+ IDENT_RE$1,
2063
+ regex.lookahead(/\s*\(/)
2064
+ ),
2065
+ className: "title.function",
2066
+ relevance: 0
2067
+ };
2068
+ const PROPERTY_ACCESS = {
2069
+ begin: regex.concat(/\./, regex.lookahead(
2070
+ regex.concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/)
2071
+ )),
2072
+ end: IDENT_RE$1,
2073
+ excludeBegin: true,
2074
+ keywords: "prototype",
2075
+ className: "property",
2076
+ relevance: 0
2077
+ };
2078
+ const GETTER_OR_SETTER = {
2079
+ match: [
2080
+ /get|set/,
2081
+ /\s+/,
2082
+ IDENT_RE$1,
2083
+ /(?=\()/
2084
+ ],
2085
+ className: {
2086
+ 1: "keyword",
2087
+ 3: "title.function"
2088
+ },
2089
+ contains: [
2090
+ {
2091
+ // eat to avoid empty params
2092
+ begin: /\(\)/
2093
+ },
2094
+ PARAMS
2095
+ ]
2096
+ };
2097
+ const FUNC_LEAD_IN_RE = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + hljs.UNDERSCORE_IDENT_RE + ")\\s*=>";
2098
+ const FUNCTION_VARIABLE = {
2099
+ match: [
2100
+ /const|var|let/,
2101
+ /\s+/,
2102
+ IDENT_RE$1,
2103
+ /\s*/,
2104
+ /=\s*/,
2105
+ /(async\s*)?/,
2106
+ // async is optional
2107
+ regex.lookahead(FUNC_LEAD_IN_RE)
2108
+ ],
2109
+ keywords: "async",
2110
+ className: {
2111
+ 1: "keyword",
2112
+ 3: "title.function"
2113
+ },
2114
+ contains: [
2115
+ PARAMS
2116
+ ]
2117
+ };
2118
+ return {
2119
+ name: "JavaScript",
2120
+ aliases: ["js", "jsx", "mjs", "cjs"],
2121
+ keywords: KEYWORDS$1,
2122
+ // this will be extended by TypeScript
2123
+ exports: { PARAMS_CONTAINS, CLASS_REFERENCE },
2124
+ illegal: /#(?![$_A-z])/,
2125
+ contains: [
2126
+ hljs.SHEBANG({
2127
+ label: "shebang",
2128
+ binary: "node",
2129
+ relevance: 5
2130
+ }),
2131
+ USE_STRICT,
2132
+ hljs.APOS_STRING_MODE,
2133
+ hljs.QUOTE_STRING_MODE,
2134
+ HTML_TEMPLATE,
2135
+ CSS_TEMPLATE,
2136
+ GRAPHQL_TEMPLATE,
2137
+ TEMPLATE_STRING,
2138
+ COMMENT,
2139
+ // Skip numbers when they are part of a variable name
2140
+ { match: /\$\d+/ },
2141
+ NUMBER,
2142
+ CLASS_REFERENCE,
2143
+ {
2144
+ scope: "attr",
2145
+ match: IDENT_RE$1 + regex.lookahead(":"),
2146
+ relevance: 0
2147
+ },
2148
+ FUNCTION_VARIABLE,
2149
+ {
2150
+ // "value" container
2151
+ begin: "(" + hljs.RE_STARTERS_RE + "|\\b(case|return|throw)\\b)\\s*",
2152
+ keywords: "return throw case",
2153
+ relevance: 0,
2154
+ contains: [
2155
+ COMMENT,
2156
+ hljs.REGEXP_MODE,
2157
+ {
2158
+ className: "function",
2159
+ // we have to count the parens to make sure we actually have the
2160
+ // correct bounding ( ) before the =>. There could be any number of
2161
+ // sub-expressions inside also surrounded by parens.
2162
+ begin: FUNC_LEAD_IN_RE,
2163
+ returnBegin: true,
2164
+ end: "\\s*=>",
2165
+ contains: [
2166
+ {
2167
+ className: "params",
2168
+ variants: [
2169
+ {
2170
+ begin: hljs.UNDERSCORE_IDENT_RE,
2171
+ relevance: 0
2172
+ },
2173
+ {
2174
+ className: null,
2175
+ begin: /\(\s*\)/,
2176
+ skip: true
2177
+ },
2178
+ {
2179
+ begin: /(\s*)\(/,
2180
+ end: /\)/,
2181
+ excludeBegin: true,
2182
+ excludeEnd: true,
2183
+ keywords: KEYWORDS$1,
2184
+ contains: PARAMS_CONTAINS
2185
+ }
2186
+ ]
2187
+ }
2188
+ ]
2189
+ },
2190
+ {
2191
+ // could be a comma delimited list of params to a function call
2192
+ begin: /,/,
2193
+ relevance: 0
2194
+ },
2195
+ {
2196
+ match: /\s+/,
2197
+ relevance: 0
2198
+ },
2199
+ {
2200
+ // JSX
2201
+ variants: [
2202
+ { begin: FRAGMENT.begin, end: FRAGMENT.end },
2203
+ { match: XML_SELF_CLOSING },
2204
+ {
2205
+ begin: XML_TAG.begin,
2206
+ // we carefully check the opening tag to see if it truly
2207
+ // is a tag and not a false positive
2208
+ "on:begin": XML_TAG.isTrulyOpeningTag,
2209
+ end: XML_TAG.end
2210
+ }
2211
+ ],
2212
+ subLanguage: "xml",
2213
+ contains: [
2214
+ {
2215
+ begin: XML_TAG.begin,
2216
+ end: XML_TAG.end,
2217
+ skip: true,
2218
+ contains: ["self"]
2219
+ }
2220
+ ]
2221
+ }
2222
+ ]
2223
+ },
2224
+ FUNCTION_DEFINITION,
2225
+ {
2226
+ // prevent this from getting swallowed up by function
2227
+ // since they appear "function like"
2228
+ beginKeywords: "while if switch catch for"
2229
+ },
2230
+ {
2231
+ // we have to count the parens to make sure we actually have the correct
2232
+ // bounding ( ). There could be any number of sub-expressions inside
2233
+ // also surrounded by parens.
2234
+ begin: "\\b(?!function)" + hljs.UNDERSCORE_IDENT_RE + "\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",
2235
+ // end parens
2236
+ returnBegin: true,
2237
+ label: "func.def",
2238
+ contains: [
2239
+ PARAMS,
2240
+ hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1, className: "title.function" })
2241
+ ]
2242
+ },
2243
+ // catch ... so it won't trigger the property rule below
2244
+ {
2245
+ match: /\.\.\./,
2246
+ relevance: 0
2247
+ },
2248
+ PROPERTY_ACCESS,
2249
+ // hack: prevents detection of keywords in some circumstances
2250
+ // .keyword()
2251
+ // $keyword = x
2252
+ {
2253
+ match: "\\$" + IDENT_RE$1,
2254
+ relevance: 0
2255
+ },
2256
+ {
2257
+ match: [/\bconstructor(?=\s*\()/],
2258
+ className: { 1: "title.function" },
2259
+ contains: [PARAMS]
2260
+ },
2261
+ FUNCTION_CALL,
2262
+ UPPER_CASE_CONSTANT,
2263
+ CLASS_OR_EXTENDS,
2264
+ GETTER_OR_SETTER,
2265
+ {
2266
+ match: /\$[(.]/
2267
+ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
2268
+ }
2269
+ ]
2270
+ };
2271
+ }
2272
+ function typescript(hljs) {
2273
+ const regex = hljs.regex;
2274
+ const tsLanguage = javascript(hljs);
2275
+ const IDENT_RE$1 = IDENT_RE;
2276
+ const TYPES2 = [
2277
+ "any",
2278
+ "void",
2279
+ "number",
2280
+ "boolean",
2281
+ "string",
2282
+ "object",
2283
+ "never",
2284
+ "symbol",
2285
+ "bigint",
2286
+ "unknown"
2287
+ ];
2288
+ const NAMESPACE = {
2289
+ begin: [
2290
+ /namespace/,
2291
+ /\s+/,
2292
+ hljs.IDENT_RE
2293
+ ],
2294
+ beginScope: {
2295
+ 1: "keyword",
2296
+ 3: "title.class"
2297
+ }
2298
+ };
2299
+ const INTERFACE = {
2300
+ beginKeywords: "interface",
2301
+ end: /\{/,
2302
+ excludeEnd: true,
2303
+ keywords: {
2304
+ keyword: "interface extends",
2305
+ built_in: TYPES2
2306
+ },
2307
+ contains: [tsLanguage.exports.CLASS_REFERENCE]
2308
+ };
2309
+ const USE_STRICT = {
2310
+ className: "meta",
2311
+ relevance: 10,
2312
+ begin: /^\s*['"]use strict['"]/
2313
+ };
2314
+ const TS_SPECIFIC_KEYWORDS = [
2315
+ "type",
2316
+ // "namespace",
2317
+ "interface",
2318
+ "public",
2319
+ "private",
2320
+ "protected",
2321
+ "implements",
2322
+ "declare",
2323
+ "abstract",
2324
+ "readonly",
2325
+ "enum",
2326
+ "override",
2327
+ "satisfies"
2328
+ ];
2329
+ const KEYWORDS$1 = {
2330
+ $pattern: IDENT_RE,
2331
+ keyword: KEYWORDS.concat(TS_SPECIFIC_KEYWORDS),
2332
+ literal: LITERALS,
2333
+ built_in: BUILT_INS.concat(TYPES2),
2334
+ "variable.language": BUILT_IN_VARIABLES
2335
+ };
2336
+ const DECORATOR = {
2337
+ className: "meta",
2338
+ begin: "@" + IDENT_RE$1
2339
+ };
2340
+ const swapMode = (mode, label, replacement) => {
2341
+ const indx = mode.contains.findIndex((m) => m.label === label);
2342
+ if (indx === -1) {
2343
+ throw new Error("can not find mode to replace");
2344
+ }
2345
+ mode.contains.splice(indx, 1, replacement);
2346
+ };
2347
+ Object.assign(tsLanguage.keywords, KEYWORDS$1);
2348
+ tsLanguage.exports.PARAMS_CONTAINS.push(DECORATOR);
2349
+ const ATTRIBUTE_HIGHLIGHT = tsLanguage.contains.find((c) => c.scope === "attr");
2350
+ const OPTIONAL_KEY_OR_ARGUMENT = Object.assign(
2351
+ {},
2352
+ ATTRIBUTE_HIGHLIGHT,
2353
+ { match: regex.concat(IDENT_RE$1, regex.lookahead(/\s*\?:/)) }
2354
+ );
2355
+ tsLanguage.exports.PARAMS_CONTAINS.push([
2356
+ tsLanguage.exports.CLASS_REFERENCE,
2357
+ // class reference for highlighting the params types
2358
+ ATTRIBUTE_HIGHLIGHT,
2359
+ // highlight the params key
2360
+ OPTIONAL_KEY_OR_ARGUMENT
2361
+ // Added for optional property assignment highlighting
2362
+ ]);
2363
+ tsLanguage.contains = tsLanguage.contains.concat([
2364
+ DECORATOR,
2365
+ NAMESPACE,
2366
+ INTERFACE,
2367
+ OPTIONAL_KEY_OR_ARGUMENT
2368
+ // Added for optional property assignment highlighting
2369
+ ]);
2370
+ swapMode(tsLanguage, "shebang", hljs.SHEBANG());
2371
+ swapMode(tsLanguage, "use_strict", USE_STRICT);
2372
+ const functionDeclaration = tsLanguage.contains.find((m) => m.label === "func.def");
2373
+ functionDeclaration.relevance = 0;
2374
+ Object.assign(tsLanguage, {
2375
+ name: "TypeScript",
2376
+ aliases: [
2377
+ "ts",
2378
+ "tsx",
2379
+ "mts",
2380
+ "cts"
2381
+ ]
2382
+ });
2383
+ return tsLanguage;
2384
+ }
2385
+
2386
+ // src/vendor/hljs.ts
2387
+ core_default.configure({ cssSelector: "pre.prettyprint" });
2388
+ core_default.registerLanguage("typescript", typescript);
2389
+ Object.assign(window, {
2390
+ prettyPrint: () => {
2391
+ document.querySelectorAll("pre.prettyprint").forEach((el) => {
2392
+ el.classList.remove("lang-js");
2393
+ el.classList.add("lang-ts");
2394
+ core_default.highlightElement(el);
2395
+ });
2396
+ }
2397
+ });
2398
+ })();