UNPKG

147 kBJavaScriptView Raw
1/** @license React v17.0.1
2 * react-dom-server.browser.development.js
3 *
4 * Copyright (c) Facebook, Inc. and its affiliates.
5 *
6 * This source code is licensed under the MIT license found in the
7 * LICENSE file in the root directory of this source tree.
8 */
9(function (global, factory) {
10 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
11 typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
12 (global = global || self, factory(global.ReactDOMServer = {}, global.React));
13}(this, (function (exports, React) { 'use strict';
14
15 // Do not require this module directly! Use normal `invariant` calls with
16 // template literal strings. The messages will be replaced with error codes
17 // during build.
18 function formatProdErrorMessage(code) {
19 var url = 'https://reactjs.org/docs/error-decoder.html?invariant=' + code;
20
21 for (var i = 1; i < arguments.length; i++) {
22 url += '&args[]=' + encodeURIComponent(arguments[i]);
23 }
24
25 return "Minified React error #" + code + "; visit " + url + " for the full message or " + 'use the non-minified dev environment for full errors and additional ' + 'helpful warnings.';
26 }
27
28 // TODO: this is special because it gets imported during build.
29 var ReactVersion = '17.0.1';
30
31 var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
32
33 // by calls to these methods by a Babel plugin.
34 //
35 // In PROD (or in packages without access to React internals),
36 // they are left as they are instead.
37
38 function warn(format) {
39 {
40 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
41 args[_key - 1] = arguments[_key];
42 }
43
44 printWarning('warn', format, args);
45 }
46 }
47 function error(format) {
48 {
49 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
50 args[_key2 - 1] = arguments[_key2];
51 }
52
53 printWarning('error', format, args);
54 }
55 }
56
57 function printWarning(level, format, args) {
58 // When changing this logic, you might want to also
59 // update consoleWithStackDev.www.js as well.
60 {
61 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
62 var stack = ReactDebugCurrentFrame.getStackAddendum();
63
64 if (stack !== '') {
65 format += '%s';
66 args = args.concat([stack]);
67 }
68
69 var argsWithFormat = args.map(function (item) {
70 return '' + item;
71 }); // Careful: RN currently depends on this prefix
72
73 argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
74 // breaks IE9: https://github.com/facebook/react/issues/13610
75 // eslint-disable-next-line react-internal/no-production-logging
76
77 Function.prototype.apply.call(console[level], console, argsWithFormat);
78 }
79 }
80
81 var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
82 var _assign = ReactInternals.assign;
83
84 // ATTENTION
85 // When adding new symbols to this file,
86 // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
87 // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
88 // nor polyfill, then a plain number is used for performance.
89 var REACT_ELEMENT_TYPE = 0xeac7;
90 var REACT_PORTAL_TYPE = 0xeaca;
91 var REACT_FRAGMENT_TYPE = 0xeacb;
92 var REACT_STRICT_MODE_TYPE = 0xeacc;
93 var REACT_PROFILER_TYPE = 0xead2;
94 var REACT_PROVIDER_TYPE = 0xeacd;
95 var REACT_CONTEXT_TYPE = 0xeace;
96 var REACT_FORWARD_REF_TYPE = 0xead0;
97 var REACT_SUSPENSE_TYPE = 0xead1;
98 var REACT_SUSPENSE_LIST_TYPE = 0xead8;
99 var REACT_MEMO_TYPE = 0xead3;
100 var REACT_LAZY_TYPE = 0xead4;
101 var REACT_BLOCK_TYPE = 0xead9;
102 var REACT_SERVER_BLOCK_TYPE = 0xeada;
103 var REACT_FUNDAMENTAL_TYPE = 0xead5;
104 var REACT_SCOPE_TYPE = 0xead7;
105 var REACT_OPAQUE_ID_TYPE = 0xeae0;
106 var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
107 var REACT_OFFSCREEN_TYPE = 0xeae2;
108 var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
109
110 if (typeof Symbol === 'function' && Symbol.for) {
111 var symbolFor = Symbol.for;
112 REACT_ELEMENT_TYPE = symbolFor('react.element');
113 REACT_PORTAL_TYPE = symbolFor('react.portal');
114 REACT_FRAGMENT_TYPE = symbolFor('react.fragment');
115 REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
116 REACT_PROFILER_TYPE = symbolFor('react.profiler');
117 REACT_PROVIDER_TYPE = symbolFor('react.provider');
118 REACT_CONTEXT_TYPE = symbolFor('react.context');
119 REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
120 REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
121 REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
122 REACT_MEMO_TYPE = symbolFor('react.memo');
123 REACT_LAZY_TYPE = symbolFor('react.lazy');
124 REACT_BLOCK_TYPE = symbolFor('react.block');
125 REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
126 REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
127 REACT_SCOPE_TYPE = symbolFor('react.scope');
128 REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
129 REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
130 REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');
131 REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
132 }
133
134 function getWrappedName(outerType, innerType, wrapperName) {
135 var functionName = innerType.displayName || innerType.name || '';
136 return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
137 }
138
139 function getContextName(type) {
140 return type.displayName || 'Context';
141 }
142
143 function getComponentName(type) {
144 if (type == null) {
145 // Host root, text node or just invalid type.
146 return null;
147 }
148
149 {
150 if (typeof type.tag === 'number') {
151 error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
152 }
153 }
154
155 if (typeof type === 'function') {
156 return type.displayName || type.name || null;
157 }
158
159 if (typeof type === 'string') {
160 return type;
161 }
162
163 switch (type) {
164 case REACT_FRAGMENT_TYPE:
165 return 'Fragment';
166
167 case REACT_PORTAL_TYPE:
168 return 'Portal';
169
170 case REACT_PROFILER_TYPE:
171 return 'Profiler';
172
173 case REACT_STRICT_MODE_TYPE:
174 return 'StrictMode';
175
176 case REACT_SUSPENSE_TYPE:
177 return 'Suspense';
178
179 case REACT_SUSPENSE_LIST_TYPE:
180 return 'SuspenseList';
181 }
182
183 if (typeof type === 'object') {
184 switch (type.$$typeof) {
185 case REACT_CONTEXT_TYPE:
186 var context = type;
187 return getContextName(context) + '.Consumer';
188
189 case REACT_PROVIDER_TYPE:
190 var provider = type;
191 return getContextName(provider._context) + '.Provider';
192
193 case REACT_FORWARD_REF_TYPE:
194 return getWrappedName(type, type.render, 'ForwardRef');
195
196 case REACT_MEMO_TYPE:
197 return getComponentName(type.type);
198
199 case REACT_BLOCK_TYPE:
200 return getComponentName(type._render);
201
202 case REACT_LAZY_TYPE:
203 {
204 var lazyComponent = type;
205 var payload = lazyComponent._payload;
206 var init = lazyComponent._init;
207
208 try {
209 return getComponentName(init(payload));
210 } catch (x) {
211 return null;
212 }
213 }
214 }
215 }
216
217 return null;
218 }
219
220 // Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
221
222 var enableSuspenseServerRenderer = false;
223
224 // Helpers to patch console.logs to avoid logging during side-effect free
225 // replaying on render function. This currently only patches the object
226 // lazily which won't cover if the log function was extracted eagerly.
227 // We could also eagerly patch the method.
228 var disabledDepth = 0;
229 var prevLog;
230 var prevInfo;
231 var prevWarn;
232 var prevError;
233 var prevGroup;
234 var prevGroupCollapsed;
235 var prevGroupEnd;
236
237 function disabledLog() {}
238
239 disabledLog.__reactDisabledLog = true;
240 function disableLogs() {
241 {
242 if (disabledDepth === 0) {
243 /* eslint-disable react-internal/no-production-logging */
244 prevLog = console.log;
245 prevInfo = console.info;
246 prevWarn = console.warn;
247 prevError = console.error;
248 prevGroup = console.group;
249 prevGroupCollapsed = console.groupCollapsed;
250 prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
251
252 var props = {
253 configurable: true,
254 enumerable: true,
255 value: disabledLog,
256 writable: true
257 }; // $FlowFixMe Flow thinks console is immutable.
258
259 Object.defineProperties(console, {
260 info: props,
261 log: props,
262 warn: props,
263 error: props,
264 group: props,
265 groupCollapsed: props,
266 groupEnd: props
267 });
268 /* eslint-enable react-internal/no-production-logging */
269 }
270
271 disabledDepth++;
272 }
273 }
274 function reenableLogs() {
275 {
276 disabledDepth--;
277
278 if (disabledDepth === 0) {
279 /* eslint-disable react-internal/no-production-logging */
280 var props = {
281 configurable: true,
282 enumerable: true,
283 writable: true
284 }; // $FlowFixMe Flow thinks console is immutable.
285
286 Object.defineProperties(console, {
287 log: _assign({}, props, {
288 value: prevLog
289 }),
290 info: _assign({}, props, {
291 value: prevInfo
292 }),
293 warn: _assign({}, props, {
294 value: prevWarn
295 }),
296 error: _assign({}, props, {
297 value: prevError
298 }),
299 group: _assign({}, props, {
300 value: prevGroup
301 }),
302 groupCollapsed: _assign({}, props, {
303 value: prevGroupCollapsed
304 }),
305 groupEnd: _assign({}, props, {
306 value: prevGroupEnd
307 })
308 });
309 /* eslint-enable react-internal/no-production-logging */
310 }
311
312 if (disabledDepth < 0) {
313 error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
314 }
315 }
316 }
317
318 var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
319 var prefix;
320 function describeBuiltInComponentFrame(name, source, ownerFn) {
321 {
322 if (prefix === undefined) {
323 // Extract the VM specific prefix used by each line.
324 try {
325 throw Error();
326 } catch (x) {
327 var match = x.stack.trim().match(/\n( *(at )?)/);
328 prefix = match && match[1] || '';
329 }
330 } // We use the prefix to ensure our stacks line up with native stack frames.
331
332
333 return '\n' + prefix + name;
334 }
335 }
336 var reentry = false;
337 var componentFrameCache;
338
339 {
340 var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
341 componentFrameCache = new PossiblyWeakMap();
342 }
343
344 function describeNativeComponentFrame(fn, construct) {
345 // If something asked for a stack inside a fake render, it should get ignored.
346 if (!fn || reentry) {
347 return '';
348 }
349
350 {
351 var frame = componentFrameCache.get(fn);
352
353 if (frame !== undefined) {
354 return frame;
355 }
356 }
357
358 var control;
359 reentry = true;
360 var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
361
362 Error.prepareStackTrace = undefined;
363 var previousDispatcher;
364
365 {
366 previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
367 // for warnings.
368
369 ReactCurrentDispatcher.current = null;
370 disableLogs();
371 }
372
373 try {
374 // This should throw.
375 if (construct) {
376 // Something should be setting the props in the constructor.
377 var Fake = function () {
378 throw Error();
379 }; // $FlowFixMe
380
381
382 Object.defineProperty(Fake.prototype, 'props', {
383 set: function () {
384 // We use a throwing setter instead of frozen or non-writable props
385 // because that won't throw in a non-strict mode function.
386 throw Error();
387 }
388 });
389
390 if (typeof Reflect === 'object' && Reflect.construct) {
391 // We construct a different control for this case to include any extra
392 // frames added by the construct call.
393 try {
394 Reflect.construct(Fake, []);
395 } catch (x) {
396 control = x;
397 }
398
399 Reflect.construct(fn, [], Fake);
400 } else {
401 try {
402 Fake.call();
403 } catch (x) {
404 control = x;
405 }
406
407 fn.call(Fake.prototype);
408 }
409 } else {
410 try {
411 throw Error();
412 } catch (x) {
413 control = x;
414 }
415
416 fn();
417 }
418 } catch (sample) {
419 // This is inlined manually because closure doesn't do it for us.
420 if (sample && control && typeof sample.stack === 'string') {
421 // This extracts the first frame from the sample that isn't also in the control.
422 // Skipping one frame that we assume is the frame that calls the two.
423 var sampleLines = sample.stack.split('\n');
424 var controlLines = control.stack.split('\n');
425 var s = sampleLines.length - 1;
426 var c = controlLines.length - 1;
427
428 while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
429 // We expect at least one stack frame to be shared.
430 // Typically this will be the root most one. However, stack frames may be
431 // cut off due to maximum stack limits. In this case, one maybe cut off
432 // earlier than the other. We assume that the sample is longer or the same
433 // and there for cut off earlier. So we should find the root most frame in
434 // the sample somewhere in the control.
435 c--;
436 }
437
438 for (; s >= 1 && c >= 0; s--, c--) {
439 // Next we find the first one that isn't the same which should be the
440 // frame that called our sample function and the control.
441 if (sampleLines[s] !== controlLines[c]) {
442 // In V8, the first line is describing the message but other VMs don't.
443 // If we're about to return the first line, and the control is also on the same
444 // line, that's a pretty good indicator that our sample threw at same line as
445 // the control. I.e. before we entered the sample frame. So we ignore this result.
446 // This can happen if you passed a class to function component, or non-function.
447 if (s !== 1 || c !== 1) {
448 do {
449 s--;
450 c--; // We may still have similar intermediate frames from the construct call.
451 // The next one that isn't the same should be our match though.
452
453 if (c < 0 || sampleLines[s] !== controlLines[c]) {
454 // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
455 var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
456
457 {
458 if (typeof fn === 'function') {
459 componentFrameCache.set(fn, _frame);
460 }
461 } // Return the line we found.
462
463
464 return _frame;
465 }
466 } while (s >= 1 && c >= 0);
467 }
468
469 break;
470 }
471 }
472 }
473 } finally {
474 reentry = false;
475
476 {
477 ReactCurrentDispatcher.current = previousDispatcher;
478 reenableLogs();
479 }
480
481 Error.prepareStackTrace = previousPrepareStackTrace;
482 } // Fallback to just using the name if we couldn't make it throw.
483
484
485 var name = fn ? fn.displayName || fn.name : '';
486 var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
487
488 {
489 if (typeof fn === 'function') {
490 componentFrameCache.set(fn, syntheticFrame);
491 }
492 }
493
494 return syntheticFrame;
495 }
496 function describeFunctionComponentFrame(fn, source, ownerFn) {
497 {
498 return describeNativeComponentFrame(fn, false);
499 }
500 }
501
502 function shouldConstruct(Component) {
503 var prototype = Component.prototype;
504 return !!(prototype && prototype.isReactComponent);
505 }
506
507 function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
508
509 if (type == null) {
510 return '';
511 }
512
513 if (typeof type === 'function') {
514 {
515 return describeNativeComponentFrame(type, shouldConstruct(type));
516 }
517 }
518
519 if (typeof type === 'string') {
520 return describeBuiltInComponentFrame(type);
521 }
522
523 switch (type) {
524 case REACT_SUSPENSE_TYPE:
525 return describeBuiltInComponentFrame('Suspense');
526
527 case REACT_SUSPENSE_LIST_TYPE:
528 return describeBuiltInComponentFrame('SuspenseList');
529 }
530
531 if (typeof type === 'object') {
532 switch (type.$$typeof) {
533 case REACT_FORWARD_REF_TYPE:
534 return describeFunctionComponentFrame(type.render);
535
536 case REACT_MEMO_TYPE:
537 // Memo may contain any component type so we recursively resolve it.
538 return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
539
540 case REACT_BLOCK_TYPE:
541 return describeFunctionComponentFrame(type._render);
542
543 case REACT_LAZY_TYPE:
544 {
545 var lazyComponent = type;
546 var payload = lazyComponent._payload;
547 var init = lazyComponent._init;
548
549 try {
550 // Lazy may contain any component type so we recursively resolve it.
551 return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
552 } catch (x) {}
553 }
554 }
555 }
556
557 return '';
558 }
559
560 var loggedTypeFailures = {};
561 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
562
563 function setCurrentlyValidatingElement(element) {
564 {
565 if (element) {
566 var owner = element._owner;
567 var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
568 ReactDebugCurrentFrame.setExtraStackFrame(stack);
569 } else {
570 ReactDebugCurrentFrame.setExtraStackFrame(null);
571 }
572 }
573 }
574
575 function checkPropTypes(typeSpecs, values, location, componentName, element) {
576 {
577 // $FlowFixMe This is okay but Flow doesn't know it.
578 var has = Function.call.bind(Object.prototype.hasOwnProperty);
579
580 for (var typeSpecName in typeSpecs) {
581 if (has(typeSpecs, typeSpecName)) {
582 var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
583 // fail the render phase where it didn't fail before. So we log it.
584 // After these have been cleaned up, we'll let them throw.
585
586 try {
587 // This is intentionally an invariant that gets caught. It's the same
588 // behavior as without this statement except with a better message.
589 if (typeof typeSpecs[typeSpecName] !== 'function') {
590 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`.');
591 err.name = 'Invariant Violation';
592 throw err;
593 }
594
595 error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
596 } catch (ex) {
597 error$1 = ex;
598 }
599
600 if (error$1 && !(error$1 instanceof Error)) {
601 setCurrentlyValidatingElement(element);
602
603 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);
604
605 setCurrentlyValidatingElement(null);
606 }
607
608 if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
609 // Only monitor this failure once because there tends to be a lot of the
610 // same error.
611 loggedTypeFailures[error$1.message] = true;
612 setCurrentlyValidatingElement(element);
613
614 error('Failed %s type: %s', location, error$1.message);
615
616 setCurrentlyValidatingElement(null);
617 }
618 }
619 }
620 }
621 }
622
623 var didWarnAboutInvalidateContextType;
624
625 {
626 didWarnAboutInvalidateContextType = new Set();
627 }
628
629 var emptyObject = {};
630
631 {
632 Object.freeze(emptyObject);
633 }
634
635 function maskContext(type, context) {
636 var contextTypes = type.contextTypes;
637
638 if (!contextTypes) {
639 return emptyObject;
640 }
641
642 var maskedContext = {};
643
644 for (var contextName in contextTypes) {
645 maskedContext[contextName] = context[contextName];
646 }
647
648 return maskedContext;
649 }
650
651 function checkContextTypes(typeSpecs, values, location) {
652 {
653 checkPropTypes(typeSpecs, values, location, 'Component');
654 }
655 }
656
657 function validateContextBounds(context, threadID) {
658 // If we don't have enough slots in this context to store this threadID,
659 // fill it in without leaving any holes to ensure that the VM optimizes
660 // this as non-holey index properties.
661 // (Note: If `react` package is < 16.6, _threadCount is undefined.)
662 for (var i = context._threadCount | 0; i <= threadID; i++) {
663 // We assume that this is the same as the defaultValue which might not be
664 // true if we're rendering inside a secondary renderer but they are
665 // secondary because these use cases are very rare.
666 context[i] = context._currentValue2;
667 context._threadCount = i + 1;
668 }
669 }
670 function processContext(type, context, threadID, isClass) {
671 if (isClass) {
672 var contextType = type.contextType;
673
674 {
675 if ('contextType' in type) {
676 var isValid = // Allow null for conditional declaration
677 contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a <Context.Consumer>
678
679 if (!isValid && !didWarnAboutInvalidateContextType.has(type)) {
680 didWarnAboutInvalidateContextType.add(type);
681 var addendum = '';
682
683 if (contextType === undefined) {
684 addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.';
685 } else if (typeof contextType !== 'object') {
686 addendum = ' However, it is set to a ' + typeof contextType + '.';
687 } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) {
688 addendum = ' Did you accidentally pass the Context.Provider instead?';
689 } else if (contextType._context !== undefined) {
690 // <Context.Consumer>
691 addendum = ' Did you accidentally pass the Context.Consumer instead?';
692 } else {
693 addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.';
694 }
695
696 error('%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentName(type) || 'Component', addendum);
697 }
698 }
699 }
700
701 if (typeof contextType === 'object' && contextType !== null) {
702 validateContextBounds(contextType, threadID);
703 return contextType[threadID];
704 }
705
706 {
707 var maskedContext = maskContext(type, context);
708
709 {
710 if (type.contextTypes) {
711 checkContextTypes(type.contextTypes, maskedContext, 'context');
712 }
713 }
714
715 return maskedContext;
716 }
717 } else {
718 {
719 var _maskedContext = maskContext(type, context);
720
721 {
722 if (type.contextTypes) {
723 checkContextTypes(type.contextTypes, _maskedContext, 'context');
724 }
725 }
726
727 return _maskedContext;
728 }
729 }
730 }
731
732 var nextAvailableThreadIDs = new Uint16Array(16);
733
734 for (var i = 0; i < 15; i++) {
735 nextAvailableThreadIDs[i] = i + 1;
736 }
737
738 nextAvailableThreadIDs[15] = 0;
739
740 function growThreadCountAndReturnNextAvailable() {
741 var oldArray = nextAvailableThreadIDs;
742 var oldSize = oldArray.length;
743 var newSize = oldSize * 2;
744
745 if (!(newSize <= 0x10000)) {
746 {
747 throw Error( "Maximum number of concurrent React renderers exceeded. This can happen if you are not properly destroying the Readable provided by React. Ensure that you call .destroy() on it if you no longer want to read from it, and did not read to the end. If you use .pipe() this should be automatic." );
748 }
749 }
750
751 var newArray = new Uint16Array(newSize);
752 newArray.set(oldArray);
753 nextAvailableThreadIDs = newArray;
754 nextAvailableThreadIDs[0] = oldSize + 1;
755
756 for (var _i = oldSize; _i < newSize - 1; _i++) {
757 nextAvailableThreadIDs[_i] = _i + 1;
758 }
759
760 nextAvailableThreadIDs[newSize - 1] = 0;
761 return oldSize;
762 }
763
764 function allocThreadID() {
765 var nextID = nextAvailableThreadIDs[0];
766
767 if (nextID === 0) {
768 return growThreadCountAndReturnNextAvailable();
769 }
770
771 nextAvailableThreadIDs[0] = nextAvailableThreadIDs[nextID];
772 return nextID;
773 }
774 function freeThreadID(id) {
775 nextAvailableThreadIDs[id] = nextAvailableThreadIDs[0];
776 nextAvailableThreadIDs[0] = id;
777 }
778
779 // A reserved attribute.
780 // It is handled by React separately and shouldn't be written to the DOM.
781 var RESERVED = 0; // A simple string attribute.
782 // Attributes that aren't in the filter are presumed to have this type.
783
784 var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called
785 // "enumerated" attributes with "true" and "false" as possible values.
786 // When true, it should be set to a "true" string.
787 // When false, it should be set to a "false" string.
788
789 var BOOLEANISH_STRING = 2; // A real boolean attribute.
790 // When true, it should be present (set either to an empty string or its name).
791 // When false, it should be omitted.
792
793 var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value.
794 // When true, it should be present (set either to an empty string or its name).
795 // When false, it should be omitted.
796 // For any other value, should be present with that value.
797
798 var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric.
799 // When falsy, it should be removed.
800
801 var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric.
802 // When falsy, it should be removed.
803
804 var POSITIVE_NUMERIC = 6;
805
806 /* eslint-disable max-len */
807 var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
808 /* eslint-enable max-len */
809
810 var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
811 var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
812 var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
813 var hasOwnProperty = Object.prototype.hasOwnProperty;
814 var illegalAttributeNameCache = {};
815 var validatedAttributeNameCache = {};
816 function isAttributeNameSafe(attributeName) {
817 if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
818 return true;
819 }
820
821 if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) {
822 return false;
823 }
824
825 if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
826 validatedAttributeNameCache[attributeName] = true;
827 return true;
828 }
829
830 illegalAttributeNameCache[attributeName] = true;
831
832 {
833 error('Invalid attribute name: `%s`', attributeName);
834 }
835
836 return false;
837 }
838 function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
839 if (propertyInfo !== null) {
840 return propertyInfo.type === RESERVED;
841 }
842
843 if (isCustomComponentTag) {
844 return false;
845 }
846
847 if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
848 return true;
849 }
850
851 return false;
852 }
853 function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
854 if (propertyInfo !== null && propertyInfo.type === RESERVED) {
855 return false;
856 }
857
858 switch (typeof value) {
859 case 'function': // $FlowIssue symbol is perfectly valid here
860
861 case 'symbol':
862 // eslint-disable-line
863 return true;
864
865 case 'boolean':
866 {
867 if (isCustomComponentTag) {
868 return false;
869 }
870
871 if (propertyInfo !== null) {
872 return !propertyInfo.acceptsBooleans;
873 } else {
874 var prefix = name.toLowerCase().slice(0, 5);
875 return prefix !== 'data-' && prefix !== 'aria-';
876 }
877 }
878
879 default:
880 return false;
881 }
882 }
883 function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
884 if (value === null || typeof value === 'undefined') {
885 return true;
886 }
887
888 if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
889 return true;
890 }
891
892 if (isCustomComponentTag) {
893 return false;
894 }
895
896 if (propertyInfo !== null) {
897
898 switch (propertyInfo.type) {
899 case BOOLEAN:
900 return !value;
901
902 case OVERLOADED_BOOLEAN:
903 return value === false;
904
905 case NUMERIC:
906 return isNaN(value);
907
908 case POSITIVE_NUMERIC:
909 return isNaN(value) || value < 1;
910 }
911 }
912
913 return false;
914 }
915 function getPropertyInfo(name) {
916 return properties.hasOwnProperty(name) ? properties[name] : null;
917 }
918
919 function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL, removeEmptyString) {
920 this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
921 this.attributeName = attributeName;
922 this.attributeNamespace = attributeNamespace;
923 this.mustUseProperty = mustUseProperty;
924 this.propertyName = name;
925 this.type = type;
926 this.sanitizeURL = sanitizeURL;
927 this.removeEmptyString = removeEmptyString;
928 } // When adding attributes to this list, be sure to also add them to
929 // the `possibleStandardNames` module to ensure casing and incorrect
930 // name warnings.
931
932
933 var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM.
934
935 var reservedProps = ['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular
936 // elements (not just inputs). Now that ReactDOMInput assigns to the
937 // defaultValue property -- do we need this?
938 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'];
939 reservedProps.forEach(function (name) {
940 properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
941 name, // attributeName
942 null, // attributeNamespace
943 false, // sanitizeURL
944 false);
945 }); // A few React string attributes have a different name.
946 // This is a mapping from React prop names to the attribute names.
947
948 [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
949 var name = _ref[0],
950 attributeName = _ref[1];
951 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
952 attributeName, // attributeName
953 null, // attributeNamespace
954 false, // sanitizeURL
955 false);
956 }); // These are "enumerated" HTML attributes that accept "true" and "false".
957 // In React, we let users pass `true` and `false` even though technically
958 // these aren't boolean attributes (they are coerced to strings).
959
960 ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
961 properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
962 name.toLowerCase(), // attributeName
963 null, // attributeNamespace
964 false, // sanitizeURL
965 false);
966 }); // These are "enumerated" SVG attributes that accept "true" and "false".
967 // In React, we let users pass `true` and `false` even though technically
968 // these aren't boolean attributes (they are coerced to strings).
969 // Since these are SVG attributes, their attribute names are case-sensitive.
970
971 ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
972 properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
973 name, // attributeName
974 null, // attributeNamespace
975 false, // sanitizeURL
976 false);
977 }); // These are HTML boolean attributes.
978
979 ['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM
980 // on the client side because the browsers are inconsistent. Instead we call focus().
981 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'disableRemotePlayback', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata
982 'itemScope'].forEach(function (name) {
983 properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
984 name.toLowerCase(), // attributeName
985 null, // attributeNamespace
986 false, // sanitizeURL
987 false);
988 }); // These are the few React props that we set as DOM properties
989 // rather than attributes. These are all booleans.
990
991 ['checked', // Note: `option.selected` is not updated if `select.multiple` is
992 // disabled with `removeAttribute`. We have special logic for handling this.
993 'multiple', 'muted', 'selected' // NOTE: if you add a camelCased prop to this list,
994 // you'll need to set attributeName to name.toLowerCase()
995 // instead in the assignment below.
996 ].forEach(function (name) {
997 properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
998 name, // attributeName
999 null, // attributeNamespace
1000 false, // sanitizeURL
1001 false);
1002 }); // These are HTML attributes that are "overloaded booleans": they behave like
1003 // booleans, but can also accept a string value.
1004
1005 ['capture', 'download' // NOTE: if you add a camelCased prop to this list,
1006 // you'll need to set attributeName to name.toLowerCase()
1007 // instead in the assignment below.
1008 ].forEach(function (name) {
1009 properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
1010 name, // attributeName
1011 null, // attributeNamespace
1012 false, // sanitizeURL
1013 false);
1014 }); // These are HTML attributes that must be positive numbers.
1015
1016 ['cols', 'rows', 'size', 'span' // NOTE: if you add a camelCased prop to this list,
1017 // you'll need to set attributeName to name.toLowerCase()
1018 // instead in the assignment below.
1019 ].forEach(function (name) {
1020 properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
1021 name, // attributeName
1022 null, // attributeNamespace
1023 false, // sanitizeURL
1024 false);
1025 }); // These are HTML attributes that must be numbers.
1026
1027 ['rowSpan', 'start'].forEach(function (name) {
1028 properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
1029 name.toLowerCase(), // attributeName
1030 null, // attributeNamespace
1031 false, // sanitizeURL
1032 false);
1033 });
1034 var CAMELIZE = /[\-\:]([a-z])/g;
1035
1036 var capitalize = function (token) {
1037 return token[1].toUpperCase();
1038 }; // This is a list of all SVG attributes that need special casing, namespacing,
1039 // or boolean value assignment. Regular attributes that just accept strings
1040 // and have the same names are omitted, just like in the HTML attribute filter.
1041 // Some of these attributes can be hard to find. This list was created by
1042 // scraping the MDN documentation.
1043
1044
1045 ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height' // NOTE: if you add a camelCased prop to this list,
1046 // you'll need to set attributeName to name.toLowerCase()
1047 // instead in the assignment below.
1048 ].forEach(function (attributeName) {
1049 var name = attributeName.replace(CAMELIZE, capitalize);
1050 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
1051 attributeName, null, // attributeNamespace
1052 false, // sanitizeURL
1053 false);
1054 }); // String SVG attributes with the xlink namespace.
1055
1056 ['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type' // NOTE: if you add a camelCased prop to this list,
1057 // you'll need to set attributeName to name.toLowerCase()
1058 // instead in the assignment below.
1059 ].forEach(function (attributeName) {
1060 var name = attributeName.replace(CAMELIZE, capitalize);
1061 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
1062 attributeName, 'http://www.w3.org/1999/xlink', false, // sanitizeURL
1063 false);
1064 }); // String SVG attributes with the xml namespace.
1065
1066 ['xml:base', 'xml:lang', 'xml:space' // NOTE: if you add a camelCased prop to this list,
1067 // you'll need to set attributeName to name.toLowerCase()
1068 // instead in the assignment below.
1069 ].forEach(function (attributeName) {
1070 var name = attributeName.replace(CAMELIZE, capitalize);
1071 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
1072 attributeName, 'http://www.w3.org/XML/1998/namespace', false, // sanitizeURL
1073 false);
1074 }); // These attribute exists both in HTML and SVG.
1075 // The attribute name is case-sensitive in SVG so we can't just use
1076 // the React name like we do for attributes that exist only in HTML.
1077
1078 ['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
1079 properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
1080 attributeName.toLowerCase(), // attributeName
1081 null, // attributeNamespace
1082 false, // sanitizeURL
1083 false);
1084 }); // These attributes accept URLs. These must not allow javascript: URLS.
1085 // These will also need to accept Trusted Types object in the future.
1086
1087 var xlinkHref = 'xlinkHref';
1088 properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty
1089 'xlink:href', 'http://www.w3.org/1999/xlink', true, // sanitizeURL
1090 false);
1091 ['src', 'href', 'action', 'formAction'].forEach(function (attributeName) {
1092 properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
1093 attributeName.toLowerCase(), // attributeName
1094 null, // attributeNamespace
1095 true, // sanitizeURL
1096 true);
1097 });
1098
1099 // and any newline or tab are filtered out as if they're not part of the URL.
1100 // https://url.spec.whatwg.org/#url-parsing
1101 // Tab or newline are defined as \r\n\t:
1102 // https://infra.spec.whatwg.org/#ascii-tab-or-newline
1103 // A C0 control is a code point in the range \u0000 NULL to \u001F
1104 // INFORMATION SEPARATOR ONE, inclusive:
1105 // https://infra.spec.whatwg.org/#c0-control-or-space
1106
1107 /* eslint-disable max-len */
1108
1109 var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
1110 var didWarn = false;
1111
1112 function sanitizeURL(url) {
1113 {
1114 if (!didWarn && isJavaScriptProtocol.test(url)) {
1115 didWarn = true;
1116
1117 error('A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url));
1118 }
1119 }
1120 }
1121
1122 // code copied and modified from escape-html
1123
1124 /**
1125 * Module variables.
1126 * @private
1127 */
1128 var matchHtmlRegExp = /["'&<>]/;
1129 /**
1130 * Escapes special characters and HTML entities in a given html string.
1131 *
1132 * @param {string} string HTML string to escape for later insertion
1133 * @return {string}
1134 * @public
1135 */
1136
1137 function escapeHtml(string) {
1138 var str = '' + string;
1139 var match = matchHtmlRegExp.exec(str);
1140
1141 if (!match) {
1142 return str;
1143 }
1144
1145 var escape;
1146 var html = '';
1147 var index;
1148 var lastIndex = 0;
1149
1150 for (index = match.index; index < str.length; index++) {
1151 switch (str.charCodeAt(index)) {
1152 case 34:
1153 // "
1154 escape = '&quot;';
1155 break;
1156
1157 case 38:
1158 // &
1159 escape = '&amp;';
1160 break;
1161
1162 case 39:
1163 // '
1164 escape = '&#x27;'; // modified from escape-html; used to be '&#39'
1165
1166 break;
1167
1168 case 60:
1169 // <
1170 escape = '&lt;';
1171 break;
1172
1173 case 62:
1174 // >
1175 escape = '&gt;';
1176 break;
1177
1178 default:
1179 continue;
1180 }
1181
1182 if (lastIndex !== index) {
1183 html += str.substring(lastIndex, index);
1184 }
1185
1186 lastIndex = index + 1;
1187 html += escape;
1188 }
1189
1190 return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
1191 } // end code copied and modified from escape-html
1192
1193 /**
1194 * Escapes text to prevent scripting attacks.
1195 *
1196 * @param {*} text Text value to escape.
1197 * @return {string} An escaped string.
1198 */
1199
1200
1201 function escapeTextForBrowser(text) {
1202 if (typeof text === 'boolean' || typeof text === 'number') {
1203 // this shortcircuit helps perf for types that we know will never have
1204 // special characters, especially given that this function is used often
1205 // for numeric dom ids.
1206 return '' + text;
1207 }
1208
1209 return escapeHtml(text);
1210 }
1211
1212 /**
1213 * Escapes attribute value to prevent scripting attacks.
1214 *
1215 * @param {*} value Value to escape.
1216 * @return {string} An escaped string.
1217 */
1218
1219 function quoteAttributeValueForBrowser(value) {
1220 return '"' + escapeTextForBrowser(value) + '"';
1221 }
1222
1223 function createMarkupForRoot() {
1224 return ROOT_ATTRIBUTE_NAME + '=""';
1225 }
1226 /**
1227 * Creates markup for a property.
1228 *
1229 * @param {string} name
1230 * @param {*} value
1231 * @return {?string} Markup string, or null if the property was invalid.
1232 */
1233
1234 function createMarkupForProperty(name, value) {
1235 var propertyInfo = getPropertyInfo(name);
1236
1237 if (name !== 'style' && shouldIgnoreAttribute(name, propertyInfo, false)) {
1238 return '';
1239 }
1240
1241 if (shouldRemoveAttribute(name, value, propertyInfo, false)) {
1242 return '';
1243 }
1244
1245 if (propertyInfo !== null) {
1246 var attributeName = propertyInfo.attributeName;
1247 var type = propertyInfo.type;
1248
1249 if (type === BOOLEAN || type === OVERLOADED_BOOLEAN && value === true) {
1250 return attributeName + '=""';
1251 } else {
1252 if (propertyInfo.sanitizeURL) {
1253 value = '' + value;
1254 sanitizeURL(value);
1255 }
1256
1257 return attributeName + '=' + quoteAttributeValueForBrowser(value);
1258 }
1259 } else if (isAttributeNameSafe(name)) {
1260 return name + '=' + quoteAttributeValueForBrowser(value);
1261 }
1262
1263 return '';
1264 }
1265 /**
1266 * Creates markup for a custom property.
1267 *
1268 * @param {string} name
1269 * @param {*} value
1270 * @return {string} Markup string, or empty string if the property was invalid.
1271 */
1272
1273 function createMarkupForCustomAttribute(name, value) {
1274 if (!isAttributeNameSafe(name) || value == null) {
1275 return '';
1276 }
1277
1278 return name + '=' + quoteAttributeValueForBrowser(value);
1279 }
1280
1281 /**
1282 * inlined Object.is polyfill to avoid requiring consumers ship their own
1283 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
1284 */
1285 function is(x, y) {
1286 return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
1287 ;
1288 }
1289
1290 var objectIs = typeof Object.is === 'function' ? Object.is : is;
1291
1292 var currentlyRenderingComponent = null;
1293 var firstWorkInProgressHook = null;
1294 var workInProgressHook = null; // Whether the work-in-progress hook is a re-rendered hook
1295
1296 var isReRender = false; // Whether an update was scheduled during the currently executing render pass.
1297
1298 var didScheduleRenderPhaseUpdate = false; // Lazily created map of render-phase updates
1299
1300 var renderPhaseUpdates = null; // Counter to prevent infinite loops.
1301
1302 var numberOfReRenders = 0;
1303 var RE_RENDER_LIMIT = 25;
1304 var isInHookUserCodeInDev = false; // In DEV, this is the name of the currently executing primitive hook
1305
1306 var currentHookNameInDev;
1307
1308 function resolveCurrentlyRenderingComponent() {
1309 if (!(currentlyRenderingComponent !== null)) {
1310 {
1311 throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." );
1312 }
1313 }
1314
1315 {
1316 if (isInHookUserCodeInDev) {
1317 error('Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://reactjs.org/link/rules-of-hooks');
1318 }
1319 }
1320
1321 return currentlyRenderingComponent;
1322 }
1323
1324 function areHookInputsEqual(nextDeps, prevDeps) {
1325 if (prevDeps === null) {
1326 {
1327 error('%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev);
1328 }
1329
1330 return false;
1331 }
1332
1333 {
1334 // Don't bother comparing lengths in prod because these arrays should be
1335 // passed inline.
1336 if (nextDeps.length !== prevDeps.length) {
1337 error('The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, "[" + nextDeps.join(', ') + "]", "[" + prevDeps.join(', ') + "]");
1338 }
1339 }
1340
1341 for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
1342 if (objectIs(nextDeps[i], prevDeps[i])) {
1343 continue;
1344 }
1345
1346 return false;
1347 }
1348
1349 return true;
1350 }
1351
1352 function createHook() {
1353 if (numberOfReRenders > 0) {
1354 {
1355 {
1356 throw Error( "Rendered more hooks than during the previous render" );
1357 }
1358 }
1359 }
1360
1361 return {
1362 memoizedState: null,
1363 queue: null,
1364 next: null
1365 };
1366 }
1367
1368 function createWorkInProgressHook() {
1369 if (workInProgressHook === null) {
1370 // This is the first hook in the list
1371 if (firstWorkInProgressHook === null) {
1372 isReRender = false;
1373 firstWorkInProgressHook = workInProgressHook = createHook();
1374 } else {
1375 // There's already a work-in-progress. Reuse it.
1376 isReRender = true;
1377 workInProgressHook = firstWorkInProgressHook;
1378 }
1379 } else {
1380 if (workInProgressHook.next === null) {
1381 isReRender = false; // Append to the end of the list
1382
1383 workInProgressHook = workInProgressHook.next = createHook();
1384 } else {
1385 // There's already a work-in-progress. Reuse it.
1386 isReRender = true;
1387 workInProgressHook = workInProgressHook.next;
1388 }
1389 }
1390
1391 return workInProgressHook;
1392 }
1393
1394 function prepareToUseHooks(componentIdentity) {
1395 currentlyRenderingComponent = componentIdentity;
1396
1397 {
1398 isInHookUserCodeInDev = false;
1399 } // The following should have already been reset
1400 // didScheduleRenderPhaseUpdate = false;
1401 // firstWorkInProgressHook = null;
1402 // numberOfReRenders = 0;
1403 // renderPhaseUpdates = null;
1404 // workInProgressHook = null;
1405
1406 }
1407 function finishHooks(Component, props, children, refOrContext) {
1408 // This must be called after every function component to prevent hooks from
1409 // being used in classes.
1410 while (didScheduleRenderPhaseUpdate) {
1411 // Updates were scheduled during the render phase. They are stored in
1412 // the `renderPhaseUpdates` map. Call the component again, reusing the
1413 // work-in-progress hooks and applying the additional updates on top. Keep
1414 // restarting until no more updates are scheduled.
1415 didScheduleRenderPhaseUpdate = false;
1416 numberOfReRenders += 1; // Start over from the beginning of the list
1417
1418 workInProgressHook = null;
1419 children = Component(props, refOrContext);
1420 }
1421
1422 resetHooksState();
1423 return children;
1424 } // Reset the internal hooks state if an error occurs while rendering a component
1425
1426 function resetHooksState() {
1427 {
1428 isInHookUserCodeInDev = false;
1429 }
1430
1431 currentlyRenderingComponent = null;
1432 didScheduleRenderPhaseUpdate = false;
1433 firstWorkInProgressHook = null;
1434 numberOfReRenders = 0;
1435 renderPhaseUpdates = null;
1436 workInProgressHook = null;
1437 }
1438
1439 function readContext(context, observedBits) {
1440 var threadID = currentPartialRenderer.threadID;
1441 validateContextBounds(context, threadID);
1442
1443 {
1444 if (isInHookUserCodeInDev) {
1445 error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().');
1446 }
1447 }
1448
1449 return context[threadID];
1450 }
1451
1452 function useContext(context, observedBits) {
1453 {
1454 currentHookNameInDev = 'useContext';
1455 }
1456
1457 resolveCurrentlyRenderingComponent();
1458 var threadID = currentPartialRenderer.threadID;
1459 validateContextBounds(context, threadID);
1460 return context[threadID];
1461 }
1462
1463 function basicStateReducer(state, action) {
1464 // $FlowFixMe: Flow doesn't like mixed types
1465 return typeof action === 'function' ? action(state) : action;
1466 }
1467
1468 function useState(initialState) {
1469 {
1470 currentHookNameInDev = 'useState';
1471 }
1472
1473 return useReducer(basicStateReducer, // useReducer has a special case to support lazy useState initializers
1474 initialState);
1475 }
1476 function useReducer(reducer, initialArg, init) {
1477 {
1478 if (reducer !== basicStateReducer) {
1479 currentHookNameInDev = 'useReducer';
1480 }
1481 }
1482
1483 currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
1484 workInProgressHook = createWorkInProgressHook();
1485
1486 if (isReRender) {
1487 // This is a re-render. Apply the new render phase updates to the previous
1488 // current hook.
1489 var queue = workInProgressHook.queue;
1490 var dispatch = queue.dispatch;
1491
1492 if (renderPhaseUpdates !== null) {
1493 // Render phase updates are stored in a map of queue -> linked list
1494 var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
1495
1496 if (firstRenderPhaseUpdate !== undefined) {
1497 renderPhaseUpdates.delete(queue);
1498 var newState = workInProgressHook.memoizedState;
1499 var update = firstRenderPhaseUpdate;
1500
1501 do {
1502 // Process this render phase update. We don't have to check the
1503 // priority because it will always be the same as the current
1504 // render's.
1505 var action = update.action;
1506
1507 {
1508 isInHookUserCodeInDev = true;
1509 }
1510
1511 newState = reducer(newState, action);
1512
1513 {
1514 isInHookUserCodeInDev = false;
1515 }
1516
1517 update = update.next;
1518 } while (update !== null);
1519
1520 workInProgressHook.memoizedState = newState;
1521 return [newState, dispatch];
1522 }
1523 }
1524
1525 return [workInProgressHook.memoizedState, dispatch];
1526 } else {
1527 {
1528 isInHookUserCodeInDev = true;
1529 }
1530
1531 var initialState;
1532
1533 if (reducer === basicStateReducer) {
1534 // Special case for `useState`.
1535 initialState = typeof initialArg === 'function' ? initialArg() : initialArg;
1536 } else {
1537 initialState = init !== undefined ? init(initialArg) : initialArg;
1538 }
1539
1540 {
1541 isInHookUserCodeInDev = false;
1542 }
1543
1544 workInProgressHook.memoizedState = initialState;
1545
1546 var _queue = workInProgressHook.queue = {
1547 last: null,
1548 dispatch: null
1549 };
1550
1551 var _dispatch = _queue.dispatch = dispatchAction.bind(null, currentlyRenderingComponent, _queue);
1552
1553 return [workInProgressHook.memoizedState, _dispatch];
1554 }
1555 }
1556
1557 function useMemo(nextCreate, deps) {
1558 currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
1559 workInProgressHook = createWorkInProgressHook();
1560 var nextDeps = deps === undefined ? null : deps;
1561
1562 if (workInProgressHook !== null) {
1563 var prevState = workInProgressHook.memoizedState;
1564
1565 if (prevState !== null) {
1566 if (nextDeps !== null) {
1567 var prevDeps = prevState[1];
1568
1569 if (areHookInputsEqual(nextDeps, prevDeps)) {
1570 return prevState[0];
1571 }
1572 }
1573 }
1574 }
1575
1576 {
1577 isInHookUserCodeInDev = true;
1578 }
1579
1580 var nextValue = nextCreate();
1581
1582 {
1583 isInHookUserCodeInDev = false;
1584 }
1585
1586 workInProgressHook.memoizedState = [nextValue, nextDeps];
1587 return nextValue;
1588 }
1589
1590 function useRef(initialValue) {
1591 currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
1592 workInProgressHook = createWorkInProgressHook();
1593 var previousRef = workInProgressHook.memoizedState;
1594
1595 if (previousRef === null) {
1596 var ref = {
1597 current: initialValue
1598 };
1599
1600 {
1601 Object.seal(ref);
1602 }
1603
1604 workInProgressHook.memoizedState = ref;
1605 return ref;
1606 } else {
1607 return previousRef;
1608 }
1609 }
1610
1611 function useLayoutEffect(create, inputs) {
1612 {
1613 currentHookNameInDev = 'useLayoutEffect';
1614
1615 error('useLayoutEffect does nothing on the server, because its effect cannot ' + "be encoded into the server renderer's output format. This will lead " + 'to a mismatch between the initial, non-hydrated UI and the intended ' + 'UI. To avoid this, useLayoutEffect should only be used in ' + 'components that render exclusively on the client. ' + 'See https://reactjs.org/link/uselayouteffect-ssr for common fixes.');
1616 }
1617 }
1618
1619 function dispatchAction(componentIdentity, queue, action) {
1620 if (!(numberOfReRenders < RE_RENDER_LIMIT)) {
1621 {
1622 throw Error( "Too many re-renders. React limits the number of renders to prevent an infinite loop." );
1623 }
1624 }
1625
1626 if (componentIdentity === currentlyRenderingComponent) {
1627 // This is a render phase update. Stash it in a lazily-created map of
1628 // queue -> linked list of updates. After this render pass, we'll restart
1629 // and apply the stashed updates on top of the work-in-progress hook.
1630 didScheduleRenderPhaseUpdate = true;
1631 var update = {
1632 action: action,
1633 next: null
1634 };
1635
1636 if (renderPhaseUpdates === null) {
1637 renderPhaseUpdates = new Map();
1638 }
1639
1640 var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
1641
1642 if (firstRenderPhaseUpdate === undefined) {
1643 renderPhaseUpdates.set(queue, update);
1644 } else {
1645 // Append the update to the end of the list.
1646 var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
1647
1648 while (lastRenderPhaseUpdate.next !== null) {
1649 lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
1650 }
1651
1652 lastRenderPhaseUpdate.next = update;
1653 }
1654 }
1655 }
1656
1657 function useCallback(callback, deps) {
1658 return useMemo(function () {
1659 return callback;
1660 }, deps);
1661 } // TODO Decide on how to implement this hook for server rendering.
1662 // If a mutation occurs during render, consider triggering a Suspense boundary
1663 // and falling back to client rendering.
1664
1665 function useMutableSource(source, getSnapshot, subscribe) {
1666 resolveCurrentlyRenderingComponent();
1667 return getSnapshot(source._source);
1668 }
1669
1670 function useDeferredValue(value) {
1671 resolveCurrentlyRenderingComponent();
1672 return value;
1673 }
1674
1675 function useTransition() {
1676 resolveCurrentlyRenderingComponent();
1677
1678 var startTransition = function (callback) {
1679 callback();
1680 };
1681
1682 return [startTransition, false];
1683 }
1684
1685 function useOpaqueIdentifier() {
1686 return (currentPartialRenderer.identifierPrefix || '') + 'R:' + (currentPartialRenderer.uniqueID++).toString(36);
1687 }
1688
1689 function noop() {}
1690
1691 var currentPartialRenderer = null;
1692 function setCurrentPartialRenderer(renderer) {
1693 currentPartialRenderer = renderer;
1694 }
1695 var Dispatcher = {
1696 readContext: readContext,
1697 useContext: useContext,
1698 useMemo: useMemo,
1699 useReducer: useReducer,
1700 useRef: useRef,
1701 useState: useState,
1702 useLayoutEffect: useLayoutEffect,
1703 useCallback: useCallback,
1704 // useImperativeHandle is not run in the server environment
1705 useImperativeHandle: noop,
1706 // Effects are not run in the server environment.
1707 useEffect: noop,
1708 // Debugging effect
1709 useDebugValue: noop,
1710 useDeferredValue: useDeferredValue,
1711 useTransition: useTransition,
1712 useOpaqueIdentifier: useOpaqueIdentifier,
1713 // Subscriptions are not setup in a server environment.
1714 useMutableSource: useMutableSource
1715 };
1716
1717 var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
1718 var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
1719 var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
1720 var Namespaces = {
1721 html: HTML_NAMESPACE,
1722 mathml: MATH_NAMESPACE,
1723 svg: SVG_NAMESPACE
1724 }; // Assumes there is no parent namespace.
1725
1726 function getIntrinsicNamespace(type) {
1727 switch (type) {
1728 case 'svg':
1729 return SVG_NAMESPACE;
1730
1731 case 'math':
1732 return MATH_NAMESPACE;
1733
1734 default:
1735 return HTML_NAMESPACE;
1736 }
1737 }
1738 function getChildNamespace(parentNamespace, type) {
1739 if (parentNamespace == null || parentNamespace === HTML_NAMESPACE) {
1740 // No (or default) parent namespace: potential entry point.
1741 return getIntrinsicNamespace(type);
1742 }
1743
1744 if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') {
1745 // We're leaving SVG.
1746 return HTML_NAMESPACE;
1747 } // By default, pass namespace below.
1748
1749
1750 return parentNamespace;
1751 }
1752
1753 var hasReadOnlyValue = {
1754 button: true,
1755 checkbox: true,
1756 image: true,
1757 hidden: true,
1758 radio: true,
1759 reset: true,
1760 submit: true
1761 };
1762 function checkControlledValueProps(tagName, props) {
1763 {
1764 if (!(hasReadOnlyValue[props.type] || props.onChange || props.onInput || props.readOnly || props.disabled || props.value == null)) {
1765 error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
1766 }
1767
1768 if (!(props.onChange || props.readOnly || props.disabled || props.checked == null)) {
1769 error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
1770 }
1771 }
1772 }
1773
1774 // For HTML, certain tags should omit their close tag. We keep a list for
1775 // those special-case tags.
1776 var omittedCloseTags = {
1777 area: true,
1778 base: true,
1779 br: true,
1780 col: true,
1781 embed: true,
1782 hr: true,
1783 img: true,
1784 input: true,
1785 keygen: true,
1786 link: true,
1787 meta: true,
1788 param: true,
1789 source: true,
1790 track: true,
1791 wbr: true // NOTE: menuitem's close tag should be omitted, but that causes problems.
1792
1793 };
1794
1795 // `omittedCloseTags` except that `menuitem` should still have its closing tag.
1796
1797 var voidElementTags = _assign({
1798 menuitem: true
1799 }, omittedCloseTags);
1800
1801 var HTML = '__html';
1802
1803 function assertValidProps(tag, props) {
1804 if (!props) {
1805 return;
1806 } // Note the use of `==` which checks for null or undefined.
1807
1808
1809 if (voidElementTags[tag]) {
1810 if (!(props.children == null && props.dangerouslySetInnerHTML == null)) {
1811 {
1812 throw Error( tag + " is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`." );
1813 }
1814 }
1815 }
1816
1817 if (props.dangerouslySetInnerHTML != null) {
1818 if (!(props.children == null)) {
1819 {
1820 throw Error( "Can only set one of `children` or `props.dangerouslySetInnerHTML`." );
1821 }
1822 }
1823
1824 if (!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML)) {
1825 {
1826 throw Error( "`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://reactjs.org/link/dangerously-set-inner-html for more information." );
1827 }
1828 }
1829 }
1830
1831 {
1832 if (!props.suppressContentEditableWarning && props.contentEditable && props.children != null) {
1833 error('A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.');
1834 }
1835 }
1836
1837 if (!(props.style == null || typeof props.style === 'object')) {
1838 {
1839 throw Error( "The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX." );
1840 }
1841 }
1842 }
1843
1844 /**
1845 * CSS properties which accept numbers but are not in units of "px".
1846 */
1847 var isUnitlessNumber = {
1848 animationIterationCount: true,
1849 borderImageOutset: true,
1850 borderImageSlice: true,
1851 borderImageWidth: true,
1852 boxFlex: true,
1853 boxFlexGroup: true,
1854 boxOrdinalGroup: true,
1855 columnCount: true,
1856 columns: true,
1857 flex: true,
1858 flexGrow: true,
1859 flexPositive: true,
1860 flexShrink: true,
1861 flexNegative: true,
1862 flexOrder: true,
1863 gridArea: true,
1864 gridRow: true,
1865 gridRowEnd: true,
1866 gridRowSpan: true,
1867 gridRowStart: true,
1868 gridColumn: true,
1869 gridColumnEnd: true,
1870 gridColumnSpan: true,
1871 gridColumnStart: true,
1872 fontWeight: true,
1873 lineClamp: true,
1874 lineHeight: true,
1875 opacity: true,
1876 order: true,
1877 orphans: true,
1878 tabSize: true,
1879 widows: true,
1880 zIndex: true,
1881 zoom: true,
1882 // SVG-related properties
1883 fillOpacity: true,
1884 floodOpacity: true,
1885 stopOpacity: true,
1886 strokeDasharray: true,
1887 strokeDashoffset: true,
1888 strokeMiterlimit: true,
1889 strokeOpacity: true,
1890 strokeWidth: true
1891 };
1892 /**
1893 * @param {string} prefix vendor-specific prefix, eg: Webkit
1894 * @param {string} key style name, eg: transitionDuration
1895 * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
1896 * WebkitTransitionDuration
1897 */
1898
1899 function prefixKey(prefix, key) {
1900 return prefix + key.charAt(0).toUpperCase() + key.substring(1);
1901 }
1902 /**
1903 * Support style names that may come passed in prefixed by adding permutations
1904 * of vendor prefixes.
1905 */
1906
1907
1908 var prefixes = ['Webkit', 'ms', 'Moz', 'O']; // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
1909 // infinite loop, because it iterates over the newly added props too.
1910
1911 Object.keys(isUnitlessNumber).forEach(function (prop) {
1912 prefixes.forEach(function (prefix) {
1913 isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
1914 });
1915 });
1916
1917 /**
1918 * Convert a value into the proper css writable value. The style name `name`
1919 * should be logical (no hyphens), as specified
1920 * in `CSSProperty.isUnitlessNumber`.
1921 *
1922 * @param {string} name CSS property name such as `topMargin`.
1923 * @param {*} value CSS property value such as `10px`.
1924 * @return {string} Normalized style value with dimensions applied.
1925 */
1926
1927 function dangerousStyleValue(name, value, isCustomProperty) {
1928 // Note that we've removed escapeTextForBrowser() calls here since the
1929 // whole string will be escaped when the attribute is injected into
1930 // the markup. If you provide unsafe user data here they can inject
1931 // arbitrary CSS which may be problematic (I couldn't repro this):
1932 // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
1933 // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
1934 // This is not an XSS hole but instead a potential CSS injection issue
1935 // which has lead to a greater discussion about how we're going to
1936 // trust URLs moving forward. See #2115901
1937 var isEmpty = value == null || typeof value === 'boolean' || value === '';
1938
1939 if (isEmpty) {
1940 return '';
1941 }
1942
1943 if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) {
1944 return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers
1945 }
1946
1947 return ('' + value).trim();
1948 }
1949
1950 var uppercasePattern = /([A-Z])/g;
1951 var msPattern = /^ms-/;
1952 /**
1953 * Hyphenates a camelcased CSS property name, for example:
1954 *
1955 * > hyphenateStyleName('backgroundColor')
1956 * < "background-color"
1957 * > hyphenateStyleName('MozTransition')
1958 * < "-moz-transition"
1959 * > hyphenateStyleName('msTransition')
1960 * < "-ms-transition"
1961 *
1962 * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
1963 * is converted to `-ms-`.
1964 */
1965
1966 function hyphenateStyleName(name) {
1967 return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-');
1968 }
1969
1970 function isCustomComponent(tagName, props) {
1971 if (tagName.indexOf('-') === -1) {
1972 return typeof props.is === 'string';
1973 }
1974
1975 switch (tagName) {
1976 // These are reserved SVG and MathML elements.
1977 // We don't mind this list too much because we expect it to never grow.
1978 // The alternative is to track the namespace in a few places which is convoluted.
1979 // https://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts
1980 case 'annotation-xml':
1981 case 'color-profile':
1982 case 'font-face':
1983 case 'font-face-src':
1984 case 'font-face-uri':
1985 case 'font-face-format':
1986 case 'font-face-name':
1987 case 'missing-glyph':
1988 return false;
1989
1990 default:
1991 return true;
1992 }
1993 }
1994
1995 var warnValidStyle = function () {};
1996
1997 {
1998 // 'msTransform' is correct, but the other prefixes should be capitalized
1999 var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
2000 var msPattern$1 = /^-ms-/;
2001 var hyphenPattern = /-(.)/g; // style values shouldn't contain a semicolon
2002
2003 var badStyleValueWithSemicolonPattern = /;\s*$/;
2004 var warnedStyleNames = {};
2005 var warnedStyleValues = {};
2006 var warnedForNaNValue = false;
2007 var warnedForInfinityValue = false;
2008
2009 var camelize = function (string) {
2010 return string.replace(hyphenPattern, function (_, character) {
2011 return character.toUpperCase();
2012 });
2013 };
2014
2015 var warnHyphenatedStyleName = function (name) {
2016 if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
2017 return;
2018 }
2019
2020 warnedStyleNames[name] = true;
2021
2022 error('Unsupported style property %s. Did you mean %s?', name, // As Andi Smith suggests
2023 // (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
2024 // is converted to lowercase `ms`.
2025 camelize(name.replace(msPattern$1, 'ms-')));
2026 };
2027
2028 var warnBadVendoredStyleName = function (name) {
2029 if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
2030 return;
2031 }
2032
2033 warnedStyleNames[name] = true;
2034
2035 error('Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1));
2036 };
2037
2038 var warnStyleValueWithSemicolon = function (name, value) {
2039 if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
2040 return;
2041 }
2042
2043 warnedStyleValues[value] = true;
2044
2045 error("Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, ''));
2046 };
2047
2048 var warnStyleValueIsNaN = function (name, value) {
2049 if (warnedForNaNValue) {
2050 return;
2051 }
2052
2053 warnedForNaNValue = true;
2054
2055 error('`NaN` is an invalid value for the `%s` css style property.', name);
2056 };
2057
2058 var warnStyleValueIsInfinity = function (name, value) {
2059 if (warnedForInfinityValue) {
2060 return;
2061 }
2062
2063 warnedForInfinityValue = true;
2064
2065 error('`Infinity` is an invalid value for the `%s` css style property.', name);
2066 };
2067
2068 warnValidStyle = function (name, value) {
2069 if (name.indexOf('-') > -1) {
2070 warnHyphenatedStyleName(name);
2071 } else if (badVendoredStyleNamePattern.test(name)) {
2072 warnBadVendoredStyleName(name);
2073 } else if (badStyleValueWithSemicolonPattern.test(value)) {
2074 warnStyleValueWithSemicolon(name, value);
2075 }
2076
2077 if (typeof value === 'number') {
2078 if (isNaN(value)) {
2079 warnStyleValueIsNaN(name, value);
2080 } else if (!isFinite(value)) {
2081 warnStyleValueIsInfinity(name, value);
2082 }
2083 }
2084 };
2085 }
2086
2087 var warnValidStyle$1 = warnValidStyle;
2088
2089 var ariaProperties = {
2090 'aria-current': 0,
2091 // state
2092 'aria-details': 0,
2093 'aria-disabled': 0,
2094 // state
2095 'aria-hidden': 0,
2096 // state
2097 'aria-invalid': 0,
2098 // state
2099 'aria-keyshortcuts': 0,
2100 'aria-label': 0,
2101 'aria-roledescription': 0,
2102 // Widget Attributes
2103 'aria-autocomplete': 0,
2104 'aria-checked': 0,
2105 'aria-expanded': 0,
2106 'aria-haspopup': 0,
2107 'aria-level': 0,
2108 'aria-modal': 0,
2109 'aria-multiline': 0,
2110 'aria-multiselectable': 0,
2111 'aria-orientation': 0,
2112 'aria-placeholder': 0,
2113 'aria-pressed': 0,
2114 'aria-readonly': 0,
2115 'aria-required': 0,
2116 'aria-selected': 0,
2117 'aria-sort': 0,
2118 'aria-valuemax': 0,
2119 'aria-valuemin': 0,
2120 'aria-valuenow': 0,
2121 'aria-valuetext': 0,
2122 // Live Region Attributes
2123 'aria-atomic': 0,
2124 'aria-busy': 0,
2125 'aria-live': 0,
2126 'aria-relevant': 0,
2127 // Drag-and-Drop Attributes
2128 'aria-dropeffect': 0,
2129 'aria-grabbed': 0,
2130 // Relationship Attributes
2131 'aria-activedescendant': 0,
2132 'aria-colcount': 0,
2133 'aria-colindex': 0,
2134 'aria-colspan': 0,
2135 'aria-controls': 0,
2136 'aria-describedby': 0,
2137 'aria-errormessage': 0,
2138 'aria-flowto': 0,
2139 'aria-labelledby': 0,
2140 'aria-owns': 0,
2141 'aria-posinset': 0,
2142 'aria-rowcount': 0,
2143 'aria-rowindex': 0,
2144 'aria-rowspan': 0,
2145 'aria-setsize': 0
2146 };
2147
2148 var warnedProperties = {};
2149 var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
2150 var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
2151 var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
2152
2153 function validateProperty(tagName, name) {
2154 {
2155 if (hasOwnProperty$1.call(warnedProperties, name) && warnedProperties[name]) {
2156 return true;
2157 }
2158
2159 if (rARIACamel.test(name)) {
2160 var ariaName = 'aria-' + name.slice(4).toLowerCase();
2161 var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null; // If this is an aria-* attribute, but is not listed in the known DOM
2162 // DOM properties, then it is an invalid aria-* attribute.
2163
2164 if (correctName == null) {
2165 error('Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
2166
2167 warnedProperties[name] = true;
2168 return true;
2169 } // aria-* attributes should be lowercase; suggest the lowercase version.
2170
2171
2172 if (name !== correctName) {
2173 error('Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
2174
2175 warnedProperties[name] = true;
2176 return true;
2177 }
2178 }
2179
2180 if (rARIA.test(name)) {
2181 var lowerCasedName = name.toLowerCase();
2182 var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null; // If this is an aria-* attribute, but is not listed in the known DOM
2183 // DOM properties, then it is an invalid aria-* attribute.
2184
2185 if (standardName == null) {
2186 warnedProperties[name] = true;
2187 return false;
2188 } // aria-* attributes should be lowercase; suggest the lowercase version.
2189
2190
2191 if (name !== standardName) {
2192 error('Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
2193
2194 warnedProperties[name] = true;
2195 return true;
2196 }
2197 }
2198 }
2199
2200 return true;
2201 }
2202
2203 function warnInvalidARIAProps(type, props) {
2204 {
2205 var invalidProps = [];
2206
2207 for (var key in props) {
2208 var isValid = validateProperty(type, key);
2209
2210 if (!isValid) {
2211 invalidProps.push(key);
2212 }
2213 }
2214
2215 var unknownPropString = invalidProps.map(function (prop) {
2216 return '`' + prop + '`';
2217 }).join(', ');
2218
2219 if (invalidProps.length === 1) {
2220 error('Invalid aria prop %s on <%s> tag. ' + 'For details, see https://reactjs.org/link/invalid-aria-props', unknownPropString, type);
2221 } else if (invalidProps.length > 1) {
2222 error('Invalid aria props %s on <%s> tag. ' + 'For details, see https://reactjs.org/link/invalid-aria-props', unknownPropString, type);
2223 }
2224 }
2225 }
2226
2227 function validateProperties(type, props) {
2228 if (isCustomComponent(type, props)) {
2229 return;
2230 }
2231
2232 warnInvalidARIAProps(type, props);
2233 }
2234
2235 var didWarnValueNull = false;
2236 function validateProperties$1(type, props) {
2237 {
2238 if (type !== 'input' && type !== 'textarea' && type !== 'select') {
2239 return;
2240 }
2241
2242 if (props != null && props.value === null && !didWarnValueNull) {
2243 didWarnValueNull = true;
2244
2245 if (type === 'select' && props.multiple) {
2246 error('`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.', type);
2247 } else {
2248 error('`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.', type);
2249 }
2250 }
2251 }
2252 }
2253
2254 // When adding attributes to the HTML or SVG allowed attribute list, be sure to
2255 // also add them to this module to ensure casing and incorrect name
2256 // warnings.
2257 var possibleStandardNames = {
2258 // HTML
2259 accept: 'accept',
2260 acceptcharset: 'acceptCharset',
2261 'accept-charset': 'acceptCharset',
2262 accesskey: 'accessKey',
2263 action: 'action',
2264 allowfullscreen: 'allowFullScreen',
2265 alt: 'alt',
2266 as: 'as',
2267 async: 'async',
2268 autocapitalize: 'autoCapitalize',
2269 autocomplete: 'autoComplete',
2270 autocorrect: 'autoCorrect',
2271 autofocus: 'autoFocus',
2272 autoplay: 'autoPlay',
2273 autosave: 'autoSave',
2274 capture: 'capture',
2275 cellpadding: 'cellPadding',
2276 cellspacing: 'cellSpacing',
2277 challenge: 'challenge',
2278 charset: 'charSet',
2279 checked: 'checked',
2280 children: 'children',
2281 cite: 'cite',
2282 class: 'className',
2283 classid: 'classID',
2284 classname: 'className',
2285 cols: 'cols',
2286 colspan: 'colSpan',
2287 content: 'content',
2288 contenteditable: 'contentEditable',
2289 contextmenu: 'contextMenu',
2290 controls: 'controls',
2291 controlslist: 'controlsList',
2292 coords: 'coords',
2293 crossorigin: 'crossOrigin',
2294 dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
2295 data: 'data',
2296 datetime: 'dateTime',
2297 default: 'default',
2298 defaultchecked: 'defaultChecked',
2299 defaultvalue: 'defaultValue',
2300 defer: 'defer',
2301 dir: 'dir',
2302 disabled: 'disabled',
2303 disablepictureinpicture: 'disablePictureInPicture',
2304 disableremoteplayback: 'disableRemotePlayback',
2305 download: 'download',
2306 draggable: 'draggable',
2307 enctype: 'encType',
2308 enterkeyhint: 'enterKeyHint',
2309 for: 'htmlFor',
2310 form: 'form',
2311 formmethod: 'formMethod',
2312 formaction: 'formAction',
2313 formenctype: 'formEncType',
2314 formnovalidate: 'formNoValidate',
2315 formtarget: 'formTarget',
2316 frameborder: 'frameBorder',
2317 headers: 'headers',
2318 height: 'height',
2319 hidden: 'hidden',
2320 high: 'high',
2321 href: 'href',
2322 hreflang: 'hrefLang',
2323 htmlfor: 'htmlFor',
2324 httpequiv: 'httpEquiv',
2325 'http-equiv': 'httpEquiv',
2326 icon: 'icon',
2327 id: 'id',
2328 innerhtml: 'innerHTML',
2329 inputmode: 'inputMode',
2330 integrity: 'integrity',
2331 is: 'is',
2332 itemid: 'itemID',
2333 itemprop: 'itemProp',
2334 itemref: 'itemRef',
2335 itemscope: 'itemScope',
2336 itemtype: 'itemType',
2337 keyparams: 'keyParams',
2338 keytype: 'keyType',
2339 kind: 'kind',
2340 label: 'label',
2341 lang: 'lang',
2342 list: 'list',
2343 loop: 'loop',
2344 low: 'low',
2345 manifest: 'manifest',
2346 marginwidth: 'marginWidth',
2347 marginheight: 'marginHeight',
2348 max: 'max',
2349 maxlength: 'maxLength',
2350 media: 'media',
2351 mediagroup: 'mediaGroup',
2352 method: 'method',
2353 min: 'min',
2354 minlength: 'minLength',
2355 multiple: 'multiple',
2356 muted: 'muted',
2357 name: 'name',
2358 nomodule: 'noModule',
2359 nonce: 'nonce',
2360 novalidate: 'noValidate',
2361 open: 'open',
2362 optimum: 'optimum',
2363 pattern: 'pattern',
2364 placeholder: 'placeholder',
2365 playsinline: 'playsInline',
2366 poster: 'poster',
2367 preload: 'preload',
2368 profile: 'profile',
2369 radiogroup: 'radioGroup',
2370 readonly: 'readOnly',
2371 referrerpolicy: 'referrerPolicy',
2372 rel: 'rel',
2373 required: 'required',
2374 reversed: 'reversed',
2375 role: 'role',
2376 rows: 'rows',
2377 rowspan: 'rowSpan',
2378 sandbox: 'sandbox',
2379 scope: 'scope',
2380 scoped: 'scoped',
2381 scrolling: 'scrolling',
2382 seamless: 'seamless',
2383 selected: 'selected',
2384 shape: 'shape',
2385 size: 'size',
2386 sizes: 'sizes',
2387 span: 'span',
2388 spellcheck: 'spellCheck',
2389 src: 'src',
2390 srcdoc: 'srcDoc',
2391 srclang: 'srcLang',
2392 srcset: 'srcSet',
2393 start: 'start',
2394 step: 'step',
2395 style: 'style',
2396 summary: 'summary',
2397 tabindex: 'tabIndex',
2398 target: 'target',
2399 title: 'title',
2400 type: 'type',
2401 usemap: 'useMap',
2402 value: 'value',
2403 width: 'width',
2404 wmode: 'wmode',
2405 wrap: 'wrap',
2406 // SVG
2407 about: 'about',
2408 accentheight: 'accentHeight',
2409 'accent-height': 'accentHeight',
2410 accumulate: 'accumulate',
2411 additive: 'additive',
2412 alignmentbaseline: 'alignmentBaseline',
2413 'alignment-baseline': 'alignmentBaseline',
2414 allowreorder: 'allowReorder',
2415 alphabetic: 'alphabetic',
2416 amplitude: 'amplitude',
2417 arabicform: 'arabicForm',
2418 'arabic-form': 'arabicForm',
2419 ascent: 'ascent',
2420 attributename: 'attributeName',
2421 attributetype: 'attributeType',
2422 autoreverse: 'autoReverse',
2423 azimuth: 'azimuth',
2424 basefrequency: 'baseFrequency',
2425 baselineshift: 'baselineShift',
2426 'baseline-shift': 'baselineShift',
2427 baseprofile: 'baseProfile',
2428 bbox: 'bbox',
2429 begin: 'begin',
2430 bias: 'bias',
2431 by: 'by',
2432 calcmode: 'calcMode',
2433 capheight: 'capHeight',
2434 'cap-height': 'capHeight',
2435 clip: 'clip',
2436 clippath: 'clipPath',
2437 'clip-path': 'clipPath',
2438 clippathunits: 'clipPathUnits',
2439 cliprule: 'clipRule',
2440 'clip-rule': 'clipRule',
2441 color: 'color',
2442 colorinterpolation: 'colorInterpolation',
2443 'color-interpolation': 'colorInterpolation',
2444 colorinterpolationfilters: 'colorInterpolationFilters',
2445 'color-interpolation-filters': 'colorInterpolationFilters',
2446 colorprofile: 'colorProfile',
2447 'color-profile': 'colorProfile',
2448 colorrendering: 'colorRendering',
2449 'color-rendering': 'colorRendering',
2450 contentscripttype: 'contentScriptType',
2451 contentstyletype: 'contentStyleType',
2452 cursor: 'cursor',
2453 cx: 'cx',
2454 cy: 'cy',
2455 d: 'd',
2456 datatype: 'datatype',
2457 decelerate: 'decelerate',
2458 descent: 'descent',
2459 diffuseconstant: 'diffuseConstant',
2460 direction: 'direction',
2461 display: 'display',
2462 divisor: 'divisor',
2463 dominantbaseline: 'dominantBaseline',
2464 'dominant-baseline': 'dominantBaseline',
2465 dur: 'dur',
2466 dx: 'dx',
2467 dy: 'dy',
2468 edgemode: 'edgeMode',
2469 elevation: 'elevation',
2470 enablebackground: 'enableBackground',
2471 'enable-background': 'enableBackground',
2472 end: 'end',
2473 exponent: 'exponent',
2474 externalresourcesrequired: 'externalResourcesRequired',
2475 fill: 'fill',
2476 fillopacity: 'fillOpacity',
2477 'fill-opacity': 'fillOpacity',
2478 fillrule: 'fillRule',
2479 'fill-rule': 'fillRule',
2480 filter: 'filter',
2481 filterres: 'filterRes',
2482 filterunits: 'filterUnits',
2483 floodopacity: 'floodOpacity',
2484 'flood-opacity': 'floodOpacity',
2485 floodcolor: 'floodColor',
2486 'flood-color': 'floodColor',
2487 focusable: 'focusable',
2488 fontfamily: 'fontFamily',
2489 'font-family': 'fontFamily',
2490 fontsize: 'fontSize',
2491 'font-size': 'fontSize',
2492 fontsizeadjust: 'fontSizeAdjust',
2493 'font-size-adjust': 'fontSizeAdjust',
2494 fontstretch: 'fontStretch',
2495 'font-stretch': 'fontStretch',
2496 fontstyle: 'fontStyle',
2497 'font-style': 'fontStyle',
2498 fontvariant: 'fontVariant',
2499 'font-variant': 'fontVariant',
2500 fontweight: 'fontWeight',
2501 'font-weight': 'fontWeight',
2502 format: 'format',
2503 from: 'from',
2504 fx: 'fx',
2505 fy: 'fy',
2506 g1: 'g1',
2507 g2: 'g2',
2508 glyphname: 'glyphName',
2509 'glyph-name': 'glyphName',
2510 glyphorientationhorizontal: 'glyphOrientationHorizontal',
2511 'glyph-orientation-horizontal': 'glyphOrientationHorizontal',
2512 glyphorientationvertical: 'glyphOrientationVertical',
2513 'glyph-orientation-vertical': 'glyphOrientationVertical',
2514 glyphref: 'glyphRef',
2515 gradienttransform: 'gradientTransform',
2516 gradientunits: 'gradientUnits',
2517 hanging: 'hanging',
2518 horizadvx: 'horizAdvX',
2519 'horiz-adv-x': 'horizAdvX',
2520 horizoriginx: 'horizOriginX',
2521 'horiz-origin-x': 'horizOriginX',
2522 ideographic: 'ideographic',
2523 imagerendering: 'imageRendering',
2524 'image-rendering': 'imageRendering',
2525 in2: 'in2',
2526 in: 'in',
2527 inlist: 'inlist',
2528 intercept: 'intercept',
2529 k1: 'k1',
2530 k2: 'k2',
2531 k3: 'k3',
2532 k4: 'k4',
2533 k: 'k',
2534 kernelmatrix: 'kernelMatrix',
2535 kernelunitlength: 'kernelUnitLength',
2536 kerning: 'kerning',
2537 keypoints: 'keyPoints',
2538 keysplines: 'keySplines',
2539 keytimes: 'keyTimes',
2540 lengthadjust: 'lengthAdjust',
2541 letterspacing: 'letterSpacing',
2542 'letter-spacing': 'letterSpacing',
2543 lightingcolor: 'lightingColor',
2544 'lighting-color': 'lightingColor',
2545 limitingconeangle: 'limitingConeAngle',
2546 local: 'local',
2547 markerend: 'markerEnd',
2548 'marker-end': 'markerEnd',
2549 markerheight: 'markerHeight',
2550 markermid: 'markerMid',
2551 'marker-mid': 'markerMid',
2552 markerstart: 'markerStart',
2553 'marker-start': 'markerStart',
2554 markerunits: 'markerUnits',
2555 markerwidth: 'markerWidth',
2556 mask: 'mask',
2557 maskcontentunits: 'maskContentUnits',
2558 maskunits: 'maskUnits',
2559 mathematical: 'mathematical',
2560 mode: 'mode',
2561 numoctaves: 'numOctaves',
2562 offset: 'offset',
2563 opacity: 'opacity',
2564 operator: 'operator',
2565 order: 'order',
2566 orient: 'orient',
2567 orientation: 'orientation',
2568 origin: 'origin',
2569 overflow: 'overflow',
2570 overlineposition: 'overlinePosition',
2571 'overline-position': 'overlinePosition',
2572 overlinethickness: 'overlineThickness',
2573 'overline-thickness': 'overlineThickness',
2574 paintorder: 'paintOrder',
2575 'paint-order': 'paintOrder',
2576 panose1: 'panose1',
2577 'panose-1': 'panose1',
2578 pathlength: 'pathLength',
2579 patterncontentunits: 'patternContentUnits',
2580 patterntransform: 'patternTransform',
2581 patternunits: 'patternUnits',
2582 pointerevents: 'pointerEvents',
2583 'pointer-events': 'pointerEvents',
2584 points: 'points',
2585 pointsatx: 'pointsAtX',
2586 pointsaty: 'pointsAtY',
2587 pointsatz: 'pointsAtZ',
2588 prefix: 'prefix',
2589 preservealpha: 'preserveAlpha',
2590 preserveaspectratio: 'preserveAspectRatio',
2591 primitiveunits: 'primitiveUnits',
2592 property: 'property',
2593 r: 'r',
2594 radius: 'radius',
2595 refx: 'refX',
2596 refy: 'refY',
2597 renderingintent: 'renderingIntent',
2598 'rendering-intent': 'renderingIntent',
2599 repeatcount: 'repeatCount',
2600 repeatdur: 'repeatDur',
2601 requiredextensions: 'requiredExtensions',
2602 requiredfeatures: 'requiredFeatures',
2603 resource: 'resource',
2604 restart: 'restart',
2605 result: 'result',
2606 results: 'results',
2607 rotate: 'rotate',
2608 rx: 'rx',
2609 ry: 'ry',
2610 scale: 'scale',
2611 security: 'security',
2612 seed: 'seed',
2613 shaperendering: 'shapeRendering',
2614 'shape-rendering': 'shapeRendering',
2615 slope: 'slope',
2616 spacing: 'spacing',
2617 specularconstant: 'specularConstant',
2618 specularexponent: 'specularExponent',
2619 speed: 'speed',
2620 spreadmethod: 'spreadMethod',
2621 startoffset: 'startOffset',
2622 stddeviation: 'stdDeviation',
2623 stemh: 'stemh',
2624 stemv: 'stemv',
2625 stitchtiles: 'stitchTiles',
2626 stopcolor: 'stopColor',
2627 'stop-color': 'stopColor',
2628 stopopacity: 'stopOpacity',
2629 'stop-opacity': 'stopOpacity',
2630 strikethroughposition: 'strikethroughPosition',
2631 'strikethrough-position': 'strikethroughPosition',
2632 strikethroughthickness: 'strikethroughThickness',
2633 'strikethrough-thickness': 'strikethroughThickness',
2634 string: 'string',
2635 stroke: 'stroke',
2636 strokedasharray: 'strokeDasharray',
2637 'stroke-dasharray': 'strokeDasharray',
2638 strokedashoffset: 'strokeDashoffset',
2639 'stroke-dashoffset': 'strokeDashoffset',
2640 strokelinecap: 'strokeLinecap',
2641 'stroke-linecap': 'strokeLinecap',
2642 strokelinejoin: 'strokeLinejoin',
2643 'stroke-linejoin': 'strokeLinejoin',
2644 strokemiterlimit: 'strokeMiterlimit',
2645 'stroke-miterlimit': 'strokeMiterlimit',
2646 strokewidth: 'strokeWidth',
2647 'stroke-width': 'strokeWidth',
2648 strokeopacity: 'strokeOpacity',
2649 'stroke-opacity': 'strokeOpacity',
2650 suppresscontenteditablewarning: 'suppressContentEditableWarning',
2651 suppresshydrationwarning: 'suppressHydrationWarning',
2652 surfacescale: 'surfaceScale',
2653 systemlanguage: 'systemLanguage',
2654 tablevalues: 'tableValues',
2655 targetx: 'targetX',
2656 targety: 'targetY',
2657 textanchor: 'textAnchor',
2658 'text-anchor': 'textAnchor',
2659 textdecoration: 'textDecoration',
2660 'text-decoration': 'textDecoration',
2661 textlength: 'textLength',
2662 textrendering: 'textRendering',
2663 'text-rendering': 'textRendering',
2664 to: 'to',
2665 transform: 'transform',
2666 typeof: 'typeof',
2667 u1: 'u1',
2668 u2: 'u2',
2669 underlineposition: 'underlinePosition',
2670 'underline-position': 'underlinePosition',
2671 underlinethickness: 'underlineThickness',
2672 'underline-thickness': 'underlineThickness',
2673 unicode: 'unicode',
2674 unicodebidi: 'unicodeBidi',
2675 'unicode-bidi': 'unicodeBidi',
2676 unicoderange: 'unicodeRange',
2677 'unicode-range': 'unicodeRange',
2678 unitsperem: 'unitsPerEm',
2679 'units-per-em': 'unitsPerEm',
2680 unselectable: 'unselectable',
2681 valphabetic: 'vAlphabetic',
2682 'v-alphabetic': 'vAlphabetic',
2683 values: 'values',
2684 vectoreffect: 'vectorEffect',
2685 'vector-effect': 'vectorEffect',
2686 version: 'version',
2687 vertadvy: 'vertAdvY',
2688 'vert-adv-y': 'vertAdvY',
2689 vertoriginx: 'vertOriginX',
2690 'vert-origin-x': 'vertOriginX',
2691 vertoriginy: 'vertOriginY',
2692 'vert-origin-y': 'vertOriginY',
2693 vhanging: 'vHanging',
2694 'v-hanging': 'vHanging',
2695 videographic: 'vIdeographic',
2696 'v-ideographic': 'vIdeographic',
2697 viewbox: 'viewBox',
2698 viewtarget: 'viewTarget',
2699 visibility: 'visibility',
2700 vmathematical: 'vMathematical',
2701 'v-mathematical': 'vMathematical',
2702 vocab: 'vocab',
2703 widths: 'widths',
2704 wordspacing: 'wordSpacing',
2705 'word-spacing': 'wordSpacing',
2706 writingmode: 'writingMode',
2707 'writing-mode': 'writingMode',
2708 x1: 'x1',
2709 x2: 'x2',
2710 x: 'x',
2711 xchannelselector: 'xChannelSelector',
2712 xheight: 'xHeight',
2713 'x-height': 'xHeight',
2714 xlinkactuate: 'xlinkActuate',
2715 'xlink:actuate': 'xlinkActuate',
2716 xlinkarcrole: 'xlinkArcrole',
2717 'xlink:arcrole': 'xlinkArcrole',
2718 xlinkhref: 'xlinkHref',
2719 'xlink:href': 'xlinkHref',
2720 xlinkrole: 'xlinkRole',
2721 'xlink:role': 'xlinkRole',
2722 xlinkshow: 'xlinkShow',
2723 'xlink:show': 'xlinkShow',
2724 xlinktitle: 'xlinkTitle',
2725 'xlink:title': 'xlinkTitle',
2726 xlinktype: 'xlinkType',
2727 'xlink:type': 'xlinkType',
2728 xmlbase: 'xmlBase',
2729 'xml:base': 'xmlBase',
2730 xmllang: 'xmlLang',
2731 'xml:lang': 'xmlLang',
2732 xmlns: 'xmlns',
2733 'xml:space': 'xmlSpace',
2734 xmlnsxlink: 'xmlnsXlink',
2735 'xmlns:xlink': 'xmlnsXlink',
2736 xmlspace: 'xmlSpace',
2737 y1: 'y1',
2738 y2: 'y2',
2739 y: 'y',
2740 ychannelselector: 'yChannelSelector',
2741 z: 'z',
2742 zoomandpan: 'zoomAndPan'
2743 };
2744
2745 var validateProperty$1 = function () {};
2746
2747 {
2748 var warnedProperties$1 = {};
2749 var _hasOwnProperty = Object.prototype.hasOwnProperty;
2750 var EVENT_NAME_REGEX = /^on./;
2751 var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
2752 var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
2753 var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
2754
2755 validateProperty$1 = function (tagName, name, value, eventRegistry) {
2756 if (_hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
2757 return true;
2758 }
2759
2760 var lowerCasedName = name.toLowerCase();
2761
2762 if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
2763 error('React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
2764
2765 warnedProperties$1[name] = true;
2766 return true;
2767 } // We can't rely on the event system being injected on the server.
2768
2769
2770 if (eventRegistry != null) {
2771 var registrationNameDependencies = eventRegistry.registrationNameDependencies,
2772 possibleRegistrationNames = eventRegistry.possibleRegistrationNames;
2773
2774 if (registrationNameDependencies.hasOwnProperty(name)) {
2775 return true;
2776 }
2777
2778 var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
2779
2780 if (registrationName != null) {
2781 error('Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName);
2782
2783 warnedProperties$1[name] = true;
2784 return true;
2785 }
2786
2787 if (EVENT_NAME_REGEX.test(name)) {
2788 error('Unknown event handler property `%s`. It will be ignored.', name);
2789
2790 warnedProperties$1[name] = true;
2791 return true;
2792 }
2793 } else if (EVENT_NAME_REGEX.test(name)) {
2794 // If no event plugins have been injected, we are in a server environment.
2795 // So we can't tell if the event name is correct for sure, but we can filter
2796 // out known bad ones like `onclick`. We can't suggest a specific replacement though.
2797 if (INVALID_EVENT_NAME_REGEX.test(name)) {
2798 error('Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name);
2799 }
2800
2801 warnedProperties$1[name] = true;
2802 return true;
2803 } // Let the ARIA attribute hook validate ARIA attributes
2804
2805
2806 if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
2807 return true;
2808 }
2809
2810 if (lowerCasedName === 'innerhtml') {
2811 error('Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
2812
2813 warnedProperties$1[name] = true;
2814 return true;
2815 }
2816
2817 if (lowerCasedName === 'aria') {
2818 error('The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
2819
2820 warnedProperties$1[name] = true;
2821 return true;
2822 }
2823
2824 if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
2825 error('Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value);
2826
2827 warnedProperties$1[name] = true;
2828 return true;
2829 }
2830
2831 if (typeof value === 'number' && isNaN(value)) {
2832 error('Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name);
2833
2834 warnedProperties$1[name] = true;
2835 return true;
2836 }
2837
2838 var propertyInfo = getPropertyInfo(name);
2839 var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED; // Known attributes should match the casing specified in the property config.
2840
2841 if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
2842 var standardName = possibleStandardNames[lowerCasedName];
2843
2844 if (standardName !== name) {
2845 error('Invalid DOM property `%s`. Did you mean `%s`?', name, standardName);
2846
2847 warnedProperties$1[name] = true;
2848 return true;
2849 }
2850 } else if (!isReserved && name !== lowerCasedName) {
2851 // Unknown attributes should have lowercase casing since that's how they
2852 // will be cased anyway with server rendering.
2853 error('React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.', name, lowerCasedName);
2854
2855 warnedProperties$1[name] = true;
2856 return true;
2857 }
2858
2859 if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
2860 if (value) {
2861 error('Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.', value, name, name, value, name);
2862 } else {
2863 error('Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name);
2864 }
2865
2866 warnedProperties$1[name] = true;
2867 return true;
2868 } // Now that we've validated casing, do not validate
2869 // data types for reserved props
2870
2871
2872 if (isReserved) {
2873 return true;
2874 } // Warn when a known attribute is a bad type
2875
2876
2877 if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
2878 warnedProperties$1[name] = true;
2879 return false;
2880 } // Warn when passing the strings 'false' or 'true' into a boolean prop
2881
2882
2883 if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
2884 error('Received the string `%s` for the boolean attribute `%s`. ' + '%s ' + 'Did you mean %s={%s}?', value, name, value === 'false' ? 'The browser will interpret it as a truthy value.' : 'Although this works, it will not work as expected if you pass the string "false".', name, value);
2885
2886 warnedProperties$1[name] = true;
2887 return true;
2888 }
2889
2890 return true;
2891 };
2892 }
2893
2894 var warnUnknownProperties = function (type, props, eventRegistry) {
2895 {
2896 var unknownProps = [];
2897
2898 for (var key in props) {
2899 var isValid = validateProperty$1(type, key, props[key], eventRegistry);
2900
2901 if (!isValid) {
2902 unknownProps.push(key);
2903 }
2904 }
2905
2906 var unknownPropString = unknownProps.map(function (prop) {
2907 return '`' + prop + '`';
2908 }).join(', ');
2909
2910 if (unknownProps.length === 1) {
2911 error('Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://reactjs.org/link/attribute-behavior ', unknownPropString, type);
2912 } else if (unknownProps.length > 1) {
2913 error('Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://reactjs.org/link/attribute-behavior ', unknownPropString, type);
2914 }
2915 }
2916 };
2917
2918 function validateProperties$2(type, props, eventRegistry) {
2919 if (isCustomComponent(type, props)) {
2920 return;
2921 }
2922
2923 warnUnknownProperties(type, props, eventRegistry);
2924 }
2925
2926 var toArray = React.Children.toArray; // This is only used in DEV.
2927 // Each entry is `this.stack` from a currently executing renderer instance.
2928 // (There may be more than one because ReactDOMServer is reentrant).
2929 // Each stack is an array of frames which may contain nested stacks of elements.
2930
2931 var currentDebugStacks = [];
2932 var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
2933 var ReactDebugCurrentFrame$1;
2934 var prevGetCurrentStackImpl = null;
2935
2936 var getCurrentServerStackImpl = function () {
2937 return '';
2938 };
2939
2940 var describeStackFrame = function (element) {
2941 return '';
2942 };
2943
2944 var validatePropertiesInDevelopment = function (type, props) {};
2945
2946 var pushCurrentDebugStack = function (stack) {};
2947
2948 var pushElementToDebugStack = function (element) {};
2949
2950 var popCurrentDebugStack = function () {};
2951
2952 var hasWarnedAboutUsingContextAsConsumer = false;
2953
2954 {
2955 ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
2956
2957 validatePropertiesInDevelopment = function (type, props) {
2958 validateProperties(type, props);
2959 validateProperties$1(type, props);
2960 validateProperties$2(type, props, null);
2961 };
2962
2963 describeStackFrame = function (element) {
2964 return describeUnknownElementTypeFrameInDEV(element.type, element._source, null);
2965 };
2966
2967 pushCurrentDebugStack = function (stack) {
2968 currentDebugStacks.push(stack);
2969
2970 if (currentDebugStacks.length === 1) {
2971 // We are entering a server renderer.
2972 // Remember the previous (e.g. client) global stack implementation.
2973 prevGetCurrentStackImpl = ReactDebugCurrentFrame$1.getCurrentStack;
2974 ReactDebugCurrentFrame$1.getCurrentStack = getCurrentServerStackImpl;
2975 }
2976 };
2977
2978 pushElementToDebugStack = function (element) {
2979 // For the innermost executing ReactDOMServer call,
2980 var stack = currentDebugStacks[currentDebugStacks.length - 1]; // Take the innermost executing frame (e.g. <Foo>),
2981
2982 var frame = stack[stack.length - 1]; // and record that it has one more element associated with it.
2983
2984 frame.debugElementStack.push(element); // We only need this because we tail-optimize single-element
2985 // children and directly handle them in an inner loop instead of
2986 // creating separate frames for them.
2987 };
2988
2989 popCurrentDebugStack = function () {
2990 currentDebugStacks.pop();
2991
2992 if (currentDebugStacks.length === 0) {
2993 // We are exiting the server renderer.
2994 // Restore the previous (e.g. client) global stack implementation.
2995 ReactDebugCurrentFrame$1.getCurrentStack = prevGetCurrentStackImpl;
2996 prevGetCurrentStackImpl = null;
2997 }
2998 };
2999
3000 getCurrentServerStackImpl = function () {
3001 if (currentDebugStacks.length === 0) {
3002 // Nothing is currently rendering.
3003 return '';
3004 } // ReactDOMServer is reentrant so there may be multiple calls at the same time.
3005 // Take the frames from the innermost call which is the last in the array.
3006
3007
3008 var frames = currentDebugStacks[currentDebugStacks.length - 1];
3009 var stack = ''; // Go through every frame in the stack from the innermost one.
3010
3011 for (var i = frames.length - 1; i >= 0; i--) {
3012 var frame = frames[i]; // Every frame might have more than one debug element stack entry associated with it.
3013 // This is because single-child nesting doesn't create materialized frames.
3014 // Instead it would push them through `pushElementToDebugStack()`.
3015
3016 var debugElementStack = frame.debugElementStack;
3017
3018 for (var ii = debugElementStack.length - 1; ii >= 0; ii--) {
3019 stack += describeStackFrame(debugElementStack[ii]);
3020 }
3021 }
3022
3023 return stack;
3024 };
3025 }
3026
3027 var didWarnDefaultInputValue = false;
3028 var didWarnDefaultChecked = false;
3029 var didWarnDefaultSelectValue = false;
3030 var didWarnDefaultTextareaValue = false;
3031 var didWarnInvalidOptionChildren = false;
3032 var didWarnAboutNoopUpdateForComponent = {};
3033 var didWarnAboutBadClass = {};
3034 var didWarnAboutModulePatternComponent = {};
3035 var didWarnAboutDeprecatedWillMount = {};
3036 var didWarnAboutUndefinedDerivedState = {};
3037 var didWarnAboutUninitializedState = {};
3038 var valuePropNames = ['value', 'defaultValue'];
3039 var newlineEatingTags = {
3040 listing: true,
3041 pre: true,
3042 textarea: true
3043 }; // We accept any tag to be rendered but since this gets injected into arbitrary
3044 // HTML, we want to make sure that it's a safe tag.
3045 // http://www.w3.org/TR/REC-xml/#NT-Name
3046
3047 var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
3048
3049 var validatedTagCache = {};
3050
3051 function validateDangerousTag(tag) {
3052 if (!validatedTagCache.hasOwnProperty(tag)) {
3053 if (!VALID_TAG_REGEX.test(tag)) {
3054 {
3055 throw Error( "Invalid tag: " + tag );
3056 }
3057 }
3058
3059 validatedTagCache[tag] = true;
3060 }
3061 }
3062
3063 var styleNameCache = {};
3064
3065 var processStyleName = function (styleName) {
3066 if (styleNameCache.hasOwnProperty(styleName)) {
3067 return styleNameCache[styleName];
3068 }
3069
3070 var result = hyphenateStyleName(styleName);
3071 styleNameCache[styleName] = result;
3072 return result;
3073 };
3074
3075 function createMarkupForStyles(styles) {
3076 var serialized = '';
3077 var delimiter = '';
3078
3079 for (var styleName in styles) {
3080 if (!styles.hasOwnProperty(styleName)) {
3081 continue;
3082 }
3083
3084 var isCustomProperty = styleName.indexOf('--') === 0;
3085 var styleValue = styles[styleName];
3086
3087 {
3088 if (!isCustomProperty) {
3089 warnValidStyle$1(styleName, styleValue);
3090 }
3091 }
3092
3093 if (styleValue != null) {
3094 serialized += delimiter + (isCustomProperty ? styleName : processStyleName(styleName)) + ':';
3095 serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
3096 delimiter = ';';
3097 }
3098 }
3099
3100 return serialized || null;
3101 }
3102
3103 function warnNoop(publicInstance, callerName) {
3104 {
3105 var _constructor = publicInstance.constructor;
3106 var componentName = _constructor && getComponentName(_constructor) || 'ReactClass';
3107 var warningKey = componentName + '.' + callerName;
3108
3109 if (didWarnAboutNoopUpdateForComponent[warningKey]) {
3110 return;
3111 }
3112
3113 error('%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, componentName);
3114
3115 didWarnAboutNoopUpdateForComponent[warningKey] = true;
3116 }
3117 }
3118
3119 function shouldConstruct$1(Component) {
3120 return Component.prototype && Component.prototype.isReactComponent;
3121 }
3122
3123 function getNonChildrenInnerMarkup(props) {
3124 var innerHTML = props.dangerouslySetInnerHTML;
3125
3126 if (innerHTML != null) {
3127 if (innerHTML.__html != null) {
3128 return innerHTML.__html;
3129 }
3130 } else {
3131 var content = props.children;
3132
3133 if (typeof content === 'string' || typeof content === 'number') {
3134 return escapeTextForBrowser(content);
3135 }
3136 }
3137
3138 return null;
3139 }
3140
3141 function flattenTopLevelChildren(children) {
3142 if (!React.isValidElement(children)) {
3143 return toArray(children);
3144 }
3145
3146 var element = children;
3147
3148 if (element.type !== REACT_FRAGMENT_TYPE) {
3149 return [element];
3150 }
3151
3152 var fragmentChildren = element.props.children;
3153
3154 if (!React.isValidElement(fragmentChildren)) {
3155 return toArray(fragmentChildren);
3156 }
3157
3158 var fragmentChildElement = fragmentChildren;
3159 return [fragmentChildElement];
3160 }
3161
3162 function flattenOptionChildren(children) {
3163 if (children === undefined || children === null) {
3164 return children;
3165 }
3166
3167 var content = ''; // Flatten children and warn if they aren't strings or numbers;
3168 // invalid types are ignored.
3169
3170 React.Children.forEach(children, function (child) {
3171 if (child == null) {
3172 return;
3173 }
3174
3175 content += child;
3176
3177 {
3178 if (!didWarnInvalidOptionChildren && typeof child !== 'string' && typeof child !== 'number') {
3179 didWarnInvalidOptionChildren = true;
3180
3181 error('Only strings and numbers are supported as <option> children.');
3182 }
3183 }
3184 });
3185 return content;
3186 }
3187
3188 var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
3189 var STYLE = 'style';
3190 var RESERVED_PROPS = {
3191 children: null,
3192 dangerouslySetInnerHTML: null,
3193 suppressContentEditableWarning: null,
3194 suppressHydrationWarning: null
3195 };
3196
3197 function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeStaticMarkup, isRootElement) {
3198 var ret = '<' + tagVerbatim;
3199 var isCustomComponent$1 = isCustomComponent(tagLowercase, props);
3200
3201 for (var propKey in props) {
3202 if (!hasOwnProperty$2.call(props, propKey)) {
3203 continue;
3204 }
3205
3206 var propValue = props[propKey];
3207
3208 if (propValue == null) {
3209 continue;
3210 }
3211
3212 if (propKey === STYLE) {
3213 propValue = createMarkupForStyles(propValue);
3214 }
3215
3216 var markup = null;
3217
3218 if (isCustomComponent$1) {
3219 if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
3220 markup = createMarkupForCustomAttribute(propKey, propValue);
3221 }
3222 } else {
3223 markup = createMarkupForProperty(propKey, propValue);
3224 }
3225
3226 if (markup) {
3227 ret += ' ' + markup;
3228 }
3229 } // For static pages, no need to put React ID and checksum. Saves lots of
3230 // bytes.
3231
3232
3233 if (makeStaticMarkup) {
3234 return ret;
3235 }
3236
3237 if (isRootElement) {
3238 ret += ' ' + createMarkupForRoot();
3239 }
3240
3241 return ret;
3242 }
3243
3244 function validateRenderResult(child, type) {
3245 if (child === undefined) {
3246 {
3247 {
3248 throw Error( (getComponentName(type) || 'Component') + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." );
3249 }
3250 }
3251 }
3252 }
3253
3254 function resolve(child, context, threadID) {
3255 while (React.isValidElement(child)) {
3256 // Safe because we just checked it's an element.
3257 var element = child;
3258 var Component = element.type;
3259
3260 {
3261 pushElementToDebugStack(element);
3262 }
3263
3264 if (typeof Component !== 'function') {
3265 break;
3266 }
3267
3268 processChild(element, Component);
3269 } // Extra closure so queue and replace can be captured properly
3270
3271
3272 function processChild(element, Component) {
3273 var isClass = shouldConstruct$1(Component);
3274 var publicContext = processContext(Component, context, threadID, isClass);
3275 var queue = [];
3276 var replace = false;
3277 var updater = {
3278 isMounted: function (publicInstance) {
3279 return false;
3280 },
3281 enqueueForceUpdate: function (publicInstance) {
3282 if (queue === null) {
3283 warnNoop(publicInstance, 'forceUpdate');
3284 return null;
3285 }
3286 },
3287 enqueueReplaceState: function (publicInstance, completeState) {
3288 replace = true;
3289 queue = [completeState];
3290 },
3291 enqueueSetState: function (publicInstance, currentPartialState) {
3292 if (queue === null) {
3293 warnNoop(publicInstance, 'setState');
3294 return null;
3295 }
3296
3297 queue.push(currentPartialState);
3298 }
3299 };
3300 var inst;
3301
3302 if (isClass) {
3303 inst = new Component(element.props, publicContext, updater);
3304
3305 if (typeof Component.getDerivedStateFromProps === 'function') {
3306 {
3307 if (inst.state === null || inst.state === undefined) {
3308 var componentName = getComponentName(Component) || 'Unknown';
3309
3310 if (!didWarnAboutUninitializedState[componentName]) {
3311 error('`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, inst.state === null ? 'null' : 'undefined', componentName);
3312
3313 didWarnAboutUninitializedState[componentName] = true;
3314 }
3315 }
3316 }
3317
3318 var partialState = Component.getDerivedStateFromProps.call(null, element.props, inst.state);
3319
3320 {
3321 if (partialState === undefined) {
3322 var _componentName = getComponentName(Component) || 'Unknown';
3323
3324 if (!didWarnAboutUndefinedDerivedState[_componentName]) {
3325 error('%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', _componentName);
3326
3327 didWarnAboutUndefinedDerivedState[_componentName] = true;
3328 }
3329 }
3330 }
3331
3332 if (partialState != null) {
3333 inst.state = _assign({}, inst.state, partialState);
3334 }
3335 }
3336 } else {
3337 {
3338 if (Component.prototype && typeof Component.prototype.render === 'function') {
3339 var _componentName2 = getComponentName(Component) || 'Unknown';
3340
3341 if (!didWarnAboutBadClass[_componentName2]) {
3342 error("The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', _componentName2, _componentName2);
3343
3344 didWarnAboutBadClass[_componentName2] = true;
3345 }
3346 }
3347 }
3348
3349 var componentIdentity = {};
3350 prepareToUseHooks(componentIdentity);
3351 inst = Component(element.props, publicContext, updater);
3352 inst = finishHooks(Component, element.props, inst, publicContext);
3353
3354 {
3355 // Support for module components is deprecated and is removed behind a flag.
3356 // Whether or not it would crash later, we want to show a good message in DEV first.
3357 if (inst != null && inst.render != null) {
3358 var _componentName3 = getComponentName(Component) || 'Unknown';
3359
3360 if (!didWarnAboutModulePatternComponent[_componentName3]) {
3361 error('The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName3, _componentName3, _componentName3);
3362
3363 didWarnAboutModulePatternComponent[_componentName3] = true;
3364 }
3365 }
3366 } // If the flag is on, everything is assumed to be a function component.
3367 // Otherwise, we also do the unfortunate dynamic checks.
3368
3369
3370 if ( inst == null || inst.render == null) {
3371 child = inst;
3372 validateRenderResult(child, Component);
3373 return;
3374 }
3375 }
3376
3377 inst.props = element.props;
3378 inst.context = publicContext;
3379 inst.updater = updater;
3380 var initialState = inst.state;
3381
3382 if (initialState === undefined) {
3383 inst.state = initialState = null;
3384 }
3385
3386 if (typeof inst.UNSAFE_componentWillMount === 'function' || typeof inst.componentWillMount === 'function') {
3387 if (typeof inst.componentWillMount === 'function') {
3388 {
3389 if ( inst.componentWillMount.__suppressDeprecationWarning !== true) {
3390 var _componentName4 = getComponentName(Component) || 'Unknown';
3391
3392 if (!didWarnAboutDeprecatedWillMount[_componentName4]) {
3393 warn( // keep this warning in sync with ReactStrictModeWarning.js
3394 'componentWillMount has been renamed, and is not recommended for use. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move code from componentWillMount to componentDidMount (preferred in most cases) ' + 'or the constructor.\n' + '\nPlease update the following components: %s', _componentName4);
3395
3396 didWarnAboutDeprecatedWillMount[_componentName4] = true;
3397 }
3398 }
3399 } // In order to support react-lifecycles-compat polyfilled components,
3400 // Unsafe lifecycles should not be invoked for any component with the new gDSFP.
3401
3402
3403 if (typeof Component.getDerivedStateFromProps !== 'function') {
3404 inst.componentWillMount();
3405 }
3406 }
3407
3408 if (typeof inst.UNSAFE_componentWillMount === 'function' && typeof Component.getDerivedStateFromProps !== 'function') {
3409 // In order to support react-lifecycles-compat polyfilled components,
3410 // Unsafe lifecycles should not be invoked for any component with the new gDSFP.
3411 inst.UNSAFE_componentWillMount();
3412 }
3413
3414 if (queue.length) {
3415 var oldQueue = queue;
3416 var oldReplace = replace;
3417 queue = null;
3418 replace = false;
3419
3420 if (oldReplace && oldQueue.length === 1) {
3421 inst.state = oldQueue[0];
3422 } else {
3423 var nextState = oldReplace ? oldQueue[0] : inst.state;
3424 var dontMutate = true;
3425
3426 for (var i = oldReplace ? 1 : 0; i < oldQueue.length; i++) {
3427 var partial = oldQueue[i];
3428
3429 var _partialState = typeof partial === 'function' ? partial.call(inst, nextState, element.props, publicContext) : partial;
3430
3431 if (_partialState != null) {
3432 if (dontMutate) {
3433 dontMutate = false;
3434 nextState = _assign({}, nextState, _partialState);
3435 } else {
3436 _assign(nextState, _partialState);
3437 }
3438 }
3439 }
3440
3441 inst.state = nextState;
3442 }
3443 } else {
3444 queue = null;
3445 }
3446 }
3447
3448 child = inst.render();
3449
3450 {
3451 if (child === undefined && inst.render._isMockFunction) {
3452 // This is probably bad practice. Consider warning here and
3453 // deprecating this convenience.
3454 child = null;
3455 }
3456 }
3457
3458 validateRenderResult(child, Component);
3459 var childContext;
3460
3461 {
3462 if (typeof inst.getChildContext === 'function') {
3463 var _childContextTypes = Component.childContextTypes;
3464
3465 if (typeof _childContextTypes === 'object') {
3466 childContext = inst.getChildContext();
3467
3468 for (var contextKey in childContext) {
3469 if (!(contextKey in _childContextTypes)) {
3470 {
3471 throw Error( (getComponentName(Component) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes." );
3472 }
3473 }
3474 }
3475 } else {
3476 {
3477 error('%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(Component) || 'Unknown');
3478 }
3479 }
3480 }
3481
3482 if (childContext) {
3483 context = _assign({}, context, childContext);
3484 }
3485 }
3486 }
3487
3488 return {
3489 child: child,
3490 context: context
3491 };
3492 }
3493
3494 var ReactDOMServerRenderer = /*#__PURE__*/function () {
3495 // TODO: type this more strictly:
3496 // DEV-only
3497 function ReactDOMServerRenderer(children, makeStaticMarkup, options) {
3498 var flatChildren = flattenTopLevelChildren(children);
3499 var topFrame = {
3500 type: null,
3501 // Assume all trees start in the HTML namespace (not totally true, but
3502 // this is what we did historically)
3503 domNamespace: Namespaces.html,
3504 children: flatChildren,
3505 childIndex: 0,
3506 context: emptyObject,
3507 footer: ''
3508 };
3509
3510 {
3511 topFrame.debugElementStack = [];
3512 }
3513
3514 this.threadID = allocThreadID();
3515 this.stack = [topFrame];
3516 this.exhausted = false;
3517 this.currentSelectValue = null;
3518 this.previousWasTextNode = false;
3519 this.makeStaticMarkup = makeStaticMarkup;
3520 this.suspenseDepth = 0; // Context (new API)
3521
3522 this.contextIndex = -1;
3523 this.contextStack = [];
3524 this.contextValueStack = []; // useOpaqueIdentifier ID
3525
3526 this.uniqueID = 0;
3527 this.identifierPrefix = options && options.identifierPrefix || '';
3528
3529 {
3530 this.contextProviderStack = [];
3531 }
3532 }
3533
3534 var _proto = ReactDOMServerRenderer.prototype;
3535
3536 _proto.destroy = function destroy() {
3537 if (!this.exhausted) {
3538 this.exhausted = true;
3539 this.clearProviders();
3540 freeThreadID(this.threadID);
3541 }
3542 }
3543 /**
3544 * Note: We use just two stacks regardless of how many context providers you have.
3545 * Providers are always popped in the reverse order to how they were pushed
3546 * so we always know on the way down which provider you'll encounter next on the way up.
3547 * On the way down, we push the current provider, and its context value *before*
3548 * we mutated it, onto the stacks. Therefore, on the way up, we always know which
3549 * provider needs to be "restored" to which value.
3550 * https://github.com/facebook/react/pull/12985#issuecomment-396301248
3551 */
3552 ;
3553
3554 _proto.pushProvider = function pushProvider(provider) {
3555 var index = ++this.contextIndex;
3556 var context = provider.type._context;
3557 var threadID = this.threadID;
3558 validateContextBounds(context, threadID);
3559 var previousValue = context[threadID]; // Remember which value to restore this context to on our way up.
3560
3561 this.contextStack[index] = context;
3562 this.contextValueStack[index] = previousValue;
3563
3564 {
3565 // Only used for push/pop mismatch warnings.
3566 this.contextProviderStack[index] = provider;
3567 } // Mutate the current value.
3568
3569
3570 context[threadID] = provider.props.value;
3571 };
3572
3573 _proto.popProvider = function popProvider(provider) {
3574 var index = this.contextIndex;
3575
3576 {
3577 if (index < 0 || provider !== this.contextProviderStack[index]) {
3578 error('Unexpected pop.');
3579 }
3580 }
3581
3582 var context = this.contextStack[index];
3583 var previousValue = this.contextValueStack[index]; // "Hide" these null assignments from Flow by using `any`
3584 // because conceptually they are deletions--as long as we
3585 // promise to never access values beyond `this.contextIndex`.
3586
3587 this.contextStack[index] = null;
3588 this.contextValueStack[index] = null;
3589
3590 {
3591 this.contextProviderStack[index] = null;
3592 }
3593
3594 this.contextIndex--; // Restore to the previous value we stored as we were walking down.
3595 // We've already verified that this context has been expanded to accommodate
3596 // this thread id, so we don't need to do it again.
3597
3598 context[this.threadID] = previousValue;
3599 };
3600
3601 _proto.clearProviders = function clearProviders() {
3602 // Restore any remaining providers on the stack to previous values
3603 for (var index = this.contextIndex; index >= 0; index--) {
3604 var context = this.contextStack[index];
3605 var previousValue = this.contextValueStack[index];
3606 context[this.threadID] = previousValue;
3607 }
3608 };
3609
3610 _proto.read = function read(bytes) {
3611 if (this.exhausted) {
3612 return null;
3613 }
3614
3615 var prevPartialRenderer = currentPartialRenderer;
3616 setCurrentPartialRenderer(this);
3617 var prevDispatcher = ReactCurrentDispatcher$1.current;
3618 ReactCurrentDispatcher$1.current = Dispatcher;
3619
3620 try {
3621 // Markup generated within <Suspense> ends up buffered until we know
3622 // nothing in that boundary suspended
3623 var out = [''];
3624 var suspended = false;
3625
3626 while (out[0].length < bytes) {
3627 if (this.stack.length === 0) {
3628 this.exhausted = true;
3629 freeThreadID(this.threadID);
3630 break;
3631 }
3632
3633 var frame = this.stack[this.stack.length - 1];
3634
3635 if (suspended || frame.childIndex >= frame.children.length) {
3636 var footer = frame.footer;
3637
3638 if (footer !== '') {
3639 this.previousWasTextNode = false;
3640 }
3641
3642 this.stack.pop();
3643
3644 if (frame.type === 'select') {
3645 this.currentSelectValue = null;
3646 } else if (frame.type != null && frame.type.type != null && frame.type.type.$$typeof === REACT_PROVIDER_TYPE) {
3647 var provider = frame.type;
3648 this.popProvider(provider);
3649 } else if (frame.type === REACT_SUSPENSE_TYPE) {
3650 this.suspenseDepth--;
3651 var buffered = out.pop();
3652
3653 if (suspended) {
3654 suspended = false; // If rendering was suspended at this boundary, render the fallbackFrame
3655
3656 var fallbackFrame = frame.fallbackFrame;
3657
3658 if (!fallbackFrame) {
3659 {
3660 throw Error(true ? "ReactDOMServer did not find an internal fallback frame for Suspense. This is a bug in React. Please file an issue." : formatProdErrorMessage(303));
3661 }
3662 }
3663
3664 this.stack.push(fallbackFrame);
3665 out[this.suspenseDepth] += '<!--$!-->'; // Skip flushing output since we're switching to the fallback
3666
3667 continue;
3668 } else {
3669 out[this.suspenseDepth] += buffered;
3670 }
3671 } // Flush output
3672
3673
3674 out[this.suspenseDepth] += footer;
3675 continue;
3676 }
3677
3678 var child = frame.children[frame.childIndex++];
3679 var outBuffer = '';
3680
3681 if (true) {
3682 pushCurrentDebugStack(this.stack); // We're starting work on this frame, so reset its inner stack.
3683
3684 frame.debugElementStack.length = 0;
3685 }
3686
3687 try {
3688 outBuffer += this.render(child, frame.context, frame.domNamespace);
3689 } catch (err) {
3690 if (err != null && typeof err.then === 'function') {
3691 if (enableSuspenseServerRenderer) {
3692 if (!(this.suspenseDepth > 0)) {
3693 {
3694 throw Error(true ? "A React component suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display." : formatProdErrorMessage(342));
3695 }
3696 }
3697
3698 suspended = true;
3699 } else {
3700 if (!false) {
3701 {
3702 throw Error(true ? "ReactDOMServer does not yet support Suspense." : formatProdErrorMessage(294));
3703 }
3704 }
3705 }
3706 } else {
3707 throw err;
3708 }
3709 } finally {
3710 if (true) {
3711 popCurrentDebugStack();
3712 }
3713 }
3714
3715 if (out.length <= this.suspenseDepth) {
3716 out.push('');
3717 }
3718
3719 out[this.suspenseDepth] += outBuffer;
3720 }
3721
3722 return out[0];
3723 } finally {
3724 ReactCurrentDispatcher$1.current = prevDispatcher;
3725 setCurrentPartialRenderer(prevPartialRenderer);
3726 resetHooksState();
3727 }
3728 };
3729
3730 _proto.render = function render(child, context, parentNamespace) {
3731 if (typeof child === 'string' || typeof child === 'number') {
3732 var text = '' + child;
3733
3734 if (text === '') {
3735 return '';
3736 }
3737
3738 if (this.makeStaticMarkup) {
3739 return escapeTextForBrowser(text);
3740 }
3741
3742 if (this.previousWasTextNode) {
3743 return '<!-- -->' + escapeTextForBrowser(text);
3744 }
3745
3746 this.previousWasTextNode = true;
3747 return escapeTextForBrowser(text);
3748 } else {
3749 var nextChild;
3750
3751 var _resolve = resolve(child, context, this.threadID);
3752
3753 nextChild = _resolve.child;
3754 context = _resolve.context;
3755
3756 if (nextChild === null || nextChild === false) {
3757 return '';
3758 } else if (!React.isValidElement(nextChild)) {
3759 if (nextChild != null && nextChild.$$typeof != null) {
3760 // Catch unexpected special types early.
3761 var $$typeof = nextChild.$$typeof;
3762
3763 if (!($$typeof !== REACT_PORTAL_TYPE)) {
3764 {
3765 throw Error( "Portals are not currently supported by the server renderer. Render them conditionally so that they only appear on the client render." );
3766 }
3767 } // Catch-all to prevent an infinite loop if React.Children.toArray() supports some new type.
3768
3769
3770 {
3771 {
3772 throw Error( "Unknown element-like object type: " + $$typeof.toString() + ". This is likely a bug in React. Please file an issue." );
3773 }
3774 }
3775 }
3776
3777 var nextChildren = toArray(nextChild);
3778 var frame = {
3779 type: null,
3780 domNamespace: parentNamespace,
3781 children: nextChildren,
3782 childIndex: 0,
3783 context: context,
3784 footer: ''
3785 };
3786
3787 {
3788 frame.debugElementStack = [];
3789 }
3790
3791 this.stack.push(frame);
3792 return '';
3793 } // Safe because we just checked it's an element.
3794
3795
3796 var nextElement = nextChild;
3797 var elementType = nextElement.type;
3798
3799 if (typeof elementType === 'string') {
3800 return this.renderDOM(nextElement, context, parentNamespace);
3801 }
3802
3803 switch (elementType) {
3804 // TODO: LegacyHidden acts the same as a fragment. This only works
3805 // because we currently assume that every instance of LegacyHidden is
3806 // accompanied by a host component wrapper. In the hidden mode, the host
3807 // component is given a `hidden` attribute, which ensures that the
3808 // initial HTML is not visible. To support the use of LegacyHidden as a
3809 // true fragment, without an extra DOM node, we would have to hide the
3810 // initial HTML in some other way.
3811 case REACT_LEGACY_HIDDEN_TYPE:
3812 case REACT_DEBUG_TRACING_MODE_TYPE:
3813 case REACT_STRICT_MODE_TYPE:
3814 case REACT_PROFILER_TYPE:
3815 case REACT_SUSPENSE_LIST_TYPE:
3816 case REACT_FRAGMENT_TYPE:
3817 {
3818 var _nextChildren = toArray(nextChild.props.children);
3819
3820 var _frame = {
3821 type: null,
3822 domNamespace: parentNamespace,
3823 children: _nextChildren,
3824 childIndex: 0,
3825 context: context,
3826 footer: ''
3827 };
3828
3829 {
3830 _frame.debugElementStack = [];
3831 }
3832
3833 this.stack.push(_frame);
3834 return '';
3835 }
3836
3837 case REACT_SUSPENSE_TYPE:
3838 {
3839 {
3840 {
3841 {
3842 throw Error( "ReactDOMServer does not yet support Suspense." );
3843 }
3844 }
3845 }
3846 }
3847 // eslint-disable-next-line-no-fallthrough
3848
3849 case REACT_SCOPE_TYPE:
3850 {
3851
3852 {
3853 {
3854 throw Error( "ReactDOMServer does not yet support scope components." );
3855 }
3856 }
3857 }
3858 }
3859
3860 if (typeof elementType === 'object' && elementType !== null) {
3861 switch (elementType.$$typeof) {
3862 case REACT_FORWARD_REF_TYPE:
3863 {
3864 var element = nextChild;
3865
3866 var _nextChildren5;
3867
3868 var componentIdentity = {};
3869 prepareToUseHooks(componentIdentity);
3870 _nextChildren5 = elementType.render(element.props, element.ref);
3871 _nextChildren5 = finishHooks(elementType.render, element.props, _nextChildren5, element.ref);
3872 _nextChildren5 = toArray(_nextChildren5);
3873 var _frame5 = {
3874 type: null,
3875 domNamespace: parentNamespace,
3876 children: _nextChildren5,
3877 childIndex: 0,
3878 context: context,
3879 footer: ''
3880 };
3881
3882 {
3883 _frame5.debugElementStack = [];
3884 }
3885
3886 this.stack.push(_frame5);
3887 return '';
3888 }
3889
3890 case REACT_MEMO_TYPE:
3891 {
3892 var _element = nextChild;
3893 var _nextChildren6 = [React.createElement(elementType.type, _assign({
3894 ref: _element.ref
3895 }, _element.props))];
3896 var _frame6 = {
3897 type: null,
3898 domNamespace: parentNamespace,
3899 children: _nextChildren6,
3900 childIndex: 0,
3901 context: context,
3902 footer: ''
3903 };
3904
3905 {
3906 _frame6.debugElementStack = [];
3907 }
3908
3909 this.stack.push(_frame6);
3910 return '';
3911 }
3912
3913 case REACT_PROVIDER_TYPE:
3914 {
3915 var provider = nextChild;
3916 var nextProps = provider.props;
3917
3918 var _nextChildren7 = toArray(nextProps.children);
3919
3920 var _frame7 = {
3921 type: provider,
3922 domNamespace: parentNamespace,
3923 children: _nextChildren7,
3924 childIndex: 0,
3925 context: context,
3926 footer: ''
3927 };
3928
3929 {
3930 _frame7.debugElementStack = [];
3931 }
3932
3933 this.pushProvider(provider);
3934 this.stack.push(_frame7);
3935 return '';
3936 }
3937
3938 case REACT_CONTEXT_TYPE:
3939 {
3940 var reactContext = nextChild.type; // The logic below for Context differs depending on PROD or DEV mode. In
3941 // DEV mode, we create a separate object for Context.Consumer that acts
3942 // like a proxy to Context. This proxy object adds unnecessary code in PROD
3943 // so we use the old behaviour (Context.Consumer references Context) to
3944 // reduce size and overhead. The separate object references context via
3945 // a property called "_context", which also gives us the ability to check
3946 // in DEV mode if this property exists or not and warn if it does not.
3947
3948 {
3949 if (reactContext._context === undefined) {
3950 // This may be because it's a Context (rather than a Consumer).
3951 // Or it may be because it's older React where they're the same thing.
3952 // We only want to warn if we're sure it's a new React.
3953 if (reactContext !== reactContext.Consumer) {
3954 if (!hasWarnedAboutUsingContextAsConsumer) {
3955 hasWarnedAboutUsingContextAsConsumer = true;
3956
3957 error('Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
3958 }
3959 }
3960 } else {
3961 reactContext = reactContext._context;
3962 }
3963 }
3964
3965 var _nextProps = nextChild.props;
3966 var threadID = this.threadID;
3967 validateContextBounds(reactContext, threadID);
3968 var nextValue = reactContext[threadID];
3969
3970 var _nextChildren8 = toArray(_nextProps.children(nextValue));
3971
3972 var _frame8 = {
3973 type: nextChild,
3974 domNamespace: parentNamespace,
3975 children: _nextChildren8,
3976 childIndex: 0,
3977 context: context,
3978 footer: ''
3979 };
3980
3981 {
3982 _frame8.debugElementStack = [];
3983 }
3984
3985 this.stack.push(_frame8);
3986 return '';
3987 }
3988 // eslint-disable-next-line-no-fallthrough
3989
3990 case REACT_FUNDAMENTAL_TYPE:
3991 {
3992
3993 {
3994 {
3995 throw Error( "ReactDOMServer does not yet support the fundamental API." );
3996 }
3997 }
3998 }
3999 // eslint-disable-next-line-no-fallthrough
4000
4001 case REACT_LAZY_TYPE:
4002 {
4003 var _element2 = nextChild;
4004 var lazyComponent = nextChild.type; // Attempt to initialize lazy component regardless of whether the
4005 // suspense server-side renderer is enabled so synchronously
4006 // resolved constructors are supported.
4007
4008 var payload = lazyComponent._payload;
4009 var init = lazyComponent._init;
4010 var result = init(payload);
4011 var _nextChildren10 = [React.createElement(result, _assign({
4012 ref: _element2.ref
4013 }, _element2.props))];
4014 var _frame10 = {
4015 type: null,
4016 domNamespace: parentNamespace,
4017 children: _nextChildren10,
4018 childIndex: 0,
4019 context: context,
4020 footer: ''
4021 };
4022
4023 {
4024 _frame10.debugElementStack = [];
4025 }
4026
4027 this.stack.push(_frame10);
4028 return '';
4029 }
4030 }
4031 }
4032
4033 var info = '';
4034
4035 {
4036 var owner = nextElement._owner;
4037
4038 if (elementType === undefined || typeof elementType === 'object' && elementType !== null && Object.keys(elementType).length === 0) {
4039 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.';
4040 }
4041
4042 var ownerName = owner ? getComponentName(owner) : null;
4043
4044 if (ownerName) {
4045 info += '\n\nCheck the render method of `' + ownerName + '`.';
4046 }
4047 }
4048
4049 {
4050 {
4051 throw Error( "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + (elementType == null ? elementType : typeof elementType) + "." + info );
4052 }
4053 }
4054 }
4055 };
4056
4057 _proto.renderDOM = function renderDOM(element, context, parentNamespace) {
4058 var tag = element.type.toLowerCase();
4059 var namespace = parentNamespace;
4060
4061 if (parentNamespace === Namespaces.html) {
4062 namespace = getIntrinsicNamespace(tag);
4063 }
4064
4065 {
4066 if (namespace === Namespaces.html) {
4067 // Should this check be gated by parent namespace? Not sure we want to
4068 // allow <SVG> or <mATH>.
4069 if (tag !== element.type) {
4070 error('<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', element.type);
4071 }
4072 }
4073 }
4074
4075 validateDangerousTag(tag);
4076 var props = element.props;
4077
4078 if (tag === 'input') {
4079 {
4080 checkControlledValueProps('input', props);
4081
4082 if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnDefaultChecked) {
4083 error('%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components', 'A component', props.type);
4084
4085 didWarnDefaultChecked = true;
4086 }
4087
4088 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultInputValue) {
4089 error('%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components', 'A component', props.type);
4090
4091 didWarnDefaultInputValue = true;
4092 }
4093 }
4094
4095 props = _assign({
4096 type: undefined
4097 }, props, {
4098 defaultChecked: undefined,
4099 defaultValue: undefined,
4100 value: props.value != null ? props.value : props.defaultValue,
4101 checked: props.checked != null ? props.checked : props.defaultChecked
4102 });
4103 } else if (tag === 'textarea') {
4104 {
4105 checkControlledValueProps('textarea', props);
4106
4107 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultTextareaValue) {
4108 error('Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components');
4109
4110 didWarnDefaultTextareaValue = true;
4111 }
4112 }
4113
4114 var initialValue = props.value;
4115
4116 if (initialValue == null) {
4117 var defaultValue = props.defaultValue; // TODO (yungsters): Remove support for children content in <textarea>.
4118
4119 var textareaChildren = props.children;
4120
4121 if (textareaChildren != null) {
4122 {
4123 error('Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
4124 }
4125
4126 if (!(defaultValue == null)) {
4127 {
4128 throw Error( "If you supply `defaultValue` on a <textarea>, do not pass children." );
4129 }
4130 }
4131
4132 if (Array.isArray(textareaChildren)) {
4133 if (!(textareaChildren.length <= 1)) {
4134 {
4135 throw Error( "<textarea> can only have at most one child." );
4136 }
4137 }
4138
4139 textareaChildren = textareaChildren[0];
4140 }
4141
4142 defaultValue = '' + textareaChildren;
4143 }
4144
4145 if (defaultValue == null) {
4146 defaultValue = '';
4147 }
4148
4149 initialValue = defaultValue;
4150 }
4151
4152 props = _assign({}, props, {
4153 value: undefined,
4154 children: '' + initialValue
4155 });
4156 } else if (tag === 'select') {
4157 {
4158 checkControlledValueProps('select', props);
4159
4160 for (var i = 0; i < valuePropNames.length; i++) {
4161 var propName = valuePropNames[i];
4162
4163 if (props[propName] == null) {
4164 continue;
4165 }
4166
4167 var isArray = Array.isArray(props[propName]);
4168
4169 if (props.multiple && !isArray) {
4170 error('The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.', propName);
4171 } else if (!props.multiple && isArray) {
4172 error('The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.', propName);
4173 }
4174 }
4175
4176 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultSelectValue) {
4177 error('Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components');
4178
4179 didWarnDefaultSelectValue = true;
4180 }
4181 }
4182
4183 this.currentSelectValue = props.value != null ? props.value : props.defaultValue;
4184 props = _assign({}, props, {
4185 value: undefined
4186 });
4187 } else if (tag === 'option') {
4188 var selected = null;
4189 var selectValue = this.currentSelectValue;
4190 var optionChildren = flattenOptionChildren(props.children);
4191
4192 if (selectValue != null) {
4193 var value;
4194
4195 if (props.value != null) {
4196 value = props.value + '';
4197 } else {
4198 value = optionChildren;
4199 }
4200
4201 selected = false;
4202
4203 if (Array.isArray(selectValue)) {
4204 // multiple
4205 for (var j = 0; j < selectValue.length; j++) {
4206 if ('' + selectValue[j] === value) {
4207 selected = true;
4208 break;
4209 }
4210 }
4211 } else {
4212 selected = '' + selectValue === value;
4213 }
4214
4215 props = _assign({
4216 selected: undefined,
4217 children: undefined
4218 }, props, {
4219 selected: selected,
4220 children: optionChildren
4221 });
4222 }
4223 }
4224
4225 {
4226 validatePropertiesInDevelopment(tag, props);
4227 }
4228
4229 assertValidProps(tag, props);
4230 var out = createOpenTagMarkup(element.type, tag, props, namespace, this.makeStaticMarkup, this.stack.length === 1);
4231 var footer = '';
4232
4233 if (omittedCloseTags.hasOwnProperty(tag)) {
4234 out += '/>';
4235 } else {
4236 out += '>';
4237 footer = '</' + element.type + '>';
4238 }
4239
4240 var children;
4241 var innerMarkup = getNonChildrenInnerMarkup(props);
4242
4243 if (innerMarkup != null) {
4244 children = [];
4245
4246 if (newlineEatingTags.hasOwnProperty(tag) && innerMarkup.charAt(0) === '\n') {
4247 // text/html ignores the first character in these tags if it's a newline
4248 // Prefer to break application/xml over text/html (for now) by adding
4249 // a newline specifically to get eaten by the parser. (Alternately for
4250 // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
4251 // \r is normalized out by HTMLTextAreaElement#value.)
4252 // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
4253 // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
4254 // See: <http://www.w3.org/TR/html5/syntax.html#newlines>
4255 // See: Parsing of "textarea" "listing" and "pre" elements
4256 // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
4257 out += '\n';
4258 }
4259
4260 out += innerMarkup;
4261 } else {
4262 children = toArray(props.children);
4263 }
4264
4265 var frame = {
4266 domNamespace: getChildNamespace(parentNamespace, element.type),
4267 type: tag,
4268 children: children,
4269 childIndex: 0,
4270 context: context,
4271 footer: footer
4272 };
4273
4274 {
4275 frame.debugElementStack = [];
4276 }
4277
4278 this.stack.push(frame);
4279 this.previousWasTextNode = false;
4280 return out;
4281 };
4282
4283 return ReactDOMServerRenderer;
4284 }();
4285
4286 /**
4287 * Render a ReactElement to its initial HTML. This should only be used on the
4288 * server.
4289 * See https://reactjs.org/docs/react-dom-server.html#rendertostring
4290 */
4291
4292 function renderToString(element, options) {
4293 var renderer = new ReactDOMServerRenderer(element, false, options);
4294
4295 try {
4296 var markup = renderer.read(Infinity);
4297 return markup;
4298 } finally {
4299 renderer.destroy();
4300 }
4301 }
4302 /**
4303 * Similar to renderToString, except this doesn't create extra DOM attributes
4304 * such as data-react-id that React uses internally.
4305 * See https://reactjs.org/docs/react-dom-server.html#rendertostaticmarkup
4306 */
4307
4308 function renderToStaticMarkup(element, options) {
4309 var renderer = new ReactDOMServerRenderer(element, true, options);
4310
4311 try {
4312 var markup = renderer.read(Infinity);
4313 return markup;
4314 } finally {
4315 renderer.destroy();
4316 }
4317 }
4318
4319 function renderToNodeStream() {
4320 {
4321 {
4322 throw Error( "ReactDOMServer.renderToNodeStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToString() instead." );
4323 }
4324 }
4325 }
4326
4327 function renderToStaticNodeStream() {
4328 {
4329 {
4330 throw Error( "ReactDOMServer.renderToStaticNodeStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToStaticMarkup() instead." );
4331 }
4332 }
4333 }
4334
4335 exports.renderToNodeStream = renderToNodeStream;
4336 exports.renderToStaticMarkup = renderToStaticMarkup;
4337 exports.renderToStaticNodeStream = renderToStaticNodeStream;
4338 exports.renderToString = renderToString;
4339 exports.version = ReactVersion;
4340
4341})));