@koide-labs/ui 0.0.6 → 0.0.7

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 (77) hide show
  1. package/README.md +3 -0
  2. package/dist/components/accordion/index.js +1 -1
  3. package/dist/components/alert-dialog/index.js +1 -1
  4. package/dist/components/anchor/index.js +1 -1
  5. package/dist/components/avatar/index.js +1 -1
  6. package/dist/components/badge/index.js +1 -1
  7. package/dist/components/button/index.js +1 -1
  8. package/dist/components/checkbox/index.js +1 -1
  9. package/dist/components/code/index.js +1203 -8
  10. package/dist/components/collapse/index.js +1 -1
  11. package/dist/components/command/index.js +2 -2
  12. package/dist/components/context-menu/index.js +2 -2
  13. package/dist/components/heading/index.js +1 -1
  14. package/dist/components/icon/index.js +1 -1
  15. package/dist/components/icon-button/index.js +1 -1
  16. package/dist/components/inline-code/index.js +1 -1
  17. package/dist/components/meter/index.js +1 -1
  18. package/dist/components/number-input/index.js +2 -2
  19. package/dist/components/password-input/index.js +1 -1
  20. package/dist/components/pill/index.js +1 -1
  21. package/dist/components/popover/index.js +1 -1
  22. package/dist/components/preview-card/index.js +1 -1
  23. package/dist/components/radio/index.js +1 -1
  24. package/dist/components/search-bar/index.js +1 -1
  25. package/dist/components/select/index.js +1 -1
  26. package/dist/components/separator/index.js +1 -1
  27. package/dist/components/slider/index.js +1 -1
  28. package/dist/components/spinner/index.js +1 -1
  29. package/dist/components/stacked-avatars/index.js +1 -1
  30. package/dist/components/status-banner/index.js +1 -1
  31. package/dist/components/surface/index.js +1 -1
  32. package/dist/components/switch/index.js +1 -1
  33. package/dist/components/tabs/index.js +2 -2
  34. package/dist/components/text/index.js +1 -1
  35. package/dist/components/timestamp/index.js +1 -1
  36. package/dist/components/view/index.js +1 -1
  37. package/dist/{index-FMoPxlJ2.js → index-DVjyPAD4.js} +1 -1
  38. package/dist/index.js +2 -2
  39. package/dist/index10.css +1 -1
  40. package/dist/index11.css +1 -1
  41. package/dist/index12.css +1 -1
  42. package/dist/index13.css +1 -1
  43. package/dist/index14.css +1 -1
  44. package/dist/index15.css +1 -1
  45. package/dist/index16.css +1 -1
  46. package/dist/index17.css +1 -1
  47. package/dist/index18.css +1 -1
  48. package/dist/index19.css +1 -1
  49. package/dist/index2.css +1 -1
  50. package/dist/index20.css +1 -1
  51. package/dist/index21.css +1 -1
  52. package/dist/index22.css +1 -1
  53. package/dist/index23.css +1 -1
  54. package/dist/index24.css +1 -1
  55. package/dist/index25.css +1 -1
  56. package/dist/index26.css +1 -1
  57. package/dist/index27.css +1 -1
  58. package/dist/index28.css +1 -1
  59. package/dist/index29.css +1 -1
  60. package/dist/index3.css +1 -1
  61. package/dist/index30.css +1 -1
  62. package/dist/index31.css +1 -1
  63. package/dist/index32.css +1 -1
  64. package/dist/index33.css +1 -1
  65. package/dist/index34.css +1 -1
  66. package/dist/index35.css +1 -1
  67. package/dist/index36.css +1 -1
  68. package/dist/index37.css +1 -1
  69. package/dist/index4.css +1 -1
  70. package/dist/index5.css +1 -1
  71. package/dist/index6.css +1 -1
  72. package/dist/index7.css +1 -1
  73. package/dist/index8.css +1 -1
  74. package/dist/index9.css +1 -1
  75. package/dist/integrations/react-markdown/index.js +73 -6819
  76. package/package.json +8 -3
  77. package/dist/index-BX1XbbRk.js +0 -1206
@@ -1,1206 +0,0 @@
1
- import { jsxs as ne, jsx as j } from "react/jsx-runtime";
2
- import { c as re } from "./clsx-OuTLNxxd.js";
3
- import { useMemo as ie } from "react";
4
- import { Surface as J } from "./components/surface/index.js";
5
- import { Text as se } from "./components/text/index.js";
6
- import { View as ue } from "./components/view/index.js";
7
- import './index21.css';var V = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
8
- function le(b) {
9
- return b && b.__esModule && Object.prototype.hasOwnProperty.call(b, "default") ? b.default : b;
10
- }
11
- var Z = { exports: {} }, K;
12
- function oe() {
13
- return K || (K = 1, (function(b) {
14
- var z = typeof window < "u" ? window : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : {};
15
- var i = (function(g) {
16
- var f = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i, F = 0, A = {}, s = {
17
- /**
18
- * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
19
- * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
20
- * additional languages or plugins yourself.
21
- *
22
- * By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
23
- *
24
- * You obviously have to change this value before the automatic highlighting started. To do this, you can add an
25
- * empty Prism object into the global scope before loading the Prism script like this:
26
- *
27
- * ```js
28
- * window.Prism = window.Prism || {};
29
- * Prism.manual = true;
30
- * // add a new <script> to load Prism's script
31
- * ```
32
- *
33
- * @default false
34
- * @type {boolean}
35
- * @memberof Prism
36
- * @public
37
- */
38
- manual: g.Prism && g.Prism.manual,
39
- /**
40
- * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
41
- * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
42
- * own worker, you don't want it to do this.
43
- *
44
- * By setting this value to `true`, Prism will not add its own listeners to the worker.
45
- *
46
- * You obviously have to change this value before Prism executes. To do this, you can add an
47
- * empty Prism object into the global scope before loading the Prism script like this:
48
- *
49
- * ```js
50
- * window.Prism = window.Prism || {};
51
- * Prism.disableWorkerMessageHandler = true;
52
- * // Load Prism's script
53
- * ```
54
- *
55
- * @default false
56
- * @type {boolean}
57
- * @memberof Prism
58
- * @public
59
- */
60
- disableWorkerMessageHandler: g.Prism && g.Prism.disableWorkerMessageHandler,
61
- /**
62
- * A namespace for utility methods.
63
- *
64
- * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
65
- * change or disappear at any time.
66
- *
67
- * @namespace
68
- * @memberof Prism
69
- */
70
- util: {
71
- encode: function t(e) {
72
- return e instanceof y ? new y(e.type, t(e.content), e.alias) : Array.isArray(e) ? e.map(t) : e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ");
73
- },
74
- /**
75
- * Returns the name of the type of the given value.
76
- *
77
- * @param {any} o
78
- * @returns {string}
79
- * @example
80
- * type(null) === 'Null'
81
- * type(undefined) === 'Undefined'
82
- * type(123) === 'Number'
83
- * type('foo') === 'String'
84
- * type(true) === 'Boolean'
85
- * type([1, 2]) === 'Array'
86
- * type({}) === 'Object'
87
- * type(String) === 'Function'
88
- * type(/abc+/) === 'RegExp'
89
- */
90
- type: function(t) {
91
- return Object.prototype.toString.call(t).slice(8, -1);
92
- },
93
- /**
94
- * Returns a unique number for the given object. Later calls will still return the same number.
95
- *
96
- * @param {Object} obj
97
- * @returns {number}
98
- */
99
- objId: function(t) {
100
- return t.__id || Object.defineProperty(t, "__id", { value: ++F }), t.__id;
101
- },
102
- /**
103
- * Creates a deep clone of the given object.
104
- *
105
- * The main intended use of this function is to clone language definitions.
106
- *
107
- * @param {T} o
108
- * @param {Record<number, any>} [visited]
109
- * @returns {T}
110
- * @template T
111
- */
112
- clone: function t(e, a) {
113
- a = a || {};
114
- var n, r;
115
- switch (s.util.type(e)) {
116
- case "Object":
117
- if (r = s.util.objId(e), a[r])
118
- return a[r];
119
- n = /** @type {Record<string, any>} */
120
- {}, a[r] = n;
121
- for (var l in e)
122
- e.hasOwnProperty(l) && (n[l] = t(e[l], a));
123
- return (
124
- /** @type {any} */
125
- n
126
- );
127
- case "Array":
128
- return r = s.util.objId(e), a[r] ? a[r] : (n = [], a[r] = n, /** @type {Array} */
129
- /** @type {any} */
130
- e.forEach(function(o, u) {
131
- n[u] = t(o, a);
132
- }), /** @type {any} */
133
- n);
134
- default:
135
- return e;
136
- }
137
- },
138
- /**
139
- * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
140
- *
141
- * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
142
- *
143
- * @param {Element} element
144
- * @returns {string}
145
- */
146
- getLanguage: function(t) {
147
- for (; t; ) {
148
- var e = f.exec(t.className);
149
- if (e)
150
- return e[1].toLowerCase();
151
- t = t.parentElement;
152
- }
153
- return "none";
154
- },
155
- /**
156
- * Sets the Prism `language-xxxx` class of the given element.
157
- *
158
- * @param {Element} element
159
- * @param {string} language
160
- * @returns {void}
161
- */
162
- setLanguage: function(t, e) {
163
- t.className = t.className.replace(RegExp(f, "gi"), ""), t.classList.add("language-" + e);
164
- },
165
- /**
166
- * Returns the script element that is currently executing.
167
- *
168
- * This does __not__ work for line script element.
169
- *
170
- * @returns {HTMLScriptElement | null}
171
- */
172
- currentScript: function() {
173
- if (typeof document > "u")
174
- return null;
175
- if (document.currentScript && document.currentScript.tagName === "SCRIPT")
176
- return (
177
- /** @type {any} */
178
- document.currentScript
179
- );
180
- try {
181
- throw new Error();
182
- } catch (n) {
183
- var t = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(n.stack) || [])[1];
184
- if (t) {
185
- var e = document.getElementsByTagName("script");
186
- for (var a in e)
187
- if (e[a].src == t)
188
- return e[a];
189
- }
190
- return null;
191
- }
192
- },
193
- /**
194
- * Returns whether a given class is active for `element`.
195
- *
196
- * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
197
- * if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
198
- * given class is just the given class with a `no-` prefix.
199
- *
200
- * Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
201
- * closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
202
- * ancestors have the given class or the negated version of it, then the default activation will be returned.
203
- *
204
- * In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
205
- * version of it, the class is considered active.
206
- *
207
- * @param {Element} element
208
- * @param {string} className
209
- * @param {boolean} [defaultActivation=false]
210
- * @returns {boolean}
211
- */
212
- isActive: function(t, e, a) {
213
- for (var n = "no-" + e; t; ) {
214
- var r = t.classList;
215
- if (r.contains(e))
216
- return !0;
217
- if (r.contains(n))
218
- return !1;
219
- t = t.parentElement;
220
- }
221
- return !!a;
222
- }
223
- },
224
- /**
225
- * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
226
- *
227
- * @namespace
228
- * @memberof Prism
229
- * @public
230
- */
231
- languages: {
232
- /**
233
- * The grammar for plain, unformatted text.
234
- */
235
- plain: A,
236
- plaintext: A,
237
- text: A,
238
- txt: A,
239
- /**
240
- * Creates a deep copy of the language with the given id and appends the given tokens.
241
- *
242
- * If a token in `redef` also appears in the copied language, then the existing token in the copied language
243
- * will be overwritten at its original position.
244
- *
245
- * ## Best practices
246
- *
247
- * Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
248
- * doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
249
- * understand the language definition because, normally, the order of tokens matters in Prism grammars.
250
- *
251
- * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
252
- * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
253
- *
254
- * @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
255
- * @param {Grammar} redef The new tokens to append.
256
- * @returns {Grammar} The new language created.
257
- * @public
258
- * @example
259
- * Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
260
- * // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
261
- * // at its original position
262
- * 'comment': { ... },
263
- * // CSS doesn't have a 'color' token, so this token will be appended
264
- * 'color': /\b(?:red|green|blue)\b/
265
- * });
266
- */
267
- extend: function(t, e) {
268
- var a = s.util.clone(s.languages[t]);
269
- for (var n in e)
270
- a[n] = e[n];
271
- return a;
272
- },
273
- /**
274
- * Inserts tokens _before_ another token in a language definition or any other grammar.
275
- *
276
- * ## Usage
277
- *
278
- * This helper method makes it easy to modify existing languages. For example, the CSS language definition
279
- * not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
280
- * in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
281
- * appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
282
- * this:
283
- *
284
- * ```js
285
- * Prism.languages.markup.style = {
286
- * // token
287
- * };
288
- * ```
289
- *
290
- * then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
291
- * before existing tokens. For the CSS example above, you would use it like this:
292
- *
293
- * ```js
294
- * Prism.languages.insertBefore('markup', 'cdata', {
295
- * 'style': {
296
- * // token
297
- * }
298
- * });
299
- * ```
300
- *
301
- * ## Special cases
302
- *
303
- * If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
304
- * will be ignored.
305
- *
306
- * This behavior can be used to insert tokens after `before`:
307
- *
308
- * ```js
309
- * Prism.languages.insertBefore('markup', 'comment', {
310
- * 'comment': Prism.languages.markup.comment,
311
- * // tokens after 'comment'
312
- * });
313
- * ```
314
- *
315
- * ## Limitations
316
- *
317
- * The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
318
- * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
319
- * differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
320
- * deleting properties which is necessary to insert at arbitrary positions.
321
- *
322
- * To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
323
- * Instead, it will create a new object and replace all references to the target object with the new one. This
324
- * can be done without temporarily deleting properties, so the iteration order is well-defined.
325
- *
326
- * However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
327
- * you hold the target object in a variable, then the value of the variable will not change.
328
- *
329
- * ```js
330
- * var oldMarkup = Prism.languages.markup;
331
- * var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
332
- *
333
- * assert(oldMarkup !== Prism.languages.markup);
334
- * assert(newMarkup === Prism.languages.markup);
335
- * ```
336
- *
337
- * @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
338
- * object to be modified.
339
- * @param {string} before The key to insert before.
340
- * @param {Grammar} insert An object containing the key-value pairs to be inserted.
341
- * @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
342
- * object to be modified.
343
- *
344
- * Defaults to `Prism.languages`.
345
- * @returns {Grammar} The new grammar object.
346
- * @public
347
- */
348
- insertBefore: function(t, e, a, n) {
349
- n = n || /** @type {any} */
350
- s.languages;
351
- var r = n[t], l = {};
352
- for (var o in r)
353
- if (r.hasOwnProperty(o)) {
354
- if (o == e)
355
- for (var u in a)
356
- a.hasOwnProperty(u) && (l[u] = a[u]);
357
- a.hasOwnProperty(o) || (l[o] = r[o]);
358
- }
359
- var d = n[t];
360
- return n[t] = l, s.languages.DFS(s.languages, function(v, k) {
361
- k === d && v != t && (this[v] = l);
362
- }), l;
363
- },
364
- // Traverse a language definition with Depth First Search
365
- DFS: function t(e, a, n, r) {
366
- r = r || {};
367
- var l = s.util.objId;
368
- for (var o in e)
369
- if (e.hasOwnProperty(o)) {
370
- a.call(e, o, e[o], n || o);
371
- var u = e[o], d = s.util.type(u);
372
- d === "Object" && !r[l(u)] ? (r[l(u)] = !0, t(u, a, null, r)) : d === "Array" && !r[l(u)] && (r[l(u)] = !0, t(u, a, o, r));
373
- }
374
- }
375
- },
376
- plugins: {},
377
- /**
378
- * This is the most high-level function in Prism’s API.
379
- * It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
380
- * each one of them.
381
- *
382
- * This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
383
- *
384
- * @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
385
- * @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
386
- * @memberof Prism
387
- * @public
388
- */
389
- highlightAll: function(t, e) {
390
- s.highlightAllUnder(document, t, e);
391
- },
392
- /**
393
- * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
394
- * {@link Prism.highlightElement} on each one of them.
395
- *
396
- * The following hooks will be run:
397
- * 1. `before-highlightall`
398
- * 2. `before-all-elements-highlight`
399
- * 3. All hooks of {@link Prism.highlightElement} for each element.
400
- *
401
- * @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
402
- * @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
403
- * @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
404
- * @memberof Prism
405
- * @public
406
- */
407
- highlightAllUnder: function(t, e, a) {
408
- var n = {
409
- callback: a,
410
- container: t,
411
- selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
412
- };
413
- s.hooks.run("before-highlightall", n), n.elements = Array.prototype.slice.apply(n.container.querySelectorAll(n.selector)), s.hooks.run("before-all-elements-highlight", n);
414
- for (var r = 0, l; l = n.elements[r++]; )
415
- s.highlightElement(l, e === !0, n.callback);
416
- },
417
- /**
418
- * Highlights the code inside a single element.
419
- *
420
- * The following hooks will be run:
421
- * 1. `before-sanity-check`
422
- * 2. `before-highlight`
423
- * 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
424
- * 4. `before-insert`
425
- * 5. `after-highlight`
426
- * 6. `complete`
427
- *
428
- * Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
429
- * the element's language.
430
- *
431
- * @param {Element} element The element containing the code.
432
- * It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
433
- * @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
434
- * to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
435
- * [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
436
- *
437
- * Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
438
- * asynchronous highlighting to work. You can build your own bundle on the
439
- * [Download page](https://prismjs.com/download.html).
440
- * @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
441
- * Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
442
- * @memberof Prism
443
- * @public
444
- */
445
- highlightElement: function(t, e, a) {
446
- var n = s.util.getLanguage(t), r = s.languages[n];
447
- s.util.setLanguage(t, n);
448
- var l = t.parentElement;
449
- l && l.nodeName.toLowerCase() === "pre" && s.util.setLanguage(l, n);
450
- var o = t.textContent, u = {
451
- element: t,
452
- language: n,
453
- grammar: r,
454
- code: o
455
- };
456
- function d(k) {
457
- u.highlightedCode = k, s.hooks.run("before-insert", u), u.element.innerHTML = u.highlightedCode, s.hooks.run("after-highlight", u), s.hooks.run("complete", u), a && a.call(u.element);
458
- }
459
- if (s.hooks.run("before-sanity-check", u), l = u.element.parentElement, l && l.nodeName.toLowerCase() === "pre" && !l.hasAttribute("tabindex") && l.setAttribute("tabindex", "0"), !u.code) {
460
- s.hooks.run("complete", u), a && a.call(u.element);
461
- return;
462
- }
463
- if (s.hooks.run("before-highlight", u), !u.grammar) {
464
- d(s.util.encode(u.code));
465
- return;
466
- }
467
- if (e && g.Worker) {
468
- var v = new Worker(s.filename);
469
- v.onmessage = function(k) {
470
- d(k.data);
471
- }, v.postMessage(JSON.stringify({
472
- language: u.language,
473
- code: u.code,
474
- immediateClose: !0
475
- }));
476
- } else
477
- d(s.highlight(u.code, u.grammar, u.language));
478
- },
479
- /**
480
- * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
481
- * and the language definitions to use, and returns a string with the HTML produced.
482
- *
483
- * The following hooks will be run:
484
- * 1. `before-tokenize`
485
- * 2. `after-tokenize`
486
- * 3. `wrap`: On each {@link Token}.
487
- *
488
- * @param {string} text A string with the code to be highlighted.
489
- * @param {Grammar} grammar An object containing the tokens to use.
490
- *
491
- * Usually a language definition like `Prism.languages.markup`.
492
- * @param {string} language The name of the language definition passed to `grammar`.
493
- * @returns {string} The highlighted HTML.
494
- * @memberof Prism
495
- * @public
496
- * @example
497
- * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
498
- */
499
- highlight: function(t, e, a) {
500
- var n = {
501
- code: t,
502
- grammar: e,
503
- language: a
504
- };
505
- if (s.hooks.run("before-tokenize", n), !n.grammar)
506
- throw new Error('The language "' + n.language + '" has no grammar.');
507
- return n.tokens = s.tokenize(n.code, n.grammar), s.hooks.run("after-tokenize", n), y.stringify(s.util.encode(n.tokens), n.language);
508
- },
509
- /**
510
- * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
511
- * and the language definitions to use, and returns an array with the tokenized code.
512
- *
513
- * When the language definition includes nested tokens, the function is called recursively on each of these tokens.
514
- *
515
- * This method could be useful in other contexts as well, as a very crude parser.
516
- *
517
- * @param {string} text A string with the code to be highlighted.
518
- * @param {Grammar} grammar An object containing the tokens to use.
519
- *
520
- * Usually a language definition like `Prism.languages.markup`.
521
- * @returns {TokenStream} An array of strings and tokens, a token stream.
522
- * @memberof Prism
523
- * @public
524
- * @example
525
- * let code = `var foo = 0;`;
526
- * let tokens = Prism.tokenize(code, Prism.languages.javascript);
527
- * tokens.forEach(token => {
528
- * if (token instanceof Prism.Token && token.type === 'number') {
529
- * console.log(`Found numeric literal: ${token.content}`);
530
- * }
531
- * });
532
- */
533
- tokenize: function(t, e) {
534
- var a = e.rest;
535
- if (a) {
536
- for (var n in a)
537
- e[n] = a[n];
538
- delete e.rest;
539
- }
540
- var r = new T();
541
- return S(r, r.head, t), P(t, r, e, r.head, 0), L(r);
542
- },
543
- /**
544
- * @namespace
545
- * @memberof Prism
546
- * @public
547
- */
548
- hooks: {
549
- all: {},
550
- /**
551
- * Adds the given callback to the list of callbacks for the given hook.
552
- *
553
- * The callback will be invoked when the hook it is registered for is run.
554
- * Hooks are usually directly run by a highlight function but you can also run hooks yourself.
555
- *
556
- * One callback function can be registered to multiple hooks and the same hook multiple times.
557
- *
558
- * @param {string} name The name of the hook.
559
- * @param {HookCallback} callback The callback function which is given environment variables.
560
- * @public
561
- */
562
- add: function(t, e) {
563
- var a = s.hooks.all;
564
- a[t] = a[t] || [], a[t].push(e);
565
- },
566
- /**
567
- * Runs a hook invoking all registered callbacks with the given environment variables.
568
- *
569
- * Callbacks will be invoked synchronously and in the order in which they were registered.
570
- *
571
- * @param {string} name The name of the hook.
572
- * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
573
- * @public
574
- */
575
- run: function(t, e) {
576
- var a = s.hooks.all[t];
577
- if (!(!a || !a.length))
578
- for (var n = 0, r; r = a[n++]; )
579
- r(e);
580
- }
581
- },
582
- Token: y
583
- };
584
- g.Prism = s;
585
- function y(t, e, a, n) {
586
- this.type = t, this.content = e, this.alias = a, this.length = (n || "").length | 0;
587
- }
588
- y.stringify = function t(e, a) {
589
- if (typeof e == "string")
590
- return e;
591
- if (Array.isArray(e)) {
592
- var n = "";
593
- return e.forEach(function(d) {
594
- n += t(d, a);
595
- }), n;
596
- }
597
- var r = {
598
- type: e.type,
599
- content: t(e.content, a),
600
- tag: "span",
601
- classes: ["token", e.type],
602
- attributes: {},
603
- language: a
604
- }, l = e.alias;
605
- l && (Array.isArray(l) ? Array.prototype.push.apply(r.classes, l) : r.classes.push(l)), s.hooks.run("wrap", r);
606
- var o = "";
607
- for (var u in r.attributes)
608
- o += " " + u + '="' + (r.attributes[u] || "").replace(/"/g, "&quot;") + '"';
609
- return "<" + r.tag + ' class="' + r.classes.join(" ") + '"' + o + ">" + r.content + "</" + r.tag + ">";
610
- };
611
- function $(t, e, a, n) {
612
- t.lastIndex = e;
613
- var r = t.exec(a);
614
- if (r && n && r[1]) {
615
- var l = r[1].length;
616
- r.index += l, r[0] = r[0].slice(l);
617
- }
618
- return r;
619
- }
620
- function P(t, e, a, n, r, l) {
621
- for (var o in a)
622
- if (!(!a.hasOwnProperty(o) || !a[o])) {
623
- var u = a[o];
624
- u = Array.isArray(u) ? u : [u];
625
- for (var d = 0; d < u.length; ++d) {
626
- if (l && l.cause == o + "," + d)
627
- return;
628
- var v = u[d], k = v.inside, W = !!v.lookbehind, N = !!v.greedy, Q = v.alias;
629
- if (N && !v.pattern.global) {
630
- var ee = v.pattern.toString().match(/[imsuy]*$/)[0];
631
- v.pattern = RegExp(v.pattern.source, ee + "g");
632
- }
633
- for (var X = v.pattern || v, m = n.next, w = r; m !== e.tail && !(l && w >= l.reach); w += m.value.length, m = m.next) {
634
- var E = m.value;
635
- if (e.length > t.length)
636
- return;
637
- if (!(E instanceof y)) {
638
- var I = 1, x;
639
- if (N) {
640
- if (x = $(X, w, t, W), !x || x.index >= t.length)
641
- break;
642
- var M = x.index, te = x.index + x[0].length, _ = w;
643
- for (_ += m.value.length; M >= _; )
644
- m = m.next, _ += m.value.length;
645
- if (_ -= m.value.length, w = _, m.value instanceof y)
646
- continue;
647
- for (var C = m; C !== e.tail && (_ < te || typeof C.value == "string"); C = C.next)
648
- I++, _ += C.value.length;
649
- I--, E = t.slice(w, _), x.index -= w;
650
- } else if (x = $(X, 0, E, W), !x)
651
- continue;
652
- var M = x.index, D = x[0], q = E.slice(0, M), Y = E.slice(M + D.length), G = w + E.length;
653
- l && G > l.reach && (l.reach = G);
654
- var O = m.prev;
655
- q && (O = S(e, O, q), w += q.length), H(e, O, I);
656
- var ae = new y(o, k ? s.tokenize(D, k) : D, Q, D);
657
- if (m = S(e, O, ae), Y && S(e, m, Y), I > 1) {
658
- var U = {
659
- cause: o + "," + d,
660
- reach: G
661
- };
662
- P(t, e, a, m.prev, w, U), l && U.reach > l.reach && (l.reach = U.reach);
663
- }
664
- }
665
- }
666
- }
667
- }
668
- }
669
- function T() {
670
- var t = { value: null, prev: null, next: null }, e = { value: null, prev: t, next: null };
671
- t.next = e, this.head = t, this.tail = e, this.length = 0;
672
- }
673
- function S(t, e, a) {
674
- var n = e.next, r = { value: a, prev: e, next: n };
675
- return e.next = r, n.prev = r, t.length++, r;
676
- }
677
- function H(t, e, a) {
678
- for (var n = e.next, r = 0; r < a && n !== t.tail; r++)
679
- n = n.next;
680
- e.next = n, n.prev = e, t.length -= r;
681
- }
682
- function L(t) {
683
- for (var e = [], a = t.head.next; a !== t.tail; )
684
- e.push(a.value), a = a.next;
685
- return e;
686
- }
687
- if (!g.document)
688
- return g.addEventListener && (s.disableWorkerMessageHandler || g.addEventListener("message", function(t) {
689
- var e = JSON.parse(t.data), a = e.language, n = e.code, r = e.immediateClose;
690
- g.postMessage(s.highlight(n, s.languages[a], a)), r && g.close();
691
- }, !1)), s;
692
- var p = s.util.currentScript();
693
- p && (s.filename = p.src, p.hasAttribute("data-manual") && (s.manual = !0));
694
- function c() {
695
- s.manual || s.highlightAll();
696
- }
697
- if (!s.manual) {
698
- var h = document.readyState;
699
- h === "loading" || h === "interactive" && p && p.defer ? document.addEventListener("DOMContentLoaded", c) : window.requestAnimationFrame ? window.requestAnimationFrame(c) : window.setTimeout(c, 16);
700
- }
701
- return s;
702
- })(z);
703
- b.exports && (b.exports = i), typeof V < "u" && (V.Prism = i), i.languages.markup = {
704
- comment: {
705
- pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
706
- greedy: !0
707
- },
708
- prolog: {
709
- pattern: /<\?[\s\S]+?\?>/,
710
- greedy: !0
711
- },
712
- doctype: {
713
- // https://www.w3.org/TR/xml/#NT-doctypedecl
714
- pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
715
- greedy: !0,
716
- inside: {
717
- "internal-subset": {
718
- pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
719
- lookbehind: !0,
720
- greedy: !0,
721
- inside: null
722
- // see below
723
- },
724
- string: {
725
- pattern: /"[^"]*"|'[^']*'/,
726
- greedy: !0
727
- },
728
- punctuation: /^<!|>$|[[\]]/,
729
- "doctype-tag": /^DOCTYPE/i,
730
- name: /[^\s<>'"]+/
731
- }
732
- },
733
- cdata: {
734
- pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
735
- greedy: !0
736
- },
737
- tag: {
738
- pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
739
- greedy: !0,
740
- inside: {
741
- tag: {
742
- pattern: /^<\/?[^\s>\/]+/,
743
- inside: {
744
- punctuation: /^<\/?/,
745
- namespace: /^[^\s>\/:]+:/
746
- }
747
- },
748
- "special-attr": [],
749
- "attr-value": {
750
- pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
751
- inside: {
752
- punctuation: [
753
- {
754
- pattern: /^=/,
755
- alias: "attr-equals"
756
- },
757
- {
758
- pattern: /^(\s*)["']|["']$/,
759
- lookbehind: !0
760
- }
761
- ]
762
- }
763
- },
764
- punctuation: /\/?>/,
765
- "attr-name": {
766
- pattern: /[^\s>\/]+/,
767
- inside: {
768
- namespace: /^[^\s>\/:]+:/
769
- }
770
- }
771
- }
772
- },
773
- entity: [
774
- {
775
- pattern: /&[\da-z]{1,8};/i,
776
- alias: "named-entity"
777
- },
778
- /&#x?[\da-f]{1,8};/i
779
- ]
780
- }, i.languages.markup.tag.inside["attr-value"].inside.entity = i.languages.markup.entity, i.languages.markup.doctype.inside["internal-subset"].inside = i.languages.markup, i.hooks.add("wrap", function(g) {
781
- g.type === "entity" && (g.attributes.title = g.content.replace(/&amp;/, "&"));
782
- }), Object.defineProperty(i.languages.markup.tag, "addInlined", {
783
- /**
784
- * Adds an inlined language to markup.
785
- *
786
- * An example of an inlined language is CSS with `<style>` tags.
787
- *
788
- * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
789
- * case insensitive.
790
- * @param {string} lang The language key.
791
- * @example
792
- * addInlined('style', 'css');
793
- */
794
- value: function(f, F) {
795
- var A = {};
796
- A["language-" + F] = {
797
- pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
798
- lookbehind: !0,
799
- inside: i.languages[F]
800
- }, A.cdata = /^<!\[CDATA\[|\]\]>$/i;
801
- var s = {
802
- "included-cdata": {
803
- pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
804
- inside: A
805
- }
806
- };
807
- s["language-" + F] = {
808
- pattern: /[\s\S]+/,
809
- inside: i.languages[F]
810
- };
811
- var y = {};
812
- y[f] = {
813
- pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
814
- return f;
815
- }), "i"),
816
- lookbehind: !0,
817
- greedy: !0,
818
- inside: s
819
- }, i.languages.insertBefore("markup", "cdata", y);
820
- }
821
- }), Object.defineProperty(i.languages.markup.tag, "addAttribute", {
822
- /**
823
- * Adds an pattern to highlight languages embedded in HTML attributes.
824
- *
825
- * An example of an inlined language is CSS with `style` attributes.
826
- *
827
- * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
828
- * case insensitive.
829
- * @param {string} lang The language key.
830
- * @example
831
- * addAttribute('style', 'css');
832
- */
833
- value: function(g, f) {
834
- i.languages.markup.tag.inside["special-attr"].push({
835
- pattern: RegExp(
836
- /(^|["'\s])/.source + "(?:" + g + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
837
- "i"
838
- ),
839
- lookbehind: !0,
840
- inside: {
841
- "attr-name": /^[^\s=]+/,
842
- "attr-value": {
843
- pattern: /=[\s\S]+/,
844
- inside: {
845
- value: {
846
- pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
847
- lookbehind: !0,
848
- alias: [f, "language-" + f],
849
- inside: i.languages[f]
850
- },
851
- punctuation: [
852
- {
853
- pattern: /^=/,
854
- alias: "attr-equals"
855
- },
856
- /"|'/
857
- ]
858
- }
859
- }
860
- }
861
- });
862
- }
863
- }), i.languages.html = i.languages.markup, i.languages.mathml = i.languages.markup, i.languages.svg = i.languages.markup, i.languages.xml = i.languages.extend("markup", {}), i.languages.ssml = i.languages.xml, i.languages.atom = i.languages.xml, i.languages.rss = i.languages.xml, (function(g) {
864
- var f = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
865
- g.languages.css = {
866
- comment: /\/\*[\s\S]*?\*\//,
867
- atrule: {
868
- pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + f.source + ")*?" + /(?:;|(?=\s*\{))/.source),
869
- inside: {
870
- rule: /^@[\w-]+/,
871
- "selector-function-argument": {
872
- pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
873
- lookbehind: !0,
874
- alias: "selector"
875
- },
876
- keyword: {
877
- pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
878
- lookbehind: !0
879
- }
880
- // See rest below
881
- }
882
- },
883
- url: {
884
- // https://drafts.csswg.org/css-values-3/#urls
885
- pattern: RegExp("\\burl\\((?:" + f.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
886
- greedy: !0,
887
- inside: {
888
- function: /^url/i,
889
- punctuation: /^\(|\)$/,
890
- string: {
891
- pattern: RegExp("^" + f.source + "$"),
892
- alias: "url"
893
- }
894
- }
895
- },
896
- selector: {
897
- pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` + f.source + ")*(?=\\s*\\{)"),
898
- lookbehind: !0
899
- },
900
- string: {
901
- pattern: f,
902
- greedy: !0
903
- },
904
- property: {
905
- pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
906
- lookbehind: !0
907
- },
908
- important: /!important\b/i,
909
- function: {
910
- pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
911
- lookbehind: !0
912
- },
913
- punctuation: /[(){};:,]/
914
- }, g.languages.css.atrule.inside.rest = g.languages.css;
915
- var F = g.languages.markup;
916
- F && (F.tag.addInlined("style", "css"), F.tag.addAttribute("style", "css"));
917
- })(i), i.languages.clike = {
918
- comment: [
919
- {
920
- pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
921
- lookbehind: !0,
922
- greedy: !0
923
- },
924
- {
925
- pattern: /(^|[^\\:])\/\/.*/,
926
- lookbehind: !0,
927
- greedy: !0
928
- }
929
- ],
930
- string: {
931
- pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
932
- greedy: !0
933
- },
934
- "class-name": {
935
- pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
936
- lookbehind: !0,
937
- inside: {
938
- punctuation: /[.\\]/
939
- }
940
- },
941
- keyword: /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
942
- boolean: /\b(?:false|true)\b/,
943
- function: /\b\w+(?=\()/,
944
- number: /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
945
- operator: /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
946
- punctuation: /[{}[\];(),.:]/
947
- }, i.languages.javascript = i.languages.extend("clike", {
948
- "class-name": [
949
- i.languages.clike["class-name"],
950
- {
951
- pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
952
- lookbehind: !0
953
- }
954
- ],
955
- keyword: [
956
- {
957
- pattern: /((?:^|\})\s*)catch\b/,
958
- lookbehind: !0
959
- },
960
- {
961
- 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/,
962
- lookbehind: !0
963
- }
964
- ],
965
- // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
966
- function: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
967
- number: {
968
- pattern: RegExp(
969
- /(^|[^\w$])/.source + "(?:" + // constant
970
- (/NaN|Infinity/.source + "|" + // binary integer
971
- /0[bB][01]+(?:_[01]+)*n?/.source + "|" + // octal integer
972
- /0[oO][0-7]+(?:_[0-7]+)*n?/.source + "|" + // hexadecimal integer
973
- /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + "|" + // decimal bigint
974
- /\d+(?:_\d+)*n/.source + "|" + // decimal number (integer or float) but no bigint
975
- /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ")" + /(?![\w$])/.source
976
- ),
977
- lookbehind: !0
978
- },
979
- operator: /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
980
- }), i.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/, i.languages.insertBefore("javascript", "keyword", {
981
- regex: {
982
- pattern: RegExp(
983
- // lookbehind
984
- // eslint-disable-next-line regexp/no-dupe-characters-character-class
985
- /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source + // Regex pattern:
986
- // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
987
- // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
988
- // with the only syntax, so we have to define 2 different regex patterns.
989
- /\//.source + "(?:" + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + "|" + // `v` flag syntax. This supports 3 levels of nested character classes.
990
- /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ")" + // lookahead
991
- /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
992
- ),
993
- lookbehind: !0,
994
- greedy: !0,
995
- inside: {
996
- "regex-source": {
997
- pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
998
- lookbehind: !0,
999
- alias: "language-regex",
1000
- inside: i.languages.regex
1001
- },
1002
- "regex-delimiter": /^\/|\/$/,
1003
- "regex-flags": /^[a-z]+$/
1004
- }
1005
- },
1006
- // This must be declared before keyword because we use "function" inside the look-forward
1007
- "function-variable": {
1008
- 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*=>))/,
1009
- alias: "function"
1010
- },
1011
- parameter: [
1012
- {
1013
- pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1014
- lookbehind: !0,
1015
- inside: i.languages.javascript
1016
- },
1017
- {
1018
- pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1019
- lookbehind: !0,
1020
- inside: i.languages.javascript
1021
- },
1022
- {
1023
- pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1024
- lookbehind: !0,
1025
- inside: i.languages.javascript
1026
- },
1027
- {
1028
- 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*\{)/,
1029
- lookbehind: !0,
1030
- inside: i.languages.javascript
1031
- }
1032
- ],
1033
- constant: /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1034
- }), i.languages.insertBefore("javascript", "string", {
1035
- hashbang: {
1036
- pattern: /^#!.*/,
1037
- greedy: !0,
1038
- alias: "comment"
1039
- },
1040
- "template-string": {
1041
- pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1042
- greedy: !0,
1043
- inside: {
1044
- "template-punctuation": {
1045
- pattern: /^`|`$/,
1046
- alias: "string"
1047
- },
1048
- interpolation: {
1049
- pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1050
- lookbehind: !0,
1051
- inside: {
1052
- "interpolation-punctuation": {
1053
- pattern: /^\$\{|\}$/,
1054
- alias: "punctuation"
1055
- },
1056
- rest: i.languages.javascript
1057
- }
1058
- },
1059
- string: /[\s\S]+/
1060
- }
1061
- },
1062
- "string-property": {
1063
- pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
1064
- lookbehind: !0,
1065
- greedy: !0,
1066
- alias: "property"
1067
- }
1068
- }), i.languages.insertBefore("javascript", "operator", {
1069
- "literal-property": {
1070
- pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
1071
- lookbehind: !0,
1072
- alias: "property"
1073
- }
1074
- }), i.languages.markup && (i.languages.markup.tag.addInlined("script", "javascript"), i.languages.markup.tag.addAttribute(
1075
- /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,
1076
- "javascript"
1077
- )), i.languages.js = i.languages.javascript, (function() {
1078
- if (typeof i > "u" || typeof document > "u")
1079
- return;
1080
- Element.prototype.matches || (Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector);
1081
- var g = "Loading…", f = function(p, c) {
1082
- return "✖ Error " + p + " while fetching file: " + c;
1083
- }, F = "✖ Error: File does not exist or is empty", A = {
1084
- js: "javascript",
1085
- py: "python",
1086
- rb: "ruby",
1087
- ps1: "powershell",
1088
- psm1: "powershell",
1089
- sh: "bash",
1090
- bat: "batch",
1091
- h: "c",
1092
- tex: "latex"
1093
- }, s = "data-src-status", y = "loading", $ = "loaded", P = "failed", T = "pre[data-src]:not([" + s + '="' + $ + '"]):not([' + s + '="' + y + '"])';
1094
- function S(p, c, h) {
1095
- var t = new XMLHttpRequest();
1096
- t.open("GET", p, !0), t.onreadystatechange = function() {
1097
- t.readyState == 4 && (t.status < 400 && t.responseText ? c(t.responseText) : t.status >= 400 ? h(f(t.status, t.statusText)) : h(F));
1098
- }, t.send(null);
1099
- }
1100
- function H(p) {
1101
- var c = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(p || "");
1102
- if (c) {
1103
- var h = Number(c[1]), t = c[2], e = c[3];
1104
- return t ? e ? [h, Number(e)] : [h, void 0] : [h, h];
1105
- }
1106
- }
1107
- i.hooks.add("before-highlightall", function(p) {
1108
- p.selector += ", " + T;
1109
- }), i.hooks.add("before-sanity-check", function(p) {
1110
- var c = (
1111
- /** @type {HTMLPreElement} */
1112
- p.element
1113
- );
1114
- if (c.matches(T)) {
1115
- p.code = "", c.setAttribute(s, y);
1116
- var h = c.appendChild(document.createElement("CODE"));
1117
- h.textContent = g;
1118
- var t = c.getAttribute("data-src"), e = p.language;
1119
- if (e === "none") {
1120
- var a = (/\.(\w+)$/.exec(t) || [, "none"])[1];
1121
- e = A[a] || a;
1122
- }
1123
- i.util.setLanguage(h, e), i.util.setLanguage(c, e);
1124
- var n = i.plugins.autoloader;
1125
- n && n.loadLanguages(e), S(
1126
- t,
1127
- function(r) {
1128
- c.setAttribute(s, $);
1129
- var l = H(c.getAttribute("data-range"));
1130
- if (l) {
1131
- var o = r.split(/\r\n?|\n/g), u = l[0], d = l[1] == null ? o.length : l[1];
1132
- u < 0 && (u += o.length), u = Math.max(0, Math.min(u - 1, o.length)), d < 0 && (d += o.length), d = Math.max(0, Math.min(d, o.length)), r = o.slice(u, d).join(`
1133
- `), c.hasAttribute("data-start") || c.setAttribute("data-start", String(u + 1));
1134
- }
1135
- h.textContent = r, i.highlightElement(h);
1136
- },
1137
- function(r) {
1138
- c.setAttribute(s, P), h.textContent = r;
1139
- }
1140
- );
1141
- }
1142
- }), i.plugins.fileHighlight = {
1143
- /**
1144
- * Executes the File Highlight plugin for all matching `pre` elements under the given container.
1145
- *
1146
- * Note: Elements which are already loaded or currently loading will not be touched by this method.
1147
- *
1148
- * @param {ParentNode} [container=document]
1149
- */
1150
- highlight: function(c) {
1151
- for (var h = (c || document).querySelectorAll(T), t = 0, e; e = h[t++]; )
1152
- i.highlightElement(e);
1153
- }
1154
- };
1155
- var L = !1;
1156
- i.fileHighlight = function() {
1157
- L || (console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."), L = !0), i.plugins.fileHighlight.highlight.apply(this, arguments);
1158
- };
1159
- })();
1160
- })(Z)), Z.exports;
1161
- }
1162
- var ge = oe();
1163
- const B = /* @__PURE__ */ le(ge), ce = "_code_1uijz_1", de = "_code_title_1uijz_6", fe = "_code__value_1uijz_10", pe = "_code__title_1uijz_15", R = {
1164
- code: ce,
1165
- code_title: de,
1166
- code__value: fe,
1167
- code__title: pe
1168
- };
1169
- function xe({
1170
- language: b = "javascript",
1171
- children: z = "",
1172
- title: i,
1173
- className: g
1174
- }) {
1175
- const f = ie(
1176
- () => B.highlight(
1177
- z,
1178
- B.languages[b] ?? B.languages.javascript,
1179
- b
1180
- ),
1181
- [z, b]
1182
- );
1183
- return /* @__PURE__ */ ne(ue, { className: g, children: [
1184
- i ? /* @__PURE__ */ j(J, { elevated: !0, className: R.code__title, children: /* @__PURE__ */ j(se, { size: "sm", color: "dimmer", children: i }) }) : null,
1185
- /* @__PURE__ */ j(
1186
- J,
1187
- {
1188
- elevated: !0,
1189
- className: re(R.code, i && R.code_title),
1190
- children: /* @__PURE__ */ j("pre", { children: /* @__PURE__ */ j(
1191
- "code",
1192
- {
1193
- className: R.code__value,
1194
- dangerouslySetInnerHTML: {
1195
- __html: f
1196
- }
1197
- }
1198
- ) })
1199
- }
1200
- )
1201
- ] });
1202
- }
1203
- export {
1204
- xe as C,
1205
- le as g
1206
- };