UNPKG

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