UNPKG

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