react-markdown-table-ts 0.1.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.
@@ -0,0 +1,1718 @@
1
+ import require$$0, { useMemo, useEffect } from 'react';
2
+
3
+ var jsxRuntime = {exports: {}};
4
+
5
+ var reactJsxRuntime_production_min = {};
6
+
7
+ /**
8
+ * @license React
9
+ * react-jsx-runtime.production.min.js
10
+ *
11
+ * Copyright (c) Facebook, Inc. and its affiliates.
12
+ *
13
+ * This source code is licensed under the MIT license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ */
16
+
17
+ var hasRequiredReactJsxRuntime_production_min;
18
+
19
+ function requireReactJsxRuntime_production_min () {
20
+ if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
21
+ hasRequiredReactJsxRuntime_production_min = 1;
22
+ 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};
23
+ 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;
24
+ return reactJsxRuntime_production_min;
25
+ }
26
+
27
+ var reactJsxRuntime_development = {};
28
+
29
+ /**
30
+ * @license React
31
+ * react-jsx-runtime.development.js
32
+ *
33
+ * Copyright (c) Facebook, Inc. and its affiliates.
34
+ *
35
+ * This source code is licensed under the MIT license found in the
36
+ * LICENSE file in the root directory of this source tree.
37
+ */
38
+
39
+ var hasRequiredReactJsxRuntime_development;
40
+
41
+ function requireReactJsxRuntime_development () {
42
+ if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
43
+ hasRequiredReactJsxRuntime_development = 1;
44
+
45
+ if (process.env.NODE_ENV !== "production") {
46
+ (function() {
47
+
48
+ var React = require$$0;
49
+
50
+ // ATTENTION
51
+ // When adding new symbols to this file,
52
+ // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
53
+ // The Symbol used to tag the ReactElement-like types.
54
+ var REACT_ELEMENT_TYPE = Symbol.for('react.element');
55
+ var REACT_PORTAL_TYPE = Symbol.for('react.portal');
56
+ var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
57
+ var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
58
+ var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
59
+ var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
60
+ var REACT_CONTEXT_TYPE = Symbol.for('react.context');
61
+ var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
62
+ var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
63
+ var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
64
+ var REACT_MEMO_TYPE = Symbol.for('react.memo');
65
+ var REACT_LAZY_TYPE = Symbol.for('react.lazy');
66
+ var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
67
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
68
+ var FAUX_ITERATOR_SYMBOL = '@@iterator';
69
+ function getIteratorFn(maybeIterable) {
70
+ if (maybeIterable === null || typeof maybeIterable !== 'object') {
71
+ return null;
72
+ }
73
+
74
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
75
+
76
+ if (typeof maybeIterator === 'function') {
77
+ return maybeIterator;
78
+ }
79
+
80
+ return null;
81
+ }
82
+
83
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
84
+
85
+ function error(format) {
86
+ {
87
+ {
88
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
89
+ args[_key2 - 1] = arguments[_key2];
90
+ }
91
+
92
+ printWarning('error', format, args);
93
+ }
94
+ }
95
+ }
96
+
97
+ function printWarning(level, format, args) {
98
+ // When changing this logic, you might want to also
99
+ // update consoleWithStackDev.www.js as well.
100
+ {
101
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
102
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
103
+
104
+ if (stack !== '') {
105
+ format += '%s';
106
+ args = args.concat([stack]);
107
+ } // eslint-disable-next-line react-internal/safe-string-coercion
108
+
109
+
110
+ var argsWithFormat = args.map(function (item) {
111
+ return String(item);
112
+ }); // Careful: RN currently depends on this prefix
113
+
114
+ argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
115
+ // breaks IE9: https://github.com/facebook/react/issues/13610
116
+ // eslint-disable-next-line react-internal/no-production-logging
117
+
118
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
119
+ }
120
+ }
121
+
122
+ // -----------------------------------------------------------------------------
123
+
124
+ var enableScopeAPI = false; // Experimental Create Event Handle API.
125
+ var enableCacheElement = false;
126
+ var enableTransitionTracing = false; // No known bugs, but needs performance testing
127
+
128
+ var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
129
+ // stuff. Intended to enable React core members to more easily debug scheduling
130
+ // issues in DEV builds.
131
+
132
+ var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
133
+
134
+ var REACT_MODULE_REFERENCE;
135
+
136
+ {
137
+ REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
138
+ }
139
+
140
+ function isValidElementType(type) {
141
+ if (typeof type === 'string' || typeof type === 'function') {
142
+ return true;
143
+ } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
144
+
145
+
146
+ 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 ) {
147
+ return true;
148
+ }
149
+
150
+ if (typeof type === 'object' && type !== null) {
151
+ 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
152
+ // types supported by any Flight configuration anywhere since
153
+ // we don't know which Flight build this will end up being used
154
+ // with.
155
+ type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
156
+ return true;
157
+ }
158
+ }
159
+
160
+ return false;
161
+ }
162
+
163
+ function getWrappedName(outerType, innerType, wrapperName) {
164
+ var displayName = outerType.displayName;
165
+
166
+ if (displayName) {
167
+ return displayName;
168
+ }
169
+
170
+ var functionName = innerType.displayName || innerType.name || '';
171
+ return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
172
+ } // Keep in sync with react-reconciler/getComponentNameFromFiber
173
+
174
+
175
+ function getContextName(type) {
176
+ return type.displayName || 'Context';
177
+ } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
178
+
179
+
180
+ function getComponentNameFromType(type) {
181
+ if (type == null) {
182
+ // Host root, text node or just invalid type.
183
+ return null;
184
+ }
185
+
186
+ {
187
+ if (typeof type.tag === 'number') {
188
+ error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
189
+ }
190
+ }
191
+
192
+ if (typeof type === 'function') {
193
+ return type.displayName || type.name || null;
194
+ }
195
+
196
+ if (typeof type === 'string') {
197
+ return type;
198
+ }
199
+
200
+ switch (type) {
201
+ case REACT_FRAGMENT_TYPE:
202
+ return 'Fragment';
203
+
204
+ case REACT_PORTAL_TYPE:
205
+ return 'Portal';
206
+
207
+ case REACT_PROFILER_TYPE:
208
+ return 'Profiler';
209
+
210
+ case REACT_STRICT_MODE_TYPE:
211
+ return 'StrictMode';
212
+
213
+ case REACT_SUSPENSE_TYPE:
214
+ return 'Suspense';
215
+
216
+ case REACT_SUSPENSE_LIST_TYPE:
217
+ return 'SuspenseList';
218
+
219
+ }
220
+
221
+ if (typeof type === 'object') {
222
+ switch (type.$$typeof) {
223
+ case REACT_CONTEXT_TYPE:
224
+ var context = type;
225
+ return getContextName(context) + '.Consumer';
226
+
227
+ case REACT_PROVIDER_TYPE:
228
+ var provider = type;
229
+ return getContextName(provider._context) + '.Provider';
230
+
231
+ case REACT_FORWARD_REF_TYPE:
232
+ return getWrappedName(type, type.render, 'ForwardRef');
233
+
234
+ case REACT_MEMO_TYPE:
235
+ var outerName = type.displayName || null;
236
+
237
+ if (outerName !== null) {
238
+ return outerName;
239
+ }
240
+
241
+ return getComponentNameFromType(type.type) || 'Memo';
242
+
243
+ case REACT_LAZY_TYPE:
244
+ {
245
+ var lazyComponent = type;
246
+ var payload = lazyComponent._payload;
247
+ var init = lazyComponent._init;
248
+
249
+ try {
250
+ return getComponentNameFromType(init(payload));
251
+ } catch (x) {
252
+ return null;
253
+ }
254
+ }
255
+
256
+ // eslint-disable-next-line no-fallthrough
257
+ }
258
+ }
259
+
260
+ return null;
261
+ }
262
+
263
+ var assign = Object.assign;
264
+
265
+ // Helpers to patch console.logs to avoid logging during side-effect free
266
+ // replaying on render function. This currently only patches the object
267
+ // lazily which won't cover if the log function was extracted eagerly.
268
+ // We could also eagerly patch the method.
269
+ var disabledDepth = 0;
270
+ var prevLog;
271
+ var prevInfo;
272
+ var prevWarn;
273
+ var prevError;
274
+ var prevGroup;
275
+ var prevGroupCollapsed;
276
+ var prevGroupEnd;
277
+
278
+ function disabledLog() {}
279
+
280
+ disabledLog.__reactDisabledLog = true;
281
+ function disableLogs() {
282
+ {
283
+ if (disabledDepth === 0) {
284
+ /* eslint-disable react-internal/no-production-logging */
285
+ prevLog = console.log;
286
+ prevInfo = console.info;
287
+ prevWarn = console.warn;
288
+ prevError = console.error;
289
+ prevGroup = console.group;
290
+ prevGroupCollapsed = console.groupCollapsed;
291
+ prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
292
+
293
+ var props = {
294
+ configurable: true,
295
+ enumerable: true,
296
+ value: disabledLog,
297
+ writable: true
298
+ }; // $FlowFixMe Flow thinks console is immutable.
299
+
300
+ Object.defineProperties(console, {
301
+ info: props,
302
+ log: props,
303
+ warn: props,
304
+ error: props,
305
+ group: props,
306
+ groupCollapsed: props,
307
+ groupEnd: props
308
+ });
309
+ /* eslint-enable react-internal/no-production-logging */
310
+ }
311
+
312
+ disabledDepth++;
313
+ }
314
+ }
315
+ function reenableLogs() {
316
+ {
317
+ disabledDepth--;
318
+
319
+ if (disabledDepth === 0) {
320
+ /* eslint-disable react-internal/no-production-logging */
321
+ var props = {
322
+ configurable: true,
323
+ enumerable: true,
324
+ writable: true
325
+ }; // $FlowFixMe Flow thinks console is immutable.
326
+
327
+ Object.defineProperties(console, {
328
+ log: assign({}, props, {
329
+ value: prevLog
330
+ }),
331
+ info: assign({}, props, {
332
+ value: prevInfo
333
+ }),
334
+ warn: assign({}, props, {
335
+ value: prevWarn
336
+ }),
337
+ error: assign({}, props, {
338
+ value: prevError
339
+ }),
340
+ group: assign({}, props, {
341
+ value: prevGroup
342
+ }),
343
+ groupCollapsed: assign({}, props, {
344
+ value: prevGroupCollapsed
345
+ }),
346
+ groupEnd: assign({}, props, {
347
+ value: prevGroupEnd
348
+ })
349
+ });
350
+ /* eslint-enable react-internal/no-production-logging */
351
+ }
352
+
353
+ if (disabledDepth < 0) {
354
+ error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
355
+ }
356
+ }
357
+ }
358
+
359
+ var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
360
+ var prefix;
361
+ function describeBuiltInComponentFrame(name, source, ownerFn) {
362
+ {
363
+ if (prefix === undefined) {
364
+ // Extract the VM specific prefix used by each line.
365
+ try {
366
+ throw Error();
367
+ } catch (x) {
368
+ var match = x.stack.trim().match(/\n( *(at )?)/);
369
+ prefix = match && match[1] || '';
370
+ }
371
+ } // We use the prefix to ensure our stacks line up with native stack frames.
372
+
373
+
374
+ return '\n' + prefix + name;
375
+ }
376
+ }
377
+ var reentry = false;
378
+ var componentFrameCache;
379
+
380
+ {
381
+ var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
382
+ componentFrameCache = new PossiblyWeakMap();
383
+ }
384
+
385
+ function describeNativeComponentFrame(fn, construct) {
386
+ // If something asked for a stack inside a fake render, it should get ignored.
387
+ if ( !fn || reentry) {
388
+ return '';
389
+ }
390
+
391
+ {
392
+ var frame = componentFrameCache.get(fn);
393
+
394
+ if (frame !== undefined) {
395
+ return frame;
396
+ }
397
+ }
398
+
399
+ var control;
400
+ reentry = true;
401
+ var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
402
+
403
+ Error.prepareStackTrace = undefined;
404
+ var previousDispatcher;
405
+
406
+ {
407
+ previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
408
+ // for warnings.
409
+
410
+ ReactCurrentDispatcher.current = null;
411
+ disableLogs();
412
+ }
413
+
414
+ try {
415
+ // This should throw.
416
+ if (construct) {
417
+ // Something should be setting the props in the constructor.
418
+ var Fake = function () {
419
+ throw Error();
420
+ }; // $FlowFixMe
421
+
422
+
423
+ Object.defineProperty(Fake.prototype, 'props', {
424
+ set: function () {
425
+ // We use a throwing setter instead of frozen or non-writable props
426
+ // because that won't throw in a non-strict mode function.
427
+ throw Error();
428
+ }
429
+ });
430
+
431
+ if (typeof Reflect === 'object' && Reflect.construct) {
432
+ // We construct a different control for this case to include any extra
433
+ // frames added by the construct call.
434
+ try {
435
+ Reflect.construct(Fake, []);
436
+ } catch (x) {
437
+ control = x;
438
+ }
439
+
440
+ Reflect.construct(fn, [], Fake);
441
+ } else {
442
+ try {
443
+ Fake.call();
444
+ } catch (x) {
445
+ control = x;
446
+ }
447
+
448
+ fn.call(Fake.prototype);
449
+ }
450
+ } else {
451
+ try {
452
+ throw Error();
453
+ } catch (x) {
454
+ control = x;
455
+ }
456
+
457
+ fn();
458
+ }
459
+ } catch (sample) {
460
+ // This is inlined manually because closure doesn't do it for us.
461
+ if (sample && control && typeof sample.stack === 'string') {
462
+ // This extracts the first frame from the sample that isn't also in the control.
463
+ // Skipping one frame that we assume is the frame that calls the two.
464
+ var sampleLines = sample.stack.split('\n');
465
+ var controlLines = control.stack.split('\n');
466
+ var s = sampleLines.length - 1;
467
+ var c = controlLines.length - 1;
468
+
469
+ while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
470
+ // We expect at least one stack frame to be shared.
471
+ // Typically this will be the root most one. However, stack frames may be
472
+ // cut off due to maximum stack limits. In this case, one maybe cut off
473
+ // earlier than the other. We assume that the sample is longer or the same
474
+ // and there for cut off earlier. So we should find the root most frame in
475
+ // the sample somewhere in the control.
476
+ c--;
477
+ }
478
+
479
+ for (; s >= 1 && c >= 0; s--, c--) {
480
+ // Next we find the first one that isn't the same which should be the
481
+ // frame that called our sample function and the control.
482
+ if (sampleLines[s] !== controlLines[c]) {
483
+ // In V8, the first line is describing the message but other VMs don't.
484
+ // If we're about to return the first line, and the control is also on the same
485
+ // line, that's a pretty good indicator that our sample threw at same line as
486
+ // the control. I.e. before we entered the sample frame. So we ignore this result.
487
+ // This can happen if you passed a class to function component, or non-function.
488
+ if (s !== 1 || c !== 1) {
489
+ do {
490
+ s--;
491
+ c--; // We may still have similar intermediate frames from the construct call.
492
+ // The next one that isn't the same should be our match though.
493
+
494
+ if (c < 0 || sampleLines[s] !== controlLines[c]) {
495
+ // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
496
+ var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
497
+ // but we have a user-provided "displayName"
498
+ // splice it in to make the stack more readable.
499
+
500
+
501
+ if (fn.displayName && _frame.includes('<anonymous>')) {
502
+ _frame = _frame.replace('<anonymous>', fn.displayName);
503
+ }
504
+
505
+ {
506
+ if (typeof fn === 'function') {
507
+ componentFrameCache.set(fn, _frame);
508
+ }
509
+ } // Return the line we found.
510
+
511
+
512
+ return _frame;
513
+ }
514
+ } while (s >= 1 && c >= 0);
515
+ }
516
+
517
+ break;
518
+ }
519
+ }
520
+ }
521
+ } finally {
522
+ reentry = false;
523
+
524
+ {
525
+ ReactCurrentDispatcher.current = previousDispatcher;
526
+ reenableLogs();
527
+ }
528
+
529
+ Error.prepareStackTrace = previousPrepareStackTrace;
530
+ } // Fallback to just using the name if we couldn't make it throw.
531
+
532
+
533
+ var name = fn ? fn.displayName || fn.name : '';
534
+ var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
535
+
536
+ {
537
+ if (typeof fn === 'function') {
538
+ componentFrameCache.set(fn, syntheticFrame);
539
+ }
540
+ }
541
+
542
+ return syntheticFrame;
543
+ }
544
+ function describeFunctionComponentFrame(fn, source, ownerFn) {
545
+ {
546
+ return describeNativeComponentFrame(fn, false);
547
+ }
548
+ }
549
+
550
+ function shouldConstruct(Component) {
551
+ var prototype = Component.prototype;
552
+ return !!(prototype && prototype.isReactComponent);
553
+ }
554
+
555
+ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
556
+
557
+ if (type == null) {
558
+ return '';
559
+ }
560
+
561
+ if (typeof type === 'function') {
562
+ {
563
+ return describeNativeComponentFrame(type, shouldConstruct(type));
564
+ }
565
+ }
566
+
567
+ if (typeof type === 'string') {
568
+ return describeBuiltInComponentFrame(type);
569
+ }
570
+
571
+ switch (type) {
572
+ case REACT_SUSPENSE_TYPE:
573
+ return describeBuiltInComponentFrame('Suspense');
574
+
575
+ case REACT_SUSPENSE_LIST_TYPE:
576
+ return describeBuiltInComponentFrame('SuspenseList');
577
+ }
578
+
579
+ if (typeof type === 'object') {
580
+ switch (type.$$typeof) {
581
+ case REACT_FORWARD_REF_TYPE:
582
+ return describeFunctionComponentFrame(type.render);
583
+
584
+ case REACT_MEMO_TYPE:
585
+ // Memo may contain any component type so we recursively resolve it.
586
+ return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
587
+
588
+ case REACT_LAZY_TYPE:
589
+ {
590
+ var lazyComponent = type;
591
+ var payload = lazyComponent._payload;
592
+ var init = lazyComponent._init;
593
+
594
+ try {
595
+ // Lazy may contain any component type so we recursively resolve it.
596
+ return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
597
+ } catch (x) {}
598
+ }
599
+ }
600
+ }
601
+
602
+ return '';
603
+ }
604
+
605
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
606
+
607
+ var loggedTypeFailures = {};
608
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
609
+
610
+ function setCurrentlyValidatingElement(element) {
611
+ {
612
+ if (element) {
613
+ var owner = element._owner;
614
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
615
+ ReactDebugCurrentFrame.setExtraStackFrame(stack);
616
+ } else {
617
+ ReactDebugCurrentFrame.setExtraStackFrame(null);
618
+ }
619
+ }
620
+ }
621
+
622
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
623
+ {
624
+ // $FlowFixMe This is okay but Flow doesn't know it.
625
+ var has = Function.call.bind(hasOwnProperty);
626
+
627
+ for (var typeSpecName in typeSpecs) {
628
+ if (has(typeSpecs, typeSpecName)) {
629
+ var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
630
+ // fail the render phase where it didn't fail before. So we log it.
631
+ // After these have been cleaned up, we'll let them throw.
632
+
633
+ try {
634
+ // This is intentionally an invariant that gets caught. It's the same
635
+ // behavior as without this statement except with a better message.
636
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
637
+ // eslint-disable-next-line react-internal/prod-error-codes
638
+ 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`.');
639
+ err.name = 'Invariant Violation';
640
+ throw err;
641
+ }
642
+
643
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
644
+ } catch (ex) {
645
+ error$1 = ex;
646
+ }
647
+
648
+ if (error$1 && !(error$1 instanceof Error)) {
649
+ setCurrentlyValidatingElement(element);
650
+
651
+ 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);
652
+
653
+ setCurrentlyValidatingElement(null);
654
+ }
655
+
656
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
657
+ // Only monitor this failure once because there tends to be a lot of the
658
+ // same error.
659
+ loggedTypeFailures[error$1.message] = true;
660
+ setCurrentlyValidatingElement(element);
661
+
662
+ error('Failed %s type: %s', location, error$1.message);
663
+
664
+ setCurrentlyValidatingElement(null);
665
+ }
666
+ }
667
+ }
668
+ }
669
+ }
670
+
671
+ var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
672
+
673
+ function isArray(a) {
674
+ return isArrayImpl(a);
675
+ }
676
+
677
+ /*
678
+ * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
679
+ * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
680
+ *
681
+ * The functions in this module will throw an easier-to-understand,
682
+ * easier-to-debug exception with a clear errors message message explaining the
683
+ * problem. (Instead of a confusing exception thrown inside the implementation
684
+ * of the `value` object).
685
+ */
686
+ // $FlowFixMe only called in DEV, so void return is not possible.
687
+ function typeName(value) {
688
+ {
689
+ // toStringTag is needed for namespaced types like Temporal.Instant
690
+ var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
691
+ var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
692
+ return type;
693
+ }
694
+ } // $FlowFixMe only called in DEV, so void return is not possible.
695
+
696
+
697
+ function willCoercionThrow(value) {
698
+ {
699
+ try {
700
+ testStringCoercion(value);
701
+ return false;
702
+ } catch (e) {
703
+ return true;
704
+ }
705
+ }
706
+ }
707
+
708
+ function testStringCoercion(value) {
709
+ // If you ended up here by following an exception call stack, here's what's
710
+ // happened: you supplied an object or symbol value to React (as a prop, key,
711
+ // DOM attribute, CSS property, string ref, etc.) and when React tried to
712
+ // coerce it to a string using `'' + value`, an exception was thrown.
713
+ //
714
+ // The most common types that will cause this exception are `Symbol` instances
715
+ // and Temporal objects like `Temporal.Instant`. But any object that has a
716
+ // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
717
+ // exception. (Library authors do this to prevent users from using built-in
718
+ // numeric operators like `+` or comparison operators like `>=` because custom
719
+ // methods are needed to perform accurate arithmetic or comparison.)
720
+ //
721
+ // To fix the problem, coerce this object or symbol value to a string before
722
+ // passing it to React. The most reliable way is usually `String(value)`.
723
+ //
724
+ // To find which value is throwing, check the browser or debugger console.
725
+ // Before this exception was thrown, there should be `console.error` output
726
+ // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
727
+ // problem and how that type was used: key, atrribute, input value prop, etc.
728
+ // In most cases, this console output also shows the component and its
729
+ // ancestor components where the exception happened.
730
+ //
731
+ // eslint-disable-next-line react-internal/safe-string-coercion
732
+ return '' + value;
733
+ }
734
+ function checkKeyStringCoercion(value) {
735
+ {
736
+ if (willCoercionThrow(value)) {
737
+ error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
738
+
739
+ return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
740
+ }
741
+ }
742
+ }
743
+
744
+ var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
745
+ var RESERVED_PROPS = {
746
+ key: true,
747
+ ref: true,
748
+ __self: true,
749
+ __source: true
750
+ };
751
+ var specialPropKeyWarningShown;
752
+ var specialPropRefWarningShown;
753
+ var didWarnAboutStringRefs;
754
+
755
+ {
756
+ didWarnAboutStringRefs = {};
757
+ }
758
+
759
+ function hasValidRef(config) {
760
+ {
761
+ if (hasOwnProperty.call(config, 'ref')) {
762
+ var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
763
+
764
+ if (getter && getter.isReactWarning) {
765
+ return false;
766
+ }
767
+ }
768
+ }
769
+
770
+ return config.ref !== undefined;
771
+ }
772
+
773
+ function hasValidKey(config) {
774
+ {
775
+ if (hasOwnProperty.call(config, 'key')) {
776
+ var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
777
+
778
+ if (getter && getter.isReactWarning) {
779
+ return false;
780
+ }
781
+ }
782
+ }
783
+
784
+ return config.key !== undefined;
785
+ }
786
+
787
+ function warnIfStringRefCannotBeAutoConverted(config, self) {
788
+ {
789
+ if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
790
+ var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
791
+
792
+ if (!didWarnAboutStringRefs[componentName]) {
793
+ 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);
794
+
795
+ didWarnAboutStringRefs[componentName] = true;
796
+ }
797
+ }
798
+ }
799
+ }
800
+
801
+ function defineKeyPropWarningGetter(props, displayName) {
802
+ {
803
+ var warnAboutAccessingKey = function () {
804
+ if (!specialPropKeyWarningShown) {
805
+ specialPropKeyWarningShown = true;
806
+
807
+ 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);
808
+ }
809
+ };
810
+
811
+ warnAboutAccessingKey.isReactWarning = true;
812
+ Object.defineProperty(props, 'key', {
813
+ get: warnAboutAccessingKey,
814
+ configurable: true
815
+ });
816
+ }
817
+ }
818
+
819
+ function defineRefPropWarningGetter(props, displayName) {
820
+ {
821
+ var warnAboutAccessingRef = function () {
822
+ if (!specialPropRefWarningShown) {
823
+ specialPropRefWarningShown = true;
824
+
825
+ 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);
826
+ }
827
+ };
828
+
829
+ warnAboutAccessingRef.isReactWarning = true;
830
+ Object.defineProperty(props, 'ref', {
831
+ get: warnAboutAccessingRef,
832
+ configurable: true
833
+ });
834
+ }
835
+ }
836
+ /**
837
+ * Factory method to create a new React element. This no longer adheres to
838
+ * the class pattern, so do not use new to call it. Also, instanceof check
839
+ * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
840
+ * if something is a React Element.
841
+ *
842
+ * @param {*} type
843
+ * @param {*} props
844
+ * @param {*} key
845
+ * @param {string|object} ref
846
+ * @param {*} owner
847
+ * @param {*} self A *temporary* helper to detect places where `this` is
848
+ * different from the `owner` when React.createElement is called, so that we
849
+ * can warn. We want to get rid of owner and replace string `ref`s with arrow
850
+ * functions, and as long as `this` and owner are the same, there will be no
851
+ * change in behavior.
852
+ * @param {*} source An annotation object (added by a transpiler or otherwise)
853
+ * indicating filename, line number, and/or other information.
854
+ * @internal
855
+ */
856
+
857
+
858
+ var ReactElement = function (type, key, ref, self, source, owner, props) {
859
+ var element = {
860
+ // This tag allows us to uniquely identify this as a React Element
861
+ $$typeof: REACT_ELEMENT_TYPE,
862
+ // Built-in properties that belong on the element
863
+ type: type,
864
+ key: key,
865
+ ref: ref,
866
+ props: props,
867
+ // Record the component responsible for creating this element.
868
+ _owner: owner
869
+ };
870
+
871
+ {
872
+ // The validation flag is currently mutative. We put it on
873
+ // an external backing store so that we can freeze the whole object.
874
+ // This can be replaced with a WeakMap once they are implemented in
875
+ // commonly used development environments.
876
+ element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
877
+ // the validation flag non-enumerable (where possible, which should
878
+ // include every environment we run tests in), so the test framework
879
+ // ignores it.
880
+
881
+ Object.defineProperty(element._store, 'validated', {
882
+ configurable: false,
883
+ enumerable: false,
884
+ writable: true,
885
+ value: false
886
+ }); // self and source are DEV only properties.
887
+
888
+ Object.defineProperty(element, '_self', {
889
+ configurable: false,
890
+ enumerable: false,
891
+ writable: false,
892
+ value: self
893
+ }); // Two elements created in two different places should be considered
894
+ // equal for testing purposes and therefore we hide it from enumeration.
895
+
896
+ Object.defineProperty(element, '_source', {
897
+ configurable: false,
898
+ enumerable: false,
899
+ writable: false,
900
+ value: source
901
+ });
902
+
903
+ if (Object.freeze) {
904
+ Object.freeze(element.props);
905
+ Object.freeze(element);
906
+ }
907
+ }
908
+
909
+ return element;
910
+ };
911
+ /**
912
+ * https://github.com/reactjs/rfcs/pull/107
913
+ * @param {*} type
914
+ * @param {object} props
915
+ * @param {string} key
916
+ */
917
+
918
+ function jsxDEV(type, config, maybeKey, source, self) {
919
+ {
920
+ var propName; // Reserved names are extracted
921
+
922
+ var props = {};
923
+ var key = null;
924
+ var ref = null; // Currently, key can be spread in as a prop. This causes a potential
925
+ // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
926
+ // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
927
+ // but as an intermediary step, we will use jsxDEV for everything except
928
+ // <div {...props} key="Hi" />, because we aren't currently able to tell if
929
+ // key is explicitly declared to be undefined or not.
930
+
931
+ if (maybeKey !== undefined) {
932
+ {
933
+ checkKeyStringCoercion(maybeKey);
934
+ }
935
+
936
+ key = '' + maybeKey;
937
+ }
938
+
939
+ if (hasValidKey(config)) {
940
+ {
941
+ checkKeyStringCoercion(config.key);
942
+ }
943
+
944
+ key = '' + config.key;
945
+ }
946
+
947
+ if (hasValidRef(config)) {
948
+ ref = config.ref;
949
+ warnIfStringRefCannotBeAutoConverted(config, self);
950
+ } // Remaining properties are added to a new props object
951
+
952
+
953
+ for (propName in config) {
954
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
955
+ props[propName] = config[propName];
956
+ }
957
+ } // Resolve default props
958
+
959
+
960
+ if (type && type.defaultProps) {
961
+ var defaultProps = type.defaultProps;
962
+
963
+ for (propName in defaultProps) {
964
+ if (props[propName] === undefined) {
965
+ props[propName] = defaultProps[propName];
966
+ }
967
+ }
968
+ }
969
+
970
+ if (key || ref) {
971
+ var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
972
+
973
+ if (key) {
974
+ defineKeyPropWarningGetter(props, displayName);
975
+ }
976
+
977
+ if (ref) {
978
+ defineRefPropWarningGetter(props, displayName);
979
+ }
980
+ }
981
+
982
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
983
+ }
984
+ }
985
+
986
+ var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
987
+ var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
988
+
989
+ function setCurrentlyValidatingElement$1(element) {
990
+ {
991
+ if (element) {
992
+ var owner = element._owner;
993
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
994
+ ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
995
+ } else {
996
+ ReactDebugCurrentFrame$1.setExtraStackFrame(null);
997
+ }
998
+ }
999
+ }
1000
+
1001
+ var propTypesMisspellWarningShown;
1002
+
1003
+ {
1004
+ propTypesMisspellWarningShown = false;
1005
+ }
1006
+ /**
1007
+ * Verifies the object is a ReactElement.
1008
+ * See https://reactjs.org/docs/react-api.html#isvalidelement
1009
+ * @param {?object} object
1010
+ * @return {boolean} True if `object` is a ReactElement.
1011
+ * @final
1012
+ */
1013
+
1014
+
1015
+ function isValidElement(object) {
1016
+ {
1017
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1018
+ }
1019
+ }
1020
+
1021
+ function getDeclarationErrorAddendum() {
1022
+ {
1023
+ if (ReactCurrentOwner$1.current) {
1024
+ var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
1025
+
1026
+ if (name) {
1027
+ return '\n\nCheck the render method of `' + name + '`.';
1028
+ }
1029
+ }
1030
+
1031
+ return '';
1032
+ }
1033
+ }
1034
+
1035
+ function getSourceInfoErrorAddendum(source) {
1036
+ {
1037
+ if (source !== undefined) {
1038
+ var fileName = source.fileName.replace(/^.*[\\\/]/, '');
1039
+ var lineNumber = source.lineNumber;
1040
+ return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
1041
+ }
1042
+
1043
+ return '';
1044
+ }
1045
+ }
1046
+ /**
1047
+ * Warn if there's no key explicitly set on dynamic arrays of children or
1048
+ * object keys are not valid. This allows us to keep track of children between
1049
+ * updates.
1050
+ */
1051
+
1052
+
1053
+ var ownerHasKeyUseWarning = {};
1054
+
1055
+ function getCurrentComponentErrorInfo(parentType) {
1056
+ {
1057
+ var info = getDeclarationErrorAddendum();
1058
+
1059
+ if (!info) {
1060
+ var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1061
+
1062
+ if (parentName) {
1063
+ info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1064
+ }
1065
+ }
1066
+
1067
+ return info;
1068
+ }
1069
+ }
1070
+ /**
1071
+ * Warn if the element doesn't have an explicit key assigned to it.
1072
+ * This element is in an array. The array could grow and shrink or be
1073
+ * reordered. All children that haven't already been validated are required to
1074
+ * have a "key" property assigned to it. Error statuses are cached so a warning
1075
+ * will only be shown once.
1076
+ *
1077
+ * @internal
1078
+ * @param {ReactElement} element Element that requires a key.
1079
+ * @param {*} parentType element's parent's type.
1080
+ */
1081
+
1082
+
1083
+ function validateExplicitKey(element, parentType) {
1084
+ {
1085
+ if (!element._store || element._store.validated || element.key != null) {
1086
+ return;
1087
+ }
1088
+
1089
+ element._store.validated = true;
1090
+ var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1091
+
1092
+ if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1093
+ return;
1094
+ }
1095
+
1096
+ ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
1097
+ // property, it may be the creator of the child that's responsible for
1098
+ // assigning it a key.
1099
+
1100
+ var childOwner = '';
1101
+
1102
+ if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
1103
+ // Give the component that originally created this child.
1104
+ childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
1105
+ }
1106
+
1107
+ setCurrentlyValidatingElement$1(element);
1108
+
1109
+ 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);
1110
+
1111
+ setCurrentlyValidatingElement$1(null);
1112
+ }
1113
+ }
1114
+ /**
1115
+ * Ensure that every element either is passed in a static location, in an
1116
+ * array with an explicit keys property defined, or in an object literal
1117
+ * with valid key property.
1118
+ *
1119
+ * @internal
1120
+ * @param {ReactNode} node Statically passed child of any type.
1121
+ * @param {*} parentType node's parent's type.
1122
+ */
1123
+
1124
+
1125
+ function validateChildKeys(node, parentType) {
1126
+ {
1127
+ if (typeof node !== 'object') {
1128
+ return;
1129
+ }
1130
+
1131
+ if (isArray(node)) {
1132
+ for (var i = 0; i < node.length; i++) {
1133
+ var child = node[i];
1134
+
1135
+ if (isValidElement(child)) {
1136
+ validateExplicitKey(child, parentType);
1137
+ }
1138
+ }
1139
+ } else if (isValidElement(node)) {
1140
+ // This element was passed in a valid location.
1141
+ if (node._store) {
1142
+ node._store.validated = true;
1143
+ }
1144
+ } else if (node) {
1145
+ var iteratorFn = getIteratorFn(node);
1146
+
1147
+ if (typeof iteratorFn === 'function') {
1148
+ // Entry iterators used to provide implicit keys,
1149
+ // but now we print a separate warning for them later.
1150
+ if (iteratorFn !== node.entries) {
1151
+ var iterator = iteratorFn.call(node);
1152
+ var step;
1153
+
1154
+ while (!(step = iterator.next()).done) {
1155
+ if (isValidElement(step.value)) {
1156
+ validateExplicitKey(step.value, parentType);
1157
+ }
1158
+ }
1159
+ }
1160
+ }
1161
+ }
1162
+ }
1163
+ }
1164
+ /**
1165
+ * Given an element, validate that its props follow the propTypes definition,
1166
+ * provided by the type.
1167
+ *
1168
+ * @param {ReactElement} element
1169
+ */
1170
+
1171
+
1172
+ function validatePropTypes(element) {
1173
+ {
1174
+ var type = element.type;
1175
+
1176
+ if (type === null || type === undefined || typeof type === 'string') {
1177
+ return;
1178
+ }
1179
+
1180
+ var propTypes;
1181
+
1182
+ if (typeof type === 'function') {
1183
+ propTypes = type.propTypes;
1184
+ } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
1185
+ // Inner props are checked in the reconciler.
1186
+ type.$$typeof === REACT_MEMO_TYPE)) {
1187
+ propTypes = type.propTypes;
1188
+ } else {
1189
+ return;
1190
+ }
1191
+
1192
+ if (propTypes) {
1193
+ // Intentionally inside to avoid triggering lazy initializers:
1194
+ var name = getComponentNameFromType(type);
1195
+ checkPropTypes(propTypes, element.props, 'prop', name, element);
1196
+ } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1197
+ propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
1198
+
1199
+ var _name = getComponentNameFromType(type);
1200
+
1201
+ error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
1202
+ }
1203
+
1204
+ if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
1205
+ error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
1206
+ }
1207
+ }
1208
+ }
1209
+ /**
1210
+ * Given a fragment, validate that it can only be provided with fragment props
1211
+ * @param {ReactElement} fragment
1212
+ */
1213
+
1214
+
1215
+ function validateFragmentProps(fragment) {
1216
+ {
1217
+ var keys = Object.keys(fragment.props);
1218
+
1219
+ for (var i = 0; i < keys.length; i++) {
1220
+ var key = keys[i];
1221
+
1222
+ if (key !== 'children' && key !== 'key') {
1223
+ setCurrentlyValidatingElement$1(fragment);
1224
+
1225
+ error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1226
+
1227
+ setCurrentlyValidatingElement$1(null);
1228
+ break;
1229
+ }
1230
+ }
1231
+
1232
+ if (fragment.ref !== null) {
1233
+ setCurrentlyValidatingElement$1(fragment);
1234
+
1235
+ error('Invalid attribute `ref` supplied to `React.Fragment`.');
1236
+
1237
+ setCurrentlyValidatingElement$1(null);
1238
+ }
1239
+ }
1240
+ }
1241
+
1242
+ var didWarnAboutKeySpread = {};
1243
+ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
1244
+ {
1245
+ var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
1246
+ // succeed and there will likely be errors in render.
1247
+
1248
+ if (!validType) {
1249
+ var info = '';
1250
+
1251
+ if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1252
+ 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.";
1253
+ }
1254
+
1255
+ var sourceInfo = getSourceInfoErrorAddendum(source);
1256
+
1257
+ if (sourceInfo) {
1258
+ info += sourceInfo;
1259
+ } else {
1260
+ info += getDeclarationErrorAddendum();
1261
+ }
1262
+
1263
+ var typeString;
1264
+
1265
+ if (type === null) {
1266
+ typeString = 'null';
1267
+ } else if (isArray(type)) {
1268
+ typeString = 'array';
1269
+ } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
1270
+ typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
1271
+ info = ' Did you accidentally export a JSX literal instead of a component?';
1272
+ } else {
1273
+ typeString = typeof type;
1274
+ }
1275
+
1276
+ 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);
1277
+ }
1278
+
1279
+ var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
1280
+ // TODO: Drop this when these are no longer allowed as the type argument.
1281
+
1282
+ if (element == null) {
1283
+ return element;
1284
+ } // Skip key warning if the type isn't valid since our key validation logic
1285
+ // doesn't expect a non-string/function type and can throw confusing errors.
1286
+ // We don't want exception behavior to differ between dev and prod.
1287
+ // (Rendering will throw with a helpful message and as soon as the type is
1288
+ // fixed, the key warnings will appear.)
1289
+
1290
+
1291
+ if (validType) {
1292
+ var children = props.children;
1293
+
1294
+ if (children !== undefined) {
1295
+ if (isStaticChildren) {
1296
+ if (isArray(children)) {
1297
+ for (var i = 0; i < children.length; i++) {
1298
+ validateChildKeys(children[i], type);
1299
+ }
1300
+
1301
+ if (Object.freeze) {
1302
+ Object.freeze(children);
1303
+ }
1304
+ } else {
1305
+ 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.');
1306
+ }
1307
+ } else {
1308
+ validateChildKeys(children, type);
1309
+ }
1310
+ }
1311
+ }
1312
+
1313
+ {
1314
+ if (hasOwnProperty.call(props, 'key')) {
1315
+ var componentName = getComponentNameFromType(type);
1316
+ var keys = Object.keys(props).filter(function (k) {
1317
+ return k !== 'key';
1318
+ });
1319
+ var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
1320
+
1321
+ if (!didWarnAboutKeySpread[componentName + beforeExample]) {
1322
+ var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
1323
+
1324
+ 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);
1325
+
1326
+ didWarnAboutKeySpread[componentName + beforeExample] = true;
1327
+ }
1328
+ }
1329
+ }
1330
+
1331
+ if (type === REACT_FRAGMENT_TYPE) {
1332
+ validateFragmentProps(element);
1333
+ } else {
1334
+ validatePropTypes(element);
1335
+ }
1336
+
1337
+ return element;
1338
+ }
1339
+ } // These two functions exist to still get child warnings in dev
1340
+ // even with the prod transform. This means that jsxDEV is purely
1341
+ // opt-in behavior for better messages but that we won't stop
1342
+ // giving you warnings if you use production apis.
1343
+
1344
+ function jsxWithValidationStatic(type, props, key) {
1345
+ {
1346
+ return jsxWithValidation(type, props, key, true);
1347
+ }
1348
+ }
1349
+ function jsxWithValidationDynamic(type, props, key) {
1350
+ {
1351
+ return jsxWithValidation(type, props, key, false);
1352
+ }
1353
+ }
1354
+
1355
+ var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
1356
+ // for now we can ship identical prod functions
1357
+
1358
+ var jsxs = jsxWithValidationStatic ;
1359
+
1360
+ reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
1361
+ reactJsxRuntime_development.jsx = jsx;
1362
+ reactJsxRuntime_development.jsxs = jsxs;
1363
+ })();
1364
+ }
1365
+ return reactJsxRuntime_development;
1366
+ }
1367
+
1368
+ if (process.env.NODE_ENV === 'production') {
1369
+ jsxRuntime.exports = requireReactJsxRuntime_production_min();
1370
+ } else {
1371
+ jsxRuntime.exports = requireReactJsxRuntime_development();
1372
+ }
1373
+
1374
+ var jsxRuntimeExports = jsxRuntime.exports;
1375
+
1376
+ /******************************************************************************
1377
+ Copyright (c) Microsoft Corporation.
1378
+
1379
+ Permission to use, copy, modify, and/or distribute this software for any
1380
+ purpose with or without fee is hereby granted.
1381
+
1382
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1383
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1384
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1385
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1386
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1387
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1388
+ PERFORMANCE OF THIS SOFTWARE.
1389
+ ***************************************************************************** */
1390
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
1391
+
1392
+ var extendStatics = function(d, b) {
1393
+ extendStatics = Object.setPrototypeOf ||
1394
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
1395
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
1396
+ return extendStatics(d, b);
1397
+ };
1398
+
1399
+ function __extends(d, b) {
1400
+ if (typeof b !== "function" && b !== null)
1401
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
1402
+ extendStatics(d, b);
1403
+ function __() { this.constructor = d; }
1404
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1405
+ }
1406
+
1407
+ function __spreadArray(to, from, pack) {
1408
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
1409
+ if (ar || !(i in from)) {
1410
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
1411
+ ar[i] = from[i];
1412
+ }
1413
+ }
1414
+ return to.concat(ar || Array.prototype.slice.call(from));
1415
+ }
1416
+
1417
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
1418
+ var e = new Error(message);
1419
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1420
+ };
1421
+
1422
+ // src/utils.ts
1423
+ /**
1424
+ * Calculates the maximum width for each column based on the content.
1425
+ * @param allRows - All rows (header and body) of the table.
1426
+ * @param maxColumnCount - The maximum number of columns in the table.
1427
+ * @returns An array of maximum widths for each column.
1428
+ */
1429
+ function calculateColumnWidths(allRows, maxColumnCount) {
1430
+ var widths = new Array(maxColumnCount).fill(3); // Minimum width of 3 for each column.
1431
+ allRows.forEach(function (row) {
1432
+ var _a;
1433
+ for (var i = 0; i < maxColumnCount; i++) {
1434
+ var cell = (_a = row[i]) !== null && _a !== void 0 ? _a : '';
1435
+ widths[i] = Math.max(widths[i], cell.length);
1436
+ }
1437
+ });
1438
+ return widths;
1439
+ }
1440
+ /**
1441
+ * Replaces newline characters in a string with <br> tags.
1442
+ * @param cell - The cell content to process.
1443
+ * @returns The processed cell content with newlines replaced.
1444
+ */
1445
+ function replaceNewlinesInCell(cell) {
1446
+ return cell.replace(/\n/g, '<br>');
1447
+ }
1448
+ /**
1449
+ * Formats a single row into a Markdown-formatted string.
1450
+ * @param columnCount - The number of columns in the table.
1451
+ * @param row - The data of the current row.
1452
+ * @param columnAlignments - Alignment settings for each column.
1453
+ * @param columnWidths - Widths of each column.
1454
+ * @param useTabs - Flag to use tabs between columns.
1455
+ * @param replaceNewlines - Flag to replace newlines with <br> tags.
1456
+ * @returns The Markdown string for the row.
1457
+ */
1458
+ function formatMarkdownRow(columnCount, row, columnAlignments, columnWidths, useTabs, replaceNewlines) {
1459
+ var _a, _b;
1460
+ if (useTabs === void 0) { useTabs = false; }
1461
+ if (replaceNewlines === void 0) { replaceNewlines = false; }
1462
+ var defaultAlignment = 'left';
1463
+ var adjustedAlignments = columnAlignments.length < columnCount
1464
+ ? __spreadArray(__spreadArray([], columnAlignments, true), Array(columnCount - columnAlignments.length).fill(defaultAlignment), true) : columnAlignments;
1465
+ var markdownRow = '|';
1466
+ for (var i = 0; i < columnCount; i++) {
1467
+ var cell = (_a = row[i]) !== null && _a !== void 0 ? _a : '';
1468
+ if (replaceNewlines) {
1469
+ cell = replaceNewlinesInCell(cell);
1470
+ }
1471
+ var alignment = (_b = adjustedAlignments[i]) !== null && _b !== void 0 ? _b : defaultAlignment;
1472
+ var targetWidth = columnWidths ? columnWidths[i] : cell.length;
1473
+ if (alignment === 'right') {
1474
+ markdownRow += "".concat(useTabs ? '\t' : ' ').concat(cell.padStart(targetWidth)).concat(useTabs ? '\t' : ' ', "|");
1475
+ }
1476
+ else if (alignment === 'center') {
1477
+ var totalPadding = targetWidth - cell.length;
1478
+ var paddingLeft = Math.floor(totalPadding / 2);
1479
+ var paddingRight = totalPadding - paddingLeft;
1480
+ markdownRow += "".concat(useTabs ? '\t' : ' ').concat(' '.repeat(paddingLeft)).concat(cell).concat(' '.repeat(paddingRight)).concat(useTabs ? '\t' : ' ', "|");
1481
+ }
1482
+ else {
1483
+ // Left alignment or default
1484
+ markdownRow += "".concat(useTabs ? '\t' : ' ').concat(cell.padEnd(targetWidth)).concat(useTabs ? '\t' : ' ', "|");
1485
+ }
1486
+ }
1487
+ return markdownRow;
1488
+ }
1489
+ /**
1490
+ * Generates the alignment row for the Markdown table syntax.
1491
+ * @param columnCount - The number of columns in the table.
1492
+ * @param columnAlignments - Alignment settings for each column.
1493
+ * @param columnWidths - Widths of each column.
1494
+ * @param useTabs - Flag to use tabs between columns.
1495
+ * @returns The Markdown string for the alignment row.
1496
+ */
1497
+ function formatAlignmentRow(columnCount, columnAlignments, columnWidths, useTabs) {
1498
+ var _a;
1499
+ if (useTabs === void 0) { useTabs = false; }
1500
+ var defaultAlignment = 'left';
1501
+ var adjustedAlignments = columnAlignments.length < columnCount
1502
+ ? __spreadArray(__spreadArray([], columnAlignments, true), Array(columnCount - columnAlignments.length).fill(defaultAlignment), true) : columnAlignments;
1503
+ var alignmentRow = '|';
1504
+ for (var i = 0; i < columnCount; i++) {
1505
+ var alignment = (_a = adjustedAlignments[i]) !== null && _a !== void 0 ? _a : defaultAlignment;
1506
+ var targetWidth = columnWidths ? columnWidths[i] : 3;
1507
+ var alignIndicator = '';
1508
+ switch (alignment) {
1509
+ case 'left':
1510
+ alignIndicator = ":".concat('-'.repeat(targetWidth - 1));
1511
+ break;
1512
+ case 'center':
1513
+ alignIndicator = ":".concat('-'.repeat(targetWidth - 2), ":");
1514
+ break;
1515
+ case 'right':
1516
+ alignIndicator = "".concat('-'.repeat(targetWidth - 1), ":");
1517
+ break;
1518
+ default:
1519
+ alignIndicator = "".concat('-'.repeat(targetWidth));
1520
+ break;
1521
+ }
1522
+ alignmentRow += "".concat(useTabs ? '\t' : ' ').concat(alignIndicator).concat(useTabs ? '\t' : ' ', "|");
1523
+ }
1524
+ return alignmentRow;
1525
+ }
1526
+ /**
1527
+ * Generates a complete Markdown table string from the provided data.
1528
+ * @param tableData - The table data including headers and rows.
1529
+ * @param columnAlignments - Alignment settings for each column.
1530
+ * @param adjustColumnWidths - Flag to adjust column widths based on content.
1531
+ * @param useTabs - Flag to use tabs between columns.
1532
+ * @param replaceNewlines - Flag to replace newlines with <br> tags.
1533
+ * @returns The complete Markdown table string.
1534
+ */
1535
+ function generateMarkdownTableString(tableData, columnAlignments, adjustColumnWidths, useTabs, replaceNewlines) {
1536
+ if (adjustColumnWidths === void 0) { adjustColumnWidths = true; }
1537
+ if (useTabs === void 0) { useTabs = false; }
1538
+ if (replaceNewlines === void 0) { replaceNewlines = false; }
1539
+ var headerColumnCount = tableData.header.length;
1540
+ var bodyColumnCounts = tableData.rows.map(function (row) { return row.length; });
1541
+ var maxColumnCount = Math.max.apply(Math, __spreadArray([headerColumnCount], bodyColumnCounts, false));
1542
+ var columnWidths = adjustColumnWidths
1543
+ ? calculateColumnWidths(__spreadArray([tableData.header], tableData.rows, true), maxColumnCount)
1544
+ : undefined;
1545
+ var markdownHeaderRow = formatMarkdownRow(maxColumnCount, tableData.header, columnAlignments, columnWidths, useTabs, replaceNewlines);
1546
+ var markdownAlignmentRow = formatAlignmentRow(maxColumnCount, columnAlignments, columnWidths, useTabs);
1547
+ var markdownBodyRows = tableData.rows
1548
+ .map(function (row) {
1549
+ return formatMarkdownRow(maxColumnCount, row, columnAlignments, columnWidths, useTabs, replaceNewlines);
1550
+ })
1551
+ .join('\n');
1552
+ return "".concat(markdownHeaderRow, "\n").concat(markdownAlignmentRow, "\n").concat(markdownBodyRows).trimEnd();
1553
+ }
1554
+
1555
+ // src/errors.ts
1556
+ /**
1557
+ * Custom error class for handling Markdown table generation errors.
1558
+ */
1559
+ var MarkdownTableError = /** @class */ (function (_super) {
1560
+ __extends(MarkdownTableError, _super);
1561
+ function MarkdownTableError(message) {
1562
+ var _this = _super.call(this, message) || this;
1563
+ _this.name = 'MarkdownTableError';
1564
+ Object.setPrototypeOf(_this, MarkdownTableError.prototype);
1565
+ return _this;
1566
+ }
1567
+ return MarkdownTableError;
1568
+ }(Error));
1569
+
1570
+ // src/validation.ts
1571
+ /**
1572
+ * Validates the structure of the table data based on the `hasHeader` flag.
1573
+ * Throws an error if validation fails.
1574
+ * @param props - The props to validate.
1575
+ */
1576
+ function validateMarkdownTableProps(props) {
1577
+ var data = props.data, _a = props.hasHeader, hasHeader = _a === void 0 ? true : _a, columnAlignments = props.columnAlignments, _b = props.isCompact, isCompact = _b === void 0 ? false : _b, _c = props.hasTabs, hasTabs = _c === void 0 ? false : _c, _d = props.canReplaceNewlines, canReplaceNewlines = _d === void 0 ? false : _d;
1578
+ if (!data || !Array.isArray(data)) {
1579
+ throw new MarkdownTableError("The 'data' prop must be a non-empty two-dimensional array.");
1580
+ }
1581
+ if (data.length === 0) {
1582
+ throw new MarkdownTableError("The 'data' array must contain at least one row.");
1583
+ }
1584
+ // If hasHeader is true, ensure the first row exists and is valid
1585
+ if (hasHeader) {
1586
+ var header = data[0];
1587
+ if (!Array.isArray(header) || header.length === 0) {
1588
+ throw new MarkdownTableError("The first row of 'data' must be a non-empty array representing the header.");
1589
+ }
1590
+ // Validate each header cell is a string
1591
+ header.forEach(function (cell, index) {
1592
+ if (typeof cell !== 'string') {
1593
+ throw new MarkdownTableError("Header cell at index ".concat(index, " must be a string."));
1594
+ }
1595
+ });
1596
+ }
1597
+ // Validate each row
1598
+ data.forEach(function (row, rowIndex) {
1599
+ if (!Array.isArray(row)) {
1600
+ throw new MarkdownTableError("Row ".concat(rowIndex + 1, " in 'data' must be an array of strings."));
1601
+ }
1602
+ row.forEach(function (cell, cellIndex) {
1603
+ if (typeof cell !== 'string') {
1604
+ throw new MarkdownTableError("Cell at row ".concat(rowIndex + 1, ", column ").concat(cellIndex + 1, " must be a string."));
1605
+ }
1606
+ });
1607
+ });
1608
+ // Validate columnAlignments if provided
1609
+ if (columnAlignments) {
1610
+ if (!Array.isArray(columnAlignments)) {
1611
+ throw new MarkdownTableError("'columnAlignments' must be an array of alignment strings.");
1612
+ }
1613
+ var validAlignments_1 = ['left', 'center', 'right', 'none'];
1614
+ columnAlignments.forEach(function (alignment, index) {
1615
+ if (!validAlignments_1.includes(alignment)) {
1616
+ throw new MarkdownTableError("Invalid alignment '".concat(alignment, "' at index ").concat(index, ". Valid options are 'left', 'center', 'right', 'none'."));
1617
+ }
1618
+ });
1619
+ }
1620
+ // Validate isCompact
1621
+ if (typeof isCompact !== 'boolean') {
1622
+ throw new MarkdownTableError("'isCompact' must be a boolean.");
1623
+ }
1624
+ // Validate hasTabs
1625
+ if (typeof hasTabs !== 'boolean') {
1626
+ throw new MarkdownTableError("'hasTabs' must be a boolean.");
1627
+ }
1628
+ // Validate canReplaceNewlines
1629
+ if (typeof canReplaceNewlines !== 'boolean') {
1630
+ throw new MarkdownTableError("'canReplaceNewlines' must be a boolean.");
1631
+ }
1632
+ }
1633
+
1634
+ /**
1635
+ * React component that generates and displays Markdown table syntax.
1636
+ * @param props - The input parameters for table generation.
1637
+ * @returns A <pre> element containing the Markdown table syntax or an error message.
1638
+ */
1639
+ var MarkdownTable = function (_a) {
1640
+ var data = _a.data, _b = _a.hasHeader, hasHeader = _b === void 0 ? true : _b, _c = _a.columnAlignments, columnAlignments = _c === void 0 ? [] : _c, _d = _a.isCompact, isCompact = _d === void 0 ? false : _d, _e = _a.hasTabs, hasTabs = _e === void 0 ? false : _e, _f = _a.canReplaceNewlines, canReplaceNewlines = _f === void 0 ? false : _f, className = _a.className, onTableCreate = _a.onTableCreate;
1641
+ // Invert isCompact to get adjustColumnWidths
1642
+ var adjustColumnWidths = !isCompact;
1643
+ // Generate Markdown table
1644
+ var markdownSyntax = useMemo(function () {
1645
+ try {
1646
+ validateMarkdownTableProps({
1647
+ data: data,
1648
+ hasHeader: hasHeader,
1649
+ columnAlignments: columnAlignments,
1650
+ isCompact: isCompact,
1651
+ hasTabs: hasTabs,
1652
+ canReplaceNewlines: canReplaceNewlines,
1653
+ });
1654
+ // Determine header and rows based on hasHeader
1655
+ var tableData = hasHeader
1656
+ ? {
1657
+ header: data[0],
1658
+ rows: data.slice(1),
1659
+ }
1660
+ : {
1661
+ header: generateAlphabetHeaders(data[0].length),
1662
+ rows: data,
1663
+ };
1664
+ return generateMarkdownTableString(tableData, columnAlignments, adjustColumnWidths, hasTabs, canReplaceNewlines);
1665
+ }
1666
+ catch (error) {
1667
+ if (error instanceof MarkdownTableError) {
1668
+ return "Error: ".concat(error.message);
1669
+ }
1670
+ else {
1671
+ throw error;
1672
+ }
1673
+ }
1674
+ }, [
1675
+ data,
1676
+ hasHeader,
1677
+ columnAlignments,
1678
+ isCompact,
1679
+ hasTabs,
1680
+ canReplaceNewlines,
1681
+ ]);
1682
+ useEffect(function () {
1683
+ if (onTableCreate) {
1684
+ onTableCreate(markdownSyntax);
1685
+ }
1686
+ }, [markdownSyntax, onTableCreate]);
1687
+ return jsxRuntimeExports.jsx("pre", { className: className, children: markdownSyntax });
1688
+ };
1689
+ /**
1690
+ * Generates alphabetical headers (A, B, C, ...) based on the number of columns.
1691
+ * @param columnCount - The number of columns.
1692
+ * @returns An array of alphabetical headers.
1693
+ */
1694
+ function generateAlphabetHeaders(columnCount) {
1695
+ var headers = [];
1696
+ for (var i = 0; i < columnCount; i++) {
1697
+ headers.push(getColumnName(i));
1698
+ }
1699
+ return headers;
1700
+ }
1701
+ /**
1702
+ * Converts a zero-based column index to its corresponding alphabetical representation.
1703
+ * For example, 0 -> 'A', 1 -> 'B', ..., 25 -> 'Z', 26 -> 'AA', etc.
1704
+ * @param index - The zero-based column index.
1705
+ * @returns The alphabetical column name.
1706
+ */
1707
+ function getColumnName(index) {
1708
+ var name = '';
1709
+ var currentIndex = index;
1710
+ while (currentIndex >= 0) {
1711
+ name = String.fromCharCode((currentIndex % 26) + 65) + name;
1712
+ currentIndex = Math.floor(currentIndex / 26) - 1;
1713
+ }
1714
+ return name;
1715
+ }
1716
+
1717
+ export { MarkdownTable, MarkdownTableError };
1718
+ //# sourceMappingURL=index.esm.js.map