UNPKG

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