UNPKG

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