react-markdown-table-ts 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js DELETED
@@ -1,4323 +0,0 @@
1
- import require$$0, { useRef, useMemo, useEffect } from 'react';
2
-
3
- /******************************************************************************
4
- Copyright (c) Microsoft Corporation.
5
-
6
- Permission to use, copy, modify, and/or distribute this software for any
7
- purpose with or without fee is hereby granted.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
- PERFORMANCE OF THIS SOFTWARE.
16
- ***************************************************************************** */
17
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
18
-
19
- var extendStatics = function(d, b) {
20
- extendStatics = Object.setPrototypeOf ||
21
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
22
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
23
- return extendStatics(d, b);
24
- };
25
-
26
- function __extends(d, b) {
27
- if (typeof b !== "function" && b !== null)
28
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
29
- extendStatics(d, b);
30
- function __() { this.constructor = d; }
31
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
32
- }
33
-
34
- var __assign = function() {
35
- __assign = Object.assign || function __assign(t) {
36
- for (var s, i = 1, n = arguments.length; i < n; i++) {
37
- s = arguments[i];
38
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
39
- }
40
- return t;
41
- };
42
- return __assign.apply(this, arguments);
43
- };
44
-
45
- function __spreadArray(to, from, pack) {
46
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
47
- if (ar || !(i in from)) {
48
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
49
- ar[i] = from[i];
50
- }
51
- }
52
- return to.concat(ar || Array.prototype.slice.call(from));
53
- }
54
-
55
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
56
- var e = new Error(message);
57
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
58
- };
59
-
60
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
61
-
62
- function getDefaultExportFromCjs (x) {
63
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
64
- }
65
-
66
- var jsxRuntime = {exports: {}};
67
-
68
- var reactJsxRuntime_production_min = {};
69
-
70
- /**
71
- * @license React
72
- * react-jsx-runtime.production.min.js
73
- *
74
- * Copyright (c) Facebook, Inc. and its affiliates.
75
- *
76
- * This source code is licensed under the MIT license found in the
77
- * LICENSE file in the root directory of this source tree.
78
- */
79
-
80
- var hasRequiredReactJsxRuntime_production_min;
81
-
82
- function requireReactJsxRuntime_production_min () {
83
- if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
84
- hasRequiredReactJsxRuntime_production_min = 1;
85
- var f=require$$0,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};
86
- function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;
87
- return reactJsxRuntime_production_min;
88
- }
89
-
90
- var reactJsxRuntime_development = {};
91
-
92
- /**
93
- * @license React
94
- * react-jsx-runtime.development.js
95
- *
96
- * Copyright (c) Facebook, Inc. and its affiliates.
97
- *
98
- * This source code is licensed under the MIT license found in the
99
- * LICENSE file in the root directory of this source tree.
100
- */
101
-
102
- var hasRequiredReactJsxRuntime_development;
103
-
104
- function requireReactJsxRuntime_development () {
105
- if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
106
- hasRequiredReactJsxRuntime_development = 1;
107
-
108
- if (process.env.NODE_ENV !== "production") {
109
- (function() {
110
-
111
- var React = require$$0;
112
-
113
- // ATTENTION
114
- // When adding new symbols to this file,
115
- // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
116
- // The Symbol used to tag the ReactElement-like types.
117
- var REACT_ELEMENT_TYPE = Symbol.for('react.element');
118
- var REACT_PORTAL_TYPE = Symbol.for('react.portal');
119
- var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
120
- var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
121
- var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
122
- var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
123
- var REACT_CONTEXT_TYPE = Symbol.for('react.context');
124
- var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
125
- var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
126
- var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
127
- var REACT_MEMO_TYPE = Symbol.for('react.memo');
128
- var REACT_LAZY_TYPE = Symbol.for('react.lazy');
129
- var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
130
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
131
- var FAUX_ITERATOR_SYMBOL = '@@iterator';
132
- function getIteratorFn(maybeIterable) {
133
- if (maybeIterable === null || typeof maybeIterable !== 'object') {
134
- return null;
135
- }
136
-
137
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
138
-
139
- if (typeof maybeIterator === 'function') {
140
- return maybeIterator;
141
- }
142
-
143
- return null;
144
- }
145
-
146
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
147
-
148
- function error(format) {
149
- {
150
- {
151
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
152
- args[_key2 - 1] = arguments[_key2];
153
- }
154
-
155
- printWarning('error', format, args);
156
- }
157
- }
158
- }
159
-
160
- function printWarning(level, format, args) {
161
- // When changing this logic, you might want to also
162
- // update consoleWithStackDev.www.js as well.
163
- {
164
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
165
- var stack = ReactDebugCurrentFrame.getStackAddendum();
166
-
167
- if (stack !== '') {
168
- format += '%s';
169
- args = args.concat([stack]);
170
- } // eslint-disable-next-line react-internal/safe-string-coercion
171
-
172
-
173
- var argsWithFormat = args.map(function (item) {
174
- return String(item);
175
- }); // Careful: RN currently depends on this prefix
176
-
177
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
178
- // breaks IE9: https://github.com/facebook/react/issues/13610
179
- // eslint-disable-next-line react-internal/no-production-logging
180
-
181
- Function.prototype.apply.call(console[level], console, argsWithFormat);
182
- }
183
- }
184
-
185
- // -----------------------------------------------------------------------------
186
-
187
- var enableScopeAPI = false; // Experimental Create Event Handle API.
188
- var enableCacheElement = false;
189
- var enableTransitionTracing = false; // No known bugs, but needs performance testing
190
-
191
- var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
192
- // stuff. Intended to enable React core members to more easily debug scheduling
193
- // issues in DEV builds.
194
-
195
- var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
196
-
197
- var REACT_MODULE_REFERENCE;
198
-
199
- {
200
- REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
201
- }
202
-
203
- function isValidElementType(type) {
204
- if (typeof type === 'string' || typeof type === 'function') {
205
- return true;
206
- } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
207
-
208
-
209
- if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
210
- return true;
211
- }
212
-
213
- if (typeof type === 'object' && type !== null) {
214
- if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
215
- // types supported by any Flight configuration anywhere since
216
- // we don't know which Flight build this will end up being used
217
- // with.
218
- type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
219
- return true;
220
- }
221
- }
222
-
223
- return false;
224
- }
225
-
226
- function getWrappedName(outerType, innerType, wrapperName) {
227
- var displayName = outerType.displayName;
228
-
229
- if (displayName) {
230
- return displayName;
231
- }
232
-
233
- var functionName = innerType.displayName || innerType.name || '';
234
- return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
235
- } // Keep in sync with react-reconciler/getComponentNameFromFiber
236
-
237
-
238
- function getContextName(type) {
239
- return type.displayName || 'Context';
240
- } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
241
-
242
-
243
- function getComponentNameFromType(type) {
244
- if (type == null) {
245
- // Host root, text node or just invalid type.
246
- return null;
247
- }
248
-
249
- {
250
- if (typeof type.tag === 'number') {
251
- error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
252
- }
253
- }
254
-
255
- if (typeof type === 'function') {
256
- return type.displayName || type.name || null;
257
- }
258
-
259
- if (typeof type === 'string') {
260
- return type;
261
- }
262
-
263
- switch (type) {
264
- case REACT_FRAGMENT_TYPE:
265
- return 'Fragment';
266
-
267
- case REACT_PORTAL_TYPE:
268
- return 'Portal';
269
-
270
- case REACT_PROFILER_TYPE:
271
- return 'Profiler';
272
-
273
- case REACT_STRICT_MODE_TYPE:
274
- return 'StrictMode';
275
-
276
- case REACT_SUSPENSE_TYPE:
277
- return 'Suspense';
278
-
279
- case REACT_SUSPENSE_LIST_TYPE:
280
- return 'SuspenseList';
281
-
282
- }
283
-
284
- if (typeof type === 'object') {
285
- switch (type.$$typeof) {
286
- case REACT_CONTEXT_TYPE:
287
- var context = type;
288
- return getContextName(context) + '.Consumer';
289
-
290
- case REACT_PROVIDER_TYPE:
291
- var provider = type;
292
- return getContextName(provider._context) + '.Provider';
293
-
294
- case REACT_FORWARD_REF_TYPE:
295
- return getWrappedName(type, type.render, 'ForwardRef');
296
-
297
- case REACT_MEMO_TYPE:
298
- var outerName = type.displayName || null;
299
-
300
- if (outerName !== null) {
301
- return outerName;
302
- }
303
-
304
- return getComponentNameFromType(type.type) || 'Memo';
305
-
306
- case REACT_LAZY_TYPE:
307
- {
308
- var lazyComponent = type;
309
- var payload = lazyComponent._payload;
310
- var init = lazyComponent._init;
311
-
312
- try {
313
- return getComponentNameFromType(init(payload));
314
- } catch (x) {
315
- return null;
316
- }
317
- }
318
-
319
- // eslint-disable-next-line no-fallthrough
320
- }
321
- }
322
-
323
- return null;
324
- }
325
-
326
- var assign = Object.assign;
327
-
328
- // Helpers to patch console.logs to avoid logging during side-effect free
329
- // replaying on render function. This currently only patches the object
330
- // lazily which won't cover if the log function was extracted eagerly.
331
- // We could also eagerly patch the method.
332
- var disabledDepth = 0;
333
- var prevLog;
334
- var prevInfo;
335
- var prevWarn;
336
- var prevError;
337
- var prevGroup;
338
- var prevGroupCollapsed;
339
- var prevGroupEnd;
340
-
341
- function disabledLog() {}
342
-
343
- disabledLog.__reactDisabledLog = true;
344
- function disableLogs() {
345
- {
346
- if (disabledDepth === 0) {
347
- /* eslint-disable react-internal/no-production-logging */
348
- prevLog = console.log;
349
- prevInfo = console.info;
350
- prevWarn = console.warn;
351
- prevError = console.error;
352
- prevGroup = console.group;
353
- prevGroupCollapsed = console.groupCollapsed;
354
- prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
355
-
356
- var props = {
357
- configurable: true,
358
- enumerable: true,
359
- value: disabledLog,
360
- writable: true
361
- }; // $FlowFixMe Flow thinks console is immutable.
362
-
363
- Object.defineProperties(console, {
364
- info: props,
365
- log: props,
366
- warn: props,
367
- error: props,
368
- group: props,
369
- groupCollapsed: props,
370
- groupEnd: props
371
- });
372
- /* eslint-enable react-internal/no-production-logging */
373
- }
374
-
375
- disabledDepth++;
376
- }
377
- }
378
- function reenableLogs() {
379
- {
380
- disabledDepth--;
381
-
382
- if (disabledDepth === 0) {
383
- /* eslint-disable react-internal/no-production-logging */
384
- var props = {
385
- configurable: true,
386
- enumerable: true,
387
- writable: true
388
- }; // $FlowFixMe Flow thinks console is immutable.
389
-
390
- Object.defineProperties(console, {
391
- log: assign({}, props, {
392
- value: prevLog
393
- }),
394
- info: assign({}, props, {
395
- value: prevInfo
396
- }),
397
- warn: assign({}, props, {
398
- value: prevWarn
399
- }),
400
- error: assign({}, props, {
401
- value: prevError
402
- }),
403
- group: assign({}, props, {
404
- value: prevGroup
405
- }),
406
- groupCollapsed: assign({}, props, {
407
- value: prevGroupCollapsed
408
- }),
409
- groupEnd: assign({}, props, {
410
- value: prevGroupEnd
411
- })
412
- });
413
- /* eslint-enable react-internal/no-production-logging */
414
- }
415
-
416
- if (disabledDepth < 0) {
417
- error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
418
- }
419
- }
420
- }
421
-
422
- var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
423
- var prefix;
424
- function describeBuiltInComponentFrame(name, source, ownerFn) {
425
- {
426
- if (prefix === undefined) {
427
- // Extract the VM specific prefix used by each line.
428
- try {
429
- throw Error();
430
- } catch (x) {
431
- var match = x.stack.trim().match(/\n( *(at )?)/);
432
- prefix = match && match[1] || '';
433
- }
434
- } // We use the prefix to ensure our stacks line up with native stack frames.
435
-
436
-
437
- return '\n' + prefix + name;
438
- }
439
- }
440
- var reentry = false;
441
- var componentFrameCache;
442
-
443
- {
444
- var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
445
- componentFrameCache = new PossiblyWeakMap();
446
- }
447
-
448
- function describeNativeComponentFrame(fn, construct) {
449
- // If something asked for a stack inside a fake render, it should get ignored.
450
- if ( !fn || reentry) {
451
- return '';
452
- }
453
-
454
- {
455
- var frame = componentFrameCache.get(fn);
456
-
457
- if (frame !== undefined) {
458
- return frame;
459
- }
460
- }
461
-
462
- var control;
463
- reentry = true;
464
- var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
465
-
466
- Error.prepareStackTrace = undefined;
467
- var previousDispatcher;
468
-
469
- {
470
- previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
471
- // for warnings.
472
-
473
- ReactCurrentDispatcher.current = null;
474
- disableLogs();
475
- }
476
-
477
- try {
478
- // This should throw.
479
- if (construct) {
480
- // Something should be setting the props in the constructor.
481
- var Fake = function () {
482
- throw Error();
483
- }; // $FlowFixMe
484
-
485
-
486
- Object.defineProperty(Fake.prototype, 'props', {
487
- set: function () {
488
- // We use a throwing setter instead of frozen or non-writable props
489
- // because that won't throw in a non-strict mode function.
490
- throw Error();
491
- }
492
- });
493
-
494
- if (typeof Reflect === 'object' && Reflect.construct) {
495
- // We construct a different control for this case to include any extra
496
- // frames added by the construct call.
497
- try {
498
- Reflect.construct(Fake, []);
499
- } catch (x) {
500
- control = x;
501
- }
502
-
503
- Reflect.construct(fn, [], Fake);
504
- } else {
505
- try {
506
- Fake.call();
507
- } catch (x) {
508
- control = x;
509
- }
510
-
511
- fn.call(Fake.prototype);
512
- }
513
- } else {
514
- try {
515
- throw Error();
516
- } catch (x) {
517
- control = x;
518
- }
519
-
520
- fn();
521
- }
522
- } catch (sample) {
523
- // This is inlined manually because closure doesn't do it for us.
524
- if (sample && control && typeof sample.stack === 'string') {
525
- // This extracts the first frame from the sample that isn't also in the control.
526
- // Skipping one frame that we assume is the frame that calls the two.
527
- var sampleLines = sample.stack.split('\n');
528
- var controlLines = control.stack.split('\n');
529
- var s = sampleLines.length - 1;
530
- var c = controlLines.length - 1;
531
-
532
- while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
533
- // We expect at least one stack frame to be shared.
534
- // Typically this will be the root most one. However, stack frames may be
535
- // cut off due to maximum stack limits. In this case, one maybe cut off
536
- // earlier than the other. We assume that the sample is longer or the same
537
- // and there for cut off earlier. So we should find the root most frame in
538
- // the sample somewhere in the control.
539
- c--;
540
- }
541
-
542
- for (; s >= 1 && c >= 0; s--, c--) {
543
- // Next we find the first one that isn't the same which should be the
544
- // frame that called our sample function and the control.
545
- if (sampleLines[s] !== controlLines[c]) {
546
- // In V8, the first line is describing the message but other VMs don't.
547
- // If we're about to return the first line, and the control is also on the same
548
- // line, that's a pretty good indicator that our sample threw at same line as
549
- // the control. I.e. before we entered the sample frame. So we ignore this result.
550
- // This can happen if you passed a class to function component, or non-function.
551
- if (s !== 1 || c !== 1) {
552
- do {
553
- s--;
554
- c--; // We may still have similar intermediate frames from the construct call.
555
- // The next one that isn't the same should be our match though.
556
-
557
- if (c < 0 || sampleLines[s] !== controlLines[c]) {
558
- // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
559
- var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
560
- // but we have a user-provided "displayName"
561
- // splice it in to make the stack more readable.
562
-
563
-
564
- if (fn.displayName && _frame.includes('<anonymous>')) {
565
- _frame = _frame.replace('<anonymous>', fn.displayName);
566
- }
567
-
568
- {
569
- if (typeof fn === 'function') {
570
- componentFrameCache.set(fn, _frame);
571
- }
572
- } // Return the line we found.
573
-
574
-
575
- return _frame;
576
- }
577
- } while (s >= 1 && c >= 0);
578
- }
579
-
580
- break;
581
- }
582
- }
583
- }
584
- } finally {
585
- reentry = false;
586
-
587
- {
588
- ReactCurrentDispatcher.current = previousDispatcher;
589
- reenableLogs();
590
- }
591
-
592
- Error.prepareStackTrace = previousPrepareStackTrace;
593
- } // Fallback to just using the name if we couldn't make it throw.
594
-
595
-
596
- var name = fn ? fn.displayName || fn.name : '';
597
- var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
598
-
599
- {
600
- if (typeof fn === 'function') {
601
- componentFrameCache.set(fn, syntheticFrame);
602
- }
603
- }
604
-
605
- return syntheticFrame;
606
- }
607
- function describeFunctionComponentFrame(fn, source, ownerFn) {
608
- {
609
- return describeNativeComponentFrame(fn, false);
610
- }
611
- }
612
-
613
- function shouldConstruct(Component) {
614
- var prototype = Component.prototype;
615
- return !!(prototype && prototype.isReactComponent);
616
- }
617
-
618
- function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
619
-
620
- if (type == null) {
621
- return '';
622
- }
623
-
624
- if (typeof type === 'function') {
625
- {
626
- return describeNativeComponentFrame(type, shouldConstruct(type));
627
- }
628
- }
629
-
630
- if (typeof type === 'string') {
631
- return describeBuiltInComponentFrame(type);
632
- }
633
-
634
- switch (type) {
635
- case REACT_SUSPENSE_TYPE:
636
- return describeBuiltInComponentFrame('Suspense');
637
-
638
- case REACT_SUSPENSE_LIST_TYPE:
639
- return describeBuiltInComponentFrame('SuspenseList');
640
- }
641
-
642
- if (typeof type === 'object') {
643
- switch (type.$$typeof) {
644
- case REACT_FORWARD_REF_TYPE:
645
- return describeFunctionComponentFrame(type.render);
646
-
647
- case REACT_MEMO_TYPE:
648
- // Memo may contain any component type so we recursively resolve it.
649
- return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
650
-
651
- case REACT_LAZY_TYPE:
652
- {
653
- var lazyComponent = type;
654
- var payload = lazyComponent._payload;
655
- var init = lazyComponent._init;
656
-
657
- try {
658
- // Lazy may contain any component type so we recursively resolve it.
659
- return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
660
- } catch (x) {}
661
- }
662
- }
663
- }
664
-
665
- return '';
666
- }
667
-
668
- var hasOwnProperty = Object.prototype.hasOwnProperty;
669
-
670
- var loggedTypeFailures = {};
671
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
672
-
673
- function setCurrentlyValidatingElement(element) {
674
- {
675
- if (element) {
676
- var owner = element._owner;
677
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
678
- ReactDebugCurrentFrame.setExtraStackFrame(stack);
679
- } else {
680
- ReactDebugCurrentFrame.setExtraStackFrame(null);
681
- }
682
- }
683
- }
684
-
685
- function checkPropTypes(typeSpecs, values, location, componentName, element) {
686
- {
687
- // $FlowFixMe This is okay but Flow doesn't know it.
688
- var has = Function.call.bind(hasOwnProperty);
689
-
690
- for (var typeSpecName in typeSpecs) {
691
- if (has(typeSpecs, typeSpecName)) {
692
- var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
693
- // fail the render phase where it didn't fail before. So we log it.
694
- // After these have been cleaned up, we'll let them throw.
695
-
696
- try {
697
- // This is intentionally an invariant that gets caught. It's the same
698
- // behavior as without this statement except with a better message.
699
- if (typeof typeSpecs[typeSpecName] !== 'function') {
700
- // eslint-disable-next-line react-internal/prod-error-codes
701
- var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
702
- err.name = 'Invariant Violation';
703
- throw err;
704
- }
705
-
706
- error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
707
- } catch (ex) {
708
- error$1 = ex;
709
- }
710
-
711
- if (error$1 && !(error$1 instanceof Error)) {
712
- setCurrentlyValidatingElement(element);
713
-
714
- error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
715
-
716
- setCurrentlyValidatingElement(null);
717
- }
718
-
719
- if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
720
- // Only monitor this failure once because there tends to be a lot of the
721
- // same error.
722
- loggedTypeFailures[error$1.message] = true;
723
- setCurrentlyValidatingElement(element);
724
-
725
- error('Failed %s type: %s', location, error$1.message);
726
-
727
- setCurrentlyValidatingElement(null);
728
- }
729
- }
730
- }
731
- }
732
- }
733
-
734
- var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
735
-
736
- function isArray(a) {
737
- return isArrayImpl(a);
738
- }
739
-
740
- /*
741
- * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
742
- * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
743
- *
744
- * The functions in this module will throw an easier-to-understand,
745
- * easier-to-debug exception with a clear errors message message explaining the
746
- * problem. (Instead of a confusing exception thrown inside the implementation
747
- * of the `value` object).
748
- */
749
- // $FlowFixMe only called in DEV, so void return is not possible.
750
- function typeName(value) {
751
- {
752
- // toStringTag is needed for namespaced types like Temporal.Instant
753
- var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
754
- var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
755
- return type;
756
- }
757
- } // $FlowFixMe only called in DEV, so void return is not possible.
758
-
759
-
760
- function willCoercionThrow(value) {
761
- {
762
- try {
763
- testStringCoercion(value);
764
- return false;
765
- } catch (e) {
766
- return true;
767
- }
768
- }
769
- }
770
-
771
- function testStringCoercion(value) {
772
- // If you ended up here by following an exception call stack, here's what's
773
- // happened: you supplied an object or symbol value to React (as a prop, key,
774
- // DOM attribute, CSS property, string ref, etc.) and when React tried to
775
- // coerce it to a string using `'' + value`, an exception was thrown.
776
- //
777
- // The most common types that will cause this exception are `Symbol` instances
778
- // and Temporal objects like `Temporal.Instant`. But any object that has a
779
- // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
780
- // exception. (Library authors do this to prevent users from using built-in
781
- // numeric operators like `+` or comparison operators like `>=` because custom
782
- // methods are needed to perform accurate arithmetic or comparison.)
783
- //
784
- // To fix the problem, coerce this object or symbol value to a string before
785
- // passing it to React. The most reliable way is usually `String(value)`.
786
- //
787
- // To find which value is throwing, check the browser or debugger console.
788
- // Before this exception was thrown, there should be `console.error` output
789
- // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
790
- // problem and how that type was used: key, atrribute, input value prop, etc.
791
- // In most cases, this console output also shows the component and its
792
- // ancestor components where the exception happened.
793
- //
794
- // eslint-disable-next-line react-internal/safe-string-coercion
795
- return '' + value;
796
- }
797
- function checkKeyStringCoercion(value) {
798
- {
799
- if (willCoercionThrow(value)) {
800
- error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
801
-
802
- return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
803
- }
804
- }
805
- }
806
-
807
- var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
808
- var RESERVED_PROPS = {
809
- key: true,
810
- ref: true,
811
- __self: true,
812
- __source: true
813
- };
814
- var specialPropKeyWarningShown;
815
- var specialPropRefWarningShown;
816
- var didWarnAboutStringRefs;
817
-
818
- {
819
- didWarnAboutStringRefs = {};
820
- }
821
-
822
- function hasValidRef(config) {
823
- {
824
- if (hasOwnProperty.call(config, 'ref')) {
825
- var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
826
-
827
- if (getter && getter.isReactWarning) {
828
- return false;
829
- }
830
- }
831
- }
832
-
833
- return config.ref !== undefined;
834
- }
835
-
836
- function hasValidKey(config) {
837
- {
838
- if (hasOwnProperty.call(config, 'key')) {
839
- var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
840
-
841
- if (getter && getter.isReactWarning) {
842
- return false;
843
- }
844
- }
845
- }
846
-
847
- return config.key !== undefined;
848
- }
849
-
850
- function warnIfStringRefCannotBeAutoConverted(config, self) {
851
- {
852
- if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
853
- var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
854
-
855
- if (!didWarnAboutStringRefs[componentName]) {
856
- error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
857
-
858
- didWarnAboutStringRefs[componentName] = true;
859
- }
860
- }
861
- }
862
- }
863
-
864
- function defineKeyPropWarningGetter(props, displayName) {
865
- {
866
- var warnAboutAccessingKey = function () {
867
- if (!specialPropKeyWarningShown) {
868
- specialPropKeyWarningShown = true;
869
-
870
- error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
871
- }
872
- };
873
-
874
- warnAboutAccessingKey.isReactWarning = true;
875
- Object.defineProperty(props, 'key', {
876
- get: warnAboutAccessingKey,
877
- configurable: true
878
- });
879
- }
880
- }
881
-
882
- function defineRefPropWarningGetter(props, displayName) {
883
- {
884
- var warnAboutAccessingRef = function () {
885
- if (!specialPropRefWarningShown) {
886
- specialPropRefWarningShown = true;
887
-
888
- error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
889
- }
890
- };
891
-
892
- warnAboutAccessingRef.isReactWarning = true;
893
- Object.defineProperty(props, 'ref', {
894
- get: warnAboutAccessingRef,
895
- configurable: true
896
- });
897
- }
898
- }
899
- /**
900
- * Factory method to create a new React element. This no longer adheres to
901
- * the class pattern, so do not use new to call it. Also, instanceof check
902
- * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
903
- * if something is a React Element.
904
- *
905
- * @param {*} type
906
- * @param {*} props
907
- * @param {*} key
908
- * @param {string|object} ref
909
- * @param {*} owner
910
- * @param {*} self A *temporary* helper to detect places where `this` is
911
- * different from the `owner` when React.createElement is called, so that we
912
- * can warn. We want to get rid of owner and replace string `ref`s with arrow
913
- * functions, and as long as `this` and owner are the same, there will be no
914
- * change in behavior.
915
- * @param {*} source An annotation object (added by a transpiler or otherwise)
916
- * indicating filename, line number, and/or other information.
917
- * @internal
918
- */
919
-
920
-
921
- var ReactElement = function (type, key, ref, self, source, owner, props) {
922
- var element = {
923
- // This tag allows us to uniquely identify this as a React Element
924
- $$typeof: REACT_ELEMENT_TYPE,
925
- // Built-in properties that belong on the element
926
- type: type,
927
- key: key,
928
- ref: ref,
929
- props: props,
930
- // Record the component responsible for creating this element.
931
- _owner: owner
932
- };
933
-
934
- {
935
- // The validation flag is currently mutative. We put it on
936
- // an external backing store so that we can freeze the whole object.
937
- // This can be replaced with a WeakMap once they are implemented in
938
- // commonly used development environments.
939
- element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
940
- // the validation flag non-enumerable (where possible, which should
941
- // include every environment we run tests in), so the test framework
942
- // ignores it.
943
-
944
- Object.defineProperty(element._store, 'validated', {
945
- configurable: false,
946
- enumerable: false,
947
- writable: true,
948
- value: false
949
- }); // self and source are DEV only properties.
950
-
951
- Object.defineProperty(element, '_self', {
952
- configurable: false,
953
- enumerable: false,
954
- writable: false,
955
- value: self
956
- }); // Two elements created in two different places should be considered
957
- // equal for testing purposes and therefore we hide it from enumeration.
958
-
959
- Object.defineProperty(element, '_source', {
960
- configurable: false,
961
- enumerable: false,
962
- writable: false,
963
- value: source
964
- });
965
-
966
- if (Object.freeze) {
967
- Object.freeze(element.props);
968
- Object.freeze(element);
969
- }
970
- }
971
-
972
- return element;
973
- };
974
- /**
975
- * https://github.com/reactjs/rfcs/pull/107
976
- * @param {*} type
977
- * @param {object} props
978
- * @param {string} key
979
- */
980
-
981
- function jsxDEV(type, config, maybeKey, source, self) {
982
- {
983
- var propName; // Reserved names are extracted
984
-
985
- var props = {};
986
- var key = null;
987
- var ref = null; // Currently, key can be spread in as a prop. This causes a potential
988
- // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
989
- // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
990
- // but as an intermediary step, we will use jsxDEV for everything except
991
- // <div {...props} key="Hi" />, because we aren't currently able to tell if
992
- // key is explicitly declared to be undefined or not.
993
-
994
- if (maybeKey !== undefined) {
995
- {
996
- checkKeyStringCoercion(maybeKey);
997
- }
998
-
999
- key = '' + maybeKey;
1000
- }
1001
-
1002
- if (hasValidKey(config)) {
1003
- {
1004
- checkKeyStringCoercion(config.key);
1005
- }
1006
-
1007
- key = '' + config.key;
1008
- }
1009
-
1010
- if (hasValidRef(config)) {
1011
- ref = config.ref;
1012
- warnIfStringRefCannotBeAutoConverted(config, self);
1013
- } // Remaining properties are added to a new props object
1014
-
1015
-
1016
- for (propName in config) {
1017
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
1018
- props[propName] = config[propName];
1019
- }
1020
- } // Resolve default props
1021
-
1022
-
1023
- if (type && type.defaultProps) {
1024
- var defaultProps = type.defaultProps;
1025
-
1026
- for (propName in defaultProps) {
1027
- if (props[propName] === undefined) {
1028
- props[propName] = defaultProps[propName];
1029
- }
1030
- }
1031
- }
1032
-
1033
- if (key || ref) {
1034
- var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
1035
-
1036
- if (key) {
1037
- defineKeyPropWarningGetter(props, displayName);
1038
- }
1039
-
1040
- if (ref) {
1041
- defineRefPropWarningGetter(props, displayName);
1042
- }
1043
- }
1044
-
1045
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
1046
- }
1047
- }
1048
-
1049
- var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
1050
- var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
1051
-
1052
- function setCurrentlyValidatingElement$1(element) {
1053
- {
1054
- if (element) {
1055
- var owner = element._owner;
1056
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1057
- ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
1058
- } else {
1059
- ReactDebugCurrentFrame$1.setExtraStackFrame(null);
1060
- }
1061
- }
1062
- }
1063
-
1064
- var propTypesMisspellWarningShown;
1065
-
1066
- {
1067
- propTypesMisspellWarningShown = false;
1068
- }
1069
- /**
1070
- * Verifies the object is a ReactElement.
1071
- * See https://reactjs.org/docs/react-api.html#isvalidelement
1072
- * @param {?object} object
1073
- * @return {boolean} True if `object` is a ReactElement.
1074
- * @final
1075
- */
1076
-
1077
-
1078
- function isValidElement(object) {
1079
- {
1080
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1081
- }
1082
- }
1083
-
1084
- function getDeclarationErrorAddendum() {
1085
- {
1086
- if (ReactCurrentOwner$1.current) {
1087
- var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
1088
-
1089
- if (name) {
1090
- return '\n\nCheck the render method of `' + name + '`.';
1091
- }
1092
- }
1093
-
1094
- return '';
1095
- }
1096
- }
1097
-
1098
- function getSourceInfoErrorAddendum(source) {
1099
- {
1100
- if (source !== undefined) {
1101
- var fileName = source.fileName.replace(/^.*[\\\/]/, '');
1102
- var lineNumber = source.lineNumber;
1103
- return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
1104
- }
1105
-
1106
- return '';
1107
- }
1108
- }
1109
- /**
1110
- * Warn if there's no key explicitly set on dynamic arrays of children or
1111
- * object keys are not valid. This allows us to keep track of children between
1112
- * updates.
1113
- */
1114
-
1115
-
1116
- var ownerHasKeyUseWarning = {};
1117
-
1118
- function getCurrentComponentErrorInfo(parentType) {
1119
- {
1120
- var info = getDeclarationErrorAddendum();
1121
-
1122
- if (!info) {
1123
- var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1124
-
1125
- if (parentName) {
1126
- info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1127
- }
1128
- }
1129
-
1130
- return info;
1131
- }
1132
- }
1133
- /**
1134
- * Warn if the element doesn't have an explicit key assigned to it.
1135
- * This element is in an array. The array could grow and shrink or be
1136
- * reordered. All children that haven't already been validated are required to
1137
- * have a "key" property assigned to it. Error statuses are cached so a warning
1138
- * will only be shown once.
1139
- *
1140
- * @internal
1141
- * @param {ReactElement} element Element that requires a key.
1142
- * @param {*} parentType element's parent's type.
1143
- */
1144
-
1145
-
1146
- function validateExplicitKey(element, parentType) {
1147
- {
1148
- if (!element._store || element._store.validated || element.key != null) {
1149
- return;
1150
- }
1151
-
1152
- element._store.validated = true;
1153
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1154
-
1155
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1156
- return;
1157
- }
1158
-
1159
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
1160
- // property, it may be the creator of the child that's responsible for
1161
- // assigning it a key.
1162
-
1163
- var childOwner = '';
1164
-
1165
- if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
1166
- // Give the component that originally created this child.
1167
- childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
1168
- }
1169
-
1170
- setCurrentlyValidatingElement$1(element);
1171
-
1172
- error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
1173
-
1174
- setCurrentlyValidatingElement$1(null);
1175
- }
1176
- }
1177
- /**
1178
- * Ensure that every element either is passed in a static location, in an
1179
- * array with an explicit keys property defined, or in an object literal
1180
- * with valid key property.
1181
- *
1182
- * @internal
1183
- * @param {ReactNode} node Statically passed child of any type.
1184
- * @param {*} parentType node's parent's type.
1185
- */
1186
-
1187
-
1188
- function validateChildKeys(node, parentType) {
1189
- {
1190
- if (typeof node !== 'object') {
1191
- return;
1192
- }
1193
-
1194
- if (isArray(node)) {
1195
- for (var i = 0; i < node.length; i++) {
1196
- var child = node[i];
1197
-
1198
- if (isValidElement(child)) {
1199
- validateExplicitKey(child, parentType);
1200
- }
1201
- }
1202
- } else if (isValidElement(node)) {
1203
- // This element was passed in a valid location.
1204
- if (node._store) {
1205
- node._store.validated = true;
1206
- }
1207
- } else if (node) {
1208
- var iteratorFn = getIteratorFn(node);
1209
-
1210
- if (typeof iteratorFn === 'function') {
1211
- // Entry iterators used to provide implicit keys,
1212
- // but now we print a separate warning for them later.
1213
- if (iteratorFn !== node.entries) {
1214
- var iterator = iteratorFn.call(node);
1215
- var step;
1216
-
1217
- while (!(step = iterator.next()).done) {
1218
- if (isValidElement(step.value)) {
1219
- validateExplicitKey(step.value, parentType);
1220
- }
1221
- }
1222
- }
1223
- }
1224
- }
1225
- }
1226
- }
1227
- /**
1228
- * Given an element, validate that its props follow the propTypes definition,
1229
- * provided by the type.
1230
- *
1231
- * @param {ReactElement} element
1232
- */
1233
-
1234
-
1235
- function validatePropTypes(element) {
1236
- {
1237
- var type = element.type;
1238
-
1239
- if (type === null || type === undefined || typeof type === 'string') {
1240
- return;
1241
- }
1242
-
1243
- var propTypes;
1244
-
1245
- if (typeof type === 'function') {
1246
- propTypes = type.propTypes;
1247
- } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
1248
- // Inner props are checked in the reconciler.
1249
- type.$$typeof === REACT_MEMO_TYPE)) {
1250
- propTypes = type.propTypes;
1251
- } else {
1252
- return;
1253
- }
1254
-
1255
- if (propTypes) {
1256
- // Intentionally inside to avoid triggering lazy initializers:
1257
- var name = getComponentNameFromType(type);
1258
- checkPropTypes(propTypes, element.props, 'prop', name, element);
1259
- } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1260
- propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
1261
-
1262
- var _name = getComponentNameFromType(type);
1263
-
1264
- error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
1265
- }
1266
-
1267
- if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
1268
- error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
1269
- }
1270
- }
1271
- }
1272
- /**
1273
- * Given a fragment, validate that it can only be provided with fragment props
1274
- * @param {ReactElement} fragment
1275
- */
1276
-
1277
-
1278
- function validateFragmentProps(fragment) {
1279
- {
1280
- var keys = Object.keys(fragment.props);
1281
-
1282
- for (var i = 0; i < keys.length; i++) {
1283
- var key = keys[i];
1284
-
1285
- if (key !== 'children' && key !== 'key') {
1286
- setCurrentlyValidatingElement$1(fragment);
1287
-
1288
- error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1289
-
1290
- setCurrentlyValidatingElement$1(null);
1291
- break;
1292
- }
1293
- }
1294
-
1295
- if (fragment.ref !== null) {
1296
- setCurrentlyValidatingElement$1(fragment);
1297
-
1298
- error('Invalid attribute `ref` supplied to `React.Fragment`.');
1299
-
1300
- setCurrentlyValidatingElement$1(null);
1301
- }
1302
- }
1303
- }
1304
-
1305
- var didWarnAboutKeySpread = {};
1306
- function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
1307
- {
1308
- var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
1309
- // succeed and there will likely be errors in render.
1310
-
1311
- if (!validType) {
1312
- var info = '';
1313
-
1314
- if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1315
- info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
1316
- }
1317
-
1318
- var sourceInfo = getSourceInfoErrorAddendum(source);
1319
-
1320
- if (sourceInfo) {
1321
- info += sourceInfo;
1322
- } else {
1323
- info += getDeclarationErrorAddendum();
1324
- }
1325
-
1326
- var typeString;
1327
-
1328
- if (type === null) {
1329
- typeString = 'null';
1330
- } else if (isArray(type)) {
1331
- typeString = 'array';
1332
- } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
1333
- typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
1334
- info = ' Did you accidentally export a JSX literal instead of a component?';
1335
- } else {
1336
- typeString = typeof type;
1337
- }
1338
-
1339
- error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
1340
- }
1341
-
1342
- var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
1343
- // TODO: Drop this when these are no longer allowed as the type argument.
1344
-
1345
- if (element == null) {
1346
- return element;
1347
- } // Skip key warning if the type isn't valid since our key validation logic
1348
- // doesn't expect a non-string/function type and can throw confusing errors.
1349
- // We don't want exception behavior to differ between dev and prod.
1350
- // (Rendering will throw with a helpful message and as soon as the type is
1351
- // fixed, the key warnings will appear.)
1352
-
1353
-
1354
- if (validType) {
1355
- var children = props.children;
1356
-
1357
- if (children !== undefined) {
1358
- if (isStaticChildren) {
1359
- if (isArray(children)) {
1360
- for (var i = 0; i < children.length; i++) {
1361
- validateChildKeys(children[i], type);
1362
- }
1363
-
1364
- if (Object.freeze) {
1365
- Object.freeze(children);
1366
- }
1367
- } else {
1368
- error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
1369
- }
1370
- } else {
1371
- validateChildKeys(children, type);
1372
- }
1373
- }
1374
- }
1375
-
1376
- {
1377
- if (hasOwnProperty.call(props, 'key')) {
1378
- var componentName = getComponentNameFromType(type);
1379
- var keys = Object.keys(props).filter(function (k) {
1380
- return k !== 'key';
1381
- });
1382
- var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
1383
-
1384
- if (!didWarnAboutKeySpread[componentName + beforeExample]) {
1385
- var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
1386
-
1387
- error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
1388
-
1389
- didWarnAboutKeySpread[componentName + beforeExample] = true;
1390
- }
1391
- }
1392
- }
1393
-
1394
- if (type === REACT_FRAGMENT_TYPE) {
1395
- validateFragmentProps(element);
1396
- } else {
1397
- validatePropTypes(element);
1398
- }
1399
-
1400
- return element;
1401
- }
1402
- } // These two functions exist to still get child warnings in dev
1403
- // even with the prod transform. This means that jsxDEV is purely
1404
- // opt-in behavior for better messages but that we won't stop
1405
- // giving you warnings if you use production apis.
1406
-
1407
- function jsxWithValidationStatic(type, props, key) {
1408
- {
1409
- return jsxWithValidation(type, props, key, true);
1410
- }
1411
- }
1412
- function jsxWithValidationDynamic(type, props, key) {
1413
- {
1414
- return jsxWithValidation(type, props, key, false);
1415
- }
1416
- }
1417
-
1418
- var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
1419
- // for now we can ship identical prod functions
1420
-
1421
- var jsxs = jsxWithValidationStatic ;
1422
-
1423
- reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
1424
- reactJsxRuntime_development.jsx = jsx;
1425
- reactJsxRuntime_development.jsxs = jsxs;
1426
- })();
1427
- }
1428
- return reactJsxRuntime_development;
1429
- }
1430
-
1431
- if (process.env.NODE_ENV === 'production') {
1432
- jsxRuntime.exports = requireReactJsxRuntime_production_min();
1433
- } else {
1434
- jsxRuntime.exports = requireReactJsxRuntime_development();
1435
- }
1436
-
1437
- var jsxRuntimeExports = jsxRuntime.exports;
1438
-
1439
- var prism = {exports: {}};
1440
-
1441
- prism.exports;
1442
-
1443
- (function (module) {
1444
- /* **********************************************
1445
- Begin prism-core.js
1446
- ********************************************** */
1447
-
1448
- /// <reference lib="WebWorker"/>
1449
-
1450
- var _self = (typeof window !== 'undefined')
1451
- ? window // if in browser
1452
- : (
1453
- (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
1454
- ? self // if in worker
1455
- : {} // if in node js
1456
- );
1457
-
1458
- /**
1459
- * Prism: Lightweight, robust, elegant syntax highlighting
1460
- *
1461
- * @license MIT <https://opensource.org/licenses/MIT>
1462
- * @author Lea Verou <https://lea.verou.me>
1463
- * @namespace
1464
- * @public
1465
- */
1466
- var Prism = (function (_self) {
1467
-
1468
- // Private helper vars
1469
- var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
1470
- var uniqueId = 0;
1471
-
1472
- // The grammar object for plaintext
1473
- var plainTextGrammar = {};
1474
-
1475
-
1476
- var _ = {
1477
- /**
1478
- * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
1479
- * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
1480
- * additional languages or plugins yourself.
1481
- *
1482
- * By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
1483
- *
1484
- * You obviously have to change this value before the automatic highlighting started. To do this, you can add an
1485
- * empty Prism object into the global scope before loading the Prism script like this:
1486
- *
1487
- * ```js
1488
- * window.Prism = window.Prism || {};
1489
- * Prism.manual = true;
1490
- * // add a new <script> to load Prism's script
1491
- * ```
1492
- *
1493
- * @default false
1494
- * @type {boolean}
1495
- * @memberof Prism
1496
- * @public
1497
- */
1498
- manual: _self.Prism && _self.Prism.manual,
1499
- /**
1500
- * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
1501
- * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
1502
- * own worker, you don't want it to do this.
1503
- *
1504
- * By setting this value to `true`, Prism will not add its own listeners to the worker.
1505
- *
1506
- * You obviously have to change this value before Prism executes. To do this, you can add an
1507
- * empty Prism object into the global scope before loading the Prism script like this:
1508
- *
1509
- * ```js
1510
- * window.Prism = window.Prism || {};
1511
- * Prism.disableWorkerMessageHandler = true;
1512
- * // Load Prism's script
1513
- * ```
1514
- *
1515
- * @default false
1516
- * @type {boolean}
1517
- * @memberof Prism
1518
- * @public
1519
- */
1520
- disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
1521
-
1522
- /**
1523
- * A namespace for utility methods.
1524
- *
1525
- * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
1526
- * change or disappear at any time.
1527
- *
1528
- * @namespace
1529
- * @memberof Prism
1530
- */
1531
- util: {
1532
- encode: function encode(tokens) {
1533
- if (tokens instanceof Token) {
1534
- return new Token(tokens.type, encode(tokens.content), tokens.alias);
1535
- } else if (Array.isArray(tokens)) {
1536
- return tokens.map(encode);
1537
- } else {
1538
- return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\u00a0/g, ' ');
1539
- }
1540
- },
1541
-
1542
- /**
1543
- * Returns the name of the type of the given value.
1544
- *
1545
- * @param {any} o
1546
- * @returns {string}
1547
- * @example
1548
- * type(null) === 'Null'
1549
- * type(undefined) === 'Undefined'
1550
- * type(123) === 'Number'
1551
- * type('foo') === 'String'
1552
- * type(true) === 'Boolean'
1553
- * type([1, 2]) === 'Array'
1554
- * type({}) === 'Object'
1555
- * type(String) === 'Function'
1556
- * type(/abc+/) === 'RegExp'
1557
- */
1558
- type: function (o) {
1559
- return Object.prototype.toString.call(o).slice(8, -1);
1560
- },
1561
-
1562
- /**
1563
- * Returns a unique number for the given object. Later calls will still return the same number.
1564
- *
1565
- * @param {Object} obj
1566
- * @returns {number}
1567
- */
1568
- objId: function (obj) {
1569
- if (!obj['__id']) {
1570
- Object.defineProperty(obj, '__id', { value: ++uniqueId });
1571
- }
1572
- return obj['__id'];
1573
- },
1574
-
1575
- /**
1576
- * Creates a deep clone of the given object.
1577
- *
1578
- * The main intended use of this function is to clone language definitions.
1579
- *
1580
- * @param {T} o
1581
- * @param {Record<number, any>} [visited]
1582
- * @returns {T}
1583
- * @template T
1584
- */
1585
- clone: function deepClone(o, visited) {
1586
- visited = visited || {};
1587
-
1588
- var clone; var id;
1589
- switch (_.util.type(o)) {
1590
- case 'Object':
1591
- id = _.util.objId(o);
1592
- if (visited[id]) {
1593
- return visited[id];
1594
- }
1595
- clone = /** @type {Record<string, any>} */ ({});
1596
- visited[id] = clone;
1597
-
1598
- for (var key in o) {
1599
- if (o.hasOwnProperty(key)) {
1600
- clone[key] = deepClone(o[key], visited);
1601
- }
1602
- }
1603
-
1604
- return /** @type {any} */ (clone);
1605
-
1606
- case 'Array':
1607
- id = _.util.objId(o);
1608
- if (visited[id]) {
1609
- return visited[id];
1610
- }
1611
- clone = [];
1612
- visited[id] = clone;
1613
-
1614
- (/** @type {Array} */(/** @type {any} */(o))).forEach(function (v, i) {
1615
- clone[i] = deepClone(v, visited);
1616
- });
1617
-
1618
- return /** @type {any} */ (clone);
1619
-
1620
- default:
1621
- return o;
1622
- }
1623
- },
1624
-
1625
- /**
1626
- * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
1627
- *
1628
- * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
1629
- *
1630
- * @param {Element} element
1631
- * @returns {string}
1632
- */
1633
- getLanguage: function (element) {
1634
- while (element) {
1635
- var m = lang.exec(element.className);
1636
- if (m) {
1637
- return m[1].toLowerCase();
1638
- }
1639
- element = element.parentElement;
1640
- }
1641
- return 'none';
1642
- },
1643
-
1644
- /**
1645
- * Sets the Prism `language-xxxx` class of the given element.
1646
- *
1647
- * @param {Element} element
1648
- * @param {string} language
1649
- * @returns {void}
1650
- */
1651
- setLanguage: function (element, language) {
1652
- // remove all `language-xxxx` classes
1653
- // (this might leave behind a leading space)
1654
- element.className = element.className.replace(RegExp(lang, 'gi'), '');
1655
-
1656
- // add the new `language-xxxx` class
1657
- // (using `classList` will automatically clean up spaces for us)
1658
- element.classList.add('language-' + language);
1659
- },
1660
-
1661
- /**
1662
- * Returns the script element that is currently executing.
1663
- *
1664
- * This does __not__ work for line script element.
1665
- *
1666
- * @returns {HTMLScriptElement | null}
1667
- */
1668
- currentScript: function () {
1669
- if (typeof document === 'undefined') {
1670
- return null;
1671
- }
1672
- if ('currentScript' in document && 1 < 2 /* hack to trip TS' flow analysis */) {
1673
- return /** @type {any} */ (document.currentScript);
1674
- }
1675
-
1676
- // IE11 workaround
1677
- // we'll get the src of the current script by parsing IE11's error stack trace
1678
- // this will not work for inline scripts
1679
-
1680
- try {
1681
- throw new Error();
1682
- } catch (err) {
1683
- // Get file src url from stack. Specifically works with the format of stack traces in IE.
1684
- // A stack will look like this:
1685
- //
1686
- // Error
1687
- // at _.util.currentScript (http://localhost/components/prism-core.js:119:5)
1688
- // at Global code (http://localhost/components/prism-core.js:606:1)
1689
-
1690
- var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
1691
- if (src) {
1692
- var scripts = document.getElementsByTagName('script');
1693
- for (var i in scripts) {
1694
- if (scripts[i].src == src) {
1695
- return scripts[i];
1696
- }
1697
- }
1698
- }
1699
- return null;
1700
- }
1701
- },
1702
-
1703
- /**
1704
- * Returns whether a given class is active for `element`.
1705
- *
1706
- * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
1707
- * if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
1708
- * given class is just the given class with a `no-` prefix.
1709
- *
1710
- * Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
1711
- * closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
1712
- * ancestors have the given class or the negated version of it, then the default activation will be returned.
1713
- *
1714
- * In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
1715
- * version of it, the class is considered active.
1716
- *
1717
- * @param {Element} element
1718
- * @param {string} className
1719
- * @param {boolean} [defaultActivation=false]
1720
- * @returns {boolean}
1721
- */
1722
- isActive: function (element, className, defaultActivation) {
1723
- var no = 'no-' + className;
1724
-
1725
- while (element) {
1726
- var classList = element.classList;
1727
- if (classList.contains(className)) {
1728
- return true;
1729
- }
1730
- if (classList.contains(no)) {
1731
- return false;
1732
- }
1733
- element = element.parentElement;
1734
- }
1735
- return !!defaultActivation;
1736
- }
1737
- },
1738
-
1739
- /**
1740
- * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
1741
- *
1742
- * @namespace
1743
- * @memberof Prism
1744
- * @public
1745
- */
1746
- languages: {
1747
- /**
1748
- * The grammar for plain, unformatted text.
1749
- */
1750
- plain: plainTextGrammar,
1751
- plaintext: plainTextGrammar,
1752
- text: plainTextGrammar,
1753
- txt: plainTextGrammar,
1754
-
1755
- /**
1756
- * Creates a deep copy of the language with the given id and appends the given tokens.
1757
- *
1758
- * If a token in `redef` also appears in the copied language, then the existing token in the copied language
1759
- * will be overwritten at its original position.
1760
- *
1761
- * ## Best practices
1762
- *
1763
- * Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
1764
- * doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
1765
- * understand the language definition because, normally, the order of tokens matters in Prism grammars.
1766
- *
1767
- * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
1768
- * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
1769
- *
1770
- * @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
1771
- * @param {Grammar} redef The new tokens to append.
1772
- * @returns {Grammar} The new language created.
1773
- * @public
1774
- * @example
1775
- * Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
1776
- * // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
1777
- * // at its original position
1778
- * 'comment': { ... },
1779
- * // CSS doesn't have a 'color' token, so this token will be appended
1780
- * 'color': /\b(?:red|green|blue)\b/
1781
- * });
1782
- */
1783
- extend: function (id, redef) {
1784
- var lang = _.util.clone(_.languages[id]);
1785
-
1786
- for (var key in redef) {
1787
- lang[key] = redef[key];
1788
- }
1789
-
1790
- return lang;
1791
- },
1792
-
1793
- /**
1794
- * Inserts tokens _before_ another token in a language definition or any other grammar.
1795
- *
1796
- * ## Usage
1797
- *
1798
- * This helper method makes it easy to modify existing languages. For example, the CSS language definition
1799
- * not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
1800
- * in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
1801
- * appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
1802
- * this:
1803
- *
1804
- * ```js
1805
- * Prism.languages.markup.style = {
1806
- * // token
1807
- * };
1808
- * ```
1809
- *
1810
- * then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
1811
- * before existing tokens. For the CSS example above, you would use it like this:
1812
- *
1813
- * ```js
1814
- * Prism.languages.insertBefore('markup', 'cdata', {
1815
- * 'style': {
1816
- * // token
1817
- * }
1818
- * });
1819
- * ```
1820
- *
1821
- * ## Special cases
1822
- *
1823
- * If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
1824
- * will be ignored.
1825
- *
1826
- * This behavior can be used to insert tokens after `before`:
1827
- *
1828
- * ```js
1829
- * Prism.languages.insertBefore('markup', 'comment', {
1830
- * 'comment': Prism.languages.markup.comment,
1831
- * // tokens after 'comment'
1832
- * });
1833
- * ```
1834
- *
1835
- * ## Limitations
1836
- *
1837
- * The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
1838
- * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
1839
- * differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
1840
- * deleting properties which is necessary to insert at arbitrary positions.
1841
- *
1842
- * To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
1843
- * Instead, it will create a new object and replace all references to the target object with the new one. This
1844
- * can be done without temporarily deleting properties, so the iteration order is well-defined.
1845
- *
1846
- * However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
1847
- * you hold the target object in a variable, then the value of the variable will not change.
1848
- *
1849
- * ```js
1850
- * var oldMarkup = Prism.languages.markup;
1851
- * var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
1852
- *
1853
- * assert(oldMarkup !== Prism.languages.markup);
1854
- * assert(newMarkup === Prism.languages.markup);
1855
- * ```
1856
- *
1857
- * @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
1858
- * object to be modified.
1859
- * @param {string} before The key to insert before.
1860
- * @param {Grammar} insert An object containing the key-value pairs to be inserted.
1861
- * @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
1862
- * object to be modified.
1863
- *
1864
- * Defaults to `Prism.languages`.
1865
- * @returns {Grammar} The new grammar object.
1866
- * @public
1867
- */
1868
- insertBefore: function (inside, before, insert, root) {
1869
- root = root || /** @type {any} */ (_.languages);
1870
- var grammar = root[inside];
1871
- /** @type {Grammar} */
1872
- var ret = {};
1873
-
1874
- for (var token in grammar) {
1875
- if (grammar.hasOwnProperty(token)) {
1876
-
1877
- if (token == before) {
1878
- for (var newToken in insert) {
1879
- if (insert.hasOwnProperty(newToken)) {
1880
- ret[newToken] = insert[newToken];
1881
- }
1882
- }
1883
- }
1884
-
1885
- // Do not insert token which also occur in insert. See #1525
1886
- if (!insert.hasOwnProperty(token)) {
1887
- ret[token] = grammar[token];
1888
- }
1889
- }
1890
- }
1891
-
1892
- var old = root[inside];
1893
- root[inside] = ret;
1894
-
1895
- // Update references in other language definitions
1896
- _.languages.DFS(_.languages, function (key, value) {
1897
- if (value === old && key != inside) {
1898
- this[key] = ret;
1899
- }
1900
- });
1901
-
1902
- return ret;
1903
- },
1904
-
1905
- // Traverse a language definition with Depth First Search
1906
- DFS: function DFS(o, callback, type, visited) {
1907
- visited = visited || {};
1908
-
1909
- var objId = _.util.objId;
1910
-
1911
- for (var i in o) {
1912
- if (o.hasOwnProperty(i)) {
1913
- callback.call(o, i, o[i], type || i);
1914
-
1915
- var property = o[i];
1916
- var propertyType = _.util.type(property);
1917
-
1918
- if (propertyType === 'Object' && !visited[objId(property)]) {
1919
- visited[objId(property)] = true;
1920
- DFS(property, callback, null, visited);
1921
- } else if (propertyType === 'Array' && !visited[objId(property)]) {
1922
- visited[objId(property)] = true;
1923
- DFS(property, callback, i, visited);
1924
- }
1925
- }
1926
- }
1927
- }
1928
- },
1929
-
1930
- plugins: {},
1931
-
1932
- /**
1933
- * This is the most high-level function in Prism’s API.
1934
- * It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
1935
- * each one of them.
1936
- *
1937
- * This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
1938
- *
1939
- * @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
1940
- * @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
1941
- * @memberof Prism
1942
- * @public
1943
- */
1944
- highlightAll: function (async, callback) {
1945
- _.highlightAllUnder(document, async, callback);
1946
- },
1947
-
1948
- /**
1949
- * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
1950
- * {@link Prism.highlightElement} on each one of them.
1951
- *
1952
- * The following hooks will be run:
1953
- * 1. `before-highlightall`
1954
- * 2. `before-all-elements-highlight`
1955
- * 3. All hooks of {@link Prism.highlightElement} for each element.
1956
- *
1957
- * @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
1958
- * @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
1959
- * @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
1960
- * @memberof Prism
1961
- * @public
1962
- */
1963
- highlightAllUnder: function (container, async, callback) {
1964
- var env = {
1965
- callback: callback,
1966
- container: container,
1967
- selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
1968
- };
1969
-
1970
- _.hooks.run('before-highlightall', env);
1971
-
1972
- env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
1973
-
1974
- _.hooks.run('before-all-elements-highlight', env);
1975
-
1976
- for (var i = 0, element; (element = env.elements[i++]);) {
1977
- _.highlightElement(element, async === true, env.callback);
1978
- }
1979
- },
1980
-
1981
- /**
1982
- * Highlights the code inside a single element.
1983
- *
1984
- * The following hooks will be run:
1985
- * 1. `before-sanity-check`
1986
- * 2. `before-highlight`
1987
- * 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
1988
- * 4. `before-insert`
1989
- * 5. `after-highlight`
1990
- * 6. `complete`
1991
- *
1992
- * Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
1993
- * the element's language.
1994
- *
1995
- * @param {Element} element The element containing the code.
1996
- * It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
1997
- * @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
1998
- * to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
1999
- * [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
2000
- *
2001
- * Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
2002
- * asynchronous highlighting to work. You can build your own bundle on the
2003
- * [Download page](https://prismjs.com/download.html).
2004
- * @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
2005
- * Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
2006
- * @memberof Prism
2007
- * @public
2008
- */
2009
- highlightElement: function (element, async, callback) {
2010
- // Find language
2011
- var language = _.util.getLanguage(element);
2012
- var grammar = _.languages[language];
2013
-
2014
- // Set language on the element, if not present
2015
- _.util.setLanguage(element, language);
2016
-
2017
- // Set language on the parent, for styling
2018
- var parent = element.parentElement;
2019
- if (parent && parent.nodeName.toLowerCase() === 'pre') {
2020
- _.util.setLanguage(parent, language);
2021
- }
2022
-
2023
- var code = element.textContent;
2024
-
2025
- var env = {
2026
- element: element,
2027
- language: language,
2028
- grammar: grammar,
2029
- code: code
2030
- };
2031
-
2032
- function insertHighlightedCode(highlightedCode) {
2033
- env.highlightedCode = highlightedCode;
2034
-
2035
- _.hooks.run('before-insert', env);
2036
-
2037
- env.element.innerHTML = env.highlightedCode;
2038
-
2039
- _.hooks.run('after-highlight', env);
2040
- _.hooks.run('complete', env);
2041
- callback && callback.call(env.element);
2042
- }
2043
-
2044
- _.hooks.run('before-sanity-check', env);
2045
-
2046
- // plugins may change/add the parent/element
2047
- parent = env.element.parentElement;
2048
- if (parent && parent.nodeName.toLowerCase() === 'pre' && !parent.hasAttribute('tabindex')) {
2049
- parent.setAttribute('tabindex', '0');
2050
- }
2051
-
2052
- if (!env.code) {
2053
- _.hooks.run('complete', env);
2054
- callback && callback.call(env.element);
2055
- return;
2056
- }
2057
-
2058
- _.hooks.run('before-highlight', env);
2059
-
2060
- if (!env.grammar) {
2061
- insertHighlightedCode(_.util.encode(env.code));
2062
- return;
2063
- }
2064
-
2065
- if (async && _self.Worker) {
2066
- var worker = new Worker(_.filename);
2067
-
2068
- worker.onmessage = function (evt) {
2069
- insertHighlightedCode(evt.data);
2070
- };
2071
-
2072
- worker.postMessage(JSON.stringify({
2073
- language: env.language,
2074
- code: env.code,
2075
- immediateClose: true
2076
- }));
2077
- } else {
2078
- insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
2079
- }
2080
- },
2081
-
2082
- /**
2083
- * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
2084
- * and the language definitions to use, and returns a string with the HTML produced.
2085
- *
2086
- * The following hooks will be run:
2087
- * 1. `before-tokenize`
2088
- * 2. `after-tokenize`
2089
- * 3. `wrap`: On each {@link Token}.
2090
- *
2091
- * @param {string} text A string with the code to be highlighted.
2092
- * @param {Grammar} grammar An object containing the tokens to use.
2093
- *
2094
- * Usually a language definition like `Prism.languages.markup`.
2095
- * @param {string} language The name of the language definition passed to `grammar`.
2096
- * @returns {string} The highlighted HTML.
2097
- * @memberof Prism
2098
- * @public
2099
- * @example
2100
- * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
2101
- */
2102
- highlight: function (text, grammar, language) {
2103
- var env = {
2104
- code: text,
2105
- grammar: grammar,
2106
- language: language
2107
- };
2108
- _.hooks.run('before-tokenize', env);
2109
- if (!env.grammar) {
2110
- throw new Error('The language "' + env.language + '" has no grammar.');
2111
- }
2112
- env.tokens = _.tokenize(env.code, env.grammar);
2113
- _.hooks.run('after-tokenize', env);
2114
- return Token.stringify(_.util.encode(env.tokens), env.language);
2115
- },
2116
-
2117
- /**
2118
- * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
2119
- * and the language definitions to use, and returns an array with the tokenized code.
2120
- *
2121
- * When the language definition includes nested tokens, the function is called recursively on each of these tokens.
2122
- *
2123
- * This method could be useful in other contexts as well, as a very crude parser.
2124
- *
2125
- * @param {string} text A string with the code to be highlighted.
2126
- * @param {Grammar} grammar An object containing the tokens to use.
2127
- *
2128
- * Usually a language definition like `Prism.languages.markup`.
2129
- * @returns {TokenStream} An array of strings and tokens, a token stream.
2130
- * @memberof Prism
2131
- * @public
2132
- * @example
2133
- * let code = `var foo = 0;`;
2134
- * let tokens = Prism.tokenize(code, Prism.languages.javascript);
2135
- * tokens.forEach(token => {
2136
- * if (token instanceof Prism.Token && token.type === 'number') {
2137
- * console.log(`Found numeric literal: ${token.content}`);
2138
- * }
2139
- * });
2140
- */
2141
- tokenize: function (text, grammar) {
2142
- var rest = grammar.rest;
2143
- if (rest) {
2144
- for (var token in rest) {
2145
- grammar[token] = rest[token];
2146
- }
2147
-
2148
- delete grammar.rest;
2149
- }
2150
-
2151
- var tokenList = new LinkedList();
2152
- addAfter(tokenList, tokenList.head, text);
2153
-
2154
- matchGrammar(text, tokenList, grammar, tokenList.head, 0);
2155
-
2156
- return toArray(tokenList);
2157
- },
2158
-
2159
- /**
2160
- * @namespace
2161
- * @memberof Prism
2162
- * @public
2163
- */
2164
- hooks: {
2165
- all: {},
2166
-
2167
- /**
2168
- * Adds the given callback to the list of callbacks for the given hook.
2169
- *
2170
- * The callback will be invoked when the hook it is registered for is run.
2171
- * Hooks are usually directly run by a highlight function but you can also run hooks yourself.
2172
- *
2173
- * One callback function can be registered to multiple hooks and the same hook multiple times.
2174
- *
2175
- * @param {string} name The name of the hook.
2176
- * @param {HookCallback} callback The callback function which is given environment variables.
2177
- * @public
2178
- */
2179
- add: function (name, callback) {
2180
- var hooks = _.hooks.all;
2181
-
2182
- hooks[name] = hooks[name] || [];
2183
-
2184
- hooks[name].push(callback);
2185
- },
2186
-
2187
- /**
2188
- * Runs a hook invoking all registered callbacks with the given environment variables.
2189
- *
2190
- * Callbacks will be invoked synchronously and in the order in which they were registered.
2191
- *
2192
- * @param {string} name The name of the hook.
2193
- * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
2194
- * @public
2195
- */
2196
- run: function (name, env) {
2197
- var callbacks = _.hooks.all[name];
2198
-
2199
- if (!callbacks || !callbacks.length) {
2200
- return;
2201
- }
2202
-
2203
- for (var i = 0, callback; (callback = callbacks[i++]);) {
2204
- callback(env);
2205
- }
2206
- }
2207
- },
2208
-
2209
- Token: Token
2210
- };
2211
- _self.Prism = _;
2212
-
2213
-
2214
- // Typescript note:
2215
- // The following can be used to import the Token type in JSDoc:
2216
- //
2217
- // @typedef {InstanceType<import("./prism-core")["Token"]>} Token
2218
-
2219
- /**
2220
- * Creates a new token.
2221
- *
2222
- * @param {string} type See {@link Token#type type}
2223
- * @param {string | TokenStream} content See {@link Token#content content}
2224
- * @param {string|string[]} [alias] The alias(es) of the token.
2225
- * @param {string} [matchedStr=""] A copy of the full string this token was created from.
2226
- * @class
2227
- * @global
2228
- * @public
2229
- */
2230
- function Token(type, content, alias, matchedStr) {
2231
- /**
2232
- * The type of the token.
2233
- *
2234
- * This is usually the key of a pattern in a {@link Grammar}.
2235
- *
2236
- * @type {string}
2237
- * @see GrammarToken
2238
- * @public
2239
- */
2240
- this.type = type;
2241
- /**
2242
- * The strings or tokens contained by this token.
2243
- *
2244
- * This will be a token stream if the pattern matched also defined an `inside` grammar.
2245
- *
2246
- * @type {string | TokenStream}
2247
- * @public
2248
- */
2249
- this.content = content;
2250
- /**
2251
- * The alias(es) of the token.
2252
- *
2253
- * @type {string|string[]}
2254
- * @see GrammarToken
2255
- * @public
2256
- */
2257
- this.alias = alias;
2258
- // Copy of the full string this token was created from
2259
- this.length = (matchedStr || '').length | 0;
2260
- }
2261
-
2262
- /**
2263
- * A token stream is an array of strings and {@link Token Token} objects.
2264
- *
2265
- * Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process
2266
- * them.
2267
- *
2268
- * 1. No adjacent strings.
2269
- * 2. No empty strings.
2270
- *
2271
- * The only exception here is the token stream that only contains the empty string and nothing else.
2272
- *
2273
- * @typedef {Array<string | Token>} TokenStream
2274
- * @global
2275
- * @public
2276
- */
2277
-
2278
- /**
2279
- * Converts the given token or token stream to an HTML representation.
2280
- *
2281
- * The following hooks will be run:
2282
- * 1. `wrap`: On each {@link Token}.
2283
- *
2284
- * @param {string | Token | TokenStream} o The token or token stream to be converted.
2285
- * @param {string} language The name of current language.
2286
- * @returns {string} The HTML representation of the token or token stream.
2287
- * @memberof Token
2288
- * @static
2289
- */
2290
- Token.stringify = function stringify(o, language) {
2291
- if (typeof o == 'string') {
2292
- return o;
2293
- }
2294
- if (Array.isArray(o)) {
2295
- var s = '';
2296
- o.forEach(function (e) {
2297
- s += stringify(e, language);
2298
- });
2299
- return s;
2300
- }
2301
-
2302
- var env = {
2303
- type: o.type,
2304
- content: stringify(o.content, language),
2305
- tag: 'span',
2306
- classes: ['token', o.type],
2307
- attributes: {},
2308
- language: language
2309
- };
2310
-
2311
- var aliases = o.alias;
2312
- if (aliases) {
2313
- if (Array.isArray(aliases)) {
2314
- Array.prototype.push.apply(env.classes, aliases);
2315
- } else {
2316
- env.classes.push(aliases);
2317
- }
2318
- }
2319
-
2320
- _.hooks.run('wrap', env);
2321
-
2322
- var attributes = '';
2323
- for (var name in env.attributes) {
2324
- attributes += ' ' + name + '="' + (env.attributes[name] || '').replace(/"/g, '&quot;') + '"';
2325
- }
2326
-
2327
- return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>';
2328
- };
2329
-
2330
- /**
2331
- * @param {RegExp} pattern
2332
- * @param {number} pos
2333
- * @param {string} text
2334
- * @param {boolean} lookbehind
2335
- * @returns {RegExpExecArray | null}
2336
- */
2337
- function matchPattern(pattern, pos, text, lookbehind) {
2338
- pattern.lastIndex = pos;
2339
- var match = pattern.exec(text);
2340
- if (match && lookbehind && match[1]) {
2341
- // change the match to remove the text matched by the Prism lookbehind group
2342
- var lookbehindLength = match[1].length;
2343
- match.index += lookbehindLength;
2344
- match[0] = match[0].slice(lookbehindLength);
2345
- }
2346
- return match;
2347
- }
2348
-
2349
- /**
2350
- * @param {string} text
2351
- * @param {LinkedList<string | Token>} tokenList
2352
- * @param {any} grammar
2353
- * @param {LinkedListNode<string | Token>} startNode
2354
- * @param {number} startPos
2355
- * @param {RematchOptions} [rematch]
2356
- * @returns {void}
2357
- * @private
2358
- *
2359
- * @typedef RematchOptions
2360
- * @property {string} cause
2361
- * @property {number} reach
2362
- */
2363
- function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
2364
- for (var token in grammar) {
2365
- if (!grammar.hasOwnProperty(token) || !grammar[token]) {
2366
- continue;
2367
- }
2368
-
2369
- var patterns = grammar[token];
2370
- patterns = Array.isArray(patterns) ? patterns : [patterns];
2371
-
2372
- for (var j = 0; j < patterns.length; ++j) {
2373
- if (rematch && rematch.cause == token + ',' + j) {
2374
- return;
2375
- }
2376
-
2377
- var patternObj = patterns[j];
2378
- var inside = patternObj.inside;
2379
- var lookbehind = !!patternObj.lookbehind;
2380
- var greedy = !!patternObj.greedy;
2381
- var alias = patternObj.alias;
2382
-
2383
- if (greedy && !patternObj.pattern.global) {
2384
- // Without the global flag, lastIndex won't work
2385
- var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
2386
- patternObj.pattern = RegExp(patternObj.pattern.source, flags + 'g');
2387
- }
2388
-
2389
- /** @type {RegExp} */
2390
- var pattern = patternObj.pattern || patternObj;
2391
-
2392
- for ( // iterate the token list and keep track of the current token/string position
2393
- var currentNode = startNode.next, pos = startPos;
2394
- currentNode !== tokenList.tail;
2395
- pos += currentNode.value.length, currentNode = currentNode.next
2396
- ) {
2397
-
2398
- if (rematch && pos >= rematch.reach) {
2399
- break;
2400
- }
2401
-
2402
- var str = currentNode.value;
2403
-
2404
- if (tokenList.length > text.length) {
2405
- // Something went terribly wrong, ABORT, ABORT!
2406
- return;
2407
- }
2408
-
2409
- if (str instanceof Token) {
2410
- continue;
2411
- }
2412
-
2413
- var removeCount = 1; // this is the to parameter of removeBetween
2414
- var match;
2415
-
2416
- if (greedy) {
2417
- match = matchPattern(pattern, pos, text, lookbehind);
2418
- if (!match || match.index >= text.length) {
2419
- break;
2420
- }
2421
-
2422
- var from = match.index;
2423
- var to = match.index + match[0].length;
2424
- var p = pos;
2425
-
2426
- // find the node that contains the match
2427
- p += currentNode.value.length;
2428
- while (from >= p) {
2429
- currentNode = currentNode.next;
2430
- p += currentNode.value.length;
2431
- }
2432
- // adjust pos (and p)
2433
- p -= currentNode.value.length;
2434
- pos = p;
2435
-
2436
- // the current node is a Token, then the match starts inside another Token, which is invalid
2437
- if (currentNode.value instanceof Token) {
2438
- continue;
2439
- }
2440
-
2441
- // find the last node which is affected by this match
2442
- for (
2443
- var k = currentNode;
2444
- k !== tokenList.tail && (p < to || typeof k.value === 'string');
2445
- k = k.next
2446
- ) {
2447
- removeCount++;
2448
- p += k.value.length;
2449
- }
2450
- removeCount--;
2451
-
2452
- // replace with the new match
2453
- str = text.slice(pos, p);
2454
- match.index -= pos;
2455
- } else {
2456
- match = matchPattern(pattern, 0, str, lookbehind);
2457
- if (!match) {
2458
- continue;
2459
- }
2460
- }
2461
-
2462
- // eslint-disable-next-line no-redeclare
2463
- var from = match.index;
2464
- var matchStr = match[0];
2465
- var before = str.slice(0, from);
2466
- var after = str.slice(from + matchStr.length);
2467
-
2468
- var reach = pos + str.length;
2469
- if (rematch && reach > rematch.reach) {
2470
- rematch.reach = reach;
2471
- }
2472
-
2473
- var removeFrom = currentNode.prev;
2474
-
2475
- if (before) {
2476
- removeFrom = addAfter(tokenList, removeFrom, before);
2477
- pos += before.length;
2478
- }
2479
-
2480
- removeRange(tokenList, removeFrom, removeCount);
2481
-
2482
- var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
2483
- currentNode = addAfter(tokenList, removeFrom, wrapped);
2484
-
2485
- if (after) {
2486
- addAfter(tokenList, currentNode, after);
2487
- }
2488
-
2489
- if (removeCount > 1) {
2490
- // at least one Token object was removed, so we have to do some rematching
2491
- // this can only happen if the current pattern is greedy
2492
-
2493
- /** @type {RematchOptions} */
2494
- var nestedRematch = {
2495
- cause: token + ',' + j,
2496
- reach: reach
2497
- };
2498
- matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
2499
-
2500
- // the reach might have been extended because of the rematching
2501
- if (rematch && nestedRematch.reach > rematch.reach) {
2502
- rematch.reach = nestedRematch.reach;
2503
- }
2504
- }
2505
- }
2506
- }
2507
- }
2508
- }
2509
-
2510
- /**
2511
- * @typedef LinkedListNode
2512
- * @property {T} value
2513
- * @property {LinkedListNode<T> | null} prev The previous node.
2514
- * @property {LinkedListNode<T> | null} next The next node.
2515
- * @template T
2516
- * @private
2517
- */
2518
-
2519
- /**
2520
- * @template T
2521
- * @private
2522
- */
2523
- function LinkedList() {
2524
- /** @type {LinkedListNode<T>} */
2525
- var head = { value: null, prev: null, next: null };
2526
- /** @type {LinkedListNode<T>} */
2527
- var tail = { value: null, prev: head, next: null };
2528
- head.next = tail;
2529
-
2530
- /** @type {LinkedListNode<T>} */
2531
- this.head = head;
2532
- /** @type {LinkedListNode<T>} */
2533
- this.tail = tail;
2534
- this.length = 0;
2535
- }
2536
-
2537
- /**
2538
- * Adds a new node with the given value to the list.
2539
- *
2540
- * @param {LinkedList<T>} list
2541
- * @param {LinkedListNode<T>} node
2542
- * @param {T} value
2543
- * @returns {LinkedListNode<T>} The added node.
2544
- * @template T
2545
- */
2546
- function addAfter(list, node, value) {
2547
- // assumes that node != list.tail && values.length >= 0
2548
- var next = node.next;
2549
-
2550
- var newNode = { value: value, prev: node, next: next };
2551
- node.next = newNode;
2552
- next.prev = newNode;
2553
- list.length++;
2554
-
2555
- return newNode;
2556
- }
2557
- /**
2558
- * Removes `count` nodes after the given node. The given node will not be removed.
2559
- *
2560
- * @param {LinkedList<T>} list
2561
- * @param {LinkedListNode<T>} node
2562
- * @param {number} count
2563
- * @template T
2564
- */
2565
- function removeRange(list, node, count) {
2566
- var next = node.next;
2567
- for (var i = 0; i < count && next !== list.tail; i++) {
2568
- next = next.next;
2569
- }
2570
- node.next = next;
2571
- next.prev = node;
2572
- list.length -= i;
2573
- }
2574
- /**
2575
- * @param {LinkedList<T>} list
2576
- * @returns {T[]}
2577
- * @template T
2578
- */
2579
- function toArray(list) {
2580
- var array = [];
2581
- var node = list.head.next;
2582
- while (node !== list.tail) {
2583
- array.push(node.value);
2584
- node = node.next;
2585
- }
2586
- return array;
2587
- }
2588
-
2589
-
2590
- if (!_self.document) {
2591
- if (!_self.addEventListener) {
2592
- // in Node.js
2593
- return _;
2594
- }
2595
-
2596
- if (!_.disableWorkerMessageHandler) {
2597
- // In worker
2598
- _self.addEventListener('message', function (evt) {
2599
- var message = JSON.parse(evt.data);
2600
- var lang = message.language;
2601
- var code = message.code;
2602
- var immediateClose = message.immediateClose;
2603
-
2604
- _self.postMessage(_.highlight(code, _.languages[lang], lang));
2605
- if (immediateClose) {
2606
- _self.close();
2607
- }
2608
- }, false);
2609
- }
2610
-
2611
- return _;
2612
- }
2613
-
2614
- // Get current script and highlight
2615
- var script = _.util.currentScript();
2616
-
2617
- if (script) {
2618
- _.filename = script.src;
2619
-
2620
- if (script.hasAttribute('data-manual')) {
2621
- _.manual = true;
2622
- }
2623
- }
2624
-
2625
- function highlightAutomaticallyCallback() {
2626
- if (!_.manual) {
2627
- _.highlightAll();
2628
- }
2629
- }
2630
-
2631
- if (!_.manual) {
2632
- // If the document state is "loading", then we'll use DOMContentLoaded.
2633
- // If the document state is "interactive" and the prism.js script is deferred, then we'll also use the
2634
- // DOMContentLoaded event because there might be some plugins or languages which have also been deferred and they
2635
- // might take longer one animation frame to execute which can create a race condition where only some plugins have
2636
- // been loaded when Prism.highlightAll() is executed, depending on how fast resources are loaded.
2637
- // See https://github.com/PrismJS/prism/issues/2102
2638
- var readyState = document.readyState;
2639
- if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) {
2640
- document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback);
2641
- } else {
2642
- if (window.requestAnimationFrame) {
2643
- window.requestAnimationFrame(highlightAutomaticallyCallback);
2644
- } else {
2645
- window.setTimeout(highlightAutomaticallyCallback, 16);
2646
- }
2647
- }
2648
- }
2649
-
2650
- return _;
2651
-
2652
- }(_self));
2653
-
2654
- if (module.exports) {
2655
- module.exports = Prism;
2656
- }
2657
-
2658
- // hack for components to work correctly in node.js
2659
- if (typeof commonjsGlobal !== 'undefined') {
2660
- commonjsGlobal.Prism = Prism;
2661
- }
2662
-
2663
- // some additional documentation/types
2664
-
2665
- /**
2666
- * The expansion of a simple `RegExp` literal to support additional properties.
2667
- *
2668
- * @typedef GrammarToken
2669
- * @property {RegExp} pattern The regular expression of the token.
2670
- * @property {boolean} [lookbehind=false] If `true`, then the first capturing group of `pattern` will (effectively)
2671
- * behave as a lookbehind group meaning that the captured text will not be part of the matched text of the new token.
2672
- * @property {boolean} [greedy=false] Whether the token is greedy.
2673
- * @property {string|string[]} [alias] An optional alias or list of aliases.
2674
- * @property {Grammar} [inside] The nested grammar of this token.
2675
- *
2676
- * The `inside` grammar will be used to tokenize the text value of each token of this kind.
2677
- *
2678
- * This can be used to make nested and even recursive language definitions.
2679
- *
2680
- * Note: This can cause infinite recursion. Be careful when you embed different languages or even the same language into
2681
- * each another.
2682
- * @global
2683
- * @public
2684
- */
2685
-
2686
- /**
2687
- * @typedef Grammar
2688
- * @type {Object<string, RegExp | GrammarToken | Array<RegExp | GrammarToken>>}
2689
- * @property {Grammar} [rest] An optional grammar object that will be appended to this grammar.
2690
- * @global
2691
- * @public
2692
- */
2693
-
2694
- /**
2695
- * A function which will invoked after an element was successfully highlighted.
2696
- *
2697
- * @callback HighlightCallback
2698
- * @param {Element} element The element successfully highlighted.
2699
- * @returns {void}
2700
- * @global
2701
- * @public
2702
- */
2703
-
2704
- /**
2705
- * @callback HookCallback
2706
- * @param {Object<string, any>} env The environment variables of the hook.
2707
- * @returns {void}
2708
- * @global
2709
- * @public
2710
- */
2711
-
2712
-
2713
- /* **********************************************
2714
- Begin prism-markup.js
2715
- ********************************************** */
2716
-
2717
- Prism.languages.markup = {
2718
- 'comment': {
2719
- pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
2720
- greedy: true
2721
- },
2722
- 'prolog': {
2723
- pattern: /<\?[\s\S]+?\?>/,
2724
- greedy: true
2725
- },
2726
- 'doctype': {
2727
- // https://www.w3.org/TR/xml/#NT-doctypedecl
2728
- pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
2729
- greedy: true,
2730
- inside: {
2731
- 'internal-subset': {
2732
- pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
2733
- lookbehind: true,
2734
- greedy: true,
2735
- inside: null // see below
2736
- },
2737
- 'string': {
2738
- pattern: /"[^"]*"|'[^']*'/,
2739
- greedy: true
2740
- },
2741
- 'punctuation': /^<!|>$|[[\]]/,
2742
- 'doctype-tag': /^DOCTYPE/i,
2743
- 'name': /[^\s<>'"]+/
2744
- }
2745
- },
2746
- 'cdata': {
2747
- pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
2748
- greedy: true
2749
- },
2750
- 'tag': {
2751
- pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
2752
- greedy: true,
2753
- inside: {
2754
- 'tag': {
2755
- pattern: /^<\/?[^\s>\/]+/,
2756
- inside: {
2757
- 'punctuation': /^<\/?/,
2758
- 'namespace': /^[^\s>\/:]+:/
2759
- }
2760
- },
2761
- 'special-attr': [],
2762
- 'attr-value': {
2763
- pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
2764
- inside: {
2765
- 'punctuation': [
2766
- {
2767
- pattern: /^=/,
2768
- alias: 'attr-equals'
2769
- },
2770
- {
2771
- pattern: /^(\s*)["']|["']$/,
2772
- lookbehind: true
2773
- }
2774
- ]
2775
- }
2776
- },
2777
- 'punctuation': /\/?>/,
2778
- 'attr-name': {
2779
- pattern: /[^\s>\/]+/,
2780
- inside: {
2781
- 'namespace': /^[^\s>\/:]+:/
2782
- }
2783
- }
2784
-
2785
- }
2786
- },
2787
- 'entity': [
2788
- {
2789
- pattern: /&[\da-z]{1,8};/i,
2790
- alias: 'named-entity'
2791
- },
2792
- /&#x?[\da-f]{1,8};/i
2793
- ]
2794
- };
2795
-
2796
- Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
2797
- Prism.languages.markup['entity'];
2798
- Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;
2799
-
2800
- // Plugin to make entity title show the real entity, idea by Roman Komarov
2801
- Prism.hooks.add('wrap', function (env) {
2802
-
2803
- if (env.type === 'entity') {
2804
- env.attributes['title'] = env.content.replace(/&amp;/, '&');
2805
- }
2806
- });
2807
-
2808
- Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
2809
- /**
2810
- * Adds an inlined language to markup.
2811
- *
2812
- * An example of an inlined language is CSS with `<style>` tags.
2813
- *
2814
- * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
2815
- * case insensitive.
2816
- * @param {string} lang The language key.
2817
- * @example
2818
- * addInlined('style', 'css');
2819
- */
2820
- value: function addInlined(tagName, lang) {
2821
- var includedCdataInside = {};
2822
- includedCdataInside['language-' + lang] = {
2823
- pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
2824
- lookbehind: true,
2825
- inside: Prism.languages[lang]
2826
- };
2827
- includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
2828
-
2829
- var inside = {
2830
- 'included-cdata': {
2831
- pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
2832
- inside: includedCdataInside
2833
- }
2834
- };
2835
- inside['language-' + lang] = {
2836
- pattern: /[\s\S]+/,
2837
- inside: Prism.languages[lang]
2838
- };
2839
-
2840
- var def = {};
2841
- def[tagName] = {
2842
- pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () { return tagName; }), 'i'),
2843
- lookbehind: true,
2844
- greedy: true,
2845
- inside: inside
2846
- };
2847
-
2848
- Prism.languages.insertBefore('markup', 'cdata', def);
2849
- }
2850
- });
2851
- Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
2852
- /**
2853
- * Adds an pattern to highlight languages embedded in HTML attributes.
2854
- *
2855
- * An example of an inlined language is CSS with `style` attributes.
2856
- *
2857
- * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
2858
- * case insensitive.
2859
- * @param {string} lang The language key.
2860
- * @example
2861
- * addAttribute('style', 'css');
2862
- */
2863
- value: function (attrName, lang) {
2864
- Prism.languages.markup.tag.inside['special-attr'].push({
2865
- pattern: RegExp(
2866
- /(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
2867
- 'i'
2868
- ),
2869
- lookbehind: true,
2870
- inside: {
2871
- 'attr-name': /^[^\s=]+/,
2872
- 'attr-value': {
2873
- pattern: /=[\s\S]+/,
2874
- inside: {
2875
- 'value': {
2876
- pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
2877
- lookbehind: true,
2878
- alias: [lang, 'language-' + lang],
2879
- inside: Prism.languages[lang]
2880
- },
2881
- 'punctuation': [
2882
- {
2883
- pattern: /^=/,
2884
- alias: 'attr-equals'
2885
- },
2886
- /"|'/
2887
- ]
2888
- }
2889
- }
2890
- }
2891
- });
2892
- }
2893
- });
2894
-
2895
- Prism.languages.html = Prism.languages.markup;
2896
- Prism.languages.mathml = Prism.languages.markup;
2897
- Prism.languages.svg = Prism.languages.markup;
2898
-
2899
- Prism.languages.xml = Prism.languages.extend('markup', {});
2900
- Prism.languages.ssml = Prism.languages.xml;
2901
- Prism.languages.atom = Prism.languages.xml;
2902
- Prism.languages.rss = Prism.languages.xml;
2903
-
2904
-
2905
- /* **********************************************
2906
- Begin prism-css.js
2907
- ********************************************** */
2908
-
2909
- (function (Prism) {
2910
-
2911
- var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
2912
-
2913
- Prism.languages.css = {
2914
- 'comment': /\/\*[\s\S]*?\*\//,
2915
- 'atrule': {
2916
- pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
2917
- inside: {
2918
- 'rule': /^@[\w-]+/,
2919
- 'selector-function-argument': {
2920
- pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
2921
- lookbehind: true,
2922
- alias: 'selector'
2923
- },
2924
- 'keyword': {
2925
- pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
2926
- lookbehind: true
2927
- }
2928
- // See rest below
2929
- }
2930
- },
2931
- 'url': {
2932
- // https://drafts.csswg.org/css-values-3/#urls
2933
- pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
2934
- greedy: true,
2935
- inside: {
2936
- 'function': /^url/i,
2937
- 'punctuation': /^\(|\)$/,
2938
- 'string': {
2939
- pattern: RegExp('^' + string.source + '$'),
2940
- alias: 'url'
2941
- }
2942
- }
2943
- },
2944
- 'selector': {
2945
- pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
2946
- lookbehind: true
2947
- },
2948
- 'string': {
2949
- pattern: string,
2950
- greedy: true
2951
- },
2952
- 'property': {
2953
- pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
2954
- lookbehind: true
2955
- },
2956
- 'important': /!important\b/i,
2957
- 'function': {
2958
- pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
2959
- lookbehind: true
2960
- },
2961
- 'punctuation': /[(){};:,]/
2962
- };
2963
-
2964
- Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
2965
-
2966
- var markup = Prism.languages.markup;
2967
- if (markup) {
2968
- markup.tag.addInlined('style', 'css');
2969
- markup.tag.addAttribute('style', 'css');
2970
- }
2971
-
2972
- }(Prism));
2973
-
2974
-
2975
- /* **********************************************
2976
- Begin prism-clike.js
2977
- ********************************************** */
2978
-
2979
- Prism.languages.clike = {
2980
- 'comment': [
2981
- {
2982
- pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
2983
- lookbehind: true,
2984
- greedy: true
2985
- },
2986
- {
2987
- pattern: /(^|[^\\:])\/\/.*/,
2988
- lookbehind: true,
2989
- greedy: true
2990
- }
2991
- ],
2992
- 'string': {
2993
- pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
2994
- greedy: true
2995
- },
2996
- 'class-name': {
2997
- pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
2998
- lookbehind: true,
2999
- inside: {
3000
- 'punctuation': /[.\\]/
3001
- }
3002
- },
3003
- 'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
3004
- 'boolean': /\b(?:false|true)\b/,
3005
- 'function': /\b\w+(?=\()/,
3006
- 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
3007
- 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
3008
- 'punctuation': /[{}[\];(),.:]/
3009
- };
3010
-
3011
-
3012
- /* **********************************************
3013
- Begin prism-javascript.js
3014
- ********************************************** */
3015
-
3016
- Prism.languages.javascript = Prism.languages.extend('clike', {
3017
- 'class-name': [
3018
- Prism.languages.clike['class-name'],
3019
- {
3020
- pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
3021
- lookbehind: true
3022
- }
3023
- ],
3024
- 'keyword': [
3025
- {
3026
- pattern: /((?:^|\})\s*)catch\b/,
3027
- lookbehind: true
3028
- },
3029
- {
3030
- 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/,
3031
- lookbehind: true
3032
- },
3033
- ],
3034
- // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
3035
- 'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
3036
- 'number': {
3037
- pattern: RegExp(
3038
- /(^|[^\w$])/.source +
3039
- '(?:' +
3040
- (
3041
- // constant
3042
- /NaN|Infinity/.source +
3043
- '|' +
3044
- // binary integer
3045
- /0[bB][01]+(?:_[01]+)*n?/.source +
3046
- '|' +
3047
- // octal integer
3048
- /0[oO][0-7]+(?:_[0-7]+)*n?/.source +
3049
- '|' +
3050
- // hexadecimal integer
3051
- /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source +
3052
- '|' +
3053
- // decimal bigint
3054
- /\d+(?:_\d+)*n/.source +
3055
- '|' +
3056
- // decimal number (integer or float) but no bigint
3057
- /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source
3058
- ) +
3059
- ')' +
3060
- /(?![\w$])/.source
3061
- ),
3062
- lookbehind: true
3063
- },
3064
- 'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
3065
- });
3066
-
3067
- Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
3068
-
3069
- Prism.languages.insertBefore('javascript', 'keyword', {
3070
- 'regex': {
3071
- pattern: RegExp(
3072
- // lookbehind
3073
- // eslint-disable-next-line regexp/no-dupe-characters-character-class
3074
- /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source +
3075
- // Regex pattern:
3076
- // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
3077
- // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
3078
- // with the only syntax, so we have to define 2 different regex patterns.
3079
- /\//.source +
3080
- '(?:' +
3081
- /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source +
3082
- '|' +
3083
- // `v` flag syntax. This supports 3 levels of nested character classes.
3084
- /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source +
3085
- ')' +
3086
- // lookahead
3087
- /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
3088
- ),
3089
- lookbehind: true,
3090
- greedy: true,
3091
- inside: {
3092
- 'regex-source': {
3093
- pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
3094
- lookbehind: true,
3095
- alias: 'language-regex',
3096
- inside: Prism.languages.regex
3097
- },
3098
- 'regex-delimiter': /^\/|\/$/,
3099
- 'regex-flags': /^[a-z]+$/,
3100
- }
3101
- },
3102
- // This must be declared before keyword because we use "function" inside the look-forward
3103
- 'function-variable': {
3104
- 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*=>))/,
3105
- alias: 'function'
3106
- },
3107
- 'parameter': [
3108
- {
3109
- pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
3110
- lookbehind: true,
3111
- inside: Prism.languages.javascript
3112
- },
3113
- {
3114
- pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
3115
- lookbehind: true,
3116
- inside: Prism.languages.javascript
3117
- },
3118
- {
3119
- pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
3120
- lookbehind: true,
3121
- inside: Prism.languages.javascript
3122
- },
3123
- {
3124
- 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*\{)/,
3125
- lookbehind: true,
3126
- inside: Prism.languages.javascript
3127
- }
3128
- ],
3129
- 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
3130
- });
3131
-
3132
- Prism.languages.insertBefore('javascript', 'string', {
3133
- 'hashbang': {
3134
- pattern: /^#!.*/,
3135
- greedy: true,
3136
- alias: 'comment'
3137
- },
3138
- 'template-string': {
3139
- pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
3140
- greedy: true,
3141
- inside: {
3142
- 'template-punctuation': {
3143
- pattern: /^`|`$/,
3144
- alias: 'string'
3145
- },
3146
- 'interpolation': {
3147
- pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
3148
- lookbehind: true,
3149
- inside: {
3150
- 'interpolation-punctuation': {
3151
- pattern: /^\$\{|\}$/,
3152
- alias: 'punctuation'
3153
- },
3154
- rest: Prism.languages.javascript
3155
- }
3156
- },
3157
- 'string': /[\s\S]+/
3158
- }
3159
- },
3160
- 'string-property': {
3161
- pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
3162
- lookbehind: true,
3163
- greedy: true,
3164
- alias: 'property'
3165
- }
3166
- });
3167
-
3168
- Prism.languages.insertBefore('javascript', 'operator', {
3169
- 'literal-property': {
3170
- pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
3171
- lookbehind: true,
3172
- alias: 'property'
3173
- },
3174
- });
3175
-
3176
- if (Prism.languages.markup) {
3177
- Prism.languages.markup.tag.addInlined('script', 'javascript');
3178
-
3179
- // add attribute support for all DOM events.
3180
- // https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events
3181
- Prism.languages.markup.tag.addAttribute(
3182
- /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,
3183
- 'javascript'
3184
- );
3185
- }
3186
-
3187
- Prism.languages.js = Prism.languages.javascript;
3188
-
3189
-
3190
- /* **********************************************
3191
- Begin prism-file-highlight.js
3192
- ********************************************** */
3193
-
3194
- (function () {
3195
-
3196
- if (typeof Prism === 'undefined' || typeof document === 'undefined') {
3197
- return;
3198
- }
3199
-
3200
- // https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
3201
- if (!Element.prototype.matches) {
3202
- Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
3203
- }
3204
-
3205
- var LOADING_MESSAGE = 'Loading…';
3206
- var FAILURE_MESSAGE = function (status, message) {
3207
- return '✖ Error ' + status + ' while fetching file: ' + message;
3208
- };
3209
- var FAILURE_EMPTY_MESSAGE = '✖ Error: File does not exist or is empty';
3210
-
3211
- var EXTENSIONS = {
3212
- 'js': 'javascript',
3213
- 'py': 'python',
3214
- 'rb': 'ruby',
3215
- 'ps1': 'powershell',
3216
- 'psm1': 'powershell',
3217
- 'sh': 'bash',
3218
- 'bat': 'batch',
3219
- 'h': 'c',
3220
- 'tex': 'latex'
3221
- };
3222
-
3223
- var STATUS_ATTR = 'data-src-status';
3224
- var STATUS_LOADING = 'loading';
3225
- var STATUS_LOADED = 'loaded';
3226
- var STATUS_FAILED = 'failed';
3227
-
3228
- var SELECTOR = 'pre[data-src]:not([' + STATUS_ATTR + '="' + STATUS_LOADED + '"])'
3229
- + ':not([' + STATUS_ATTR + '="' + STATUS_LOADING + '"])';
3230
-
3231
- /**
3232
- * Loads the given file.
3233
- *
3234
- * @param {string} src The URL or path of the source file to load.
3235
- * @param {(result: string) => void} success
3236
- * @param {(reason: string) => void} error
3237
- */
3238
- function loadFile(src, success, error) {
3239
- var xhr = new XMLHttpRequest();
3240
- xhr.open('GET', src, true);
3241
- xhr.onreadystatechange = function () {
3242
- if (xhr.readyState == 4) {
3243
- if (xhr.status < 400 && xhr.responseText) {
3244
- success(xhr.responseText);
3245
- } else {
3246
- if (xhr.status >= 400) {
3247
- error(FAILURE_MESSAGE(xhr.status, xhr.statusText));
3248
- } else {
3249
- error(FAILURE_EMPTY_MESSAGE);
3250
- }
3251
- }
3252
- }
3253
- };
3254
- xhr.send(null);
3255
- }
3256
-
3257
- /**
3258
- * Parses the given range.
3259
- *
3260
- * This returns a range with inclusive ends.
3261
- *
3262
- * @param {string | null | undefined} range
3263
- * @returns {[number, number | undefined] | undefined}
3264
- */
3265
- function parseRange(range) {
3266
- var m = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(range || '');
3267
- if (m) {
3268
- var start = Number(m[1]);
3269
- var comma = m[2];
3270
- var end = m[3];
3271
-
3272
- if (!comma) {
3273
- return [start, start];
3274
- }
3275
- if (!end) {
3276
- return [start, undefined];
3277
- }
3278
- return [start, Number(end)];
3279
- }
3280
- return undefined;
3281
- }
3282
-
3283
- Prism.hooks.add('before-highlightall', function (env) {
3284
- env.selector += ', ' + SELECTOR;
3285
- });
3286
-
3287
- Prism.hooks.add('before-sanity-check', function (env) {
3288
- var pre = /** @type {HTMLPreElement} */ (env.element);
3289
- if (pre.matches(SELECTOR)) {
3290
- env.code = ''; // fast-path the whole thing and go to complete
3291
-
3292
- pre.setAttribute(STATUS_ATTR, STATUS_LOADING); // mark as loading
3293
-
3294
- // add code element with loading message
3295
- var code = pre.appendChild(document.createElement('CODE'));
3296
- code.textContent = LOADING_MESSAGE;
3297
-
3298
- var src = pre.getAttribute('data-src');
3299
-
3300
- var language = env.language;
3301
- if (language === 'none') {
3302
- // the language might be 'none' because there is no language set;
3303
- // in this case, we want to use the extension as the language
3304
- var extension = (/\.(\w+)$/.exec(src) || [, 'none'])[1];
3305
- language = EXTENSIONS[extension] || extension;
3306
- }
3307
-
3308
- // set language classes
3309
- Prism.util.setLanguage(code, language);
3310
- Prism.util.setLanguage(pre, language);
3311
-
3312
- // preload the language
3313
- var autoloader = Prism.plugins.autoloader;
3314
- if (autoloader) {
3315
- autoloader.loadLanguages(language);
3316
- }
3317
-
3318
- // load file
3319
- loadFile(
3320
- src,
3321
- function (text) {
3322
- // mark as loaded
3323
- pre.setAttribute(STATUS_ATTR, STATUS_LOADED);
3324
-
3325
- // handle data-range
3326
- var range = parseRange(pre.getAttribute('data-range'));
3327
- if (range) {
3328
- var lines = text.split(/\r\n?|\n/g);
3329
-
3330
- // the range is one-based and inclusive on both ends
3331
- var start = range[0];
3332
- var end = range[1] == null ? lines.length : range[1];
3333
-
3334
- if (start < 0) { start += lines.length; }
3335
- start = Math.max(0, Math.min(start - 1, lines.length));
3336
- if (end < 0) { end += lines.length; }
3337
- end = Math.max(0, Math.min(end, lines.length));
3338
-
3339
- text = lines.slice(start, end).join('\n');
3340
-
3341
- // add data-start for line numbers
3342
- if (!pre.hasAttribute('data-start')) {
3343
- pre.setAttribute('data-start', String(start + 1));
3344
- }
3345
- }
3346
-
3347
- // highlight code
3348
- code.textContent = text;
3349
- Prism.highlightElement(code);
3350
- },
3351
- function (error) {
3352
- // mark as failed
3353
- pre.setAttribute(STATUS_ATTR, STATUS_FAILED);
3354
-
3355
- code.textContent = error;
3356
- }
3357
- );
3358
- }
3359
- });
3360
-
3361
- Prism.plugins.fileHighlight = {
3362
- /**
3363
- * Executes the File Highlight plugin for all matching `pre` elements under the given container.
3364
- *
3365
- * Note: Elements which are already loaded or currently loading will not be touched by this method.
3366
- *
3367
- * @param {ParentNode} [container=document]
3368
- */
3369
- highlight: function highlight(container) {
3370
- var elements = (container || document).querySelectorAll(SELECTOR);
3371
-
3372
- for (var i = 0, element; (element = elements[i++]);) {
3373
- Prism.highlightElement(element);
3374
- }
3375
- }
3376
- };
3377
-
3378
- var logged = false;
3379
- /** @deprecated Use `Prism.plugins.fileHighlight.highlight` instead. */
3380
- Prism.fileHighlight = function () {
3381
- if (!logged) {
3382
- console.warn('Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead.');
3383
- logged = true;
3384
- }
3385
- Prism.plugins.fileHighlight.highlight.apply(this, arguments);
3386
- };
3387
-
3388
- }());
3389
- } (prism));
3390
-
3391
- var prismExports = prism.exports;
3392
- var Prism$1 = /*@__PURE__*/getDefaultExportFromCjs(prismExports);
3393
-
3394
- (function (Prism) {
3395
-
3396
- // Allow only one line break
3397
- var inner = /(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;
3398
-
3399
- /**
3400
- * This function is intended for the creation of the bold or italic pattern.
3401
- *
3402
- * This also adds a lookbehind group to the given pattern to ensure that the pattern is not backslash-escaped.
3403
- *
3404
- * _Note:_ Keep in mind that this adds a capturing group.
3405
- *
3406
- * @param {string} pattern
3407
- * @returns {RegExp}
3408
- */
3409
- function createInline(pattern) {
3410
- pattern = pattern.replace(/<inner>/g, function () { return inner; });
3411
- return RegExp(/((?:^|[^\\])(?:\\{2})*)/.source + '(?:' + pattern + ')');
3412
- }
3413
-
3414
-
3415
- var tableCell = /(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source;
3416
- var tableRow = /\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g, function () { return tableCell; });
3417
- var tableLine = /\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;
3418
-
3419
-
3420
- Prism.languages.markdown = Prism.languages.extend('markup', {});
3421
- Prism.languages.insertBefore('markdown', 'prolog', {
3422
- 'front-matter-block': {
3423
- pattern: /(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,
3424
- lookbehind: true,
3425
- greedy: true,
3426
- inside: {
3427
- 'punctuation': /^---|---$/,
3428
- 'front-matter': {
3429
- pattern: /\S+(?:\s+\S+)*/,
3430
- alias: ['yaml', 'language-yaml'],
3431
- inside: Prism.languages.yaml
3432
- }
3433
- }
3434
- },
3435
- 'blockquote': {
3436
- // > ...
3437
- pattern: /^>(?:[\t ]*>)*/m,
3438
- alias: 'punctuation'
3439
- },
3440
- 'table': {
3441
- pattern: RegExp('^' + tableRow + tableLine + '(?:' + tableRow + ')*', 'm'),
3442
- inside: {
3443
- 'table-data-rows': {
3444
- pattern: RegExp('^(' + tableRow + tableLine + ')(?:' + tableRow + ')*$'),
3445
- lookbehind: true,
3446
- inside: {
3447
- 'table-data': {
3448
- pattern: RegExp(tableCell),
3449
- inside: Prism.languages.markdown
3450
- },
3451
- 'punctuation': /\|/
3452
- }
3453
- },
3454
- 'table-line': {
3455
- pattern: RegExp('^(' + tableRow + ')' + tableLine + '$'),
3456
- lookbehind: true,
3457
- inside: {
3458
- 'punctuation': /\||:?-{3,}:?/
3459
- }
3460
- },
3461
- 'table-header-row': {
3462
- pattern: RegExp('^' + tableRow + '$'),
3463
- inside: {
3464
- 'table-header': {
3465
- pattern: RegExp(tableCell),
3466
- alias: 'important',
3467
- inside: Prism.languages.markdown
3468
- },
3469
- 'punctuation': /\|/
3470
- }
3471
- }
3472
- }
3473
- },
3474
- 'code': [
3475
- {
3476
- // Prefixed by 4 spaces or 1 tab and preceded by an empty line
3477
- pattern: /((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,
3478
- lookbehind: true,
3479
- alias: 'keyword'
3480
- },
3481
- {
3482
- // ```optional language
3483
- // code block
3484
- // ```
3485
- pattern: /^```[\s\S]*?^```$/m,
3486
- greedy: true,
3487
- inside: {
3488
- 'code-block': {
3489
- pattern: /^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,
3490
- lookbehind: true
3491
- },
3492
- 'code-language': {
3493
- pattern: /^(```).+/,
3494
- lookbehind: true
3495
- },
3496
- 'punctuation': /```/
3497
- }
3498
- }
3499
- ],
3500
- 'title': [
3501
- {
3502
- // title 1
3503
- // =======
3504
-
3505
- // title 2
3506
- // -------
3507
- pattern: /\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,
3508
- alias: 'important',
3509
- inside: {
3510
- punctuation: /==+$|--+$/
3511
- }
3512
- },
3513
- {
3514
- // # title 1
3515
- // ###### title 6
3516
- pattern: /(^\s*)#.+/m,
3517
- lookbehind: true,
3518
- alias: 'important',
3519
- inside: {
3520
- punctuation: /^#+|#+$/
3521
- }
3522
- }
3523
- ],
3524
- 'hr': {
3525
- // ***
3526
- // ---
3527
- // * * *
3528
- // -----------
3529
- pattern: /(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,
3530
- lookbehind: true,
3531
- alias: 'punctuation'
3532
- },
3533
- 'list': {
3534
- // * item
3535
- // + item
3536
- // - item
3537
- // 1. item
3538
- pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,
3539
- lookbehind: true,
3540
- alias: 'punctuation'
3541
- },
3542
- 'url-reference': {
3543
- // [id]: http://example.com "Optional title"
3544
- // [id]: http://example.com 'Optional title'
3545
- // [id]: http://example.com (Optional title)
3546
- // [id]: <http://example.com> "Optional title"
3547
- pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,
3548
- inside: {
3549
- 'variable': {
3550
- pattern: /^(!?\[)[^\]]+/,
3551
- lookbehind: true
3552
- },
3553
- 'string': /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,
3554
- 'punctuation': /^[\[\]!:]|[<>]/
3555
- },
3556
- alias: 'url'
3557
- },
3558
- 'bold': {
3559
- // **strong**
3560
- // __strong__
3561
-
3562
- // allow one nested instance of italic text using the same delimiter
3563
- pattern: createInline(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),
3564
- lookbehind: true,
3565
- greedy: true,
3566
- inside: {
3567
- 'content': {
3568
- pattern: /(^..)[\s\S]+(?=..$)/,
3569
- lookbehind: true,
3570
- inside: {} // see below
3571
- },
3572
- 'punctuation': /\*\*|__/
3573
- }
3574
- },
3575
- 'italic': {
3576
- // *em*
3577
- // _em_
3578
-
3579
- // allow one nested instance of bold text using the same delimiter
3580
- pattern: createInline(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),
3581
- lookbehind: true,
3582
- greedy: true,
3583
- inside: {
3584
- 'content': {
3585
- pattern: /(^.)[\s\S]+(?=.$)/,
3586
- lookbehind: true,
3587
- inside: {} // see below
3588
- },
3589
- 'punctuation': /[*_]/
3590
- }
3591
- },
3592
- 'strike': {
3593
- // ~~strike through~~
3594
- // ~strike~
3595
- // eslint-disable-next-line regexp/strict
3596
- pattern: createInline(/(~~?)(?:(?!~)<inner>)+\2/.source),
3597
- lookbehind: true,
3598
- greedy: true,
3599
- inside: {
3600
- 'content': {
3601
- pattern: /(^~~?)[\s\S]+(?=\1$)/,
3602
- lookbehind: true,
3603
- inside: {} // see below
3604
- },
3605
- 'punctuation': /~~?/
3606
- }
3607
- },
3608
- 'code-snippet': {
3609
- // `code`
3610
- // ``code``
3611
- pattern: /(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,
3612
- lookbehind: true,
3613
- greedy: true,
3614
- alias: ['code', 'keyword']
3615
- },
3616
- 'url': {
3617
- // [example](http://example.com "Optional title")
3618
- // [example][id]
3619
- // [example] [id]
3620
- pattern: createInline(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),
3621
- lookbehind: true,
3622
- greedy: true,
3623
- inside: {
3624
- 'operator': /^!/,
3625
- 'content': {
3626
- pattern: /(^\[)[^\]]+(?=\])/,
3627
- lookbehind: true,
3628
- inside: {} // see below
3629
- },
3630
- 'variable': {
3631
- pattern: /(^\][ \t]?\[)[^\]]+(?=\]$)/,
3632
- lookbehind: true
3633
- },
3634
- 'url': {
3635
- pattern: /(^\]\()[^\s)]+/,
3636
- lookbehind: true
3637
- },
3638
- 'string': {
3639
- pattern: /(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,
3640
- lookbehind: true
3641
- }
3642
- }
3643
- }
3644
- });
3645
-
3646
- ['url', 'bold', 'italic', 'strike'].forEach(function (token) {
3647
- ['url', 'bold', 'italic', 'strike', 'code-snippet'].forEach(function (inside) {
3648
- if (token !== inside) {
3649
- Prism.languages.markdown[token].inside.content.inside[inside] = Prism.languages.markdown[inside];
3650
- }
3651
- });
3652
- });
3653
-
3654
- Prism.hooks.add('after-tokenize', function (env) {
3655
- if (env.language !== 'markdown' && env.language !== 'md') {
3656
- return;
3657
- }
3658
-
3659
- function walkTokens(tokens) {
3660
- if (!tokens || typeof tokens === 'string') {
3661
- return;
3662
- }
3663
-
3664
- for (var i = 0, l = tokens.length; i < l; i++) {
3665
- var token = tokens[i];
3666
-
3667
- if (token.type !== 'code') {
3668
- walkTokens(token.content);
3669
- continue;
3670
- }
3671
-
3672
- /*
3673
- * Add the correct `language-xxxx` class to this code block. Keep in mind that the `code-language` token
3674
- * is optional. But the grammar is defined so that there is only one case we have to handle:
3675
- *
3676
- * token.content = [
3677
- * <span class="punctuation">```</span>,
3678
- * <span class="code-language">xxxx</span>,
3679
- * '\n', // exactly one new lines (\r or \n or \r\n)
3680
- * <span class="code-block">...</span>,
3681
- * '\n', // exactly one new lines again
3682
- * <span class="punctuation">```</span>
3683
- * ];
3684
- */
3685
-
3686
- var codeLang = token.content[1];
3687
- var codeBlock = token.content[3];
3688
-
3689
- if (codeLang && codeBlock &&
3690
- codeLang.type === 'code-language' && codeBlock.type === 'code-block' &&
3691
- typeof codeLang.content === 'string') {
3692
-
3693
- // this might be a language that Prism does not support
3694
-
3695
- // do some replacements to support C++, C#, and F#
3696
- var lang = codeLang.content.replace(/\b#/g, 'sharp').replace(/\b\+\+/g, 'pp');
3697
- // only use the first word
3698
- lang = (/[a-z][\w-]*/i.exec(lang) || [''])[0].toLowerCase();
3699
- var alias = 'language-' + lang;
3700
-
3701
- // add alias
3702
- if (!codeBlock.alias) {
3703
- codeBlock.alias = [alias];
3704
- } else if (typeof codeBlock.alias === 'string') {
3705
- codeBlock.alias = [codeBlock.alias, alias];
3706
- } else {
3707
- codeBlock.alias.push(alias);
3708
- }
3709
- }
3710
- }
3711
- }
3712
-
3713
- walkTokens(env.tokens);
3714
- });
3715
-
3716
- Prism.hooks.add('wrap', function (env) {
3717
- if (env.type !== 'code-block') {
3718
- return;
3719
- }
3720
-
3721
- var codeLang = '';
3722
- for (var i = 0, l = env.classes.length; i < l; i++) {
3723
- var cls = env.classes[i];
3724
- var match = /language-(.+)/.exec(cls);
3725
- if (match) {
3726
- codeLang = match[1];
3727
- break;
3728
- }
3729
- }
3730
-
3731
- var grammar = Prism.languages[codeLang];
3732
-
3733
- if (!grammar) {
3734
- if (codeLang && codeLang !== 'none' && Prism.plugins.autoloader) {
3735
- var id = 'md-' + new Date().valueOf() + '-' + Math.floor(Math.random() * 1e16);
3736
- env.attributes['id'] = id;
3737
-
3738
- Prism.plugins.autoloader.loadLanguages(codeLang, function () {
3739
- var ele = document.getElementById(id);
3740
- if (ele) {
3741
- ele.innerHTML = Prism.highlight(ele.textContent, Prism.languages[codeLang], codeLang);
3742
- }
3743
- });
3744
- }
3745
- } else {
3746
- env.content = Prism.highlight(textContent(env.content), grammar, codeLang);
3747
- }
3748
- });
3749
-
3750
- var tagPattern = RegExp(Prism.languages.markup.tag.pattern.source, 'gi');
3751
-
3752
- /**
3753
- * A list of known entity names.
3754
- *
3755
- * This will always be incomplete to save space. The current list is the one used by lowdash's unescape function.
3756
- *
3757
- * @see {@link https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/unescape.js#L2}
3758
- */
3759
- var KNOWN_ENTITY_NAMES = {
3760
- 'amp': '&',
3761
- 'lt': '<',
3762
- 'gt': '>',
3763
- 'quot': '"',
3764
- };
3765
-
3766
- // IE 11 doesn't support `String.fromCodePoint`
3767
- var fromCodePoint = String.fromCodePoint || String.fromCharCode;
3768
-
3769
- /**
3770
- * Returns the text content of a given HTML source code string.
3771
- *
3772
- * @param {string} html
3773
- * @returns {string}
3774
- */
3775
- function textContent(html) {
3776
- // remove all tags
3777
- var text = html.replace(tagPattern, '');
3778
-
3779
- // decode known entities
3780
- text = text.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi, function (m, code) {
3781
- code = code.toLowerCase();
3782
-
3783
- if (code[0] === '#') {
3784
- var value;
3785
- if (code[1] === 'x') {
3786
- value = parseInt(code.slice(2), 16);
3787
- } else {
3788
- value = Number(code.slice(1));
3789
- }
3790
-
3791
- return fromCodePoint(value);
3792
- } else {
3793
- var known = KNOWN_ENTITY_NAMES[code];
3794
- if (known) {
3795
- return known;
3796
- }
3797
-
3798
- // unable to decode
3799
- return m;
3800
- }
3801
- });
3802
-
3803
- return text;
3804
- }
3805
-
3806
- Prism.languages.md = Prism.languages.markdown;
3807
-
3808
- }(Prism));
3809
-
3810
- (function () {
3811
-
3812
- if (typeof Prism === 'undefined' || typeof document === 'undefined') {
3813
- return;
3814
- }
3815
-
3816
- /**
3817
- * Plugin name which is used as a class name for <pre> which is activating the plugin
3818
- *
3819
- * @type {string}
3820
- */
3821
- var PLUGIN_NAME = 'line-numbers';
3822
-
3823
- /**
3824
- * Regular expression used for determining line breaks
3825
- *
3826
- * @type {RegExp}
3827
- */
3828
- var NEW_LINE_EXP = /\n(?!$)/g;
3829
-
3830
-
3831
- /**
3832
- * Global exports
3833
- */
3834
- var config = Prism.plugins.lineNumbers = {
3835
- /**
3836
- * Get node for provided line number
3837
- *
3838
- * @param {Element} element pre element
3839
- * @param {number} number line number
3840
- * @returns {Element|undefined}
3841
- */
3842
- getLine: function (element, number) {
3843
- if (element.tagName !== 'PRE' || !element.classList.contains(PLUGIN_NAME)) {
3844
- return;
3845
- }
3846
-
3847
- var lineNumberRows = element.querySelector('.line-numbers-rows');
3848
- if (!lineNumberRows) {
3849
- return;
3850
- }
3851
- var lineNumberStart = parseInt(element.getAttribute('data-start'), 10) || 1;
3852
- var lineNumberEnd = lineNumberStart + (lineNumberRows.children.length - 1);
3853
-
3854
- if (number < lineNumberStart) {
3855
- number = lineNumberStart;
3856
- }
3857
- if (number > lineNumberEnd) {
3858
- number = lineNumberEnd;
3859
- }
3860
-
3861
- var lineIndex = number - lineNumberStart;
3862
-
3863
- return lineNumberRows.children[lineIndex];
3864
- },
3865
-
3866
- /**
3867
- * Resizes the line numbers of the given element.
3868
- *
3869
- * This function will not add line numbers. It will only resize existing ones.
3870
- *
3871
- * @param {HTMLElement} element A `<pre>` element with line numbers.
3872
- * @returns {void}
3873
- */
3874
- resize: function (element) {
3875
- resizeElements([element]);
3876
- },
3877
-
3878
- /**
3879
- * Whether the plugin can assume that the units font sizes and margins are not depended on the size of
3880
- * the current viewport.
3881
- *
3882
- * Setting this to `true` will allow the plugin to do certain optimizations for better performance.
3883
- *
3884
- * Set this to `false` if you use any of the following CSS units: `vh`, `vw`, `vmin`, `vmax`.
3885
- *
3886
- * @type {boolean}
3887
- */
3888
- assumeViewportIndependence: true
3889
- };
3890
-
3891
- /**
3892
- * Resizes the given elements.
3893
- *
3894
- * @param {HTMLElement[]} elements
3895
- */
3896
- function resizeElements(elements) {
3897
- elements = elements.filter(function (e) {
3898
- var codeStyles = getStyles(e);
3899
- var whiteSpace = codeStyles['white-space'];
3900
- return whiteSpace === 'pre-wrap' || whiteSpace === 'pre-line';
3901
- });
3902
-
3903
- if (elements.length == 0) {
3904
- return;
3905
- }
3906
-
3907
- var infos = elements.map(function (element) {
3908
- var codeElement = element.querySelector('code');
3909
- var lineNumbersWrapper = element.querySelector('.line-numbers-rows');
3910
- if (!codeElement || !lineNumbersWrapper) {
3911
- return undefined;
3912
- }
3913
-
3914
- /** @type {HTMLElement} */
3915
- var lineNumberSizer = element.querySelector('.line-numbers-sizer');
3916
- var codeLines = codeElement.textContent.split(NEW_LINE_EXP);
3917
-
3918
- if (!lineNumberSizer) {
3919
- lineNumberSizer = document.createElement('span');
3920
- lineNumberSizer.className = 'line-numbers-sizer';
3921
-
3922
- codeElement.appendChild(lineNumberSizer);
3923
- }
3924
-
3925
- lineNumberSizer.innerHTML = '0';
3926
- lineNumberSizer.style.display = 'block';
3927
-
3928
- var oneLinerHeight = lineNumberSizer.getBoundingClientRect().height;
3929
- lineNumberSizer.innerHTML = '';
3930
-
3931
- return {
3932
- element: element,
3933
- lines: codeLines,
3934
- lineHeights: [],
3935
- oneLinerHeight: oneLinerHeight,
3936
- sizer: lineNumberSizer,
3937
- };
3938
- }).filter(Boolean);
3939
-
3940
- infos.forEach(function (info) {
3941
- var lineNumberSizer = info.sizer;
3942
- var lines = info.lines;
3943
- var lineHeights = info.lineHeights;
3944
- var oneLinerHeight = info.oneLinerHeight;
3945
-
3946
- lineHeights[lines.length - 1] = undefined;
3947
- lines.forEach(function (line, index) {
3948
- if (line && line.length > 1) {
3949
- var e = lineNumberSizer.appendChild(document.createElement('span'));
3950
- e.style.display = 'block';
3951
- e.textContent = line;
3952
- } else {
3953
- lineHeights[index] = oneLinerHeight;
3954
- }
3955
- });
3956
- });
3957
-
3958
- infos.forEach(function (info) {
3959
- var lineNumberSizer = info.sizer;
3960
- var lineHeights = info.lineHeights;
3961
-
3962
- var childIndex = 0;
3963
- for (var i = 0; i < lineHeights.length; i++) {
3964
- if (lineHeights[i] === undefined) {
3965
- lineHeights[i] = lineNumberSizer.children[childIndex++].getBoundingClientRect().height;
3966
- }
3967
- }
3968
- });
3969
-
3970
- infos.forEach(function (info) {
3971
- var lineNumberSizer = info.sizer;
3972
- var wrapper = info.element.querySelector('.line-numbers-rows');
3973
-
3974
- lineNumberSizer.style.display = 'none';
3975
- lineNumberSizer.innerHTML = '';
3976
-
3977
- info.lineHeights.forEach(function (height, lineNumber) {
3978
- wrapper.children[lineNumber].style.height = height + 'px';
3979
- });
3980
- });
3981
- }
3982
-
3983
- /**
3984
- * Returns style declarations for the element
3985
- *
3986
- * @param {Element} element
3987
- */
3988
- function getStyles(element) {
3989
- if (!element) {
3990
- return null;
3991
- }
3992
-
3993
- return window.getComputedStyle ? getComputedStyle(element) : (element.currentStyle || null);
3994
- }
3995
-
3996
- var lastWidth = undefined;
3997
- window.addEventListener('resize', function () {
3998
- if (config.assumeViewportIndependence && lastWidth === window.innerWidth) {
3999
- return;
4000
- }
4001
- lastWidth = window.innerWidth;
4002
-
4003
- resizeElements(Array.prototype.slice.call(document.querySelectorAll('pre.' + PLUGIN_NAME)));
4004
- });
4005
-
4006
- Prism.hooks.add('complete', function (env) {
4007
- if (!env.code) {
4008
- return;
4009
- }
4010
-
4011
- var code = /** @type {Element} */ (env.element);
4012
- var pre = /** @type {HTMLElement} */ (code.parentNode);
4013
-
4014
- // works only for <code> wrapped inside <pre> (not inline)
4015
- if (!pre || !/pre/i.test(pre.nodeName)) {
4016
- return;
4017
- }
4018
-
4019
- // Abort if line numbers already exists
4020
- if (code.querySelector('.line-numbers-rows')) {
4021
- return;
4022
- }
4023
-
4024
- // only add line numbers if <code> or one of its ancestors has the `line-numbers` class
4025
- if (!Prism.util.isActive(code, PLUGIN_NAME)) {
4026
- return;
4027
- }
4028
-
4029
- // Remove the class 'line-numbers' from the <code>
4030
- code.classList.remove(PLUGIN_NAME);
4031
- // Add the class 'line-numbers' to the <pre>
4032
- pre.classList.add(PLUGIN_NAME);
4033
-
4034
- var match = env.code.match(NEW_LINE_EXP);
4035
- var linesNum = match ? match.length + 1 : 1;
4036
- var lineNumbersWrapper;
4037
-
4038
- var lines = new Array(linesNum + 1).join('<span></span>');
4039
-
4040
- lineNumbersWrapper = document.createElement('span');
4041
- lineNumbersWrapper.setAttribute('aria-hidden', 'true');
4042
- lineNumbersWrapper.className = 'line-numbers-rows';
4043
- lineNumbersWrapper.innerHTML = lines;
4044
-
4045
- if (pre.hasAttribute('data-start')) {
4046
- pre.style.counterReset = 'linenumber ' + (parseInt(pre.getAttribute('data-start'), 10) - 1);
4047
- }
4048
-
4049
- env.element.appendChild(lineNumbersWrapper);
4050
-
4051
- resizeElements([pre]);
4052
-
4053
- Prism.hooks.run('line-numbers', env);
4054
- });
4055
-
4056
- Prism.hooks.add('line-numbers', function (env) {
4057
- env.plugins = env.plugins || {};
4058
- env.plugins.lineNumbers = true;
4059
- });
4060
-
4061
- }());
4062
-
4063
- /**
4064
- * @fileoverview Utilities for formatting and generating markdown tables with support
4065
- * for cell formatting, alignment, and width calculations.
4066
- */
4067
- var CellFormatter = /** @class */ (function () {
4068
- function CellFormatter(config) {
4069
- this.config = config;
4070
- this.padding = this.config.useTabs
4071
- ? "\t"
4072
- : this.config.hasPadding
4073
- ? " "
4074
- : "";
4075
- }
4076
- CellFormatter.prototype.formatCellContent = function (cell) {
4077
- var content = cell.content;
4078
- if (cell.code) {
4079
- content = "`".concat(content, "`");
4080
- }
4081
- if (cell.bold) {
4082
- content = "**".concat(content, "**");
4083
- }
4084
- if (cell.italic) {
4085
- content = "*".concat(content, "*");
4086
- }
4087
- if (cell.link) {
4088
- content = "[".concat(content, "](").concat(cell.link, ")");
4089
- }
4090
- return content;
4091
- };
4092
- CellFormatter.prototype.formatCell = function (cell, width) {
4093
- var content = this.formatCellContent(cell);
4094
- var alignment = cell.alignment || "inherit";
4095
- var effectiveAlignment = alignment === "inherit" ? "none" : alignment;
4096
- var paddedContent = "".concat(this.padding).concat(content).concat(this.padding);
4097
- var spacesToAdd = width - content.length;
4098
- if (spacesToAdd <= 0)
4099
- return paddedContent;
4100
- switch (effectiveAlignment) {
4101
- case "right":
4102
- return " ".repeat(spacesToAdd) + paddedContent;
4103
- case "center": {
4104
- var leftPad = Math.floor(spacesToAdd / 2);
4105
- var rightPad = spacesToAdd - leftPad;
4106
- return " ".repeat(leftPad) + paddedContent + " ".repeat(rightPad);
4107
- }
4108
- case "justify":
4109
- case "left":
4110
- case "none":
4111
- default:
4112
- return paddedContent + " ".repeat(spacesToAdd);
4113
- }
4114
- };
4115
- return CellFormatter;
4116
- }());
4117
- var AlignmentFormatter = /** @class */ (function () {
4118
- function AlignmentFormatter() {
4119
- }
4120
- AlignmentFormatter.formatIndicator = function (alignment, width) {
4121
- return this.indicators[alignment](width);
4122
- };
4123
- AlignmentFormatter.indicators = {
4124
- left: function (width) { return ":".concat("-".repeat(width - 1)); },
4125
- right: function (width) { return "".concat("-".repeat(width - 1), ":"); },
4126
- center: function (width) { return ":".concat("-".repeat(width - 2), ":"); },
4127
- none: function (width) { return "-".repeat(width); },
4128
- justify: function (width) { return "-".repeat(width); },
4129
- };
4130
- return AlignmentFormatter;
4131
- }());
4132
- var TableFormatter = /** @class */ (function () {
4133
- function TableFormatter(config) {
4134
- this.config = config;
4135
- this.cellFormatter = new CellFormatter(config);
4136
- this.adjustedAlignments = this.getAdjustedAlignments();
4137
- }
4138
- TableFormatter.prototype.getAdjustedAlignments = function () {
4139
- var defaultAlignment = "none";
4140
- var sanitizeAlignment = function (alignment) {
4141
- return alignment === "justify" ? "none" : alignment;
4142
- };
4143
- return this.config.columnAlignments.length < this.config.columnCount
4144
- ? __spreadArray(__spreadArray([], Array.from(this.config.columnAlignments).map(sanitizeAlignment), true), Array(this.config.columnCount - this.config.columnAlignments.length).fill(defaultAlignment), true) : Array.from(this.config.columnAlignments).map(sanitizeAlignment);
4145
- };
4146
- TableFormatter.prototype.formatRow = function (row) {
4147
- var _this = this;
4148
- var formattedCells = Array.from({ length: this.config.columnCount }, function (_, i) {
4149
- var _a, _b, _c;
4150
- var cell = (_a = row[i]) !== null && _a !== void 0 ? _a : { content: "" };
4151
- var width = (_c = (_b = _this.config.columnWidths) === null || _b === void 0 ? void 0 : _b[i]) !== null && _c !== void 0 ? _c : cell.content.length;
4152
- return _this.cellFormatter.formatCell(cell, width);
4153
- });
4154
- return "|".concat(formattedCells.join("|"), "|");
4155
- };
4156
- TableFormatter.prototype.formatAlignmentRow = function () {
4157
- var _this = this;
4158
- var padding = this.config.useTabs
4159
- ? "\t"
4160
- : this.config.hasPadding
4161
- ? " "
4162
- : "";
4163
- var formattedColumns = Array.from({ length: this.config.columnCount }, function (_, i) {
4164
- var _a, _b;
4165
- var alignment = _this.adjustedAlignments[i];
4166
- var width = (_b = (_a = _this.config.columnWidths) === null || _a === void 0 ? void 0 : _a[i]) !== null && _b !== void 0 ? _b : 3;
4167
- var indicator = AlignmentFormatter.formatIndicator(alignment, width);
4168
- return "".concat(padding).concat(indicator).concat(padding);
4169
- });
4170
- return "|".concat(formattedColumns.join("|"), "|");
4171
- };
4172
- return TableFormatter;
4173
- }());
4174
- function calculateColumnWidths(tableRows, maxColumnCount, config) {
4175
- var widths = new Array(maxColumnCount).fill(3);
4176
- var cellFormatter = new CellFormatter(config);
4177
- tableRows.forEach(function (row) {
4178
- for (var i = 0; i < maxColumnCount; i++) {
4179
- var cell = row[i];
4180
- if (cell) {
4181
- var formattedContent = cellFormatter["formatCellContent"](cell);
4182
- widths[i] = Math.max(widths[i], formattedContent.length);
4183
- }
4184
- }
4185
- });
4186
- return widths;
4187
- }
4188
- function generateMarkdownTableString(inputData, columnAlignments, canAdjustColumnWidths, useTabs, replaceNewlines, hasPadding) {
4189
- if (canAdjustColumnWidths === void 0) { canAdjustColumnWidths = true; }
4190
- if (useTabs === void 0) { useTabs = false; }
4191
- if (replaceNewlines === void 0) { replaceNewlines = false; }
4192
- if (hasPadding === void 0) { hasPadding = true; }
4193
- var maxColumnCount = Math.max.apply(Math, __spreadArray([inputData.inputDataHeader.length], inputData.inputDataBody.map(function (row) { return row.length; }), false));
4194
- var config = {
4195
- columnCount: maxColumnCount,
4196
- columnAlignments: columnAlignments,
4197
- columnWidths: canAdjustColumnWidths
4198
- ? calculateColumnWidths(__spreadArray([inputData.inputDataHeader], inputData.inputDataBody, true), maxColumnCount, {
4199
- columnCount: maxColumnCount,
4200
- columnAlignments: columnAlignments,
4201
- useTabs: useTabs,
4202
- replaceNewlines: replaceNewlines,
4203
- hasPadding: hasPadding,
4204
- })
4205
- : undefined,
4206
- useTabs: useTabs,
4207
- replaceNewlines: replaceNewlines,
4208
- hasPadding: hasPadding,
4209
- };
4210
- var tableFormatter = new TableFormatter(config);
4211
- var headerRow = tableFormatter.formatRow(inputData.inputDataHeader);
4212
- var alignmentRow = tableFormatter.formatAlignmentRow();
4213
- var bodyRows = inputData.inputDataBody
4214
- .map(function (row) { return tableFormatter.formatRow(row); })
4215
- .join("\n");
4216
- return "".concat(headerRow, "\n").concat(alignmentRow, "\n").concat(bodyRows).trimEnd();
4217
- }
4218
- function getColumnName(index) {
4219
- var columnName = "";
4220
- var currentIndex = index;
4221
- while (currentIndex >= 0) {
4222
- columnName = String.fromCharCode((currentIndex % 26) + 65) + columnName;
4223
- currentIndex = Math.floor(currentIndex / 26) - 1;
4224
- }
4225
- return columnName;
4226
- }
4227
- function generateAlphabetHeaders(columnCount) {
4228
- return Array.from({ length: columnCount }, function (_, i) { return getColumnName(i); });
4229
- }
4230
-
4231
- // src/validation.ts
4232
- /**
4233
- * Custom error class for handling Markdown table generation errors.
4234
- */
4235
- var MarkdownTableError = /** @class */ (function (_super) {
4236
- __extends(MarkdownTableError, _super);
4237
- function MarkdownTableError(message) {
4238
- var _this = _super.call(this, message) || this;
4239
- _this.name = "MarkdownTableError";
4240
- Object.setPrototypeOf(_this, MarkdownTableError.prototype);
4241
- return _this;
4242
- }
4243
- return MarkdownTableError;
4244
- }(Error));
4245
- /**
4246
- * Validates that the input data is a non-empty two-dimensional array.
4247
- * @param inputData - The data to validate
4248
- * @throws {MarkdownTableError} If validation fails
4249
- */
4250
- function validateInputData(inputData) {
4251
- if (inputData === null || !Array.isArray(inputData)) {
4252
- throw new MarkdownTableError("The 'data' prop must be a two-dimensional array.");
4253
- }
4254
- if (inputData.length === 0) {
4255
- throw new MarkdownTableError("The 'data' array must contain at least one row.");
4256
- }
4257
- }
4258
-
4259
- // CSS styles
4260
- var LIGHT_THEME_CSS = "\ncode[class*=language-],pre[class*=language-]{color:#000;background:0 0;text-shadow:0 1px #fff;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection{text-shadow:none;background:#b3d4fc}code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection{text-shadow:none;background:#b3d4fc}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#f5f2f0}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}pre[class*=language-].line-numbers{position:relative;padding-left:2.4em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.5em;text-align:right}\n";
4261
- var DARK_THEME_CSS = "\ncode[class*=language-],pre[class*=language-]{color:#f8f8f2;background:0 0;text-shadow:0 1px rgba(0,0,0,.3);font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto;border-radius:.3em}:not(pre)>code[class*=language-],pre[class*=language-]{background:#282a36}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}pre[class*=language-].line-numbers{position:relative;padding-left:2.4em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.5em;text-align:right}\n";
4262
- var getTableData = function (inputData, hasHeader) {
4263
- return hasHeader
4264
- ? { inputDataHeader: inputData[0], inputDataBody: inputData.slice(1) }
4265
- : {
4266
- inputDataHeader: generateAlphabetHeaders(inputData[0].length).map(function (header) { return ({ content: header }); }),
4267
- inputDataBody: inputData,
4268
- };
4269
- };
4270
- var generateTableSyntax = function (inputData, hasHeader, columnAlignments, adjustColumnWidths, hasTabs, canReplaceNewlines, hasPadding) {
4271
- try {
4272
- validateInputData(inputData);
4273
- var _a = getTableData(inputData, hasHeader), inputDataHeader = _a.inputDataHeader, inputDataBody = _a.inputDataBody;
4274
- return generateMarkdownTableString({ inputDataHeader: inputDataHeader, inputDataBody: inputDataBody }, columnAlignments, adjustColumnWidths, hasTabs, canReplaceNewlines, hasPadding);
4275
- }
4276
- catch (error) {
4277
- if (error instanceof MarkdownTableError) {
4278
- return "Error: ".concat(error.message);
4279
- }
4280
- throw error;
4281
- }
4282
- };
4283
- var applySyntaxHighlighting = function (preElementRef, markdownTableSyntax) {
4284
- useEffect(function () {
4285
- var _a;
4286
- var codeElement = (_a = preElementRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("code");
4287
- if (codeElement && markdownTableSyntax) {
4288
- requestAnimationFrame(function () {
4289
- Prism$1.highlightElement(codeElement);
4290
- });
4291
- }
4292
- }, [markdownTableSyntax]);
4293
- };
4294
- var MarkdownTable = function (_a) {
4295
- var _b = _a.inputData, inputData = _b === void 0 ? null : _b, _c = _a.hasHeader, hasHeader = _c === void 0 ? true : _c, _d = _a.columnAlignments, columnAlignments = _d === void 0 ? [] : _d, _e = _a.isCompact, isCompact = _e === void 0 ? false : _e, _f = _a.hasTabs, hasTabs = _f === void 0 ? false : _f, _g = _a.hasPadding, hasPadding = _g === void 0 ? true : _g, _h = _a.convertLineBreaks, convertLineBreaks = _h === void 0 ? false : _h, className = _a.className, onGenerate = _a.onGenerate, _j = _a.theme, theme = _j === void 0 ? "light" : _j, preStyle = _a.preStyle, _k = _a.topPadding, topPadding = _k === void 0 ? 16 : _k, minWidth = _a.minWidth;
4296
- var adjustColumnWidths = !isCompact;
4297
- var preElementRef = useRef(null);
4298
- var markdownTableSyntax = useMemo(function () {
4299
- return generateTableSyntax(inputData, hasHeader, columnAlignments, adjustColumnWidths, hasTabs, convertLineBreaks, hasPadding);
4300
- }, [
4301
- inputData,
4302
- hasHeader,
4303
- columnAlignments,
4304
- isCompact,
4305
- hasTabs,
4306
- convertLineBreaks,
4307
- hasPadding,
4308
- ]);
4309
- useEffect(function () {
4310
- if (onGenerate) {
4311
- onGenerate(markdownTableSyntax);
4312
- }
4313
- }, [markdownTableSyntax, onGenerate]);
4314
- applySyntaxHighlighting(preElementRef, markdownTableSyntax);
4315
- return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs("style", { children: [theme === "light" ? LIGHT_THEME_CSS : DARK_THEME_CSS, "\n pre {\n position: relative;\n padding-top: ".concat(topPadding, "px !important;\n }\n pre::before {\n position: absolute;\n top: 8px;\n left: 12px;\n color: ").concat(theme === "light" ? "#666" : "#999", ";\n letter-spacing: 2px;\n font-size: 12px;\n }\n ")] }), jsxRuntimeExports.jsx("div", { id: "MarkdownTable", style: {
4316
- position: "relative",
4317
- isolation: "isolate",
4318
- display: "inline-block",
4319
- }, children: jsxRuntimeExports.jsx("pre", { ref: preElementRef, className: "".concat(className, " language-markdown line-numbers ").concat(theme === "dark" ? "dark-theme" : ""), style: __assign({ width: "fit-content", minWidth: minWidth ? "".concat(minWidth, "px") : "min-content", margin: 0 }, preStyle), children: jsxRuntimeExports.jsx("code", { className: "language-markdown", role: "code", children: markdownTableSyntax }) }) })] }));
4320
- };
4321
-
4322
- export { MarkdownTable };
4323
- //# sourceMappingURL=index.esm.js.map