1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
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.ReactDOM = factory(global.React));
|
16 | }(this, (function (React) { 'use strict';
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | function ReactError(error) {
|
26 | error.name = 'Invariant Violation';
|
27 | return error;
|
28 | }
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 | (function () {
|
42 | if (!React) {
|
43 | {
|
44 | throw ReactError(Error("ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM."));
|
45 | }
|
46 | }
|
47 | })();
|
48 |
|
49 |
|
50 |
|
51 |
|
52 | var eventPluginOrder = null;
|
53 |
|
54 |
|
55 |
|
56 |
|
57 | var namesToPlugins = {};
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 | function recomputePluginOrdering() {
|
65 | if (!eventPluginOrder) {
|
66 |
|
67 | return;
|
68 | }
|
69 |
|
70 | for (var pluginName in namesToPlugins) {
|
71 | var pluginModule = namesToPlugins[pluginName];
|
72 | var pluginIndex = eventPluginOrder.indexOf(pluginName);
|
73 |
|
74 | (function () {
|
75 | if (!(pluginIndex > -1)) {
|
76 | {
|
77 | throw ReactError(Error("EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + pluginName + "`."));
|
78 | }
|
79 | }
|
80 | })();
|
81 |
|
82 | if (plugins[pluginIndex]) {
|
83 | continue;
|
84 | }
|
85 |
|
86 | (function () {
|
87 | if (!pluginModule.extractEvents) {
|
88 | {
|
89 | throw ReactError(Error("EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + pluginName + "` does not."));
|
90 | }
|
91 | }
|
92 | })();
|
93 |
|
94 | plugins[pluginIndex] = pluginModule;
|
95 | var publishedEvents = pluginModule.eventTypes;
|
96 |
|
97 | for (var eventName in publishedEvents) {
|
98 | (function () {
|
99 | if (!publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName)) {
|
100 | {
|
101 | throw ReactError(Error("EventPluginRegistry: Failed to publish event `" + eventName + "` for plugin `" + pluginName + "`."));
|
102 | }
|
103 | }
|
104 | })();
|
105 | }
|
106 | }
|
107 | }
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 | function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
|
119 | (function () {
|
120 | if (!!eventNameDispatchConfigs.hasOwnProperty(eventName)) {
|
121 | {
|
122 | throw ReactError(Error("EventPluginHub: More than one plugin attempted to publish the same event name, `" + eventName + "`."));
|
123 | }
|
124 | }
|
125 | })();
|
126 |
|
127 | eventNameDispatchConfigs[eventName] = dispatchConfig;
|
128 | var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
|
129 |
|
130 | if (phasedRegistrationNames) {
|
131 | for (var phaseName in phasedRegistrationNames) {
|
132 | if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
|
133 | var phasedRegistrationName = phasedRegistrationNames[phaseName];
|
134 | publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
|
135 | }
|
136 | }
|
137 |
|
138 | return true;
|
139 | } else if (dispatchConfig.registrationName) {
|
140 | publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
|
141 | return true;
|
142 | }
|
143 |
|
144 | return false;
|
145 | }
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 | function publishRegistrationName(registrationName, pluginModule, eventName) {
|
156 | (function () {
|
157 | if (!!registrationNameModules[registrationName]) {
|
158 | {
|
159 | throw ReactError(Error("EventPluginHub: More than one plugin attempted to publish the same registration name, `" + registrationName + "`."));
|
160 | }
|
161 | }
|
162 | })();
|
163 |
|
164 | registrationNameModules[registrationName] = pluginModule;
|
165 | registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
|
166 |
|
167 | {
|
168 | var lowerCasedName = registrationName.toLowerCase();
|
169 | possibleRegistrationNames[lowerCasedName] = registrationName;
|
170 |
|
171 | if (registrationName === 'onDoubleClick') {
|
172 | possibleRegistrationNames.ondblclick = registrationName;
|
173 | }
|
174 | }
|
175 | }
|
176 |
|
177 |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 | var plugins = [];
|
188 |
|
189 |
|
190 |
|
191 |
|
192 | var eventNameDispatchConfigs = {};
|
193 |
|
194 |
|
195 |
|
196 |
|
197 | var registrationNameModules = {};
|
198 |
|
199 |
|
200 |
|
201 |
|
202 | var registrationNameDependencies = {};
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 | var possibleRegistrationNames = {};
|
211 |
|
212 |
|
213 |
|
214 |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 |
|
221 |
|
222 | function injectEventPluginOrder(injectedEventPluginOrder) {
|
223 | (function () {
|
224 | if (!!eventPluginOrder) {
|
225 | {
|
226 | throw ReactError(Error("EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React."));
|
227 | }
|
228 | }
|
229 | })();
|
230 |
|
231 |
|
232 | eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
|
233 | recomputePluginOrdering();
|
234 | }
|
235 |
|
236 |
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 |
|
245 |
|
246 | function injectEventPluginsByName(injectedNamesToPlugins) {
|
247 | var isOrderingDirty = false;
|
248 |
|
249 | for (var pluginName in injectedNamesToPlugins) {
|
250 | if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
|
251 | continue;
|
252 | }
|
253 |
|
254 | var pluginModule = injectedNamesToPlugins[pluginName];
|
255 |
|
256 | if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) {
|
257 | (function () {
|
258 | if (!!namesToPlugins[pluginName]) {
|
259 | {
|
260 | throw ReactError(Error("EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + pluginName + "`."));
|
261 | }
|
262 | }
|
263 | })();
|
264 |
|
265 | namesToPlugins[pluginName] = pluginModule;
|
266 | isOrderingDirty = true;
|
267 | }
|
268 | }
|
269 |
|
270 | if (isOrderingDirty) {
|
271 | recomputePluginOrdering();
|
272 | }
|
273 | }
|
274 |
|
275 | var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f) {
|
276 | var funcArgs = Array.prototype.slice.call(arguments, 3);
|
277 |
|
278 | try {
|
279 | func.apply(context, funcArgs);
|
280 | } catch (error) {
|
281 | this.onError(error);
|
282 | }
|
283 | };
|
284 |
|
285 | {
|
286 |
|
287 |
|
288 |
|
289 |
|
290 |
|
291 |
|
292 |
|
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 |
|
303 |
|
304 |
|
305 |
|
306 | if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
|
307 | var fakeNode = document.createElement('react');
|
308 |
|
309 | var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) {
|
310 |
|
311 |
|
312 |
|
313 |
|
314 | (function () {
|
315 | if (!(typeof document !== 'undefined')) {
|
316 | {
|
317 | throw ReactError(Error("The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous."));
|
318 | }
|
319 | }
|
320 | })();
|
321 |
|
322 | var evt = document.createEvent('Event');
|
323 |
|
324 |
|
325 |
|
326 |
|
327 |
|
328 |
|
329 | var didError = true;
|
330 |
|
331 |
|
332 |
|
333 | var windowEvent = window.event;
|
334 |
|
335 |
|
336 | var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event');
|
337 |
|
338 |
|
339 |
|
340 | var funcArgs = Array.prototype.slice.call(arguments, 3);
|
341 |
|
342 | function callCallback() {
|
343 |
|
344 |
|
345 |
|
346 |
|
347 | fakeNode.removeEventListener(evtType, callCallback, false);
|
348 |
|
349 |
|
350 |
|
351 |
|
352 | if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) {
|
353 | window.event = windowEvent;
|
354 | }
|
355 |
|
356 | func.apply(context, funcArgs);
|
357 | didError = false;
|
358 | }
|
359 |
|
360 |
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 | var error;
|
372 |
|
373 | var didSetError = false;
|
374 | var isCrossOriginError = false;
|
375 |
|
376 | function handleWindowError(event) {
|
377 | error = event.error;
|
378 | didSetError = true;
|
379 |
|
380 | if (error === null && event.colno === 0 && event.lineno === 0) {
|
381 | isCrossOriginError = true;
|
382 | }
|
383 |
|
384 | if (event.defaultPrevented) {
|
385 |
|
386 |
|
387 |
|
388 | if (error != null && typeof error === 'object') {
|
389 | try {
|
390 | error._suppressLogging = true;
|
391 | } catch (inner) {
|
392 | }
|
393 | }
|
394 | }
|
395 | }
|
396 |
|
397 |
|
398 | var evtType = "react-" + (name ? name : 'invokeguardedcallback');
|
399 |
|
400 | window.addEventListener('error', handleWindowError);
|
401 | fakeNode.addEventListener(evtType, callCallback, false);
|
402 |
|
403 |
|
404 | evt.initEvent(evtType, false, false);
|
405 | fakeNode.dispatchEvent(evt);
|
406 |
|
407 | if (windowEventDescriptor) {
|
408 | Object.defineProperty(window, 'event', windowEventDescriptor);
|
409 | }
|
410 |
|
411 | if (didError) {
|
412 | if (!didSetError) {
|
413 |
|
414 | error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.');
|
415 | } else if (isCrossOriginError) {
|
416 | error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.');
|
417 | }
|
418 |
|
419 | this.onError(error);
|
420 | }
|
421 |
|
422 |
|
423 | window.removeEventListener('error', handleWindowError);
|
424 | };
|
425 |
|
426 | invokeGuardedCallbackImpl = invokeGuardedCallbackDev;
|
427 | }
|
428 | }
|
429 |
|
430 | var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl;
|
431 |
|
432 | var hasError = false;
|
433 | var caughtError = null;
|
434 |
|
435 | var hasRethrowError = false;
|
436 | var rethrowError = null;
|
437 | var reporter = {
|
438 | onError: function (error) {
|
439 | hasError = true;
|
440 | caughtError = error;
|
441 | }
|
442 | };
|
443 |
|
444 |
|
445 |
|
446 |
|
447 |
|
448 |
|
449 |
|
450 |
|
451 |
|
452 |
|
453 |
|
454 |
|
455 |
|
456 |
|
457 | function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) {
|
458 | hasError = false;
|
459 | caughtError = null;
|
460 | invokeGuardedCallbackImpl$1.apply(reporter, arguments);
|
461 | }
|
462 |
|
463 |
|
464 |
|
465 |
|
466 |
|
467 |
|
468 |
|
469 |
|
470 |
|
471 |
|
472 |
|
473 | function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) {
|
474 | invokeGuardedCallback.apply(this, arguments);
|
475 |
|
476 | if (hasError) {
|
477 | var error = clearCaughtError();
|
478 |
|
479 | if (!hasRethrowError) {
|
480 | hasRethrowError = true;
|
481 | rethrowError = error;
|
482 | }
|
483 | }
|
484 | }
|
485 |
|
486 |
|
487 |
|
488 |
|
489 |
|
490 | function rethrowCaughtError() {
|
491 | if (hasRethrowError) {
|
492 | var error = rethrowError;
|
493 | hasRethrowError = false;
|
494 | rethrowError = null;
|
495 | throw error;
|
496 | }
|
497 | }
|
498 | function hasCaughtError() {
|
499 | return hasError;
|
500 | }
|
501 | function clearCaughtError() {
|
502 | if (hasError) {
|
503 | var error = caughtError;
|
504 | hasError = false;
|
505 | caughtError = null;
|
506 | return error;
|
507 | } else {
|
508 | (function () {
|
509 | {
|
510 | {
|
511 | throw ReactError(Error("clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue."));
|
512 | }
|
513 | }
|
514 | })();
|
515 | }
|
516 | }
|
517 |
|
518 |
|
519 |
|
520 |
|
521 |
|
522 |
|
523 |
|
524 | var warningWithoutStack = function () {};
|
525 |
|
526 | {
|
527 | warningWithoutStack = function (condition, format) {
|
528 | for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
529 | args[_key - 2] = arguments[_key];
|
530 | }
|
531 |
|
532 | if (format === undefined) {
|
533 | throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
534 | }
|
535 |
|
536 | if (args.length > 8) {
|
537 |
|
538 | throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
|
539 | }
|
540 |
|
541 | if (condition) {
|
542 | return;
|
543 | }
|
544 |
|
545 | if (typeof console !== 'undefined') {
|
546 | var argsWithFormat = args.map(function (item) {
|
547 | return '' + item;
|
548 | });
|
549 | argsWithFormat.unshift('Warning: ' + format);
|
550 |
|
551 |
|
552 | Function.prototype.apply.call(console.error, console, argsWithFormat);
|
553 | }
|
554 |
|
555 | try {
|
556 |
|
557 |
|
558 |
|
559 | var argIndex = 0;
|
560 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
561 | return args[argIndex++];
|
562 | });
|
563 | throw new Error(message);
|
564 | } catch (x) {}
|
565 | };
|
566 | }
|
567 |
|
568 | var warningWithoutStack$1 = warningWithoutStack;
|
569 |
|
570 | var getFiberCurrentPropsFromNode = null;
|
571 | var getInstanceFromNode = null;
|
572 | var getNodeFromInstance = null;
|
573 | function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) {
|
574 | getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl;
|
575 | getInstanceFromNode = getInstanceFromNodeImpl;
|
576 | getNodeFromInstance = getNodeFromInstanceImpl;
|
577 |
|
578 | {
|
579 | !(getNodeFromInstance && getInstanceFromNode) ? warningWithoutStack$1(false, 'EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
|
580 | }
|
581 | }
|
582 | var validateEventDispatches;
|
583 |
|
584 | {
|
585 | validateEventDispatches = function (event) {
|
586 | var dispatchListeners = event._dispatchListeners;
|
587 | var dispatchInstances = event._dispatchInstances;
|
588 | var listenersIsArr = Array.isArray(dispatchListeners);
|
589 | var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
|
590 | var instancesIsArr = Array.isArray(dispatchInstances);
|
591 | var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
|
592 | !(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ? warningWithoutStack$1(false, 'EventPluginUtils: Invalid `event`.') : void 0;
|
593 | };
|
594 | }
|
595 |
|
596 |
|
597 |
|
598 |
|
599 |
|
600 |
|
601 |
|
602 |
|
603 | function executeDispatch(event, listener, inst) {
|
604 | var type = event.type || 'unknown-event';
|
605 | event.currentTarget = getNodeFromInstance(inst);
|
606 | invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event);
|
607 | event.currentTarget = null;
|
608 | }
|
609 |
|
610 |
|
611 |
|
612 |
|
613 | function executeDispatchesInOrder(event) {
|
614 | var dispatchListeners = event._dispatchListeners;
|
615 | var dispatchInstances = event._dispatchInstances;
|
616 |
|
617 | {
|
618 | validateEventDispatches(event);
|
619 | }
|
620 |
|
621 | if (Array.isArray(dispatchListeners)) {
|
622 | for (var i = 0; i < dispatchListeners.length; i++) {
|
623 | if (event.isPropagationStopped()) {
|
624 | break;
|
625 | }
|
626 |
|
627 |
|
628 | executeDispatch(event, dispatchListeners[i], dispatchInstances[i]);
|
629 | }
|
630 | } else if (dispatchListeners) {
|
631 | executeDispatch(event, dispatchListeners, dispatchInstances);
|
632 | }
|
633 |
|
634 | event._dispatchListeners = null;
|
635 | event._dispatchInstances = null;
|
636 | }
|
637 |
|
638 |
|
639 |
|
640 |
|
641 |
|
642 |
|
643 |
|
644 |
|
645 |
|
646 |
|
647 |
|
648 |
|
649 |
|
650 |
|
651 |
|
652 |
|
653 |
|
654 |
|
655 |
|
656 |
|
657 |
|
658 |
|
659 |
|
660 |
|
661 |
|
662 |
|
663 |
|
664 |
|
665 |
|
666 |
|
667 |
|
668 |
|
669 |
|
670 |
|
671 |
|
672 | function accumulateInto(current, next) {
|
673 | (function () {
|
674 | if (!(next != null)) {
|
675 | {
|
676 | throw ReactError(Error("accumulateInto(...): Accumulated items must not be null or undefined."));
|
677 | }
|
678 | }
|
679 | })();
|
680 |
|
681 | if (current == null) {
|
682 | return next;
|
683 | }
|
684 |
|
685 |
|
686 |
|
687 | if (Array.isArray(current)) {
|
688 | if (Array.isArray(next)) {
|
689 | current.push.apply(current, next);
|
690 | return current;
|
691 | }
|
692 |
|
693 | current.push(next);
|
694 | return current;
|
695 | }
|
696 |
|
697 | if (Array.isArray(next)) {
|
698 |
|
699 | return [current].concat(next);
|
700 | }
|
701 |
|
702 | return [current, next];
|
703 | }
|
704 |
|
705 |
|
706 |
|
707 |
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 |
|
714 | function forEachAccumulated(arr, cb, scope) {
|
715 | if (Array.isArray(arr)) {
|
716 | arr.forEach(cb, scope);
|
717 | } else if (arr) {
|
718 | cb.call(scope, arr);
|
719 | }
|
720 | }
|
721 |
|
722 |
|
723 |
|
724 |
|
725 |
|
726 |
|
727 | var eventQueue = null;
|
728 |
|
729 |
|
730 |
|
731 |
|
732 |
|
733 |
|
734 |
|
735 | var executeDispatchesAndRelease = function (event) {
|
736 | if (event) {
|
737 | executeDispatchesInOrder(event);
|
738 |
|
739 | if (!event.isPersistent()) {
|
740 | event.constructor.release(event);
|
741 | }
|
742 | }
|
743 | };
|
744 |
|
745 | var executeDispatchesAndReleaseTopLevel = function (e) {
|
746 | return executeDispatchesAndRelease(e);
|
747 | };
|
748 |
|
749 | function runEventsInBatch(events) {
|
750 | if (events !== null) {
|
751 | eventQueue = accumulateInto(eventQueue, events);
|
752 | }
|
753 |
|
754 |
|
755 |
|
756 | var processingEventQueue = eventQueue;
|
757 | eventQueue = null;
|
758 |
|
759 | if (!processingEventQueue) {
|
760 | return;
|
761 | }
|
762 |
|
763 | forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
|
764 |
|
765 | (function () {
|
766 | if (!!eventQueue) {
|
767 | {
|
768 | throw ReactError(Error("processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented."));
|
769 | }
|
770 | }
|
771 | })();
|
772 |
|
773 |
|
774 | rethrowCaughtError();
|
775 | }
|
776 |
|
777 | function isInteractive(tag) {
|
778 | return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
|
779 | }
|
780 |
|
781 | function shouldPreventMouseEvent(name, type, props) {
|
782 | switch (name) {
|
783 | case 'onClick':
|
784 | case 'onClickCapture':
|
785 | case 'onDoubleClick':
|
786 | case 'onDoubleClickCapture':
|
787 | case 'onMouseDown':
|
788 | case 'onMouseDownCapture':
|
789 | case 'onMouseMove':
|
790 | case 'onMouseMoveCapture':
|
791 | case 'onMouseUp':
|
792 | case 'onMouseUpCapture':
|
793 | return !!(props.disabled && isInteractive(type));
|
794 |
|
795 | default:
|
796 | return false;
|
797 | }
|
798 | }
|
799 |
|
800 |
|
801 |
|
802 |
|
803 |
|
804 |
|
805 |
|
806 |
|
807 |
|
808 |
|
809 |
|
810 |
|
811 |
|
812 |
|
813 |
|
814 |
|
815 |
|
816 |
|
817 |
|
818 |
|
819 |
|
820 |
|
821 |
|
822 |
|
823 |
|
824 |
|
825 |
|
826 |
|
827 | var injection = {
|
828 | |
829 |
|
830 |
|
831 |
|
832 | injectEventPluginOrder: injectEventPluginOrder,
|
833 |
|
834 | |
835 |
|
836 |
|
837 | injectEventPluginsByName: injectEventPluginsByName
|
838 | };
|
839 |
|
840 |
|
841 |
|
842 |
|
843 |
|
844 |
|
845 | function getListener(inst, registrationName) {
|
846 | var listener;
|
847 |
|
848 |
|
849 | var stateNode = inst.stateNode;
|
850 |
|
851 | if (!stateNode) {
|
852 |
|
853 | return null;
|
854 | }
|
855 |
|
856 | var props = getFiberCurrentPropsFromNode(stateNode);
|
857 |
|
858 | if (!props) {
|
859 |
|
860 | return null;
|
861 | }
|
862 |
|
863 | listener = props[registrationName];
|
864 |
|
865 | if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
|
866 | return null;
|
867 | }
|
868 |
|
869 | (function () {
|
870 | if (!(!listener || typeof listener === 'function')) {
|
871 | {
|
872 | throw ReactError(Error("Expected `" + registrationName + "` listener to be a function, instead got a value of `" + typeof listener + "` type."));
|
873 | }
|
874 | }
|
875 | })();
|
876 |
|
877 | return listener;
|
878 | }
|
879 |
|
880 |
|
881 |
|
882 |
|
883 |
|
884 |
|
885 |
|
886 |
|
887 | function extractPluginEvents(topLevelType, eventSystemFlags, targetInst, nativeEvent, nativeEventTarget) {
|
888 | var events = null;
|
889 |
|
890 | for (var i = 0; i < plugins.length; i++) {
|
891 |
|
892 | var possiblePlugin = plugins[i];
|
893 |
|
894 | if (possiblePlugin) {
|
895 | var extractedEvents = possiblePlugin.extractEvents(topLevelType, eventSystemFlags, targetInst, nativeEvent, nativeEventTarget);
|
896 |
|
897 | if (extractedEvents) {
|
898 | events = accumulateInto(events, extractedEvents);
|
899 | }
|
900 | }
|
901 | }
|
902 |
|
903 | return events;
|
904 | }
|
905 |
|
906 | function runExtractedPluginEventsInBatch(topLevelType, eventSystemFlags, targetInst, nativeEvent, nativeEventTarget) {
|
907 | var events = extractPluginEvents(topLevelType, eventSystemFlags, targetInst, nativeEvent, nativeEventTarget);
|
908 | runEventsInBatch(events);
|
909 | }
|
910 |
|
911 | var FunctionComponent = 0;
|
912 | var ClassComponent = 1;
|
913 | var IndeterminateComponent = 2;
|
914 |
|
915 | var HostRoot = 3;
|
916 |
|
917 | var HostPortal = 4;
|
918 |
|
919 | var HostComponent = 5;
|
920 | var HostText = 6;
|
921 | var Fragment = 7;
|
922 | var Mode = 8;
|
923 | var ContextConsumer = 9;
|
924 | var ContextProvider = 10;
|
925 | var ForwardRef = 11;
|
926 | var Profiler = 12;
|
927 | var SuspenseComponent = 13;
|
928 | var MemoComponent = 14;
|
929 | var SimpleMemoComponent = 15;
|
930 | var LazyComponent = 16;
|
931 | var IncompleteClassComponent = 17;
|
932 | var DehydratedFragment = 18;
|
933 | var SuspenseListComponent = 19;
|
934 | var FundamentalComponent = 20;
|
935 | var ScopeComponent = 21;
|
936 |
|
937 | var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
938 |
|
939 |
|
940 |
|
941 | if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
|
942 | ReactSharedInternals.ReactCurrentDispatcher = {
|
943 | current: null
|
944 | };
|
945 | }
|
946 |
|
947 | if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
|
948 | ReactSharedInternals.ReactCurrentBatchConfig = {
|
949 | suspense: null
|
950 | };
|
951 | }
|
952 |
|
953 | var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
954 | var describeComponentFrame = function (name, source, ownerName) {
|
955 | var sourceInfo = '';
|
956 |
|
957 | if (source) {
|
958 | var path = source.fileName;
|
959 | var fileName = path.replace(BEFORE_SLASH_RE, '');
|
960 |
|
961 | {
|
962 |
|
963 |
|
964 | if (/^index\./.test(fileName)) {
|
965 | var match = path.match(BEFORE_SLASH_RE);
|
966 |
|
967 | if (match) {
|
968 | var pathBeforeSlash = match[1];
|
969 |
|
970 | if (pathBeforeSlash) {
|
971 | var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
972 | fileName = folderName + '/' + fileName;
|
973 | }
|
974 | }
|
975 | }
|
976 | }
|
977 |
|
978 | sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
979 | } else if (ownerName) {
|
980 | sourceInfo = ' (created by ' + ownerName + ')';
|
981 | }
|
982 |
|
983 | return '\n in ' + (name || 'Unknown') + sourceInfo;
|
984 | };
|
985 |
|
986 |
|
987 |
|
988 | var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
989 | var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
990 | var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
991 | var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
992 | var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
993 | var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
994 | var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
995 | var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
996 |
|
997 |
|
998 |
|
999 | var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
1000 | var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
1001 | var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
1002 | var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
1003 | var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
1004 | var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
1005 | var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
1006 | var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
1007 | var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
1008 | var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
1009 | var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
1010 | function getIteratorFn(maybeIterable) {
|
1011 | if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
1012 | return null;
|
1013 | }
|
1014 |
|
1015 | var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
1016 |
|
1017 | if (typeof maybeIterator === 'function') {
|
1018 | return maybeIterator;
|
1019 | }
|
1020 |
|
1021 | return null;
|
1022 | }
|
1023 |
|
1024 |
|
1025 |
|
1026 |
|
1027 |
|
1028 |
|
1029 |
|
1030 |
|
1031 | var warning = warningWithoutStack$1;
|
1032 |
|
1033 | {
|
1034 | warning = function (condition, format) {
|
1035 | if (condition) {
|
1036 | return;
|
1037 | }
|
1038 |
|
1039 | var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
1040 | var stack = ReactDebugCurrentFrame.getStackAddendum();
|
1041 |
|
1042 | for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
1043 | args[_key - 2] = arguments[_key];
|
1044 | }
|
1045 |
|
1046 | warningWithoutStack$1.apply(void 0, [false, format + '%s'].concat(args, [stack]));
|
1047 | };
|
1048 | }
|
1049 |
|
1050 | var warning$1 = warning;
|
1051 |
|
1052 | var Uninitialized = -1;
|
1053 | var Pending = 0;
|
1054 | var Resolved = 1;
|
1055 | var Rejected = 2;
|
1056 | function refineResolvedLazyComponent(lazyComponent) {
|
1057 | return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
1058 | }
|
1059 | function initializeLazyComponentType(lazyComponent) {
|
1060 | if (lazyComponent._status === Uninitialized) {
|
1061 | lazyComponent._status = Pending;
|
1062 | var ctor = lazyComponent._ctor;
|
1063 | var thenable = ctor();
|
1064 | lazyComponent._result = thenable;
|
1065 | thenable.then(function (moduleObject) {
|
1066 | if (lazyComponent._status === Pending) {
|
1067 | var defaultExport = moduleObject.default;
|
1068 |
|
1069 | {
|
1070 | if (defaultExport === undefined) {
|
1071 | 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);
|
1072 | }
|
1073 | }
|
1074 |
|
1075 | lazyComponent._status = Resolved;
|
1076 | lazyComponent._result = defaultExport;
|
1077 | }
|
1078 | }, function (error) {
|
1079 | if (lazyComponent._status === Pending) {
|
1080 | lazyComponent._status = Rejected;
|
1081 | lazyComponent._result = error;
|
1082 | }
|
1083 | });
|
1084 | }
|
1085 | }
|
1086 |
|
1087 | function getWrappedName(outerType, innerType, wrapperName) {
|
1088 | var functionName = innerType.displayName || innerType.name || '';
|
1089 | return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
|
1090 | }
|
1091 |
|
1092 | function getComponentName(type) {
|
1093 | if (type == null) {
|
1094 |
|
1095 | return null;
|
1096 | }
|
1097 |
|
1098 | {
|
1099 | if (typeof type.tag === 'number') {
|
1100 | warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
1101 | }
|
1102 | }
|
1103 |
|
1104 | if (typeof type === 'function') {
|
1105 | return type.displayName || type.name || null;
|
1106 | }
|
1107 |
|
1108 | if (typeof type === 'string') {
|
1109 | return type;
|
1110 | }
|
1111 |
|
1112 | switch (type) {
|
1113 | case REACT_FRAGMENT_TYPE:
|
1114 | return 'Fragment';
|
1115 |
|
1116 | case REACT_PORTAL_TYPE:
|
1117 | return 'Portal';
|
1118 |
|
1119 | case REACT_PROFILER_TYPE:
|
1120 | return "Profiler";
|
1121 |
|
1122 | case REACT_STRICT_MODE_TYPE:
|
1123 | return 'StrictMode';
|
1124 |
|
1125 | case REACT_SUSPENSE_TYPE:
|
1126 | return 'Suspense';
|
1127 |
|
1128 | case REACT_SUSPENSE_LIST_TYPE:
|
1129 | return 'SuspenseList';
|
1130 | }
|
1131 |
|
1132 | if (typeof type === 'object') {
|
1133 | switch (type.$$typeof) {
|
1134 | case REACT_CONTEXT_TYPE:
|
1135 | return 'Context.Consumer';
|
1136 |
|
1137 | case REACT_PROVIDER_TYPE:
|
1138 | return 'Context.Provider';
|
1139 |
|
1140 | case REACT_FORWARD_REF_TYPE:
|
1141 | return getWrappedName(type, type.render, 'ForwardRef');
|
1142 |
|
1143 | case REACT_MEMO_TYPE:
|
1144 | return getComponentName(type.type);
|
1145 |
|
1146 | case REACT_LAZY_TYPE:
|
1147 | {
|
1148 | var thenable = type;
|
1149 | var resolvedThenable = refineResolvedLazyComponent(thenable);
|
1150 |
|
1151 | if (resolvedThenable) {
|
1152 | return getComponentName(resolvedThenable);
|
1153 | }
|
1154 |
|
1155 | break;
|
1156 | }
|
1157 | }
|
1158 | }
|
1159 |
|
1160 | return null;
|
1161 | }
|
1162 |
|
1163 | var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
1164 |
|
1165 | function describeFiber(fiber) {
|
1166 | switch (fiber.tag) {
|
1167 | case HostRoot:
|
1168 | case HostPortal:
|
1169 | case HostText:
|
1170 | case Fragment:
|
1171 | case ContextProvider:
|
1172 | case ContextConsumer:
|
1173 | return '';
|
1174 |
|
1175 | default:
|
1176 | var owner = fiber._debugOwner;
|
1177 | var source = fiber._debugSource;
|
1178 | var name = getComponentName(fiber.type);
|
1179 | var ownerName = null;
|
1180 |
|
1181 | if (owner) {
|
1182 | ownerName = getComponentName(owner.type);
|
1183 | }
|
1184 |
|
1185 | return describeComponentFrame(name, source, ownerName);
|
1186 | }
|
1187 | }
|
1188 |
|
1189 | function getStackByFiberInDevAndProd(workInProgress) {
|
1190 | var info = '';
|
1191 | var node = workInProgress;
|
1192 |
|
1193 | do {
|
1194 | info += describeFiber(node);
|
1195 | node = node.return;
|
1196 | } while (node);
|
1197 |
|
1198 | return info;
|
1199 | }
|
1200 | var current = null;
|
1201 | var phase = null;
|
1202 | function getCurrentFiberOwnerNameInDevOrNull() {
|
1203 | {
|
1204 | if (current === null) {
|
1205 | return null;
|
1206 | }
|
1207 |
|
1208 | var owner = current._debugOwner;
|
1209 |
|
1210 | if (owner !== null && typeof owner !== 'undefined') {
|
1211 | return getComponentName(owner.type);
|
1212 | }
|
1213 | }
|
1214 |
|
1215 | return null;
|
1216 | }
|
1217 | function getCurrentFiberStackInDev() {
|
1218 | {
|
1219 | if (current === null) {
|
1220 | return '';
|
1221 | }
|
1222 |
|
1223 |
|
1224 |
|
1225 | return getStackByFiberInDevAndProd(current);
|
1226 | }
|
1227 |
|
1228 | return '';
|
1229 | }
|
1230 | function resetCurrentFiber() {
|
1231 | {
|
1232 | ReactDebugCurrentFrame.getCurrentStack = null;
|
1233 | current = null;
|
1234 | phase = null;
|
1235 | }
|
1236 | }
|
1237 | function setCurrentFiber(fiber) {
|
1238 | {
|
1239 | ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackInDev;
|
1240 | current = fiber;
|
1241 | phase = null;
|
1242 | }
|
1243 | }
|
1244 | function setCurrentPhase(lifeCyclePhase) {
|
1245 | {
|
1246 | phase = lifeCyclePhase;
|
1247 | }
|
1248 | }
|
1249 |
|
1250 | var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
|
1251 |
|
1252 | function endsWith(subject, search) {
|
1253 | var length = subject.length;
|
1254 | return subject.substring(length - search.length, length) === search;
|
1255 | }
|
1256 |
|
1257 | var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
1258 | var _assign = ReactInternals.assign;
|
1259 |
|
1260 | var PLUGIN_EVENT_SYSTEM = 1;
|
1261 | var RESPONDER_EVENT_SYSTEM = 1 << 1;
|
1262 | var IS_PASSIVE = 1 << 2;
|
1263 | var IS_ACTIVE = 1 << 3;
|
1264 | var PASSIVE_NOT_SUPPORTED = 1 << 4;
|
1265 | var IS_REPLAYED = 1 << 5;
|
1266 |
|
1267 | var restoreImpl = null;
|
1268 | var restoreTarget = null;
|
1269 | var restoreQueue = null;
|
1270 |
|
1271 | function restoreStateOfTarget(target) {
|
1272 |
|
1273 |
|
1274 | var internalInstance = getInstanceFromNode(target);
|
1275 |
|
1276 | if (!internalInstance) {
|
1277 |
|
1278 | return;
|
1279 | }
|
1280 |
|
1281 | (function () {
|
1282 | if (!(typeof restoreImpl === 'function')) {
|
1283 | {
|
1284 | throw ReactError(Error("setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue."));
|
1285 | }
|
1286 | }
|
1287 | })();
|
1288 |
|
1289 | var props = getFiberCurrentPropsFromNode(internalInstance.stateNode);
|
1290 | restoreImpl(internalInstance.stateNode, internalInstance.type, props);
|
1291 | }
|
1292 |
|
1293 | function setRestoreImplementation(impl) {
|
1294 | restoreImpl = impl;
|
1295 | }
|
1296 | function enqueueStateRestore(target) {
|
1297 | if (restoreTarget) {
|
1298 | if (restoreQueue) {
|
1299 | restoreQueue.push(target);
|
1300 | } else {
|
1301 | restoreQueue = [target];
|
1302 | }
|
1303 | } else {
|
1304 | restoreTarget = target;
|
1305 | }
|
1306 | }
|
1307 | function needsStateRestore() {
|
1308 | return restoreTarget !== null || restoreQueue !== null;
|
1309 | }
|
1310 | function restoreStateIfNeeded() {
|
1311 | if (!restoreTarget) {
|
1312 | return;
|
1313 | }
|
1314 |
|
1315 | var target = restoreTarget;
|
1316 | var queuedTargets = restoreQueue;
|
1317 | restoreTarget = null;
|
1318 | restoreQueue = null;
|
1319 | restoreStateOfTarget(target);
|
1320 |
|
1321 | if (queuedTargets) {
|
1322 | for (var i = 0; i < queuedTargets.length; i++) {
|
1323 | restoreStateOfTarget(queuedTargets[i]);
|
1324 | }
|
1325 | }
|
1326 | }
|
1327 |
|
1328 | var enableUserTimingAPI = true;
|
1329 |
|
1330 | var debugRenderPhaseSideEffects = false;
|
1331 |
|
1332 |
|
1333 |
|
1334 |
|
1335 | var debugRenderPhaseSideEffectsForStrictMode = true;
|
1336 |
|
1337 |
|
1338 | var replayFailedUnitOfWorkWithInvokeGuardedCallback = true;
|
1339 |
|
1340 | var warnAboutDeprecatedLifecycles = true;
|
1341 |
|
1342 | var enableProfilerTimer = true;
|
1343 |
|
1344 | var enableSchedulerTracing = true;
|
1345 |
|
1346 | var enableSuspenseServerRenderer = false;
|
1347 |
|
1348 | var enableSelectiveHydration = false;
|
1349 |
|
1350 |
|
1351 |
|
1352 |
|
1353 |
|
1354 | var disableJavaScriptURLs = false;
|
1355 |
|
1356 |
|
1357 | var disableInputAttributeSyncing = false;
|
1358 |
|
1359 |
|
1360 | var enableStableConcurrentModeAPIs = false;
|
1361 | var warnAboutShorthandPropertyCollision = false;
|
1362 |
|
1363 |
|
1364 |
|
1365 |
|
1366 | var enableFlareAPI = false;
|
1367 |
|
1368 | var enableFundamentalAPI = false;
|
1369 |
|
1370 | var enableScopeAPI = false;
|
1371 |
|
1372 |
|
1373 |
|
1374 |
|
1375 | var warnAboutUnmockedScheduler = false;
|
1376 |
|
1377 |
|
1378 | var flushSuspenseFallbacksInTests = true;
|
1379 |
|
1380 |
|
1381 |
|
1382 | var enableUserBlockingEvents = false;
|
1383 |
|
1384 |
|
1385 |
|
1386 |
|
1387 |
|
1388 | var enableSuspenseCallback = false;
|
1389 |
|
1390 |
|
1391 |
|
1392 | var warnAboutDefaultPropsOnFunctionComponents = false;
|
1393 | var warnAboutStringRefs = false;
|
1394 | var disableLegacyContext = false;
|
1395 | var disableSchedulerTimeoutBasedOnReactExpirationTime = false;
|
1396 | var enableTrustedTypesIntegration = false;
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 |
|
1402 |
|
1403 |
|
1404 | var batchedUpdatesImpl = function (fn, bookkeeping) {
|
1405 | return fn(bookkeeping);
|
1406 | };
|
1407 |
|
1408 | var discreteUpdatesImpl = function (fn, a, b, c) {
|
1409 | return fn(a, b, c);
|
1410 | };
|
1411 |
|
1412 | var flushDiscreteUpdatesImpl = function () {};
|
1413 |
|
1414 | var batchedEventUpdatesImpl = batchedUpdatesImpl;
|
1415 | var isInsideEventHandler = false;
|
1416 | var isBatchingEventUpdates = false;
|
1417 |
|
1418 | function finishEventHandler() {
|
1419 |
|
1420 |
|
1421 |
|
1422 |
|
1423 | var controlledComponentsHavePendingUpdates = needsStateRestore();
|
1424 |
|
1425 | if (controlledComponentsHavePendingUpdates) {
|
1426 |
|
1427 |
|
1428 |
|
1429 | flushDiscreteUpdatesImpl();
|
1430 | restoreStateIfNeeded();
|
1431 | }
|
1432 | }
|
1433 |
|
1434 | function batchedUpdates(fn, bookkeeping) {
|
1435 | if (isInsideEventHandler) {
|
1436 |
|
1437 |
|
1438 | return fn(bookkeeping);
|
1439 | }
|
1440 |
|
1441 | isInsideEventHandler = true;
|
1442 |
|
1443 | try {
|
1444 | return batchedUpdatesImpl(fn, bookkeeping);
|
1445 | } finally {
|
1446 | isInsideEventHandler = false;
|
1447 | finishEventHandler();
|
1448 | }
|
1449 | }
|
1450 | function batchedEventUpdates(fn, a, b) {
|
1451 | if (isBatchingEventUpdates) {
|
1452 |
|
1453 |
|
1454 | return fn(a, b);
|
1455 | }
|
1456 |
|
1457 | isBatchingEventUpdates = true;
|
1458 |
|
1459 | try {
|
1460 | return batchedEventUpdatesImpl(fn, a, b);
|
1461 | } finally {
|
1462 | isBatchingEventUpdates = false;
|
1463 | finishEventHandler();
|
1464 | }
|
1465 | }
|
1466 |
|
1467 | function executeUserEventHandler(fn, value) {
|
1468 | var previouslyInEventHandler = isInsideEventHandler;
|
1469 |
|
1470 | try {
|
1471 | isInsideEventHandler = true;
|
1472 | var type = typeof value === 'object' && value !== null ? value.type : '';
|
1473 | invokeGuardedCallbackAndCatchFirstError(type, fn, undefined, value);
|
1474 | } finally {
|
1475 | isInsideEventHandler = previouslyInEventHandler;
|
1476 | }
|
1477 | }
|
1478 | function discreteUpdates(fn, a, b, c) {
|
1479 | var prevIsInsideEventHandler = isInsideEventHandler;
|
1480 | isInsideEventHandler = true;
|
1481 |
|
1482 | try {
|
1483 | return discreteUpdatesImpl(fn, a, b, c);
|
1484 | } finally {
|
1485 | isInsideEventHandler = prevIsInsideEventHandler;
|
1486 |
|
1487 | if (!isInsideEventHandler) {
|
1488 | finishEventHandler();
|
1489 | }
|
1490 | }
|
1491 | }
|
1492 | var lastFlushedEventTimeStamp = 0;
|
1493 | function flushDiscreteUpdatesIfNeeded(timeStamp) {
|
1494 |
|
1495 |
|
1496 |
|
1497 |
|
1498 |
|
1499 |
|
1500 |
|
1501 |
|
1502 |
|
1503 |
|
1504 |
|
1505 |
|
1506 | if (!isInsideEventHandler && (!enableFlareAPI || timeStamp === 0 || lastFlushedEventTimeStamp !== timeStamp)) {
|
1507 | lastFlushedEventTimeStamp = timeStamp;
|
1508 | flushDiscreteUpdatesImpl();
|
1509 | }
|
1510 | }
|
1511 | function setBatchingImplementation(_batchedUpdatesImpl, _discreteUpdatesImpl, _flushDiscreteUpdatesImpl, _batchedEventUpdatesImpl) {
|
1512 | batchedUpdatesImpl = _batchedUpdatesImpl;
|
1513 | discreteUpdatesImpl = _discreteUpdatesImpl;
|
1514 | flushDiscreteUpdatesImpl = _flushDiscreteUpdatesImpl;
|
1515 | batchedEventUpdatesImpl = _batchedEventUpdatesImpl;
|
1516 | }
|
1517 |
|
1518 | var DiscreteEvent = 0;
|
1519 | var UserBlockingEvent = 1;
|
1520 | var ContinuousEvent = 2;
|
1521 |
|
1522 | var ReactInternals$1 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
1523 | var _ReactInternals$Sched = ReactInternals$1.Scheduler;
|
1524 | var unstable_cancelCallback = _ReactInternals$Sched.unstable_cancelCallback;
|
1525 | var unstable_now = _ReactInternals$Sched.unstable_now;
|
1526 | var unstable_scheduleCallback = _ReactInternals$Sched.unstable_scheduleCallback;
|
1527 | var unstable_shouldYield = _ReactInternals$Sched.unstable_shouldYield;
|
1528 | var unstable_requestPaint = _ReactInternals$Sched.unstable_requestPaint;
|
1529 | var unstable_getFirstCallbackNode = _ReactInternals$Sched.unstable_getFirstCallbackNode;
|
1530 | var unstable_runWithPriority = _ReactInternals$Sched.unstable_runWithPriority;
|
1531 | var unstable_next = _ReactInternals$Sched.unstable_next;
|
1532 | var unstable_continueExecution = _ReactInternals$Sched.unstable_continueExecution;
|
1533 | var unstable_pauseExecution = _ReactInternals$Sched.unstable_pauseExecution;
|
1534 | var unstable_getCurrentPriorityLevel = _ReactInternals$Sched.unstable_getCurrentPriorityLevel;
|
1535 | var unstable_ImmediatePriority = _ReactInternals$Sched.unstable_ImmediatePriority;
|
1536 | var unstable_UserBlockingPriority = _ReactInternals$Sched.unstable_UserBlockingPriority;
|
1537 | var unstable_NormalPriority = _ReactInternals$Sched.unstable_NormalPriority;
|
1538 | var unstable_LowPriority = _ReactInternals$Sched.unstable_LowPriority;
|
1539 | var unstable_IdlePriority = _ReactInternals$Sched.unstable_IdlePriority;
|
1540 | var unstable_forceFrameRate = _ReactInternals$Sched.unstable_forceFrameRate;
|
1541 | var unstable_flushAllWithoutAsserting = _ReactInternals$Sched.unstable_flushAllWithoutAsserting;
|
1542 |
|
1543 |
|
1544 |
|
1545 | var UserBlockingPriority = unstable_UserBlockingPriority;
|
1546 | var runWithPriority = unstable_runWithPriority;
|
1547 | var listenToResponderEventTypesImpl;
|
1548 | function setListenToResponderEventTypes(_listenToResponderEventTypesImpl) {
|
1549 | listenToResponderEventTypesImpl = _listenToResponderEventTypesImpl;
|
1550 | }
|
1551 | var activeTimeouts = new Map();
|
1552 | var rootEventTypesToEventResponderInstances = new Map();
|
1553 | var DoNotPropagateToNextResponder = 0;
|
1554 | var PropagateToNextResponder = 1;
|
1555 | var currentTimeStamp = 0;
|
1556 | var currentTimers = new Map();
|
1557 | var currentInstance = null;
|
1558 | var currentTimerIDCounter = 0;
|
1559 | var currentDocument = null;
|
1560 | var currentPropagationBehavior = DoNotPropagateToNextResponder;
|
1561 | var eventResponderContext = {
|
1562 | dispatchEvent: function (eventValue, eventListener, eventPriority) {
|
1563 | validateResponderContext();
|
1564 | validateEventValue(eventValue);
|
1565 |
|
1566 | switch (eventPriority) {
|
1567 | case DiscreteEvent:
|
1568 | {
|
1569 | flushDiscreteUpdatesIfNeeded(currentTimeStamp);
|
1570 | discreteUpdates(function () {
|
1571 | return executeUserEventHandler(eventListener, eventValue);
|
1572 | });
|
1573 | break;
|
1574 | }
|
1575 |
|
1576 | case UserBlockingEvent:
|
1577 | {
|
1578 | if (enableUserBlockingEvents) {
|
1579 | runWithPriority(UserBlockingPriority, function () {
|
1580 | return executeUserEventHandler(eventListener, eventValue);
|
1581 | });
|
1582 | } else {
|
1583 | executeUserEventHandler(eventListener, eventValue);
|
1584 | }
|
1585 |
|
1586 | break;
|
1587 | }
|
1588 |
|
1589 | case ContinuousEvent:
|
1590 | {
|
1591 | executeUserEventHandler(eventListener, eventValue);
|
1592 | break;
|
1593 | }
|
1594 | }
|
1595 | },
|
1596 | isTargetWithinResponder: function (target) {
|
1597 | validateResponderContext();
|
1598 |
|
1599 | if (target != null) {
|
1600 | var fiber = getClosestInstanceFromNode(target);
|
1601 | var responderFiber = currentInstance.fiber;
|
1602 |
|
1603 | while (fiber !== null) {
|
1604 | if (fiber === responderFiber || fiber.alternate === responderFiber) {
|
1605 | return true;
|
1606 | }
|
1607 |
|
1608 | fiber = fiber.return;
|
1609 | }
|
1610 | }
|
1611 |
|
1612 | return false;
|
1613 | },
|
1614 | isTargetWithinResponderScope: function (target) {
|
1615 | validateResponderContext();
|
1616 | var componentInstance = currentInstance;
|
1617 | var responder = componentInstance.responder;
|
1618 |
|
1619 | if (target != null) {
|
1620 | var fiber = getClosestInstanceFromNode(target);
|
1621 | var responderFiber = currentInstance.fiber;
|
1622 |
|
1623 | while (fiber !== null) {
|
1624 | if (fiber === responderFiber || fiber.alternate === responderFiber) {
|
1625 | return true;
|
1626 | }
|
1627 |
|
1628 | if (doesFiberHaveResponder(fiber, responder)) {
|
1629 | return false;
|
1630 | }
|
1631 |
|
1632 | fiber = fiber.return;
|
1633 | }
|
1634 | }
|
1635 |
|
1636 | return false;
|
1637 | },
|
1638 | isTargetWithinNode: function (childTarget, parentTarget) {
|
1639 | validateResponderContext();
|
1640 | var childFiber = getClosestInstanceFromNode(childTarget);
|
1641 | var parentFiber = getClosestInstanceFromNode(parentTarget);
|
1642 |
|
1643 | if (childFiber != null && parentFiber != null) {
|
1644 | var parentAlternateFiber = parentFiber.alternate;
|
1645 | var node = childFiber;
|
1646 |
|
1647 | while (node !== null) {
|
1648 | if (node === parentFiber || node === parentAlternateFiber) {
|
1649 | return true;
|
1650 | }
|
1651 |
|
1652 | node = node.return;
|
1653 | }
|
1654 |
|
1655 | return false;
|
1656 | }
|
1657 |
|
1658 |
|
1659 | return parentTarget.contains(childTarget);
|
1660 | },
|
1661 | addRootEventTypes: function (rootEventTypes) {
|
1662 | validateResponderContext();
|
1663 | listenToResponderEventTypesImpl(rootEventTypes, currentDocument);
|
1664 |
|
1665 | for (var i = 0; i < rootEventTypes.length; i++) {
|
1666 | var rootEventType = rootEventTypes[i];
|
1667 | var eventResponderInstance = currentInstance;
|
1668 | registerRootEventType(rootEventType, eventResponderInstance);
|
1669 | }
|
1670 | },
|
1671 | removeRootEventTypes: function (rootEventTypes) {
|
1672 | validateResponderContext();
|
1673 |
|
1674 | for (var i = 0; i < rootEventTypes.length; i++) {
|
1675 | var rootEventType = rootEventTypes[i];
|
1676 | var rootEventResponders = rootEventTypesToEventResponderInstances.get(rootEventType);
|
1677 | var rootEventTypesSet = currentInstance.rootEventTypes;
|
1678 |
|
1679 | if (rootEventTypesSet !== null) {
|
1680 | rootEventTypesSet.delete(rootEventType);
|
1681 | }
|
1682 |
|
1683 | if (rootEventResponders !== undefined) {
|
1684 | rootEventResponders.delete(currentInstance);
|
1685 | }
|
1686 | }
|
1687 | },
|
1688 | setTimeout: function (func, delay) {
|
1689 | validateResponderContext();
|
1690 |
|
1691 | if (currentTimers === null) {
|
1692 | currentTimers = new Map();
|
1693 | }
|
1694 |
|
1695 | var timeout = currentTimers.get(delay);
|
1696 | var timerId = currentTimerIDCounter++;
|
1697 |
|
1698 | if (timeout === undefined) {
|
1699 | var timers = new Map();
|
1700 | var id = setTimeout(function () {
|
1701 | processTimers(timers, delay);
|
1702 | }, delay);
|
1703 | timeout = {
|
1704 | id: id,
|
1705 | timers: timers
|
1706 | };
|
1707 | currentTimers.set(delay, timeout);
|
1708 | }
|
1709 |
|
1710 | timeout.timers.set(timerId, {
|
1711 | instance: currentInstance,
|
1712 | func: func,
|
1713 | id: timerId,
|
1714 | timeStamp: currentTimeStamp
|
1715 | });
|
1716 | activeTimeouts.set(timerId, timeout);
|
1717 | return timerId;
|
1718 | },
|
1719 | clearTimeout: function (timerId) {
|
1720 | validateResponderContext();
|
1721 | var timeout = activeTimeouts.get(timerId);
|
1722 |
|
1723 | if (timeout !== undefined) {
|
1724 | var timers = timeout.timers;
|
1725 | timers.delete(timerId);
|
1726 |
|
1727 | if (timers.size === 0) {
|
1728 | clearTimeout(timeout.id);
|
1729 | }
|
1730 | }
|
1731 | },
|
1732 | getActiveDocument: getActiveDocument,
|
1733 | objectAssign: _assign,
|
1734 | getTimeStamp: function () {
|
1735 | validateResponderContext();
|
1736 | return currentTimeStamp;
|
1737 | },
|
1738 | isTargetWithinHostComponent: function (target, elementType) {
|
1739 | validateResponderContext();
|
1740 | var fiber = getClosestInstanceFromNode(target);
|
1741 |
|
1742 | while (fiber !== null) {
|
1743 | if (fiber.tag === HostComponent && fiber.type === elementType) {
|
1744 | return true;
|
1745 | }
|
1746 |
|
1747 | fiber = fiber.return;
|
1748 | }
|
1749 |
|
1750 | return false;
|
1751 | },
|
1752 | continuePropagation: function () {
|
1753 | currentPropagationBehavior = PropagateToNextResponder;
|
1754 | },
|
1755 | enqueueStateRestore: enqueueStateRestore,
|
1756 | getResponderNode: function () {
|
1757 | validateResponderContext();
|
1758 | var responderFiber = currentInstance.fiber;
|
1759 |
|
1760 | if (responderFiber.tag === ScopeComponent) {
|
1761 | return null;
|
1762 | }
|
1763 |
|
1764 | return responderFiber.stateNode;
|
1765 | }
|
1766 | };
|
1767 |
|
1768 | function validateEventValue(eventValue) {
|
1769 | if (typeof eventValue === 'object' && eventValue !== null) {
|
1770 | var target = eventValue.target,
|
1771 | type = eventValue.type,
|
1772 | timeStamp = eventValue.timeStamp;
|
1773 |
|
1774 | if (target == null || type == null || timeStamp == null) {
|
1775 | throw new Error('context.dispatchEvent: "target", "timeStamp", and "type" fields on event object are required.');
|
1776 | }
|
1777 |
|
1778 | var showWarning = function (name) {
|
1779 | {
|
1780 | warning$1(false, '%s is not available on event objects created from event responder modules (React Flare). ' + 'Try wrapping in a conditional, i.e. `if (event.type !== "press") { event.%s }`', name, name);
|
1781 | }
|
1782 | };
|
1783 |
|
1784 | eventValue.isDefaultPrevented = function () {
|
1785 | {
|
1786 | showWarning('isDefaultPrevented()');
|
1787 | }
|
1788 | };
|
1789 |
|
1790 | eventValue.isPropagationStopped = function () {
|
1791 | {
|
1792 | showWarning('isPropagationStopped()');
|
1793 | }
|
1794 | };
|
1795 |
|
1796 |
|
1797 | Object.defineProperty(eventValue, 'nativeEvent', {
|
1798 | get: function () {
|
1799 | {
|
1800 | showWarning('nativeEvent');
|
1801 | }
|
1802 | }
|
1803 | });
|
1804 | }
|
1805 | }
|
1806 |
|
1807 | function doesFiberHaveResponder(fiber, responder) {
|
1808 | var tag = fiber.tag;
|
1809 |
|
1810 | if (tag === HostComponent || tag === ScopeComponent) {
|
1811 | var dependencies = fiber.dependencies;
|
1812 |
|
1813 | if (dependencies !== null) {
|
1814 | var respondersMap = dependencies.responders;
|
1815 |
|
1816 | if (respondersMap !== null && respondersMap.has(responder)) {
|
1817 | return true;
|
1818 | }
|
1819 | }
|
1820 | }
|
1821 |
|
1822 | return false;
|
1823 | }
|
1824 |
|
1825 | function getActiveDocument() {
|
1826 | return currentDocument;
|
1827 | }
|
1828 |
|
1829 | function processTimers(timers, delay) {
|
1830 | var timersArr = Array.from(timers.values());
|
1831 | var previousInstance = currentInstance;
|
1832 | var previousTimers = currentTimers;
|
1833 |
|
1834 | try {
|
1835 | batchedEventUpdates(function () {
|
1836 | for (var i = 0; i < timersArr.length; i++) {
|
1837 | var _timersArr$i = timersArr[i],
|
1838 | instance = _timersArr$i.instance,
|
1839 | func = _timersArr$i.func,
|
1840 | id = _timersArr$i.id,
|
1841 | timeStamp = _timersArr$i.timeStamp;
|
1842 | currentInstance = instance;
|
1843 | currentTimeStamp = timeStamp + delay;
|
1844 |
|
1845 | try {
|
1846 | func();
|
1847 | } finally {
|
1848 | activeTimeouts.delete(id);
|
1849 | }
|
1850 | }
|
1851 | });
|
1852 | } finally {
|
1853 | currentTimers = previousTimers;
|
1854 | currentInstance = previousInstance;
|
1855 | currentTimeStamp = 0;
|
1856 | }
|
1857 | }
|
1858 |
|
1859 | function createDOMResponderEvent(topLevelType, nativeEvent, nativeEventTarget, passive, passiveSupported) {
|
1860 | var _ref = nativeEvent,
|
1861 | buttons = _ref.buttons,
|
1862 | pointerType = _ref.pointerType;
|
1863 | var eventPointerType = '';
|
1864 |
|
1865 | if (pointerType !== undefined) {
|
1866 | eventPointerType = pointerType;
|
1867 | } else if (nativeEvent.key !== undefined) {
|
1868 | eventPointerType = 'keyboard';
|
1869 | } else if (buttons !== undefined) {
|
1870 | eventPointerType = 'mouse';
|
1871 | } else if (nativeEvent.changedTouches !== undefined) {
|
1872 | eventPointerType = 'touch';
|
1873 | }
|
1874 |
|
1875 | return {
|
1876 | nativeEvent: nativeEvent,
|
1877 | passive: passive,
|
1878 | passiveSupported: passiveSupported,
|
1879 | pointerType: eventPointerType,
|
1880 | target: nativeEventTarget,
|
1881 | type: topLevelType
|
1882 | };
|
1883 | }
|
1884 |
|
1885 | function responderEventTypesContainType(eventTypes, type) {
|
1886 | for (var i = 0, len = eventTypes.length; i < len; i++) {
|
1887 | if (eventTypes[i] === type) {
|
1888 | return true;
|
1889 | }
|
1890 | }
|
1891 |
|
1892 | return false;
|
1893 | }
|
1894 |
|
1895 | function validateResponderTargetEventTypes(eventType, responder) {
|
1896 | var targetEventTypes = responder.targetEventTypes;
|
1897 |
|
1898 | if (targetEventTypes !== null) {
|
1899 | return responderEventTypesContainType(targetEventTypes, eventType);
|
1900 | }
|
1901 |
|
1902 | return false;
|
1903 | }
|
1904 |
|
1905 | function traverseAndHandleEventResponderInstances(topLevelType, targetFiber, nativeEvent, nativeEventTarget, eventSystemFlags) {
|
1906 | var isPassiveEvent = (eventSystemFlags & IS_PASSIVE) !== 0;
|
1907 | var isPassiveSupported = (eventSystemFlags & PASSIVE_NOT_SUPPORTED) === 0;
|
1908 | var isPassive = isPassiveEvent || !isPassiveSupported;
|
1909 | var eventType = isPassive ? topLevelType : topLevelType + '_active';
|
1910 |
|
1911 |
|
1912 |
|
1913 | var visitedResponders = new Set();
|
1914 | var responderEvent = createDOMResponderEvent(topLevelType, nativeEvent, nativeEventTarget, isPassiveEvent, isPassiveSupported);
|
1915 | var node = targetFiber;
|
1916 | var insidePortal = false;
|
1917 |
|
1918 | while (node !== null) {
|
1919 | var _node = node,
|
1920 | dependencies = _node.dependencies,
|
1921 | tag = _node.tag;
|
1922 |
|
1923 | if (tag === HostPortal) {
|
1924 | insidePortal = true;
|
1925 | } else if ((tag === HostComponent || tag === ScopeComponent) && dependencies !== null) {
|
1926 | var respondersMap = dependencies.responders;
|
1927 |
|
1928 | if (respondersMap !== null) {
|
1929 | var responderInstances = Array.from(respondersMap.values());
|
1930 |
|
1931 | for (var i = 0, length = responderInstances.length; i < length; i++) {
|
1932 | var responderInstance = responderInstances[i];
|
1933 | var props = responderInstance.props,
|
1934 | responder = responderInstance.responder,
|
1935 | state = responderInstance.state;
|
1936 |
|
1937 | if (!visitedResponders.has(responder) && validateResponderTargetEventTypes(eventType, responder) && (!insidePortal || responder.targetPortalPropagation)) {
|
1938 | visitedResponders.add(responder);
|
1939 | var onEvent = responder.onEvent;
|
1940 |
|
1941 | if (onEvent !== null) {
|
1942 | currentInstance = responderInstance;
|
1943 | onEvent(responderEvent, eventResponderContext, props, state);
|
1944 |
|
1945 | if (currentPropagationBehavior === PropagateToNextResponder) {
|
1946 | visitedResponders.delete(responder);
|
1947 | currentPropagationBehavior = DoNotPropagateToNextResponder;
|
1948 | }
|
1949 | }
|
1950 | }
|
1951 | }
|
1952 | }
|
1953 | }
|
1954 |
|
1955 | node = node.return;
|
1956 | }
|
1957 |
|
1958 |
|
1959 | var rootEventResponderInstances = rootEventTypesToEventResponderInstances.get(eventType);
|
1960 |
|
1961 | if (rootEventResponderInstances !== undefined) {
|
1962 | var _responderInstances = Array.from(rootEventResponderInstances);
|
1963 |
|
1964 | for (var _i = 0; _i < _responderInstances.length; _i++) {
|
1965 | var _responderInstance = _responderInstances[_i];
|
1966 | var props = _responderInstance.props,
|
1967 | responder = _responderInstance.responder,
|
1968 | state = _responderInstance.state;
|
1969 | var onRootEvent = responder.onRootEvent;
|
1970 |
|
1971 | if (onRootEvent !== null) {
|
1972 | currentInstance = _responderInstance;
|
1973 | onRootEvent(responderEvent, eventResponderContext, props, state);
|
1974 | }
|
1975 | }
|
1976 | }
|
1977 | }
|
1978 |
|
1979 | function mountEventResponder(responder, responderInstance, props, state) {
|
1980 | var onMount = responder.onMount;
|
1981 |
|
1982 | if (onMount !== null) {
|
1983 | var previousInstance = currentInstance;
|
1984 | var previousTimers = currentTimers;
|
1985 | currentInstance = responderInstance;
|
1986 |
|
1987 | try {
|
1988 | batchedEventUpdates(function () {
|
1989 | onMount(eventResponderContext, props, state);
|
1990 | });
|
1991 | } finally {
|
1992 | currentInstance = previousInstance;
|
1993 | currentTimers = previousTimers;
|
1994 | }
|
1995 | }
|
1996 | }
|
1997 | function unmountEventResponder(responderInstance) {
|
1998 | var responder = responderInstance.responder;
|
1999 | var onUnmount = responder.onUnmount;
|
2000 |
|
2001 | if (onUnmount !== null) {
|
2002 | var props = responderInstance.props,
|
2003 | state = responderInstance.state;
|
2004 | var previousInstance = currentInstance;
|
2005 | var previousTimers = currentTimers;
|
2006 | currentInstance = responderInstance;
|
2007 |
|
2008 | try {
|
2009 | batchedEventUpdates(function () {
|
2010 | onUnmount(eventResponderContext, props, state);
|
2011 | });
|
2012 | } finally {
|
2013 | currentInstance = previousInstance;
|
2014 | currentTimers = previousTimers;
|
2015 | }
|
2016 | }
|
2017 |
|
2018 | var rootEventTypesSet = responderInstance.rootEventTypes;
|
2019 |
|
2020 | if (rootEventTypesSet !== null) {
|
2021 | var rootEventTypes = Array.from(rootEventTypesSet);
|
2022 |
|
2023 | for (var i = 0; i < rootEventTypes.length; i++) {
|
2024 | var topLevelEventType = rootEventTypes[i];
|
2025 | var rootEventResponderInstances = rootEventTypesToEventResponderInstances.get(topLevelEventType);
|
2026 |
|
2027 | if (rootEventResponderInstances !== undefined) {
|
2028 | rootEventResponderInstances.delete(responderInstance);
|
2029 | }
|
2030 | }
|
2031 | }
|
2032 | }
|
2033 |
|
2034 | function validateResponderContext() {
|
2035 | (function () {
|
2036 | if (!(currentInstance !== null)) {
|
2037 | {
|
2038 | throw ReactError(Error("An event responder context was used outside of an event cycle. Use context.setTimeout() to use asynchronous responder context outside of event cycle ."));
|
2039 | }
|
2040 | }
|
2041 | })();
|
2042 | }
|
2043 |
|
2044 | function dispatchEventForResponderEventSystem(topLevelType, targetFiber, nativeEvent, nativeEventTarget, eventSystemFlags) {
|
2045 | if (enableFlareAPI) {
|
2046 | var previousInstance = currentInstance;
|
2047 | var previousTimers = currentTimers;
|
2048 | var previousTimeStamp = currentTimeStamp;
|
2049 | var previousDocument = currentDocument;
|
2050 | var previousPropagationBehavior = currentPropagationBehavior;
|
2051 | currentPropagationBehavior = DoNotPropagateToNextResponder;
|
2052 | currentTimers = null;
|
2053 |
|
2054 | currentDocument = nativeEventTarget.nodeType === 9 ? nativeEventTarget : nativeEventTarget.ownerDocument;
|
2055 |
|
2056 | currentTimeStamp = nativeEvent.timeStamp;
|
2057 |
|
2058 | try {
|
2059 | batchedEventUpdates(function () {
|
2060 | traverseAndHandleEventResponderInstances(topLevelType, targetFiber, nativeEvent, nativeEventTarget, eventSystemFlags);
|
2061 | });
|
2062 | } finally {
|
2063 | currentTimers = previousTimers;
|
2064 | currentInstance = previousInstance;
|
2065 | currentTimeStamp = previousTimeStamp;
|
2066 | currentDocument = previousDocument;
|
2067 | currentPropagationBehavior = previousPropagationBehavior;
|
2068 | }
|
2069 | }
|
2070 | }
|
2071 | function addRootEventTypesForResponderInstance(responderInstance, rootEventTypes) {
|
2072 | for (var i = 0; i < rootEventTypes.length; i++) {
|
2073 | var rootEventType = rootEventTypes[i];
|
2074 | registerRootEventType(rootEventType, responderInstance);
|
2075 | }
|
2076 | }
|
2077 |
|
2078 | function registerRootEventType(rootEventType, eventResponderInstance) {
|
2079 | var rootEventResponderInstances = rootEventTypesToEventResponderInstances.get(rootEventType);
|
2080 |
|
2081 | if (rootEventResponderInstances === undefined) {
|
2082 | rootEventResponderInstances = new Set();
|
2083 | rootEventTypesToEventResponderInstances.set(rootEventType, rootEventResponderInstances);
|
2084 | }
|
2085 |
|
2086 | var rootEventTypesSet = eventResponderInstance.rootEventTypes;
|
2087 |
|
2088 | if (rootEventTypesSet === null) {
|
2089 | rootEventTypesSet = eventResponderInstance.rootEventTypes = new Set();
|
2090 | }
|
2091 |
|
2092 | (function () {
|
2093 | if (!!rootEventTypesSet.has(rootEventType)) {
|
2094 | {
|
2095 | throw ReactError(Error("addRootEventTypes() found a duplicate root event type of \"" + rootEventType + "\". This might be because the event type exists in the event responder \"rootEventTypes\" array or because of a previous addRootEventTypes() using this root event type."));
|
2096 | }
|
2097 | }
|
2098 | })();
|
2099 |
|
2100 | rootEventTypesSet.add(rootEventType);
|
2101 | rootEventResponderInstances.add(eventResponderInstance);
|
2102 | }
|
2103 |
|
2104 |
|
2105 |
|
2106 | var RESERVED = 0;
|
2107 |
|
2108 |
|
2109 | var STRING = 1;
|
2110 |
|
2111 |
|
2112 |
|
2113 |
|
2114 | var BOOLEANISH_STRING = 2;
|
2115 |
|
2116 |
|
2117 |
|
2118 | var BOOLEAN = 3;
|
2119 |
|
2120 |
|
2121 |
|
2122 |
|
2123 | var OVERLOADED_BOOLEAN = 4;
|
2124 |
|
2125 |
|
2126 | var NUMERIC = 5;
|
2127 |
|
2128 |
|
2129 | var POSITIVE_NUMERIC = 6;
|
2130 |
|
2131 |
|
2132 | var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
|
2133 |
|
2134 |
|
2135 | var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
2136 |
|
2137 | var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
|
2138 | var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
2139 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
2140 | var illegalAttributeNameCache = {};
|
2141 | var validatedAttributeNameCache = {};
|
2142 | function isAttributeNameSafe(attributeName) {
|
2143 | if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
|
2144 | return true;
|
2145 | }
|
2146 |
|
2147 | if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) {
|
2148 | return false;
|
2149 | }
|
2150 |
|
2151 | if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
|
2152 | validatedAttributeNameCache[attributeName] = true;
|
2153 | return true;
|
2154 | }
|
2155 |
|
2156 | illegalAttributeNameCache[attributeName] = true;
|
2157 |
|
2158 | {
|
2159 | warning$1(false, 'Invalid attribute name: `%s`', attributeName);
|
2160 | }
|
2161 |
|
2162 | return false;
|
2163 | }
|
2164 | function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
|
2165 | if (propertyInfo !== null) {
|
2166 | return propertyInfo.type === RESERVED;
|
2167 | }
|
2168 |
|
2169 | if (isCustomComponentTag) {
|
2170 | return false;
|
2171 | }
|
2172 |
|
2173 | if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
|
2174 | return true;
|
2175 | }
|
2176 |
|
2177 | return false;
|
2178 | }
|
2179 | function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
|
2180 | if (propertyInfo !== null && propertyInfo.type === RESERVED) {
|
2181 | return false;
|
2182 | }
|
2183 |
|
2184 | switch (typeof value) {
|
2185 | case 'function':
|
2186 |
|
2187 | case 'symbol':
|
2188 |
|
2189 | return true;
|
2190 |
|
2191 | case 'boolean':
|
2192 | {
|
2193 | if (isCustomComponentTag) {
|
2194 | return false;
|
2195 | }
|
2196 |
|
2197 | if (propertyInfo !== null) {
|
2198 | return !propertyInfo.acceptsBooleans;
|
2199 | } else {
|
2200 | var prefix = name.toLowerCase().slice(0, 5);
|
2201 | return prefix !== 'data-' && prefix !== 'aria-';
|
2202 | }
|
2203 | }
|
2204 |
|
2205 | default:
|
2206 | return false;
|
2207 | }
|
2208 | }
|
2209 | function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
|
2210 | if (value === null || typeof value === 'undefined') {
|
2211 | return true;
|
2212 | }
|
2213 |
|
2214 | if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
|
2215 | return true;
|
2216 | }
|
2217 |
|
2218 | if (isCustomComponentTag) {
|
2219 | return false;
|
2220 | }
|
2221 |
|
2222 | if (propertyInfo !== null) {
|
2223 | switch (propertyInfo.type) {
|
2224 | case BOOLEAN:
|
2225 | return !value;
|
2226 |
|
2227 | case OVERLOADED_BOOLEAN:
|
2228 | return value === false;
|
2229 |
|
2230 | case NUMERIC:
|
2231 | return isNaN(value);
|
2232 |
|
2233 | case POSITIVE_NUMERIC:
|
2234 | return isNaN(value) || value < 1;
|
2235 | }
|
2236 | }
|
2237 |
|
2238 | return false;
|
2239 | }
|
2240 | function getPropertyInfo(name) {
|
2241 | return properties.hasOwnProperty(name) ? properties[name] : null;
|
2242 | }
|
2243 |
|
2244 | function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL) {
|
2245 | this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
|
2246 | this.attributeName = attributeName;
|
2247 | this.attributeNamespace = attributeNamespace;
|
2248 | this.mustUseProperty = mustUseProperty;
|
2249 | this.propertyName = name;
|
2250 | this.type = type;
|
2251 | this.sanitizeURL = sanitizeURL;
|
2252 | }
|
2253 |
|
2254 |
|
2255 |
|
2256 |
|
2257 | var properties = {};
|
2258 |
|
2259 | ['children', 'dangerouslySetInnerHTML',
|
2260 |
|
2261 |
|
2262 | 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) {
|
2263 | properties[name] = new PropertyInfoRecord(name, RESERVED, false,
|
2264 | name,
|
2265 | null,
|
2266 | false);
|
2267 | });
|
2268 |
|
2269 |
|
2270 | [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
|
2271 | var name = _ref[0],
|
2272 | attributeName = _ref[1];
|
2273 | properties[name] = new PropertyInfoRecord(name, STRING, false,
|
2274 | attributeName,
|
2275 | null,
|
2276 | false);
|
2277 | });
|
2278 |
|
2279 |
|
2280 |
|
2281 | ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
|
2282 | properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false,
|
2283 | name.toLowerCase(),
|
2284 | null,
|
2285 | false);
|
2286 | });
|
2287 |
|
2288 |
|
2289 |
|
2290 |
|
2291 | ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
|
2292 | properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false,
|
2293 | name,
|
2294 | null,
|
2295 | false);
|
2296 | });
|
2297 |
|
2298 | ['allowFullScreen', 'async',
|
2299 |
|
2300 | 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless',
|
2301 | 'itemScope'].forEach(function (name) {
|
2302 | properties[name] = new PropertyInfoRecord(name, BOOLEAN, false,
|
2303 | name.toLowerCase(),
|
2304 | null,
|
2305 | false);
|
2306 | });
|
2307 |
|
2308 |
|
2309 | ['checked',
|
2310 |
|
2311 | 'multiple', 'muted', 'selected'].forEach(function (name) {
|
2312 | properties[name] = new PropertyInfoRecord(name, BOOLEAN, true,
|
2313 | name,
|
2314 | null,
|
2315 | false);
|
2316 | });
|
2317 |
|
2318 |
|
2319 | ['capture', 'download'].forEach(function (name) {
|
2320 | properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false,
|
2321 | name,
|
2322 | null,
|
2323 | false);
|
2324 | });
|
2325 |
|
2326 | ['cols', 'rows', 'size', 'span'].forEach(function (name) {
|
2327 | properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false,
|
2328 | name,
|
2329 | null,
|
2330 | false);
|
2331 | });
|
2332 |
|
2333 | ['rowSpan', 'start'].forEach(function (name) {
|
2334 | properties[name] = new PropertyInfoRecord(name, NUMERIC, false,
|
2335 | name.toLowerCase(),
|
2336 | null,
|
2337 | false);
|
2338 | });
|
2339 | var CAMELIZE = /[\-\:]([a-z])/g;
|
2340 |
|
2341 | var capitalize = function (token) {
|
2342 | return token[1].toUpperCase();
|
2343 | };
|
2344 |
|
2345 |
|
2346 |
|
2347 |
|
2348 |
|
2349 |
|
2350 | ['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) {
|
2351 | var name = attributeName.replace(CAMELIZE, capitalize);
|
2352 | properties[name] = new PropertyInfoRecord(name, STRING, false,
|
2353 | attributeName, null,
|
2354 | false);
|
2355 | });
|
2356 |
|
2357 | ['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
|
2358 | var name = attributeName.replace(CAMELIZE, capitalize);
|
2359 | properties[name] = new PropertyInfoRecord(name, STRING, false,
|
2360 | attributeName, 'http://www.w3.org/1999/xlink', false);
|
2361 | });
|
2362 |
|
2363 | ['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) {
|
2364 | var name = attributeName.replace(CAMELIZE, capitalize);
|
2365 | properties[name] = new PropertyInfoRecord(name, STRING, false,
|
2366 | attributeName, 'http://www.w3.org/XML/1998/namespace', false);
|
2367 | });
|
2368 |
|
2369 |
|
2370 |
|
2371 | ['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
|
2372 | properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false,
|
2373 | attributeName.toLowerCase(),
|
2374 | null,
|
2375 | false);
|
2376 | });
|
2377 |
|
2378 |
|
2379 | var xlinkHref = 'xlinkHref';
|
2380 | properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false,
|
2381 | 'xlink:href', 'http://www.w3.org/1999/xlink', true);
|
2382 | ['src', 'href', 'action', 'formAction'].forEach(function (attributeName) {
|
2383 | properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false,
|
2384 | attributeName.toLowerCase(),
|
2385 | null,
|
2386 | true);
|
2387 | });
|
2388 |
|
2389 | var ReactDebugCurrentFrame$1 = null;
|
2390 |
|
2391 | {
|
2392 | ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
2393 | }
|
2394 |
|
2395 |
|
2396 |
|
2397 |
|
2398 |
|
2399 |
|
2400 |
|
2401 |
|
2402 |
|
2403 |
|
2404 |
|
2405 | var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
|
2406 | var didWarn = false;
|
2407 |
|
2408 | function sanitizeURL(url) {
|
2409 | if (disableJavaScriptURLs) {
|
2410 | (function () {
|
2411 | if (!!isJavaScriptProtocol.test(url)) {
|
2412 | {
|
2413 | throw ReactError(Error("React has blocked a javascript: URL as a security precaution." + (ReactDebugCurrentFrame$1.getStackAddendum())));
|
2414 | }
|
2415 | }
|
2416 | })();
|
2417 | } else if (true && !didWarn && isJavaScriptProtocol.test(url)) {
|
2418 | didWarn = true;
|
2419 | 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));
|
2420 | }
|
2421 | }
|
2422 |
|
2423 |
|
2424 |
|
2425 |
|
2426 | function toString(value) {
|
2427 | return '' + value;
|
2428 | }
|
2429 | function getToStringValue(value) {
|
2430 | switch (typeof value) {
|
2431 | case 'boolean':
|
2432 | case 'number':
|
2433 | case 'object':
|
2434 | case 'string':
|
2435 | case 'undefined':
|
2436 | return value;
|
2437 |
|
2438 | default:
|
2439 |
|
2440 | return '';
|
2441 | }
|
2442 | }
|
2443 |
|
2444 |
|
2445 |
|
2446 |
|
2447 |
|
2448 |
|
2449 |
|
2450 |
|
2451 |
|
2452 | var toStringOrTrustedType = toString;
|
2453 |
|
2454 | if (enableTrustedTypesIntegration && typeof trustedTypes !== 'undefined') {
|
2455 | var isHTML = trustedTypes.isHTML;
|
2456 | var isScript = trustedTypes.isScript;
|
2457 | var isScriptURL = trustedTypes.isScriptURL;
|
2458 |
|
2459 | var isURL = trustedTypes.isURL ? trustedTypes.isURL : function (value) {
|
2460 | return false;
|
2461 | };
|
2462 |
|
2463 | toStringOrTrustedType = function (value) {
|
2464 | if (typeof value === 'object' && (isHTML(value) || isScript(value) || isScriptURL(value) || isURL(value))) {
|
2465 |
|
2466 | return value;
|
2467 | }
|
2468 |
|
2469 | return toString(value);
|
2470 | };
|
2471 | }
|
2472 |
|
2473 |
|
2474 |
|
2475 |
|
2476 |
|
2477 | function setAttribute(node, attributeName, attributeValue) {
|
2478 | node.setAttribute(attributeName, attributeValue);
|
2479 | }
|
2480 |
|
2481 |
|
2482 |
|
2483 |
|
2484 |
|
2485 | function setAttributeNS(node, attributeNamespace, attributeName, attributeValue) {
|
2486 | node.setAttributeNS(attributeNamespace, attributeName, attributeValue);
|
2487 | }
|
2488 |
|
2489 |
|
2490 |
|
2491 |
|
2492 |
|
2493 |
|
2494 | function getValueForProperty(node, name, expected, propertyInfo) {
|
2495 | {
|
2496 | if (propertyInfo.mustUseProperty) {
|
2497 | var propertyName = propertyInfo.propertyName;
|
2498 | return node[propertyName];
|
2499 | } else {
|
2500 | if (!disableJavaScriptURLs && propertyInfo.sanitizeURL) {
|
2501 |
|
2502 |
|
2503 |
|
2504 | sanitizeURL('' + expected);
|
2505 | }
|
2506 |
|
2507 | var attributeName = propertyInfo.attributeName;
|
2508 | var stringValue = null;
|
2509 |
|
2510 | if (propertyInfo.type === OVERLOADED_BOOLEAN) {
|
2511 | if (node.hasAttribute(attributeName)) {
|
2512 | var value = node.getAttribute(attributeName);
|
2513 |
|
2514 | if (value === '') {
|
2515 | return true;
|
2516 | }
|
2517 |
|
2518 | if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
|
2519 | return value;
|
2520 | }
|
2521 |
|
2522 | if (value === '' + expected) {
|
2523 | return expected;
|
2524 | }
|
2525 |
|
2526 | return value;
|
2527 | }
|
2528 | } else if (node.hasAttribute(attributeName)) {
|
2529 | if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
|
2530 |
|
2531 |
|
2532 | return node.getAttribute(attributeName);
|
2533 | }
|
2534 |
|
2535 | if (propertyInfo.type === BOOLEAN) {
|
2536 |
|
2537 |
|
2538 | return expected;
|
2539 | }
|
2540 |
|
2541 |
|
2542 |
|
2543 |
|
2544 |
|
2545 | stringValue = node.getAttribute(attributeName);
|
2546 | }
|
2547 |
|
2548 | if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
|
2549 | return stringValue === null ? expected : stringValue;
|
2550 | } else if (stringValue === '' + expected) {
|
2551 | return expected;
|
2552 | } else {
|
2553 | return stringValue;
|
2554 | }
|
2555 | }
|
2556 | }
|
2557 | }
|
2558 |
|
2559 |
|
2560 |
|
2561 |
|
2562 |
|
2563 |
|
2564 | function getValueForAttribute(node, name, expected) {
|
2565 | {
|
2566 | if (!isAttributeNameSafe(name)) {
|
2567 | return;
|
2568 | }
|
2569 |
|
2570 | if (!node.hasAttribute(name)) {
|
2571 | return expected === undefined ? undefined : null;
|
2572 | }
|
2573 |
|
2574 | var value = node.getAttribute(name);
|
2575 |
|
2576 | if (value === '' + expected) {
|
2577 | return expected;
|
2578 | }
|
2579 |
|
2580 | return value;
|
2581 | }
|
2582 | }
|
2583 |
|
2584 |
|
2585 |
|
2586 |
|
2587 |
|
2588 |
|
2589 |
|
2590 |
|
2591 | function setValueForProperty(node, name, value, isCustomComponentTag) {
|
2592 | var propertyInfo = getPropertyInfo(name);
|
2593 |
|
2594 | if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) {
|
2595 | return;
|
2596 | }
|
2597 |
|
2598 | if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) {
|
2599 | value = null;
|
2600 | }
|
2601 |
|
2602 |
|
2603 | if (isCustomComponentTag || propertyInfo === null) {
|
2604 | if (isAttributeNameSafe(name)) {
|
2605 | var _attributeName = name;
|
2606 |
|
2607 | if (value === null) {
|
2608 | node.removeAttribute(_attributeName);
|
2609 | } else {
|
2610 | setAttribute(node, _attributeName, toStringOrTrustedType(value));
|
2611 | }
|
2612 | }
|
2613 |
|
2614 | return;
|
2615 | }
|
2616 |
|
2617 | var mustUseProperty = propertyInfo.mustUseProperty;
|
2618 |
|
2619 | if (mustUseProperty) {
|
2620 | var propertyName = propertyInfo.propertyName;
|
2621 |
|
2622 | if (value === null) {
|
2623 | var type = propertyInfo.type;
|
2624 | node[propertyName] = type === BOOLEAN ? false : '';
|
2625 | } else {
|
2626 |
|
2627 |
|
2628 | node[propertyName] = value;
|
2629 | }
|
2630 |
|
2631 | return;
|
2632 | }
|
2633 |
|
2634 |
|
2635 | var attributeName = propertyInfo.attributeName,
|
2636 | attributeNamespace = propertyInfo.attributeNamespace;
|
2637 |
|
2638 | if (value === null) {
|
2639 | node.removeAttribute(attributeName);
|
2640 | } else {
|
2641 | var _type = propertyInfo.type;
|
2642 | var attributeValue;
|
2643 |
|
2644 | if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) {
|
2645 |
|
2646 |
|
2647 | attributeValue = '';
|
2648 | } else {
|
2649 |
|
2650 |
|
2651 | attributeValue = toStringOrTrustedType(value);
|
2652 |
|
2653 | if (propertyInfo.sanitizeURL) {
|
2654 | sanitizeURL(attributeValue.toString());
|
2655 | }
|
2656 | }
|
2657 |
|
2658 | if (attributeNamespace) {
|
2659 | setAttributeNS(node, attributeNamespace, attributeName, attributeValue);
|
2660 | } else {
|
2661 | setAttribute(node, attributeName, attributeValue);
|
2662 | }
|
2663 | }
|
2664 | }
|
2665 |
|
2666 |
|
2667 |
|
2668 |
|
2669 |
|
2670 |
|
2671 |
|
2672 |
|
2673 |
|
2674 |
|
2675 | var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
2676 |
|
2677 | var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
2678 |
|
2679 |
|
2680 |
|
2681 |
|
2682 |
|
2683 |
|
2684 |
|
2685 |
|
2686 |
|
2687 |
|
2688 | var printWarning = function() {};
|
2689 |
|
2690 | {
|
2691 | var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
2692 | var loggedTypeFailures = {};
|
2693 | var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
2694 |
|
2695 | printWarning = function(text) {
|
2696 | var message = 'Warning: ' + text;
|
2697 | if (typeof console !== 'undefined') {
|
2698 | console.error(message);
|
2699 | }
|
2700 | try {
|
2701 |
|
2702 |
|
2703 |
|
2704 | throw new Error(message);
|
2705 | } catch (x) {}
|
2706 | };
|
2707 | }
|
2708 |
|
2709 |
|
2710 |
|
2711 |
|
2712 |
|
2713 |
|
2714 |
|
2715 |
|
2716 |
|
2717 |
|
2718 |
|
2719 |
|
2720 | function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
2721 | {
|
2722 | for (var typeSpecName in typeSpecs) {
|
2723 | if (has(typeSpecs, typeSpecName)) {
|
2724 | var error;
|
2725 |
|
2726 |
|
2727 |
|
2728 | try {
|
2729 |
|
2730 |
|
2731 | if (typeof typeSpecs[typeSpecName] !== 'function') {
|
2732 | var err = Error(
|
2733 | (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
2734 | 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
|
2735 | );
|
2736 | err.name = 'Invariant Violation';
|
2737 | throw err;
|
2738 | }
|
2739 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
2740 | } catch (ex) {
|
2741 | error = ex;
|
2742 | }
|
2743 | if (error && !(error instanceof Error)) {
|
2744 | printWarning(
|
2745 | (componentName || 'React class') + ': type specification of ' +
|
2746 | location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
2747 | 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
2748 | 'You may have forgotten to pass an argument to the type checker ' +
|
2749 | 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
2750 | 'shape all require an argument).'
|
2751 | );
|
2752 | }
|
2753 | if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
2754 |
|
2755 |
|
2756 | loggedTypeFailures[error.message] = true;
|
2757 |
|
2758 | var stack = getStack ? getStack() : '';
|
2759 |
|
2760 | printWarning(
|
2761 | 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
2762 | );
|
2763 | }
|
2764 | }
|
2765 | }
|
2766 | }
|
2767 | }
|
2768 |
|
2769 |
|
2770 |
|
2771 |
|
2772 |
|
2773 |
|
2774 | checkPropTypes.resetWarningCache = function() {
|
2775 | {
|
2776 | loggedTypeFailures = {};
|
2777 | }
|
2778 | };
|
2779 |
|
2780 | var checkPropTypes_1 = checkPropTypes;
|
2781 |
|
2782 | var ReactDebugCurrentFrame$2 = null;
|
2783 | var ReactControlledValuePropTypes = {
|
2784 | checkPropTypes: null
|
2785 | };
|
2786 |
|
2787 | {
|
2788 | ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
2789 | var hasReadOnlyValue = {
|
2790 | button: true,
|
2791 | checkbox: true,
|
2792 | image: true,
|
2793 | hidden: true,
|
2794 | radio: true,
|
2795 | reset: true,
|
2796 | submit: true
|
2797 | };
|
2798 | var propTypes = {
|
2799 | value: function (props, propName, componentName) {
|
2800 | if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) {
|
2801 | return null;
|
2802 | }
|
2803 |
|
2804 | 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`.');
|
2805 | },
|
2806 | checked: function (props, propName, componentName) {
|
2807 | if (props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) {
|
2808 | return null;
|
2809 | }
|
2810 |
|
2811 | 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`.');
|
2812 | }
|
2813 | };
|
2814 | |
2815 |
|
2816 |
|
2817 |
|
2818 |
|
2819 | ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
|
2820 | checkPropTypes_1(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$2.getStackAddendum);
|
2821 | };
|
2822 | }
|
2823 |
|
2824 | function isCheckable(elem) {
|
2825 | var type = elem.type;
|
2826 | var nodeName = elem.nodeName;
|
2827 | return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio');
|
2828 | }
|
2829 |
|
2830 | function getTracker(node) {
|
2831 | return node._valueTracker;
|
2832 | }
|
2833 |
|
2834 | function detachTracker(node) {
|
2835 | node._valueTracker = null;
|
2836 | }
|
2837 |
|
2838 | function getValueFromNode(node) {
|
2839 | var value = '';
|
2840 |
|
2841 | if (!node) {
|
2842 | return value;
|
2843 | }
|
2844 |
|
2845 | if (isCheckable(node)) {
|
2846 | value = node.checked ? 'true' : 'false';
|
2847 | } else {
|
2848 | value = node.value;
|
2849 | }
|
2850 |
|
2851 | return value;
|
2852 | }
|
2853 |
|
2854 | function trackValueOnNode(node) {
|
2855 | var valueField = isCheckable(node) ? 'checked' : 'value';
|
2856 | var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField);
|
2857 | var currentValue = '' + node[valueField];
|
2858 |
|
2859 |
|
2860 |
|
2861 |
|
2862 | if (node.hasOwnProperty(valueField) || typeof descriptor === 'undefined' || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') {
|
2863 | return;
|
2864 | }
|
2865 |
|
2866 | var get = descriptor.get,
|
2867 | set = descriptor.set;
|
2868 | Object.defineProperty(node, valueField, {
|
2869 | configurable: true,
|
2870 | get: function () {
|
2871 | return get.call(this);
|
2872 | },
|
2873 | set: function (value) {
|
2874 | currentValue = '' + value;
|
2875 | set.call(this, value);
|
2876 | }
|
2877 | }); // We could've passed this the first time
|
2878 | // but it triggers a bug in IE11 and Edge 14/15.
|
2879 | // Calling defineProperty() again should be equivalent.
|
2880 | // https://github.com/facebook/react/issues/11768
|
2881 |
|
2882 | Object.defineProperty(node, valueField, {
|
2883 | enumerable: descriptor.enumerable
|
2884 | });
|
2885 | var tracker = {
|
2886 | getValue: function () {
|
2887 | return currentValue;
|
2888 | },
|
2889 | setValue: function (value) {
|
2890 | currentValue = '' + value;
|
2891 | },
|
2892 | stopTracking: function () {
|
2893 | detachTracker(node);
|
2894 | delete node[valueField];
|
2895 | }
|
2896 | };
|
2897 | return tracker;
|
2898 | }
|
2899 |
|
2900 | function track(node) {
|
2901 | if (getTracker(node)) {
|
2902 | return;
|
2903 | }
|
2904 |
|
2905 |
|
2906 | node._valueTracker = trackValueOnNode(node);
|
2907 | }
|
2908 | function updateValueIfChanged(node) {
|
2909 | if (!node) {
|
2910 | return false;
|
2911 | }
|
2912 |
|
2913 | var tracker = getTracker(node);
|
2914 |
|
2915 |
|
2916 | if (!tracker) {
|
2917 | return true;
|
2918 | }
|
2919 |
|
2920 | var lastValue = tracker.getValue();
|
2921 | var nextValue = getValueFromNode(node);
|
2922 |
|
2923 | if (nextValue !== lastValue) {
|
2924 | tracker.setValue(nextValue);
|
2925 | return true;
|
2926 | }
|
2927 |
|
2928 | return false;
|
2929 | }
|
2930 |
|
2931 |
|
2932 | var didWarnValueDefaultValue = false;
|
2933 | var didWarnCheckedDefaultChecked = false;
|
2934 | var didWarnControlledToUncontrolled = false;
|
2935 | var didWarnUncontrolledToControlled = false;
|
2936 |
|
2937 | function isControlled(props) {
|
2938 | var usesChecked = props.type === 'checkbox' || props.type === 'radio';
|
2939 | return usesChecked ? props.checked != null : props.value != null;
|
2940 | }
|
2941 |
|
2942 |
|
2943 |
|
2944 |
|
2945 |
|
2946 |
|
2947 |
|
2948 |
|
2949 |
|
2950 |
|
2951 |
|
2952 |
|
2953 |
|
2954 |
|
2955 |
|
2956 |
|
2957 |
|
2958 |
|
2959 | function getHostProps(element, props) {
|
2960 | var node = element;
|
2961 | var checked = props.checked;
|
2962 |
|
2963 | var hostProps = _assign({}, props, {
|
2964 | defaultChecked: undefined,
|
2965 | defaultValue: undefined,
|
2966 | value: undefined,
|
2967 | checked: checked != null ? checked : node._wrapperState.initialChecked
|
2968 | });
|
2969 |
|
2970 | return hostProps;
|
2971 | }
|
2972 | function initWrapperState(element, props) {
|
2973 | {
|
2974 | ReactControlledValuePropTypes.checkPropTypes('input', props);
|
2975 |
|
2976 | if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
|
2977 | 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', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type);
|
2978 | didWarnCheckedDefaultChecked = true;
|
2979 | }
|
2980 |
|
2981 | if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
|
2982 | 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', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type);
|
2983 | didWarnValueDefaultValue = true;
|
2984 | }
|
2985 | }
|
2986 |
|
2987 | var node = element;
|
2988 | var defaultValue = props.defaultValue == null ? '' : props.defaultValue;
|
2989 | node._wrapperState = {
|
2990 | initialChecked: props.checked != null ? props.checked : props.defaultChecked,
|
2991 | initialValue: getToStringValue(props.value != null ? props.value : defaultValue),
|
2992 | controlled: isControlled(props)
|
2993 | };
|
2994 | }
|
2995 | function updateChecked(element, props) {
|
2996 | var node = element;
|
2997 | var checked = props.checked;
|
2998 |
|
2999 | if (checked != null) {
|
3000 | setValueForProperty(node, 'checked', checked, false);
|
3001 | }
|
3002 | }
|
3003 | function updateWrapper(element, props) {
|
3004 | var node = element;
|
3005 |
|
3006 | {
|
3007 | var controlled = isControlled(props);
|
3008 |
|
3009 | if (!node._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) {
|
3010 | warning$1(false, 'A component is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type);
|
3011 | didWarnUncontrolledToControlled = true;
|
3012 | }
|
3013 |
|
3014 | if (node._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) {
|
3015 | warning$1(false, 'A component is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type);
|
3016 | didWarnControlledToUncontrolled = true;
|
3017 | }
|
3018 | }
|
3019 |
|
3020 | updateChecked(element, props);
|
3021 | var value = getToStringValue(props.value);
|
3022 | var type = props.type;
|
3023 |
|
3024 | if (value != null) {
|
3025 | if (type === 'number') {
|
3026 | if (value === 0 && node.value === '' ||
|
3027 |
|
3028 | node.value != value) {
|
3029 | node.value = toString(value);
|
3030 | }
|
3031 | } else if (node.value !== toString(value)) {
|
3032 | node.value = toString(value);
|
3033 | }
|
3034 | } else if (type === 'submit' || type === 'reset') {
|
3035 |
|
3036 |
|
3037 | node.removeAttribute('value');
|
3038 | return;
|
3039 | }
|
3040 |
|
3041 | if (disableInputAttributeSyncing) {
|
3042 |
|
3043 |
|
3044 |
|
3045 | if (props.hasOwnProperty('defaultValue')) {
|
3046 | setDefaultValue(node, props.type, getToStringValue(props.defaultValue));
|
3047 | }
|
3048 | } else {
|
3049 |
|
3050 |
|
3051 |
|
3052 |
|
3053 |
|
3054 | if (props.hasOwnProperty('value')) {
|
3055 | setDefaultValue(node, props.type, value);
|
3056 | } else if (props.hasOwnProperty('defaultValue')) {
|
3057 | setDefaultValue(node, props.type, getToStringValue(props.defaultValue));
|
3058 | }
|
3059 | }
|
3060 |
|
3061 | if (disableInputAttributeSyncing) {
|
3062 |
|
3063 |
|
3064 |
|
3065 | if (props.defaultChecked == null) {
|
3066 | node.removeAttribute('checked');
|
3067 | } else {
|
3068 | node.defaultChecked = !!props.defaultChecked;
|
3069 | }
|
3070 | } else {
|
3071 |
|
3072 |
|
3073 | if (props.checked == null && props.defaultChecked != null) {
|
3074 | node.defaultChecked = !!props.defaultChecked;
|
3075 | }
|
3076 | }
|
3077 | }
|
3078 | function postMountWrapper(element, props, isHydrating) {
|
3079 | var node = element;
|
3080 |
|
3081 |
|
3082 | if (props.hasOwnProperty('value') || props.hasOwnProperty('defaultValue')) {
|
3083 | var type = props.type;
|
3084 | var isButton = type === 'submit' || type === 'reset';
|
3085 |
|
3086 |
|
3087 | if (isButton && (props.value === undefined || props.value === null)) {
|
3088 | return;
|
3089 | }
|
3090 |
|
3091 | var initialValue = toString(node._wrapperState.initialValue);
|
3092 |
|
3093 |
|
3094 | if (!isHydrating) {
|
3095 | if (disableInputAttributeSyncing) {
|
3096 | var value = getToStringValue(props.value);
|
3097 |
|
3098 |
|
3099 | if (value != null) {
|
3100 |
|
3101 |
|
3102 |
|
3103 |
|
3104 |
|
3105 |
|
3106 |
|
3107 |
|
3108 | if (isButton || value !== node.value) {
|
3109 | node.value = toString(value);
|
3110 | }
|
3111 | }
|
3112 | } else {
|
3113 |
|
3114 |
|
3115 |
|
3116 |
|
3117 |
|
3118 |
|
3119 | if (initialValue !== node.value) {
|
3120 | node.value = initialValue;
|
3121 | }
|
3122 | }
|
3123 | }
|
3124 |
|
3125 | if (disableInputAttributeSyncing) {
|
3126 |
|
3127 |
|
3128 | var defaultValue = getToStringValue(props.defaultValue);
|
3129 |
|
3130 | if (defaultValue != null) {
|
3131 | node.defaultValue = toString(defaultValue);
|
3132 | }
|
3133 | } else {
|
3134 |
|
3135 |
|
3136 |
|
3137 | node.defaultValue = initialValue;
|
3138 | }
|
3139 | }
|
3140 |
|
3141 |
|
3142 |
|
3143 |
|
3144 |
|
3145 |
|
3146 | var name = node.name;
|
3147 |
|
3148 | if (name !== '') {
|
3149 | node.name = '';
|
3150 | }
|
3151 |
|
3152 | if (disableInputAttributeSyncing) {
|
3153 |
|
3154 |
|
3155 |
|
3156 |
|
3157 | if (!isHydrating) {
|
3158 | updateChecked(element, props);
|
3159 | }
|
3160 |
|
3161 |
|
3162 |
|
3163 |
|
3164 | if (props.hasOwnProperty('defaultChecked')) {
|
3165 | node.defaultChecked = !node.defaultChecked;
|
3166 | node.defaultChecked = !!props.defaultChecked;
|
3167 | }
|
3168 | } else {
|
3169 |
|
3170 |
|
3171 |
|
3172 |
|
3173 |
|
3174 |
|
3175 | node.defaultChecked = !node.defaultChecked;
|
3176 | node.defaultChecked = !!node._wrapperState.initialChecked;
|
3177 | }
|
3178 |
|
3179 | if (name !== '') {
|
3180 | node.name = name;
|
3181 | }
|
3182 | }
|
3183 | function restoreControlledState$1(element, props) {
|
3184 | var node = element;
|
3185 | updateWrapper(node, props);
|
3186 | updateNamedCousins(node, props);
|
3187 | }
|
3188 |
|
3189 | function updateNamedCousins(rootNode, props) {
|
3190 | var name = props.name;
|
3191 |
|
3192 | if (props.type === 'radio' && name != null) {
|
3193 | var queryRoot = rootNode;
|
3194 |
|
3195 | while (queryRoot.parentNode) {
|
3196 | queryRoot = queryRoot.parentNode;
|
3197 | }
|
3198 |
|
3199 |
|
3200 |
|
3201 |
|
3202 |
|
3203 |
|
3204 |
|
3205 |
|
3206 | var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
|
3207 |
|
3208 | for (var i = 0; i < group.length; i++) {
|
3209 | var otherNode = group[i];
|
3210 |
|
3211 | if (otherNode === rootNode || otherNode.form !== rootNode.form) {
|
3212 | continue;
|
3213 | }
|
3214 |
|
3215 |
|
3216 |
|
3217 |
|
3218 |
|
3219 | var otherProps = getFiberCurrentPropsFromNode$1(otherNode);
|
3220 |
|
3221 | (function () {
|
3222 | if (!otherProps) {
|
3223 | {
|
3224 | throw ReactError(Error("ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported."));
|
3225 | }
|
3226 | }
|
3227 | })();
|
3228 |
|
3229 |
|
3230 |
|
3231 | updateValueIfChanged(otherNode);
|
3232 |
|
3233 |
|
3234 |
|
3235 | updateWrapper(otherNode, otherProps);
|
3236 | }
|
3237 | }
|
3238 | }
|
3239 |
|
3240 |
|
3241 |
|
3242 |
|
3243 |
|
3244 |
|
3245 |
|
3246 |
|
3247 |
|
3248 | function setDefaultValue(node, type, value) {
|
3249 | if (
|
3250 | type !== 'number' || node.ownerDocument.activeElement !== node) {
|
3251 | if (value == null) {
|
3252 | node.defaultValue = toString(node._wrapperState.initialValue);
|
3253 | } else if (node.defaultValue !== toString(value)) {
|
3254 | node.defaultValue = toString(value);
|
3255 | }
|
3256 | }
|
3257 | }
|
3258 |
|
3259 | var didWarnSelectedSetOnOption = false;
|
3260 | var didWarnInvalidChild = false;
|
3261 |
|
3262 | function flattenChildren(children) {
|
3263 | var content = '';
|
3264 |
|
3265 |
|
3266 |
|
3267 |
|
3268 |
|
3269 | React.Children.forEach(children, function (child) {
|
3270 | if (child == null) {
|
3271 | return;
|
3272 | }
|
3273 |
|
3274 | content += child;
|
3275 |
|
3276 |
|
3277 | });
|
3278 | return content;
|
3279 | }
|
3280 |
|
3281 |
|
3282 |
|
3283 |
|
3284 |
|
3285 | function validateProps(element, props) {
|
3286 | {
|
3287 |
|
3288 |
|
3289 |
|
3290 |
|
3291 | if (typeof props.children === 'object' && props.children !== null) {
|
3292 | React.Children.forEach(props.children, function (child) {
|
3293 | if (child == null) {
|
3294 | return;
|
3295 | }
|
3296 |
|
3297 | if (typeof child === 'string' || typeof child === 'number') {
|
3298 | return;
|
3299 | }
|
3300 |
|
3301 | if (typeof child.type !== 'string') {
|
3302 | return;
|
3303 | }
|
3304 |
|
3305 | if (!didWarnInvalidChild) {
|
3306 | didWarnInvalidChild = true;
|
3307 | warning$1(false, 'Only strings and numbers are supported as <option> children.');
|
3308 | }
|
3309 | });
|
3310 | }
|
3311 |
|
3312 |
|
3313 | if (props.selected != null && !didWarnSelectedSetOnOption) {
|
3314 | warning$1(false, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.');
|
3315 | didWarnSelectedSetOnOption = true;
|
3316 | }
|
3317 | }
|
3318 | }
|
3319 | function postMountWrapper$1(element, props) {
|
3320 |
|
3321 | if (props.value != null) {
|
3322 | element.setAttribute('value', toString(getToStringValue(props.value)));
|
3323 | }
|
3324 | }
|
3325 | function getHostProps$1(element, props) {
|
3326 | var hostProps = _assign({
|
3327 | children: undefined
|
3328 | }, props);
|
3329 |
|
3330 | var content = flattenChildren(props.children);
|
3331 |
|
3332 | if (content) {
|
3333 | hostProps.children = content;
|
3334 | }
|
3335 |
|
3336 | return hostProps;
|
3337 | }
|
3338 |
|
3339 |
|
3340 | var didWarnValueDefaultValue$1;
|
3341 |
|
3342 | {
|
3343 | didWarnValueDefaultValue$1 = false;
|
3344 | }
|
3345 |
|
3346 | function getDeclarationErrorAddendum() {
|
3347 | var ownerName = getCurrentFiberOwnerNameInDevOrNull();
|
3348 |
|
3349 | if (ownerName) {
|
3350 | return '\n\nCheck the render method of `' + ownerName + '`.';
|
3351 | }
|
3352 |
|
3353 | return '';
|
3354 | }
|
3355 |
|
3356 | var valuePropNames = ['value', 'defaultValue'];
|
3357 |
|
3358 |
|
3359 |
|
3360 |
|
3361 | function checkSelectPropTypes(props) {
|
3362 | ReactControlledValuePropTypes.checkPropTypes('select', props);
|
3363 |
|
3364 | for (var i = 0; i < valuePropNames.length; i++) {
|
3365 | var propName = valuePropNames[i];
|
3366 |
|
3367 | if (props[propName] == null) {
|
3368 | continue;
|
3369 | }
|
3370 |
|
3371 | var isArray = Array.isArray(props[propName]);
|
3372 |
|
3373 | if (props.multiple && !isArray) {
|
3374 | warning$1(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum());
|
3375 | } else if (!props.multiple && isArray) {
|
3376 | warning$1(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum());
|
3377 | }
|
3378 | }
|
3379 | }
|
3380 |
|
3381 | function updateOptions(node, multiple, propValue, setDefaultSelected) {
|
3382 | var options = node.options;
|
3383 |
|
3384 | if (multiple) {
|
3385 | var selectedValues = propValue;
|
3386 | var selectedValue = {};
|
3387 |
|
3388 | for (var i = 0; i < selectedValues.length; i++) {
|
3389 |
|
3390 | selectedValue['$' + selectedValues[i]] = true;
|
3391 | }
|
3392 |
|
3393 | for (var _i = 0; _i < options.length; _i++) {
|
3394 | var selected = selectedValue.hasOwnProperty('$' + options[_i].value);
|
3395 |
|
3396 | if (options[_i].selected !== selected) {
|
3397 | options[_i].selected = selected;
|
3398 | }
|
3399 |
|
3400 | if (selected && setDefaultSelected) {
|
3401 | options[_i].defaultSelected = true;
|
3402 | }
|
3403 | }
|
3404 | } else {
|
3405 |
|
3406 |
|
3407 | var _selectedValue = toString(getToStringValue(propValue));
|
3408 |
|
3409 | var defaultSelected = null;
|
3410 |
|
3411 | for (var _i2 = 0; _i2 < options.length; _i2++) {
|
3412 | if (options[_i2].value === _selectedValue) {
|
3413 | options[_i2].selected = true;
|
3414 |
|
3415 | if (setDefaultSelected) {
|
3416 | options[_i2].defaultSelected = true;
|
3417 | }
|
3418 |
|
3419 | return;
|
3420 | }
|
3421 |
|
3422 | if (defaultSelected === null && !options[_i2].disabled) {
|
3423 | defaultSelected = options[_i2];
|
3424 | }
|
3425 | }
|
3426 |
|
3427 | if (defaultSelected !== null) {
|
3428 | defaultSelected.selected = true;
|
3429 | }
|
3430 | }
|
3431 | }
|
3432 |
|
3433 |
|
3434 |
|
3435 |
|
3436 |
|
3437 |
|
3438 |
|
3439 |
|
3440 |
|
3441 |
|
3442 |
|
3443 |
|
3444 |
|
3445 |
|
3446 |
|
3447 |
|
3448 |
|
3449 | function getHostProps$2(element, props) {
|
3450 | return _assign({}, props, {
|
3451 | value: undefined
|
3452 | });
|
3453 | }
|
3454 | function initWrapperState$1(element, props) {
|
3455 | var node = element;
|
3456 |
|
3457 | {
|
3458 | checkSelectPropTypes(props);
|
3459 | }
|
3460 |
|
3461 | node._wrapperState = {
|
3462 | wasMultiple: !!props.multiple
|
3463 | };
|
3464 |
|
3465 | {
|
3466 | if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue$1) {
|
3467 | 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');
|
3468 | didWarnValueDefaultValue$1 = true;
|
3469 | }
|
3470 | }
|
3471 | }
|
3472 | function postMountWrapper$2(element, props) {
|
3473 | var node = element;
|
3474 | node.multiple = !!props.multiple;
|
3475 | var value = props.value;
|
3476 |
|
3477 | if (value != null) {
|
3478 | updateOptions(node, !!props.multiple, value, false);
|
3479 | } else if (props.defaultValue != null) {
|
3480 | updateOptions(node, !!props.multiple, props.defaultValue, true);
|
3481 | }
|
3482 | }
|
3483 | function postUpdateWrapper(element, props) {
|
3484 | var node = element;
|
3485 | var wasMultiple = node._wrapperState.wasMultiple;
|
3486 | node._wrapperState.wasMultiple = !!props.multiple;
|
3487 | var value = props.value;
|
3488 |
|
3489 | if (value != null) {
|
3490 | updateOptions(node, !!props.multiple, value, false);
|
3491 | } else if (wasMultiple !== !!props.multiple) {
|
3492 |
|
3493 | if (props.defaultValue != null) {
|
3494 | updateOptions(node, !!props.multiple, props.defaultValue, true);
|
3495 | } else {
|
3496 |
|
3497 | updateOptions(node, !!props.multiple, props.multiple ? [] : '', false);
|
3498 | }
|
3499 | }
|
3500 | }
|
3501 | function restoreControlledState$2(element, props) {
|
3502 | var node = element;
|
3503 | var value = props.value;
|
3504 |
|
3505 | if (value != null) {
|
3506 | updateOptions(node, !!props.multiple, value, false);
|
3507 | }
|
3508 | }
|
3509 |
|
3510 | var didWarnValDefaultVal = false;
|
3511 |
|
3512 |
|
3513 |
|
3514 |
|
3515 |
|
3516 |
|
3517 |
|
3518 |
|
3519 |
|
3520 |
|
3521 |
|
3522 |
|
3523 |
|
3524 |
|
3525 |
|
3526 |
|
3527 | function getHostProps$3(element, props) {
|
3528 | var node = element;
|
3529 |
|
3530 | (function () {
|
3531 | if (!(props.dangerouslySetInnerHTML == null)) {
|
3532 | {
|
3533 | throw ReactError(Error("`dangerouslySetInnerHTML` does not make sense on <textarea>."));
|
3534 | }
|
3535 | }
|
3536 | })();
|
3537 |
|
3538 |
|
3539 |
|
3540 |
|
3541 |
|
3542 |
|
3543 |
|
3544 | var hostProps = _assign({}, props, {
|
3545 | value: undefined,
|
3546 | defaultValue: undefined,
|
3547 | children: toString(node._wrapperState.initialValue)
|
3548 | });
|
3549 |
|
3550 | return hostProps;
|
3551 | }
|
3552 | function initWrapperState$2(element, props) {
|
3553 | var node = element;
|
3554 |
|
3555 | {
|
3556 | ReactControlledValuePropTypes.checkPropTypes('textarea', props);
|
3557 |
|
3558 | if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
|
3559 | warning$1(false, '%s contains a textarea with both value and defaultValue props. ' + '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', getCurrentFiberOwnerNameInDevOrNull() || 'A component');
|
3560 | didWarnValDefaultVal = true;
|
3561 | }
|
3562 | }
|
3563 |
|
3564 | var initialValue = props.value;
|
3565 |
|
3566 | if (initialValue == null) {
|
3567 | var defaultValue = props.defaultValue;
|
3568 |
|
3569 | var children = props.children;
|
3570 |
|
3571 | if (children != null) {
|
3572 | {
|
3573 | warning$1(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
|
3574 | }
|
3575 |
|
3576 | (function () {
|
3577 | if (!(defaultValue == null)) {
|
3578 | {
|
3579 | throw ReactError(Error("If you supply `defaultValue` on a <textarea>, do not pass children."));
|
3580 | }
|
3581 | }
|
3582 | })();
|
3583 |
|
3584 | if (Array.isArray(children)) {
|
3585 | (function () {
|
3586 | if (!(children.length <= 1)) {
|
3587 | {
|
3588 | throw ReactError(Error("<textarea> can only have at most one child."));
|
3589 | }
|
3590 | }
|
3591 | })();
|
3592 |
|
3593 | children = children[0];
|
3594 | }
|
3595 |
|
3596 | defaultValue = children;
|
3597 | }
|
3598 |
|
3599 | if (defaultValue == null) {
|
3600 | defaultValue = '';
|
3601 | }
|
3602 |
|
3603 | initialValue = defaultValue;
|
3604 | }
|
3605 |
|
3606 | node._wrapperState = {
|
3607 | initialValue: getToStringValue(initialValue)
|
3608 | };
|
3609 | }
|
3610 | function updateWrapper$1(element, props) {
|
3611 | var node = element;
|
3612 | var value = getToStringValue(props.value);
|
3613 | var defaultValue = getToStringValue(props.defaultValue);
|
3614 |
|
3615 | if (value != null) {
|
3616 |
|
3617 |
|
3618 | var newValue = toString(value);
|
3619 |
|
3620 | if (newValue !== node.value) {
|
3621 | node.value = newValue;
|
3622 | }
|
3623 |
|
3624 | if (props.defaultValue == null && node.defaultValue !== newValue) {
|
3625 | node.defaultValue = newValue;
|
3626 | }
|
3627 | }
|
3628 |
|
3629 | if (defaultValue != null) {
|
3630 | node.defaultValue = toString(defaultValue);
|
3631 | }
|
3632 | }
|
3633 | function postMountWrapper$3(element, props) {
|
3634 | var node = element;
|
3635 |
|
3636 |
|
3637 | var textContent = node.textContent;
|
3638 |
|
3639 |
|
3640 |
|
3641 |
|
3642 | if (textContent === node._wrapperState.initialValue) {
|
3643 | if (textContent !== '' && textContent !== null) {
|
3644 | node.value = textContent;
|
3645 | }
|
3646 | }
|
3647 | }
|
3648 | function restoreControlledState$3(element, props) {
|
3649 |
|
3650 | updateWrapper$1(element, props);
|
3651 | }
|
3652 |
|
3653 | var HTML_NAMESPACE$1 = 'http://www.w3.org/1999/xhtml';
|
3654 | var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
|
3655 | var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
3656 | var Namespaces = {
|
3657 | html: HTML_NAMESPACE$1,
|
3658 | mathml: MATH_NAMESPACE,
|
3659 | svg: SVG_NAMESPACE
|
3660 | };
|
3661 |
|
3662 | function getIntrinsicNamespace(type) {
|
3663 | switch (type) {
|
3664 | case 'svg':
|
3665 | return SVG_NAMESPACE;
|
3666 |
|
3667 | case 'math':
|
3668 | return MATH_NAMESPACE;
|
3669 |
|
3670 | default:
|
3671 | return HTML_NAMESPACE$1;
|
3672 | }
|
3673 | }
|
3674 | function getChildNamespace(parentNamespace, type) {
|
3675 | if (parentNamespace == null || parentNamespace === HTML_NAMESPACE$1) {
|
3676 |
|
3677 | return getIntrinsicNamespace(type);
|
3678 | }
|
3679 |
|
3680 | if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') {
|
3681 |
|
3682 | return HTML_NAMESPACE$1;
|
3683 | }
|
3684 |
|
3685 |
|
3686 | return parentNamespace;
|
3687 | }
|
3688 |
|
3689 |
|
3690 |
|
3691 |
|
3692 |
|
3693 |
|
3694 | var createMicrosoftUnsafeLocalFunction = function (func) {
|
3695 | if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
|
3696 | return function (arg0, arg1, arg2, arg3) {
|
3697 | MSApp.execUnsafeLocalFunction(function () {
|
3698 | return func(arg0, arg1, arg2, arg3);
|
3699 | });
|
3700 | };
|
3701 | } else {
|
3702 | return func;
|
3703 | }
|
3704 | };
|
3705 |
|
3706 | var reusableSVGContainer;
|
3707 |
|
3708 |
|
3709 |
|
3710 |
|
3711 |
|
3712 |
|
3713 |
|
3714 |
|
3715 | var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) {
|
3716 | if (node.namespaceURI === Namespaces.svg) {
|
3717 | {
|
3718 | if (enableTrustedTypesIntegration) {
|
3719 |
|
3720 |
|
3721 | !(typeof trustedTypes === 'undefined') ? warning$1(false, "Using 'dangerouslySetInnerHTML' in an svg element with " + 'Trusted Types enabled in an Internet Explorer will cause ' + 'the trusted value to be converted to string. Assigning string ' + "to 'innerHTML' will throw an error if Trusted Types are enforced. " + "You can try to wrap your svg element inside a div and use 'dangerouslySetInnerHTML' " + 'on the enclosing div instead.') : void 0;
|
3722 | }
|
3723 | }
|
3724 |
|
3725 | if (!('innerHTML' in node)) {
|
3726 |
|
3727 |
|
3728 |
|
3729 | reusableSVGContainer = reusableSVGContainer || document.createElement('div');
|
3730 | reusableSVGContainer.innerHTML = '<svg>' + html.valueOf().toString() + '</svg>';
|
3731 | var svgNode = reusableSVGContainer.firstChild;
|
3732 |
|
3733 | while (node.firstChild) {
|
3734 | node.removeChild(node.firstChild);
|
3735 | }
|
3736 |
|
3737 | while (svgNode.firstChild) {
|
3738 | node.appendChild(svgNode.firstChild);
|
3739 | }
|
3740 |
|
3741 | return;
|
3742 | }
|
3743 | }
|
3744 |
|
3745 | node.innerHTML = html;
|
3746 | });
|
3747 |
|
3748 |
|
3749 |
|
3750 |
|
3751 | var ELEMENT_NODE = 1;
|
3752 | var TEXT_NODE = 3;
|
3753 | var COMMENT_NODE = 8;
|
3754 | var DOCUMENT_NODE = 9;
|
3755 | var DOCUMENT_FRAGMENT_NODE = 11;
|
3756 |
|
3757 |
|
3758 |
|
3759 |
|
3760 |
|
3761 |
|
3762 |
|
3763 |
|
3764 |
|
3765 |
|
3766 |
|
3767 | var setTextContent = function (node, text) {
|
3768 | if (text) {
|
3769 | var firstChild = node.firstChild;
|
3770 |
|
3771 | if (firstChild && firstChild === node.lastChild && firstChild.nodeType === TEXT_NODE) {
|
3772 | firstChild.nodeValue = text;
|
3773 | return;
|
3774 | }
|
3775 | }
|
3776 |
|
3777 | node.textContent = text;
|
3778 | };
|
3779 |
|
3780 |
|
3781 |
|
3782 |
|
3783 | function unsafeCastStringToDOMTopLevelType(topLevelType) {
|
3784 | return topLevelType;
|
3785 | }
|
3786 | function unsafeCastDOMTopLevelTypeToString(topLevelType) {
|
3787 | return topLevelType;
|
3788 | }
|
3789 |
|
3790 |
|
3791 |
|
3792 |
|
3793 |
|
3794 |
|
3795 |
|
3796 |
|
3797 |
|
3798 | function makePrefixMap(styleProp, eventName) {
|
3799 | var prefixes = {};
|
3800 | prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
|
3801 | prefixes['Webkit' + styleProp] = 'webkit' + eventName;
|
3802 | prefixes['Moz' + styleProp] = 'moz' + eventName;
|
3803 | return prefixes;
|
3804 | }
|
3805 |
|
3806 |
|
3807 |
|
3808 |
|
3809 |
|
3810 | var vendorPrefixes = {
|
3811 | animationend: makePrefixMap('Animation', 'AnimationEnd'),
|
3812 | animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
|
3813 | animationstart: makePrefixMap('Animation', 'AnimationStart'),
|
3814 | transitionend: makePrefixMap('Transition', 'TransitionEnd')
|
3815 | };
|
3816 |
|
3817 |
|
3818 |
|
3819 |
|
3820 | var prefixedEventNames = {};
|
3821 |
|
3822 |
|
3823 |
|
3824 |
|
3825 | var style = {};
|
3826 |
|
3827 |
|
3828 |
|
3829 |
|
3830 | if (canUseDOM) {
|
3831 | style = document.createElement('div').style;
|
3832 |
|
3833 |
|
3834 |
|
3835 |
|
3836 | if (!('AnimationEvent' in window)) {
|
3837 | delete vendorPrefixes.animationend.animation;
|
3838 | delete vendorPrefixes.animationiteration.animation;
|
3839 | delete vendorPrefixes.animationstart.animation;
|
3840 | }
|
3841 |
|
3842 |
|
3843 | if (!('TransitionEvent' in window)) {
|
3844 | delete vendorPrefixes.transitionend.transition;
|
3845 | }
|
3846 | }
|
3847 |
|
3848 |
|
3849 |
|
3850 |
|
3851 |
|
3852 |
|
3853 |
|
3854 |
|
3855 | function getVendorPrefixedEventName(eventName) {
|
3856 | if (prefixedEventNames[eventName]) {
|
3857 | return prefixedEventNames[eventName];
|
3858 | } else if (!vendorPrefixes[eventName]) {
|
3859 | return eventName;
|
3860 | }
|
3861 |
|
3862 | var prefixMap = vendorPrefixes[eventName];
|
3863 |
|
3864 | for (var styleProp in prefixMap) {
|
3865 | if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
|
3866 | return prefixedEventNames[eventName] = prefixMap[styleProp];
|
3867 | }
|
3868 | }
|
3869 |
|
3870 | return eventName;
|
3871 | }
|
3872 |
|
3873 |
|
3874 |
|
3875 |
|
3876 |
|
3877 |
|
3878 |
|
3879 |
|
3880 |
|
3881 | var TOP_ABORT = unsafeCastStringToDOMTopLevelType('abort');
|
3882 | var TOP_ANIMATION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationend'));
|
3883 | var TOP_ANIMATION_ITERATION = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationiteration'));
|
3884 | var TOP_ANIMATION_START = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationstart'));
|
3885 | var TOP_BLUR = unsafeCastStringToDOMTopLevelType('blur');
|
3886 | var TOP_CAN_PLAY = unsafeCastStringToDOMTopLevelType('canplay');
|
3887 | var TOP_CAN_PLAY_THROUGH = unsafeCastStringToDOMTopLevelType('canplaythrough');
|
3888 | var TOP_CANCEL = unsafeCastStringToDOMTopLevelType('cancel');
|
3889 | var TOP_CHANGE = unsafeCastStringToDOMTopLevelType('change');
|
3890 | var TOP_CLICK = unsafeCastStringToDOMTopLevelType('click');
|
3891 | var TOP_CLOSE = unsafeCastStringToDOMTopLevelType('close');
|
3892 | var TOP_COMPOSITION_END = unsafeCastStringToDOMTopLevelType('compositionend');
|
3893 | var TOP_COMPOSITION_START = unsafeCastStringToDOMTopLevelType('compositionstart');
|
3894 | var TOP_COMPOSITION_UPDATE = unsafeCastStringToDOMTopLevelType('compositionupdate');
|
3895 | var TOP_CONTEXT_MENU = unsafeCastStringToDOMTopLevelType('contextmenu');
|
3896 | var TOP_COPY = unsafeCastStringToDOMTopLevelType('copy');
|
3897 | var TOP_CUT = unsafeCastStringToDOMTopLevelType('cut');
|
3898 | var TOP_DOUBLE_CLICK = unsafeCastStringToDOMTopLevelType('dblclick');
|
3899 | var TOP_AUX_CLICK = unsafeCastStringToDOMTopLevelType('auxclick');
|
3900 | var TOP_DRAG = unsafeCastStringToDOMTopLevelType('drag');
|
3901 | var TOP_DRAG_END = unsafeCastStringToDOMTopLevelType('dragend');
|
3902 | var TOP_DRAG_ENTER = unsafeCastStringToDOMTopLevelType('dragenter');
|
3903 | var TOP_DRAG_EXIT = unsafeCastStringToDOMTopLevelType('dragexit');
|
3904 | var TOP_DRAG_LEAVE = unsafeCastStringToDOMTopLevelType('dragleave');
|
3905 | var TOP_DRAG_OVER = unsafeCastStringToDOMTopLevelType('dragover');
|
3906 | var TOP_DRAG_START = unsafeCastStringToDOMTopLevelType('dragstart');
|
3907 | var TOP_DROP = unsafeCastStringToDOMTopLevelType('drop');
|
3908 | var TOP_DURATION_CHANGE = unsafeCastStringToDOMTopLevelType('durationchange');
|
3909 | var TOP_EMPTIED = unsafeCastStringToDOMTopLevelType('emptied');
|
3910 | var TOP_ENCRYPTED = unsafeCastStringToDOMTopLevelType('encrypted');
|
3911 | var TOP_ENDED = unsafeCastStringToDOMTopLevelType('ended');
|
3912 | var TOP_ERROR = unsafeCastStringToDOMTopLevelType('error');
|
3913 | var TOP_FOCUS = unsafeCastStringToDOMTopLevelType('focus');
|
3914 | var TOP_GOT_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('gotpointercapture');
|
3915 | var TOP_INPUT = unsafeCastStringToDOMTopLevelType('input');
|
3916 | var TOP_INVALID = unsafeCastStringToDOMTopLevelType('invalid');
|
3917 | var TOP_KEY_DOWN = unsafeCastStringToDOMTopLevelType('keydown');
|
3918 | var TOP_KEY_PRESS = unsafeCastStringToDOMTopLevelType('keypress');
|
3919 | var TOP_KEY_UP = unsafeCastStringToDOMTopLevelType('keyup');
|
3920 | var TOP_LOAD = unsafeCastStringToDOMTopLevelType('load');
|
3921 | var TOP_LOAD_START = unsafeCastStringToDOMTopLevelType('loadstart');
|
3922 | var TOP_LOADED_DATA = unsafeCastStringToDOMTopLevelType('loadeddata');
|
3923 | var TOP_LOADED_METADATA = unsafeCastStringToDOMTopLevelType('loadedmetadata');
|
3924 | var TOP_LOST_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('lostpointercapture');
|
3925 | var TOP_MOUSE_DOWN = unsafeCastStringToDOMTopLevelType('mousedown');
|
3926 | var TOP_MOUSE_MOVE = unsafeCastStringToDOMTopLevelType('mousemove');
|
3927 | var TOP_MOUSE_OUT = unsafeCastStringToDOMTopLevelType('mouseout');
|
3928 | var TOP_MOUSE_OVER = unsafeCastStringToDOMTopLevelType('mouseover');
|
3929 | var TOP_MOUSE_UP = unsafeCastStringToDOMTopLevelType('mouseup');
|
3930 | var TOP_PASTE = unsafeCastStringToDOMTopLevelType('paste');
|
3931 | var TOP_PAUSE = unsafeCastStringToDOMTopLevelType('pause');
|
3932 | var TOP_PLAY = unsafeCastStringToDOMTopLevelType('play');
|
3933 | var TOP_PLAYING = unsafeCastStringToDOMTopLevelType('playing');
|
3934 | var TOP_POINTER_CANCEL = unsafeCastStringToDOMTopLevelType('pointercancel');
|
3935 | var TOP_POINTER_DOWN = unsafeCastStringToDOMTopLevelType('pointerdown');
|
3936 |
|
3937 |
|
3938 | var TOP_POINTER_MOVE = unsafeCastStringToDOMTopLevelType('pointermove');
|
3939 | var TOP_POINTER_OUT = unsafeCastStringToDOMTopLevelType('pointerout');
|
3940 | var TOP_POINTER_OVER = unsafeCastStringToDOMTopLevelType('pointerover');
|
3941 | var TOP_POINTER_UP = unsafeCastStringToDOMTopLevelType('pointerup');
|
3942 | var TOP_PROGRESS = unsafeCastStringToDOMTopLevelType('progress');
|
3943 | var TOP_RATE_CHANGE = unsafeCastStringToDOMTopLevelType('ratechange');
|
3944 | var TOP_RESET = unsafeCastStringToDOMTopLevelType('reset');
|
3945 | var TOP_SCROLL = unsafeCastStringToDOMTopLevelType('scroll');
|
3946 | var TOP_SEEKED = unsafeCastStringToDOMTopLevelType('seeked');
|
3947 | var TOP_SEEKING = unsafeCastStringToDOMTopLevelType('seeking');
|
3948 | var TOP_SELECTION_CHANGE = unsafeCastStringToDOMTopLevelType('selectionchange');
|
3949 | var TOP_STALLED = unsafeCastStringToDOMTopLevelType('stalled');
|
3950 | var TOP_SUBMIT = unsafeCastStringToDOMTopLevelType('submit');
|
3951 | var TOP_SUSPEND = unsafeCastStringToDOMTopLevelType('suspend');
|
3952 | var TOP_TEXT_INPUT = unsafeCastStringToDOMTopLevelType('textInput');
|
3953 | var TOP_TIME_UPDATE = unsafeCastStringToDOMTopLevelType('timeupdate');
|
3954 | var TOP_TOGGLE = unsafeCastStringToDOMTopLevelType('toggle');
|
3955 | var TOP_TOUCH_CANCEL = unsafeCastStringToDOMTopLevelType('touchcancel');
|
3956 | var TOP_TOUCH_END = unsafeCastStringToDOMTopLevelType('touchend');
|
3957 | var TOP_TOUCH_MOVE = unsafeCastStringToDOMTopLevelType('touchmove');
|
3958 | var TOP_TOUCH_START = unsafeCastStringToDOMTopLevelType('touchstart');
|
3959 | var TOP_TRANSITION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('transitionend'));
|
3960 | var TOP_VOLUME_CHANGE = unsafeCastStringToDOMTopLevelType('volumechange');
|
3961 | var TOP_WAITING = unsafeCastStringToDOMTopLevelType('waiting');
|
3962 | var TOP_WHEEL = unsafeCastStringToDOMTopLevelType('wheel');
|
3963 |
|
3964 |
|
3965 |
|
3966 | var mediaEventTypes = [TOP_ABORT, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_VOLUME_CHANGE, TOP_WAITING];
|
3967 | function getRawEventName(topLevelType) {
|
3968 | return unsafeCastDOMTopLevelTypeToString(topLevelType);
|
3969 | }
|
3970 |
|
3971 | var attemptSynchronousHydration;
|
3972 | function setAttemptSynchronousHydration(fn) {
|
3973 | attemptSynchronousHydration = fn;
|
3974 | }
|
3975 |
|
3976 |
|
3977 | var hasScheduledReplayAttempt = false;
|
3978 |
|
3979 | var queuedDiscreteEvents = [];
|
3980 |
|
3981 |
|
3982 |
|
3983 | var queuedFocus = null;
|
3984 | var queuedDrag = null;
|
3985 | var queuedMouse = null;
|
3986 |
|
3987 | var queuedPointers = new Map();
|
3988 | var queuedPointerCaptures = new Map();
|
3989 |
|
3990 | function hasQueuedDiscreteEvents() {
|
3991 | return queuedDiscreteEvents.length > 0;
|
3992 | }
|
3993 |
|
3994 | var discreteReplayableEvents = [TOP_MOUSE_DOWN, TOP_MOUSE_UP, TOP_TOUCH_CANCEL, TOP_TOUCH_END, TOP_TOUCH_START, TOP_AUX_CLICK, TOP_DOUBLE_CLICK, TOP_POINTER_CANCEL, TOP_POINTER_DOWN, TOP_POINTER_UP, TOP_DRAG_END, TOP_DRAG_START, TOP_DROP, TOP_COMPOSITION_END, TOP_COMPOSITION_START, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_INPUT, TOP_TEXT_INPUT, TOP_CLOSE, TOP_CANCEL, TOP_COPY, TOP_CUT, TOP_PASTE, TOP_CLICK, TOP_CHANGE, TOP_CONTEXT_MENU, TOP_RESET, TOP_SUBMIT];
|
3995 | var continuousReplayableEvents = [TOP_FOCUS, TOP_BLUR, TOP_DRAG_ENTER, TOP_DRAG_LEAVE, TOP_MOUSE_OVER, TOP_MOUSE_OUT, TOP_POINTER_OVER, TOP_POINTER_OUT, TOP_GOT_POINTER_CAPTURE, TOP_LOST_POINTER_CAPTURE];
|
3996 | function isReplayableDiscreteEvent(eventType) {
|
3997 | return discreteReplayableEvents.indexOf(eventType) > -1;
|
3998 | }
|
3999 |
|
4000 | function trapReplayableEvent(topLevelType, document, listeningSet) {
|
4001 | listenToTopLevel(topLevelType, document, listeningSet);
|
4002 |
|
4003 | if (enableFlareAPI) {
|
4004 |
|
4005 | var passiveEventKey = unsafeCastDOMTopLevelTypeToString(topLevelType) + '_passive';
|
4006 |
|
4007 | if (!listeningSet.has(passiveEventKey)) {
|
4008 | trapEventForResponderEventSystem(document, topLevelType, true);
|
4009 | listeningSet.add(passiveEventKey);
|
4010 | }
|
4011 |
|
4012 |
|
4013 |
|
4014 |
|
4015 |
|
4016 |
|
4017 |
|
4018 | var activeEventKey = unsafeCastDOMTopLevelTypeToString(topLevelType) + '_active';
|
4019 |
|
4020 | if (!listeningSet.has(activeEventKey)) {
|
4021 | trapEventForResponderEventSystem(document, topLevelType, false);
|
4022 | listeningSet.add(activeEventKey);
|
4023 | }
|
4024 | }
|
4025 | }
|
4026 |
|
4027 | function eagerlyTrapReplayableEvents(document) {
|
4028 | var listeningSet = getListeningSetForElement(document);
|
4029 |
|
4030 | discreteReplayableEvents.forEach(function (topLevelType) {
|
4031 | trapReplayableEvent(topLevelType, document, listeningSet);
|
4032 | });
|
4033 |
|
4034 | continuousReplayableEvents.forEach(function (topLevelType) {
|
4035 | trapReplayableEvent(topLevelType, document, listeningSet);
|
4036 | });
|
4037 | }
|
4038 |
|
4039 | function createQueuedReplayableEvent(blockedOn, topLevelType, eventSystemFlags, nativeEvent) {
|
4040 | return {
|
4041 | blockedOn: blockedOn,
|
4042 | topLevelType: topLevelType,
|
4043 | eventSystemFlags: eventSystemFlags | IS_REPLAYED,
|
4044 | nativeEvent: nativeEvent
|
4045 | };
|
4046 | }
|
4047 |
|
4048 | function queueDiscreteEvent(blockedOn, topLevelType, eventSystemFlags, nativeEvent) {
|
4049 | var queuedEvent = createQueuedReplayableEvent(blockedOn, topLevelType, eventSystemFlags, nativeEvent);
|
4050 | queuedDiscreteEvents.push(queuedEvent);
|
4051 |
|
4052 | if (enableSelectiveHydration) {
|
4053 | if (queuedDiscreteEvents.length === 1) {
|
4054 |
|
4055 |
|
4056 | while (queuedEvent.blockedOn !== null) {
|
4057 | var _fiber = getInstanceFromNode$1(queuedEvent.blockedOn);
|
4058 |
|
4059 | if (_fiber === null) {
|
4060 | break;
|
4061 | }
|
4062 |
|
4063 | attemptSynchronousHydration(_fiber);
|
4064 |
|
4065 | if (queuedEvent.blockedOn === null) {
|
4066 |
|
4067 | replayUnblockedEvents();
|
4068 |
|
4069 |
|
4070 | continue;
|
4071 | } else {
|
4072 |
|
4073 |
|
4074 | break;
|
4075 | }
|
4076 | }
|
4077 | }
|
4078 | }
|
4079 | }
|
4080 |
|
4081 | function clearIfContinuousEvent(topLevelType, nativeEvent) {
|
4082 | switch (topLevelType) {
|
4083 | case TOP_FOCUS:
|
4084 | case TOP_BLUR:
|
4085 | queuedFocus = null;
|
4086 | break;
|
4087 |
|
4088 | case TOP_DRAG_ENTER:
|
4089 | case TOP_DRAG_LEAVE:
|
4090 | queuedDrag = null;
|
4091 | break;
|
4092 |
|
4093 | case TOP_MOUSE_OVER:
|
4094 | case TOP_MOUSE_OUT:
|
4095 | queuedMouse = null;
|
4096 | break;
|
4097 |
|
4098 | case TOP_POINTER_OVER:
|
4099 | case TOP_POINTER_OUT:
|
4100 | {
|
4101 | var pointerId = nativeEvent.pointerId;
|
4102 | queuedPointers.delete(pointerId);
|
4103 | break;
|
4104 | }
|
4105 |
|
4106 | case TOP_GOT_POINTER_CAPTURE:
|
4107 | case TOP_LOST_POINTER_CAPTURE:
|
4108 | {
|
4109 | var _pointerId = nativeEvent.pointerId;
|
4110 | queuedPointerCaptures.delete(_pointerId);
|
4111 | break;
|
4112 | }
|
4113 | }
|
4114 | }
|
4115 |
|
4116 | function accumulateOrCreateQueuedReplayableEvent(existingQueuedEvent, blockedOn, topLevelType, eventSystemFlags, nativeEvent) {
|
4117 | if (existingQueuedEvent === null || existingQueuedEvent.nativeEvent !== nativeEvent) {
|
4118 | return createQueuedReplayableEvent(blockedOn, topLevelType, eventSystemFlags, nativeEvent);
|
4119 | }
|
4120 |
|
4121 |
|
4122 |
|
4123 |
|
4124 |
|
4125 | existingQueuedEvent.eventSystemFlags |= eventSystemFlags;
|
4126 | return existingQueuedEvent;
|
4127 | }
|
4128 |
|
4129 | function queueIfContinuousEvent(blockedOn, topLevelType, eventSystemFlags, nativeEvent) {
|
4130 |
|
4131 |
|
4132 |
|
4133 | switch (topLevelType) {
|
4134 | case TOP_FOCUS:
|
4135 | {
|
4136 | var focusEvent = nativeEvent;
|
4137 | queuedFocus = accumulateOrCreateQueuedReplayableEvent(queuedFocus, blockedOn, topLevelType, eventSystemFlags, focusEvent);
|
4138 | return true;
|
4139 | }
|
4140 |
|
4141 | case TOP_DRAG_ENTER:
|
4142 | {
|
4143 | var dragEvent = nativeEvent;
|
4144 | queuedDrag = accumulateOrCreateQueuedReplayableEvent(queuedDrag, blockedOn, topLevelType, eventSystemFlags, dragEvent);
|
4145 | return true;
|
4146 | }
|
4147 |
|
4148 | case TOP_MOUSE_OVER:
|
4149 | {
|
4150 | var mouseEvent = nativeEvent;
|
4151 | queuedMouse = accumulateOrCreateQueuedReplayableEvent(queuedMouse, blockedOn, topLevelType, eventSystemFlags, mouseEvent);
|
4152 | return true;
|
4153 | }
|
4154 |
|
4155 | case TOP_POINTER_OVER:
|
4156 | {
|
4157 | var pointerEvent = nativeEvent;
|
4158 | var pointerId = pointerEvent.pointerId;
|
4159 | queuedPointers.set(pointerId, accumulateOrCreateQueuedReplayableEvent(queuedPointers.get(pointerId) || null, blockedOn, topLevelType, eventSystemFlags, pointerEvent));
|
4160 | return true;
|
4161 | }
|
4162 |
|
4163 | case TOP_GOT_POINTER_CAPTURE:
|
4164 | {
|
4165 | var _pointerEvent = nativeEvent;
|
4166 | var _pointerId2 = _pointerEvent.pointerId;
|
4167 | queuedPointerCaptures.set(_pointerId2, accumulateOrCreateQueuedReplayableEvent(queuedPointerCaptures.get(_pointerId2) || null, blockedOn, topLevelType, eventSystemFlags, _pointerEvent));
|
4168 | return true;
|
4169 | }
|
4170 | }
|
4171 |
|
4172 | return false;
|
4173 | }
|
4174 |
|
4175 | function attemptReplayQueuedEvent(queuedEvent) {
|
4176 | if (queuedEvent.blockedOn !== null) {
|
4177 | return false;
|
4178 | }
|
4179 |
|
4180 | var nextBlockedOn = attemptToDispatchEvent(queuedEvent.topLevelType, queuedEvent.eventSystemFlags, queuedEvent.nativeEvent);
|
4181 |
|
4182 | if (nextBlockedOn !== null) {
|
4183 |
|
4184 | queuedEvent.blockedOn = nextBlockedOn;
|
4185 | return false;
|
4186 | }
|
4187 |
|
4188 | return true;
|
4189 | }
|
4190 |
|
4191 | function attemptReplayQueuedEventInMap(queuedEvent, key, map) {
|
4192 | if (attemptReplayQueuedEvent(queuedEvent)) {
|
4193 | map.delete(key);
|
4194 | }
|
4195 | }
|
4196 |
|
4197 | function replayUnblockedEvents() {
|
4198 | hasScheduledReplayAttempt = false;
|
4199 |
|
4200 | while (queuedDiscreteEvents.length > 0) {
|
4201 | var nextDiscreteEvent = queuedDiscreteEvents[0];
|
4202 |
|
4203 | if (nextDiscreteEvent.blockedOn !== null) {
|
4204 |
|
4205 | break;
|
4206 | }
|
4207 |
|
4208 | var nextBlockedOn = attemptToDispatchEvent(nextDiscreteEvent.topLevelType, nextDiscreteEvent.eventSystemFlags, nextDiscreteEvent.nativeEvent);
|
4209 |
|
4210 | if (nextBlockedOn !== null) {
|
4211 |
|
4212 | nextDiscreteEvent.blockedOn = nextBlockedOn;
|
4213 | } else {
|
4214 |
|
4215 | queuedDiscreteEvents.shift();
|
4216 | }
|
4217 | }
|
4218 |
|
4219 |
|
4220 | if (queuedFocus !== null && attemptReplayQueuedEvent(queuedFocus)) {
|
4221 | queuedFocus = null;
|
4222 | }
|
4223 |
|
4224 | if (queuedDrag !== null && attemptReplayQueuedEvent(queuedDrag)) {
|
4225 | queuedDrag = null;
|
4226 | }
|
4227 |
|
4228 | if (queuedMouse !== null && attemptReplayQueuedEvent(queuedMouse)) {
|
4229 | queuedMouse = null;
|
4230 | }
|
4231 |
|
4232 | queuedPointers.forEach(attemptReplayQueuedEventInMap);
|
4233 | queuedPointerCaptures.forEach(attemptReplayQueuedEventInMap);
|
4234 | }
|
4235 |
|
4236 | function scheduleCallbackIfUnblocked(queuedEvent, unblocked) {
|
4237 | if (queuedEvent.blockedOn === unblocked) {
|
4238 | queuedEvent.blockedOn = null;
|
4239 |
|
4240 | if (!hasScheduledReplayAttempt) {
|
4241 | hasScheduledReplayAttempt = true;
|
4242 |
|
4243 |
|
4244 |
|
4245 | unstable_scheduleCallback(unstable_NormalPriority, replayUnblockedEvents);
|
4246 | }
|
4247 | }
|
4248 | }
|
4249 |
|
4250 | function retryIfBlockedOn(unblocked) {
|
4251 |
|
4252 |
|
4253 | if (queuedDiscreteEvents.length > 0) {
|
4254 | scheduleCallbackIfUnblocked(queuedDiscreteEvents[0], unblocked);
|
4255 |
|
4256 |
|
4257 |
|
4258 | for (var i = 1; i < queuedDiscreteEvents.length; i++) {
|
4259 | var queuedEvent = queuedDiscreteEvents[i];
|
4260 |
|
4261 | if (queuedEvent.blockedOn === unblocked) {
|
4262 | queuedEvent.blockedOn = null;
|
4263 | }
|
4264 | }
|
4265 | }
|
4266 |
|
4267 | if (queuedFocus !== null) {
|
4268 | scheduleCallbackIfUnblocked(queuedFocus, unblocked);
|
4269 | }
|
4270 |
|
4271 | if (queuedDrag !== null) {
|
4272 | scheduleCallbackIfUnblocked(queuedDrag, unblocked);
|
4273 | }
|
4274 |
|
4275 | if (queuedMouse !== null) {
|
4276 | scheduleCallbackIfUnblocked(queuedMouse, unblocked);
|
4277 | }
|
4278 |
|
4279 | var unblock = function (queuedEvent) {
|
4280 | return scheduleCallbackIfUnblocked(queuedEvent, unblocked);
|
4281 | };
|
4282 |
|
4283 | queuedPointers.forEach(unblock);
|
4284 | queuedPointerCaptures.forEach(unblock);
|
4285 | }
|
4286 |
|
4287 |
|
4288 |
|
4289 |
|
4290 |
|
4291 |
|
4292 |
|
4293 |
|
4294 |
|
4295 |
|
4296 |
|
4297 |
|
4298 |
|
4299 |
|
4300 |
|
4301 |
|
4302 |
|
4303 | function get(key) {
|
4304 | return key._reactInternalFiber;
|
4305 | }
|
4306 | function has$1(key) {
|
4307 | return key._reactInternalFiber !== undefined;
|
4308 | }
|
4309 | function set(key, value) {
|
4310 | key._reactInternalFiber = value;
|
4311 | }
|
4312 |
|
4313 |
|
4314 | var NoEffect =
|
4315 |
|
4316 | 0;
|
4317 | var PerformedWork =
|
4318 |
|
4319 | 1;
|
4320 |
|
4321 | var Placement =
|
4322 |
|
4323 | 2;
|
4324 | var Update =
|
4325 |
|
4326 | 4;
|
4327 | var PlacementAndUpdate =
|
4328 |
|
4329 | 6;
|
4330 | var Deletion =
|
4331 |
|
4332 | 8;
|
4333 | var ContentReset =
|
4334 |
|
4335 | 16;
|
4336 | var Callback =
|
4337 |
|
4338 | 32;
|
4339 | var DidCapture =
|
4340 |
|
4341 | 64;
|
4342 | var Ref =
|
4343 |
|
4344 | 128;
|
4345 | var Snapshot =
|
4346 |
|
4347 | 256;
|
4348 | var Passive =
|
4349 |
|
4350 | 512;
|
4351 | var Hydrating =
|
4352 |
|
4353 | 1024;
|
4354 | var HydratingAndUpdate =
|
4355 |
|
4356 | 1028;
|
4357 |
|
4358 | var LifecycleEffectMask =
|
4359 |
|
4360 | 932;
|
4361 |
|
4362 | var HostEffectMask =
|
4363 |
|
4364 | 2047;
|
4365 | var Incomplete =
|
4366 |
|
4367 | 2048;
|
4368 | var ShouldCapture =
|
4369 |
|
4370 | 4096;
|
4371 |
|
4372 | var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
4373 | function getNearestMountedFiber(fiber) {
|
4374 | var node = fiber;
|
4375 | var nearestMounted = fiber;
|
4376 |
|
4377 | if (!fiber.alternate) {
|
4378 |
|
4379 |
|
4380 | var nextNode = node;
|
4381 |
|
4382 | do {
|
4383 | node = nextNode;
|
4384 |
|
4385 | if ((node.effectTag & (Placement | Hydrating)) !== NoEffect) {
|
4386 |
|
4387 |
|
4388 |
|
4389 | nearestMounted = node.return;
|
4390 | }
|
4391 |
|
4392 | nextNode = node.return;
|
4393 | } while (nextNode);
|
4394 | } else {
|
4395 | while (node.return) {
|
4396 | node = node.return;
|
4397 | }
|
4398 | }
|
4399 |
|
4400 | if (node.tag === HostRoot) {
|
4401 |
|
4402 |
|
4403 | return nearestMounted;
|
4404 | }
|
4405 |
|
4406 |
|
4407 |
|
4408 | return null;
|
4409 | }
|
4410 | function getSuspenseInstanceFromFiber(fiber) {
|
4411 | if (fiber.tag === SuspenseComponent) {
|
4412 | var suspenseState = fiber.memoizedState;
|
4413 |
|
4414 | if (suspenseState === null) {
|
4415 | var current = fiber.alternate;
|
4416 |
|
4417 | if (current !== null) {
|
4418 | suspenseState = current.memoizedState;
|
4419 | }
|
4420 | }
|
4421 |
|
4422 | if (suspenseState !== null) {
|
4423 | return suspenseState.dehydrated;
|
4424 | }
|
4425 | }
|
4426 |
|
4427 | return null;
|
4428 | }
|
4429 | function getContainerFromFiber(fiber) {
|
4430 | return fiber.tag === HostRoot ? fiber.stateNode.containerInfo : null;
|
4431 | }
|
4432 | function isFiberMounted(fiber) {
|
4433 | return getNearestMountedFiber(fiber) === fiber;
|
4434 | }
|
4435 | function isMounted(component) {
|
4436 | {
|
4437 | var owner = ReactCurrentOwner$1.current;
|
4438 |
|
4439 | if (owner !== null && owner.tag === ClassComponent) {
|
4440 | var ownerFiber = owner;
|
4441 | var instance = ownerFiber.stateNode;
|
4442 | !instance._warnedAboutRefsInRender ? warningWithoutStack$1(false, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(ownerFiber.type) || 'A component') : void 0;
|
4443 | instance._warnedAboutRefsInRender = true;
|
4444 | }
|
4445 | }
|
4446 |
|
4447 | var fiber = get(component);
|
4448 |
|
4449 | if (!fiber) {
|
4450 | return false;
|
4451 | }
|
4452 |
|
4453 | return getNearestMountedFiber(fiber) === fiber;
|
4454 | }
|
4455 |
|
4456 | function assertIsMounted(fiber) {
|
4457 | (function () {
|
4458 | if (!(getNearestMountedFiber(fiber) === fiber)) {
|
4459 | {
|
4460 | throw ReactError(Error("Unable to find node on an unmounted component."));
|
4461 | }
|
4462 | }
|
4463 | })();
|
4464 | }
|
4465 |
|
4466 | function findCurrentFiberUsingSlowPath(fiber) {
|
4467 | var alternate = fiber.alternate;
|
4468 |
|
4469 | if (!alternate) {
|
4470 |
|
4471 | var nearestMounted = getNearestMountedFiber(fiber);
|
4472 |
|
4473 | (function () {
|
4474 | if (!(nearestMounted !== null)) {
|
4475 | {
|
4476 | throw ReactError(Error("Unable to find node on an unmounted component."));
|
4477 | }
|
4478 | }
|
4479 | })();
|
4480 |
|
4481 | if (nearestMounted !== fiber) {
|
4482 | return null;
|
4483 | }
|
4484 |
|
4485 | return fiber;
|
4486 | }
|
4487 |
|
4488 |
|
4489 |
|
4490 |
|
4491 | var a = fiber;
|
4492 | var b = alternate;
|
4493 |
|
4494 | while (true) {
|
4495 | var parentA = a.return;
|
4496 |
|
4497 | if (parentA === null) {
|
4498 |
|
4499 | break;
|
4500 | }
|
4501 |
|
4502 | var parentB = parentA.alternate;
|
4503 |
|
4504 | if (parentB === null) {
|
4505 |
|
4506 |
|
4507 |
|
4508 |
|
4509 | var nextParent = parentA.return;
|
4510 |
|
4511 | if (nextParent !== null) {
|
4512 | a = b = nextParent;
|
4513 | continue;
|
4514 | }
|
4515 |
|
4516 |
|
4517 | break;
|
4518 | }
|
4519 |
|
4520 |
|
4521 |
|
4522 |
|
4523 | if (parentA.child === parentB.child) {
|
4524 | var child = parentA.child;
|
4525 |
|
4526 | while (child) {
|
4527 | if (child === a) {
|
4528 |
|
4529 | assertIsMounted(parentA);
|
4530 | return fiber;
|
4531 | }
|
4532 |
|
4533 | if (child === b) {
|
4534 |
|
4535 | assertIsMounted(parentA);
|
4536 | return alternate;
|
4537 | }
|
4538 |
|
4539 | child = child.sibling;
|
4540 | }
|
4541 |
|
4542 |
|
4543 |
|
4544 | (function () {
|
4545 | {
|
4546 | {
|
4547 | throw ReactError(Error("Unable to find node on an unmounted component."));
|
4548 | }
|
4549 | }
|
4550 | })();
|
4551 | }
|
4552 |
|
4553 | if (a.return !== b.return) {
|
4554 |
|
4555 |
|
4556 |
|
4557 |
|
4558 | a = parentA;
|
4559 | b = parentB;
|
4560 | } else {
|
4561 |
|
4562 |
|
4563 |
|
4564 |
|
4565 |
|
4566 | var didFindChild = false;
|
4567 | var _child = parentA.child;
|
4568 |
|
4569 | while (_child) {
|
4570 | if (_child === a) {
|
4571 | didFindChild = true;
|
4572 | a = parentA;
|
4573 | b = parentB;
|
4574 | break;
|
4575 | }
|
4576 |
|
4577 | if (_child === b) {
|
4578 | didFindChild = true;
|
4579 | b = parentA;
|
4580 | a = parentB;
|
4581 | break;
|
4582 | }
|
4583 |
|
4584 | _child = _child.sibling;
|
4585 | }
|
4586 |
|
4587 | if (!didFindChild) {
|
4588 |
|
4589 | _child = parentB.child;
|
4590 |
|
4591 | while (_child) {
|
4592 | if (_child === a) {
|
4593 | didFindChild = true;
|
4594 | a = parentB;
|
4595 | b = parentA;
|
4596 | break;
|
4597 | }
|
4598 |
|
4599 | if (_child === b) {
|
4600 | didFindChild = true;
|
4601 | b = parentB;
|
4602 | a = parentA;
|
4603 | break;
|
4604 | }
|
4605 |
|
4606 | _child = _child.sibling;
|
4607 | }
|
4608 |
|
4609 | (function () {
|
4610 | if (!didFindChild) {
|
4611 | {
|
4612 | throw ReactError(Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue."));
|
4613 | }
|
4614 | }
|
4615 | })();
|
4616 | }
|
4617 | }
|
4618 |
|
4619 | (function () {
|
4620 | if (!(a.alternate === b)) {
|
4621 | {
|
4622 | throw ReactError(Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue."));
|
4623 | }
|
4624 | }
|
4625 | })();
|
4626 | }
|
4627 |
|
4628 |
|
4629 |
|
4630 | (function () {
|
4631 | if (!(a.tag === HostRoot)) {
|
4632 | {
|
4633 | throw ReactError(Error("Unable to find node on an unmounted component."));
|
4634 | }
|
4635 | }
|
4636 | })();
|
4637 |
|
4638 | if (a.stateNode.current === a) {
|
4639 |
|
4640 | return fiber;
|
4641 | }
|
4642 |
|
4643 |
|
4644 | return alternate;
|
4645 | }
|
4646 | function findCurrentHostFiber(parent) {
|
4647 | var currentParent = findCurrentFiberUsingSlowPath(parent);
|
4648 |
|
4649 | if (!currentParent) {
|
4650 | return null;
|
4651 | }
|
4652 |
|
4653 |
|
4654 | var node = currentParent;
|
4655 |
|
4656 | while (true) {
|
4657 | if (node.tag === HostComponent || node.tag === HostText) {
|
4658 | return node;
|
4659 | } else if (node.child) {
|
4660 | node.child.return = node;
|
4661 | node = node.child;
|
4662 | continue;
|
4663 | }
|
4664 |
|
4665 | if (node === currentParent) {
|
4666 | return null;
|
4667 | }
|
4668 |
|
4669 | while (!node.sibling) {
|
4670 | if (!node.return || node.return === currentParent) {
|
4671 | return null;
|
4672 | }
|
4673 |
|
4674 | node = node.return;
|
4675 | }
|
4676 |
|
4677 | node.sibling.return = node.return;
|
4678 | node = node.sibling;
|
4679 | }
|
4680 |
|
4681 |
|
4682 |
|
4683 | return null;
|
4684 | }
|
4685 | function findCurrentHostFiberWithNoPortals(parent) {
|
4686 | var currentParent = findCurrentFiberUsingSlowPath(parent);
|
4687 |
|
4688 | if (!currentParent) {
|
4689 | return null;
|
4690 | }
|
4691 |
|
4692 |
|
4693 | var node = currentParent;
|
4694 |
|
4695 | while (true) {
|
4696 | if (node.tag === HostComponent || node.tag === HostText || enableFundamentalAPI && node.tag === FundamentalComponent) {
|
4697 | return node;
|
4698 | } else if (node.child && node.tag !== HostPortal) {
|
4699 | node.child.return = node;
|
4700 | node = node.child;
|
4701 | continue;
|
4702 | }
|
4703 |
|
4704 | if (node === currentParent) {
|
4705 | return null;
|
4706 | }
|
4707 |
|
4708 | while (!node.sibling) {
|
4709 | if (!node.return || node.return === currentParent) {
|
4710 | return null;
|
4711 | }
|
4712 |
|
4713 | node = node.return;
|
4714 | }
|
4715 |
|
4716 | node.sibling.return = node.return;
|
4717 | node = node.sibling;
|
4718 | }
|
4719 |
|
4720 |
|
4721 |
|
4722 | return null;
|
4723 | }
|
4724 |
|
4725 | function addEventBubbleListener(element, eventType, listener) {
|
4726 | element.addEventListener(eventType, listener, false);
|
4727 | }
|
4728 | function addEventCaptureListener(element, eventType, listener) {
|
4729 | element.addEventListener(eventType, listener, true);
|
4730 | }
|
4731 | function addEventCaptureListenerWithPassiveFlag(element, eventType, listener, passive) {
|
4732 | element.addEventListener(eventType, listener, {
|
4733 | capture: true,
|
4734 | passive: passive
|
4735 | });
|
4736 | }
|
4737 |
|
4738 |
|
4739 |
|
4740 |
|
4741 |
|
4742 |
|
4743 |
|
4744 |
|
4745 |
|
4746 | function getEventTarget(nativeEvent) {
|
4747 |
|
4748 |
|
4749 | var target = nativeEvent.target || nativeEvent.srcElement || window;
|
4750 |
|
4751 | if (target.correspondingUseElement) {
|
4752 | target = target.correspondingUseElement;
|
4753 | }
|
4754 |
|
4755 |
|
4756 |
|
4757 | return target.nodeType === TEXT_NODE ? target.parentNode : target;
|
4758 | }
|
4759 |
|
4760 | function getParent(inst) {
|
4761 | do {
|
4762 | inst = inst.return;
|
4763 |
|
4764 |
|
4765 |
|
4766 |
|
4767 | } while (inst && inst.tag !== HostComponent);
|
4768 |
|
4769 | if (inst) {
|
4770 | return inst;
|
4771 | }
|
4772 |
|
4773 | return null;
|
4774 | }
|
4775 |
|
4776 |
|
4777 |
|
4778 |
|
4779 |
|
4780 |
|
4781 | function getLowestCommonAncestor(instA, instB) {
|
4782 | var depthA = 0;
|
4783 |
|
4784 | for (var tempA = instA; tempA; tempA = getParent(tempA)) {
|
4785 | depthA++;
|
4786 | }
|
4787 |
|
4788 | var depthB = 0;
|
4789 |
|
4790 | for (var tempB = instB; tempB; tempB = getParent(tempB)) {
|
4791 | depthB++;
|
4792 | }
|
4793 |
|
4794 |
|
4795 | while (depthA - depthB > 0) {
|
4796 | instA = getParent(instA);
|
4797 | depthA--;
|
4798 | }
|
4799 |
|
4800 |
|
4801 | while (depthB - depthA > 0) {
|
4802 | instB = getParent(instB);
|
4803 | depthB--;
|
4804 | }
|
4805 |
|
4806 |
|
4807 | var depth = depthA;
|
4808 |
|
4809 | while (depth--) {
|
4810 | if (instA === instB || instA === instB.alternate) {
|
4811 | return instA;
|
4812 | }
|
4813 |
|
4814 | instA = getParent(instA);
|
4815 | instB = getParent(instB);
|
4816 | }
|
4817 |
|
4818 | return null;
|
4819 | }
|
4820 |
|
4821 |
|
4822 |
|
4823 |
|
4824 |
|
4825 |
|
4826 |
|
4827 |
|
4828 |
|
4829 |
|
4830 |
|
4831 |
|
4832 |
|
4833 |
|
4834 | function traverseTwoPhase(inst, fn, arg) {
|
4835 | var path = [];
|
4836 |
|
4837 | while (inst) {
|
4838 | path.push(inst);
|
4839 | inst = getParent(inst);
|
4840 | }
|
4841 |
|
4842 | var i;
|
4843 |
|
4844 | for (i = path.length; i-- > 0;) {
|
4845 | fn(path[i], 'captured', arg);
|
4846 | }
|
4847 |
|
4848 | for (i = 0; i < path.length; i++) {
|
4849 | fn(path[i], 'bubbled', arg);
|
4850 | }
|
4851 | }
|
4852 |
|
4853 |
|
4854 |
|
4855 |
|
4856 |
|
4857 |
|
4858 |
|
4859 |
|
4860 | function traverseEnterLeave(from, to, fn, argFrom, argTo) {
|
4861 | var common = from && to ? getLowestCommonAncestor(from, to) : null;
|
4862 | var pathFrom = [];
|
4863 |
|
4864 | while (true) {
|
4865 | if (!from) {
|
4866 | break;
|
4867 | }
|
4868 |
|
4869 | if (from === common) {
|
4870 | break;
|
4871 | }
|
4872 |
|
4873 | var alternate = from.alternate;
|
4874 |
|
4875 | if (alternate !== null && alternate === common) {
|
4876 | break;
|
4877 | }
|
4878 |
|
4879 | pathFrom.push(from);
|
4880 | from = getParent(from);
|
4881 | }
|
4882 |
|
4883 | var pathTo = [];
|
4884 |
|
4885 | while (true) {
|
4886 | if (!to) {
|
4887 | break;
|
4888 | }
|
4889 |
|
4890 | if (to === common) {
|
4891 | break;
|
4892 | }
|
4893 |
|
4894 | var _alternate = to.alternate;
|
4895 |
|
4896 | if (_alternate !== null && _alternate === common) {
|
4897 | break;
|
4898 | }
|
4899 |
|
4900 | pathTo.push(to);
|
4901 | to = getParent(to);
|
4902 | }
|
4903 |
|
4904 | for (var i = 0; i < pathFrom.length; i++) {
|
4905 | fn(pathFrom[i], 'bubbled', argFrom);
|
4906 | }
|
4907 |
|
4908 | for (var _i = pathTo.length; _i-- > 0;) {
|
4909 | fn(pathTo[_i], 'captured', argTo);
|
4910 | }
|
4911 | }
|
4912 |
|
4913 |
|
4914 |
|
4915 |
|
4916 |
|
4917 | function listenerAtPhase(inst, event, propagationPhase) {
|
4918 | var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
|
4919 | return getListener(inst, registrationName);
|
4920 | }
|
4921 |
|
4922 |
|
4923 |
|
4924 |
|
4925 |
|
4926 |
|
4927 |
|
4928 |
|
4929 |
|
4930 |
|
4931 |
|
4932 |
|
4933 |
|
4934 |
|
4935 |
|
4936 |
|
4937 |
|
4938 |
|
4939 | function accumulateDirectionalDispatches(inst, phase, event) {
|
4940 | {
|
4941 | !inst ? warningWithoutStack$1(false, 'Dispatching inst must not be null') : void 0;
|
4942 | }
|
4943 |
|
4944 | var listener = listenerAtPhase(inst, event, phase);
|
4945 |
|
4946 | if (listener) {
|
4947 | event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
|
4948 | event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
|
4949 | }
|
4950 | }
|
4951 |
|
4952 |
|
4953 |
|
4954 |
|
4955 |
|
4956 |
|
4957 |
|
4958 |
|
4959 |
|
4960 | function accumulateTwoPhaseDispatchesSingle(event) {
|
4961 | if (event && event.dispatchConfig.phasedRegistrationNames) {
|
4962 | traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
|
4963 | }
|
4964 | }
|
4965 |
|
4966 |
|
4967 |
|
4968 |
|
4969 |
|
4970 |
|
4971 |
|
4972 | function accumulateDispatches(inst, ignoredDirection, event) {
|
4973 | if (inst && event && event.dispatchConfig.registrationName) {
|
4974 | var registrationName = event.dispatchConfig.registrationName;
|
4975 | var listener = getListener(inst, registrationName);
|
4976 |
|
4977 | if (listener) {
|
4978 | event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
|
4979 | event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
|
4980 | }
|
4981 | }
|
4982 | }
|
4983 |
|
4984 |
|
4985 |
|
4986 |
|
4987 |
|
4988 |
|
4989 |
|
4990 | function accumulateDirectDispatchesSingle(event) {
|
4991 | if (event && event.dispatchConfig.registrationName) {
|
4992 | accumulateDispatches(event._targetInst, null, event);
|
4993 | }
|
4994 | }
|
4995 |
|
4996 | function accumulateTwoPhaseDispatches(events) {
|
4997 | forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
|
4998 | }
|
4999 |
|
5000 | function accumulateEnterLeaveDispatches(leave, enter, from, to) {
|
5001 | traverseEnterLeave(from, to, accumulateDispatches, leave, enter);
|
5002 | }
|
5003 | function accumulateDirectDispatches(events) {
|
5004 | forEachAccumulated(events, accumulateDirectDispatchesSingle);
|
5005 | }
|
5006 |
|
5007 |
|
5008 | var EVENT_POOL_SIZE = 10;
|
5009 |
|
5010 |
|
5011 |
|
5012 |
|
5013 |
|
5014 | var EventInterface = {
|
5015 | type: null,
|
5016 | target: null,
|
5017 |
|
5018 | currentTarget: function () {
|
5019 | return null;
|
5020 | },
|
5021 | eventPhase: null,
|
5022 | bubbles: null,
|
5023 | cancelable: null,
|
5024 | timeStamp: function (event) {
|
5025 | return event.timeStamp || Date.now();
|
5026 | },
|
5027 | defaultPrevented: null,
|
5028 | isTrusted: null
|
5029 | };
|
5030 |
|
5031 | function functionThatReturnsTrue() {
|
5032 | return true;
|
5033 | }
|
5034 |
|
5035 | function functionThatReturnsFalse() {
|
5036 | return false;
|
5037 | }
|
5038 |
|
5039 |
|
5040 |
|
5041 |
|
5042 |
|
5043 |
|
5044 |
|
5045 |
|
5046 |
|
5047 |
|
5048 |
|
5049 |
|
5050 |
|
5051 |
|
5052 |
|
5053 |
|
5054 |
|
5055 |
|
5056 |
|
5057 |
|
5058 | function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {
|
5059 | {
|
5060 |
|
5061 | delete this.nativeEvent;
|
5062 | delete this.preventDefault;
|
5063 | delete this.stopPropagation;
|
5064 | delete this.isDefaultPrevented;
|
5065 | delete this.isPropagationStopped;
|
5066 | }
|
5067 |
|
5068 | this.dispatchConfig = dispatchConfig;
|
5069 | this._targetInst = targetInst;
|
5070 | this.nativeEvent = nativeEvent;
|
5071 | var Interface = this.constructor.Interface;
|
5072 |
|
5073 | for (var propName in Interface) {
|
5074 | if (!Interface.hasOwnProperty(propName)) {
|
5075 | continue;
|
5076 | }
|
5077 |
|
5078 | {
|
5079 | delete this[propName];
|
5080 | }
|
5081 |
|
5082 | var normalize = Interface[propName];
|
5083 |
|
5084 | if (normalize) {
|
5085 | this[propName] = normalize(nativeEvent);
|
5086 | } else {
|
5087 | if (propName === 'target') {
|
5088 | this.target = nativeEventTarget;
|
5089 | } else {
|
5090 | this[propName] = nativeEvent[propName];
|
5091 | }
|
5092 | }
|
5093 | }
|
5094 |
|
5095 | var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
|
5096 |
|
5097 | if (defaultPrevented) {
|
5098 | this.isDefaultPrevented = functionThatReturnsTrue;
|
5099 | } else {
|
5100 | this.isDefaultPrevented = functionThatReturnsFalse;
|
5101 | }
|
5102 |
|
5103 | this.isPropagationStopped = functionThatReturnsFalse;
|
5104 | return this;
|
5105 | }
|
5106 |
|
5107 | _assign(SyntheticEvent.prototype, {
|
5108 | preventDefault: function () {
|
5109 | this.defaultPrevented = true;
|
5110 | var event = this.nativeEvent;
|
5111 |
|
5112 | if (!event) {
|
5113 | return;
|
5114 | }
|
5115 |
|
5116 | if (event.preventDefault) {
|
5117 | event.preventDefault();
|
5118 | } else if (typeof event.returnValue !== 'unknown') {
|
5119 | event.returnValue = false;
|
5120 | }
|
5121 |
|
5122 | this.isDefaultPrevented = functionThatReturnsTrue;
|
5123 | },
|
5124 | stopPropagation: function () {
|
5125 | var event = this.nativeEvent;
|
5126 |
|
5127 | if (!event) {
|
5128 | return;
|
5129 | }
|
5130 |
|
5131 | if (event.stopPropagation) {
|
5132 | event.stopPropagation();
|
5133 | } else if (typeof event.cancelBubble !== 'unknown') {
|
5134 |
|
5135 |
|
5136 |
|
5137 |
|
5138 |
|
5139 | event.cancelBubble = true;
|
5140 | }
|
5141 |
|
5142 | this.isPropagationStopped = functionThatReturnsTrue;
|
5143 | },
|
5144 |
|
5145 | |
5146 |
|
5147 |
|
5148 |
|
5149 |
|
5150 | persist: function () {
|
5151 | this.isPersistent = functionThatReturnsTrue;
|
5152 | },
|
5153 |
|
5154 | |
5155 |
|
5156 |
|
5157 |
|
5158 |
|
5159 | isPersistent: functionThatReturnsFalse,
|
5160 |
|
5161 | |
5162 |
|
5163 |
|
5164 | destructor: function () {
|
5165 | var Interface = this.constructor.Interface;
|
5166 |
|
5167 | for (var propName in Interface) {
|
5168 | {
|
5169 | Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
|
5170 | }
|
5171 | }
|
5172 |
|
5173 | this.dispatchConfig = null;
|
5174 | this._targetInst = null;
|
5175 | this.nativeEvent = null;
|
5176 | this.isDefaultPrevented = functionThatReturnsFalse;
|
5177 | this.isPropagationStopped = functionThatReturnsFalse;
|
5178 | this._dispatchListeners = null;
|
5179 | this._dispatchInstances = null;
|
5180 |
|
5181 | {
|
5182 | Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
|
5183 | Object.defineProperty(this, 'isDefaultPrevented', getPooledWarningPropertyDefinition('isDefaultPrevented', functionThatReturnsFalse));
|
5184 | Object.defineProperty(this, 'isPropagationStopped', getPooledWarningPropertyDefinition('isPropagationStopped', functionThatReturnsFalse));
|
5185 | Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', function () {}));
|
5186 | Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', function () {}));
|
5187 | }
|
5188 | }
|
5189 | });
|
5190 |
|
5191 | SyntheticEvent.Interface = EventInterface;
|
5192 |
|
5193 |
|
5194 |
|
5195 |
|
5196 | SyntheticEvent.extend = function (Interface) {
|
5197 | var Super = this;
|
5198 |
|
5199 | var E = function () {};
|
5200 |
|
5201 | E.prototype = Super.prototype;
|
5202 | var prototype = new E();
|
5203 |
|
5204 | function Class() {
|
5205 | return Super.apply(this, arguments);
|
5206 | }
|
5207 |
|
5208 | _assign(prototype, Class.prototype);
|
5209 |
|
5210 | Class.prototype = prototype;
|
5211 | Class.prototype.constructor = Class;
|
5212 | Class.Interface = _assign({}, Super.Interface, Interface);
|
5213 | Class.extend = Super.extend;
|
5214 | addEventPoolingTo(Class);
|
5215 | return Class;
|
5216 | };
|
5217 |
|
5218 | addEventPoolingTo(SyntheticEvent);
|
5219 |
|
5220 |
|
5221 |
|
5222 |
|
5223 |
|
5224 |
|
5225 |
|
5226 |
|
5227 | function getPooledWarningPropertyDefinition(propName, getVal) {
|
5228 | var isFunction = typeof getVal === 'function';
|
5229 | return {
|
5230 | configurable: true,
|
5231 | set: set,
|
5232 | get: get
|
5233 | };
|
5234 |
|
5235 | function set(val) {
|
5236 | var action = isFunction ? 'setting the method' : 'setting the property';
|
5237 | warn(action, 'This is effectively a no-op');
|
5238 | return val;
|
5239 | }
|
5240 |
|
5241 | function get() {
|
5242 | var action = isFunction ? 'accessing the method' : 'accessing the property';
|
5243 | var result = isFunction ? 'This is a no-op function' : 'This is set to null';
|
5244 | warn(action, result);
|
5245 | return getVal;
|
5246 | }
|
5247 |
|
5248 | function warn(action, result) {
|
5249 | var warningCondition = false;
|
5250 | !warningCondition ? warningWithoutStack$1(false, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
|
5251 | }
|
5252 | }
|
5253 |
|
5254 | function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
|
5255 | var EventConstructor = this;
|
5256 |
|
5257 | if (EventConstructor.eventPool.length) {
|
5258 | var instance = EventConstructor.eventPool.pop();
|
5259 | EventConstructor.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst);
|
5260 | return instance;
|
5261 | }
|
5262 |
|
5263 | return new EventConstructor(dispatchConfig, targetInst, nativeEvent, nativeInst);
|
5264 | }
|
5265 |
|
5266 | function releasePooledEvent(event) {
|
5267 | var EventConstructor = this;
|
5268 |
|
5269 | (function () {
|
5270 | if (!(event instanceof EventConstructor)) {
|
5271 | {
|
5272 | throw ReactError(Error("Trying to release an event instance into a pool of a different type."));
|
5273 | }
|
5274 | }
|
5275 | })();
|
5276 |
|
5277 | event.destructor();
|
5278 |
|
5279 | if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
|
5280 | EventConstructor.eventPool.push(event);
|
5281 | }
|
5282 | }
|
5283 |
|
5284 | function addEventPoolingTo(EventConstructor) {
|
5285 | EventConstructor.eventPool = [];
|
5286 | EventConstructor.getPooled = getPooledEvent;
|
5287 | EventConstructor.release = releasePooledEvent;
|
5288 | }
|
5289 |
|
5290 |
|
5291 |
|
5292 |
|
5293 |
|
5294 |
|
5295 |
|
5296 | var SyntheticAnimationEvent = SyntheticEvent.extend({
|
5297 | animationName: null,
|
5298 | elapsedTime: null,
|
5299 | pseudoElement: null
|
5300 | });
|
5301 |
|
5302 |
|
5303 |
|
5304 |
|
5305 |
|
5306 |
|
5307 | var SyntheticClipboardEvent = SyntheticEvent.extend({
|
5308 | clipboardData: function (event) {
|
5309 | return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
|
5310 | }
|
5311 | });
|
5312 |
|
5313 | var SyntheticUIEvent = SyntheticEvent.extend({
|
5314 | view: null,
|
5315 | detail: null
|
5316 | });
|
5317 |
|
5318 |
|
5319 |
|
5320 |
|
5321 |
|
5322 |
|
5323 | var SyntheticFocusEvent = SyntheticUIEvent.extend({
|
5324 | relatedTarget: null
|
5325 | });
|
5326 |
|
5327 |
|
5328 |
|
5329 |
|
5330 |
|
5331 |
|
5332 |
|
5333 |
|
5334 |
|
5335 |
|
5336 |
|
5337 | function getEventCharCode(nativeEvent) {
|
5338 | var charCode;
|
5339 | var keyCode = nativeEvent.keyCode;
|
5340 |
|
5341 | if ('charCode' in nativeEvent) {
|
5342 | charCode = nativeEvent.charCode;
|
5343 |
|
5344 | if (charCode === 0 && keyCode === 13) {
|
5345 | charCode = 13;
|
5346 | }
|
5347 | } else {
|
5348 |
|
5349 | charCode = keyCode;
|
5350 | }
|
5351 |
|
5352 |
|
5353 |
|
5354 | if (charCode === 10) {
|
5355 | charCode = 13;
|
5356 | }
|
5357 |
|
5358 |
|
5359 |
|
5360 | if (charCode >= 32 || charCode === 13) {
|
5361 | return charCode;
|
5362 | }
|
5363 |
|
5364 | return 0;
|
5365 | }
|
5366 |
|
5367 |
|
5368 |
|
5369 |
|
5370 |
|
5371 |
|
5372 | var normalizeKey = {
|
5373 | Esc: 'Escape',
|
5374 | Spacebar: ' ',
|
5375 | Left: 'ArrowLeft',
|
5376 | Up: 'ArrowUp',
|
5377 | Right: 'ArrowRight',
|
5378 | Down: 'ArrowDown',
|
5379 | Del: 'Delete',
|
5380 | Win: 'OS',
|
5381 | Menu: 'ContextMenu',
|
5382 | Apps: 'ContextMenu',
|
5383 | Scroll: 'ScrollLock',
|
5384 | MozPrintableKey: 'Unidentified'
|
5385 | };
|
5386 |
|
5387 |
|
5388 |
|
5389 |
|
5390 |
|
5391 |
|
5392 | var translateToKey = {
|
5393 | '8': 'Backspace',
|
5394 | '9': 'Tab',
|
5395 | '12': 'Clear',
|
5396 | '13': 'Enter',
|
5397 | '16': 'Shift',
|
5398 | '17': 'Control',
|
5399 | '18': 'Alt',
|
5400 | '19': 'Pause',
|
5401 | '20': 'CapsLock',
|
5402 | '27': 'Escape',
|
5403 | '32': ' ',
|
5404 | '33': 'PageUp',
|
5405 | '34': 'PageDown',
|
5406 | '35': 'End',
|
5407 | '36': 'Home',
|
5408 | '37': 'ArrowLeft',
|
5409 | '38': 'ArrowUp',
|
5410 | '39': 'ArrowRight',
|
5411 | '40': 'ArrowDown',
|
5412 | '45': 'Insert',
|
5413 | '46': 'Delete',
|
5414 | '112': 'F1',
|
5415 | '113': 'F2',
|
5416 | '114': 'F3',
|
5417 | '115': 'F4',
|
5418 | '116': 'F5',
|
5419 | '117': 'F6',
|
5420 | '118': 'F7',
|
5421 | '119': 'F8',
|
5422 | '120': 'F9',
|
5423 | '121': 'F10',
|
5424 | '122': 'F11',
|
5425 | '123': 'F12',
|
5426 | '144': 'NumLock',
|
5427 | '145': 'ScrollLock',
|
5428 | '224': 'Meta'
|
5429 | };
|
5430 |
|
5431 |
|
5432 |
|
5433 |
|
5434 |
|
5435 | function getEventKey(nativeEvent) {
|
5436 | if (nativeEvent.key) {
|
5437 |
|
5438 |
|
5439 |
|
5440 |
|
5441 | var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
|
5442 |
|
5443 | if (key !== 'Unidentified') {
|
5444 | return key;
|
5445 | }
|
5446 | }
|
5447 |
|
5448 |
|
5449 | if (nativeEvent.type === 'keypress') {
|
5450 | var charCode = getEventCharCode(nativeEvent);
|
5451 |
|
5452 |
|
5453 | return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
|
5454 | }
|
5455 |
|
5456 | if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
|
5457 |
|
5458 |
|
5459 | return translateToKey[nativeEvent.keyCode] || 'Unidentified';
|
5460 | }
|
5461 |
|
5462 | return '';
|
5463 | }
|
5464 |
|
5465 |
|
5466 |
|
5467 |
|
5468 |
|
5469 | var modifierKeyToProp = {
|
5470 | Alt: 'altKey',
|
5471 | Control: 'ctrlKey',
|
5472 | Meta: 'metaKey',
|
5473 | Shift: 'shiftKey'
|
5474 | };
|
5475 |
|
5476 |
|
5477 |
|
5478 | function modifierStateGetter(keyArg) {
|
5479 | var syntheticEvent = this;
|
5480 | var nativeEvent = syntheticEvent.nativeEvent;
|
5481 |
|
5482 | if (nativeEvent.getModifierState) {
|
5483 | return nativeEvent.getModifierState(keyArg);
|
5484 | }
|
5485 |
|
5486 | var keyProp = modifierKeyToProp[keyArg];
|
5487 | return keyProp ? !!nativeEvent[keyProp] : false;
|
5488 | }
|
5489 |
|
5490 | function getEventModifierState(nativeEvent) {
|
5491 | return modifierStateGetter;
|
5492 | }
|
5493 |
|
5494 |
|
5495 |
|
5496 |
|
5497 |
|
5498 |
|
5499 | var SyntheticKeyboardEvent = SyntheticUIEvent.extend({
|
5500 | key: getEventKey,
|
5501 | location: null,
|
5502 | ctrlKey: null,
|
5503 | shiftKey: null,
|
5504 | altKey: null,
|
5505 | metaKey: null,
|
5506 | repeat: null,
|
5507 | locale: null,
|
5508 | getModifierState: getEventModifierState,
|
5509 |
|
5510 | charCode: function (event) {
|
5511 |
|
5512 |
|
5513 |
|
5514 |
|
5515 | if (event.type === 'keypress') {
|
5516 | return getEventCharCode(event);
|
5517 | }
|
5518 |
|
5519 | return 0;
|
5520 | },
|
5521 | keyCode: function (event) {
|
5522 |
|
5523 |
|
5524 |
|
5525 |
|
5526 |
|
5527 |
|
5528 | if (event.type === 'keydown' || event.type === 'keyup') {
|
5529 | return event.keyCode;
|
5530 | }
|
5531 |
|
5532 | return 0;
|
5533 | },
|
5534 | which: function (event) {
|
5535 |
|
5536 |
|
5537 | if (event.type === 'keypress') {
|
5538 | return getEventCharCode(event);
|
5539 | }
|
5540 |
|
5541 | if (event.type === 'keydown' || event.type === 'keyup') {
|
5542 | return event.keyCode;
|
5543 | }
|
5544 |
|
5545 | return 0;
|
5546 | }
|
5547 | });
|
5548 |
|
5549 | var previousScreenX = 0;
|
5550 | var previousScreenY = 0;
|
5551 |
|
5552 | var isMovementXSet = false;
|
5553 | var isMovementYSet = false;
|
5554 |
|
5555 |
|
5556 |
|
5557 |
|
5558 |
|
5559 | var SyntheticMouseEvent = SyntheticUIEvent.extend({
|
5560 | screenX: null,
|
5561 | screenY: null,
|
5562 | clientX: null,
|
5563 | clientY: null,
|
5564 | pageX: null,
|
5565 | pageY: null,
|
5566 | ctrlKey: null,
|
5567 | shiftKey: null,
|
5568 | altKey: null,
|
5569 | metaKey: null,
|
5570 | getModifierState: getEventModifierState,
|
5571 | button: null,
|
5572 | buttons: null,
|
5573 | relatedTarget: function (event) {
|
5574 | return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
|
5575 | },
|
5576 | movementX: function (event) {
|
5577 | if ('movementX' in event) {
|
5578 | return event.movementX;
|
5579 | }
|
5580 |
|
5581 | var screenX = previousScreenX;
|
5582 | previousScreenX = event.screenX;
|
5583 |
|
5584 | if (!isMovementXSet) {
|
5585 | isMovementXSet = true;
|
5586 | return 0;
|
5587 | }
|
5588 |
|
5589 | return event.type === 'mousemove' ? event.screenX - screenX : 0;
|
5590 | },
|
5591 | movementY: function (event) {
|
5592 | if ('movementY' in event) {
|
5593 | return event.movementY;
|
5594 | }
|
5595 |
|
5596 | var screenY = previousScreenY;
|
5597 | previousScreenY = event.screenY;
|
5598 |
|
5599 | if (!isMovementYSet) {
|
5600 | isMovementYSet = true;
|
5601 | return 0;
|
5602 | }
|
5603 |
|
5604 | return event.type === 'mousemove' ? event.screenY - screenY : 0;
|
5605 | }
|
5606 | });
|
5607 |
|
5608 |
|
5609 |
|
5610 |
|
5611 |
|
5612 |
|
5613 | var SyntheticPointerEvent = SyntheticMouseEvent.extend({
|
5614 | pointerId: null,
|
5615 | width: null,
|
5616 | height: null,
|
5617 | pressure: null,
|
5618 | tangentialPressure: null,
|
5619 | tiltX: null,
|
5620 | tiltY: null,
|
5621 | twist: null,
|
5622 | pointerType: null,
|
5623 | isPrimary: null
|
5624 | });
|
5625 |
|
5626 |
|
5627 |
|
5628 |
|
5629 |
|
5630 |
|
5631 | var SyntheticDragEvent = SyntheticMouseEvent.extend({
|
5632 | dataTransfer: null
|
5633 | });
|
5634 |
|
5635 |
|
5636 |
|
5637 |
|
5638 |
|
5639 |
|
5640 | var SyntheticTouchEvent = SyntheticUIEvent.extend({
|
5641 | touches: null,
|
5642 | targetTouches: null,
|
5643 | changedTouches: null,
|
5644 | altKey: null,
|
5645 | metaKey: null,
|
5646 | ctrlKey: null,
|
5647 | shiftKey: null,
|
5648 | getModifierState: getEventModifierState
|
5649 | });
|
5650 |
|
5651 |
|
5652 |
|
5653 |
|
5654 |
|
5655 |
|
5656 |
|
5657 | var SyntheticTransitionEvent = SyntheticEvent.extend({
|
5658 | propertyName: null,
|
5659 | elapsedTime: null,
|
5660 | pseudoElement: null
|
5661 | });
|
5662 |
|
5663 |
|
5664 |
|
5665 |
|
5666 |
|
5667 |
|
5668 | var SyntheticWheelEvent = SyntheticMouseEvent.extend({
|
5669 | deltaX: function (event) {
|
5670 | return 'deltaX' in event ? event.deltaX :
|
5671 | 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
|
5672 | },
|
5673 | deltaY: function (event) {
|
5674 | return 'deltaY' in event ? event.deltaY :
|
5675 | 'wheelDeltaY' in event ? -event.wheelDeltaY :
|
5676 | 'wheelDelta' in event ? -event.wheelDelta : 0;
|
5677 | },
|
5678 | deltaZ: null,
|
5679 |
|
5680 |
|
5681 |
|
5682 |
|
5683 | deltaMode: null
|
5684 | });
|
5685 |
|
5686 |
|
5687 |
|
5688 |
|
5689 |
|
5690 |
|
5691 |
|
5692 |
|
5693 |
|
5694 |
|
5695 |
|
5696 |
|
5697 |
|
5698 |
|
5699 |
|
5700 |
|
5701 |
|
5702 |
|
5703 |
|
5704 |
|
5705 | var eventTuples = [
|
5706 | [TOP_BLUR, 'blur', DiscreteEvent], [TOP_CANCEL, 'cancel', DiscreteEvent], [TOP_CLICK, 'click', DiscreteEvent], [TOP_CLOSE, 'close', DiscreteEvent], [TOP_CONTEXT_MENU, 'contextMenu', DiscreteEvent], [TOP_COPY, 'copy', DiscreteEvent], [TOP_CUT, 'cut', DiscreteEvent], [TOP_AUX_CLICK, 'auxClick', DiscreteEvent], [TOP_DOUBLE_CLICK, 'doubleClick', DiscreteEvent], [TOP_DRAG_END, 'dragEnd', DiscreteEvent], [TOP_DRAG_START, 'dragStart', DiscreteEvent], [TOP_DROP, 'drop', DiscreteEvent], [TOP_FOCUS, 'focus', DiscreteEvent], [TOP_INPUT, 'input', DiscreteEvent], [TOP_INVALID, 'invalid', DiscreteEvent], [TOP_KEY_DOWN, 'keyDown', DiscreteEvent], [TOP_KEY_PRESS, 'keyPress', DiscreteEvent], [TOP_KEY_UP, 'keyUp', DiscreteEvent], [TOP_MOUSE_DOWN, 'mouseDown', DiscreteEvent], [TOP_MOUSE_UP, 'mouseUp', DiscreteEvent], [TOP_PASTE, 'paste', DiscreteEvent], [TOP_PAUSE, 'pause', DiscreteEvent], [TOP_PLAY, 'play', DiscreteEvent], [TOP_POINTER_CANCEL, 'pointerCancel', DiscreteEvent], [TOP_POINTER_DOWN, 'pointerDown', DiscreteEvent], [TOP_POINTER_UP, 'pointerUp', DiscreteEvent], [TOP_RATE_CHANGE, 'rateChange', DiscreteEvent], [TOP_RESET, 'reset', DiscreteEvent], [TOP_SEEKED, 'seeked', DiscreteEvent], [TOP_SUBMIT, 'submit', DiscreteEvent], [TOP_TOUCH_CANCEL, 'touchCancel', DiscreteEvent], [TOP_TOUCH_END, 'touchEnd', DiscreteEvent], [TOP_TOUCH_START, 'touchStart', DiscreteEvent], [TOP_VOLUME_CHANGE, 'volumeChange', DiscreteEvent],
|
5707 | [TOP_DRAG, 'drag', UserBlockingEvent], [TOP_DRAG_ENTER, 'dragEnter', UserBlockingEvent], [TOP_DRAG_EXIT, 'dragExit', UserBlockingEvent], [TOP_DRAG_LEAVE, 'dragLeave', UserBlockingEvent], [TOP_DRAG_OVER, 'dragOver', UserBlockingEvent], [TOP_MOUSE_MOVE, 'mouseMove', UserBlockingEvent], [TOP_MOUSE_OUT, 'mouseOut', UserBlockingEvent], [TOP_MOUSE_OVER, 'mouseOver', UserBlockingEvent], [TOP_POINTER_MOVE, 'pointerMove', UserBlockingEvent], [TOP_POINTER_OUT, 'pointerOut', UserBlockingEvent], [TOP_POINTER_OVER, 'pointerOver', UserBlockingEvent], [TOP_SCROLL, 'scroll', UserBlockingEvent], [TOP_TOGGLE, 'toggle', UserBlockingEvent], [TOP_TOUCH_MOVE, 'touchMove', UserBlockingEvent], [TOP_WHEEL, 'wheel', UserBlockingEvent],
|
5708 | [TOP_ABORT, 'abort', ContinuousEvent], [TOP_ANIMATION_END, 'animationEnd', ContinuousEvent], [TOP_ANIMATION_ITERATION, 'animationIteration', ContinuousEvent], [TOP_ANIMATION_START, 'animationStart', ContinuousEvent], [TOP_CAN_PLAY, 'canPlay', ContinuousEvent], [TOP_CAN_PLAY_THROUGH, 'canPlayThrough', ContinuousEvent], [TOP_DURATION_CHANGE, 'durationChange', ContinuousEvent], [TOP_EMPTIED, 'emptied', ContinuousEvent], [TOP_ENCRYPTED, 'encrypted', ContinuousEvent], [TOP_ENDED, 'ended', ContinuousEvent], [TOP_ERROR, 'error', ContinuousEvent], [TOP_GOT_POINTER_CAPTURE, 'gotPointerCapture', ContinuousEvent], [TOP_LOAD, 'load', ContinuousEvent], [TOP_LOADED_DATA, 'loadedData', ContinuousEvent], [TOP_LOADED_METADATA, 'loadedMetadata', ContinuousEvent], [TOP_LOAD_START, 'loadStart', ContinuousEvent], [TOP_LOST_POINTER_CAPTURE, 'lostPointerCapture', ContinuousEvent], [TOP_PLAYING, 'playing', ContinuousEvent], [TOP_PROGRESS, 'progress', ContinuousEvent], [TOP_SEEKING, 'seeking', ContinuousEvent], [TOP_STALLED, 'stalled', ContinuousEvent], [TOP_SUSPEND, 'suspend', ContinuousEvent], [TOP_TIME_UPDATE, 'timeUpdate', ContinuousEvent], [TOP_TRANSITION_END, 'transitionEnd', ContinuousEvent], [TOP_WAITING, 'waiting', ContinuousEvent]];
|
5709 | var eventTypes = {};
|
5710 | var topLevelEventsToDispatchConfig = {};
|
5711 |
|
5712 | for (var i = 0; i < eventTuples.length; i++) {
|
5713 | var eventTuple = eventTuples[i];
|
5714 | var topEvent = eventTuple[0];
|
5715 | var event = eventTuple[1];
|
5716 | var eventPriority = eventTuple[2];
|
5717 | var capitalizedEvent = event[0].toUpperCase() + event.slice(1);
|
5718 | var onEvent = 'on' + capitalizedEvent;
|
5719 | var config = {
|
5720 | phasedRegistrationNames: {
|
5721 | bubbled: onEvent,
|
5722 | captured: onEvent + 'Capture'
|
5723 | },
|
5724 | dependencies: [topEvent],
|
5725 | eventPriority: eventPriority
|
5726 | };
|
5727 | eventTypes[event] = config;
|
5728 | topLevelEventsToDispatchConfig[topEvent] = config;
|
5729 | }
|
5730 |
|
5731 |
|
5732 | var knownHTMLTopLevelTypes = [TOP_ABORT, TOP_CANCEL, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_CLOSE, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_INPUT, TOP_INVALID, TOP_LOAD, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_RESET, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUBMIT, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_TOGGLE, TOP_VOLUME_CHANGE, TOP_WAITING];
|
5733 | var SimpleEventPlugin = {
|
5734 | eventTypes: eventTypes,
|
5735 | getEventPriority: function (topLevelType) {
|
5736 | var config = topLevelEventsToDispatchConfig[topLevelType];
|
5737 | return config !== undefined ? config.eventPriority : ContinuousEvent;
|
5738 | },
|
5739 | extractEvents: function (topLevelType, eventSystemFlags, targetInst, nativeEvent, nativeEventTarget) {
|
5740 | var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
|
5741 |
|
5742 | if (!dispatchConfig) {
|
5743 | return null;
|
5744 | }
|
5745 |
|
5746 | var EventConstructor;
|
5747 |
|
5748 | switch (topLevelType) {
|
5749 | case TOP_KEY_PRESS:
|
5750 |
|
5751 |
|
5752 |
|
5753 | if (getEventCharCode(nativeEvent) === 0) {
|
5754 | return null;
|
5755 | }
|
5756 |
|
5757 |
|
5758 |
|
5759 | case TOP_KEY_DOWN:
|
5760 | case TOP_KEY_UP:
|
5761 | EventConstructor = SyntheticKeyboardEvent;
|
5762 | break;
|
5763 |
|
5764 | case TOP_BLUR:
|
5765 | case TOP_FOCUS:
|
5766 | EventConstructor = SyntheticFocusEvent;
|
5767 | break;
|
5768 |
|
5769 | case TOP_CLICK:
|
5770 |
|
5771 |
|
5772 | if (nativeEvent.button === 2) {
|
5773 | return null;
|
5774 | }
|
5775 |
|
5776 |
|
5777 |
|
5778 | case TOP_AUX_CLICK:
|
5779 | case TOP_DOUBLE_CLICK:
|
5780 | case TOP_MOUSE_DOWN:
|
5781 | case TOP_MOUSE_MOVE:
|
5782 | case TOP_MOUSE_UP:
|
5783 |
|
5784 |
|
5785 |
|
5786 | case TOP_MOUSE_OUT:
|
5787 | case TOP_MOUSE_OVER:
|
5788 | case TOP_CONTEXT_MENU:
|
5789 | EventConstructor = SyntheticMouseEvent;
|
5790 | break;
|
5791 |
|
5792 | case TOP_DRAG:
|
5793 | case TOP_DRAG_END:
|
5794 | case TOP_DRAG_ENTER:
|
5795 | case TOP_DRAG_EXIT:
|
5796 | case TOP_DRAG_LEAVE:
|
5797 | case TOP_DRAG_OVER:
|
5798 | case TOP_DRAG_START:
|
5799 | case TOP_DROP:
|
5800 | EventConstructor = SyntheticDragEvent;
|
5801 | break;
|
5802 |
|
5803 | case TOP_TOUCH_CANCEL:
|
5804 | case TOP_TOUCH_END:
|
5805 | case TOP_TOUCH_MOVE:
|
5806 | case TOP_TOUCH_START:
|
5807 | EventConstructor = SyntheticTouchEvent;
|
5808 | break;
|
5809 |
|
5810 | case TOP_ANIMATION_END:
|
5811 | case TOP_ANIMATION_ITERATION:
|
5812 | case TOP_ANIMATION_START:
|
5813 | EventConstructor = SyntheticAnimationEvent;
|
5814 | break;
|
5815 |
|
5816 | case TOP_TRANSITION_END:
|
5817 | EventConstructor = SyntheticTransitionEvent;
|
5818 | break;
|
5819 |
|
5820 | case TOP_SCROLL:
|
5821 | EventConstructor = SyntheticUIEvent;
|
5822 | break;
|
5823 |
|
5824 | case TOP_WHEEL:
|
5825 | EventConstructor = SyntheticWheelEvent;
|
5826 | break;
|
5827 |
|
5828 | case TOP_COPY:
|
5829 | case TOP_CUT:
|
5830 | case TOP_PASTE:
|
5831 | EventConstructor = SyntheticClipboardEvent;
|
5832 | break;
|
5833 |
|
5834 | case TOP_GOT_POINTER_CAPTURE:
|
5835 | case TOP_LOST_POINTER_CAPTURE:
|
5836 | case TOP_POINTER_CANCEL:
|
5837 | case TOP_POINTER_DOWN:
|
5838 | case TOP_POINTER_MOVE:
|
5839 | case TOP_POINTER_OUT:
|
5840 | case TOP_POINTER_OVER:
|
5841 | case TOP_POINTER_UP:
|
5842 | EventConstructor = SyntheticPointerEvent;
|
5843 | break;
|
5844 |
|
5845 | default:
|
5846 | {
|
5847 | if (knownHTMLTopLevelTypes.indexOf(topLevelType) === -1) {
|
5848 | warningWithoutStack$1(false, 'SimpleEventPlugin: Unhandled event type, `%s`. This warning ' + 'is likely caused by a bug in React. Please file an issue.', topLevelType);
|
5849 | }
|
5850 | }
|
5851 |
|
5852 |
|
5853 |
|
5854 | EventConstructor = SyntheticEvent;
|
5855 | break;
|
5856 | }
|
5857 |
|
5858 | var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
|
5859 | accumulateTwoPhaseDispatches(event);
|
5860 | return event;
|
5861 | }
|
5862 | };
|
5863 |
|
5864 | var passiveBrowserEventsSupported = false;
|
5865 |
|
5866 |
|
5867 | if (enableFlareAPI && canUseDOM) {
|
5868 | try {
|
5869 | var options = {};
|
5870 |
|
5871 | Object.defineProperty(options, 'passive', {
|
5872 | get: function () {
|
5873 | passiveBrowserEventsSupported = true;
|
5874 | }
|
5875 | });
|
5876 | window.addEventListener('test', options, options);
|
5877 | window.removeEventListener('test', options, options);
|
5878 | } catch (e) {
|
5879 | passiveBrowserEventsSupported = false;
|
5880 | }
|
5881 | }
|
5882 |
|
5883 |
|
5884 |
|
5885 | var UserBlockingPriority$1 = unstable_UserBlockingPriority;
|
5886 | var runWithPriority$1 = unstable_runWithPriority;
|
5887 | var getEventPriority = SimpleEventPlugin.getEventPriority;
|
5888 | var CALLBACK_BOOKKEEPING_POOL_SIZE = 10;
|
5889 | var callbackBookkeepingPool = [];
|
5890 |
|
5891 |
|
5892 |
|
5893 |
|
5894 |
|
5895 |
|
5896 | function findRootContainerNode(inst) {
|
5897 | if (inst.tag === HostRoot) {
|
5898 | return inst.stateNode.containerInfo;
|
5899 | }
|
5900 |
|
5901 |
|
5902 |
|
5903 |
|
5904 | while (inst.return) {
|
5905 | inst = inst.return;
|
5906 | }
|
5907 |
|
5908 | if (inst.tag !== HostRoot) {
|
5909 |
|
5910 | return null;
|
5911 | }
|
5912 |
|
5913 | return inst.stateNode.containerInfo;
|
5914 | }
|
5915 |
|
5916 |
|
5917 | function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst, eventSystemFlags) {
|
5918 | if (callbackBookkeepingPool.length) {
|
5919 | var instance = callbackBookkeepingPool.pop();
|
5920 | instance.topLevelType = topLevelType;
|
5921 | instance.eventSystemFlags = eventSystemFlags;
|
5922 | instance.nativeEvent = nativeEvent;
|
5923 | instance.targetInst = targetInst;
|
5924 | return instance;
|
5925 | }
|
5926 |
|
5927 | return {
|
5928 | topLevelType: topLevelType,
|
5929 | eventSystemFlags: eventSystemFlags,
|
5930 | nativeEvent: nativeEvent,
|
5931 | targetInst: targetInst,
|
5932 | ancestors: []
|
5933 | };
|
5934 | }
|
5935 |
|
5936 | function releaseTopLevelCallbackBookKeeping(instance) {
|
5937 | instance.topLevelType = null;
|
5938 | instance.nativeEvent = null;
|
5939 | instance.targetInst = null;
|
5940 | instance.ancestors.length = 0;
|
5941 |
|
5942 | if (callbackBookkeepingPool.length < CALLBACK_BOOKKEEPING_POOL_SIZE) {
|
5943 | callbackBookkeepingPool.push(instance);
|
5944 | }
|
5945 | }
|
5946 |
|
5947 | function handleTopLevel(bookKeeping) {
|
5948 | var targetInst = bookKeeping.targetInst;
|
5949 |
|
5950 |
|
5951 |
|
5952 |
|
5953 | var ancestor = targetInst;
|
5954 |
|
5955 | do {
|
5956 | if (!ancestor) {
|
5957 | var ancestors = bookKeeping.ancestors;
|
5958 | ancestors.push(ancestor);
|
5959 | break;
|
5960 | }
|
5961 |
|
5962 | var root = findRootContainerNode(ancestor);
|
5963 |
|
5964 | if (!root) {
|
5965 | break;
|
5966 | }
|
5967 |
|
5968 | var tag = ancestor.tag;
|
5969 |
|
5970 | if (tag === HostComponent || tag === HostText) {
|
5971 | bookKeeping.ancestors.push(ancestor);
|
5972 | }
|
5973 |
|
5974 | ancestor = getClosestInstanceFromNode(root);
|
5975 | } while (ancestor);
|
5976 |
|
5977 | for (var i = 0; i < bookKeeping.ancestors.length; i++) {
|
5978 | targetInst = bookKeeping.ancestors[i];
|
5979 | var eventTarget = getEventTarget(bookKeeping.nativeEvent);
|
5980 | var topLevelType = bookKeeping.topLevelType;
|
5981 | var nativeEvent = bookKeeping.nativeEvent;
|
5982 | runExtractedPluginEventsInBatch(topLevelType, bookKeeping.eventSystemFlags, targetInst, nativeEvent, eventTarget);
|
5983 | }
|
5984 | }
|
5985 |
|
5986 |
|
5987 | var _enabled = true;
|
5988 | function setEnabled(enabled) {
|
5989 | _enabled = !!enabled;
|
5990 | }
|
5991 | function isEnabled() {
|
5992 | return _enabled;
|
5993 | }
|
5994 | function trapBubbledEvent(topLevelType, element) {
|
5995 | trapEventForPluginEventSystem(element, topLevelType, false);
|
5996 | }
|
5997 | function trapCapturedEvent(topLevelType, element) {
|
5998 | trapEventForPluginEventSystem(element, topLevelType, true);
|
5999 | }
|
6000 | function trapEventForResponderEventSystem(element, topLevelType, passive) {
|
6001 | if (enableFlareAPI) {
|
6002 | var rawEventName = getRawEventName(topLevelType);
|
6003 | var eventFlags = RESPONDER_EVENT_SYSTEM;
|
6004 |
|
6005 |
|
6006 |
|
6007 |
|
6008 | if (passive) {
|
6009 | if (passiveBrowserEventsSupported) {
|
6010 | eventFlags |= IS_PASSIVE;
|
6011 | } else {
|
6012 | eventFlags |= IS_ACTIVE;
|
6013 | eventFlags |= PASSIVE_NOT_SUPPORTED;
|
6014 | passive = false;
|
6015 | }
|
6016 | } else {
|
6017 | eventFlags |= IS_ACTIVE;
|
6018 | }
|
6019 |
|
6020 |
|
6021 | var listener = dispatchEvent.bind(null, topLevelType, eventFlags);
|
6022 |
|
6023 | if (passiveBrowserEventsSupported) {
|
6024 | addEventCaptureListenerWithPassiveFlag(element, rawEventName, listener, passive);
|
6025 | } else {
|
6026 | addEventCaptureListener(element, rawEventName, listener);
|
6027 | }
|
6028 | }
|
6029 | }
|
6030 |
|
6031 | function trapEventForPluginEventSystem(element, topLevelType, capture) {
|
6032 | var listener;
|
6033 |
|
6034 | switch (getEventPriority(topLevelType)) {
|
6035 | case DiscreteEvent:
|
6036 | listener = dispatchDiscreteEvent.bind(null, topLevelType, PLUGIN_EVENT_SYSTEM);
|
6037 | break;
|
6038 |
|
6039 | case UserBlockingEvent:
|
6040 | listener = dispatchUserBlockingUpdate.bind(null, topLevelType, PLUGIN_EVENT_SYSTEM);
|
6041 | break;
|
6042 |
|
6043 | case ContinuousEvent:
|
6044 | default:
|
6045 | listener = dispatchEvent.bind(null, topLevelType, PLUGIN_EVENT_SYSTEM);
|
6046 | break;
|
6047 | }
|
6048 |
|
6049 | var rawEventName = getRawEventName(topLevelType);
|
6050 |
|
6051 | if (capture) {
|
6052 | addEventCaptureListener(element, rawEventName, listener);
|
6053 | } else {
|
6054 | addEventBubbleListener(element, rawEventName, listener);
|
6055 | }
|
6056 | }
|
6057 |
|
6058 | function dispatchDiscreteEvent(topLevelType, eventSystemFlags, nativeEvent) {
|
6059 | flushDiscreteUpdatesIfNeeded(nativeEvent.timeStamp);
|
6060 | discreteUpdates(dispatchEvent, topLevelType, eventSystemFlags, nativeEvent);
|
6061 | }
|
6062 |
|
6063 | function dispatchUserBlockingUpdate(topLevelType, eventSystemFlags, nativeEvent) {
|
6064 | if (enableUserBlockingEvents) {
|
6065 | runWithPriority$1(UserBlockingPriority$1, dispatchEvent.bind(null, topLevelType, eventSystemFlags, nativeEvent));
|
6066 | } else {
|
6067 | dispatchEvent(topLevelType, eventSystemFlags, nativeEvent);
|
6068 | }
|
6069 | }
|
6070 |
|
6071 | function dispatchEventForPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, targetInst) {
|
6072 | var bookKeeping = getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst, eventSystemFlags);
|
6073 |
|
6074 | try {
|
6075 |
|
6076 |
|
6077 | batchedEventUpdates(handleTopLevel, bookKeeping);
|
6078 | } finally {
|
6079 | releaseTopLevelCallbackBookKeeping(bookKeeping);
|
6080 | }
|
6081 | }
|
6082 |
|
6083 | function dispatchEvent(topLevelType, eventSystemFlags, nativeEvent) {
|
6084 | if (!_enabled) {
|
6085 | return;
|
6086 | }
|
6087 |
|
6088 | if (hasQueuedDiscreteEvents() && isReplayableDiscreteEvent(topLevelType)) {
|
6089 |
|
6090 |
|
6091 |
|
6092 | queueDiscreteEvent(null,
|
6093 | topLevelType, eventSystemFlags, nativeEvent);
|
6094 | return;
|
6095 | }
|
6096 |
|
6097 | var blockedOn = attemptToDispatchEvent(topLevelType, eventSystemFlags, nativeEvent);
|
6098 |
|
6099 | if (blockedOn === null) {
|
6100 |
|
6101 | clearIfContinuousEvent(topLevelType, nativeEvent);
|
6102 | return;
|
6103 | }
|
6104 |
|
6105 | if (isReplayableDiscreteEvent(topLevelType)) {
|
6106 |
|
6107 | queueDiscreteEvent(blockedOn, topLevelType, eventSystemFlags, nativeEvent);
|
6108 | return;
|
6109 | }
|
6110 |
|
6111 | if (queueIfContinuousEvent(blockedOn, topLevelType, eventSystemFlags, nativeEvent)) {
|
6112 | return;
|
6113 | }
|
6114 |
|
6115 |
|
6116 |
|
6117 | clearIfContinuousEvent(topLevelType, nativeEvent);
|
6118 |
|
6119 |
|
6120 | if (enableFlareAPI) {
|
6121 | if (eventSystemFlags & PLUGIN_EVENT_SYSTEM) {
|
6122 | dispatchEventForPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, null);
|
6123 | }
|
6124 |
|
6125 | if (eventSystemFlags & RESPONDER_EVENT_SYSTEM) {
|
6126 |
|
6127 | dispatchEventForResponderEventSystem(topLevelType, null, nativeEvent, getEventTarget(nativeEvent), eventSystemFlags);
|
6128 | }
|
6129 | } else {
|
6130 | dispatchEventForPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, null);
|
6131 | }
|
6132 | }
|
6133 |
|
6134 | function attemptToDispatchEvent(topLevelType, eventSystemFlags, nativeEvent) {
|
6135 |
|
6136 | var nativeEventTarget = getEventTarget(nativeEvent);
|
6137 | var targetInst = getClosestInstanceFromNode(nativeEventTarget);
|
6138 |
|
6139 | if (targetInst !== null) {
|
6140 | var nearestMounted = getNearestMountedFiber(targetInst);
|
6141 |
|
6142 | if (nearestMounted === null) {
|
6143 |
|
6144 | targetInst = null;
|
6145 | } else {
|
6146 | var tag = nearestMounted.tag;
|
6147 |
|
6148 | if (tag === SuspenseComponent) {
|
6149 | var instance = getSuspenseInstanceFromFiber(nearestMounted);
|
6150 |
|
6151 | if (instance !== null) {
|
6152 |
|
6153 |
|
6154 |
|
6155 |
|
6156 | return instance;
|
6157 | }
|
6158 |
|
6159 |
|
6160 |
|
6161 |
|
6162 | targetInst = null;
|
6163 | } else if (tag === HostRoot) {
|
6164 | var root = nearestMounted.stateNode;
|
6165 |
|
6166 | if (root.hydrate) {
|
6167 |
|
6168 |
|
6169 | return getContainerFromFiber(nearestMounted);
|
6170 | }
|
6171 |
|
6172 | targetInst = null;
|
6173 | } else if (nearestMounted !== targetInst) {
|
6174 |
|
6175 |
|
6176 |
|
6177 |
|
6178 | targetInst = null;
|
6179 | }
|
6180 | }
|
6181 | }
|
6182 |
|
6183 | if (enableFlareAPI) {
|
6184 | if (eventSystemFlags & PLUGIN_EVENT_SYSTEM) {
|
6185 | dispatchEventForPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, targetInst);
|
6186 | }
|
6187 |
|
6188 | if (eventSystemFlags & RESPONDER_EVENT_SYSTEM) {
|
6189 |
|
6190 | dispatchEventForResponderEventSystem(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags);
|
6191 | }
|
6192 | } else {
|
6193 | dispatchEventForPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, targetInst);
|
6194 | }
|
6195 |
|
6196 |
|
6197 | return null;
|
6198 | }
|
6199 |
|
6200 |
|
6201 |
|
6202 |
|
6203 |
|
6204 |
|
6205 |
|
6206 |
|
6207 |
|
6208 |
|
6209 |
|
6210 |
|
6211 |
|
6212 |
|
6213 |
|
6214 | function isEventSupported(eventNameSuffix) {
|
6215 | if (!canUseDOM) {
|
6216 | return false;
|
6217 | }
|
6218 |
|
6219 | var eventName = 'on' + eventNameSuffix;
|
6220 | var isSupported = eventName in document;
|
6221 |
|
6222 | if (!isSupported) {
|
6223 | var element = document.createElement('div');
|
6224 | element.setAttribute(eventName, 'return;');
|
6225 | isSupported = typeof element[eventName] === 'function';
|
6226 | }
|
6227 |
|
6228 | return isSupported;
|
6229 | }
|
6230 |
|
6231 |
|
6232 |
|
6233 |
|
6234 |
|
6235 |
|
6236 |
|
6237 |
|
6238 |
|
6239 |
|
6240 |
|
6241 |
|
6242 |
|
6243 |
|
6244 |
|
6245 |
|
6246 |
|
6247 |
|
6248 |
|
6249 |
|
6250 |
|
6251 |
|
6252 |
|
6253 |
|
6254 |
|
6255 |
|
6256 |
|
6257 |
|
6258 |
|
6259 |
|
6260 |
|
6261 |
|
6262 |
|
6263 |
|
6264 |
|
6265 |
|
6266 |
|
6267 |
|
6268 |
|
6269 |
|
6270 |
|
6271 |
|
6272 |
|
6273 |
|
6274 |
|
6275 |
|
6276 |
|
6277 |
|
6278 |
|
6279 |
|
6280 |
|
6281 |
|
6282 |
|
6283 |
|
6284 |
|
6285 |
|
6286 |
|
6287 | var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
6288 | var elementListeningSets = new PossiblyWeakMap();
|
6289 | function getListeningSetForElement(element) {
|
6290 | var listeningSet = elementListeningSets.get(element);
|
6291 |
|
6292 | if (listeningSet === undefined) {
|
6293 | listeningSet = new Set();
|
6294 | elementListeningSets.set(element, listeningSet);
|
6295 | }
|
6296 |
|
6297 | return listeningSet;
|
6298 | }
|
6299 |
|
6300 |
|
6301 |
|
6302 |
|
6303 |
|
6304 |
|
6305 |
|
6306 |
|
6307 |
|
6308 |
|
6309 |
|
6310 |
|
6311 |
|
6312 |
|
6313 |
|
6314 |
|
6315 |
|
6316 |
|
6317 |
|
6318 |
|
6319 |
|
6320 |
|
6321 | function listenTo(registrationName, mountAt) {
|
6322 | var listeningSet = getListeningSetForElement(mountAt);
|
6323 | var dependencies = registrationNameDependencies[registrationName];
|
6324 |
|
6325 | for (var i = 0; i < dependencies.length; i++) {
|
6326 | var dependency = dependencies[i];
|
6327 | listenToTopLevel(dependency, mountAt, listeningSet);
|
6328 | }
|
6329 | }
|
6330 | function listenToTopLevel(topLevelType, mountAt, listeningSet) {
|
6331 | if (!listeningSet.has(topLevelType)) {
|
6332 | switch (topLevelType) {
|
6333 | case TOP_SCROLL:
|
6334 | trapCapturedEvent(TOP_SCROLL, mountAt);
|
6335 | break;
|
6336 |
|
6337 | case TOP_FOCUS:
|
6338 | case TOP_BLUR:
|
6339 | trapCapturedEvent(TOP_FOCUS, mountAt);
|
6340 | trapCapturedEvent(TOP_BLUR, mountAt);
|
6341 |
|
6342 |
|
6343 | listeningSet.add(TOP_BLUR);
|
6344 | listeningSet.add(TOP_FOCUS);
|
6345 | break;
|
6346 |
|
6347 | case TOP_CANCEL:
|
6348 | case TOP_CLOSE:
|
6349 | if (isEventSupported(getRawEventName(topLevelType))) {
|
6350 | trapCapturedEvent(topLevelType, mountAt);
|
6351 | }
|
6352 |
|
6353 | break;
|
6354 |
|
6355 | case TOP_INVALID:
|
6356 | case TOP_SUBMIT:
|
6357 | case TOP_RESET:
|
6358 |
|
6359 |
|
6360 | break;
|
6361 |
|
6362 | default:
|
6363 |
|
6364 |
|
6365 | var isMediaEvent = mediaEventTypes.indexOf(topLevelType) !== -1;
|
6366 |
|
6367 | if (!isMediaEvent) {
|
6368 | trapBubbledEvent(topLevelType, mountAt);
|
6369 | }
|
6370 |
|
6371 | break;
|
6372 | }
|
6373 |
|
6374 | listeningSet.add(topLevelType);
|
6375 | }
|
6376 | }
|
6377 | function isListeningToAllDependencies(registrationName, mountAt) {
|
6378 | var listeningSet = getListeningSetForElement(mountAt);
|
6379 | var dependencies = registrationNameDependencies[registrationName];
|
6380 |
|
6381 | for (var i = 0; i < dependencies.length; i++) {
|
6382 | var dependency = dependencies[i];
|
6383 |
|
6384 | if (!listeningSet.has(dependency)) {
|
6385 | return false;
|
6386 | }
|
6387 | }
|
6388 |
|
6389 | return true;
|
6390 | }
|
6391 |
|
6392 |
|
6393 |
|
6394 | var shorthandToLonghand = {
|
6395 | animation: ['animationDelay', 'animationDirection', 'animationDuration', 'animationFillMode', 'animationIterationCount', 'animationName', 'animationPlayState', 'animationTimingFunction'],
|
6396 | background: ['backgroundAttachment', 'backgroundClip', 'backgroundColor', 'backgroundImage', 'backgroundOrigin', 'backgroundPositionX', 'backgroundPositionY', 'backgroundRepeat', 'backgroundSize'],
|
6397 | backgroundPosition: ['backgroundPositionX', 'backgroundPositionY'],
|
6398 | border: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth', 'borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth', 'borderLeftColor', 'borderLeftStyle', 'borderLeftWidth', 'borderRightColor', 'borderRightStyle', 'borderRightWidth', 'borderTopColor', 'borderTopStyle', 'borderTopWidth'],
|
6399 | borderBlockEnd: ['borderBlockEndColor', 'borderBlockEndStyle', 'borderBlockEndWidth'],
|
6400 | borderBlockStart: ['borderBlockStartColor', 'borderBlockStartStyle', 'borderBlockStartWidth'],
|
6401 | borderBottom: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth'],
|
6402 | borderColor: ['borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor'],
|
6403 | borderImage: ['borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth'],
|
6404 | borderInlineEnd: ['borderInlineEndColor', 'borderInlineEndStyle', 'borderInlineEndWidth'],
|
6405 | borderInlineStart: ['borderInlineStartColor', 'borderInlineStartStyle', 'borderInlineStartWidth'],
|
6406 | borderLeft: ['borderLeftColor', 'borderLeftStyle', 'borderLeftWidth'],
|
6407 | borderRadius: ['borderBottomLeftRadius', 'borderBottomRightRadius', 'borderTopLeftRadius', 'borderTopRightRadius'],
|
6408 | borderRight: ['borderRightColor', 'borderRightStyle', 'borderRightWidth'],
|
6409 | borderStyle: ['borderBottomStyle', 'borderLeftStyle', 'borderRightStyle', 'borderTopStyle'],
|
6410 | borderTop: ['borderTopColor', 'borderTopStyle', 'borderTopWidth'],
|
6411 | borderWidth: ['borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopWidth'],
|
6412 | columnRule: ['columnRuleColor', 'columnRuleStyle', 'columnRuleWidth'],
|
6413 | columns: ['columnCount', 'columnWidth'],
|
6414 | flex: ['flexBasis', 'flexGrow', 'flexShrink'],
|
6415 | flexFlow: ['flexDirection', 'flexWrap'],
|
6416 | font: ['fontFamily', 'fontFeatureSettings', 'fontKerning', 'fontLanguageOverride', 'fontSize', 'fontSizeAdjust', 'fontStretch', 'fontStyle', 'fontVariant', 'fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition', 'fontWeight', 'lineHeight'],
|
6417 | fontVariant: ['fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition'],
|
6418 | gap: ['columnGap', 'rowGap'],
|
6419 | grid: ['gridAutoColumns', 'gridAutoFlow', 'gridAutoRows', 'gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'],
|
6420 | gridArea: ['gridColumnEnd', 'gridColumnStart', 'gridRowEnd', 'gridRowStart'],
|
6421 | gridColumn: ['gridColumnEnd', 'gridColumnStart'],
|
6422 | gridColumnGap: ['columnGap'],
|
6423 | gridGap: ['columnGap', 'rowGap'],
|
6424 | gridRow: ['gridRowEnd', 'gridRowStart'],
|
6425 | gridRowGap: ['rowGap'],
|
6426 | gridTemplate: ['gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'],
|
6427 | listStyle: ['listStyleImage', 'listStylePosition', 'listStyleType'],
|
6428 | margin: ['marginBottom', 'marginLeft', 'marginRight', 'marginTop'],
|
6429 | marker: ['markerEnd', 'markerMid', 'markerStart'],
|
6430 | mask: ['maskClip', 'maskComposite', 'maskImage', 'maskMode', 'maskOrigin', 'maskPositionX', 'maskPositionY', 'maskRepeat', 'maskSize'],
|
6431 | maskPosition: ['maskPositionX', 'maskPositionY'],
|
6432 | outline: ['outlineColor', 'outlineStyle', 'outlineWidth'],
|
6433 | overflow: ['overflowX', 'overflowY'],
|
6434 | padding: ['paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop'],
|
6435 | placeContent: ['alignContent', 'justifyContent'],
|
6436 | placeItems: ['alignItems', 'justifyItems'],
|
6437 | placeSelf: ['alignSelf', 'justifySelf'],
|
6438 | textDecoration: ['textDecorationColor', 'textDecorationLine', 'textDecorationStyle'],
|
6439 | textEmphasis: ['textEmphasisColor', 'textEmphasisStyle'],
|
6440 | transition: ['transitionDelay', 'transitionDuration', 'transitionProperty', 'transitionTimingFunction'],
|
6441 | wordWrap: ['overflowWrap']
|
6442 | };
|
6443 |
|
6444 |
|
6445 |
|
6446 |
|
6447 | var isUnitlessNumber = {
|
6448 | animationIterationCount: true,
|
6449 | borderImageOutset: true,
|
6450 | borderImageSlice: true,
|
6451 | borderImageWidth: true,
|
6452 | boxFlex: true,
|
6453 | boxFlexGroup: true,
|
6454 | boxOrdinalGroup: true,
|
6455 | columnCount: true,
|
6456 | columns: true,
|
6457 | flex: true,
|
6458 | flexGrow: true,
|
6459 | flexPositive: true,
|
6460 | flexShrink: true,
|
6461 | flexNegative: true,
|
6462 | flexOrder: true,
|
6463 | gridArea: true,
|
6464 | gridRow: true,
|
6465 | gridRowEnd: true,
|
6466 | gridRowSpan: true,
|
6467 | gridRowStart: true,
|
6468 | gridColumn: true,
|
6469 | gridColumnEnd: true,
|
6470 | gridColumnSpan: true,
|
6471 | gridColumnStart: true,
|
6472 | fontWeight: true,
|
6473 | lineClamp: true,
|
6474 | lineHeight: true,
|
6475 | opacity: true,
|
6476 | order: true,
|
6477 | orphans: true,
|
6478 | tabSize: true,
|
6479 | widows: true,
|
6480 | zIndex: true,
|
6481 | zoom: true,
|
6482 |
|
6483 | fillOpacity: true,
|
6484 | floodOpacity: true,
|
6485 | stopOpacity: true,
|
6486 | strokeDasharray: true,
|
6487 | strokeDashoffset: true,
|
6488 | strokeMiterlimit: true,
|
6489 | strokeOpacity: true,
|
6490 | strokeWidth: true
|
6491 | };
|
6492 |
|
6493 |
|
6494 |
|
6495 |
|
6496 |
|
6497 |
|
6498 |
|
6499 | function prefixKey(prefix, key) {
|
6500 | return prefix + key.charAt(0).toUpperCase() + key.substring(1);
|
6501 | }
|
6502 |
|
6503 |
|
6504 |
|
6505 |
|
6506 |
|
6507 |
|
6508 | var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
|
6509 |
|
6510 |
|
6511 | Object.keys(isUnitlessNumber).forEach(function (prop) {
|
6512 | prefixes.forEach(function (prefix) {
|
6513 | isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
|
6514 | });
|
6515 | });
|
6516 |
|
6517 |
|
6518 |
|
6519 |
|
6520 |
|
6521 |
|
6522 |
|
6523 |
|
6524 |
|
6525 |
|
6526 |
|
6527 | function dangerousStyleValue(name, value, isCustomProperty) {
|
6528 |
|
6529 |
|
6530 |
|
6531 |
|
6532 |
|
6533 |
|
6534 |
|
6535 |
|
6536 |
|
6537 | var isEmpty = value == null || typeof value === 'boolean' || value === '';
|
6538 |
|
6539 | if (isEmpty) {
|
6540 | return '';
|
6541 | }
|
6542 |
|
6543 | if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) {
|
6544 | return value + 'px';
|
6545 | }
|
6546 |
|
6547 | return ('' + value).trim();
|
6548 | }
|
6549 |
|
6550 | var uppercasePattern = /([A-Z])/g;
|
6551 | var msPattern = /^ms-/;
|
6552 |
|
6553 |
|
6554 |
|
6555 |
|
6556 |
|
6557 |
|
6558 |
|
6559 |
|
6560 |
|
6561 |
|
6562 |
|
6563 |
|
6564 |
|
6565 |
|
6566 | function hyphenateStyleName(name) {
|
6567 | return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-');
|
6568 | }
|
6569 |
|
6570 | var warnValidStyle = function () {};
|
6571 |
|
6572 | {
|
6573 |
|
6574 | var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
|
6575 | var msPattern$1 = /^-ms-/;
|
6576 | var hyphenPattern = /-(.)/g;
|
6577 |
|
6578 | var badStyleValueWithSemicolonPattern = /;\s*$/;
|
6579 | var warnedStyleNames = {};
|
6580 | var warnedStyleValues = {};
|
6581 | var warnedForNaNValue = false;
|
6582 | var warnedForInfinityValue = false;
|
6583 |
|
6584 | var camelize = function (string) {
|
6585 | return string.replace(hyphenPattern, function (_, character) {
|
6586 | return character.toUpperCase();
|
6587 | });
|
6588 | };
|
6589 |
|
6590 | var warnHyphenatedStyleName = function (name) {
|
6591 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
|
6592 | return;
|
6593 | }
|
6594 |
|
6595 | warnedStyleNames[name] = true;
|
6596 | warning$1(false, 'Unsupported style property %s. Did you mean %s?', name,
|
6597 |
|
6598 |
|
6599 | camelize(name.replace(msPattern$1, 'ms-')));
|
6600 | };
|
6601 |
|
6602 | var warnBadVendoredStyleName = function (name) {
|
6603 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
|
6604 | return;
|
6605 | }
|
6606 |
|
6607 | warnedStyleNames[name] = true;
|
6608 | warning$1(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1));
|
6609 | };
|
6610 |
|
6611 | var warnStyleValueWithSemicolon = function (name, value) {
|
6612 | if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
|
6613 | return;
|
6614 | }
|
6615 |
|
6616 | warnedStyleValues[value] = true;
|
6617 | warning$1(false, "Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, ''));
|
6618 | };
|
6619 |
|
6620 | var warnStyleValueIsNaN = function (name, value) {
|
6621 | if (warnedForNaNValue) {
|
6622 | return;
|
6623 | }
|
6624 |
|
6625 | warnedForNaNValue = true;
|
6626 | warning$1(false, '`NaN` is an invalid value for the `%s` css style property.', name);
|
6627 | };
|
6628 |
|
6629 | var warnStyleValueIsInfinity = function (name, value) {
|
6630 | if (warnedForInfinityValue) {
|
6631 | return;
|
6632 | }
|
6633 |
|
6634 | warnedForInfinityValue = true;
|
6635 | warning$1(false, '`Infinity` is an invalid value for the `%s` css style property.', name);
|
6636 | };
|
6637 |
|
6638 | warnValidStyle = function (name, value) {
|
6639 | if (name.indexOf('-') > -1) {
|
6640 | warnHyphenatedStyleName(name);
|
6641 | } else if (badVendoredStyleNamePattern.test(name)) {
|
6642 | warnBadVendoredStyleName(name);
|
6643 | } else if (badStyleValueWithSemicolonPattern.test(value)) {
|
6644 | warnStyleValueWithSemicolon(name, value);
|
6645 | }
|
6646 |
|
6647 | if (typeof value === 'number') {
|
6648 | if (isNaN(value)) {
|
6649 | warnStyleValueIsNaN(name, value);
|
6650 | } else if (!isFinite(value)) {
|
6651 | warnStyleValueIsInfinity(name, value);
|
6652 | }
|
6653 | }
|
6654 | };
|
6655 | }
|
6656 |
|
6657 | var warnValidStyle$1 = warnValidStyle;
|
6658 |
|
6659 |
|
6660 |
|
6661 |
|
6662 |
|
6663 |
|
6664 |
|
6665 |
|
6666 |
|
6667 |
|
6668 |
|
6669 |
|
6670 | function createDangerousStringForStyles(styles) {
|
6671 | {
|
6672 | var serialized = '';
|
6673 | var delimiter = '';
|
6674 |
|
6675 | for (var styleName in styles) {
|
6676 | if (!styles.hasOwnProperty(styleName)) {
|
6677 | continue;
|
6678 | }
|
6679 |
|
6680 | var styleValue = styles[styleName];
|
6681 |
|
6682 | if (styleValue != null) {
|
6683 | var isCustomProperty = styleName.indexOf('--') === 0;
|
6684 | serialized += delimiter + (isCustomProperty ? styleName : hyphenateStyleName(styleName)) + ':';
|
6685 | serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
|
6686 | delimiter = ';';
|
6687 | }
|
6688 | }
|
6689 |
|
6690 | return serialized || null;
|
6691 | }
|
6692 | }
|
6693 |
|
6694 |
|
6695 |
|
6696 |
|
6697 |
|
6698 |
|
6699 |
|
6700 |
|
6701 | function setValueForStyles(node, styles) {
|
6702 | var style = node.style;
|
6703 |
|
6704 | for (var styleName in styles) {
|
6705 | if (!styles.hasOwnProperty(styleName)) {
|
6706 | continue;
|
6707 | }
|
6708 |
|
6709 | var isCustomProperty = styleName.indexOf('--') === 0;
|
6710 |
|
6711 | {
|
6712 | if (!isCustomProperty) {
|
6713 | warnValidStyle$1(styleName, styles[styleName]);
|
6714 | }
|
6715 | }
|
6716 |
|
6717 | var styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty);
|
6718 |
|
6719 | if (styleName === 'float') {
|
6720 | styleName = 'cssFloat';
|
6721 | }
|
6722 |
|
6723 | if (isCustomProperty) {
|
6724 | style.setProperty(styleName, styleValue);
|
6725 | } else {
|
6726 | style[styleName] = styleValue;
|
6727 | }
|
6728 | }
|
6729 | }
|
6730 |
|
6731 | function isValueEmpty(value) {
|
6732 | return value == null || typeof value === 'boolean' || value === '';
|
6733 | }
|
6734 |
|
6735 |
|
6736 |
|
6737 |
|
6738 |
|
6739 |
|
6740 |
|
6741 |
|
6742 |
|
6743 |
|
6744 | function expandShorthandMap(styles) {
|
6745 | var expanded = {};
|
6746 |
|
6747 | for (var key in styles) {
|
6748 | var longhands = shorthandToLonghand[key] || [key];
|
6749 |
|
6750 | for (var i = 0; i < longhands.length; i++) {
|
6751 | expanded[longhands[i]] = key;
|
6752 | }
|
6753 | }
|
6754 |
|
6755 | return expanded;
|
6756 | }
|
6757 |
|
6758 |
|
6759 |
|
6760 |
|
6761 |
|
6762 |
|
6763 |
|
6764 |
|
6765 |
|
6766 |
|
6767 |
|
6768 |
|
6769 |
|
6770 |
|
6771 |
|
6772 |
|
6773 | function validateShorthandPropertyCollisionInDev(styleUpdates, nextStyles) {
|
6774 | if (!warnAboutShorthandPropertyCollision) {
|
6775 | return;
|
6776 | }
|
6777 |
|
6778 | if (!nextStyles) {
|
6779 | return;
|
6780 | }
|
6781 |
|
6782 | var expandedUpdates = expandShorthandMap(styleUpdates);
|
6783 | var expandedStyles = expandShorthandMap(nextStyles);
|
6784 | var warnedAbout = {};
|
6785 |
|
6786 | for (var key in expandedUpdates) {
|
6787 | var originalKey = expandedUpdates[key];
|
6788 | var correctOriginalKey = expandedStyles[key];
|
6789 |
|
6790 | if (correctOriginalKey && originalKey !== correctOriginalKey) {
|
6791 | var warningKey = originalKey + ',' + correctOriginalKey;
|
6792 |
|
6793 | if (warnedAbout[warningKey]) {
|
6794 | continue;
|
6795 | }
|
6796 |
|
6797 | warnedAbout[warningKey] = true;
|
6798 | warning$1(false, '%s a style property during rerender (%s) when a ' + 'conflicting property is set (%s) can lead to styling bugs. To ' + "avoid this, don't mix shorthand and non-shorthand properties " + 'for the same value; instead, replace the shorthand with ' + 'separate values.', isValueEmpty(styleUpdates[originalKey]) ? 'Removing' : 'Updating', originalKey, correctOriginalKey);
|
6799 | }
|
6800 | }
|
6801 | }
|
6802 |
|
6803 |
|
6804 |
|
6805 | var omittedCloseTags = {
|
6806 | area: true,
|
6807 | base: true,
|
6808 | br: true,
|
6809 | col: true,
|
6810 | embed: true,
|
6811 | hr: true,
|
6812 | img: true,
|
6813 | input: true,
|
6814 | keygen: true,
|
6815 | link: true,
|
6816 | meta: true,
|
6817 | param: true,
|
6818 | source: true,
|
6819 | track: true,
|
6820 | wbr: true
|
6821 |
|
6822 | };
|
6823 |
|
6824 |
|
6825 |
|
6826 | var voidElementTags = _assign({
|
6827 | menuitem: true
|
6828 | }, omittedCloseTags);
|
6829 |
|
6830 |
|
6831 |
|
6832 | var HTML$1 = '__html';
|
6833 | var ReactDebugCurrentFrame$3 = null;
|
6834 |
|
6835 | {
|
6836 | ReactDebugCurrentFrame$3 = ReactSharedInternals.ReactDebugCurrentFrame;
|
6837 | }
|
6838 |
|
6839 | function assertValidProps(tag, props) {
|
6840 | if (!props) {
|
6841 | return;
|
6842 | }
|
6843 |
|
6844 |
|
6845 | if (voidElementTags[tag]) {
|
6846 | (function () {
|
6847 | if (!(props.children == null && props.dangerouslySetInnerHTML == null)) {
|
6848 | {
|
6849 | throw ReactError(Error(tag + " is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`." + (ReactDebugCurrentFrame$3.getStackAddendum())));
|
6850 | }
|
6851 | }
|
6852 | })();
|
6853 | }
|
6854 |
|
6855 | if (props.dangerouslySetInnerHTML != null) {
|
6856 | (function () {
|
6857 | if (!(props.children == null)) {
|
6858 | {
|
6859 | throw ReactError(Error("Can only set one of `children` or `props.dangerouslySetInnerHTML`."));
|
6860 | }
|
6861 | }
|
6862 | })();
|
6863 |
|
6864 | (function () {
|
6865 | if (!(typeof props.dangerouslySetInnerHTML === 'object' && HTML$1 in props.dangerouslySetInnerHTML)) {
|
6866 | {
|
6867 | throw ReactError(Error("`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information."));
|
6868 | }
|
6869 | }
|
6870 | })();
|
6871 | }
|
6872 |
|
6873 | {
|
6874 | !(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;
|
6875 | }
|
6876 |
|
6877 | (function () {
|
6878 | if (!(props.style == null || typeof props.style === 'object')) {
|
6879 | {
|
6880 | throw ReactError(Error("The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX." + (ReactDebugCurrentFrame$3.getStackAddendum())));
|
6881 | }
|
6882 | }
|
6883 | })();
|
6884 | }
|
6885 |
|
6886 | function isCustomComponent(tagName, props) {
|
6887 | if (tagName.indexOf('-') === -1) {
|
6888 | return typeof props.is === 'string';
|
6889 | }
|
6890 |
|
6891 | switch (tagName) {
|
6892 |
|
6893 |
|
6894 |
|
6895 |
|
6896 | case 'annotation-xml':
|
6897 | case 'color-profile':
|
6898 | case 'font-face':
|
6899 | case 'font-face-src':
|
6900 | case 'font-face-uri':
|
6901 | case 'font-face-format':
|
6902 | case 'font-face-name':
|
6903 | case 'missing-glyph':
|
6904 | return false;
|
6905 |
|
6906 | default:
|
6907 | return true;
|
6908 | }
|
6909 | }
|
6910 |
|
6911 |
|
6912 |
|
6913 |
|
6914 | var possibleStandardNames = {
|
6915 |
|
6916 | accept: 'accept',
|
6917 | acceptcharset: 'acceptCharset',
|
6918 | 'accept-charset': 'acceptCharset',
|
6919 | accesskey: 'accessKey',
|
6920 | action: 'action',
|
6921 | allowfullscreen: 'allowFullScreen',
|
6922 | alt: 'alt',
|
6923 | as: 'as',
|
6924 | async: 'async',
|
6925 | autocapitalize: 'autoCapitalize',
|
6926 | autocomplete: 'autoComplete',
|
6927 | autocorrect: 'autoCorrect',
|
6928 | autofocus: 'autoFocus',
|
6929 | autoplay: 'autoPlay',
|
6930 | autosave: 'autoSave',
|
6931 | capture: 'capture',
|
6932 | cellpadding: 'cellPadding',
|
6933 | cellspacing: 'cellSpacing',
|
6934 | challenge: 'challenge',
|
6935 | charset: 'charSet',
|
6936 | checked: 'checked',
|
6937 | children: 'children',
|
6938 | cite: 'cite',
|
6939 | class: 'className',
|
6940 | classid: 'classID',
|
6941 | classname: 'className',
|
6942 | cols: 'cols',
|
6943 | colspan: 'colSpan',
|
6944 | content: 'content',
|
6945 | contenteditable: 'contentEditable',
|
6946 | contextmenu: 'contextMenu',
|
6947 | controls: 'controls',
|
6948 | controlslist: 'controlsList',
|
6949 | coords: 'coords',
|
6950 | crossorigin: 'crossOrigin',
|
6951 | dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
|
6952 | data: 'data',
|
6953 | datetime: 'dateTime',
|
6954 | default: 'default',
|
6955 | defaultchecked: 'defaultChecked',
|
6956 | defaultvalue: 'defaultValue',
|
6957 | defer: 'defer',
|
6958 | dir: 'dir',
|
6959 | disabled: 'disabled',
|
6960 | disablepictureinpicture: 'disablePictureInPicture',
|
6961 | download: 'download',
|
6962 | draggable: 'draggable',
|
6963 | enctype: 'encType',
|
6964 | for: 'htmlFor',
|
6965 | form: 'form',
|
6966 | formmethod: 'formMethod',
|
6967 | formaction: 'formAction',
|
6968 | formenctype: 'formEncType',
|
6969 | formnovalidate: 'formNoValidate',
|
6970 | formtarget: 'formTarget',
|
6971 | frameborder: 'frameBorder',
|
6972 | headers: 'headers',
|
6973 | height: 'height',
|
6974 | hidden: 'hidden',
|
6975 | high: 'high',
|
6976 | href: 'href',
|
6977 | hreflang: 'hrefLang',
|
6978 | htmlfor: 'htmlFor',
|
6979 | httpequiv: 'httpEquiv',
|
6980 | 'http-equiv': 'httpEquiv',
|
6981 | icon: 'icon',
|
6982 | id: 'id',
|
6983 | innerhtml: 'innerHTML',
|
6984 | inputmode: 'inputMode',
|
6985 | integrity: 'integrity',
|
6986 | is: 'is',
|
6987 | itemid: 'itemID',
|
6988 | itemprop: 'itemProp',
|
6989 | itemref: 'itemRef',
|
6990 | itemscope: 'itemScope',
|
6991 | itemtype: 'itemType',
|
6992 | keyparams: 'keyParams',
|
6993 | keytype: 'keyType',
|
6994 | kind: 'kind',
|
6995 | label: 'label',
|
6996 | lang: 'lang',
|
6997 | list: 'list',
|
6998 | loop: 'loop',
|
6999 | low: 'low',
|
7000 | manifest: 'manifest',
|
7001 | marginwidth: 'marginWidth',
|
7002 | marginheight: 'marginHeight',
|
7003 | max: 'max',
|
7004 | maxlength: 'maxLength',
|
7005 | media: 'media',
|
7006 | mediagroup: 'mediaGroup',
|
7007 | method: 'method',
|
7008 | min: 'min',
|
7009 | minlength: 'minLength',
|
7010 | multiple: 'multiple',
|
7011 | muted: 'muted',
|
7012 | name: 'name',
|
7013 | nomodule: 'noModule',
|
7014 | nonce: 'nonce',
|
7015 | novalidate: 'noValidate',
|
7016 | open: 'open',
|
7017 | optimum: 'optimum',
|
7018 | pattern: 'pattern',
|
7019 | placeholder: 'placeholder',
|
7020 | playsinline: 'playsInline',
|
7021 | poster: 'poster',
|
7022 | preload: 'preload',
|
7023 | profile: 'profile',
|
7024 | radiogroup: 'radioGroup',
|
7025 | readonly: 'readOnly',
|
7026 | referrerpolicy: 'referrerPolicy',
|
7027 | rel: 'rel',
|
7028 | required: 'required',
|
7029 | reversed: 'reversed',
|
7030 | role: 'role',
|
7031 | rows: 'rows',
|
7032 | rowspan: 'rowSpan',
|
7033 | sandbox: 'sandbox',
|
7034 | scope: 'scope',
|
7035 | scoped: 'scoped',
|
7036 | scrolling: 'scrolling',
|
7037 | seamless: 'seamless',
|
7038 | selected: 'selected',
|
7039 | shape: 'shape',
|
7040 | size: 'size',
|
7041 | sizes: 'sizes',
|
7042 | span: 'span',
|
7043 | spellcheck: 'spellCheck',
|
7044 | src: 'src',
|
7045 | srcdoc: 'srcDoc',
|
7046 | srclang: 'srcLang',
|
7047 | srcset: 'srcSet',
|
7048 | start: 'start',
|
7049 | step: 'step',
|
7050 | style: 'style',
|
7051 | summary: 'summary',
|
7052 | tabindex: 'tabIndex',
|
7053 | target: 'target',
|
7054 | title: 'title',
|
7055 | type: 'type',
|
7056 | usemap: 'useMap',
|
7057 | value: 'value',
|
7058 | width: 'width',
|
7059 | wmode: 'wmode',
|
7060 | wrap: 'wrap',
|
7061 |
|
7062 | about: 'about',
|
7063 | accentheight: 'accentHeight',
|
7064 | 'accent-height': 'accentHeight',
|
7065 | accumulate: 'accumulate',
|
7066 | additive: 'additive',
|
7067 | alignmentbaseline: 'alignmentBaseline',
|
7068 | 'alignment-baseline': 'alignmentBaseline',
|
7069 | allowreorder: 'allowReorder',
|
7070 | alphabetic: 'alphabetic',
|
7071 | amplitude: 'amplitude',
|
7072 | arabicform: 'arabicForm',
|
7073 | 'arabic-form': 'arabicForm',
|
7074 | ascent: 'ascent',
|
7075 | attributename: 'attributeName',
|
7076 | attributetype: 'attributeType',
|
7077 | autoreverse: 'autoReverse',
|
7078 | azimuth: 'azimuth',
|
7079 | basefrequency: 'baseFrequency',
|
7080 | baselineshift: 'baselineShift',
|
7081 | 'baseline-shift': 'baselineShift',
|
7082 | baseprofile: 'baseProfile',
|
7083 | bbox: 'bbox',
|
7084 | begin: 'begin',
|
7085 | bias: 'bias',
|
7086 | by: 'by',
|
7087 | calcmode: 'calcMode',
|
7088 | capheight: 'capHeight',
|
7089 | 'cap-height': 'capHeight',
|
7090 | clip: 'clip',
|
7091 | clippath: 'clipPath',
|
7092 | 'clip-path': 'clipPath',
|
7093 | clippathunits: 'clipPathUnits',
|
7094 | cliprule: 'clipRule',
|
7095 | 'clip-rule': 'clipRule',
|
7096 | color: 'color',
|
7097 | colorinterpolation: 'colorInterpolation',
|
7098 | 'color-interpolation': 'colorInterpolation',
|
7099 | colorinterpolationfilters: 'colorInterpolationFilters',
|
7100 | 'color-interpolation-filters': 'colorInterpolationFilters',
|
7101 | colorprofile: 'colorProfile',
|
7102 | 'color-profile': 'colorProfile',
|
7103 | colorrendering: 'colorRendering',
|
7104 | 'color-rendering': 'colorRendering',
|
7105 | contentscripttype: 'contentScriptType',
|
7106 | contentstyletype: 'contentStyleType',
|
7107 | cursor: 'cursor',
|
7108 | cx: 'cx',
|
7109 | cy: 'cy',
|
7110 | d: 'd',
|
7111 | datatype: 'datatype',
|
7112 | decelerate: 'decelerate',
|
7113 | descent: 'descent',
|
7114 | diffuseconstant: 'diffuseConstant',
|
7115 | direction: 'direction',
|
7116 | display: 'display',
|
7117 | divisor: 'divisor',
|
7118 | dominantbaseline: 'dominantBaseline',
|
7119 | 'dominant-baseline': 'dominantBaseline',
|
7120 | dur: 'dur',
|
7121 | dx: 'dx',
|
7122 | dy: 'dy',
|
7123 | edgemode: 'edgeMode',
|
7124 | elevation: 'elevation',
|
7125 | enablebackground: 'enableBackground',
|
7126 | 'enable-background': 'enableBackground',
|
7127 | end: 'end',
|
7128 | exponent: 'exponent',
|
7129 | externalresourcesrequired: 'externalResourcesRequired',
|
7130 | fill: 'fill',
|
7131 | fillopacity: 'fillOpacity',
|
7132 | 'fill-opacity': 'fillOpacity',
|
7133 | fillrule: 'fillRule',
|
7134 | 'fill-rule': 'fillRule',
|
7135 | filter: 'filter',
|
7136 | filterres: 'filterRes',
|
7137 | filterunits: 'filterUnits',
|
7138 | floodopacity: 'floodOpacity',
|
7139 | 'flood-opacity': 'floodOpacity',
|
7140 | floodcolor: 'floodColor',
|
7141 | 'flood-color': 'floodColor',
|
7142 | focusable: 'focusable',
|
7143 | fontfamily: 'fontFamily',
|
7144 | 'font-family': 'fontFamily',
|
7145 | fontsize: 'fontSize',
|
7146 | 'font-size': 'fontSize',
|
7147 | fontsizeadjust: 'fontSizeAdjust',
|
7148 | 'font-size-adjust': 'fontSizeAdjust',
|
7149 | fontstretch: 'fontStretch',
|
7150 | 'font-stretch': 'fontStretch',
|
7151 | fontstyle: 'fontStyle',
|
7152 | 'font-style': 'fontStyle',
|
7153 | fontvariant: 'fontVariant',
|
7154 | 'font-variant': 'fontVariant',
|
7155 | fontweight: 'fontWeight',
|
7156 | 'font-weight': 'fontWeight',
|
7157 | format: 'format',
|
7158 | from: 'from',
|
7159 | fx: 'fx',
|
7160 | fy: 'fy',
|
7161 | g1: 'g1',
|
7162 | g2: 'g2',
|
7163 | glyphname: 'glyphName',
|
7164 | 'glyph-name': 'glyphName',
|
7165 | glyphorientationhorizontal: 'glyphOrientationHorizontal',
|
7166 | 'glyph-orientation-horizontal': 'glyphOrientationHorizontal',
|
7167 | glyphorientationvertical: 'glyphOrientationVertical',
|
7168 | 'glyph-orientation-vertical': 'glyphOrientationVertical',
|
7169 | glyphref: 'glyphRef',
|
7170 | gradienttransform: 'gradientTransform',
|
7171 | gradientunits: 'gradientUnits',
|
7172 | hanging: 'hanging',
|
7173 | horizadvx: 'horizAdvX',
|
7174 | 'horiz-adv-x': 'horizAdvX',
|
7175 | horizoriginx: 'horizOriginX',
|
7176 | 'horiz-origin-x': 'horizOriginX',
|
7177 | ideographic: 'ideographic',
|
7178 | imagerendering: 'imageRendering',
|
7179 | 'image-rendering': 'imageRendering',
|
7180 | in2: 'in2',
|
7181 | in: 'in',
|
7182 | inlist: 'inlist',
|
7183 | intercept: 'intercept',
|
7184 | k1: 'k1',
|
7185 | k2: 'k2',
|
7186 | k3: 'k3',
|
7187 | k4: 'k4',
|
7188 | k: 'k',
|
7189 | kernelmatrix: 'kernelMatrix',
|
7190 | kernelunitlength: 'kernelUnitLength',
|
7191 | kerning: 'kerning',
|
7192 | keypoints: 'keyPoints',
|
7193 | keysplines: 'keySplines',
|
7194 | keytimes: 'keyTimes',
|
7195 | lengthadjust: 'lengthAdjust',
|
7196 | letterspacing: 'letterSpacing',
|
7197 | 'letter-spacing': 'letterSpacing',
|
7198 | lightingcolor: 'lightingColor',
|
7199 | 'lighting-color': 'lightingColor',
|
7200 | limitingconeangle: 'limitingConeAngle',
|
7201 | local: 'local',
|
7202 | markerend: 'markerEnd',
|
7203 | 'marker-end': 'markerEnd',
|
7204 | markerheight: 'markerHeight',
|
7205 | markermid: 'markerMid',
|
7206 | 'marker-mid': 'markerMid',
|
7207 | markerstart: 'markerStart',
|
7208 | 'marker-start': 'markerStart',
|
7209 | markerunits: 'markerUnits',
|
7210 | markerwidth: 'markerWidth',
|
7211 | mask: 'mask',
|
7212 | maskcontentunits: 'maskContentUnits',
|
7213 | maskunits: 'maskUnits',
|
7214 | mathematical: 'mathematical',
|
7215 | mode: 'mode',
|
7216 | numoctaves: 'numOctaves',
|
7217 | offset: 'offset',
|
7218 | opacity: 'opacity',
|
7219 | operator: 'operator',
|
7220 | order: 'order',
|
7221 | orient: 'orient',
|
7222 | orientation: 'orientation',
|
7223 | origin: 'origin',
|
7224 | overflow: 'overflow',
|
7225 | overlineposition: 'overlinePosition',
|
7226 | 'overline-position': 'overlinePosition',
|
7227 | overlinethickness: 'overlineThickness',
|
7228 | 'overline-thickness': 'overlineThickness',
|
7229 | paintorder: 'paintOrder',
|
7230 | 'paint-order': 'paintOrder',
|
7231 | panose1: 'panose1',
|
7232 | 'panose-1': 'panose1',
|
7233 | pathlength: 'pathLength',
|
7234 | patterncontentunits: 'patternContentUnits',
|
7235 | patterntransform: 'patternTransform',
|
7236 | patternunits: 'patternUnits',
|
7237 | pointerevents: 'pointerEvents',
|
7238 | 'pointer-events': 'pointerEvents',
|
7239 | points: 'points',
|
7240 | pointsatx: 'pointsAtX',
|
7241 | pointsaty: 'pointsAtY',
|
7242 | pointsatz: 'pointsAtZ',
|
7243 | prefix: 'prefix',
|
7244 | preservealpha: 'preserveAlpha',
|
7245 | preserveaspectratio: 'preserveAspectRatio',
|
7246 | primitiveunits: 'primitiveUnits',
|
7247 | property: 'property',
|
7248 | r: 'r',
|
7249 | radius: 'radius',
|
7250 | refx: 'refX',
|
7251 | refy: 'refY',
|
7252 | renderingintent: 'renderingIntent',
|
7253 | 'rendering-intent': 'renderingIntent',
|
7254 | repeatcount: 'repeatCount',
|
7255 | repeatdur: 'repeatDur',
|
7256 | requiredextensions: 'requiredExtensions',
|
7257 | requiredfeatures: 'requiredFeatures',
|
7258 | resource: 'resource',
|
7259 | restart: 'restart',
|
7260 | result: 'result',
|
7261 | results: 'results',
|
7262 | rotate: 'rotate',
|
7263 | rx: 'rx',
|
7264 | ry: 'ry',
|
7265 | scale: 'scale',
|
7266 | security: 'security',
|
7267 | seed: 'seed',
|
7268 | shaperendering: 'shapeRendering',
|
7269 | 'shape-rendering': 'shapeRendering',
|
7270 | slope: 'slope',
|
7271 | spacing: 'spacing',
|
7272 | specularconstant: 'specularConstant',
|
7273 | specularexponent: 'specularExponent',
|
7274 | speed: 'speed',
|
7275 | spreadmethod: 'spreadMethod',
|
7276 | startoffset: 'startOffset',
|
7277 | stddeviation: 'stdDeviation',
|
7278 | stemh: 'stemh',
|
7279 | stemv: 'stemv',
|
7280 | stitchtiles: 'stitchTiles',
|
7281 | stopcolor: 'stopColor',
|
7282 | 'stop-color': 'stopColor',
|
7283 | stopopacity: 'stopOpacity',
|
7284 | 'stop-opacity': 'stopOpacity',
|
7285 | strikethroughposition: 'strikethroughPosition',
|
7286 | 'strikethrough-position': 'strikethroughPosition',
|
7287 | strikethroughthickness: 'strikethroughThickness',
|
7288 | 'strikethrough-thickness': 'strikethroughThickness',
|
7289 | string: 'string',
|
7290 | stroke: 'stroke',
|
7291 | strokedasharray: 'strokeDasharray',
|
7292 | 'stroke-dasharray': 'strokeDasharray',
|
7293 | strokedashoffset: 'strokeDashoffset',
|
7294 | 'stroke-dashoffset': 'strokeDashoffset',
|
7295 | strokelinecap: 'strokeLinecap',
|
7296 | 'stroke-linecap': 'strokeLinecap',
|
7297 | strokelinejoin: 'strokeLinejoin',
|
7298 | 'stroke-linejoin': 'strokeLinejoin',
|
7299 | strokemiterlimit: 'strokeMiterlimit',
|
7300 | 'stroke-miterlimit': 'strokeMiterlimit',
|
7301 | strokewidth: 'strokeWidth',
|
7302 | 'stroke-width': 'strokeWidth',
|
7303 | strokeopacity: 'strokeOpacity',
|
7304 | 'stroke-opacity': 'strokeOpacity',
|
7305 | suppresscontenteditablewarning: 'suppressContentEditableWarning',
|
7306 | suppresshydrationwarning: 'suppressHydrationWarning',
|
7307 | surfacescale: 'surfaceScale',
|
7308 | systemlanguage: 'systemLanguage',
|
7309 | tablevalues: 'tableValues',
|
7310 | targetx: 'targetX',
|
7311 | targety: 'targetY',
|
7312 | textanchor: 'textAnchor',
|
7313 | 'text-anchor': 'textAnchor',
|
7314 | textdecoration: 'textDecoration',
|
7315 | 'text-decoration': 'textDecoration',
|
7316 | textlength: 'textLength',
|
7317 | textrendering: 'textRendering',
|
7318 | 'text-rendering': 'textRendering',
|
7319 | to: 'to',
|
7320 | transform: 'transform',
|
7321 | typeof: 'typeof',
|
7322 | u1: 'u1',
|
7323 | u2: 'u2',
|
7324 | underlineposition: 'underlinePosition',
|
7325 | 'underline-position': 'underlinePosition',
|
7326 | underlinethickness: 'underlineThickness',
|
7327 | 'underline-thickness': 'underlineThickness',
|
7328 | unicode: 'unicode',
|
7329 | unicodebidi: 'unicodeBidi',
|
7330 | 'unicode-bidi': 'unicodeBidi',
|
7331 | unicoderange: 'unicodeRange',
|
7332 | 'unicode-range': 'unicodeRange',
|
7333 | unitsperem: 'unitsPerEm',
|
7334 | 'units-per-em': 'unitsPerEm',
|
7335 | unselectable: 'unselectable',
|
7336 | valphabetic: 'vAlphabetic',
|
7337 | 'v-alphabetic': 'vAlphabetic',
|
7338 | values: 'values',
|
7339 | vectoreffect: 'vectorEffect',
|
7340 | 'vector-effect': 'vectorEffect',
|
7341 | version: 'version',
|
7342 | vertadvy: 'vertAdvY',
|
7343 | 'vert-adv-y': 'vertAdvY',
|
7344 | vertoriginx: 'vertOriginX',
|
7345 | 'vert-origin-x': 'vertOriginX',
|
7346 | vertoriginy: 'vertOriginY',
|
7347 | 'vert-origin-y': 'vertOriginY',
|
7348 | vhanging: 'vHanging',
|
7349 | 'v-hanging': 'vHanging',
|
7350 | videographic: 'vIdeographic',
|
7351 | 'v-ideographic': 'vIdeographic',
|
7352 | viewbox: 'viewBox',
|
7353 | viewtarget: 'viewTarget',
|
7354 | visibility: 'visibility',
|
7355 | vmathematical: 'vMathematical',
|
7356 | 'v-mathematical': 'vMathematical',
|
7357 | vocab: 'vocab',
|
7358 | widths: 'widths',
|
7359 | wordspacing: 'wordSpacing',
|
7360 | 'word-spacing': 'wordSpacing',
|
7361 | writingmode: 'writingMode',
|
7362 | 'writing-mode': 'writingMode',
|
7363 | x1: 'x1',
|
7364 | x2: 'x2',
|
7365 | x: 'x',
|
7366 | xchannelselector: 'xChannelSelector',
|
7367 | xheight: 'xHeight',
|
7368 | 'x-height': 'xHeight',
|
7369 | xlinkactuate: 'xlinkActuate',
|
7370 | 'xlink:actuate': 'xlinkActuate',
|
7371 | xlinkarcrole: 'xlinkArcrole',
|
7372 | 'xlink:arcrole': 'xlinkArcrole',
|
7373 | xlinkhref: 'xlinkHref',
|
7374 | 'xlink:href': 'xlinkHref',
|
7375 | xlinkrole: 'xlinkRole',
|
7376 | 'xlink:role': 'xlinkRole',
|
7377 | xlinkshow: 'xlinkShow',
|
7378 | 'xlink:show': 'xlinkShow',
|
7379 | xlinktitle: 'xlinkTitle',
|
7380 | 'xlink:title': 'xlinkTitle',
|
7381 | xlinktype: 'xlinkType',
|
7382 | 'xlink:type': 'xlinkType',
|
7383 | xmlbase: 'xmlBase',
|
7384 | 'xml:base': 'xmlBase',
|
7385 | xmllang: 'xmlLang',
|
7386 | 'xml:lang': 'xmlLang',
|
7387 | xmlns: 'xmlns',
|
7388 | 'xml:space': 'xmlSpace',
|
7389 | xmlnsxlink: 'xmlnsXlink',
|
7390 | 'xmlns:xlink': 'xmlnsXlink',
|
7391 | xmlspace: 'xmlSpace',
|
7392 | y1: 'y1',
|
7393 | y2: 'y2',
|
7394 | y: 'y',
|
7395 | ychannelselector: 'yChannelSelector',
|
7396 | z: 'z',
|
7397 | zoomandpan: 'zoomAndPan'
|
7398 | };
|
7399 |
|
7400 | var ariaProperties = {
|
7401 | 'aria-current': 0,
|
7402 |
|
7403 | 'aria-details': 0,
|
7404 | 'aria-disabled': 0,
|
7405 |
|
7406 | 'aria-hidden': 0,
|
7407 |
|
7408 | 'aria-invalid': 0,
|
7409 |
|
7410 | 'aria-keyshortcuts': 0,
|
7411 | 'aria-label': 0,
|
7412 | 'aria-roledescription': 0,
|
7413 |
|
7414 | 'aria-autocomplete': 0,
|
7415 | 'aria-checked': 0,
|
7416 | 'aria-expanded': 0,
|
7417 | 'aria-haspopup': 0,
|
7418 | 'aria-level': 0,
|
7419 | 'aria-modal': 0,
|
7420 | 'aria-multiline': 0,
|
7421 | 'aria-multiselectable': 0,
|
7422 | 'aria-orientation': 0,
|
7423 | 'aria-placeholder': 0,
|
7424 | 'aria-pressed': 0,
|
7425 | 'aria-readonly': 0,
|
7426 | 'aria-required': 0,
|
7427 | 'aria-selected': 0,
|
7428 | 'aria-sort': 0,
|
7429 | 'aria-valuemax': 0,
|
7430 | 'aria-valuemin': 0,
|
7431 | 'aria-valuenow': 0,
|
7432 | 'aria-valuetext': 0,
|
7433 |
|
7434 | 'aria-atomic': 0,
|
7435 | 'aria-busy': 0,
|
7436 | 'aria-live': 0,
|
7437 | 'aria-relevant': 0,
|
7438 |
|
7439 | 'aria-dropeffect': 0,
|
7440 | 'aria-grabbed': 0,
|
7441 |
|
7442 | 'aria-activedescendant': 0,
|
7443 | 'aria-colcount': 0,
|
7444 | 'aria-colindex': 0,
|
7445 | 'aria-colspan': 0,
|
7446 | 'aria-controls': 0,
|
7447 | 'aria-describedby': 0,
|
7448 | 'aria-errormessage': 0,
|
7449 | 'aria-flowto': 0,
|
7450 | 'aria-labelledby': 0,
|
7451 | 'aria-owns': 0,
|
7452 | 'aria-posinset': 0,
|
7453 | 'aria-rowcount': 0,
|
7454 | 'aria-rowindex': 0,
|
7455 | 'aria-rowspan': 0,
|
7456 | 'aria-setsize': 0
|
7457 | };
|
7458 |
|
7459 | var warnedProperties = {};
|
7460 | var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
|
7461 | var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
7462 | var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
7463 |
|
7464 | function validateProperty(tagName, name) {
|
7465 | if (hasOwnProperty$1.call(warnedProperties, name) && warnedProperties[name]) {
|
7466 | return true;
|
7467 | }
|
7468 |
|
7469 | if (rARIACamel.test(name)) {
|
7470 | var ariaName = 'aria-' + name.slice(4).toLowerCase();
|
7471 | var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null;
|
7472 |
|
7473 |
|
7474 | if (correctName == null) {
|
7475 | warning$1(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
|
7476 | warnedProperties[name] = true;
|
7477 | return true;
|
7478 | }
|
7479 |
|
7480 |
|
7481 | if (name !== correctName) {
|
7482 | warning$1(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
|
7483 | warnedProperties[name] = true;
|
7484 | return true;
|
7485 | }
|
7486 | }
|
7487 |
|
7488 | if (rARIA.test(name)) {
|
7489 | var lowerCasedName = name.toLowerCase();
|
7490 | var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null;
|
7491 |
|
7492 |
|
7493 | if (standardName == null) {
|
7494 | warnedProperties[name] = true;
|
7495 | return false;
|
7496 | }
|
7497 |
|
7498 |
|
7499 | if (name !== standardName) {
|
7500 | warning$1(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
|
7501 | warnedProperties[name] = true;
|
7502 | return true;
|
7503 | }
|
7504 | }
|
7505 |
|
7506 | return true;
|
7507 | }
|
7508 |
|
7509 | function warnInvalidARIAProps(type, props) {
|
7510 | var invalidProps = [];
|
7511 |
|
7512 | for (var key in props) {
|
7513 | var isValid = validateProperty(type, key);
|
7514 |
|
7515 | if (!isValid) {
|
7516 | invalidProps.push(key);
|
7517 | }
|
7518 | }
|
7519 |
|
7520 | var unknownPropString = invalidProps.map(function (prop) {
|
7521 | return '`' + prop + '`';
|
7522 | }).join(', ');
|
7523 |
|
7524 | if (invalidProps.length === 1) {
|
7525 | warning$1(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
|
7526 | } else if (invalidProps.length > 1) {
|
7527 | warning$1(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
|
7528 | }
|
7529 | }
|
7530 |
|
7531 | function validateProperties(type, props) {
|
7532 | if (isCustomComponent(type, props)) {
|
7533 | return;
|
7534 | }
|
7535 |
|
7536 | warnInvalidARIAProps(type, props);
|
7537 | }
|
7538 |
|
7539 | var didWarnValueNull = false;
|
7540 | function validateProperties$1(type, props) {
|
7541 | if (type !== 'input' && type !== 'textarea' && type !== 'select') {
|
7542 | return;
|
7543 | }
|
7544 |
|
7545 | if (props != null && props.value === null && !didWarnValueNull) {
|
7546 | didWarnValueNull = true;
|
7547 |
|
7548 | if (type === 'select' && props.multiple) {
|
7549 | 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);
|
7550 | } else {
|
7551 | 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);
|
7552 | }
|
7553 | }
|
7554 | }
|
7555 |
|
7556 | var validateProperty$1 = function () {};
|
7557 |
|
7558 | {
|
7559 | var warnedProperties$1 = {};
|
7560 | var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
7561 | var EVENT_NAME_REGEX = /^on./;
|
7562 | var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
|
7563 | var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
|
7564 | var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
7565 |
|
7566 | validateProperty$1 = function (tagName, name, value, canUseEventSystem) {
|
7567 | if (_hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
|
7568 | return true;
|
7569 | }
|
7570 |
|
7571 | var lowerCasedName = name.toLowerCase();
|
7572 |
|
7573 | if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
|
7574 | 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.');
|
7575 | warnedProperties$1[name] = true;
|
7576 | return true;
|
7577 | }
|
7578 |
|
7579 |
|
7580 | if (canUseEventSystem) {
|
7581 | if (registrationNameModules.hasOwnProperty(name)) {
|
7582 | return true;
|
7583 | }
|
7584 |
|
7585 | var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
|
7586 |
|
7587 | if (registrationName != null) {
|
7588 | warning$1(false, 'Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName);
|
7589 | warnedProperties$1[name] = true;
|
7590 | return true;
|
7591 | }
|
7592 |
|
7593 | if (EVENT_NAME_REGEX.test(name)) {
|
7594 | warning$1(false, 'Unknown event handler property `%s`. It will be ignored.', name);
|
7595 | warnedProperties$1[name] = true;
|
7596 | return true;
|
7597 | }
|
7598 | } else if (EVENT_NAME_REGEX.test(name)) {
|
7599 |
|
7600 |
|
7601 |
|
7602 | if (INVALID_EVENT_NAME_REGEX.test(name)) {
|
7603 | warning$1(false, 'Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name);
|
7604 | }
|
7605 |
|
7606 | warnedProperties$1[name] = true;
|
7607 | return true;
|
7608 | }
|
7609 |
|
7610 |
|
7611 | if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
|
7612 | return true;
|
7613 | }
|
7614 |
|
7615 | if (lowerCasedName === 'innerhtml') {
|
7616 | warning$1(false, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
|
7617 | warnedProperties$1[name] = true;
|
7618 | return true;
|
7619 | }
|
7620 |
|
7621 | if (lowerCasedName === 'aria') {
|
7622 | warning$1(false, 'The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
|
7623 | warnedProperties$1[name] = true;
|
7624 | return true;
|
7625 | }
|
7626 |
|
7627 | if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
|
7628 | warning$1(false, 'Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value);
|
7629 | warnedProperties$1[name] = true;
|
7630 | return true;
|
7631 | }
|
7632 |
|
7633 | if (typeof value === 'number' && isNaN(value)) {
|
7634 | warning$1(false, 'Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name);
|
7635 | warnedProperties$1[name] = true;
|
7636 | return true;
|
7637 | }
|
7638 |
|
7639 | var propertyInfo = getPropertyInfo(name);
|
7640 | var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED;
|
7641 |
|
7642 | if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
|
7643 | var standardName = possibleStandardNames[lowerCasedName];
|
7644 |
|
7645 | if (standardName !== name) {
|
7646 | warning$1(false, 'Invalid DOM property `%s`. Did you mean `%s`?', name, standardName);
|
7647 | warnedProperties$1[name] = true;
|
7648 | return true;
|
7649 | }
|
7650 | } else if (!isReserved && name !== lowerCasedName) {
|
7651 |
|
7652 |
|
7653 | 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);
|
7654 | warnedProperties$1[name] = true;
|
7655 | return true;
|
7656 | }
|
7657 |
|
7658 | if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
|
7659 | if (value) {
|
7660 | 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);
|
7661 | } else {
|
7662 | 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);
|
7663 | }
|
7664 |
|
7665 | warnedProperties$1[name] = true;
|
7666 | return true;
|
7667 | }
|
7668 |
|
7669 |
|
7670 |
|
7671 | if (isReserved) {
|
7672 | return true;
|
7673 | }
|
7674 |
|
7675 |
|
7676 | if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
|
7677 | warnedProperties$1[name] = true;
|
7678 | return false;
|
7679 | }
|
7680 |
|
7681 |
|
7682 | if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
|
7683 | 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);
|
7684 | warnedProperties$1[name] = true;
|
7685 | return true;
|
7686 | }
|
7687 |
|
7688 | return true;
|
7689 | };
|
7690 | }
|
7691 |
|
7692 | var warnUnknownProperties = function (type, props, canUseEventSystem) {
|
7693 | var unknownProps = [];
|
7694 |
|
7695 | for (var key in props) {
|
7696 | var isValid = validateProperty$1(type, key, props[key], canUseEventSystem);
|
7697 |
|
7698 | if (!isValid) {
|
7699 | unknownProps.push(key);
|
7700 | }
|
7701 | }
|
7702 |
|
7703 | var unknownPropString = unknownProps.map(function (prop) {
|
7704 | return '`' + prop + '`';
|
7705 | }).join(', ');
|
7706 |
|
7707 | if (unknownProps.length === 1) {
|
7708 | 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);
|
7709 | } else if (unknownProps.length > 1) {
|
7710 | 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);
|
7711 | }
|
7712 | };
|
7713 |
|
7714 | function validateProperties$2(type, props, canUseEventSystem) {
|
7715 | if (isCustomComponent(type, props)) {
|
7716 | return;
|
7717 | }
|
7718 |
|
7719 | warnUnknownProperties(type, props, canUseEventSystem);
|
7720 | }
|
7721 |
|
7722 |
|
7723 | var didWarnInvalidHydration = false;
|
7724 | var didWarnShadyDOM = false;
|
7725 | var didWarnScriptTags = false;
|
7726 | var DANGEROUSLY_SET_INNER_HTML = 'dangerouslySetInnerHTML';
|
7727 | var SUPPRESS_CONTENT_EDITABLE_WARNING = 'suppressContentEditableWarning';
|
7728 | var SUPPRESS_HYDRATION_WARNING$1 = 'suppressHydrationWarning';
|
7729 | var AUTOFOCUS = 'autoFocus';
|
7730 | var CHILDREN = 'children';
|
7731 | var STYLE$1 = 'style';
|
7732 | var HTML = '__html';
|
7733 | var LISTENERS = 'listeners';
|
7734 | var HTML_NAMESPACE = Namespaces.html;
|
7735 | var warnedUnknownTags;
|
7736 | var suppressHydrationWarning;
|
7737 | var validatePropertiesInDevelopment;
|
7738 | var warnForTextDifference;
|
7739 | var warnForPropDifference;
|
7740 | var warnForExtraAttributes;
|
7741 | var warnForInvalidEventListener;
|
7742 | var canDiffStyleForHydrationWarning;
|
7743 | var normalizeMarkupForTextOrAttribute;
|
7744 | var normalizeHTML;
|
7745 |
|
7746 | {
|
7747 | warnedUnknownTags = {
|
7748 |
|
7749 |
|
7750 |
|
7751 |
|
7752 | time: true,
|
7753 |
|
7754 | dialog: true,
|
7755 |
|
7756 |
|
7757 |
|
7758 |
|
7759 |
|
7760 | webview: true
|
7761 | };
|
7762 |
|
7763 | validatePropertiesInDevelopment = function (type, props) {
|
7764 | validateProperties(type, props);
|
7765 | validateProperties$1(type, props);
|
7766 | validateProperties$2(type, props,
|
7767 |
|
7768 | true);
|
7769 | };
|
7770 |
|
7771 |
|
7772 |
|
7773 |
|
7774 |
|
7775 |
|
7776 |
|
7777 |
|
7778 |
|
7779 | canDiffStyleForHydrationWarning = canUseDOM && !document.documentMode;
|
7780 |
|
7781 |
|
7782 |
|
7783 |
|
7784 |
|
7785 | var NORMALIZE_NEWLINES_REGEX = /\r\n?/g;
|
7786 | var NORMALIZE_NULL_AND_REPLACEMENT_REGEX = /\u0000|\uFFFD/g;
|
7787 |
|
7788 | normalizeMarkupForTextOrAttribute = function (markup) {
|
7789 | var markupString = typeof markup === 'string' ? markup : '' + markup;
|
7790 | return markupString.replace(NORMALIZE_NEWLINES_REGEX, '\n').replace(NORMALIZE_NULL_AND_REPLACEMENT_REGEX, '');
|
7791 | };
|
7792 |
|
7793 | warnForTextDifference = function (serverText, clientText) {
|
7794 | if (didWarnInvalidHydration) {
|
7795 | return;
|
7796 | }
|
7797 |
|
7798 | var normalizedClientText = normalizeMarkupForTextOrAttribute(clientText);
|
7799 | var normalizedServerText = normalizeMarkupForTextOrAttribute(serverText);
|
7800 |
|
7801 | if (normalizedServerText === normalizedClientText) {
|
7802 | return;
|
7803 | }
|
7804 |
|
7805 | didWarnInvalidHydration = true;
|
7806 | warningWithoutStack$1(false, 'Text content did not match. Server: "%s" Client: "%s"', normalizedServerText, normalizedClientText);
|
7807 | };
|
7808 |
|
7809 | warnForPropDifference = function (propName, serverValue, clientValue) {
|
7810 | if (didWarnInvalidHydration) {
|
7811 | return;
|
7812 | }
|
7813 |
|
7814 | var normalizedClientValue = normalizeMarkupForTextOrAttribute(clientValue);
|
7815 | var normalizedServerValue = normalizeMarkupForTextOrAttribute(serverValue);
|
7816 |
|
7817 | if (normalizedServerValue === normalizedClientValue) {
|
7818 | return;
|
7819 | }
|
7820 |
|
7821 | didWarnInvalidHydration = true;
|
7822 | warningWithoutStack$1(false, 'Prop `%s` did not match. Server: %s Client: %s', propName, JSON.stringify(normalizedServerValue), JSON.stringify(normalizedClientValue));
|
7823 | };
|
7824 |
|
7825 | warnForExtraAttributes = function (attributeNames) {
|
7826 | if (didWarnInvalidHydration) {
|
7827 | return;
|
7828 | }
|
7829 |
|
7830 | didWarnInvalidHydration = true;
|
7831 | var names = [];
|
7832 | attributeNames.forEach(function (name) {
|
7833 | names.push(name);
|
7834 | });
|
7835 | warningWithoutStack$1(false, 'Extra attributes from the server: %s', names);
|
7836 | };
|
7837 |
|
7838 | warnForInvalidEventListener = function (registrationName, listener) {
|
7839 | if (listener === false) {
|
7840 | warning$1(false, 'Expected `%s` listener to be a function, instead got `false`.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', registrationName, registrationName, registrationName);
|
7841 | } else {
|
7842 | warning$1(false, 'Expected `%s` listener to be a function, instead got a value of `%s` type.', registrationName, typeof listener);
|
7843 | }
|
7844 | };
|
7845 |
|
7846 |
|
7847 |
|
7848 | normalizeHTML = function (parent, html) {
|
7849 |
|
7850 |
|
7851 |
|
7852 |
|
7853 | var testElement = parent.namespaceURI === HTML_NAMESPACE ? parent.ownerDocument.createElement(parent.tagName) : parent.ownerDocument.createElementNS(parent.namespaceURI, parent.tagName);
|
7854 | testElement.innerHTML = html;
|
7855 | return testElement.innerHTML;
|
7856 | };
|
7857 | }
|
7858 |
|
7859 | function ensureListeningTo(rootContainerElement, registrationName) {
|
7860 | var isDocumentOrFragment = rootContainerElement.nodeType === DOCUMENT_NODE || rootContainerElement.nodeType === DOCUMENT_FRAGMENT_NODE;
|
7861 | var doc = isDocumentOrFragment ? rootContainerElement : rootContainerElement.ownerDocument;
|
7862 | listenTo(registrationName, doc);
|
7863 | }
|
7864 |
|
7865 | function getOwnerDocumentFromRootContainer(rootContainerElement) {
|
7866 | return rootContainerElement.nodeType === DOCUMENT_NODE ? rootContainerElement : rootContainerElement.ownerDocument;
|
7867 | }
|
7868 |
|
7869 | function noop() {}
|
7870 |
|
7871 | function trapClickOnNonInteractiveElement(node) {
|
7872 |
|
7873 |
|
7874 |
|
7875 |
|
7876 |
|
7877 |
|
7878 |
|
7879 |
|
7880 |
|
7881 | node.onclick = noop;
|
7882 | }
|
7883 |
|
7884 | function setInitialDOMProperties(tag, domElement, rootContainerElement, nextProps, isCustomComponentTag) {
|
7885 | for (var propKey in nextProps) {
|
7886 | if (!nextProps.hasOwnProperty(propKey)) {
|
7887 | continue;
|
7888 | }
|
7889 |
|
7890 | var nextProp = nextProps[propKey];
|
7891 |
|
7892 | if (propKey === STYLE$1) {
|
7893 | {
|
7894 | if (nextProp) {
|
7895 |
|
7896 |
|
7897 | Object.freeze(nextProp);
|
7898 | }
|
7899 | }
|
7900 |
|
7901 |
|
7902 | setValueForStyles(domElement, nextProp);
|
7903 | } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
|
7904 | var nextHtml = nextProp ? nextProp[HTML] : undefined;
|
7905 |
|
7906 | if (nextHtml != null) {
|
7907 | setInnerHTML(domElement, nextHtml);
|
7908 | }
|
7909 | } else if (propKey === CHILDREN) {
|
7910 | if (typeof nextProp === 'string') {
|
7911 |
|
7912 |
|
7913 |
|
7914 |
|
7915 | var canSetTextContent = tag !== 'textarea' || nextProp !== '';
|
7916 |
|
7917 | if (canSetTextContent) {
|
7918 | setTextContent(domElement, nextProp);
|
7919 | }
|
7920 | } else if (typeof nextProp === 'number') {
|
7921 | setTextContent(domElement, '' + nextProp);
|
7922 | }
|
7923 | } else if (enableFlareAPI && propKey === LISTENERS || propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
|
7924 | } else if (propKey === AUTOFOCUS) {
|
7925 |
|
7926 |
|
7927 |
|
7928 | } else if (registrationNameModules.hasOwnProperty(propKey)) {
|
7929 | if (nextProp != null) {
|
7930 | if (true && typeof nextProp !== 'function') {
|
7931 | warnForInvalidEventListener(propKey, nextProp);
|
7932 | }
|
7933 |
|
7934 | ensureListeningTo(rootContainerElement, propKey);
|
7935 | }
|
7936 | } else if (nextProp != null) {
|
7937 | setValueForProperty(domElement, propKey, nextProp, isCustomComponentTag);
|
7938 | }
|
7939 | }
|
7940 | }
|
7941 |
|
7942 | function updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag) {
|
7943 |
|
7944 | for (var i = 0; i < updatePayload.length; i += 2) {
|
7945 | var propKey = updatePayload[i];
|
7946 | var propValue = updatePayload[i + 1];
|
7947 |
|
7948 | if (propKey === STYLE$1) {
|
7949 | setValueForStyles(domElement, propValue);
|
7950 | } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
|
7951 | setInnerHTML(domElement, propValue);
|
7952 | } else if (propKey === CHILDREN) {
|
7953 | setTextContent(domElement, propValue);
|
7954 | } else {
|
7955 | setValueForProperty(domElement, propKey, propValue, isCustomComponentTag);
|
7956 | }
|
7957 | }
|
7958 | }
|
7959 |
|
7960 | function createElement(type, props, rootContainerElement, parentNamespace) {
|
7961 | var isCustomComponentTag;
|
7962 |
|
7963 |
|
7964 | var ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement);
|
7965 | var domElement;
|
7966 | var namespaceURI = parentNamespace;
|
7967 |
|
7968 | if (namespaceURI === HTML_NAMESPACE) {
|
7969 | namespaceURI = getIntrinsicNamespace(type);
|
7970 | }
|
7971 |
|
7972 | if (namespaceURI === HTML_NAMESPACE) {
|
7973 | {
|
7974 | isCustomComponentTag = isCustomComponent(type, props);
|
7975 |
|
7976 |
|
7977 | !(isCustomComponentTag || type === type.toLowerCase()) ? warning$1(false, '<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', type) : void 0;
|
7978 | }
|
7979 |
|
7980 | if (type === 'script') {
|
7981 |
|
7982 |
|
7983 | var div = ownerDocument.createElement('div');
|
7984 |
|
7985 | {
|
7986 | if (enableTrustedTypesIntegration && !didWarnScriptTags) {
|
7987 | warning$1(false, 'Encountered a script tag while rendering React component. ' + 'Scripts inside React components are never executed when rendering ' + 'on the client. Consider using template tag instead ' + '(https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template).');
|
7988 | didWarnScriptTags = true;
|
7989 | }
|
7990 | }
|
7991 |
|
7992 | div.innerHTML = '<script><' + '/script>';
|
7993 |
|
7994 |
|
7995 | var firstChild = div.firstChild;
|
7996 | domElement = div.removeChild(firstChild);
|
7997 | } else if (typeof props.is === 'string') {
|
7998 |
|
7999 | domElement = ownerDocument.createElement(type, {
|
8000 | is: props.is
|
8001 | });
|
8002 | } else {
|
8003 |
|
8004 |
|
8005 |
|
8006 | domElement = ownerDocument.createElement(type);
|
8007 |
|
8008 |
|
8009 |
|
8010 |
|
8011 |
|
8012 |
|
8013 |
|
8014 |
|
8015 | if (type === 'select') {
|
8016 | var node = domElement;
|
8017 |
|
8018 | if (props.multiple) {
|
8019 | node.multiple = true;
|
8020 | } else if (props.size) {
|
8021 |
|
8022 |
|
8023 |
|
8024 |
|
8025 | node.size = props.size;
|
8026 | }
|
8027 | }
|
8028 | }
|
8029 | } else {
|
8030 | domElement = ownerDocument.createElementNS(namespaceURI, type);
|
8031 | }
|
8032 |
|
8033 | {
|
8034 | if (namespaceURI === HTML_NAMESPACE) {
|
8035 | if (!isCustomComponentTag && Object.prototype.toString.call(domElement) === '[object HTMLUnknownElement]' && !Object.prototype.hasOwnProperty.call(warnedUnknownTags, type)) {
|
8036 | warnedUnknownTags[type] = true;
|
8037 | warning$1(false, 'The tag <%s> is unrecognized in this browser. ' + 'If you meant to render a React component, start its name with ' + 'an uppercase letter.', type);
|
8038 | }
|
8039 | }
|
8040 | }
|
8041 |
|
8042 | return domElement;
|
8043 | }
|
8044 | function createTextNode(text, rootContainerElement) {
|
8045 | return getOwnerDocumentFromRootContainer(rootContainerElement).createTextNode(text);
|
8046 | }
|
8047 | function setInitialProperties(domElement, tag, rawProps, rootContainerElement) {
|
8048 | var isCustomComponentTag = isCustomComponent(tag, rawProps);
|
8049 |
|
8050 | {
|
8051 | validatePropertiesInDevelopment(tag, rawProps);
|
8052 |
|
8053 | if (isCustomComponentTag && !didWarnShadyDOM && domElement.shadyRoot) {
|
8054 | warning$1(false, '%s is using shady DOM. Using shady DOM with React can ' + 'cause things to break subtly.', getCurrentFiberOwnerNameInDevOrNull() || 'A component');
|
8055 | didWarnShadyDOM = true;
|
8056 | }
|
8057 | }
|
8058 |
|
8059 |
|
8060 | var props;
|
8061 |
|
8062 | switch (tag) {
|
8063 | case 'iframe':
|
8064 | case 'object':
|
8065 | case 'embed':
|
8066 | trapBubbledEvent(TOP_LOAD, domElement);
|
8067 | props = rawProps;
|
8068 | break;
|
8069 |
|
8070 | case 'video':
|
8071 | case 'audio':
|
8072 |
|
8073 | for (var i = 0; i < mediaEventTypes.length; i++) {
|
8074 | trapBubbledEvent(mediaEventTypes[i], domElement);
|
8075 | }
|
8076 |
|
8077 | props = rawProps;
|
8078 | break;
|
8079 |
|
8080 | case 'source':
|
8081 | trapBubbledEvent(TOP_ERROR, domElement);
|
8082 | props = rawProps;
|
8083 | break;
|
8084 |
|
8085 | case 'img':
|
8086 | case 'image':
|
8087 | case 'link':
|
8088 | trapBubbledEvent(TOP_ERROR, domElement);
|
8089 | trapBubbledEvent(TOP_LOAD, domElement);
|
8090 | props = rawProps;
|
8091 | break;
|
8092 |
|
8093 | case 'form':
|
8094 | trapBubbledEvent(TOP_RESET, domElement);
|
8095 | trapBubbledEvent(TOP_SUBMIT, domElement);
|
8096 | props = rawProps;
|
8097 | break;
|
8098 |
|
8099 | case 'details':
|
8100 | trapBubbledEvent(TOP_TOGGLE, domElement);
|
8101 | props = rawProps;
|
8102 | break;
|
8103 |
|
8104 | case 'input':
|
8105 | initWrapperState(domElement, rawProps);
|
8106 | props = getHostProps(domElement, rawProps);
|
8107 | trapBubbledEvent(TOP_INVALID, domElement);
|
8108 |
|
8109 |
|
8110 | ensureListeningTo(rootContainerElement, 'onChange');
|
8111 | break;
|
8112 |
|
8113 | case 'option':
|
8114 | validateProps(domElement, rawProps);
|
8115 | props = getHostProps$1(domElement, rawProps);
|
8116 | break;
|
8117 |
|
8118 | case 'select':
|
8119 | initWrapperState$1(domElement, rawProps);
|
8120 | props = getHostProps$2(domElement, rawProps);
|
8121 | trapBubbledEvent(TOP_INVALID, domElement);
|
8122 |
|
8123 |
|
8124 | ensureListeningTo(rootContainerElement, 'onChange');
|
8125 | break;
|
8126 |
|
8127 | case 'textarea':
|
8128 | initWrapperState$2(domElement, rawProps);
|
8129 | props = getHostProps$3(domElement, rawProps);
|
8130 | trapBubbledEvent(TOP_INVALID, domElement);
|
8131 |
|
8132 |
|
8133 | ensureListeningTo(rootContainerElement, 'onChange');
|
8134 | break;
|
8135 |
|
8136 | default:
|
8137 | props = rawProps;
|
8138 | }
|
8139 |
|
8140 | assertValidProps(tag, props);
|
8141 | setInitialDOMProperties(tag, domElement, rootContainerElement, props, isCustomComponentTag);
|
8142 |
|
8143 | switch (tag) {
|
8144 | case 'input':
|
8145 |
|
8146 |
|
8147 | track(domElement);
|
8148 | postMountWrapper(domElement, rawProps, false);
|
8149 | break;
|
8150 |
|
8151 | case 'textarea':
|
8152 |
|
8153 |
|
8154 | track(domElement);
|
8155 | postMountWrapper$3(domElement, rawProps);
|
8156 | break;
|
8157 |
|
8158 | case 'option':
|
8159 | postMountWrapper$1(domElement, rawProps);
|
8160 | break;
|
8161 |
|
8162 | case 'select':
|
8163 | postMountWrapper$2(domElement, rawProps);
|
8164 | break;
|
8165 |
|
8166 | default:
|
8167 | if (typeof props.onClick === 'function') {
|
8168 |
|
8169 | trapClickOnNonInteractiveElement(domElement);
|
8170 | }
|
8171 |
|
8172 | break;
|
8173 | }
|
8174 | }
|
8175 |
|
8176 | function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContainerElement) {
|
8177 | {
|
8178 | validatePropertiesInDevelopment(tag, nextRawProps);
|
8179 | }
|
8180 |
|
8181 | var updatePayload = null;
|
8182 | var lastProps;
|
8183 | var nextProps;
|
8184 |
|
8185 | switch (tag) {
|
8186 | case 'input':
|
8187 | lastProps = getHostProps(domElement, lastRawProps);
|
8188 | nextProps = getHostProps(domElement, nextRawProps);
|
8189 | updatePayload = [];
|
8190 | break;
|
8191 |
|
8192 | case 'option':
|
8193 | lastProps = getHostProps$1(domElement, lastRawProps);
|
8194 | nextProps = getHostProps$1(domElement, nextRawProps);
|
8195 | updatePayload = [];
|
8196 | break;
|
8197 |
|
8198 | case 'select':
|
8199 | lastProps = getHostProps$2(domElement, lastRawProps);
|
8200 | nextProps = getHostProps$2(domElement, nextRawProps);
|
8201 | updatePayload = [];
|
8202 | break;
|
8203 |
|
8204 | case 'textarea':
|
8205 | lastProps = getHostProps$3(domElement, lastRawProps);
|
8206 | nextProps = getHostProps$3(domElement, nextRawProps);
|
8207 | updatePayload = [];
|
8208 | break;
|
8209 |
|
8210 | default:
|
8211 | lastProps = lastRawProps;
|
8212 | nextProps = nextRawProps;
|
8213 |
|
8214 | if (typeof lastProps.onClick !== 'function' && typeof nextProps.onClick === 'function') {
|
8215 |
|
8216 | trapClickOnNonInteractiveElement(domElement);
|
8217 | }
|
8218 |
|
8219 | break;
|
8220 | }
|
8221 |
|
8222 | assertValidProps(tag, nextProps);
|
8223 | var propKey;
|
8224 | var styleName;
|
8225 | var styleUpdates = null;
|
8226 |
|
8227 | for (propKey in lastProps) {
|
8228 | if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
|
8229 | continue;
|
8230 | }
|
8231 |
|
8232 | if (propKey === STYLE$1) {
|
8233 | var lastStyle = lastProps[propKey];
|
8234 |
|
8235 | for (styleName in lastStyle) {
|
8236 | if (lastStyle.hasOwnProperty(styleName)) {
|
8237 | if (!styleUpdates) {
|
8238 | styleUpdates = {};
|
8239 | }
|
8240 |
|
8241 | styleUpdates[styleName] = '';
|
8242 | }
|
8243 | }
|
8244 | } else if (propKey === DANGEROUSLY_SET_INNER_HTML || propKey === CHILDREN) {
|
8245 | } else if (enableFlareAPI && propKey === LISTENERS || propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
|
8246 | } else if (propKey === AUTOFOCUS) {
|
8247 | } else if (registrationNameModules.hasOwnProperty(propKey)) {
|
8248 |
|
8249 |
|
8250 |
|
8251 | if (!updatePayload) {
|
8252 | updatePayload = [];
|
8253 | }
|
8254 | } else {
|
8255 |
|
8256 |
|
8257 | (updatePayload = updatePayload || []).push(propKey, null);
|
8258 | }
|
8259 | }
|
8260 |
|
8261 | for (propKey in nextProps) {
|
8262 | var nextProp = nextProps[propKey];
|
8263 | var lastProp = lastProps != null ? lastProps[propKey] : undefined;
|
8264 |
|
8265 | if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
|
8266 | continue;
|
8267 | }
|
8268 |
|
8269 | if (propKey === STYLE$1) {
|
8270 | {
|
8271 | if (nextProp) {
|
8272 |
|
8273 |
|
8274 | Object.freeze(nextProp);
|
8275 | }
|
8276 | }
|
8277 |
|
8278 | if (lastProp) {
|
8279 |
|
8280 | for (styleName in lastProp) {
|
8281 | if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
|
8282 | if (!styleUpdates) {
|
8283 | styleUpdates = {};
|
8284 | }
|
8285 |
|
8286 | styleUpdates[styleName] = '';
|
8287 | }
|
8288 | }
|
8289 |
|
8290 |
|
8291 | for (styleName in nextProp) {
|
8292 | if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
|
8293 | if (!styleUpdates) {
|
8294 | styleUpdates = {};
|
8295 | }
|
8296 |
|
8297 | styleUpdates[styleName] = nextProp[styleName];
|
8298 | }
|
8299 | }
|
8300 | } else {
|
8301 |
|
8302 | if (!styleUpdates) {
|
8303 | if (!updatePayload) {
|
8304 | updatePayload = [];
|
8305 | }
|
8306 |
|
8307 | updatePayload.push(propKey, styleUpdates);
|
8308 | }
|
8309 |
|
8310 | styleUpdates = nextProp;
|
8311 | }
|
8312 | } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
|
8313 | var nextHtml = nextProp ? nextProp[HTML] : undefined;
|
8314 | var lastHtml = lastProp ? lastProp[HTML] : undefined;
|
8315 |
|
8316 | if (nextHtml != null) {
|
8317 | if (lastHtml !== nextHtml) {
|
8318 | (updatePayload = updatePayload || []).push(propKey, toStringOrTrustedType(nextHtml));
|
8319 | }
|
8320 | } else {
|
8321 |
|
8322 | }
|
8323 | } else if (propKey === CHILDREN) {
|
8324 | if (lastProp !== nextProp && (typeof nextProp === 'string' || typeof nextProp === 'number')) {
|
8325 | (updatePayload = updatePayload || []).push(propKey, '' + nextProp);
|
8326 | }
|
8327 | } else if (enableFlareAPI && propKey === LISTENERS || propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
|
8328 | } else if (registrationNameModules.hasOwnProperty(propKey)) {
|
8329 | if (nextProp != null) {
|
8330 |
|
8331 | if (true && typeof nextProp !== 'function') {
|
8332 | warnForInvalidEventListener(propKey, nextProp);
|
8333 | }
|
8334 |
|
8335 | ensureListeningTo(rootContainerElement, propKey);
|
8336 | }
|
8337 |
|
8338 | if (!updatePayload && lastProp !== nextProp) {
|
8339 |
|
8340 |
|
8341 |
|
8342 | updatePayload = [];
|
8343 | }
|
8344 | } else {
|
8345 |
|
8346 |
|
8347 | (updatePayload = updatePayload || []).push(propKey, nextProp);
|
8348 | }
|
8349 | }
|
8350 |
|
8351 | if (styleUpdates) {
|
8352 | {
|
8353 | validateShorthandPropertyCollisionInDev(styleUpdates, nextProps[STYLE$1]);
|
8354 | }
|
8355 |
|
8356 | (updatePayload = updatePayload || []).push(STYLE$1, styleUpdates);
|
8357 | }
|
8358 |
|
8359 | return updatePayload;
|
8360 | }
|
8361 |
|
8362 | function updateProperties(domElement, updatePayload, tag, lastRawProps, nextRawProps) {
|
8363 |
|
8364 |
|
8365 |
|
8366 | if (tag === 'input' && nextRawProps.type === 'radio' && nextRawProps.name != null) {
|
8367 | updateChecked(domElement, nextRawProps);
|
8368 | }
|
8369 |
|
8370 | var wasCustomComponentTag = isCustomComponent(tag, lastRawProps);
|
8371 | var isCustomComponentTag = isCustomComponent(tag, nextRawProps);
|
8372 |
|
8373 | updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag);
|
8374 |
|
8375 |
|
8376 | switch (tag) {
|
8377 | case 'input':
|
8378 |
|
8379 |
|
8380 |
|
8381 | updateWrapper(domElement, nextRawProps);
|
8382 | break;
|
8383 |
|
8384 | case 'textarea':
|
8385 | updateWrapper$1(domElement, nextRawProps);
|
8386 | break;
|
8387 |
|
8388 | case 'select':
|
8389 |
|
8390 |
|
8391 | postUpdateWrapper(domElement, nextRawProps);
|
8392 | break;
|
8393 | }
|
8394 | }
|
8395 |
|
8396 | function getPossibleStandardName(propName) {
|
8397 | {
|
8398 | var lowerCasedName = propName.toLowerCase();
|
8399 |
|
8400 | if (!possibleStandardNames.hasOwnProperty(lowerCasedName)) {
|
8401 | return null;
|
8402 | }
|
8403 |
|
8404 | return possibleStandardNames[lowerCasedName] || null;
|
8405 | }
|
8406 |
|
8407 | return null;
|
8408 | }
|
8409 |
|
8410 | function diffHydratedProperties(domElement, tag, rawProps, parentNamespace, rootContainerElement) {
|
8411 | var isCustomComponentTag;
|
8412 | var extraAttributeNames;
|
8413 |
|
8414 | {
|
8415 | suppressHydrationWarning = rawProps[SUPPRESS_HYDRATION_WARNING$1] === true;
|
8416 | isCustomComponentTag = isCustomComponent(tag, rawProps);
|
8417 | validatePropertiesInDevelopment(tag, rawProps);
|
8418 |
|
8419 | if (isCustomComponentTag && !didWarnShadyDOM && domElement.shadyRoot) {
|
8420 | warning$1(false, '%s is using shady DOM. Using shady DOM with React can ' + 'cause things to break subtly.', getCurrentFiberOwnerNameInDevOrNull() || 'A component');
|
8421 | didWarnShadyDOM = true;
|
8422 | }
|
8423 | }
|
8424 |
|
8425 |
|
8426 | switch (tag) {
|
8427 | case 'iframe':
|
8428 | case 'object':
|
8429 | case 'embed':
|
8430 | trapBubbledEvent(TOP_LOAD, domElement);
|
8431 | break;
|
8432 |
|
8433 | case 'video':
|
8434 | case 'audio':
|
8435 |
|
8436 | for (var i = 0; i < mediaEventTypes.length; i++) {
|
8437 | trapBubbledEvent(mediaEventTypes[i], domElement);
|
8438 | }
|
8439 |
|
8440 | break;
|
8441 |
|
8442 | case 'source':
|
8443 | trapBubbledEvent(TOP_ERROR, domElement);
|
8444 | break;
|
8445 |
|
8446 | case 'img':
|
8447 | case 'image':
|
8448 | case 'link':
|
8449 | trapBubbledEvent(TOP_ERROR, domElement);
|
8450 | trapBubbledEvent(TOP_LOAD, domElement);
|
8451 | break;
|
8452 |
|
8453 | case 'form':
|
8454 | trapBubbledEvent(TOP_RESET, domElement);
|
8455 | trapBubbledEvent(TOP_SUBMIT, domElement);
|
8456 | break;
|
8457 |
|
8458 | case 'details':
|
8459 | trapBubbledEvent(TOP_TOGGLE, domElement);
|
8460 | break;
|
8461 |
|
8462 | case 'input':
|
8463 | initWrapperState(domElement, rawProps);
|
8464 | trapBubbledEvent(TOP_INVALID, domElement);
|
8465 |
|
8466 |
|
8467 | ensureListeningTo(rootContainerElement, 'onChange');
|
8468 | break;
|
8469 |
|
8470 | case 'option':
|
8471 | validateProps(domElement, rawProps);
|
8472 | break;
|
8473 |
|
8474 | case 'select':
|
8475 | initWrapperState$1(domElement, rawProps);
|
8476 | trapBubbledEvent(TOP_INVALID, domElement);
|
8477 |
|
8478 |
|
8479 | ensureListeningTo(rootContainerElement, 'onChange');
|
8480 | break;
|
8481 |
|
8482 | case 'textarea':
|
8483 | initWrapperState$2(domElement, rawProps);
|
8484 | trapBubbledEvent(TOP_INVALID, domElement);
|
8485 |
|
8486 |
|
8487 | ensureListeningTo(rootContainerElement, 'onChange');
|
8488 | break;
|
8489 | }
|
8490 |
|
8491 | assertValidProps(tag, rawProps);
|
8492 |
|
8493 | {
|
8494 | extraAttributeNames = new Set();
|
8495 | var attributes = domElement.attributes;
|
8496 |
|
8497 | for (var _i = 0; _i < attributes.length; _i++) {
|
8498 | var name = attributes[_i].name.toLowerCase();
|
8499 |
|
8500 | switch (name) {
|
8501 |
|
8502 | case 'data-reactroot':
|
8503 | break;
|
8504 |
|
8505 |
|
8506 |
|
8507 | case 'value':
|
8508 | break;
|
8509 |
|
8510 | case 'checked':
|
8511 | break;
|
8512 |
|
8513 | case 'selected':
|
8514 | break;
|
8515 |
|
8516 | default:
|
8517 |
|
8518 |
|
8519 | extraAttributeNames.add(attributes[_i].name);
|
8520 | }
|
8521 | }
|
8522 | }
|
8523 |
|
8524 | var updatePayload = null;
|
8525 |
|
8526 | for (var propKey in rawProps) {
|
8527 | if (!rawProps.hasOwnProperty(propKey)) {
|
8528 | continue;
|
8529 | }
|
8530 |
|
8531 | var nextProp = rawProps[propKey];
|
8532 |
|
8533 | if (propKey === CHILDREN) {
|
8534 |
|
8535 |
|
8536 |
|
8537 |
|
8538 |
|
8539 |
|
8540 |
|
8541 |
|
8542 |
|
8543 | if (typeof nextProp === 'string') {
|
8544 | if (domElement.textContent !== nextProp) {
|
8545 | if (true && !suppressHydrationWarning) {
|
8546 | warnForTextDifference(domElement.textContent, nextProp);
|
8547 | }
|
8548 |
|
8549 | updatePayload = [CHILDREN, nextProp];
|
8550 | }
|
8551 | } else if (typeof nextProp === 'number') {
|
8552 | if (domElement.textContent !== '' + nextProp) {
|
8553 | if (true && !suppressHydrationWarning) {
|
8554 | warnForTextDifference(domElement.textContent, nextProp);
|
8555 | }
|
8556 |
|
8557 | updatePayload = [CHILDREN, '' + nextProp];
|
8558 | }
|
8559 | }
|
8560 | } else if (registrationNameModules.hasOwnProperty(propKey)) {
|
8561 | if (nextProp != null) {
|
8562 | if (true && typeof nextProp !== 'function') {
|
8563 | warnForInvalidEventListener(propKey, nextProp);
|
8564 | }
|
8565 |
|
8566 | ensureListeningTo(rootContainerElement, propKey);
|
8567 | }
|
8568 | } else if (true &&
|
8569 | typeof isCustomComponentTag === 'boolean') {
|
8570 |
|
8571 | var serverValue = void 0;
|
8572 | var propertyInfo = getPropertyInfo(propKey);
|
8573 |
|
8574 | if (suppressHydrationWarning) {
|
8575 | } else if (enableFlareAPI && propKey === LISTENERS || propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1 ||
|
8576 |
|
8577 | propKey === 'value' || propKey === 'checked' || propKey === 'selected') {
|
8578 | } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
|
8579 | var serverHTML = domElement.innerHTML;
|
8580 | var nextHtml = nextProp ? nextProp[HTML] : undefined;
|
8581 | var expectedHTML = normalizeHTML(domElement, nextHtml != null ? nextHtml : '');
|
8582 |
|
8583 | if (expectedHTML !== serverHTML) {
|
8584 | warnForPropDifference(propKey, serverHTML, expectedHTML);
|
8585 | }
|
8586 | } else if (propKey === STYLE$1) {
|
8587 |
|
8588 | extraAttributeNames.delete(propKey);
|
8589 |
|
8590 | if (canDiffStyleForHydrationWarning) {
|
8591 | var expectedStyle = createDangerousStringForStyles(nextProp);
|
8592 | serverValue = domElement.getAttribute('style');
|
8593 |
|
8594 | if (expectedStyle !== serverValue) {
|
8595 | warnForPropDifference(propKey, serverValue, expectedStyle);
|
8596 | }
|
8597 | }
|
8598 | } else if (isCustomComponentTag) {
|
8599 |
|
8600 | extraAttributeNames.delete(propKey.toLowerCase());
|
8601 | serverValue = getValueForAttribute(domElement, propKey, nextProp);
|
8602 |
|
8603 | if (nextProp !== serverValue) {
|
8604 | warnForPropDifference(propKey, serverValue, nextProp);
|
8605 | }
|
8606 | } else if (!shouldIgnoreAttribute(propKey, propertyInfo, isCustomComponentTag) && !shouldRemoveAttribute(propKey, nextProp, propertyInfo, isCustomComponentTag)) {
|
8607 | var isMismatchDueToBadCasing = false;
|
8608 |
|
8609 | if (propertyInfo !== null) {
|
8610 |
|
8611 | extraAttributeNames.delete(propertyInfo.attributeName);
|
8612 | serverValue = getValueForProperty(domElement, propKey, nextProp, propertyInfo);
|
8613 | } else {
|
8614 | var ownNamespace = parentNamespace;
|
8615 |
|
8616 | if (ownNamespace === HTML_NAMESPACE) {
|
8617 | ownNamespace = getIntrinsicNamespace(tag);
|
8618 | }
|
8619 |
|
8620 | if (ownNamespace === HTML_NAMESPACE) {
|
8621 |
|
8622 | extraAttributeNames.delete(propKey.toLowerCase());
|
8623 | } else {
|
8624 | var standardName = getPossibleStandardName(propKey);
|
8625 |
|
8626 | if (standardName !== null && standardName !== propKey) {
|
8627 |
|
8628 |
|
8629 |
|
8630 |
|
8631 |
|
8632 | isMismatchDueToBadCasing = true;
|
8633 |
|
8634 | extraAttributeNames.delete(standardName);
|
8635 | }
|
8636 |
|
8637 |
|
8638 | extraAttributeNames.delete(propKey);
|
8639 | }
|
8640 |
|
8641 | serverValue = getValueForAttribute(domElement, propKey, nextProp);
|
8642 | }
|
8643 |
|
8644 | if (nextProp !== serverValue && !isMismatchDueToBadCasing) {
|
8645 | warnForPropDifference(propKey, serverValue, nextProp);
|
8646 | }
|
8647 | }
|
8648 | }
|
8649 | }
|
8650 |
|
8651 | {
|
8652 |
|
8653 | if (extraAttributeNames.size > 0 && !suppressHydrationWarning) {
|
8654 |
|
8655 | warnForExtraAttributes(extraAttributeNames);
|
8656 | }
|
8657 | }
|
8658 |
|
8659 | switch (tag) {
|
8660 | case 'input':
|
8661 |
|
8662 |
|
8663 | track(domElement);
|
8664 | postMountWrapper(domElement, rawProps, true);
|
8665 | break;
|
8666 |
|
8667 | case 'textarea':
|
8668 |
|
8669 |
|
8670 | track(domElement);
|
8671 | postMountWrapper$3(domElement, rawProps);
|
8672 | break;
|
8673 |
|
8674 | case 'select':
|
8675 | case 'option':
|
8676 |
|
8677 |
|
8678 |
|
8679 |
|
8680 |
|
8681 | break;
|
8682 |
|
8683 | default:
|
8684 | if (typeof rawProps.onClick === 'function') {
|
8685 |
|
8686 | trapClickOnNonInteractiveElement(domElement);
|
8687 | }
|
8688 |
|
8689 | break;
|
8690 | }
|
8691 |
|
8692 | return updatePayload;
|
8693 | }
|
8694 | function diffHydratedText(textNode, text) {
|
8695 | var isDifferent = textNode.nodeValue !== text;
|
8696 | return isDifferent;
|
8697 | }
|
8698 | function warnForUnmatchedText(textNode, text) {
|
8699 | {
|
8700 | warnForTextDifference(textNode.nodeValue, text);
|
8701 | }
|
8702 | }
|
8703 | function warnForDeletedHydratableElement(parentNode, child) {
|
8704 | {
|
8705 | if (didWarnInvalidHydration) {
|
8706 | return;
|
8707 | }
|
8708 |
|
8709 | didWarnInvalidHydration = true;
|
8710 | warningWithoutStack$1(false, 'Did not expect server HTML to contain a <%s> in <%s>.', child.nodeName.toLowerCase(), parentNode.nodeName.toLowerCase());
|
8711 | }
|
8712 | }
|
8713 | function warnForDeletedHydratableText(parentNode, child) {
|
8714 | {
|
8715 | if (didWarnInvalidHydration) {
|
8716 | return;
|
8717 | }
|
8718 |
|
8719 | didWarnInvalidHydration = true;
|
8720 | warningWithoutStack$1(false, 'Did not expect server HTML to contain the text node "%s" in <%s>.', child.nodeValue, parentNode.nodeName.toLowerCase());
|
8721 | }
|
8722 | }
|
8723 | function warnForInsertedHydratedElement(parentNode, tag, props) {
|
8724 | {
|
8725 | if (didWarnInvalidHydration) {
|
8726 | return;
|
8727 | }
|
8728 |
|
8729 | didWarnInvalidHydration = true;
|
8730 | warningWithoutStack$1(false, 'Expected server HTML to contain a matching <%s> in <%s>.', tag, parentNode.nodeName.toLowerCase());
|
8731 | }
|
8732 | }
|
8733 | function warnForInsertedHydratedText(parentNode, text) {
|
8734 | {
|
8735 | if (text === '') {
|
8736 |
|
8737 |
|
8738 |
|
8739 |
|
8740 | return;
|
8741 | }
|
8742 |
|
8743 | if (didWarnInvalidHydration) {
|
8744 | return;
|
8745 | }
|
8746 |
|
8747 | didWarnInvalidHydration = true;
|
8748 | warningWithoutStack$1(false, 'Expected server HTML to contain a matching text node for "%s" in <%s>.', text, parentNode.nodeName.toLowerCase());
|
8749 | }
|
8750 | }
|
8751 | function restoreControlledState$$1(domElement, tag, props) {
|
8752 | switch (tag) {
|
8753 | case 'input':
|
8754 | restoreControlledState$1(domElement, props);
|
8755 | return;
|
8756 |
|
8757 | case 'textarea':
|
8758 | restoreControlledState$3(domElement, props);
|
8759 | return;
|
8760 |
|
8761 | case 'select':
|
8762 | restoreControlledState$2(domElement, props);
|
8763 | return;
|
8764 | }
|
8765 | }
|
8766 | function listenToEventResponderEventTypes(eventTypes, element) {
|
8767 | if (enableFlareAPI) {
|
8768 |
|
8769 |
|
8770 | var listeningSet = getListeningSetForElement(element);
|
8771 |
|
8772 | for (var i = 0, length = eventTypes.length; i < length; ++i) {
|
8773 | var eventType = eventTypes[i];
|
8774 | var isPassive = !endsWith(eventType, '_active');
|
8775 | var eventKey = isPassive ? eventType + '_passive' : eventType;
|
8776 | var targetEventType = isPassive ? eventType : eventType.substring(0, eventType.length - 7);
|
8777 |
|
8778 | if (!listeningSet.has(eventKey)) {
|
8779 | trapEventForResponderEventSystem(element, targetEventType, isPassive);
|
8780 | listeningSet.add(eventKey);
|
8781 | }
|
8782 | }
|
8783 | }
|
8784 | }
|
8785 |
|
8786 | if (enableFlareAPI) {
|
8787 | setListenToResponderEventTypes(listenToEventResponderEventTypes);
|
8788 | }
|
8789 |
|
8790 | function getActiveElement(doc) {
|
8791 | doc = doc || (typeof document !== 'undefined' ? document : undefined);
|
8792 |
|
8793 | if (typeof doc === 'undefined') {
|
8794 | return null;
|
8795 | }
|
8796 |
|
8797 | try {
|
8798 | return doc.activeElement || doc.body;
|
8799 | } catch (e) {
|
8800 | return doc.body;
|
8801 | }
|
8802 | }
|
8803 |
|
8804 |
|
8805 |
|
8806 |
|
8807 |
|
8808 |
|
8809 |
|
8810 |
|
8811 | function getLeafNode(node) {
|
8812 | while (node && node.firstChild) {
|
8813 | node = node.firstChild;
|
8814 | }
|
8815 |
|
8816 | return node;
|
8817 | }
|
8818 |
|
8819 |
|
8820 |
|
8821 |
|
8822 |
|
8823 |
|
8824 |
|
8825 |
|
8826 |
|
8827 | function getSiblingNode(node) {
|
8828 | while (node) {
|
8829 | if (node.nextSibling) {
|
8830 | return node.nextSibling;
|
8831 | }
|
8832 |
|
8833 | node = node.parentNode;
|
8834 | }
|
8835 | }
|
8836 |
|
8837 |
|
8838 |
|
8839 |
|
8840 |
|
8841 |
|
8842 |
|
8843 |
|
8844 |
|
8845 | function getNodeForCharacterOffset(root, offset) {
|
8846 | var node = getLeafNode(root);
|
8847 | var nodeStart = 0;
|
8848 | var nodeEnd = 0;
|
8849 |
|
8850 | while (node) {
|
8851 | if (node.nodeType === TEXT_NODE) {
|
8852 | nodeEnd = nodeStart + node.textContent.length;
|
8853 |
|
8854 | if (nodeStart <= offset && nodeEnd >= offset) {
|
8855 | return {
|
8856 | node: node,
|
8857 | offset: offset - nodeStart
|
8858 | };
|
8859 | }
|
8860 |
|
8861 | nodeStart = nodeEnd;
|
8862 | }
|
8863 |
|
8864 | node = getLeafNode(getSiblingNode(node));
|
8865 | }
|
8866 | }
|
8867 |
|
8868 |
|
8869 |
|
8870 |
|
8871 |
|
8872 |
|
8873 | function getOffsets(outerNode) {
|
8874 | var ownerDocument = outerNode.ownerDocument;
|
8875 | var win = ownerDocument && ownerDocument.defaultView || window;
|
8876 | var selection = win.getSelection && win.getSelection();
|
8877 |
|
8878 | if (!selection || selection.rangeCount === 0) {
|
8879 | return null;
|
8880 | }
|
8881 |
|
8882 | var anchorNode = selection.anchorNode,
|
8883 | anchorOffset = selection.anchorOffset,
|
8884 | focusNode = selection.focusNode,
|
8885 | focusOffset = selection.focusOffset;
|
8886 |
|
8887 |
|
8888 |
|
8889 |
|
8890 |
|
8891 |
|
8892 |
|
8893 | try {
|
8894 |
|
8895 | anchorNode.nodeType;
|
8896 | focusNode.nodeType;
|
8897 |
|
8898 | } catch (e) {
|
8899 | return null;
|
8900 | }
|
8901 |
|
8902 | return getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset);
|
8903 | }
|
8904 |
|
8905 |
|
8906 |
|
8907 |
|
8908 |
|
8909 |
|
8910 |
|
8911 |
|
8912 |
|
8913 |
|
8914 | function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset) {
|
8915 | var length = 0;
|
8916 | var start = -1;
|
8917 | var end = -1;
|
8918 | var indexWithinAnchor = 0;
|
8919 | var indexWithinFocus = 0;
|
8920 | var node = outerNode;
|
8921 | var parentNode = null;
|
8922 |
|
8923 | outer: while (true) {
|
8924 | var next = null;
|
8925 |
|
8926 | while (true) {
|
8927 | if (node === anchorNode && (anchorOffset === 0 || node.nodeType === TEXT_NODE)) {
|
8928 | start = length + anchorOffset;
|
8929 | }
|
8930 |
|
8931 | if (node === focusNode && (focusOffset === 0 || node.nodeType === TEXT_NODE)) {
|
8932 | end = length + focusOffset;
|
8933 | }
|
8934 |
|
8935 | if (node.nodeType === TEXT_NODE) {
|
8936 | length += node.nodeValue.length;
|
8937 | }
|
8938 |
|
8939 | if ((next = node.firstChild) === null) {
|
8940 | break;
|
8941 | }
|
8942 |
|
8943 |
|
8944 | parentNode = node;
|
8945 | node = next;
|
8946 | }
|
8947 |
|
8948 | while (true) {
|
8949 | if (node === outerNode) {
|
8950 |
|
8951 |
|
8952 |
|
8953 |
|
8954 | break outer;
|
8955 | }
|
8956 |
|
8957 | if (parentNode === anchorNode && ++indexWithinAnchor === anchorOffset) {
|
8958 | start = length;
|
8959 | }
|
8960 |
|
8961 | if (parentNode === focusNode && ++indexWithinFocus === focusOffset) {
|
8962 | end = length;
|
8963 | }
|
8964 |
|
8965 | if ((next = node.nextSibling) !== null) {
|
8966 | break;
|
8967 | }
|
8968 |
|
8969 | node = parentNode;
|
8970 | parentNode = node.parentNode;
|
8971 | }
|
8972 |
|
8973 |
|
8974 | node = next;
|
8975 | }
|
8976 |
|
8977 | if (start === -1 || end === -1) {
|
8978 |
|
8979 |
|
8980 | return null;
|
8981 | }
|
8982 |
|
8983 | return {
|
8984 | start: start,
|
8985 | end: end
|
8986 | };
|
8987 | }
|
8988 |
|
8989 |
|
8990 |
|
8991 |
|
8992 |
|
8993 |
|
8994 |
|
8995 |
|
8996 |
|
8997 |
|
8998 |
|
8999 |
|
9000 |
|
9001 | function setOffsets(node, offsets) {
|
9002 | var doc = node.ownerDocument || document;
|
9003 | var win = doc && doc.defaultView || window;
|
9004 |
|
9005 |
|
9006 |
|
9007 | if (!win.getSelection) {
|
9008 | return;
|
9009 | }
|
9010 |
|
9011 | var selection = win.getSelection();
|
9012 | var length = node.textContent.length;
|
9013 | var start = Math.min(offsets.start, length);
|
9014 | var end = offsets.end === undefined ? start : Math.min(offsets.end, length);
|
9015 |
|
9016 |
|
9017 | if (!selection.extend && start > end) {
|
9018 | var temp = end;
|
9019 | end = start;
|
9020 | start = temp;
|
9021 | }
|
9022 |
|
9023 | var startMarker = getNodeForCharacterOffset(node, start);
|
9024 | var endMarker = getNodeForCharacterOffset(node, end);
|
9025 |
|
9026 | if (startMarker && endMarker) {
|
9027 | if (selection.rangeCount === 1 && selection.anchorNode === startMarker.node && selection.anchorOffset === startMarker.offset && selection.focusNode === endMarker.node && selection.focusOffset === endMarker.offset) {
|
9028 | return;
|
9029 | }
|
9030 |
|
9031 | var range = doc.createRange();
|
9032 | range.setStart(startMarker.node, startMarker.offset);
|
9033 | selection.removeAllRanges();
|
9034 |
|
9035 | if (start > end) {
|
9036 | selection.addRange(range);
|
9037 | selection.extend(endMarker.node, endMarker.offset);
|
9038 | } else {
|
9039 | range.setEnd(endMarker.node, endMarker.offset);
|
9040 | selection.addRange(range);
|
9041 | }
|
9042 | }
|
9043 | }
|
9044 |
|
9045 | function isTextNode(node) {
|
9046 | return node && node.nodeType === TEXT_NODE;
|
9047 | }
|
9048 |
|
9049 | function containsNode(outerNode, innerNode) {
|
9050 | if (!outerNode || !innerNode) {
|
9051 | return false;
|
9052 | } else if (outerNode === innerNode) {
|
9053 | return true;
|
9054 | } else if (isTextNode(outerNode)) {
|
9055 | return false;
|
9056 | } else if (isTextNode(innerNode)) {
|
9057 | return containsNode(outerNode, innerNode.parentNode);
|
9058 | } else if ('contains' in outerNode) {
|
9059 | return outerNode.contains(innerNode);
|
9060 | } else if (outerNode.compareDocumentPosition) {
|
9061 | return !!(outerNode.compareDocumentPosition(innerNode) & 16);
|
9062 | } else {
|
9063 | return false;
|
9064 | }
|
9065 | }
|
9066 |
|
9067 | function isInDocument(node) {
|
9068 | return node && node.ownerDocument && containsNode(node.ownerDocument.documentElement, node);
|
9069 | }
|
9070 |
|
9071 | function isSameOriginFrame(iframe) {
|
9072 | try {
|
9073 |
|
9074 |
|
9075 |
|
9076 |
|
9077 |
|
9078 |
|
9079 |
|
9080 | return typeof iframe.contentWindow.location.href === 'string';
|
9081 | } catch (err) {
|
9082 | return false;
|
9083 | }
|
9084 | }
|
9085 |
|
9086 | function getActiveElementDeep() {
|
9087 | var win = window;
|
9088 | var element = getActiveElement();
|
9089 |
|
9090 | while (element instanceof win.HTMLIFrameElement) {
|
9091 | if (isSameOriginFrame(element)) {
|
9092 | win = element.contentWindow;
|
9093 | } else {
|
9094 | return element;
|
9095 | }
|
9096 |
|
9097 | element = getActiveElement(win.document);
|
9098 | }
|
9099 |
|
9100 | return element;
|
9101 | }
|
9102 |
|
9103 |
|
9104 |
|
9105 |
|
9106 |
|
9107 |
|
9108 |
|
9109 |
|
9110 |
|
9111 |
|
9112 |
|
9113 |
|
9114 |
|
9115 |
|
9116 | function hasSelectionCapabilities(elem) {
|
9117 | var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
|
9118 | return nodeName && (nodeName === 'input' && (elem.type === 'text' || elem.type === 'search' || elem.type === 'tel' || elem.type === 'url' || elem.type === 'password') || nodeName === 'textarea' || elem.contentEditable === 'true');
|
9119 | }
|
9120 | function getSelectionInformation() {
|
9121 | var focusedElem = getActiveElementDeep();
|
9122 | return {
|
9123 | focusedElem: focusedElem,
|
9124 | selectionRange: hasSelectionCapabilities(focusedElem) ? getSelection(focusedElem) : null
|
9125 | };
|
9126 | }
|
9127 |
|
9128 |
|
9129 |
|
9130 |
|
9131 |
|
9132 |
|
9133 | function restoreSelection(priorSelectionInformation) {
|
9134 | var curFocusedElem = getActiveElementDeep();
|
9135 | var priorFocusedElem = priorSelectionInformation.focusedElem;
|
9136 | var priorSelectionRange = priorSelectionInformation.selectionRange;
|
9137 |
|
9138 | if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
|
9139 | if (priorSelectionRange !== null && hasSelectionCapabilities(priorFocusedElem)) {
|
9140 | setSelection(priorFocusedElem, priorSelectionRange);
|
9141 | }
|
9142 |
|
9143 |
|
9144 | var ancestors = [];
|
9145 | var ancestor = priorFocusedElem;
|
9146 |
|
9147 | while (ancestor = ancestor.parentNode) {
|
9148 | if (ancestor.nodeType === ELEMENT_NODE) {
|
9149 | ancestors.push({
|
9150 | element: ancestor,
|
9151 | left: ancestor.scrollLeft,
|
9152 | top: ancestor.scrollTop
|
9153 | });
|
9154 | }
|
9155 | }
|
9156 |
|
9157 | if (typeof priorFocusedElem.focus === 'function') {
|
9158 | priorFocusedElem.focus();
|
9159 | }
|
9160 |
|
9161 | for (var i = 0; i < ancestors.length; i++) {
|
9162 | var info = ancestors[i];
|
9163 | info.element.scrollLeft = info.left;
|
9164 | info.element.scrollTop = info.top;
|
9165 | }
|
9166 | }
|
9167 | }
|
9168 |
|
9169 |
|
9170 |
|
9171 |
|
9172 |
|
9173 |
|
9174 |
|
9175 | function getSelection(input) {
|
9176 | var selection;
|
9177 |
|
9178 | if ('selectionStart' in input) {
|
9179 |
|
9180 | selection = {
|
9181 | start: input.selectionStart,
|
9182 | end: input.selectionEnd
|
9183 | };
|
9184 | } else {
|
9185 |
|
9186 | selection = getOffsets(input);
|
9187 | }
|
9188 |
|
9189 | return selection || {
|
9190 | start: 0,
|
9191 | end: 0
|
9192 | };
|
9193 | }
|
9194 |
|
9195 |
|
9196 |
|
9197 |
|
9198 |
|
9199 |
|
9200 |
|
9201 | function setSelection(input, offsets) {
|
9202 | var start = offsets.start,
|
9203 | end = offsets.end;
|
9204 |
|
9205 | if (end === undefined) {
|
9206 | end = start;
|
9207 | }
|
9208 |
|
9209 | if ('selectionStart' in input) {
|
9210 | input.selectionStart = start;
|
9211 | input.selectionEnd = Math.min(end, input.value.length);
|
9212 | } else {
|
9213 | setOffsets(input, offsets);
|
9214 | }
|
9215 | }
|
9216 |
|
9217 | var validateDOMNesting = function () {};
|
9218 |
|
9219 | var updatedAncestorInfo = function () {};
|
9220 |
|
9221 | {
|
9222 |
|
9223 |
|
9224 |
|
9225 |
|
9226 |
|
9227 |
|
9228 |
|
9229 |
|
9230 |
|
9231 |
|
9232 |
|
9233 | var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp'];
|
9234 |
|
9235 | var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
|
9236 |
|
9237 |
|
9238 | 'foreignObject', 'desc', 'title'];
|
9239 |
|
9240 | var buttonScopeTags = inScopeTags.concat(['button']);
|
9241 |
|
9242 | var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
|
9243 | var emptyAncestorInfo = {
|
9244 | current: null,
|
9245 | formTag: null,
|
9246 | aTagInScope: null,
|
9247 | buttonTagInScope: null,
|
9248 | nobrTagInScope: null,
|
9249 | pTagInButtonScope: null,
|
9250 | listItemTagAutoclosing: null,
|
9251 | dlItemTagAutoclosing: null
|
9252 | };
|
9253 |
|
9254 | updatedAncestorInfo = function (oldInfo, tag) {
|
9255 | var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo);
|
9256 |
|
9257 | var info = {
|
9258 | tag: tag
|
9259 | };
|
9260 |
|
9261 | if (inScopeTags.indexOf(tag) !== -1) {
|
9262 | ancestorInfo.aTagInScope = null;
|
9263 | ancestorInfo.buttonTagInScope = null;
|
9264 | ancestorInfo.nobrTagInScope = null;
|
9265 | }
|
9266 |
|
9267 | if (buttonScopeTags.indexOf(tag) !== -1) {
|
9268 | ancestorInfo.pTagInButtonScope = null;
|
9269 | }
|
9270 |
|
9271 |
|
9272 |
|
9273 | if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
|
9274 | ancestorInfo.listItemTagAutoclosing = null;
|
9275 | ancestorInfo.dlItemTagAutoclosing = null;
|
9276 | }
|
9277 |
|
9278 | ancestorInfo.current = info;
|
9279 |
|
9280 | if (tag === 'form') {
|
9281 | ancestorInfo.formTag = info;
|
9282 | }
|
9283 |
|
9284 | if (tag === 'a') {
|
9285 | ancestorInfo.aTagInScope = info;
|
9286 | }
|
9287 |
|
9288 | if (tag === 'button') {
|
9289 | ancestorInfo.buttonTagInScope = info;
|
9290 | }
|
9291 |
|
9292 | if (tag === 'nobr') {
|
9293 | ancestorInfo.nobrTagInScope = info;
|
9294 | }
|
9295 |
|
9296 | if (tag === 'p') {
|
9297 | ancestorInfo.pTagInButtonScope = info;
|
9298 | }
|
9299 |
|
9300 | if (tag === 'li') {
|
9301 | ancestorInfo.listItemTagAutoclosing = info;
|
9302 | }
|
9303 |
|
9304 | if (tag === 'dd' || tag === 'dt') {
|
9305 | ancestorInfo.dlItemTagAutoclosing = info;
|
9306 | }
|
9307 |
|
9308 | return ancestorInfo;
|
9309 | };
|
9310 | |
9311 |
|
9312 |
|
9313 |
|
9314 |
|
9315 | var isTagValidWithParent = function (tag, parentTag) {
|
9316 |
|
9317 | switch (parentTag) {
|
9318 |
|
9319 | case 'select':
|
9320 | return tag === 'option' || tag === 'optgroup' || tag === '#text';
|
9321 |
|
9322 | case 'optgroup':
|
9323 | return tag === 'option' || tag === '#text';
|
9324 |
|
9325 |
|
9326 |
|
9327 | case 'option':
|
9328 | return tag === '#text';
|
9329 |
|
9330 |
|
9331 |
|
9332 |
|
9333 |
|
9334 |
|
9335 | case 'tr':
|
9336 | return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
|
9337 |
|
9338 |
|
9339 | case 'tbody':
|
9340 | case 'thead':
|
9341 | case 'tfoot':
|
9342 | return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
|
9343 |
|
9344 |
|
9345 | case 'colgroup':
|
9346 | return tag === 'col' || tag === 'template';
|
9347 |
|
9348 |
|
9349 | case 'table':
|
9350 | return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
|
9351 |
|
9352 |
|
9353 | case 'head':
|
9354 | return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
|
9355 |
|
9356 |
|
9357 | case 'html':
|
9358 | return tag === 'head' || tag === 'body' || tag === 'frameset';
|
9359 |
|
9360 | case 'frameset':
|
9361 | return tag === 'frame';
|
9362 |
|
9363 | case '#document':
|
9364 | return tag === 'html';
|
9365 | }
|
9366 |
|
9367 |
|
9368 |
|
9369 |
|
9370 | switch (tag) {
|
9371 | case 'h1':
|
9372 | case 'h2':
|
9373 | case 'h3':
|
9374 | case 'h4':
|
9375 | case 'h5':
|
9376 | case 'h6':
|
9377 | return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
|
9378 |
|
9379 | case 'rp':
|
9380 | case 'rt':
|
9381 | return impliedEndTags.indexOf(parentTag) === -1;
|
9382 |
|
9383 | case 'body':
|
9384 | case 'caption':
|
9385 | case 'col':
|
9386 | case 'colgroup':
|
9387 | case 'frameset':
|
9388 | case 'frame':
|
9389 | case 'head':
|
9390 | case 'html':
|
9391 | case 'tbody':
|
9392 | case 'td':
|
9393 | case 'tfoot':
|
9394 | case 'th':
|
9395 | case 'thead':
|
9396 | case 'tr':
|
9397 |
|
9398 |
|
9399 |
|
9400 |
|
9401 | return parentTag == null;
|
9402 | }
|
9403 |
|
9404 | return true;
|
9405 | };
|
9406 | |
9407 |
|
9408 |
|
9409 |
|
9410 |
|
9411 | var findInvalidAncestorForTag = function (tag, ancestorInfo) {
|
9412 | switch (tag) {
|
9413 | case 'address':
|
9414 | case 'article':
|
9415 | case 'aside':
|
9416 | case 'blockquote':
|
9417 | case 'center':
|
9418 | case 'details':
|
9419 | case 'dialog':
|
9420 | case 'dir':
|
9421 | case 'div':
|
9422 | case 'dl':
|
9423 | case 'fieldset':
|
9424 | case 'figcaption':
|
9425 | case 'figure':
|
9426 | case 'footer':
|
9427 | case 'header':
|
9428 | case 'hgroup':
|
9429 | case 'main':
|
9430 | case 'menu':
|
9431 | case 'nav':
|
9432 | case 'ol':
|
9433 | case 'p':
|
9434 | case 'section':
|
9435 | case 'summary':
|
9436 | case 'ul':
|
9437 | case 'pre':
|
9438 | case 'listing':
|
9439 | case 'table':
|
9440 | case 'hr':
|
9441 | case 'xmp':
|
9442 | case 'h1':
|
9443 | case 'h2':
|
9444 | case 'h3':
|
9445 | case 'h4':
|
9446 | case 'h5':
|
9447 | case 'h6':
|
9448 | return ancestorInfo.pTagInButtonScope;
|
9449 |
|
9450 | case 'form':
|
9451 | return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
|
9452 |
|
9453 | case 'li':
|
9454 | return ancestorInfo.listItemTagAutoclosing;
|
9455 |
|
9456 | case 'dd':
|
9457 | case 'dt':
|
9458 | return ancestorInfo.dlItemTagAutoclosing;
|
9459 |
|
9460 | case 'button':
|
9461 | return ancestorInfo.buttonTagInScope;
|
9462 |
|
9463 | case 'a':
|
9464 |
|
9465 |
|
9466 | return ancestorInfo.aTagInScope;
|
9467 |
|
9468 | case 'nobr':
|
9469 | return ancestorInfo.nobrTagInScope;
|
9470 | }
|
9471 |
|
9472 | return null;
|
9473 | };
|
9474 |
|
9475 | var didWarn$1 = {};
|
9476 |
|
9477 | validateDOMNesting = function (childTag, childText, ancestorInfo) {
|
9478 | ancestorInfo = ancestorInfo || emptyAncestorInfo;
|
9479 | var parentInfo = ancestorInfo.current;
|
9480 | var parentTag = parentInfo && parentInfo.tag;
|
9481 |
|
9482 | if (childText != null) {
|
9483 | !(childTag == null) ? warningWithoutStack$1(false, 'validateDOMNesting: when childText is passed, childTag should be null') : void 0;
|
9484 | childTag = '#text';
|
9485 | }
|
9486 |
|
9487 | var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
|
9488 | var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
|
9489 | var invalidParentOrAncestor = invalidParent || invalidAncestor;
|
9490 |
|
9491 | if (!invalidParentOrAncestor) {
|
9492 | return;
|
9493 | }
|
9494 |
|
9495 | var ancestorTag = invalidParentOrAncestor.tag;
|
9496 | var addendum = getCurrentFiberStackInDev();
|
9497 | var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + addendum;
|
9498 |
|
9499 | if (didWarn$1[warnKey]) {
|
9500 | return;
|
9501 | }
|
9502 |
|
9503 | didWarn$1[warnKey] = true;
|
9504 | var tagDisplayName = childTag;
|
9505 | var whitespaceInfo = '';
|
9506 |
|
9507 | if (childTag === '#text') {
|
9508 | if (/\S/.test(childText)) {
|
9509 | tagDisplayName = 'Text nodes';
|
9510 | } else {
|
9511 | tagDisplayName = 'Whitespace text nodes';
|
9512 | whitespaceInfo = " Make sure you don't have any extra whitespace between tags on " + 'each line of your source code.';
|
9513 | }
|
9514 | } else {
|
9515 | tagDisplayName = '<' + childTag + '>';
|
9516 | }
|
9517 |
|
9518 | if (invalidParent) {
|
9519 | var info = '';
|
9520 |
|
9521 | if (ancestorTag === 'table' && childTag === 'tr') {
|
9522 | info += ' Add a <tbody>, <thead> or <tfoot> to your code to match the DOM tree generated by ' + 'the browser.';
|
9523 | }
|
9524 |
|
9525 | warningWithoutStack$1(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>.%s%s%s', tagDisplayName, ancestorTag, whitespaceInfo, info, addendum);
|
9526 | } else {
|
9527 | warningWithoutStack$1(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>.%s', tagDisplayName, ancestorTag, addendum);
|
9528 | }
|
9529 | };
|
9530 | }
|
9531 |
|
9532 |
|
9533 |
|
9534 | function shim() {
|
9535 | (function () {
|
9536 | {
|
9537 | {
|
9538 | throw ReactError(Error("The current renderer does not support persistence. This error is likely caused by a bug in React. Please file an issue."));
|
9539 | }
|
9540 | }
|
9541 | })();
|
9542 | }
|
9543 |
|
9544 |
|
9545 | var supportsPersistence = false;
|
9546 | var cloneInstance = shim;
|
9547 | var cloneFundamentalInstance = shim;
|
9548 | var createContainerChildSet = shim;
|
9549 | var appendChildToContainerChildSet = shim;
|
9550 | var finalizeContainerChildren = shim;
|
9551 | var replaceContainerChildren = shim;
|
9552 | var cloneHiddenInstance = shim;
|
9553 | var cloneHiddenTextInstance = shim;
|
9554 |
|
9555 | var SUPPRESS_HYDRATION_WARNING;
|
9556 |
|
9557 | {
|
9558 | SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning';
|
9559 | }
|
9560 |
|
9561 | var SUSPENSE_START_DATA = '$';
|
9562 | var SUSPENSE_END_DATA = '/$';
|
9563 | var SUSPENSE_PENDING_START_DATA = '$?';
|
9564 | var SUSPENSE_FALLBACK_START_DATA = '$!';
|
9565 | var STYLE = 'style';
|
9566 | var eventsEnabled = null;
|
9567 | var selectionInformation = null;
|
9568 |
|
9569 | function shouldAutoFocusHostComponent(type, props) {
|
9570 | switch (type) {
|
9571 | case 'button':
|
9572 | case 'input':
|
9573 | case 'select':
|
9574 | case 'textarea':
|
9575 | return !!props.autoFocus;
|
9576 | }
|
9577 |
|
9578 | return false;
|
9579 | }
|
9580 |
|
9581 | function getRootHostContext(rootContainerInstance) {
|
9582 | var type;
|
9583 | var namespace;
|
9584 | var nodeType = rootContainerInstance.nodeType;
|
9585 |
|
9586 | switch (nodeType) {
|
9587 | case DOCUMENT_NODE:
|
9588 | case DOCUMENT_FRAGMENT_NODE:
|
9589 | {
|
9590 | type = nodeType === DOCUMENT_NODE ? '#document' : '#fragment';
|
9591 | var root = rootContainerInstance.documentElement;
|
9592 | namespace = root ? root.namespaceURI : getChildNamespace(null, '');
|
9593 | break;
|
9594 | }
|
9595 |
|
9596 | default:
|
9597 | {
|
9598 | var container = nodeType === COMMENT_NODE ? rootContainerInstance.parentNode : rootContainerInstance;
|
9599 | var ownNamespace = container.namespaceURI || null;
|
9600 | type = container.tagName;
|
9601 | namespace = getChildNamespace(ownNamespace, type);
|
9602 | break;
|
9603 | }
|
9604 | }
|
9605 |
|
9606 | {
|
9607 | var validatedTag = type.toLowerCase();
|
9608 | var ancestorInfo = updatedAncestorInfo(null, validatedTag);
|
9609 | return {
|
9610 | namespace: namespace,
|
9611 | ancestorInfo: ancestorInfo
|
9612 | };
|
9613 | }
|
9614 |
|
9615 | return namespace;
|
9616 | }
|
9617 | function getChildHostContext(parentHostContext, type, rootContainerInstance) {
|
9618 | {
|
9619 | var parentHostContextDev = parentHostContext;
|
9620 | var namespace = getChildNamespace(parentHostContextDev.namespace, type);
|
9621 | var ancestorInfo = updatedAncestorInfo(parentHostContextDev.ancestorInfo, type);
|
9622 | return {
|
9623 | namespace: namespace,
|
9624 | ancestorInfo: ancestorInfo
|
9625 | };
|
9626 | }
|
9627 |
|
9628 | var parentNamespace = parentHostContext;
|
9629 | return getChildNamespace(parentNamespace, type);
|
9630 | }
|
9631 | function getPublicInstance(instance) {
|
9632 | return instance;
|
9633 | }
|
9634 | function prepareForCommit(containerInfo) {
|
9635 | eventsEnabled = isEnabled();
|
9636 | selectionInformation = getSelectionInformation();
|
9637 | setEnabled(false);
|
9638 | }
|
9639 | function resetAfterCommit(containerInfo) {
|
9640 | restoreSelection(selectionInformation);
|
9641 | selectionInformation = null;
|
9642 | setEnabled(eventsEnabled);
|
9643 | eventsEnabled = null;
|
9644 | }
|
9645 | function createInstance(type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
|
9646 | var parentNamespace;
|
9647 |
|
9648 | {
|
9649 |
|
9650 | var hostContextDev = hostContext;
|
9651 | validateDOMNesting(type, null, hostContextDev.ancestorInfo);
|
9652 |
|
9653 | if (typeof props.children === 'string' || typeof props.children === 'number') {
|
9654 | var string = '' + props.children;
|
9655 | var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type);
|
9656 | validateDOMNesting(null, string, ownAncestorInfo);
|
9657 | }
|
9658 |
|
9659 | parentNamespace = hostContextDev.namespace;
|
9660 | }
|
9661 |
|
9662 | var domElement = createElement(type, props, rootContainerInstance, parentNamespace);
|
9663 | precacheFiberNode(internalInstanceHandle, domElement);
|
9664 | updateFiberProps(domElement, props);
|
9665 | return domElement;
|
9666 | }
|
9667 | function appendInitialChild(parentInstance, child) {
|
9668 | parentInstance.appendChild(child);
|
9669 | }
|
9670 | function finalizeInitialChildren(domElement, type, props, rootContainerInstance, hostContext) {
|
9671 | setInitialProperties(domElement, type, props, rootContainerInstance);
|
9672 | return shouldAutoFocusHostComponent(type, props);
|
9673 | }
|
9674 | function prepareUpdate(domElement, type, oldProps, newProps, rootContainerInstance, hostContext) {
|
9675 | {
|
9676 | var hostContextDev = hostContext;
|
9677 |
|
9678 | if (typeof newProps.children !== typeof oldProps.children && (typeof newProps.children === 'string' || typeof newProps.children === 'number')) {
|
9679 | var string = '' + newProps.children;
|
9680 | var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type);
|
9681 | validateDOMNesting(null, string, ownAncestorInfo);
|
9682 | }
|
9683 | }
|
9684 |
|
9685 | return diffProperties(domElement, type, oldProps, newProps, rootContainerInstance);
|
9686 | }
|
9687 | function shouldSetTextContent(type, props) {
|
9688 | return type === 'textarea' || type === 'option' || type === 'noscript' || typeof props.children === 'string' || typeof props.children === 'number' || typeof props.dangerouslySetInnerHTML === 'object' && props.dangerouslySetInnerHTML !== null && props.dangerouslySetInnerHTML.__html != null;
|
9689 | }
|
9690 | function shouldDeprioritizeSubtree(type, props) {
|
9691 | return !!props.hidden;
|
9692 | }
|
9693 | function createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) {
|
9694 | {
|
9695 | var hostContextDev = hostContext;
|
9696 | validateDOMNesting(null, text, hostContextDev.ancestorInfo);
|
9697 | }
|
9698 |
|
9699 | var textNode = createTextNode(text, rootContainerInstance);
|
9700 | precacheFiberNode(internalInstanceHandle, textNode);
|
9701 | return textNode;
|
9702 | }
|
9703 | var isPrimaryRenderer = true;
|
9704 | var warnsIfNotActing = true;
|
9705 |
|
9706 |
|
9707 |
|
9708 | var scheduleTimeout = typeof setTimeout === 'function' ? setTimeout : undefined;
|
9709 | var cancelTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined;
|
9710 | var noTimeout = -1;
|
9711 |
|
9712 |
|
9713 |
|
9714 | var supportsMutation = true;
|
9715 | function commitMount(domElement, type, newProps, internalInstanceHandle) {
|
9716 |
|
9717 |
|
9718 |
|
9719 |
|
9720 |
|
9721 |
|
9722 | if (shouldAutoFocusHostComponent(type, newProps)) {
|
9723 | domElement.focus();
|
9724 | }
|
9725 | }
|
9726 | function commitUpdate(domElement, updatePayload, type, oldProps, newProps, internalInstanceHandle) {
|
9727 |
|
9728 |
|
9729 | updateFiberProps(domElement, newProps);
|
9730 |
|
9731 | updateProperties(domElement, updatePayload, type, oldProps, newProps);
|
9732 | }
|
9733 | function resetTextContent(domElement) {
|
9734 | setTextContent(domElement, '');
|
9735 | }
|
9736 | function commitTextUpdate(textInstance, oldText, newText) {
|
9737 | textInstance.nodeValue = newText;
|
9738 | }
|
9739 | function appendChild(parentInstance, child) {
|
9740 | parentInstance.appendChild(child);
|
9741 | }
|
9742 | function appendChildToContainer(container, child) {
|
9743 | var parentNode;
|
9744 |
|
9745 | if (container.nodeType === COMMENT_NODE) {
|
9746 | parentNode = container.parentNode;
|
9747 | parentNode.insertBefore(child, container);
|
9748 | } else {
|
9749 | parentNode = container;
|
9750 | parentNode.appendChild(child);
|
9751 | }
|
9752 |
|
9753 |
|
9754 |
|
9755 |
|
9756 |
|
9757 |
|
9758 |
|
9759 |
|
9760 |
|
9761 | var reactRootContainer = container._reactRootContainer;
|
9762 |
|
9763 | if ((reactRootContainer === null || reactRootContainer === undefined) && parentNode.onclick === null) {
|
9764 |
|
9765 | trapClickOnNonInteractiveElement(parentNode);
|
9766 | }
|
9767 | }
|
9768 | function insertBefore(parentInstance, child, beforeChild) {
|
9769 | parentInstance.insertBefore(child, beforeChild);
|
9770 | }
|
9771 | function insertInContainerBefore(container, child, beforeChild) {
|
9772 | if (container.nodeType === COMMENT_NODE) {
|
9773 | container.parentNode.insertBefore(child, beforeChild);
|
9774 | } else {
|
9775 | container.insertBefore(child, beforeChild);
|
9776 | }
|
9777 | }
|
9778 | function removeChild(parentInstance, child) {
|
9779 | parentInstance.removeChild(child);
|
9780 | }
|
9781 | function removeChildFromContainer(container, child) {
|
9782 | if (container.nodeType === COMMENT_NODE) {
|
9783 | container.parentNode.removeChild(child);
|
9784 | } else {
|
9785 | container.removeChild(child);
|
9786 | }
|
9787 | }
|
9788 | function clearSuspenseBoundary(parentInstance, suspenseInstance) {
|
9789 | var node = suspenseInstance;
|
9790 |
|
9791 |
|
9792 |
|
9793 | var depth = 0;
|
9794 |
|
9795 | do {
|
9796 | var nextNode = node.nextSibling;
|
9797 | parentInstance.removeChild(node);
|
9798 |
|
9799 | if (nextNode && nextNode.nodeType === COMMENT_NODE) {
|
9800 | var data = nextNode.data;
|
9801 |
|
9802 | if (data === SUSPENSE_END_DATA) {
|
9803 | if (depth === 0) {
|
9804 | parentInstance.removeChild(nextNode);
|
9805 |
|
9806 | retryIfBlockedOn(suspenseInstance);
|
9807 | return;
|
9808 | } else {
|
9809 | depth--;
|
9810 | }
|
9811 | } else if (data === SUSPENSE_START_DATA || data === SUSPENSE_PENDING_START_DATA || data === SUSPENSE_FALLBACK_START_DATA) {
|
9812 | depth++;
|
9813 | }
|
9814 | }
|
9815 |
|
9816 | node = nextNode;
|
9817 | } while (node);
|
9818 |
|
9819 |
|
9820 |
|
9821 | retryIfBlockedOn(suspenseInstance);
|
9822 | }
|
9823 | function clearSuspenseBoundaryFromContainer(container, suspenseInstance) {
|
9824 | if (container.nodeType === COMMENT_NODE) {
|
9825 | clearSuspenseBoundary(container.parentNode, suspenseInstance);
|
9826 | } else if (container.nodeType === ELEMENT_NODE) {
|
9827 | clearSuspenseBoundary(container, suspenseInstance);
|
9828 | } else {}
|
9829 |
|
9830 |
|
9831 |
|
9832 | retryIfBlockedOn(container);
|
9833 | }
|
9834 | function hideInstance(instance) {
|
9835 |
|
9836 |
|
9837 | instance = instance;
|
9838 | var style = instance.style;
|
9839 |
|
9840 | if (typeof style.setProperty === 'function') {
|
9841 | style.setProperty('display', 'none', 'important');
|
9842 | } else {
|
9843 | style.display = 'none';
|
9844 | }
|
9845 | }
|
9846 | function hideTextInstance(textInstance) {
|
9847 | textInstance.nodeValue = '';
|
9848 | }
|
9849 | function unhideInstance(instance, props) {
|
9850 | instance = instance;
|
9851 | var styleProp = props[STYLE];
|
9852 | var display = styleProp !== undefined && styleProp !== null && styleProp.hasOwnProperty('display') ? styleProp.display : null;
|
9853 | instance.style.display = dangerousStyleValue('display', display);
|
9854 | }
|
9855 | function unhideTextInstance(textInstance, text) {
|
9856 | textInstance.nodeValue = text;
|
9857 | }
|
9858 |
|
9859 |
|
9860 |
|
9861 | var supportsHydration = true;
|
9862 | function canHydrateInstance(instance, type, props) {
|
9863 | if (instance.nodeType !== ELEMENT_NODE || type.toLowerCase() !== instance.nodeName.toLowerCase()) {
|
9864 | return null;
|
9865 | }
|
9866 |
|
9867 |
|
9868 | return instance;
|
9869 | }
|
9870 | function canHydrateTextInstance(instance, text) {
|
9871 | if (text === '' || instance.nodeType !== TEXT_NODE) {
|
9872 |
|
9873 | return null;
|
9874 | }
|
9875 |
|
9876 |
|
9877 | return instance;
|
9878 | }
|
9879 | function canHydrateSuspenseInstance(instance) {
|
9880 | if (instance.nodeType !== COMMENT_NODE) {
|
9881 |
|
9882 | return null;
|
9883 | }
|
9884 |
|
9885 |
|
9886 | return instance;
|
9887 | }
|
9888 | function isSuspenseInstancePending(instance) {
|
9889 | return instance.data === SUSPENSE_PENDING_START_DATA;
|
9890 | }
|
9891 | function isSuspenseInstanceFallback(instance) {
|
9892 | return instance.data === SUSPENSE_FALLBACK_START_DATA;
|
9893 | }
|
9894 | function registerSuspenseInstanceRetry(instance, callback) {
|
9895 | instance._reactRetry = callback;
|
9896 | }
|
9897 |
|
9898 | function getNextHydratable(node) {
|
9899 |
|
9900 | for (; node != null; node = node.nextSibling) {
|
9901 | var nodeType = node.nodeType;
|
9902 |
|
9903 | if (nodeType === ELEMENT_NODE || nodeType === TEXT_NODE) {
|
9904 | break;
|
9905 | }
|
9906 |
|
9907 | if (enableSuspenseServerRenderer) {
|
9908 | if (nodeType === COMMENT_NODE) {
|
9909 | var nodeData = node.data;
|
9910 |
|
9911 | if (nodeData === SUSPENSE_START_DATA || nodeData === SUSPENSE_FALLBACK_START_DATA || nodeData === SUSPENSE_PENDING_START_DATA) {
|
9912 | break;
|
9913 | }
|
9914 | }
|
9915 | }
|
9916 | }
|
9917 |
|
9918 | return node;
|
9919 | }
|
9920 |
|
9921 | function getNextHydratableSibling(instance) {
|
9922 | return getNextHydratable(instance.nextSibling);
|
9923 | }
|
9924 | function getFirstHydratableChild(parentInstance) {
|
9925 | return getNextHydratable(parentInstance.firstChild);
|
9926 | }
|
9927 | function hydrateInstance(instance, type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
|
9928 | precacheFiberNode(internalInstanceHandle, instance);
|
9929 |
|
9930 |
|
9931 | updateFiberProps(instance, props);
|
9932 | var parentNamespace;
|
9933 |
|
9934 | {
|
9935 | var hostContextDev = hostContext;
|
9936 | parentNamespace = hostContextDev.namespace;
|
9937 | }
|
9938 |
|
9939 | return diffHydratedProperties(instance, type, props, parentNamespace, rootContainerInstance);
|
9940 | }
|
9941 | function hydrateTextInstance(textInstance, text, internalInstanceHandle) {
|
9942 | precacheFiberNode(internalInstanceHandle, textInstance);
|
9943 | return diffHydratedText(textInstance, text);
|
9944 | }
|
9945 | function hydrateSuspenseInstance(suspenseInstance, internalInstanceHandle) {
|
9946 | precacheFiberNode(internalInstanceHandle, suspenseInstance);
|
9947 | }
|
9948 | function getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance) {
|
9949 | var node = suspenseInstance.nextSibling;
|
9950 |
|
9951 |
|
9952 |
|
9953 | var depth = 0;
|
9954 |
|
9955 | while (node) {
|
9956 | if (node.nodeType === COMMENT_NODE) {
|
9957 | var data = node.data;
|
9958 |
|
9959 | if (data === SUSPENSE_END_DATA) {
|
9960 | if (depth === 0) {
|
9961 | return getNextHydratableSibling(node);
|
9962 | } else {
|
9963 | depth--;
|
9964 | }
|
9965 | } else if (data === SUSPENSE_START_DATA || data === SUSPENSE_FALLBACK_START_DATA || data === SUSPENSE_PENDING_START_DATA) {
|
9966 | depth++;
|
9967 | }
|
9968 | }
|
9969 |
|
9970 | node = node.nextSibling;
|
9971 | }
|
9972 |
|
9973 |
|
9974 | return null;
|
9975 | }
|
9976 |
|
9977 |
|
9978 |
|
9979 | function getParentSuspenseInstance(targetInstance) {
|
9980 | var node = targetInstance.previousSibling;
|
9981 |
|
9982 |
|
9983 |
|
9984 | var depth = 0;
|
9985 |
|
9986 | while (node) {
|
9987 | if (node.nodeType === COMMENT_NODE) {
|
9988 | var data = node.data;
|
9989 |
|
9990 | if (data === SUSPENSE_START_DATA || data === SUSPENSE_FALLBACK_START_DATA || data === SUSPENSE_PENDING_START_DATA) {
|
9991 | if (depth === 0) {
|
9992 | return node;
|
9993 | } else {
|
9994 | depth--;
|
9995 | }
|
9996 | } else if (data === SUSPENSE_END_DATA) {
|
9997 | depth++;
|
9998 | }
|
9999 | }
|
10000 |
|
10001 | node = node.previousSibling;
|
10002 | }
|
10003 |
|
10004 | return null;
|
10005 | }
|
10006 | function commitHydratedContainer(container) {
|
10007 |
|
10008 | retryIfBlockedOn(container);
|
10009 | }
|
10010 | function commitHydratedSuspenseInstance(suspenseInstance) {
|
10011 |
|
10012 | retryIfBlockedOn(suspenseInstance);
|
10013 | }
|
10014 | function didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, text) {
|
10015 | {
|
10016 | warnForUnmatchedText(textInstance, text);
|
10017 | }
|
10018 | }
|
10019 | function didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, text) {
|
10020 | if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
|
10021 | warnForUnmatchedText(textInstance, text);
|
10022 | }
|
10023 | }
|
10024 | function didNotHydrateContainerInstance(parentContainer, instance) {
|
10025 | {
|
10026 | if (instance.nodeType === ELEMENT_NODE) {
|
10027 | warnForDeletedHydratableElement(parentContainer, instance);
|
10028 | } else if (instance.nodeType === COMMENT_NODE) {
|
10029 | } else {
|
10030 | warnForDeletedHydratableText(parentContainer, instance);
|
10031 | }
|
10032 | }
|
10033 | }
|
10034 | function didNotHydrateInstance(parentType, parentProps, parentInstance, instance) {
|
10035 | if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
|
10036 | if (instance.nodeType === ELEMENT_NODE) {
|
10037 | warnForDeletedHydratableElement(parentInstance, instance);
|
10038 | } else if (instance.nodeType === COMMENT_NODE) {
|
10039 | } else {
|
10040 | warnForDeletedHydratableText(parentInstance, instance);
|
10041 | }
|
10042 | }
|
10043 | }
|
10044 | function didNotFindHydratableContainerInstance(parentContainer, type, props) {
|
10045 | {
|
10046 | warnForInsertedHydratedElement(parentContainer, type, props);
|
10047 | }
|
10048 | }
|
10049 | function didNotFindHydratableContainerTextInstance(parentContainer, text) {
|
10050 | {
|
10051 | warnForInsertedHydratedText(parentContainer, text);
|
10052 | }
|
10053 | }
|
10054 |
|
10055 | function didNotFindHydratableInstance(parentType, parentProps, parentInstance, type, props) {
|
10056 | if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
|
10057 | warnForInsertedHydratedElement(parentInstance, type, props);
|
10058 | }
|
10059 | }
|
10060 | function didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, text) {
|
10061 | if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
|
10062 | warnForInsertedHydratedText(parentInstance, text);
|
10063 | }
|
10064 | }
|
10065 | function didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance) {
|
10066 | if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
|
10067 | }
|
10068 | }
|
10069 | function mountResponderInstance(responder, responderInstance, responderProps, responderState, instance) {
|
10070 |
|
10071 | var doc = instance.ownerDocument;
|
10072 | var _ref = responder,
|
10073 | rootEventTypes = _ref.rootEventTypes,
|
10074 | targetEventTypes = _ref.targetEventTypes;
|
10075 |
|
10076 | if (targetEventTypes !== null) {
|
10077 | listenToEventResponderEventTypes(targetEventTypes, doc);
|
10078 | }
|
10079 |
|
10080 | if (rootEventTypes !== null) {
|
10081 | addRootEventTypesForResponderInstance(responderInstance, rootEventTypes);
|
10082 | listenToEventResponderEventTypes(rootEventTypes, doc);
|
10083 | }
|
10084 |
|
10085 | mountEventResponder(responder, responderInstance, responderProps, responderState);
|
10086 | return responderInstance;
|
10087 | }
|
10088 | function unmountResponderInstance(responderInstance) {
|
10089 | if (enableFlareAPI) {
|
10090 |
|
10091 | unmountEventResponder(responderInstance);
|
10092 | }
|
10093 | }
|
10094 | function getFundamentalComponentInstance(fundamentalInstance) {
|
10095 | if (enableFundamentalAPI) {
|
10096 | var currentFiber = fundamentalInstance.currentFiber,
|
10097 | impl = fundamentalInstance.impl,
|
10098 | props = fundamentalInstance.props,
|
10099 | state = fundamentalInstance.state;
|
10100 | var instance = impl.getInstance(null, props, state);
|
10101 | precacheFiberNode(currentFiber, instance);
|
10102 | return instance;
|
10103 | }
|
10104 |
|
10105 |
|
10106 | return null;
|
10107 | }
|
10108 | function mountFundamentalComponent(fundamentalInstance) {
|
10109 | if (enableFundamentalAPI) {
|
10110 | var impl = fundamentalInstance.impl,
|
10111 | instance = fundamentalInstance.instance,
|
10112 | props = fundamentalInstance.props,
|
10113 | state = fundamentalInstance.state;
|
10114 | var onMount = impl.onMount;
|
10115 |
|
10116 | if (onMount !== undefined) {
|
10117 | onMount(null, instance, props, state);
|
10118 | }
|
10119 | }
|
10120 | }
|
10121 | function shouldUpdateFundamentalComponent(fundamentalInstance) {
|
10122 | if (enableFundamentalAPI) {
|
10123 | var impl = fundamentalInstance.impl,
|
10124 | prevProps = fundamentalInstance.prevProps,
|
10125 | props = fundamentalInstance.props,
|
10126 | state = fundamentalInstance.state;
|
10127 | var shouldUpdate = impl.shouldUpdate;
|
10128 |
|
10129 | if (shouldUpdate !== undefined) {
|
10130 | return shouldUpdate(null, prevProps, props, state);
|
10131 | }
|
10132 | }
|
10133 |
|
10134 | return true;
|
10135 | }
|
10136 | function updateFundamentalComponent(fundamentalInstance) {
|
10137 | if (enableFundamentalAPI) {
|
10138 | var impl = fundamentalInstance.impl,
|
10139 | instance = fundamentalInstance.instance,
|
10140 | prevProps = fundamentalInstance.prevProps,
|
10141 | props = fundamentalInstance.props,
|
10142 | state = fundamentalInstance.state;
|
10143 | var onUpdate = impl.onUpdate;
|
10144 |
|
10145 | if (onUpdate !== undefined) {
|
10146 | onUpdate(null, instance, prevProps, props, state);
|
10147 | }
|
10148 | }
|
10149 | }
|
10150 | function unmountFundamentalComponent(fundamentalInstance) {
|
10151 | if (enableFundamentalAPI) {
|
10152 | var impl = fundamentalInstance.impl,
|
10153 | instance = fundamentalInstance.instance,
|
10154 | props = fundamentalInstance.props,
|
10155 | state = fundamentalInstance.state;
|
10156 | var onUnmount = impl.onUnmount;
|
10157 |
|
10158 | if (onUnmount !== undefined) {
|
10159 | onUnmount(null, instance, props, state);
|
10160 | }
|
10161 | }
|
10162 | }
|
10163 |
|
10164 | var randomKey = Math.random().toString(36).slice(2);
|
10165 | var internalInstanceKey = '__reactInternalInstance$' + randomKey;
|
10166 | var internalEventHandlersKey = '__reactEventHandlers$' + randomKey;
|
10167 | var internalContainerInstanceKey = '__reactContainere$' + randomKey;
|
10168 | function precacheFiberNode(hostInst, node) {
|
10169 | node[internalInstanceKey] = hostInst;
|
10170 | }
|
10171 | function markContainerAsRoot(hostRoot, node) {
|
10172 | node[internalContainerInstanceKey] = hostRoot;
|
10173 | }
|
10174 |
|
10175 |
|
10176 |
|
10177 |
|
10178 |
|
10179 |
|
10180 |
|
10181 | function getClosestInstanceFromNode(targetNode) {
|
10182 | var targetInst = targetNode[internalInstanceKey];
|
10183 |
|
10184 | if (targetInst) {
|
10185 |
|
10186 | return targetInst;
|
10187 | }
|
10188 |
|
10189 |
|
10190 |
|
10191 | var parentNode = targetNode.parentNode;
|
10192 |
|
10193 | while (parentNode) {
|
10194 |
|
10195 |
|
10196 |
|
10197 |
|
10198 |
|
10199 |
|
10200 |
|
10201 |
|
10202 | targetInst = parentNode[internalContainerInstanceKey] || parentNode[internalInstanceKey];
|
10203 |
|
10204 | if (targetInst) {
|
10205 |
|
10206 |
|
10207 |
|
10208 |
|
10209 |
|
10210 |
|
10211 |
|
10212 |
|
10213 |
|
10214 |
|
10215 |
|
10216 |
|
10217 |
|
10218 | var alternate = targetInst.alternate;
|
10219 |
|
10220 | if (targetInst.child !== null || alternate !== null && alternate.child !== null) {
|
10221 |
|
10222 |
|
10223 | var suspenseInstance = getParentSuspenseInstance(targetNode);
|
10224 |
|
10225 | while (suspenseInstance !== null) {
|
10226 |
|
10227 |
|
10228 |
|
10229 |
|
10230 |
|
10231 |
|
10232 |
|
10233 |
|
10234 | var targetSuspenseInst = suspenseInstance[internalInstanceKey];
|
10235 |
|
10236 | if (targetSuspenseInst) {
|
10237 | return targetSuspenseInst;
|
10238 | }
|
10239 |
|
10240 |
|
10241 |
|
10242 |
|
10243 |
|
10244 | suspenseInstance = getParentSuspenseInstance(suspenseInstance);
|
10245 |
|
10246 |
|
10247 | }
|
10248 | }
|
10249 |
|
10250 | return targetInst;
|
10251 | }
|
10252 |
|
10253 | targetNode = parentNode;
|
10254 | parentNode = targetNode.parentNode;
|
10255 | }
|
10256 |
|
10257 | return null;
|
10258 | }
|
10259 |
|
10260 |
|
10261 |
|
10262 |
|
10263 |
|
10264 | function getInstanceFromNode$1(node) {
|
10265 | var inst = node[internalInstanceKey] || node[internalContainerInstanceKey];
|
10266 |
|
10267 | if (inst) {
|
10268 | if (inst.tag === HostComponent || inst.tag === HostText || inst.tag === SuspenseComponent || inst.tag === HostRoot) {
|
10269 | return inst;
|
10270 | } else {
|
10271 | return null;
|
10272 | }
|
10273 | }
|
10274 |
|
10275 | return null;
|
10276 | }
|
10277 |
|
10278 |
|
10279 |
|
10280 |
|
10281 |
|
10282 | function getNodeFromInstance$1(inst) {
|
10283 | if (inst.tag === HostComponent || inst.tag === HostText) {
|
10284 |
|
10285 |
|
10286 | return inst.stateNode;
|
10287 | }
|
10288 |
|
10289 |
|
10290 |
|
10291 | (function () {
|
10292 | {
|
10293 | {
|
10294 | throw ReactError(Error("getNodeFromInstance: Invalid argument."));
|
10295 | }
|
10296 | }
|
10297 | })();
|
10298 | }
|
10299 | function getFiberCurrentPropsFromNode$1(node) {
|
10300 | return node[internalEventHandlersKey] || null;
|
10301 | }
|
10302 | function updateFiberProps(node, props) {
|
10303 | node[internalEventHandlersKey] = props;
|
10304 | }
|
10305 |
|
10306 |
|
10307 |
|
10308 |
|
10309 |
|
10310 |
|
10311 |
|
10312 |
|
10313 |
|
10314 |
|
10315 |
|
10316 |
|
10317 | var root = null;
|
10318 | var startText = null;
|
10319 | var fallbackText = null;
|
10320 | function initialize(nativeEventTarget) {
|
10321 | root = nativeEventTarget;
|
10322 | startText = getText();
|
10323 | return true;
|
10324 | }
|
10325 | function reset() {
|
10326 | root = null;
|
10327 | startText = null;
|
10328 | fallbackText = null;
|
10329 | }
|
10330 | function getData() {
|
10331 | if (fallbackText) {
|
10332 | return fallbackText;
|
10333 | }
|
10334 |
|
10335 | var start;
|
10336 | var startValue = startText;
|
10337 | var startLength = startValue.length;
|
10338 | var end;
|
10339 | var endValue = getText();
|
10340 | var endLength = endValue.length;
|
10341 |
|
10342 | for (start = 0; start < startLength; start++) {
|
10343 | if (startValue[start] !== endValue[start]) {
|
10344 | break;
|
10345 | }
|
10346 | }
|
10347 |
|
10348 | var minEnd = startLength - start;
|
10349 |
|
10350 | for (end = 1; end <= minEnd; end++) {
|
10351 | if (startValue[startLength - end] !== endValue[endLength - end]) {
|
10352 | break;
|
10353 | }
|
10354 | }
|
10355 |
|
10356 | var sliceTail = end > 1 ? 1 - end : undefined;
|
10357 | fallbackText = endValue.slice(start, sliceTail);
|
10358 | return fallbackText;
|
10359 | }
|
10360 | function getText() {
|
10361 | if ('value' in root) {
|
10362 | return root.value;
|
10363 | }
|
10364 |
|
10365 | return root.textContent;
|
10366 | }
|
10367 |
|
10368 |
|
10369 |
|
10370 |
|
10371 |
|
10372 |
|
10373 | var SyntheticCompositionEvent = SyntheticEvent.extend({
|
10374 | data: null
|
10375 | });
|
10376 |
|
10377 |
|
10378 |
|
10379 |
|
10380 |
|
10381 |
|
10382 |
|
10383 | var SyntheticInputEvent = SyntheticEvent.extend({
|
10384 | data: null
|
10385 | });
|
10386 |
|
10387 | var END_KEYCODES = [9, 13, 27, 32];
|
10388 |
|
10389 | var START_KEYCODE = 229;
|
10390 | var canUseCompositionEvent = canUseDOM && 'CompositionEvent' in window;
|
10391 | var documentMode = null;
|
10392 |
|
10393 | if (canUseDOM && 'documentMode' in document) {
|
10394 | documentMode = document.documentMode;
|
10395 | }
|
10396 |
|
10397 |
|
10398 |
|
10399 |
|
10400 | var canUseTextInputEvent = canUseDOM && 'TextEvent' in window && !documentMode;
|
10401 |
|
10402 |
|
10403 |
|
10404 | var useFallbackCompositionData = canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
|
10405 | var SPACEBAR_CODE = 32;
|
10406 | var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
|
10407 |
|
10408 | var eventTypes$1 = {
|
10409 | beforeInput: {
|
10410 | phasedRegistrationNames: {
|
10411 | bubbled: 'onBeforeInput',
|
10412 | captured: 'onBeforeInputCapture'
|
10413 | },
|
10414 | dependencies: [TOP_COMPOSITION_END, TOP_KEY_PRESS, TOP_TEXT_INPUT, TOP_PASTE]
|
10415 | },
|
10416 | compositionEnd: {
|
10417 | phasedRegistrationNames: {
|
10418 | bubbled: 'onCompositionEnd',
|
10419 | captured: 'onCompositionEndCapture'
|
10420 | },
|
10421 | dependencies: [TOP_BLUR, TOP_COMPOSITION_END, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
|
10422 | },
|
10423 | compositionStart: {
|
10424 | phasedRegistrationNames: {
|
10425 | bubbled: 'onCompositionStart',
|
10426 | captured: 'onCompositionStartCapture'
|
10427 | },
|
10428 | dependencies: [TOP_BLUR, TOP_COMPOSITION_START, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
|
10429 | },
|
10430 | compositionUpdate: {
|
10431 | phasedRegistrationNames: {
|
10432 | bubbled: 'onCompositionUpdate',
|
10433 | captured: 'onCompositionUpdateCapture'
|
10434 | },
|
10435 | dependencies: [TOP_BLUR, TOP_COMPOSITION_UPDATE, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
|
10436 | }
|
10437 | };
|
10438 |
|
10439 | var hasSpaceKeypress = false;
|
10440 |
|
10441 |
|
10442 |
|
10443 |
|
10444 |
|
10445 |
|
10446 | function isKeypressCommand(nativeEvent) {
|
10447 | return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
|
10448 | !(nativeEvent.ctrlKey && nativeEvent.altKey);
|
10449 | }
|
10450 |
|
10451 |
|
10452 |
|
10453 |
|
10454 |
|
10455 |
|
10456 |
|
10457 |
|
10458 | function getCompositionEventType(topLevelType) {
|
10459 | switch (topLevelType) {
|
10460 | case TOP_COMPOSITION_START:
|
10461 | return eventTypes$1.compositionStart;
|
10462 |
|
10463 | case TOP_COMPOSITION_END:
|
10464 | return eventTypes$1.compositionEnd;
|
10465 |
|
10466 | case TOP_COMPOSITION_UPDATE:
|
10467 | return eventTypes$1.compositionUpdate;
|
10468 | }
|
10469 | }
|
10470 |
|
10471 |
|
10472 |
|
10473 |
|
10474 |
|
10475 |
|
10476 |
|
10477 |
|
10478 |
|
10479 |
|
10480 | function isFallbackCompositionStart(topLevelType, nativeEvent) {
|
10481 | return topLevelType === TOP_KEY_DOWN && nativeEvent.keyCode === START_KEYCODE;
|
10482 | }
|
10483 |
|
10484 |
|
10485 |
|
10486 |
|
10487 |
|
10488 |
|
10489 |
|
10490 |
|
10491 |
|
10492 | function isFallbackCompositionEnd(topLevelType, nativeEvent) {
|
10493 | switch (topLevelType) {
|
10494 | case TOP_KEY_UP:
|
10495 |
|
10496 | return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
|
10497 |
|
10498 | case TOP_KEY_DOWN:
|
10499 |
|
10500 |
|
10501 | return nativeEvent.keyCode !== START_KEYCODE;
|
10502 |
|
10503 | case TOP_KEY_PRESS:
|
10504 | case TOP_MOUSE_DOWN:
|
10505 | case TOP_BLUR:
|
10506 |
|
10507 | return true;
|
10508 |
|
10509 | default:
|
10510 | return false;
|
10511 | }
|
10512 | }
|
10513 |
|
10514 |
|
10515 |
|
10516 |
|
10517 |
|
10518 |
|
10519 |
|
10520 |
|
10521 |
|
10522 |
|
10523 |
|
10524 | function getDataFromCustomEvent(nativeEvent) {
|
10525 | var detail = nativeEvent.detail;
|
10526 |
|
10527 | if (typeof detail === 'object' && 'data' in detail) {
|
10528 | return detail.data;
|
10529 | }
|
10530 |
|
10531 | return null;
|
10532 | }
|
10533 |
|
10534 |
|
10535 |
|
10536 |
|
10537 |
|
10538 |
|
10539 |
|
10540 |
|
10541 |
|
10542 |
|
10543 |
|
10544 |
|
10545 | function isUsingKoreanIME(nativeEvent) {
|
10546 | return nativeEvent.locale === 'ko';
|
10547 | }
|
10548 |
|
10549 |
|
10550 | var isComposing = false;
|
10551 |
|
10552 |
|
10553 |
|
10554 |
|
10555 | function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
|
10556 | var eventType;
|
10557 | var fallbackData;
|
10558 |
|
10559 | if (canUseCompositionEvent) {
|
10560 | eventType = getCompositionEventType(topLevelType);
|
10561 | } else if (!isComposing) {
|
10562 | if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
|
10563 | eventType = eventTypes$1.compositionStart;
|
10564 | }
|
10565 | } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
|
10566 | eventType = eventTypes$1.compositionEnd;
|
10567 | }
|
10568 |
|
10569 | if (!eventType) {
|
10570 | return null;
|
10571 | }
|
10572 |
|
10573 | if (useFallbackCompositionData && !isUsingKoreanIME(nativeEvent)) {
|
10574 |
|
10575 |
|
10576 | if (!isComposing && eventType === eventTypes$1.compositionStart) {
|
10577 | isComposing = initialize(nativeEventTarget);
|
10578 | } else if (eventType === eventTypes$1.compositionEnd) {
|
10579 | if (isComposing) {
|
10580 | fallbackData = getData();
|
10581 | }
|
10582 | }
|
10583 | }
|
10584 |
|
10585 | var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget);
|
10586 |
|
10587 | if (fallbackData) {
|
10588 |
|
10589 |
|
10590 | event.data = fallbackData;
|
10591 | } else {
|
10592 | var customData = getDataFromCustomEvent(nativeEvent);
|
10593 |
|
10594 | if (customData !== null) {
|
10595 | event.data = customData;
|
10596 | }
|
10597 | }
|
10598 |
|
10599 | accumulateTwoPhaseDispatches(event);
|
10600 | return event;
|
10601 | }
|
10602 |
|
10603 |
|
10604 |
|
10605 |
|
10606 |
|
10607 |
|
10608 |
|
10609 | function getNativeBeforeInputChars(topLevelType, nativeEvent) {
|
10610 | switch (topLevelType) {
|
10611 | case TOP_COMPOSITION_END:
|
10612 | return getDataFromCustomEvent(nativeEvent);
|
10613 |
|
10614 | case TOP_KEY_PRESS:
|
10615 | |
10616 |
|
10617 |
|
10618 |
|
10619 |
|
10620 |
|
10621 |
|
10622 |
|
10623 |
|
10624 |
|
10625 |
|
10626 |
|
10627 |
|
10628 |
|
10629 | var which = nativeEvent.which;
|
10630 |
|
10631 | if (which !== SPACEBAR_CODE) {
|
10632 | return null;
|
10633 | }
|
10634 |
|
10635 | hasSpaceKeypress = true;
|
10636 | return SPACEBAR_CHAR;
|
10637 |
|
10638 | case TOP_TEXT_INPUT:
|
10639 |
|
10640 | var chars = nativeEvent.data;
|
10641 |
|
10642 |
|
10643 |
|
10644 | if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
|
10645 | return null;
|
10646 | }
|
10647 |
|
10648 | return chars;
|
10649 |
|
10650 | default:
|
10651 |
|
10652 | return null;
|
10653 | }
|
10654 | }
|
10655 |
|
10656 |
|
10657 |
|
10658 |
|
10659 |
|
10660 |
|
10661 |
|
10662 |
|
10663 |
|
10664 |
|
10665 | function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
|
10666 |
|
10667 |
|
10668 |
|
10669 |
|
10670 | if (isComposing) {
|
10671 | if (topLevelType === TOP_COMPOSITION_END || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) {
|
10672 | var chars = getData();
|
10673 | reset();
|
10674 | isComposing = false;
|
10675 | return chars;
|
10676 | }
|
10677 |
|
10678 | return null;
|
10679 | }
|
10680 |
|
10681 | switch (topLevelType) {
|
10682 | case TOP_PASTE:
|
10683 |
|
10684 |
|
10685 | return null;
|
10686 |
|
10687 | case TOP_KEY_PRESS:
|
10688 | |
10689 |
|
10690 |
|
10691 |
|
10692 |
|
10693 |
|
10694 |
|
10695 |
|
10696 |
|
10697 |
|
10698 |
|
10699 |
|
10700 |
|
10701 |
|
10702 |
|
10703 |
|
10704 | if (!isKeypressCommand(nativeEvent)) {
|
10705 |
|
10706 |
|
10707 |
|
10708 |
|
10709 |
|
10710 |
|
10711 | if (nativeEvent.char && nativeEvent.char.length > 1) {
|
10712 | return nativeEvent.char;
|
10713 | } else if (nativeEvent.which) {
|
10714 | return String.fromCharCode(nativeEvent.which);
|
10715 | }
|
10716 | }
|
10717 |
|
10718 | return null;
|
10719 |
|
10720 | case TOP_COMPOSITION_END:
|
10721 | return useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) ? null : nativeEvent.data;
|
10722 |
|
10723 | default:
|
10724 | return null;
|
10725 | }
|
10726 | }
|
10727 |
|
10728 |
|
10729 |
|
10730 |
|
10731 |
|
10732 |
|
10733 |
|
10734 |
|
10735 | function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
|
10736 | var chars;
|
10737 |
|
10738 | if (canUseTextInputEvent) {
|
10739 | chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
|
10740 | } else {
|
10741 | chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
|
10742 | }
|
10743 |
|
10744 |
|
10745 |
|
10746 | if (!chars) {
|
10747 | return null;
|
10748 | }
|
10749 |
|
10750 | var event = SyntheticInputEvent.getPooled(eventTypes$1.beforeInput, targetInst, nativeEvent, nativeEventTarget);
|
10751 | event.data = chars;
|
10752 | accumulateTwoPhaseDispatches(event);
|
10753 | return event;
|
10754 | }
|
10755 |
|
10756 |
|
10757 |
|
10758 |
|
10759 |
|
10760 |
|
10761 |
|
10762 |
|
10763 |
|
10764 |
|
10765 |
|
10766 |
|
10767 |
|
10768 |
|
10769 |
|
10770 |
|
10771 |
|
10772 |
|
10773 |
|
10774 |
|
10775 | var BeforeInputEventPlugin = {
|
10776 | eventTypes: eventTypes$1,
|
10777 | extractEvents: function (topLevelType, eventSystemFlags, targetInst, nativeEvent, nativeEventTarget) {
|
10778 | var composition = extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget);
|
10779 | var beforeInput = extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget);
|
10780 |
|
10781 | if (composition === null) {
|
10782 | return beforeInput;
|
10783 | }
|
10784 |
|
10785 | if (beforeInput === null) {
|
10786 | return composition;
|
10787 | }
|
10788 |
|
10789 | return [composition, beforeInput];
|
10790 | }
|
10791 | };
|
10792 |
|
10793 |
|
10794 |
|
10795 |
|
10796 | var supportedInputTypes = {
|
10797 | color: true,
|
10798 | date: true,
|
10799 | datetime: true,
|
10800 | 'datetime-local': true,
|
10801 | email: true,
|
10802 | month: true,
|
10803 | number: true,
|
10804 | password: true,
|
10805 | range: true,
|
10806 | search: true,
|
10807 | tel: true,
|
10808 | text: true,
|
10809 | time: true,
|
10810 | url: true,
|
10811 | week: true
|
10812 | };
|
10813 |
|
10814 | function isTextInputElement(elem) {
|
10815 | var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
|
10816 |
|
10817 | if (nodeName === 'input') {
|
10818 | return !!supportedInputTypes[elem.type];
|
10819 | }
|
10820 |
|
10821 | if (nodeName === 'textarea') {
|
10822 | return true;
|
10823 | }
|
10824 |
|
10825 | return false;
|
10826 | }
|
10827 |
|
10828 | var eventTypes$2 = {
|
10829 | change: {
|
10830 | phasedRegistrationNames: {
|
10831 | bubbled: 'onChange',
|
10832 | captured: 'onChangeCapture'
|
10833 | },
|
10834 | dependencies: [TOP_BLUR, TOP_CHANGE, TOP_CLICK, TOP_FOCUS, TOP_INPUT, TOP_KEY_DOWN, TOP_KEY_UP, TOP_SELECTION_CHANGE]
|
10835 | }
|
10836 | };
|
10837 |
|
10838 | function createAndAccumulateChangeEvent(inst, nativeEvent, target) {
|
10839 | var event = SyntheticEvent.getPooled(eventTypes$2.change, inst, nativeEvent, target);
|
10840 | event.type = 'change';
|
10841 |
|
10842 | enqueueStateRestore(target);
|
10843 | accumulateTwoPhaseDispatches(event);
|
10844 | return event;
|
10845 | }
|
10846 |
|
10847 |
|
10848 |
|
10849 |
|
10850 |
|
10851 | var activeElement = null;
|
10852 | var activeElementInst = null;
|
10853 |
|
10854 |
|
10855 |
|
10856 |
|
10857 | function shouldUseChangeEvent(elem) {
|
10858 | var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
|
10859 | return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
|
10860 | }
|
10861 |
|
10862 | function manualDispatchChangeEvent(nativeEvent) {
|
10863 | var event = createAndAccumulateChangeEvent(activeElementInst, nativeEvent, getEventTarget(nativeEvent));
|
10864 |
|
10865 |
|
10866 |
|
10867 |
|
10868 |
|
10869 |
|
10870 |
|
10871 |
|
10872 |
|
10873 |
|
10874 |
|
10875 | batchedUpdates(runEventInBatch, event);
|
10876 | }
|
10877 |
|
10878 | function runEventInBatch(event) {
|
10879 | runEventsInBatch(event);
|
10880 | }
|
10881 |
|
10882 | function getInstIfValueChanged(targetInst) {
|
10883 | var targetNode = getNodeFromInstance$1(targetInst);
|
10884 |
|
10885 | if (updateValueIfChanged(targetNode)) {
|
10886 | return targetInst;
|
10887 | }
|
10888 | }
|
10889 |
|
10890 | function getTargetInstForChangeEvent(topLevelType, targetInst) {
|
10891 | if (topLevelType === TOP_CHANGE) {
|
10892 | return targetInst;
|
10893 | }
|
10894 | }
|
10895 |
|
10896 |
|
10897 |
|
10898 |
|
10899 |
|
10900 | var isInputEventSupported = false;
|
10901 |
|
10902 | if (canUseDOM) {
|
10903 |
|
10904 |
|
10905 | isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 9);
|
10906 | }
|
10907 |
|
10908 |
|
10909 |
|
10910 |
|
10911 |
|
10912 |
|
10913 |
|
10914 | function startWatchingForValueChange(target, targetInst) {
|
10915 | activeElement = target;
|
10916 | activeElementInst = targetInst;
|
10917 | activeElement.attachEvent('onpropertychange', handlePropertyChange);
|
10918 | }
|
10919 |
|
10920 |
|
10921 |
|
10922 |
|
10923 |
|
10924 |
|
10925 | function stopWatchingForValueChange() {
|
10926 | if (!activeElement) {
|
10927 | return;
|
10928 | }
|
10929 |
|
10930 | activeElement.detachEvent('onpropertychange', handlePropertyChange);
|
10931 | activeElement = null;
|
10932 | activeElementInst = null;
|
10933 | }
|
10934 |
|
10935 |
|
10936 |
|
10937 |
|
10938 |
|
10939 |
|
10940 | function handlePropertyChange(nativeEvent) {
|
10941 | if (nativeEvent.propertyName !== 'value') {
|
10942 | return;
|
10943 | }
|
10944 |
|
10945 | if (getInstIfValueChanged(activeElementInst)) {
|
10946 | manualDispatchChangeEvent(nativeEvent);
|
10947 | }
|
10948 | }
|
10949 |
|
10950 | function handleEventsForInputEventPolyfill(topLevelType, target, targetInst) {
|
10951 | if (topLevelType === TOP_FOCUS) {
|
10952 |
|
10953 |
|
10954 |
|
10955 |
|
10956 |
|
10957 |
|
10958 |
|
10959 |
|
10960 |
|
10961 |
|
10962 | stopWatchingForValueChange();
|
10963 | startWatchingForValueChange(target, targetInst);
|
10964 | } else if (topLevelType === TOP_BLUR) {
|
10965 | stopWatchingForValueChange();
|
10966 | }
|
10967 | }
|
10968 |
|
10969 |
|
10970 | function getTargetInstForInputEventPolyfill(topLevelType, targetInst) {
|
10971 | if (topLevelType === TOP_SELECTION_CHANGE || topLevelType === TOP_KEY_UP || topLevelType === TOP_KEY_DOWN) {
|
10972 |
|
10973 |
|
10974 |
|
10975 |
|
10976 |
|
10977 |
|
10978 |
|
10979 |
|
10980 |
|
10981 |
|
10982 | return getInstIfValueChanged(activeElementInst);
|
10983 | }
|
10984 | }
|
10985 |
|
10986 |
|
10987 |
|
10988 |
|
10989 |
|
10990 | function shouldUseClickEvent(elem) {
|
10991 |
|
10992 |
|
10993 |
|
10994 | var nodeName = elem.nodeName;
|
10995 | return nodeName && nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
|
10996 | }
|
10997 |
|
10998 | function getTargetInstForClickEvent(topLevelType, targetInst) {
|
10999 | if (topLevelType === TOP_CLICK) {
|
11000 | return getInstIfValueChanged(targetInst);
|
11001 | }
|
11002 | }
|
11003 |
|
11004 | function getTargetInstForInputOrChangeEvent(topLevelType, targetInst) {
|
11005 | if (topLevelType === TOP_INPUT || topLevelType === TOP_CHANGE) {
|
11006 | return getInstIfValueChanged(targetInst);
|
11007 | }
|
11008 | }
|
11009 |
|
11010 | function handleControlledInputBlur(node) {
|
11011 | var state = node._wrapperState;
|
11012 |
|
11013 | if (!state || !state.controlled || node.type !== 'number') {
|
11014 | return;
|
11015 | }
|
11016 |
|
11017 | if (!disableInputAttributeSyncing) {
|
11018 |
|
11019 | setDefaultValue(node, 'number', node.value);
|
11020 | }
|
11021 | }
|
11022 |
|
11023 |
|
11024 |
|
11025 |
|
11026 |
|
11027 |
|
11028 |
|
11029 |
|
11030 |
|
11031 |
|
11032 |
|
11033 |
|
11034 | var ChangeEventPlugin = {
|
11035 | eventTypes: eventTypes$2,
|
11036 | _isInputEventSupported: isInputEventSupported,
|
11037 | extractEvents: function (topLevelType, eventSystemFlags, targetInst, nativeEvent, nativeEventTarget) {
|
11038 | var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window;
|
11039 | var getTargetInstFunc, handleEventFunc;
|
11040 |
|
11041 | if (shouldUseChangeEvent(targetNode)) {
|
11042 | getTargetInstFunc = getTargetInstForChangeEvent;
|
11043 | } else if (isTextInputElement(targetNode)) {
|
11044 | if (isInputEventSupported) {
|
11045 | getTargetInstFunc = getTargetInstForInputOrChangeEvent;
|
11046 | } else {
|
11047 | getTargetInstFunc = getTargetInstForInputEventPolyfill;
|
11048 | handleEventFunc = handleEventsForInputEventPolyfill;
|
11049 | }
|
11050 | } else if (shouldUseClickEvent(targetNode)) {
|
11051 | getTargetInstFunc = getTargetInstForClickEvent;
|
11052 | }
|
11053 |
|
11054 | if (getTargetInstFunc) {
|
11055 | var inst = getTargetInstFunc(topLevelType, targetInst);
|
11056 |
|
11057 | if (inst) {
|
11058 | var event = createAndAccumulateChangeEvent(inst, nativeEvent, nativeEventTarget);
|
11059 | return event;
|
11060 | }
|
11061 | }
|
11062 |
|
11063 | if (handleEventFunc) {
|
11064 | handleEventFunc(topLevelType, targetNode, targetInst);
|
11065 | }
|
11066 |
|
11067 |
|
11068 | if (topLevelType === TOP_BLUR) {
|
11069 | handleControlledInputBlur(targetNode);
|
11070 | }
|
11071 | }
|
11072 | };
|
11073 |
|
11074 |
|
11075 |
|
11076 |
|
11077 |
|
11078 |
|
11079 |
|
11080 |
|
11081 |
|
11082 |
|
11083 | var DOMEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin'];
|
11084 |
|
11085 | var eventTypes$3 = {
|
11086 | mouseEnter: {
|
11087 | registrationName: 'onMouseEnter',
|
11088 | dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER]
|
11089 | },
|
11090 | mouseLeave: {
|
11091 | registrationName: 'onMouseLeave',
|
11092 | dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER]
|
11093 | },
|
11094 | pointerEnter: {
|
11095 | registrationName: 'onPointerEnter',
|
11096 | dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER]
|
11097 | },
|
11098 | pointerLeave: {
|
11099 | registrationName: 'onPointerLeave',
|
11100 | dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER]
|
11101 | }
|
11102 | };
|
11103 | var EnterLeaveEventPlugin = {
|
11104 | eventTypes: eventTypes$3,
|
11105 |
|
11106 | |
11107 |
|
11108 |
|
11109 |
|
11110 |
|
11111 |
|
11112 |
|
11113 | extractEvents: function (topLevelType, eventSystemFlags, targetInst, nativeEvent, nativeEventTarget) {
|
11114 | var isOverEvent = topLevelType === TOP_MOUSE_OVER || topLevelType === TOP_POINTER_OVER;
|
11115 | var isOutEvent = topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_POINTER_OUT;
|
11116 |
|
11117 | if (isOverEvent && (eventSystemFlags & IS_REPLAYED) === 0 && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
|
11118 |
|
11119 |
|
11120 |
|
11121 |
|
11122 | return null;
|
11123 | }
|
11124 |
|
11125 | if (!isOutEvent && !isOverEvent) {
|
11126 |
|
11127 | return null;
|
11128 | }
|
11129 |
|
11130 | var win;
|
11131 |
|
11132 | if (nativeEventTarget.window === nativeEventTarget) {
|
11133 |
|
11134 | win = nativeEventTarget;
|
11135 | } else {
|
11136 |
|
11137 | var doc = nativeEventTarget.ownerDocument;
|
11138 |
|
11139 | if (doc) {
|
11140 | win = doc.defaultView || doc.parentWindow;
|
11141 | } else {
|
11142 | win = window;
|
11143 | }
|
11144 | }
|
11145 |
|
11146 | var from;
|
11147 | var to;
|
11148 |
|
11149 | if (isOutEvent) {
|
11150 | from = targetInst;
|
11151 | var related = nativeEvent.relatedTarget || nativeEvent.toElement;
|
11152 | to = related ? getClosestInstanceFromNode(related) : null;
|
11153 |
|
11154 | if (to !== null) {
|
11155 | var nearestMounted = getNearestMountedFiber(to);
|
11156 |
|
11157 | if (to !== nearestMounted || to.tag !== HostComponent && to.tag !== HostText) {
|
11158 | to = null;
|
11159 | }
|
11160 | }
|
11161 | } else {
|
11162 |
|
11163 | from = null;
|
11164 | to = targetInst;
|
11165 | }
|
11166 |
|
11167 | if (from === to) {
|
11168 |
|
11169 | return null;
|
11170 | }
|
11171 |
|
11172 | var eventInterface, leaveEventType, enterEventType, eventTypePrefix;
|
11173 |
|
11174 | if (topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_MOUSE_OVER) {
|
11175 | eventInterface = SyntheticMouseEvent;
|
11176 | leaveEventType = eventTypes$3.mouseLeave;
|
11177 | enterEventType = eventTypes$3.mouseEnter;
|
11178 | eventTypePrefix = 'mouse';
|
11179 | } else if (topLevelType === TOP_POINTER_OUT || topLevelType === TOP_POINTER_OVER) {
|
11180 | eventInterface = SyntheticPointerEvent;
|
11181 | leaveEventType = eventTypes$3.pointerLeave;
|
11182 | enterEventType = eventTypes$3.pointerEnter;
|
11183 | eventTypePrefix = 'pointer';
|
11184 | }
|
11185 |
|
11186 | var fromNode = from == null ? win : getNodeFromInstance$1(from);
|
11187 | var toNode = to == null ? win : getNodeFromInstance$1(to);
|
11188 | var leave = eventInterface.getPooled(leaveEventType, from, nativeEvent, nativeEventTarget);
|
11189 | leave.type = eventTypePrefix + 'leave';
|
11190 | leave.target = fromNode;
|
11191 | leave.relatedTarget = toNode;
|
11192 | var enter = eventInterface.getPooled(enterEventType, to, nativeEvent, nativeEventTarget);
|
11193 | enter.type = eventTypePrefix + 'enter';
|
11194 | enter.target = toNode;
|
11195 | enter.relatedTarget = fromNode;
|
11196 | accumulateEnterLeaveDispatches(leave, enter, from, to);
|
11197 | return [leave, enter];
|
11198 | }
|
11199 | };
|
11200 |
|
11201 |
|
11202 |
|
11203 |
|
11204 |
|
11205 | function is(x, y) {
|
11206 | return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y
|
11207 | ;
|
11208 | }
|
11209 |
|
11210 | var is$1 = typeof Object.is === 'function' ? Object.is : is;
|
11211 |
|
11212 | var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
11213 |
|
11214 |
|
11215 |
|
11216 |
|
11217 |
|
11218 |
|
11219 | function shallowEqual(objA, objB) {
|
11220 | if (is$1(objA, objB)) {
|
11221 | return true;
|
11222 | }
|
11223 |
|
11224 | if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
|
11225 | return false;
|
11226 | }
|
11227 |
|
11228 | var keysA = Object.keys(objA);
|
11229 | var keysB = Object.keys(objB);
|
11230 |
|
11231 | if (keysA.length !== keysB.length) {
|
11232 | return false;
|
11233 | }
|
11234 |
|
11235 |
|
11236 | for (var i = 0; i < keysA.length; i++) {
|
11237 | if (!hasOwnProperty$2.call(objB, keysA[i]) || !is$1(objA[keysA[i]], objB[keysA[i]])) {
|
11238 | return false;
|
11239 | }
|
11240 | }
|
11241 |
|
11242 | return true;
|
11243 | }
|
11244 |
|
11245 | var skipSelectionChangeEvent = canUseDOM && 'documentMode' in document && document.documentMode <= 11;
|
11246 | var eventTypes$4 = {
|
11247 | select: {
|
11248 | phasedRegistrationNames: {
|
11249 | bubbled: 'onSelect',
|
11250 | captured: 'onSelectCapture'
|
11251 | },
|
11252 | dependencies: [TOP_BLUR, TOP_CONTEXT_MENU, TOP_DRAG_END, TOP_FOCUS, TOP_KEY_DOWN, TOP_KEY_UP, TOP_MOUSE_DOWN, TOP_MOUSE_UP, TOP_SELECTION_CHANGE]
|
11253 | }
|
11254 | };
|
11255 | var activeElement$1 = null;
|
11256 | var activeElementInst$1 = null;
|
11257 | var lastSelection = null;
|
11258 | var mouseDown = false;
|
11259 |
|
11260 |
|
11261 |
|
11262 |
|
11263 |
|
11264 |
|
11265 |
|
11266 |
|
11267 |
|
11268 |
|
11269 | function getSelection$1(node) {
|
11270 | if ('selectionStart' in node && hasSelectionCapabilities(node)) {
|
11271 | return {
|
11272 | start: node.selectionStart,
|
11273 | end: node.selectionEnd
|
11274 | };
|
11275 | } else {
|
11276 | var win = node.ownerDocument && node.ownerDocument.defaultView || window;
|
11277 | var selection = win.getSelection();
|
11278 | return {
|
11279 | anchorNode: selection.anchorNode,
|
11280 | anchorOffset: selection.anchorOffset,
|
11281 | focusNode: selection.focusNode,
|
11282 | focusOffset: selection.focusOffset
|
11283 | };
|
11284 | }
|
11285 | }
|
11286 |
|
11287 |
|
11288 |
|
11289 |
|
11290 |
|
11291 |
|
11292 |
|
11293 |
|
11294 | function getEventTargetDocument(eventTarget) {
|
11295 | return eventTarget.window === eventTarget ? eventTarget.document : eventTarget.nodeType === DOCUMENT_NODE ? eventTarget : eventTarget.ownerDocument;
|
11296 | }
|
11297 |
|
11298 |
|
11299 |
|
11300 |
|
11301 |
|
11302 |
|
11303 |
|
11304 |
|
11305 |
|
11306 | function constructSelectEvent(nativeEvent, nativeEventTarget) {
|
11307 |
|
11308 |
|
11309 |
|
11310 |
|
11311 | var doc = getEventTargetDocument(nativeEventTarget);
|
11312 |
|
11313 | if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement(doc)) {
|
11314 | return null;
|
11315 | }
|
11316 |
|
11317 |
|
11318 | var currentSelection = getSelection$1(activeElement$1);
|
11319 |
|
11320 | if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
|
11321 | lastSelection = currentSelection;
|
11322 | var syntheticEvent = SyntheticEvent.getPooled(eventTypes$4.select, activeElementInst$1, nativeEvent, nativeEventTarget);
|
11323 | syntheticEvent.type = 'select';
|
11324 | syntheticEvent.target = activeElement$1;
|
11325 | accumulateTwoPhaseDispatches(syntheticEvent);
|
11326 | return syntheticEvent;
|
11327 | }
|
11328 |
|
11329 | return null;
|
11330 | }
|
11331 |
|
11332 |
|
11333 |
|
11334 |
|
11335 |
|
11336 |
|
11337 |
|
11338 |
|
11339 |
|
11340 |
|
11341 |
|
11342 |
|
11343 |
|
11344 |
|
11345 |
|
11346 |
|
11347 | var SelectEventPlugin = {
|
11348 | eventTypes: eventTypes$4,
|
11349 | extractEvents: function (topLevelType, eventSystemFlags, targetInst, nativeEvent, nativeEventTarget) {
|
11350 | var doc = getEventTargetDocument(nativeEventTarget);
|
11351 |
|
11352 |
|
11353 | if (!doc || !isListeningToAllDependencies('onSelect', doc)) {
|
11354 | return null;
|
11355 | }
|
11356 |
|
11357 | var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window;
|
11358 |
|
11359 | switch (topLevelType) {
|
11360 |
|
11361 | case TOP_FOCUS:
|
11362 | if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') {
|
11363 | activeElement$1 = targetNode;
|
11364 | activeElementInst$1 = targetInst;
|
11365 | lastSelection = null;
|
11366 | }
|
11367 |
|
11368 | break;
|
11369 |
|
11370 | case TOP_BLUR:
|
11371 | activeElement$1 = null;
|
11372 | activeElementInst$1 = null;
|
11373 | lastSelection = null;
|
11374 | break;
|
11375 |
|
11376 |
|
11377 |
|
11378 | case TOP_MOUSE_DOWN:
|
11379 | mouseDown = true;
|
11380 | break;
|
11381 |
|
11382 | case TOP_CONTEXT_MENU:
|
11383 | case TOP_MOUSE_UP:
|
11384 | case TOP_DRAG_END:
|
11385 | mouseDown = false;
|
11386 | return constructSelectEvent(nativeEvent, nativeEventTarget);
|
11387 |
|
11388 |
|
11389 |
|
11390 |
|
11391 |
|
11392 |
|
11393 |
|
11394 |
|
11395 |
|
11396 |
|
11397 | case TOP_SELECTION_CHANGE:
|
11398 | if (skipSelectionChangeEvent) {
|
11399 | break;
|
11400 | }
|
11401 |
|
11402 |
|
11403 |
|
11404 | case TOP_KEY_DOWN:
|
11405 | case TOP_KEY_UP:
|
11406 | return constructSelectEvent(nativeEvent, nativeEventTarget);
|
11407 | }
|
11408 |
|
11409 | return null;
|
11410 | }
|
11411 | };
|
11412 |
|
11413 |
|
11414 |
|
11415 |
|
11416 |
|
11417 | injection.injectEventPluginOrder(DOMEventPluginOrder);
|
11418 | setComponentTree(getFiberCurrentPropsFromNode$1, getInstanceFromNode$1, getNodeFromInstance$1);
|
11419 |
|
11420 |
|
11421 |
|
11422 |
|
11423 |
|
11424 | injection.injectEventPluginsByName({
|
11425 | SimpleEventPlugin: SimpleEventPlugin,
|
11426 | EnterLeaveEventPlugin: EnterLeaveEventPlugin,
|
11427 | ChangeEventPlugin: ChangeEventPlugin,
|
11428 | SelectEventPlugin: SelectEventPlugin,
|
11429 | BeforeInputEventPlugin: BeforeInputEventPlugin
|
11430 | });
|
11431 |
|
11432 |
|
11433 |
|
11434 | var reactEmoji = "\u269B";
|
11435 | var warningEmoji = "\u26D4";
|
11436 | var supportsUserTiming = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';
|
11437 |
|
11438 |
|
11439 | var currentFiber = null;
|
11440 |
|
11441 |
|
11442 |
|
11443 |
|
11444 | var currentPhase = null;
|
11445 | var currentPhaseFiber = null;
|
11446 |
|
11447 |
|
11448 |
|
11449 | var isCommitting = false;
|
11450 | var hasScheduledUpdateInCurrentCommit = false;
|
11451 | var hasScheduledUpdateInCurrentPhase = false;
|
11452 | var commitCountInCurrentWorkLoop = 0;
|
11453 | var effectCountInCurrentCommit = 0;
|
11454 |
|
11455 |
|
11456 | var labelsInCurrentCommit = new Set();
|
11457 |
|
11458 | var formatMarkName = function (markName) {
|
11459 | return reactEmoji + " " + markName;
|
11460 | };
|
11461 |
|
11462 | var formatLabel = function (label, warning) {
|
11463 | var prefix = warning ? warningEmoji + " " : reactEmoji + " ";
|
11464 | var suffix = warning ? " Warning: " + warning : '';
|
11465 | return "" + prefix + label + suffix;
|
11466 | };
|
11467 |
|
11468 | var beginMark = function (markName) {
|
11469 | performance.mark(formatMarkName(markName));
|
11470 | };
|
11471 |
|
11472 | var clearMark = function (markName) {
|
11473 | performance.clearMarks(formatMarkName(markName));
|
11474 | };
|
11475 |
|
11476 | var endMark = function (label, markName, warning) {
|
11477 | var formattedMarkName = formatMarkName(markName);
|
11478 | var formattedLabel = formatLabel(label, warning);
|
11479 |
|
11480 | try {
|
11481 | performance.measure(formattedLabel, formattedMarkName);
|
11482 | } catch (err) {}
|
11483 |
|
11484 |
|
11485 |
|
11486 |
|
11487 |
|
11488 | performance.clearMarks(formattedMarkName);
|
11489 | performance.clearMeasures(formattedLabel);
|
11490 | };
|
11491 |
|
11492 | var getFiberMarkName = function (label, debugID) {
|
11493 | return label + " (#" + debugID + ")";
|
11494 | };
|
11495 |
|
11496 | var getFiberLabel = function (componentName, isMounted, phase) {
|
11497 | if (phase === null) {
|
11498 |
|
11499 | return componentName + " [" + (isMounted ? 'update' : 'mount') + "]";
|
11500 | } else {
|
11501 |
|
11502 | return componentName + "." + phase;
|
11503 | }
|
11504 | };
|
11505 |
|
11506 | var beginFiberMark = function (fiber, phase) {
|
11507 | var componentName = getComponentName(fiber.type) || 'Unknown';
|
11508 | var debugID = fiber._debugID;
|
11509 | var isMounted = fiber.alternate !== null;
|
11510 | var label = getFiberLabel(componentName, isMounted, phase);
|
11511 |
|
11512 | if (isCommitting && labelsInCurrentCommit.has(label)) {
|
11513 |
|
11514 |
|
11515 |
|
11516 | return false;
|
11517 | }
|
11518 |
|
11519 | labelsInCurrentCommit.add(label);
|
11520 | var markName = getFiberMarkName(label, debugID);
|
11521 | beginMark(markName);
|
11522 | return true;
|
11523 | };
|
11524 |
|
11525 | var clearFiberMark = function (fiber, phase) {
|
11526 | var componentName = getComponentName(fiber.type) || 'Unknown';
|
11527 | var debugID = fiber._debugID;
|
11528 | var isMounted = fiber.alternate !== null;
|
11529 | var label = getFiberLabel(componentName, isMounted, phase);
|
11530 | var markName = getFiberMarkName(label, debugID);
|
11531 | clearMark(markName);
|
11532 | };
|
11533 |
|
11534 | var endFiberMark = function (fiber, phase, warning) {
|
11535 | var componentName = getComponentName(fiber.type) || 'Unknown';
|
11536 | var debugID = fiber._debugID;
|
11537 | var isMounted = fiber.alternate !== null;
|
11538 | var label = getFiberLabel(componentName, isMounted, phase);
|
11539 | var markName = getFiberMarkName(label, debugID);
|
11540 | endMark(label, markName, warning);
|
11541 | };
|
11542 |
|
11543 | var shouldIgnoreFiber = function (fiber) {
|
11544 |
|
11545 |
|
11546 | switch (fiber.tag) {
|
11547 | case HostRoot:
|
11548 | case HostComponent:
|
11549 | case HostText:
|
11550 | case HostPortal:
|
11551 | case Fragment:
|
11552 | case ContextProvider:
|
11553 | case ContextConsumer:
|
11554 | case Mode:
|
11555 | return true;
|
11556 |
|
11557 | default:
|
11558 | return false;
|
11559 | }
|
11560 | };
|
11561 |
|
11562 | var clearPendingPhaseMeasurement = function () {
|
11563 | if (currentPhase !== null && currentPhaseFiber !== null) {
|
11564 | clearFiberMark(currentPhaseFiber, currentPhase);
|
11565 | }
|
11566 |
|
11567 | currentPhaseFiber = null;
|
11568 | currentPhase = null;
|
11569 | hasScheduledUpdateInCurrentPhase = false;
|
11570 | };
|
11571 |
|
11572 | var pauseTimers = function () {
|
11573 |
|
11574 |
|
11575 | var fiber = currentFiber;
|
11576 |
|
11577 | while (fiber) {
|
11578 | if (fiber._debugIsCurrentlyTiming) {
|
11579 | endFiberMark(fiber, null, null);
|
11580 | }
|
11581 |
|
11582 | fiber = fiber.return;
|
11583 | }
|
11584 | };
|
11585 |
|
11586 | var resumeTimersRecursively = function (fiber) {
|
11587 | if (fiber.return !== null) {
|
11588 | resumeTimersRecursively(fiber.return);
|
11589 | }
|
11590 |
|
11591 | if (fiber._debugIsCurrentlyTiming) {
|
11592 | beginFiberMark(fiber, null);
|
11593 | }
|
11594 | };
|
11595 |
|
11596 | var resumeTimers = function () {
|
11597 |
|
11598 | if (currentFiber !== null) {
|
11599 | resumeTimersRecursively(currentFiber);
|
11600 | }
|
11601 | };
|
11602 |
|
11603 | function recordEffect() {
|
11604 | if (enableUserTimingAPI) {
|
11605 | effectCountInCurrentCommit++;
|
11606 | }
|
11607 | }
|
11608 | function recordScheduleUpdate() {
|
11609 | if (enableUserTimingAPI) {
|
11610 | if (isCommitting) {
|
11611 | hasScheduledUpdateInCurrentCommit = true;
|
11612 | }
|
11613 |
|
11614 | if (currentPhase !== null && currentPhase !== 'componentWillMount' && currentPhase !== 'componentWillReceiveProps') {
|
11615 | hasScheduledUpdateInCurrentPhase = true;
|
11616 | }
|
11617 | }
|
11618 | }
|
11619 |
|
11620 |
|
11621 | function startWorkTimer(fiber) {
|
11622 | if (enableUserTimingAPI) {
|
11623 | if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
|
11624 | return;
|
11625 | }
|
11626 |
|
11627 |
|
11628 | currentFiber = fiber;
|
11629 |
|
11630 | if (!beginFiberMark(fiber, null)) {
|
11631 | return;
|
11632 | }
|
11633 |
|
11634 | fiber._debugIsCurrentlyTiming = true;
|
11635 | }
|
11636 | }
|
11637 | function cancelWorkTimer(fiber) {
|
11638 | if (enableUserTimingAPI) {
|
11639 | if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
|
11640 | return;
|
11641 | }
|
11642 |
|
11643 |
|
11644 |
|
11645 | fiber._debugIsCurrentlyTiming = false;
|
11646 | clearFiberMark(fiber, null);
|
11647 | }
|
11648 | }
|
11649 | function stopWorkTimer(fiber) {
|
11650 | if (enableUserTimingAPI) {
|
11651 | if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
|
11652 | return;
|
11653 | }
|
11654 |
|
11655 |
|
11656 | currentFiber = fiber.return;
|
11657 |
|
11658 | if (!fiber._debugIsCurrentlyTiming) {
|
11659 | return;
|
11660 | }
|
11661 |
|
11662 | fiber._debugIsCurrentlyTiming = false;
|
11663 | endFiberMark(fiber, null, null);
|
11664 | }
|
11665 | }
|
11666 | function stopFailedWorkTimer(fiber) {
|
11667 | if (enableUserTimingAPI) {
|
11668 | if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
|
11669 | return;
|
11670 | }
|
11671 |
|
11672 |
|
11673 | currentFiber = fiber.return;
|
11674 |
|
11675 | if (!fiber._debugIsCurrentlyTiming) {
|
11676 | return;
|
11677 | }
|
11678 |
|
11679 | fiber._debugIsCurrentlyTiming = false;
|
11680 | var warning = fiber.tag === SuspenseComponent ? 'Rendering was suspended' : 'An error was thrown inside this error boundary';
|
11681 | endFiberMark(fiber, null, warning);
|
11682 | }
|
11683 | }
|
11684 | function startPhaseTimer(fiber, phase) {
|
11685 | if (enableUserTimingAPI) {
|
11686 | if (!supportsUserTiming) {
|
11687 | return;
|
11688 | }
|
11689 |
|
11690 | clearPendingPhaseMeasurement();
|
11691 |
|
11692 | if (!beginFiberMark(fiber, phase)) {
|
11693 | return;
|
11694 | }
|
11695 |
|
11696 | currentPhaseFiber = fiber;
|
11697 | currentPhase = phase;
|
11698 | }
|
11699 | }
|
11700 | function stopPhaseTimer() {
|
11701 | if (enableUserTimingAPI) {
|
11702 | if (!supportsUserTiming) {
|
11703 | return;
|
11704 | }
|
11705 |
|
11706 | if (currentPhase !== null && currentPhaseFiber !== null) {
|
11707 | var warning = hasScheduledUpdateInCurrentPhase ? 'Scheduled a cascading update' : null;
|
11708 | endFiberMark(currentPhaseFiber, currentPhase, warning);
|
11709 | }
|
11710 |
|
11711 | currentPhase = null;
|
11712 | currentPhaseFiber = null;
|
11713 | }
|
11714 | }
|
11715 | function startWorkLoopTimer(nextUnitOfWork) {
|
11716 | if (enableUserTimingAPI) {
|
11717 | currentFiber = nextUnitOfWork;
|
11718 |
|
11719 | if (!supportsUserTiming) {
|
11720 | return;
|
11721 | }
|
11722 |
|
11723 | commitCountInCurrentWorkLoop = 0;
|
11724 |
|
11725 |
|
11726 | beginMark('(React Tree Reconciliation)');
|
11727 |
|
11728 | resumeTimers();
|
11729 | }
|
11730 | }
|
11731 | function stopWorkLoopTimer(interruptedBy, didCompleteRoot) {
|
11732 | if (enableUserTimingAPI) {
|
11733 | if (!supportsUserTiming) {
|
11734 | return;
|
11735 | }
|
11736 |
|
11737 | var warning = null;
|
11738 |
|
11739 | if (interruptedBy !== null) {
|
11740 | if (interruptedBy.tag === HostRoot) {
|
11741 | warning = 'A top-level update interrupted the previous render';
|
11742 | } else {
|
11743 | var componentName = getComponentName(interruptedBy.type) || 'Unknown';
|
11744 | warning = "An update to " + componentName + " interrupted the previous render";
|
11745 | }
|
11746 | } else if (commitCountInCurrentWorkLoop > 1) {
|
11747 | warning = 'There were cascading updates';
|
11748 | }
|
11749 |
|
11750 | commitCountInCurrentWorkLoop = 0;
|
11751 | var label = didCompleteRoot ? '(React Tree Reconciliation: Completed Root)' : '(React Tree Reconciliation: Yielded)';
|
11752 |
|
11753 | pauseTimers();
|
11754 | endMark(label, '(React Tree Reconciliation)', warning);
|
11755 | }
|
11756 | }
|
11757 | function startCommitTimer() {
|
11758 | if (enableUserTimingAPI) {
|
11759 | if (!supportsUserTiming) {
|
11760 | return;
|
11761 | }
|
11762 |
|
11763 | isCommitting = true;
|
11764 | hasScheduledUpdateInCurrentCommit = false;
|
11765 | labelsInCurrentCommit.clear();
|
11766 | beginMark('(Committing Changes)');
|
11767 | }
|
11768 | }
|
11769 | function stopCommitTimer() {
|
11770 | if (enableUserTimingAPI) {
|
11771 | if (!supportsUserTiming) {
|
11772 | return;
|
11773 | }
|
11774 |
|
11775 | var warning = null;
|
11776 |
|
11777 | if (hasScheduledUpdateInCurrentCommit) {
|
11778 | warning = 'Lifecycle hook scheduled a cascading update';
|
11779 | } else if (commitCountInCurrentWorkLoop > 0) {
|
11780 | warning = 'Caused by a cascading update in earlier commit';
|
11781 | }
|
11782 |
|
11783 | hasScheduledUpdateInCurrentCommit = false;
|
11784 | commitCountInCurrentWorkLoop++;
|
11785 | isCommitting = false;
|
11786 | labelsInCurrentCommit.clear();
|
11787 | endMark('(Committing Changes)', '(Committing Changes)', warning);
|
11788 | }
|
11789 | }
|
11790 | function startCommitSnapshotEffectsTimer() {
|
11791 | if (enableUserTimingAPI) {
|
11792 | if (!supportsUserTiming) {
|
11793 | return;
|
11794 | }
|
11795 |
|
11796 | effectCountInCurrentCommit = 0;
|
11797 | beginMark('(Committing Snapshot Effects)');
|
11798 | }
|
11799 | }
|
11800 | function stopCommitSnapshotEffectsTimer() {
|
11801 | if (enableUserTimingAPI) {
|
11802 | if (!supportsUserTiming) {
|
11803 | return;
|
11804 | }
|
11805 |
|
11806 | var count = effectCountInCurrentCommit;
|
11807 | effectCountInCurrentCommit = 0;
|
11808 | endMark("(Committing Snapshot Effects: " + count + " Total)", '(Committing Snapshot Effects)', null);
|
11809 | }
|
11810 | }
|
11811 | function startCommitHostEffectsTimer() {
|
11812 | if (enableUserTimingAPI) {
|
11813 | if (!supportsUserTiming) {
|
11814 | return;
|
11815 | }
|
11816 |
|
11817 | effectCountInCurrentCommit = 0;
|
11818 | beginMark('(Committing Host Effects)');
|
11819 | }
|
11820 | }
|
11821 | function stopCommitHostEffectsTimer() {
|
11822 | if (enableUserTimingAPI) {
|
11823 | if (!supportsUserTiming) {
|
11824 | return;
|
11825 | }
|
11826 |
|
11827 | var count = effectCountInCurrentCommit;
|
11828 | effectCountInCurrentCommit = 0;
|
11829 | endMark("(Committing Host Effects: " + count + " Total)", '(Committing Host Effects)', null);
|
11830 | }
|
11831 | }
|
11832 | function startCommitLifeCyclesTimer() {
|
11833 | if (enableUserTimingAPI) {
|
11834 | if (!supportsUserTiming) {
|
11835 | return;
|
11836 | }
|
11837 |
|
11838 | effectCountInCurrentCommit = 0;
|
11839 | beginMark('(Calling Lifecycle Methods)');
|
11840 | }
|
11841 | }
|
11842 | function stopCommitLifeCyclesTimer() {
|
11843 | if (enableUserTimingAPI) {
|
11844 | if (!supportsUserTiming) {
|
11845 | return;
|
11846 | }
|
11847 |
|
11848 | var count = effectCountInCurrentCommit;
|
11849 | effectCountInCurrentCommit = 0;
|
11850 | endMark("(Calling Lifecycle Methods: " + count + " Total)", '(Calling Lifecycle Methods)', null);
|
11851 | }
|
11852 | }
|
11853 |
|
11854 | var valueStack = [];
|
11855 | var fiberStack;
|
11856 |
|
11857 | {
|
11858 | fiberStack = [];
|
11859 | }
|
11860 |
|
11861 | var index = -1;
|
11862 |
|
11863 | function createCursor(defaultValue) {
|
11864 | return {
|
11865 | current: defaultValue
|
11866 | };
|
11867 | }
|
11868 |
|
11869 | function pop(cursor, fiber) {
|
11870 | if (index < 0) {
|
11871 | {
|
11872 | warningWithoutStack$1(false, 'Unexpected pop.');
|
11873 | }
|
11874 |
|
11875 | return;
|
11876 | }
|
11877 |
|
11878 | {
|
11879 | if (fiber !== fiberStack[index]) {
|
11880 | warningWithoutStack$1(false, 'Unexpected Fiber popped.');
|
11881 | }
|
11882 | }
|
11883 |
|
11884 | cursor.current = valueStack[index];
|
11885 | valueStack[index] = null;
|
11886 |
|
11887 | {
|
11888 | fiberStack[index] = null;
|
11889 | }
|
11890 |
|
11891 | index--;
|
11892 | }
|
11893 |
|
11894 | function push(cursor, value, fiber) {
|
11895 | index++;
|
11896 | valueStack[index] = cursor.current;
|
11897 |
|
11898 | {
|
11899 | fiberStack[index] = fiber;
|
11900 | }
|
11901 |
|
11902 | cursor.current = value;
|
11903 | }
|
11904 |
|
11905 | var warnedAboutMissingGetChildContext;
|
11906 |
|
11907 | {
|
11908 | warnedAboutMissingGetChildContext = {};
|
11909 | }
|
11910 |
|
11911 | var emptyContextObject = {};
|
11912 |
|
11913 | {
|
11914 | Object.freeze(emptyContextObject);
|
11915 | }
|
11916 |
|
11917 |
|
11918 | var contextStackCursor = createCursor(emptyContextObject);
|
11919 |
|
11920 | var didPerformWorkStackCursor = createCursor(false);
|
11921 |
|
11922 |
|
11923 |
|
11924 | var previousContext = emptyContextObject;
|
11925 |
|
11926 | function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) {
|
11927 | if (disableLegacyContext) {
|
11928 | return emptyContextObject;
|
11929 | } else {
|
11930 | if (didPushOwnContextIfProvider && isContextProvider(Component)) {
|
11931 |
|
11932 |
|
11933 |
|
11934 |
|
11935 | return previousContext;
|
11936 | }
|
11937 |
|
11938 | return contextStackCursor.current;
|
11939 | }
|
11940 | }
|
11941 |
|
11942 | function cacheContext(workInProgress, unmaskedContext, maskedContext) {
|
11943 | if (disableLegacyContext) {
|
11944 | return;
|
11945 | } else {
|
11946 | var instance = workInProgress.stateNode;
|
11947 | instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext;
|
11948 | instance.__reactInternalMemoizedMaskedChildContext = maskedContext;
|
11949 | }
|
11950 | }
|
11951 |
|
11952 | function getMaskedContext(workInProgress, unmaskedContext) {
|
11953 | if (disableLegacyContext) {
|
11954 | return emptyContextObject;
|
11955 | } else {
|
11956 | var type = workInProgress.type;
|
11957 | var contextTypes = type.contextTypes;
|
11958 |
|
11959 | if (!contextTypes) {
|
11960 | return emptyContextObject;
|
11961 | }
|
11962 |
|
11963 |
|
11964 |
|
11965 |
|
11966 | var instance = workInProgress.stateNode;
|
11967 |
|
11968 | if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) {
|
11969 | return instance.__reactInternalMemoizedMaskedChildContext;
|
11970 | }
|
11971 |
|
11972 | var context = {};
|
11973 |
|
11974 | for (var key in contextTypes) {
|
11975 | context[key] = unmaskedContext[key];
|
11976 | }
|
11977 |
|
11978 | {
|
11979 | var name = getComponentName(type) || 'Unknown';
|
11980 | checkPropTypes_1(contextTypes, context, 'context', name, getCurrentFiberStackInDev);
|
11981 | }
|
11982 |
|
11983 |
|
11984 |
|
11985 | if (instance) {
|
11986 | cacheContext(workInProgress, unmaskedContext, context);
|
11987 | }
|
11988 |
|
11989 | return context;
|
11990 | }
|
11991 | }
|
11992 |
|
11993 | function hasContextChanged() {
|
11994 | if (disableLegacyContext) {
|
11995 | return false;
|
11996 | } else {
|
11997 | return didPerformWorkStackCursor.current;
|
11998 | }
|
11999 | }
|
12000 |
|
12001 | function isContextProvider(type) {
|
12002 | if (disableLegacyContext) {
|
12003 | return false;
|
12004 | } else {
|
12005 | var childContextTypes = type.childContextTypes;
|
12006 | return childContextTypes !== null && childContextTypes !== undefined;
|
12007 | }
|
12008 | }
|
12009 |
|
12010 | function popContext(fiber) {
|
12011 | if (disableLegacyContext) {
|
12012 | return;
|
12013 | } else {
|
12014 | pop(didPerformWorkStackCursor, fiber);
|
12015 | pop(contextStackCursor, fiber);
|
12016 | }
|
12017 | }
|
12018 |
|
12019 | function popTopLevelContextObject(fiber) {
|
12020 | if (disableLegacyContext) {
|
12021 | return;
|
12022 | } else {
|
12023 | pop(didPerformWorkStackCursor, fiber);
|
12024 | pop(contextStackCursor, fiber);
|
12025 | }
|
12026 | }
|
12027 |
|
12028 | function pushTopLevelContextObject(fiber, context, didChange) {
|
12029 | if (disableLegacyContext) {
|
12030 | return;
|
12031 | } else {
|
12032 | (function () {
|
12033 | if (!(contextStackCursor.current === emptyContextObject)) {
|
12034 | {
|
12035 | throw ReactError(Error("Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue."));
|
12036 | }
|
12037 | }
|
12038 | })();
|
12039 |
|
12040 | push(contextStackCursor, context, fiber);
|
12041 | push(didPerformWorkStackCursor, didChange, fiber);
|
12042 | }
|
12043 | }
|
12044 |
|
12045 | function processChildContext(fiber, type, parentContext) {
|
12046 | if (disableLegacyContext) {
|
12047 | return parentContext;
|
12048 | } else {
|
12049 | var instance = fiber.stateNode;
|
12050 | var childContextTypes = type.childContextTypes;
|
12051 |
|
12052 |
|
12053 | if (typeof instance.getChildContext !== 'function') {
|
12054 | {
|
12055 | var componentName = getComponentName(type) || 'Unknown';
|
12056 |
|
12057 | if (!warnedAboutMissingGetChildContext[componentName]) {
|
12058 | warnedAboutMissingGetChildContext[componentName] = true;
|
12059 | warningWithoutStack$1(false, '%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName);
|
12060 | }
|
12061 | }
|
12062 |
|
12063 | return parentContext;
|
12064 | }
|
12065 |
|
12066 | var childContext;
|
12067 |
|
12068 | {
|
12069 | setCurrentPhase('getChildContext');
|
12070 | }
|
12071 |
|
12072 | startPhaseTimer(fiber, 'getChildContext');
|
12073 | childContext = instance.getChildContext();
|
12074 | stopPhaseTimer();
|
12075 |
|
12076 | {
|
12077 | setCurrentPhase(null);
|
12078 | }
|
12079 |
|
12080 | for (var contextKey in childContext) {
|
12081 | (function () {
|
12082 | if (!(contextKey in childContextTypes)) {
|
12083 | {
|
12084 | throw ReactError(Error((getComponentName(type) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes."));
|
12085 | }
|
12086 | }
|
12087 | })();
|
12088 | }
|
12089 |
|
12090 | {
|
12091 | var name = getComponentName(type) || 'Unknown';
|
12092 | checkPropTypes_1(childContextTypes, childContext, 'child context', name,
|
12093 |
|
12094 |
|
12095 |
|
12096 |
|
12097 | getCurrentFiberStackInDev);
|
12098 | }
|
12099 |
|
12100 | return _assign({}, parentContext, {}, childContext);
|
12101 | }
|
12102 | }
|
12103 |
|
12104 | function pushContextProvider(workInProgress) {
|
12105 | if (disableLegacyContext) {
|
12106 | return false;
|
12107 | } else {
|
12108 | var instance = workInProgress.stateNode;
|
12109 |
|
12110 |
|
12111 |
|
12112 | var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject;
|
12113 |
|
12114 |
|
12115 | previousContext = contextStackCursor.current;
|
12116 | push(contextStackCursor, memoizedMergedChildContext, workInProgress);
|
12117 | push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress);
|
12118 | return true;
|
12119 | }
|
12120 | }
|
12121 |
|
12122 | function invalidateContextProvider(workInProgress, type, didChange) {
|
12123 | if (disableLegacyContext) {
|
12124 | return;
|
12125 | } else {
|
12126 | var instance = workInProgress.stateNode;
|
12127 |
|
12128 | (function () {
|
12129 | if (!instance) {
|
12130 | {
|
12131 | throw ReactError(Error("Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue."));
|
12132 | }
|
12133 | }
|
12134 | })();
|
12135 |
|
12136 | if (didChange) {
|
12137 |
|
12138 |
|
12139 |
|
12140 | var mergedContext = processChildContext(workInProgress, type, previousContext);
|
12141 | instance.__reactInternalMemoizedMergedChildContext = mergedContext;
|
12142 |
|
12143 |
|
12144 | pop(didPerformWorkStackCursor, workInProgress);
|
12145 | pop(contextStackCursor, workInProgress);
|
12146 |
|
12147 | push(contextStackCursor, mergedContext, workInProgress);
|
12148 | push(didPerformWorkStackCursor, didChange, workInProgress);
|
12149 | } else {
|
12150 | pop(didPerformWorkStackCursor, workInProgress);
|
12151 | push(didPerformWorkStackCursor, didChange, workInProgress);
|
12152 | }
|
12153 | }
|
12154 | }
|
12155 |
|
12156 | function findCurrentUnmaskedContext(fiber) {
|
12157 | if (disableLegacyContext) {
|
12158 | return emptyContextObject;
|
12159 | } else {
|
12160 |
|
12161 |
|
12162 | (function () {
|
12163 | if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) {
|
12164 | {
|
12165 | throw ReactError(Error("Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue."));
|
12166 | }
|
12167 | }
|
12168 | })();
|
12169 |
|
12170 | var node = fiber;
|
12171 |
|
12172 | do {
|
12173 | switch (node.tag) {
|
12174 | case HostRoot:
|
12175 | return node.stateNode.context;
|
12176 |
|
12177 | case ClassComponent:
|
12178 | {
|
12179 | var Component = node.type;
|
12180 |
|
12181 | if (isContextProvider(Component)) {
|
12182 | return node.stateNode.__reactInternalMemoizedMergedChildContext;
|
12183 | }
|
12184 |
|
12185 | break;
|
12186 | }
|
12187 | }
|
12188 |
|
12189 | node = node.return;
|
12190 | } while (node !== null);
|
12191 |
|
12192 | (function () {
|
12193 | {
|
12194 | {
|
12195 | throw ReactError(Error("Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue."));
|
12196 | }
|
12197 | }
|
12198 | })();
|
12199 | }
|
12200 | }
|
12201 |
|
12202 | var LegacyRoot = 0;
|
12203 | var BatchedRoot = 1;
|
12204 | var ConcurrentRoot = 2;
|
12205 |
|
12206 | var ReactInternals$2 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
12207 | var _ReactInternals$Sched$1 = ReactInternals$2.SchedulerTracing;
|
12208 | var __interactionsRef = _ReactInternals$Sched$1.__interactionsRef;
|
12209 | var __subscriberRef = _ReactInternals$Sched$1.__subscriberRef;
|
12210 | var unstable_clear = _ReactInternals$Sched$1.unstable_clear;
|
12211 | var unstable_getCurrent = _ReactInternals$Sched$1.unstable_getCurrent;
|
12212 | var unstable_getThreadID = _ReactInternals$Sched$1.unstable_getThreadID;
|
12213 | var unstable_subscribe = _ReactInternals$Sched$1.unstable_subscribe;
|
12214 | var unstable_trace = _ReactInternals$Sched$1.unstable_trace;
|
12215 | var unstable_unsubscribe = _ReactInternals$Sched$1.unstable_unsubscribe;
|
12216 | var unstable_wrap = _ReactInternals$Sched$1.unstable_wrap;
|
12217 |
|
12218 |
|
12219 |
|
12220 | var Scheduler_runWithPriority = unstable_runWithPriority;
|
12221 | var Scheduler_scheduleCallback = unstable_scheduleCallback;
|
12222 | var Scheduler_cancelCallback = unstable_cancelCallback;
|
12223 | var Scheduler_shouldYield = unstable_shouldYield;
|
12224 | var Scheduler_requestPaint = unstable_requestPaint;
|
12225 | var Scheduler_now = unstable_now;
|
12226 | var Scheduler_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
|
12227 | var Scheduler_ImmediatePriority = unstable_ImmediatePriority;
|
12228 | var Scheduler_UserBlockingPriority = unstable_UserBlockingPriority;
|
12229 | var Scheduler_NormalPriority = unstable_NormalPriority;
|
12230 | var Scheduler_LowPriority = unstable_LowPriority;
|
12231 | var Scheduler_IdlePriority = unstable_IdlePriority;
|
12232 |
|
12233 | if (enableSchedulerTracing) {
|
12234 |
|
12235 |
|
12236 |
|
12237 | (function () {
|
12238 | if (!(__interactionsRef != null && __interactionsRef.current != null)) {
|
12239 | {
|
12240 | throw ReactError(Error("It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling"));
|
12241 | }
|
12242 | }
|
12243 | })();
|
12244 | }
|
12245 |
|
12246 | var fakeCallbackNode = {};
|
12247 |
|
12248 |
|
12249 |
|
12250 | var ImmediatePriority = 99;
|
12251 | var UserBlockingPriority$2 = 98;
|
12252 | var NormalPriority = 97;
|
12253 | var LowPriority = 96;
|
12254 | var IdlePriority = 95;
|
12255 |
|
12256 | var NoPriority = 90;
|
12257 | var shouldYield = Scheduler_shouldYield;
|
12258 | var requestPaint =
|
12259 | Scheduler_requestPaint !== undefined ? Scheduler_requestPaint : function () {};
|
12260 | var syncQueue = null;
|
12261 | var immediateQueueCallbackNode = null;
|
12262 | var isFlushingSyncQueue = false;
|
12263 | var initialTimeMs = Scheduler_now();
|
12264 |
|
12265 |
|
12266 |
|
12267 |
|
12268 |
|
12269 |
|
12270 |
|
12271 | var now = initialTimeMs < 10000 ? Scheduler_now : function () {
|
12272 | return Scheduler_now() - initialTimeMs;
|
12273 | };
|
12274 | function getCurrentPriorityLevel() {
|
12275 | switch (Scheduler_getCurrentPriorityLevel()) {
|
12276 | case Scheduler_ImmediatePriority:
|
12277 | return ImmediatePriority;
|
12278 |
|
12279 | case Scheduler_UserBlockingPriority:
|
12280 | return UserBlockingPriority$2;
|
12281 |
|
12282 | case Scheduler_NormalPriority:
|
12283 | return NormalPriority;
|
12284 |
|
12285 | case Scheduler_LowPriority:
|
12286 | return LowPriority;
|
12287 |
|
12288 | case Scheduler_IdlePriority:
|
12289 | return IdlePriority;
|
12290 |
|
12291 | default:
|
12292 | (function () {
|
12293 | {
|
12294 | {
|
12295 | throw ReactError(Error("Unknown priority level."));
|
12296 | }
|
12297 | }
|
12298 | })();
|
12299 |
|
12300 | }
|
12301 | }
|
12302 |
|
12303 | function reactPriorityToSchedulerPriority(reactPriorityLevel) {
|
12304 | switch (reactPriorityLevel) {
|
12305 | case ImmediatePriority:
|
12306 | return Scheduler_ImmediatePriority;
|
12307 |
|
12308 | case UserBlockingPriority$2:
|
12309 | return Scheduler_UserBlockingPriority;
|
12310 |
|
12311 | case NormalPriority:
|
12312 | return Scheduler_NormalPriority;
|
12313 |
|
12314 | case LowPriority:
|
12315 | return Scheduler_LowPriority;
|
12316 |
|
12317 | case IdlePriority:
|
12318 | return Scheduler_IdlePriority;
|
12319 |
|
12320 | default:
|
12321 | (function () {
|
12322 | {
|
12323 | {
|
12324 | throw ReactError(Error("Unknown priority level."));
|
12325 | }
|
12326 | }
|
12327 | })();
|
12328 |
|
12329 | }
|
12330 | }
|
12331 |
|
12332 | function runWithPriority$2(reactPriorityLevel, fn) {
|
12333 | var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel);
|
12334 | return Scheduler_runWithPriority(priorityLevel, fn);
|
12335 | }
|
12336 | function scheduleCallback(reactPriorityLevel, callback, options) {
|
12337 | var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel);
|
12338 | return Scheduler_scheduleCallback(priorityLevel, callback, options);
|
12339 | }
|
12340 | function scheduleSyncCallback(callback) {
|
12341 |
|
12342 |
|
12343 | if (syncQueue === null) {
|
12344 | syncQueue = [callback];
|
12345 |
|
12346 | immediateQueueCallbackNode = Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueueImpl);
|
12347 | } else {
|
12348 |
|
12349 |
|
12350 | syncQueue.push(callback);
|
12351 | }
|
12352 |
|
12353 | return fakeCallbackNode;
|
12354 | }
|
12355 | function cancelCallback(callbackNode) {
|
12356 | if (callbackNode !== fakeCallbackNode) {
|
12357 | Scheduler_cancelCallback(callbackNode);
|
12358 | }
|
12359 | }
|
12360 | function flushSyncCallbackQueue() {
|
12361 | if (immediateQueueCallbackNode !== null) {
|
12362 | var node = immediateQueueCallbackNode;
|
12363 | immediateQueueCallbackNode = null;
|
12364 | Scheduler_cancelCallback(node);
|
12365 | }
|
12366 |
|
12367 | flushSyncCallbackQueueImpl();
|
12368 | }
|
12369 |
|
12370 | function flushSyncCallbackQueueImpl() {
|
12371 | if (!isFlushingSyncQueue && syncQueue !== null) {
|
12372 |
|
12373 | isFlushingSyncQueue = true;
|
12374 | var i = 0;
|
12375 |
|
12376 | try {
|
12377 | var _isSync = true;
|
12378 | var queue = syncQueue;
|
12379 | runWithPriority$2(ImmediatePriority, function () {
|
12380 | for (; i < queue.length; i++) {
|
12381 | var callback = queue[i];
|
12382 |
|
12383 | do {
|
12384 | callback = callback(_isSync);
|
12385 | } while (callback !== null);
|
12386 | }
|
12387 | });
|
12388 | syncQueue = null;
|
12389 | } catch (error) {
|
12390 |
|
12391 | if (syncQueue !== null) {
|
12392 | syncQueue = syncQueue.slice(i + 1);
|
12393 | }
|
12394 |
|
12395 |
|
12396 | Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueue);
|
12397 | throw error;
|
12398 | } finally {
|
12399 | isFlushingSyncQueue = false;
|
12400 | }
|
12401 | }
|
12402 | }
|
12403 |
|
12404 | var NoMode = 0;
|
12405 | var StrictMode = 1;
|
12406 |
|
12407 |
|
12408 | var BatchedMode = 2;
|
12409 | var ConcurrentMode = 4;
|
12410 | var ProfileMode = 8;
|
12411 |
|
12412 |
|
12413 |
|
12414 |
|
12415 | var MAX_SIGNED_31_BIT_INT = 1073741823;
|
12416 |
|
12417 | var NoWork = 0;
|
12418 |
|
12419 |
|
12420 |
|
12421 |
|
12422 |
|
12423 |
|
12424 |
|
12425 | var Never = 1;
|
12426 |
|
12427 |
|
12428 | var Idle = 2;
|
12429 | var Sync = MAX_SIGNED_31_BIT_INT;
|
12430 | var Batched = Sync - 1;
|
12431 | var UNIT_SIZE = 10;
|
12432 | var MAGIC_NUMBER_OFFSET = Batched - 1;
|
12433 |
|
12434 | function msToExpirationTime(ms) {
|
12435 |
|
12436 | return MAGIC_NUMBER_OFFSET - (ms / UNIT_SIZE | 0);
|
12437 | }
|
12438 | function expirationTimeToMs(expirationTime) {
|
12439 | return (MAGIC_NUMBER_OFFSET - expirationTime) * UNIT_SIZE;
|
12440 | }
|
12441 |
|
12442 | function ceiling(num, precision) {
|
12443 | return ((num / precision | 0) + 1) * precision;
|
12444 | }
|
12445 |
|
12446 | function computeExpirationBucket(currentTime, expirationInMs, bucketSizeMs) {
|
12447 | return MAGIC_NUMBER_OFFSET - ceiling(MAGIC_NUMBER_OFFSET - currentTime + expirationInMs / UNIT_SIZE, bucketSizeMs / UNIT_SIZE);
|
12448 | }
|
12449 |
|
12450 |
|
12451 |
|
12452 | var LOW_PRIORITY_EXPIRATION = 5000;
|
12453 | var LOW_PRIORITY_BATCH_SIZE = 250;
|
12454 | function computeAsyncExpiration(currentTime) {
|
12455 | return computeExpirationBucket(currentTime, LOW_PRIORITY_EXPIRATION, LOW_PRIORITY_BATCH_SIZE);
|
12456 | }
|
12457 | function computeSuspenseExpiration(currentTime, timeoutMs) {
|
12458 |
|
12459 | return computeExpirationBucket(currentTime, timeoutMs, LOW_PRIORITY_BATCH_SIZE);
|
12460 | }
|
12461 |
|
12462 |
|
12463 |
|
12464 |
|
12465 |
|
12466 |
|
12467 |
|
12468 |
|
12469 |
|
12470 |
|
12471 |
|
12472 | var HIGH_PRIORITY_EXPIRATION = 500;
|
12473 | var HIGH_PRIORITY_BATCH_SIZE = 100;
|
12474 | function computeInteractiveExpiration(currentTime) {
|
12475 | return computeExpirationBucket(currentTime, HIGH_PRIORITY_EXPIRATION, HIGH_PRIORITY_BATCH_SIZE);
|
12476 | }
|
12477 | function inferPriorityFromExpirationTime(currentTime, expirationTime) {
|
12478 | if (expirationTime === Sync) {
|
12479 | return ImmediatePriority;
|
12480 | }
|
12481 |
|
12482 | if (expirationTime === Never || expirationTime === Idle) {
|
12483 | return IdlePriority;
|
12484 | }
|
12485 |
|
12486 | var msUntil = expirationTimeToMs(expirationTime) - expirationTimeToMs(currentTime);
|
12487 |
|
12488 | if (msUntil <= 0) {
|
12489 | return ImmediatePriority;
|
12490 | }
|
12491 |
|
12492 | if (msUntil <= HIGH_PRIORITY_EXPIRATION + HIGH_PRIORITY_BATCH_SIZE) {
|
12493 | return UserBlockingPriority$2;
|
12494 | }
|
12495 |
|
12496 | if (msUntil <= LOW_PRIORITY_EXPIRATION + LOW_PRIORITY_BATCH_SIZE) {
|
12497 | return NormalPriority;
|
12498 | }
|
12499 |
|
12500 |
|
12501 |
|
12502 | return IdlePriority;
|
12503 | }
|
12504 |
|
12505 |
|
12506 |
|
12507 |
|
12508 |
|
12509 |
|
12510 |
|
12511 |
|
12512 |
|
12513 |
|
12514 |
|
12515 |
|
12516 |
|
12517 |
|
12518 | var lowPriorityWarningWithoutStack = function () {};
|
12519 |
|
12520 | {
|
12521 | var printWarning$1 = function (format) {
|
12522 | for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
12523 | args[_key - 1] = arguments[_key];
|
12524 | }
|
12525 |
|
12526 | var argIndex = 0;
|
12527 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
12528 | return args[argIndex++];
|
12529 | });
|
12530 |
|
12531 | if (typeof console !== 'undefined') {
|
12532 | console.warn(message);
|
12533 | }
|
12534 |
|
12535 | try {
|
12536 |
|
12537 |
|
12538 |
|
12539 | throw new Error(message);
|
12540 | } catch (x) {}
|
12541 | };
|
12542 |
|
12543 | lowPriorityWarningWithoutStack = function (condition, format) {
|
12544 | if (format === undefined) {
|
12545 | throw new Error('`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
12546 | }
|
12547 |
|
12548 | if (!condition) {
|
12549 | for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
12550 | args[_key2 - 2] = arguments[_key2];
|
12551 | }
|
12552 |
|
12553 | printWarning$1.apply(void 0, [format].concat(args));
|
12554 | }
|
12555 | };
|
12556 | }
|
12557 |
|
12558 | var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack;
|
12559 |
|
12560 | var ReactStrictModeWarnings = {
|
12561 | recordUnsafeLifecycleWarnings: function (fiber, instance) {},
|
12562 | flushPendingUnsafeLifecycleWarnings: function () {},
|
12563 | recordLegacyContextWarning: function (fiber, instance) {},
|
12564 | flushLegacyContextWarning: function () {},
|
12565 | discardPendingWarnings: function () {}
|
12566 | };
|
12567 |
|
12568 | {
|
12569 | var findStrictRoot = function (fiber) {
|
12570 | var maybeStrictRoot = null;
|
12571 | var node = fiber;
|
12572 |
|
12573 | while (node !== null) {
|
12574 | if (node.mode & StrictMode) {
|
12575 | maybeStrictRoot = node;
|
12576 | }
|
12577 |
|
12578 | node = node.return;
|
12579 | }
|
12580 |
|
12581 | return maybeStrictRoot;
|
12582 | };
|
12583 |
|
12584 | var setToSortedString = function (set) {
|
12585 | var array = [];
|
12586 | set.forEach(function (value) {
|
12587 | array.push(value);
|
12588 | });
|
12589 | return array.sort().join(', ');
|
12590 | };
|
12591 |
|
12592 | var pendingComponentWillMountWarnings = [];
|
12593 | var pendingUNSAFE_ComponentWillMountWarnings = [];
|
12594 | var pendingComponentWillReceivePropsWarnings = [];
|
12595 | var pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
|
12596 | var pendingComponentWillUpdateWarnings = [];
|
12597 | var pendingUNSAFE_ComponentWillUpdateWarnings = [];
|
12598 |
|
12599 | var didWarnAboutUnsafeLifecycles = new Set();
|
12600 |
|
12601 | ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function (fiber, instance) {
|
12602 |
|
12603 | if (didWarnAboutUnsafeLifecycles.has(fiber.type)) {
|
12604 | return;
|
12605 | }
|
12606 |
|
12607 | if (typeof instance.componentWillMount === 'function' &&
|
12608 | instance.componentWillMount.__suppressDeprecationWarning !== true) {
|
12609 | pendingComponentWillMountWarnings.push(fiber);
|
12610 | }
|
12611 |
|
12612 | if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillMount === 'function') {
|
12613 | pendingUNSAFE_ComponentWillMountWarnings.push(fiber);
|
12614 | }
|
12615 |
|
12616 | if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
|
12617 | pendingComponentWillReceivePropsWarnings.push(fiber);
|
12618 | }
|
12619 |
|
12620 | if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
|
12621 | pendingUNSAFE_ComponentWillReceivePropsWarnings.push(fiber);
|
12622 | }
|
12623 |
|
12624 | if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
|
12625 | pendingComponentWillUpdateWarnings.push(fiber);
|
12626 | }
|
12627 |
|
12628 | if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillUpdate === 'function') {
|
12629 | pendingUNSAFE_ComponentWillUpdateWarnings.push(fiber);
|
12630 | }
|
12631 | };
|
12632 |
|
12633 | ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function () {
|
12634 |
|
12635 | var componentWillMountUniqueNames = new Set();
|
12636 |
|
12637 | if (pendingComponentWillMountWarnings.length > 0) {
|
12638 | pendingComponentWillMountWarnings.forEach(function (fiber) {
|
12639 | componentWillMountUniqueNames.add(getComponentName(fiber.type) || 'Component');
|
12640 | didWarnAboutUnsafeLifecycles.add(fiber.type);
|
12641 | });
|
12642 | pendingComponentWillMountWarnings = [];
|
12643 | }
|
12644 |
|
12645 | var UNSAFE_componentWillMountUniqueNames = new Set();
|
12646 |
|
12647 | if (pendingUNSAFE_ComponentWillMountWarnings.length > 0) {
|
12648 | pendingUNSAFE_ComponentWillMountWarnings.forEach(function (fiber) {
|
12649 | UNSAFE_componentWillMountUniqueNames.add(getComponentName(fiber.type) || 'Component');
|
12650 | didWarnAboutUnsafeLifecycles.add(fiber.type);
|
12651 | });
|
12652 | pendingUNSAFE_ComponentWillMountWarnings = [];
|
12653 | }
|
12654 |
|
12655 | var componentWillReceivePropsUniqueNames = new Set();
|
12656 |
|
12657 | if (pendingComponentWillReceivePropsWarnings.length > 0) {
|
12658 | pendingComponentWillReceivePropsWarnings.forEach(function (fiber) {
|
12659 | componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || 'Component');
|
12660 | didWarnAboutUnsafeLifecycles.add(fiber.type);
|
12661 | });
|
12662 | pendingComponentWillReceivePropsWarnings = [];
|
12663 | }
|
12664 |
|
12665 | var UNSAFE_componentWillReceivePropsUniqueNames = new Set();
|
12666 |
|
12667 | if (pendingUNSAFE_ComponentWillReceivePropsWarnings.length > 0) {
|
12668 | pendingUNSAFE_ComponentWillReceivePropsWarnings.forEach(function (fiber) {
|
12669 | UNSAFE_componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || 'Component');
|
12670 | didWarnAboutUnsafeLifecycles.add(fiber.type);
|
12671 | });
|
12672 | pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
|
12673 | }
|
12674 |
|
12675 | var componentWillUpdateUniqueNames = new Set();
|
12676 |
|
12677 | if (pendingComponentWillUpdateWarnings.length > 0) {
|
12678 | pendingComponentWillUpdateWarnings.forEach(function (fiber) {
|
12679 | componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || 'Component');
|
12680 | didWarnAboutUnsafeLifecycles.add(fiber.type);
|
12681 | });
|
12682 | pendingComponentWillUpdateWarnings = [];
|
12683 | }
|
12684 |
|
12685 | var UNSAFE_componentWillUpdateUniqueNames = new Set();
|
12686 |
|
12687 | if (pendingUNSAFE_ComponentWillUpdateWarnings.length > 0) {
|
12688 | pendingUNSAFE_ComponentWillUpdateWarnings.forEach(function (fiber) {
|
12689 | UNSAFE_componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || 'Component');
|
12690 | didWarnAboutUnsafeLifecycles.add(fiber.type);
|
12691 | });
|
12692 | pendingUNSAFE_ComponentWillUpdateWarnings = [];
|
12693 | }
|
12694 |
|
12695 |
|
12696 |
|
12697 | if (UNSAFE_componentWillMountUniqueNames.size > 0) {
|
12698 | var sortedNames = setToSortedString(UNSAFE_componentWillMountUniqueNames);
|
12699 | warningWithoutStack$1(false, 'Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '\nPlease update the following components: %s', sortedNames);
|
12700 | }
|
12701 |
|
12702 | if (UNSAFE_componentWillReceivePropsUniqueNames.size > 0) {
|
12703 | var _sortedNames = setToSortedString(UNSAFE_componentWillReceivePropsUniqueNames);
|
12704 |
|
12705 | warningWithoutStack$1(false, 'Using UNSAFE_componentWillReceiveProps in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, " + 'refactor your code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' + '\nPlease update the following components: %s', _sortedNames);
|
12706 | }
|
12707 |
|
12708 | if (UNSAFE_componentWillUpdateUniqueNames.size > 0) {
|
12709 | var _sortedNames2 = setToSortedString(UNSAFE_componentWillUpdateUniqueNames);
|
12710 |
|
12711 | warningWithoutStack$1(false, 'Using UNSAFE_componentWillUpdate in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '\nPlease update the following components: %s', _sortedNames2);
|
12712 | }
|
12713 |
|
12714 | if (componentWillMountUniqueNames.size > 0) {
|
12715 | var _sortedNames3 = setToSortedString(componentWillMountUniqueNames);
|
12716 |
|
12717 | lowPriorityWarningWithoutStack$1(false, 'componentWillMount has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '* Rename componentWillMount to UNSAFE_componentWillMount to suppress ' + 'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames3);
|
12718 | }
|
12719 |
|
12720 | if (componentWillReceivePropsUniqueNames.size > 0) {
|
12721 | var _sortedNames4 = setToSortedString(componentWillReceivePropsUniqueNames);
|
12722 |
|
12723 | lowPriorityWarningWithoutStack$1(false, 'componentWillReceiveProps has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, refactor your " + 'code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' + '* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress ' + 'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames4);
|
12724 | }
|
12725 |
|
12726 | if (componentWillUpdateUniqueNames.size > 0) {
|
12727 | var _sortedNames5 = setToSortedString(componentWillUpdateUniqueNames);
|
12728 |
|
12729 | lowPriorityWarningWithoutStack$1(false, 'componentWillUpdate has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress ' + 'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames5);
|
12730 | }
|
12731 | };
|
12732 |
|
12733 | var pendingLegacyContextWarning = new Map();
|
12734 |
|
12735 | var didWarnAboutLegacyContext = new Set();
|
12736 |
|
12737 | ReactStrictModeWarnings.recordLegacyContextWarning = function (fiber, instance) {
|
12738 | var strictRoot = findStrictRoot(fiber);
|
12739 |
|
12740 | if (strictRoot === null) {
|
12741 | warningWithoutStack$1(false, 'Expected to find a StrictMode component in a strict mode tree. ' + 'This error is likely caused by a bug in React. Please file an issue.');
|
12742 | return;
|
12743 | }
|
12744 |
|
12745 |
|
12746 | if (didWarnAboutLegacyContext.has(fiber.type)) {
|
12747 | return;
|
12748 | }
|
12749 |
|
12750 | var warningsForRoot = pendingLegacyContextWarning.get(strictRoot);
|
12751 |
|
12752 | if (fiber.type.contextTypes != null || fiber.type.childContextTypes != null || instance !== null && typeof instance.getChildContext === 'function') {
|
12753 | if (warningsForRoot === undefined) {
|
12754 | warningsForRoot = [];
|
12755 | pendingLegacyContextWarning.set(strictRoot, warningsForRoot);
|
12756 | }
|
12757 |
|
12758 | warningsForRoot.push(fiber);
|
12759 | }
|
12760 | };
|
12761 |
|
12762 | ReactStrictModeWarnings.flushLegacyContextWarning = function () {
|
12763 | pendingLegacyContextWarning.forEach(function (fiberArray, strictRoot) {
|
12764 | var uniqueNames = new Set();
|
12765 | fiberArray.forEach(function (fiber) {
|
12766 | uniqueNames.add(getComponentName(fiber.type) || 'Component');
|
12767 | didWarnAboutLegacyContext.add(fiber.type);
|
12768 | });
|
12769 | var sortedNames = setToSortedString(uniqueNames);
|
12770 | var strictRootComponentStack = getStackByFiberInDevAndProd(strictRoot);
|
12771 | warningWithoutStack$1(false, 'Legacy context API has been detected within a strict-mode tree.' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here: https://fb.me/react-legacy-context' + '%s', sortedNames, strictRootComponentStack);
|
12772 | });
|
12773 | };
|
12774 |
|
12775 | ReactStrictModeWarnings.discardPendingWarnings = function () {
|
12776 | pendingComponentWillMountWarnings = [];
|
12777 | pendingUNSAFE_ComponentWillMountWarnings = [];
|
12778 | pendingComponentWillReceivePropsWarnings = [];
|
12779 | pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
|
12780 | pendingComponentWillUpdateWarnings = [];
|
12781 | pendingUNSAFE_ComponentWillUpdateWarnings = [];
|
12782 | pendingLegacyContextWarning = new Map();
|
12783 | };
|
12784 | }
|
12785 |
|
12786 | var resolveFamily = null;
|
12787 |
|
12788 | var failedBoundaries = null;
|
12789 | var setRefreshHandler = function (handler) {
|
12790 | {
|
12791 | resolveFamily = handler;
|
12792 | }
|
12793 | };
|
12794 | function resolveFunctionForHotReloading(type) {
|
12795 | {
|
12796 | if (resolveFamily === null) {
|
12797 |
|
12798 | return type;
|
12799 | }
|
12800 |
|
12801 | var family = resolveFamily(type);
|
12802 |
|
12803 | if (family === undefined) {
|
12804 | return type;
|
12805 | }
|
12806 |
|
12807 |
|
12808 | return family.current;
|
12809 | }
|
12810 | }
|
12811 | function resolveClassForHotReloading(type) {
|
12812 |
|
12813 | return resolveFunctionForHotReloading(type);
|
12814 | }
|
12815 | function resolveForwardRefForHotReloading(type) {
|
12816 | {
|
12817 | if (resolveFamily === null) {
|
12818 |
|
12819 | return type;
|
12820 | }
|
12821 |
|
12822 | var family = resolveFamily(type);
|
12823 |
|
12824 | if (family === undefined) {
|
12825 |
|
12826 | if (type !== null && type !== undefined && typeof type.render === 'function') {
|
12827 |
|
12828 |
|
12829 |
|
12830 | var currentRender = resolveFunctionForHotReloading(type.render);
|
12831 |
|
12832 | if (type.render !== currentRender) {
|
12833 | var syntheticType = {
|
12834 | $$typeof: REACT_FORWARD_REF_TYPE,
|
12835 | render: currentRender
|
12836 | };
|
12837 |
|
12838 | if (type.displayName !== undefined) {
|
12839 | syntheticType.displayName = type.displayName;
|
12840 | }
|
12841 |
|
12842 | return syntheticType;
|
12843 | }
|
12844 | }
|
12845 |
|
12846 | return type;
|
12847 | }
|
12848 |
|
12849 |
|
12850 | return family.current;
|
12851 | }
|
12852 | }
|
12853 | function isCompatibleFamilyForHotReloading(fiber, element) {
|
12854 | {
|
12855 | if (resolveFamily === null) {
|
12856 |
|
12857 | return false;
|
12858 | }
|
12859 |
|
12860 | var prevType = fiber.elementType;
|
12861 | var nextType = element.type;
|
12862 |
|
12863 | var needsCompareFamilies = false;
|
12864 | var $$typeofNextType = typeof nextType === 'object' && nextType !== null ? nextType.$$typeof : null;
|
12865 |
|
12866 | switch (fiber.tag) {
|
12867 | case ClassComponent:
|
12868 | {
|
12869 | if (typeof nextType === 'function') {
|
12870 | needsCompareFamilies = true;
|
12871 | }
|
12872 |
|
12873 | break;
|
12874 | }
|
12875 |
|
12876 | case FunctionComponent:
|
12877 | {
|
12878 | if (typeof nextType === 'function') {
|
12879 | needsCompareFamilies = true;
|
12880 | } else if ($$typeofNextType === REACT_LAZY_TYPE) {
|
12881 |
|
12882 |
|
12883 |
|
12884 |
|
12885 | needsCompareFamilies = true;
|
12886 | }
|
12887 |
|
12888 | break;
|
12889 | }
|
12890 |
|
12891 | case ForwardRef:
|
12892 | {
|
12893 | if ($$typeofNextType === REACT_FORWARD_REF_TYPE) {
|
12894 | needsCompareFamilies = true;
|
12895 | } else if ($$typeofNextType === REACT_LAZY_TYPE) {
|
12896 | needsCompareFamilies = true;
|
12897 | }
|
12898 |
|
12899 | break;
|
12900 | }
|
12901 |
|
12902 | case MemoComponent:
|
12903 | case SimpleMemoComponent:
|
12904 | {
|
12905 | if ($$typeofNextType === REACT_MEMO_TYPE) {
|
12906 |
|
12907 |
|
12908 | needsCompareFamilies = true;
|
12909 | } else if ($$typeofNextType === REACT_LAZY_TYPE) {
|
12910 | needsCompareFamilies = true;
|
12911 | }
|
12912 |
|
12913 | break;
|
12914 | }
|
12915 |
|
12916 | default:
|
12917 | return false;
|
12918 | }
|
12919 |
|
12920 |
|
12921 | if (needsCompareFamilies) {
|
12922 |
|
12923 |
|
12924 |
|
12925 |
|
12926 |
|
12927 | var prevFamily = resolveFamily(prevType);
|
12928 |
|
12929 | if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) {
|
12930 | return true;
|
12931 | }
|
12932 | }
|
12933 |
|
12934 | return false;
|
12935 | }
|
12936 | }
|
12937 | function markFailedErrorBoundaryForHotReloading(fiber) {
|
12938 | {
|
12939 | if (resolveFamily === null) {
|
12940 |
|
12941 | return;
|
12942 | }
|
12943 |
|
12944 | if (typeof WeakSet !== 'function') {
|
12945 | return;
|
12946 | }
|
12947 |
|
12948 | if (failedBoundaries === null) {
|
12949 | failedBoundaries = new WeakSet();
|
12950 | }
|
12951 |
|
12952 | failedBoundaries.add(fiber);
|
12953 | }
|
12954 | }
|
12955 | var scheduleRefresh = function (root, update) {
|
12956 | {
|
12957 | if (resolveFamily === null) {
|
12958 |
|
12959 | return;
|
12960 | }
|
12961 |
|
12962 | var staleFamilies = update.staleFamilies,
|
12963 | updatedFamilies = update.updatedFamilies;
|
12964 | flushPassiveEffects();
|
12965 | flushSync(function () {
|
12966 | scheduleFibersWithFamiliesRecursively(root.current, updatedFamilies, staleFamilies);
|
12967 | });
|
12968 | }
|
12969 | };
|
12970 | var scheduleRoot = function (root, element) {
|
12971 | {
|
12972 | if (root.context !== emptyContextObject) {
|
12973 |
|
12974 |
|
12975 |
|
12976 | return;
|
12977 | }
|
12978 |
|
12979 | flushPassiveEffects();
|
12980 | updateContainerAtExpirationTime(element, root, null, Sync, null);
|
12981 | }
|
12982 | };
|
12983 |
|
12984 | function scheduleFibersWithFamiliesRecursively(fiber, updatedFamilies, staleFamilies) {
|
12985 | {
|
12986 | var alternate = fiber.alternate,
|
12987 | child = fiber.child,
|
12988 | sibling = fiber.sibling,
|
12989 | tag = fiber.tag,
|
12990 | type = fiber.type;
|
12991 | var candidateType = null;
|
12992 |
|
12993 | switch (tag) {
|
12994 | case FunctionComponent:
|
12995 | case SimpleMemoComponent:
|
12996 | case ClassComponent:
|
12997 | candidateType = type;
|
12998 | break;
|
12999 |
|
13000 | case ForwardRef:
|
13001 | candidateType = type.render;
|
13002 | break;
|
13003 |
|
13004 | default:
|
13005 | break;
|
13006 | }
|
13007 |
|
13008 | if (resolveFamily === null) {
|
13009 | throw new Error('Expected resolveFamily to be set during hot reload.');
|
13010 | }
|
13011 |
|
13012 | var needsRender = false;
|
13013 | var needsRemount = false;
|
13014 |
|
13015 | if (candidateType !== null) {
|
13016 | var family = resolveFamily(candidateType);
|
13017 |
|
13018 | if (family !== undefined) {
|
13019 | if (staleFamilies.has(family)) {
|
13020 | needsRemount = true;
|
13021 | } else if (updatedFamilies.has(family)) {
|
13022 | if (tag === ClassComponent) {
|
13023 | needsRemount = true;
|
13024 | } else {
|
13025 | needsRender = true;
|
13026 | }
|
13027 | }
|
13028 | }
|
13029 | }
|
13030 |
|
13031 | if (failedBoundaries !== null) {
|
13032 | if (failedBoundaries.has(fiber) || alternate !== null && failedBoundaries.has(alternate)) {
|
13033 | needsRemount = true;
|
13034 | }
|
13035 | }
|
13036 |
|
13037 | if (needsRemount) {
|
13038 | fiber._debugNeedsRemount = true;
|
13039 | }
|
13040 |
|
13041 | if (needsRemount || needsRender) {
|
13042 | scheduleWork(fiber, Sync);
|
13043 | }
|
13044 |
|
13045 | if (child !== null && !needsRemount) {
|
13046 | scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies);
|
13047 | }
|
13048 |
|
13049 | if (sibling !== null) {
|
13050 | scheduleFibersWithFamiliesRecursively(sibling, updatedFamilies, staleFamilies);
|
13051 | }
|
13052 | }
|
13053 | }
|
13054 |
|
13055 | var findHostInstancesForRefresh = function (root, families) {
|
13056 | {
|
13057 | var hostInstances = new Set();
|
13058 | var types = new Set(families.map(function (family) {
|
13059 | return family.current;
|
13060 | }));
|
13061 | findHostInstancesForMatchingFibersRecursively(root.current, types, hostInstances);
|
13062 | return hostInstances;
|
13063 | }
|
13064 | };
|
13065 |
|
13066 | function findHostInstancesForMatchingFibersRecursively(fiber, types, hostInstances) {
|
13067 | {
|
13068 | var child = fiber.child,
|
13069 | sibling = fiber.sibling,
|
13070 | tag = fiber.tag,
|
13071 | type = fiber.type;
|
13072 | var candidateType = null;
|
13073 |
|
13074 | switch (tag) {
|
13075 | case FunctionComponent:
|
13076 | case SimpleMemoComponent:
|
13077 | case ClassComponent:
|
13078 | candidateType = type;
|
13079 | break;
|
13080 |
|
13081 | case ForwardRef:
|
13082 | candidateType = type.render;
|
13083 | break;
|
13084 |
|
13085 | default:
|
13086 | break;
|
13087 | }
|
13088 |
|
13089 | var didMatch = false;
|
13090 |
|
13091 | if (candidateType !== null) {
|
13092 | if (types.has(candidateType)) {
|
13093 | didMatch = true;
|
13094 | }
|
13095 | }
|
13096 |
|
13097 | if (didMatch) {
|
13098 |
|
13099 |
|
13100 |
|
13101 | findHostInstancesForFiberShallowly(fiber, hostInstances);
|
13102 | } else {
|
13103 |
|
13104 | if (child !== null) {
|
13105 | findHostInstancesForMatchingFibersRecursively(child, types, hostInstances);
|
13106 | }
|
13107 | }
|
13108 |
|
13109 | if (sibling !== null) {
|
13110 | findHostInstancesForMatchingFibersRecursively(sibling, types, hostInstances);
|
13111 | }
|
13112 | }
|
13113 | }
|
13114 |
|
13115 | function findHostInstancesForFiberShallowly(fiber, hostInstances) {
|
13116 | {
|
13117 | var foundHostInstances = findChildHostInstancesForFiberShallowly(fiber, hostInstances);
|
13118 |
|
13119 | if (foundHostInstances) {
|
13120 | return;
|
13121 | }
|
13122 |
|
13123 |
|
13124 | var node = fiber;
|
13125 |
|
13126 | while (true) {
|
13127 | switch (node.tag) {
|
13128 | case HostComponent:
|
13129 | hostInstances.add(node.stateNode);
|
13130 | return;
|
13131 |
|
13132 | case HostPortal:
|
13133 | hostInstances.add(node.stateNode.containerInfo);
|
13134 | return;
|
13135 |
|
13136 | case HostRoot:
|
13137 | hostInstances.add(node.stateNode.containerInfo);
|
13138 | return;
|
13139 | }
|
13140 |
|
13141 | if (node.return === null) {
|
13142 | throw new Error('Expected to reach root first.');
|
13143 | }
|
13144 |
|
13145 | node = node.return;
|
13146 | }
|
13147 | }
|
13148 | }
|
13149 |
|
13150 | function findChildHostInstancesForFiberShallowly(fiber, hostInstances) {
|
13151 | {
|
13152 | var node = fiber;
|
13153 | var foundHostInstances = false;
|
13154 |
|
13155 | while (true) {
|
13156 | if (node.tag === HostComponent) {
|
13157 |
|
13158 | foundHostInstances = true;
|
13159 | hostInstances.add(node.stateNode);
|
13160 | } else if (node.child !== null) {
|
13161 | node.child.return = node;
|
13162 | node = node.child;
|
13163 | continue;
|
13164 | }
|
13165 |
|
13166 | if (node === fiber) {
|
13167 | return foundHostInstances;
|
13168 | }
|
13169 |
|
13170 | while (node.sibling === null) {
|
13171 | if (node.return === null || node.return === fiber) {
|
13172 | return foundHostInstances;
|
13173 | }
|
13174 |
|
13175 | node = node.return;
|
13176 | }
|
13177 |
|
13178 | node.sibling.return = node.return;
|
13179 | node = node.sibling;
|
13180 | }
|
13181 | }
|
13182 |
|
13183 | return false;
|
13184 | }
|
13185 |
|
13186 | function resolveDefaultProps(Component, baseProps) {
|
13187 | if (Component && Component.defaultProps) {
|
13188 |
|
13189 | var props = _assign({}, baseProps);
|
13190 |
|
13191 | var defaultProps = Component.defaultProps;
|
13192 |
|
13193 | for (var propName in defaultProps) {
|
13194 | if (props[propName] === undefined) {
|
13195 | props[propName] = defaultProps[propName];
|
13196 | }
|
13197 | }
|
13198 |
|
13199 | return props;
|
13200 | }
|
13201 |
|
13202 | return baseProps;
|
13203 | }
|
13204 | function readLazyComponentType(lazyComponent) {
|
13205 | initializeLazyComponentType(lazyComponent);
|
13206 |
|
13207 | if (lazyComponent._status !== Resolved) {
|
13208 | throw lazyComponent._result;
|
13209 | }
|
13210 |
|
13211 | return lazyComponent._result;
|
13212 | }
|
13213 |
|
13214 | var valueCursor = createCursor(null);
|
13215 | var rendererSigil;
|
13216 |
|
13217 | {
|
13218 |
|
13219 | rendererSigil = {};
|
13220 | }
|
13221 |
|
13222 | var currentlyRenderingFiber = null;
|
13223 | var lastContextDependency = null;
|
13224 | var lastContextWithAllBitsObserved = null;
|
13225 | var isDisallowedContextReadInDEV = false;
|
13226 | function resetContextDependencies() {
|
13227 |
|
13228 |
|
13229 | currentlyRenderingFiber = null;
|
13230 | lastContextDependency = null;
|
13231 | lastContextWithAllBitsObserved = null;
|
13232 |
|
13233 | {
|
13234 | isDisallowedContextReadInDEV = false;
|
13235 | }
|
13236 | }
|
13237 | function enterDisallowedContextReadInDEV() {
|
13238 | {
|
13239 | isDisallowedContextReadInDEV = true;
|
13240 | }
|
13241 | }
|
13242 | function exitDisallowedContextReadInDEV() {
|
13243 | {
|
13244 | isDisallowedContextReadInDEV = false;
|
13245 | }
|
13246 | }
|
13247 | function pushProvider(providerFiber, nextValue) {
|
13248 | var context = providerFiber.type._context;
|
13249 |
|
13250 | if (isPrimaryRenderer) {
|
13251 | push(valueCursor, context._currentValue, providerFiber);
|
13252 | context._currentValue = nextValue;
|
13253 |
|
13254 | {
|
13255 | !(context._currentRenderer === undefined || context._currentRenderer === null || context._currentRenderer === rendererSigil) ? warningWithoutStack$1(false, 'Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.') : void 0;
|
13256 | context._currentRenderer = rendererSigil;
|
13257 | }
|
13258 | } else {
|
13259 | push(valueCursor, context._currentValue2, providerFiber);
|
13260 | context._currentValue2 = nextValue;
|
13261 |
|
13262 | {
|
13263 | !(context._currentRenderer2 === undefined || context._currentRenderer2 === null || context._currentRenderer2 === rendererSigil) ? warningWithoutStack$1(false, 'Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.') : void 0;
|
13264 | context._currentRenderer2 = rendererSigil;
|
13265 | }
|
13266 | }
|
13267 | }
|
13268 | function popProvider(providerFiber) {
|
13269 | var currentValue = valueCursor.current;
|
13270 | pop(valueCursor, providerFiber);
|
13271 | var context = providerFiber.type._context;
|
13272 |
|
13273 | if (isPrimaryRenderer) {
|
13274 | context._currentValue = currentValue;
|
13275 | } else {
|
13276 | context._currentValue2 = currentValue;
|
13277 | }
|
13278 | }
|
13279 | function calculateChangedBits(context, newValue, oldValue) {
|
13280 | if (is$1(oldValue, newValue)) {
|
13281 |
|
13282 | return 0;
|
13283 | } else {
|
13284 | var changedBits = typeof context._calculateChangedBits === 'function' ? context._calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;
|
13285 |
|
13286 | {
|
13287 | !((changedBits & MAX_SIGNED_31_BIT_INT) === changedBits) ? warning$1(false, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits) : void 0;
|
13288 | }
|
13289 |
|
13290 | return changedBits | 0;
|
13291 | }
|
13292 | }
|
13293 | function scheduleWorkOnParentPath(parent, renderExpirationTime) {
|
13294 |
|
13295 |
|
13296 | var node = parent;
|
13297 |
|
13298 | while (node !== null) {
|
13299 | var alternate = node.alternate;
|
13300 |
|
13301 | if (node.childExpirationTime < renderExpirationTime) {
|
13302 | node.childExpirationTime = renderExpirationTime;
|
13303 |
|
13304 | if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
|
13305 | alternate.childExpirationTime = renderExpirationTime;
|
13306 | }
|
13307 | } else if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
|
13308 | alternate.childExpirationTime = renderExpirationTime;
|
13309 | } else {
|
13310 |
|
13311 |
|
13312 | break;
|
13313 | }
|
13314 |
|
13315 | node = node.return;
|
13316 | }
|
13317 | }
|
13318 | function propagateContextChange(workInProgress, context, changedBits, renderExpirationTime) {
|
13319 | var fiber = workInProgress.child;
|
13320 |
|
13321 | if (fiber !== null) {
|
13322 |
|
13323 | fiber.return = workInProgress;
|
13324 | }
|
13325 |
|
13326 | while (fiber !== null) {
|
13327 | var nextFiber = void 0;
|
13328 |
|
13329 | var list = fiber.dependencies;
|
13330 |
|
13331 | if (list !== null) {
|
13332 | nextFiber = fiber.child;
|
13333 | var dependency = list.firstContext;
|
13334 |
|
13335 | while (dependency !== null) {
|
13336 |
|
13337 | if (dependency.context === context && (dependency.observedBits & changedBits) !== 0) {
|
13338 |
|
13339 | if (fiber.tag === ClassComponent) {
|
13340 |
|
13341 | var update = createUpdate(renderExpirationTime, null);
|
13342 | update.tag = ForceUpdate;
|
13343 |
|
13344 |
|
13345 |
|
13346 |
|
13347 | enqueueUpdate(fiber, update);
|
13348 | }
|
13349 |
|
13350 | if (fiber.expirationTime < renderExpirationTime) {
|
13351 | fiber.expirationTime = renderExpirationTime;
|
13352 | }
|
13353 |
|
13354 | var alternate = fiber.alternate;
|
13355 |
|
13356 | if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
|
13357 | alternate.expirationTime = renderExpirationTime;
|
13358 | }
|
13359 |
|
13360 | scheduleWorkOnParentPath(fiber.return, renderExpirationTime);
|
13361 |
|
13362 | if (list.expirationTime < renderExpirationTime) {
|
13363 | list.expirationTime = renderExpirationTime;
|
13364 | }
|
13365 |
|
13366 |
|
13367 |
|
13368 | break;
|
13369 | }
|
13370 |
|
13371 | dependency = dependency.next;
|
13372 | }
|
13373 | } else if (fiber.tag === ContextProvider) {
|
13374 |
|
13375 | nextFiber = fiber.type === workInProgress.type ? null : fiber.child;
|
13376 | } else if (enableSuspenseServerRenderer && fiber.tag === DehydratedFragment) {
|
13377 |
|
13378 |
|
13379 |
|
13380 | var parentSuspense = fiber.return;
|
13381 |
|
13382 | (function () {
|
13383 | if (!(parentSuspense !== null)) {
|
13384 | {
|
13385 | throw ReactError(Error("We just came from a parent so we must have had a parent. This is a bug in React."));
|
13386 | }
|
13387 | }
|
13388 | })();
|
13389 |
|
13390 | if (parentSuspense.expirationTime < renderExpirationTime) {
|
13391 | parentSuspense.expirationTime = renderExpirationTime;
|
13392 | }
|
13393 |
|
13394 | var _alternate = parentSuspense.alternate;
|
13395 |
|
13396 | if (_alternate !== null && _alternate.expirationTime < renderExpirationTime) {
|
13397 | _alternate.expirationTime = renderExpirationTime;
|
13398 | }
|
13399 |
|
13400 |
|
13401 |
|
13402 |
|
13403 |
|
13404 | scheduleWorkOnParentPath(parentSuspense, renderExpirationTime);
|
13405 | nextFiber = fiber.sibling;
|
13406 | } else {
|
13407 |
|
13408 | nextFiber = fiber.child;
|
13409 | }
|
13410 |
|
13411 | if (nextFiber !== null) {
|
13412 |
|
13413 | nextFiber.return = fiber;
|
13414 | } else {
|
13415 |
|
13416 | nextFiber = fiber;
|
13417 |
|
13418 | while (nextFiber !== null) {
|
13419 | if (nextFiber === workInProgress) {
|
13420 |
|
13421 | nextFiber = null;
|
13422 | break;
|
13423 | }
|
13424 |
|
13425 | var sibling = nextFiber.sibling;
|
13426 |
|
13427 | if (sibling !== null) {
|
13428 |
|
13429 | sibling.return = nextFiber.return;
|
13430 | nextFiber = sibling;
|
13431 | break;
|
13432 | }
|
13433 |
|
13434 |
|
13435 | nextFiber = nextFiber.return;
|
13436 | }
|
13437 | }
|
13438 |
|
13439 | fiber = nextFiber;
|
13440 | }
|
13441 | }
|
13442 | function prepareToReadContext(workInProgress, renderExpirationTime) {
|
13443 | currentlyRenderingFiber = workInProgress;
|
13444 | lastContextDependency = null;
|
13445 | lastContextWithAllBitsObserved = null;
|
13446 | var dependencies = workInProgress.dependencies;
|
13447 |
|
13448 | if (dependencies !== null) {
|
13449 | var firstContext = dependencies.firstContext;
|
13450 |
|
13451 | if (firstContext !== null) {
|
13452 | if (dependencies.expirationTime >= renderExpirationTime) {
|
13453 |
|
13454 | markWorkInProgressReceivedUpdate();
|
13455 | }
|
13456 |
|
13457 |
|
13458 | dependencies.firstContext = null;
|
13459 | }
|
13460 | }
|
13461 | }
|
13462 | function readContext(context, observedBits) {
|
13463 | {
|
13464 |
|
13465 |
|
13466 | !!isDisallowedContextReadInDEV ? 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;
|
13467 | }
|
13468 |
|
13469 | if (lastContextWithAllBitsObserved === context) {
|
13470 | } else if (observedBits === false || observedBits === 0) {
|
13471 | } else {
|
13472 | var resolvedObservedBits;
|
13473 |
|
13474 | if (typeof observedBits !== 'number' || observedBits === MAX_SIGNED_31_BIT_INT) {
|
13475 |
|
13476 | lastContextWithAllBitsObserved = context;
|
13477 | resolvedObservedBits = MAX_SIGNED_31_BIT_INT;
|
13478 | } else {
|
13479 | resolvedObservedBits = observedBits;
|
13480 | }
|
13481 |
|
13482 | var contextItem = {
|
13483 | context: context,
|
13484 | observedBits: resolvedObservedBits,
|
13485 | next: null
|
13486 | };
|
13487 |
|
13488 | if (lastContextDependency === null) {
|
13489 | (function () {
|
13490 | if (!(currentlyRenderingFiber !== null)) {
|
13491 | {
|
13492 | throw ReactError(Error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()."));
|
13493 | }
|
13494 | }
|
13495 | })();
|
13496 |
|
13497 |
|
13498 | lastContextDependency = contextItem;
|
13499 | currentlyRenderingFiber.dependencies = {
|
13500 | expirationTime: NoWork,
|
13501 | firstContext: contextItem,
|
13502 | responders: null
|
13503 | };
|
13504 | } else {
|
13505 |
|
13506 | lastContextDependency = lastContextDependency.next = contextItem;
|
13507 | }
|
13508 | }
|
13509 |
|
13510 | return isPrimaryRenderer ? context._currentValue : context._currentValue2;
|
13511 | }
|
13512 |
|
13513 |
|
13514 |
|
13515 |
|
13516 |
|
13517 |
|
13518 |
|
13519 |
|
13520 |
|
13521 |
|
13522 |
|
13523 |
|
13524 |
|
13525 |
|
13526 |
|
13527 |
|
13528 |
|
13529 |
|
13530 |
|
13531 |
|
13532 |
|
13533 |
|
13534 |
|
13535 |
|
13536 |
|
13537 |
|
13538 |
|
13539 |
|
13540 |
|
13541 |
|
13542 |
|
13543 |
|
13544 |
|
13545 |
|
13546 |
|
13547 |
|
13548 |
|
13549 |
|
13550 |
|
13551 |
|
13552 |
|
13553 |
|
13554 |
|
13555 |
|
13556 |
|
13557 |
|
13558 |
|
13559 |
|
13560 |
|
13561 |
|
13562 |
|
13563 |
|
13564 |
|
13565 |
|
13566 |
|
13567 |
|
13568 |
|
13569 |
|
13570 |
|
13571 |
|
13572 |
|
13573 |
|
13574 |
|
13575 |
|
13576 |
|
13577 |
|
13578 |
|
13579 |
|
13580 |
|
13581 |
|
13582 |
|
13583 |
|
13584 |
|
13585 |
|
13586 |
|
13587 |
|
13588 |
|
13589 | var UpdateState = 0;
|
13590 | var ReplaceState = 1;
|
13591 | var ForceUpdate = 2;
|
13592 | var CaptureUpdate = 3;
|
13593 |
|
13594 |
|
13595 |
|
13596 | var hasForceUpdate = false;
|
13597 | var didWarnUpdateInsideUpdate;
|
13598 | var currentlyProcessingQueue;
|
13599 |
|
13600 |
|
13601 | {
|
13602 | didWarnUpdateInsideUpdate = false;
|
13603 | currentlyProcessingQueue = null;
|
13604 |
|
13605 |
|
13606 | }
|
13607 |
|
13608 | function createUpdateQueue(baseState) {
|
13609 | var queue = {
|
13610 | baseState: baseState,
|
13611 | firstUpdate: null,
|
13612 | lastUpdate: null,
|
13613 | firstCapturedUpdate: null,
|
13614 | lastCapturedUpdate: null,
|
13615 | firstEffect: null,
|
13616 | lastEffect: null,
|
13617 | firstCapturedEffect: null,
|
13618 | lastCapturedEffect: null
|
13619 | };
|
13620 | return queue;
|
13621 | }
|
13622 |
|
13623 | function cloneUpdateQueue(currentQueue) {
|
13624 | var queue = {
|
13625 | baseState: currentQueue.baseState,
|
13626 | firstUpdate: currentQueue.firstUpdate,
|
13627 | lastUpdate: currentQueue.lastUpdate,
|
13628 |
|
13629 |
|
13630 | firstCapturedUpdate: null,
|
13631 | lastCapturedUpdate: null,
|
13632 | firstEffect: null,
|
13633 | lastEffect: null,
|
13634 | firstCapturedEffect: null,
|
13635 | lastCapturedEffect: null
|
13636 | };
|
13637 | return queue;
|
13638 | }
|
13639 |
|
13640 | function createUpdate(expirationTime, suspenseConfig) {
|
13641 | var update = {
|
13642 | expirationTime: expirationTime,
|
13643 | suspenseConfig: suspenseConfig,
|
13644 | tag: UpdateState,
|
13645 | payload: null,
|
13646 | callback: null,
|
13647 | next: null,
|
13648 | nextEffect: null
|
13649 | };
|
13650 |
|
13651 | {
|
13652 | update.priority = getCurrentPriorityLevel();
|
13653 | }
|
13654 |
|
13655 | return update;
|
13656 | }
|
13657 |
|
13658 | function appendUpdateToQueue(queue, update) {
|
13659 |
|
13660 | if (queue.lastUpdate === null) {
|
13661 |
|
13662 | queue.firstUpdate = queue.lastUpdate = update;
|
13663 | } else {
|
13664 | queue.lastUpdate.next = update;
|
13665 | queue.lastUpdate = update;
|
13666 | }
|
13667 | }
|
13668 |
|
13669 | function enqueueUpdate(fiber, update) {
|
13670 |
|
13671 | var alternate = fiber.alternate;
|
13672 | var queue1;
|
13673 | var queue2;
|
13674 |
|
13675 | if (alternate === null) {
|
13676 |
|
13677 | queue1 = fiber.updateQueue;
|
13678 | queue2 = null;
|
13679 |
|
13680 | if (queue1 === null) {
|
13681 | queue1 = fiber.updateQueue = createUpdateQueue(fiber.memoizedState);
|
13682 | }
|
13683 | } else {
|
13684 |
|
13685 | queue1 = fiber.updateQueue;
|
13686 | queue2 = alternate.updateQueue;
|
13687 |
|
13688 | if (queue1 === null) {
|
13689 | if (queue2 === null) {
|
13690 |
|
13691 | queue1 = fiber.updateQueue = createUpdateQueue(fiber.memoizedState);
|
13692 | queue2 = alternate.updateQueue = createUpdateQueue(alternate.memoizedState);
|
13693 | } else {
|
13694 |
|
13695 | queue1 = fiber.updateQueue = cloneUpdateQueue(queue2);
|
13696 | }
|
13697 | } else {
|
13698 | if (queue2 === null) {
|
13699 |
|
13700 | queue2 = alternate.updateQueue = cloneUpdateQueue(queue1);
|
13701 | } else {
|
13702 | }
|
13703 | }
|
13704 | }
|
13705 |
|
13706 | if (queue2 === null || queue1 === queue2) {
|
13707 |
|
13708 | appendUpdateToQueue(queue1, update);
|
13709 | } else {
|
13710 |
|
13711 |
|
13712 |
|
13713 | if (queue1.lastUpdate === null || queue2.lastUpdate === null) {
|
13714 |
|
13715 | appendUpdateToQueue(queue1, update);
|
13716 | appendUpdateToQueue(queue2, update);
|
13717 | } else {
|
13718 |
|
13719 |
|
13720 | appendUpdateToQueue(queue1, update);
|
13721 |
|
13722 | queue2.lastUpdate = update;
|
13723 | }
|
13724 | }
|
13725 |
|
13726 | {
|
13727 | if (fiber.tag === ClassComponent && (currentlyProcessingQueue === queue1 || queue2 !== null && currentlyProcessingQueue === queue2) && !didWarnUpdateInsideUpdate) {
|
13728 | warningWithoutStack$1(false, 'An update (setState, replaceState, or forceUpdate) was scheduled ' + 'from inside an update function. Update functions should be pure, ' + 'with zero side-effects. Consider using componentDidUpdate or a ' + 'callback.');
|
13729 | didWarnUpdateInsideUpdate = true;
|
13730 | }
|
13731 | }
|
13732 | }
|
13733 | function enqueueCapturedUpdate(workInProgress, update) {
|
13734 |
|
13735 |
|
13736 | var workInProgressQueue = workInProgress.updateQueue;
|
13737 |
|
13738 | if (workInProgressQueue === null) {
|
13739 | workInProgressQueue = workInProgress.updateQueue = createUpdateQueue(workInProgress.memoizedState);
|
13740 | } else {
|
13741 |
|
13742 |
|
13743 |
|
13744 | workInProgressQueue = ensureWorkInProgressQueueIsAClone(workInProgress, workInProgressQueue);
|
13745 | }
|
13746 |
|
13747 |
|
13748 | if (workInProgressQueue.lastCapturedUpdate === null) {
|
13749 |
|
13750 | workInProgressQueue.firstCapturedUpdate = workInProgressQueue.lastCapturedUpdate = update;
|
13751 | } else {
|
13752 | workInProgressQueue.lastCapturedUpdate.next = update;
|
13753 | workInProgressQueue.lastCapturedUpdate = update;
|
13754 | }
|
13755 | }
|
13756 |
|
13757 | function ensureWorkInProgressQueueIsAClone(workInProgress, queue) {
|
13758 | var current = workInProgress.alternate;
|
13759 |
|
13760 | if (current !== null) {
|
13761 |
|
13762 |
|
13763 | if (queue === current.updateQueue) {
|
13764 | queue = workInProgress.updateQueue = cloneUpdateQueue(queue);
|
13765 | }
|
13766 | }
|
13767 |
|
13768 | return queue;
|
13769 | }
|
13770 |
|
13771 | function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps, instance) {
|
13772 | switch (update.tag) {
|
13773 | case ReplaceState:
|
13774 | {
|
13775 | var payload = update.payload;
|
13776 |
|
13777 | if (typeof payload === 'function') {
|
13778 |
|
13779 | {
|
13780 | enterDisallowedContextReadInDEV();
|
13781 |
|
13782 | if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
13783 | payload.call(instance, prevState, nextProps);
|
13784 | }
|
13785 | }
|
13786 |
|
13787 | var nextState = payload.call(instance, prevState, nextProps);
|
13788 |
|
13789 | {
|
13790 | exitDisallowedContextReadInDEV();
|
13791 | }
|
13792 |
|
13793 | return nextState;
|
13794 | }
|
13795 |
|
13796 |
|
13797 | return payload;
|
13798 | }
|
13799 |
|
13800 | case CaptureUpdate:
|
13801 | {
|
13802 | workInProgress.effectTag = workInProgress.effectTag & ~ShouldCapture | DidCapture;
|
13803 | }
|
13804 |
|
13805 |
|
13806 | case UpdateState:
|
13807 | {
|
13808 | var _payload = update.payload;
|
13809 | var partialState;
|
13810 |
|
13811 | if (typeof _payload === 'function') {
|
13812 |
|
13813 | {
|
13814 | enterDisallowedContextReadInDEV();
|
13815 |
|
13816 | if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
13817 | _payload.call(instance, prevState, nextProps);
|
13818 | }
|
13819 | }
|
13820 |
|
13821 | partialState = _payload.call(instance, prevState, nextProps);
|
13822 |
|
13823 | {
|
13824 | exitDisallowedContextReadInDEV();
|
13825 | }
|
13826 | } else {
|
13827 |
|
13828 | partialState = _payload;
|
13829 | }
|
13830 |
|
13831 | if (partialState === null || partialState === undefined) {
|
13832 |
|
13833 | return prevState;
|
13834 | }
|
13835 |
|
13836 |
|
13837 | return _assign({}, prevState, partialState);
|
13838 | }
|
13839 |
|
13840 | case ForceUpdate:
|
13841 | {
|
13842 | hasForceUpdate = true;
|
13843 | return prevState;
|
13844 | }
|
13845 | }
|
13846 |
|
13847 | return prevState;
|
13848 | }
|
13849 |
|
13850 | function processUpdateQueue(workInProgress, queue, props, instance, renderExpirationTime) {
|
13851 | hasForceUpdate = false;
|
13852 | queue = ensureWorkInProgressQueueIsAClone(workInProgress, queue);
|
13853 |
|
13854 | {
|
13855 | currentlyProcessingQueue = queue;
|
13856 | }
|
13857 |
|
13858 |
|
13859 | var newBaseState = queue.baseState;
|
13860 | var newFirstUpdate = null;
|
13861 | var newExpirationTime = NoWork;
|
13862 |
|
13863 | var update = queue.firstUpdate;
|
13864 | var resultState = newBaseState;
|
13865 |
|
13866 | while (update !== null) {
|
13867 | var updateExpirationTime = update.expirationTime;
|
13868 |
|
13869 | if (updateExpirationTime < renderExpirationTime) {
|
13870 |
|
13871 | if (newFirstUpdate === null) {
|
13872 |
|
13873 |
|
13874 | newFirstUpdate = update;
|
13875 |
|
13876 |
|
13877 | newBaseState = resultState;
|
13878 | }
|
13879 |
|
13880 |
|
13881 |
|
13882 | if (newExpirationTime < updateExpirationTime) {
|
13883 | newExpirationTime = updateExpirationTime;
|
13884 | }
|
13885 | } else {
|
13886 |
|
13887 |
|
13888 |
|
13889 |
|
13890 |
|
13891 |
|
13892 |
|
13893 | markRenderEventTimeAndConfig(updateExpirationTime, update.suspenseConfig);
|
13894 |
|
13895 | resultState = getStateFromUpdate(workInProgress, queue, update, resultState, props, instance);
|
13896 | var callback = update.callback;
|
13897 |
|
13898 | if (callback !== null) {
|
13899 | workInProgress.effectTag |= Callback;
|
13900 |
|
13901 | update.nextEffect = null;
|
13902 |
|
13903 | if (queue.lastEffect === null) {
|
13904 | queue.firstEffect = queue.lastEffect = update;
|
13905 | } else {
|
13906 | queue.lastEffect.nextEffect = update;
|
13907 | queue.lastEffect = update;
|
13908 | }
|
13909 | }
|
13910 | }
|
13911 |
|
13912 |
|
13913 | update = update.next;
|
13914 | }
|
13915 |
|
13916 |
|
13917 | var newFirstCapturedUpdate = null;
|
13918 | update = queue.firstCapturedUpdate;
|
13919 |
|
13920 | while (update !== null) {
|
13921 | var _updateExpirationTime = update.expirationTime;
|
13922 |
|
13923 | if (_updateExpirationTime < renderExpirationTime) {
|
13924 |
|
13925 | if (newFirstCapturedUpdate === null) {
|
13926 |
|
13927 |
|
13928 | newFirstCapturedUpdate = update;
|
13929 |
|
13930 |
|
13931 | if (newFirstUpdate === null) {
|
13932 | newBaseState = resultState;
|
13933 | }
|
13934 | }
|
13935 |
|
13936 |
|
13937 |
|
13938 | if (newExpirationTime < _updateExpirationTime) {
|
13939 | newExpirationTime = _updateExpirationTime;
|
13940 | }
|
13941 | } else {
|
13942 |
|
13943 |
|
13944 | resultState = getStateFromUpdate(workInProgress, queue, update, resultState, props, instance);
|
13945 | var _callback = update.callback;
|
13946 |
|
13947 | if (_callback !== null) {
|
13948 | workInProgress.effectTag |= Callback;
|
13949 |
|
13950 | update.nextEffect = null;
|
13951 |
|
13952 | if (queue.lastCapturedEffect === null) {
|
13953 | queue.firstCapturedEffect = queue.lastCapturedEffect = update;
|
13954 | } else {
|
13955 | queue.lastCapturedEffect.nextEffect = update;
|
13956 | queue.lastCapturedEffect = update;
|
13957 | }
|
13958 | }
|
13959 | }
|
13960 |
|
13961 | update = update.next;
|
13962 | }
|
13963 |
|
13964 | if (newFirstUpdate === null) {
|
13965 | queue.lastUpdate = null;
|
13966 | }
|
13967 |
|
13968 | if (newFirstCapturedUpdate === null) {
|
13969 | queue.lastCapturedUpdate = null;
|
13970 | } else {
|
13971 | workInProgress.effectTag |= Callback;
|
13972 | }
|
13973 |
|
13974 | if (newFirstUpdate === null && newFirstCapturedUpdate === null) {
|
13975 |
|
13976 |
|
13977 | newBaseState = resultState;
|
13978 | }
|
13979 |
|
13980 | queue.baseState = newBaseState;
|
13981 | queue.firstUpdate = newFirstUpdate;
|
13982 | queue.firstCapturedUpdate = newFirstCapturedUpdate;
|
13983 |
|
13984 |
|
13985 |
|
13986 |
|
13987 |
|
13988 |
|
13989 |
|
13990 | markUnprocessedUpdateTime(newExpirationTime);
|
13991 | workInProgress.expirationTime = newExpirationTime;
|
13992 | workInProgress.memoizedState = resultState;
|
13993 |
|
13994 | {
|
13995 | currentlyProcessingQueue = null;
|
13996 | }
|
13997 | }
|
13998 |
|
13999 | function callCallback(callback, context) {
|
14000 | (function () {
|
14001 | if (!(typeof callback === 'function')) {
|
14002 | {
|
14003 | throw ReactError(Error("Invalid argument passed as callback. Expected a function. Instead received: " + callback));
|
14004 | }
|
14005 | }
|
14006 | })();
|
14007 |
|
14008 | callback.call(context);
|
14009 | }
|
14010 |
|
14011 | function resetHasForceUpdateBeforeProcessing() {
|
14012 | hasForceUpdate = false;
|
14013 | }
|
14014 | function checkHasForceUpdateAfterProcessing() {
|
14015 | return hasForceUpdate;
|
14016 | }
|
14017 | function commitUpdateQueue(finishedWork, finishedQueue, instance, renderExpirationTime) {
|
14018 |
|
14019 |
|
14020 |
|
14021 |
|
14022 | if (finishedQueue.firstCapturedUpdate !== null) {
|
14023 |
|
14024 | if (finishedQueue.lastUpdate !== null) {
|
14025 | finishedQueue.lastUpdate.next = finishedQueue.firstCapturedUpdate;
|
14026 | finishedQueue.lastUpdate = finishedQueue.lastCapturedUpdate;
|
14027 | }
|
14028 |
|
14029 |
|
14030 | finishedQueue.firstCapturedUpdate = finishedQueue.lastCapturedUpdate = null;
|
14031 | }
|
14032 |
|
14033 |
|
14034 | commitUpdateEffects(finishedQueue.firstEffect, instance);
|
14035 | finishedQueue.firstEffect = finishedQueue.lastEffect = null;
|
14036 | commitUpdateEffects(finishedQueue.firstCapturedEffect, instance);
|
14037 | finishedQueue.firstCapturedEffect = finishedQueue.lastCapturedEffect = null;
|
14038 | }
|
14039 |
|
14040 | function commitUpdateEffects(effect, instance) {
|
14041 | while (effect !== null) {
|
14042 | var callback = effect.callback;
|
14043 |
|
14044 | if (callback !== null) {
|
14045 | effect.callback = null;
|
14046 | callCallback(callback, instance);
|
14047 | }
|
14048 |
|
14049 | effect = effect.nextEffect;
|
14050 | }
|
14051 | }
|
14052 |
|
14053 | var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig;
|
14054 | function requestCurrentSuspenseConfig() {
|
14055 | return ReactCurrentBatchConfig.suspense;
|
14056 | }
|
14057 |
|
14058 | var fakeInternalInstance = {};
|
14059 | var isArray$1 = Array.isArray;
|
14060 |
|
14061 |
|
14062 | var emptyRefsObject = new React.Component().refs;
|
14063 | var didWarnAboutStateAssignmentForComponent;
|
14064 | var didWarnAboutUninitializedState;
|
14065 | var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate;
|
14066 | var didWarnAboutLegacyLifecyclesAndDerivedState;
|
14067 | var didWarnAboutUndefinedDerivedState;
|
14068 | var warnOnUndefinedDerivedState;
|
14069 | var warnOnInvalidCallback$1;
|
14070 | var didWarnAboutDirectlyAssigningPropsToState;
|
14071 | var didWarnAboutContextTypeAndContextTypes;
|
14072 | var didWarnAboutInvalidateContextType;
|
14073 |
|
14074 | {
|
14075 | didWarnAboutStateAssignmentForComponent = new Set();
|
14076 | didWarnAboutUninitializedState = new Set();
|
14077 | didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set();
|
14078 | didWarnAboutLegacyLifecyclesAndDerivedState = new Set();
|
14079 | didWarnAboutDirectlyAssigningPropsToState = new Set();
|
14080 | didWarnAboutUndefinedDerivedState = new Set();
|
14081 | didWarnAboutContextTypeAndContextTypes = new Set();
|
14082 | didWarnAboutInvalidateContextType = new Set();
|
14083 | var didWarnOnInvalidCallback = new Set();
|
14084 |
|
14085 | warnOnInvalidCallback$1 = function (callback, callerName) {
|
14086 | if (callback === null || typeof callback === 'function') {
|
14087 | return;
|
14088 | }
|
14089 |
|
14090 | var key = callerName + "_" + callback;
|
14091 |
|
14092 | if (!didWarnOnInvalidCallback.has(key)) {
|
14093 | didWarnOnInvalidCallback.add(key);
|
14094 | warningWithoutStack$1(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback);
|
14095 | }
|
14096 | };
|
14097 |
|
14098 | warnOnUndefinedDerivedState = function (type, partialState) {
|
14099 | if (partialState === undefined) {
|
14100 | var componentName = getComponentName(type) || 'Component';
|
14101 |
|
14102 | if (!didWarnAboutUndefinedDerivedState.has(componentName)) {
|
14103 | didWarnAboutUndefinedDerivedState.add(componentName);
|
14104 | warningWithoutStack$1(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName);
|
14105 | }
|
14106 | }
|
14107 | };
|
14108 |
|
14109 |
|
14110 |
|
14111 |
|
14112 |
|
14113 |
|
14114 | Object.defineProperty(fakeInternalInstance, '_processChildContext', {
|
14115 | enumerable: false,
|
14116 | value: function () {
|
14117 | (function () {
|
14118 | {
|
14119 | {
|
14120 | throw ReactError(Error("_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal)."));
|
14121 | }
|
14122 | }
|
14123 | })();
|
14124 | }
|
14125 | });
|
14126 | Object.freeze(fakeInternalInstance);
|
14127 | }
|
14128 |
|
14129 | function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, nextProps) {
|
14130 | var prevState = workInProgress.memoizedState;
|
14131 |
|
14132 | {
|
14133 | if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
14134 |
|
14135 | getDerivedStateFromProps(nextProps, prevState);
|
14136 | }
|
14137 | }
|
14138 |
|
14139 | var partialState = getDerivedStateFromProps(nextProps, prevState);
|
14140 |
|
14141 | {
|
14142 | warnOnUndefinedDerivedState(ctor, partialState);
|
14143 | }
|
14144 |
|
14145 |
|
14146 | var memoizedState = partialState === null || partialState === undefined ? prevState : _assign({}, prevState, partialState);
|
14147 | workInProgress.memoizedState = memoizedState;
|
14148 |
|
14149 |
|
14150 | var updateQueue = workInProgress.updateQueue;
|
14151 |
|
14152 | if (updateQueue !== null && workInProgress.expirationTime === NoWork) {
|
14153 | updateQueue.baseState = memoizedState;
|
14154 | }
|
14155 | }
|
14156 | var classComponentUpdater = {
|
14157 | isMounted: isMounted,
|
14158 | enqueueSetState: function (inst, payload, callback) {
|
14159 | var fiber = get(inst);
|
14160 | var currentTime = requestCurrentTime();
|
14161 | var suspenseConfig = requestCurrentSuspenseConfig();
|
14162 | var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
14163 | var update = createUpdate(expirationTime, suspenseConfig);
|
14164 | update.payload = payload;
|
14165 |
|
14166 | if (callback !== undefined && callback !== null) {
|
14167 | {
|
14168 | warnOnInvalidCallback$1(callback, 'setState');
|
14169 | }
|
14170 |
|
14171 | update.callback = callback;
|
14172 | }
|
14173 |
|
14174 | enqueueUpdate(fiber, update);
|
14175 | scheduleWork(fiber, expirationTime);
|
14176 | },
|
14177 | enqueueReplaceState: function (inst, payload, callback) {
|
14178 | var fiber = get(inst);
|
14179 | var currentTime = requestCurrentTime();
|
14180 | var suspenseConfig = requestCurrentSuspenseConfig();
|
14181 | var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
14182 | var update = createUpdate(expirationTime, suspenseConfig);
|
14183 | update.tag = ReplaceState;
|
14184 | update.payload = payload;
|
14185 |
|
14186 | if (callback !== undefined && callback !== null) {
|
14187 | {
|
14188 | warnOnInvalidCallback$1(callback, 'replaceState');
|
14189 | }
|
14190 |
|
14191 | update.callback = callback;
|
14192 | }
|
14193 |
|
14194 | enqueueUpdate(fiber, update);
|
14195 | scheduleWork(fiber, expirationTime);
|
14196 | },
|
14197 | enqueueForceUpdate: function (inst, callback) {
|
14198 | var fiber = get(inst);
|
14199 | var currentTime = requestCurrentTime();
|
14200 | var suspenseConfig = requestCurrentSuspenseConfig();
|
14201 | var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
14202 | var update = createUpdate(expirationTime, suspenseConfig);
|
14203 | update.tag = ForceUpdate;
|
14204 |
|
14205 | if (callback !== undefined && callback !== null) {
|
14206 | {
|
14207 | warnOnInvalidCallback$1(callback, 'forceUpdate');
|
14208 | }
|
14209 |
|
14210 | update.callback = callback;
|
14211 | }
|
14212 |
|
14213 | enqueueUpdate(fiber, update);
|
14214 | scheduleWork(fiber, expirationTime);
|
14215 | }
|
14216 | };
|
14217 |
|
14218 | function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) {
|
14219 | var instance = workInProgress.stateNode;
|
14220 |
|
14221 | if (typeof instance.shouldComponentUpdate === 'function') {
|
14222 | startPhaseTimer(workInProgress, 'shouldComponentUpdate');
|
14223 | var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext);
|
14224 | stopPhaseTimer();
|
14225 |
|
14226 | {
|
14227 | !(shouldUpdate !== undefined) ? warningWithoutStack$1(false, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentName(ctor) || 'Component') : void 0;
|
14228 | }
|
14229 |
|
14230 | return shouldUpdate;
|
14231 | }
|
14232 |
|
14233 | if (ctor.prototype && ctor.prototype.isPureReactComponent) {
|
14234 | return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState);
|
14235 | }
|
14236 |
|
14237 | return true;
|
14238 | }
|
14239 |
|
14240 | function checkClassInstance(workInProgress, ctor, newProps) {
|
14241 | var instance = workInProgress.stateNode;
|
14242 |
|
14243 | {
|
14244 | var name = getComponentName(ctor) || 'Component';
|
14245 | var renderPresent = instance.render;
|
14246 |
|
14247 | if (!renderPresent) {
|
14248 | if (ctor.prototype && typeof ctor.prototype.render === 'function') {
|
14249 | warningWithoutStack$1(false, '%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name);
|
14250 | } else {
|
14251 | warningWithoutStack$1(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name);
|
14252 | }
|
14253 | }
|
14254 |
|
14255 | var noGetInitialStateOnES6 = !instance.getInitialState || instance.getInitialState.isReactClassApproved || instance.state;
|
14256 | !noGetInitialStateOnES6 ? warningWithoutStack$1(false, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', name) : void 0;
|
14257 | var noGetDefaultPropsOnES6 = !instance.getDefaultProps || instance.getDefaultProps.isReactClassApproved;
|
14258 | !noGetDefaultPropsOnES6 ? warningWithoutStack$1(false, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', name) : void 0;
|
14259 | var noInstancePropTypes = !instance.propTypes;
|
14260 | !noInstancePropTypes ? warningWithoutStack$1(false, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name) : void 0;
|
14261 | var noInstanceContextType = !instance.contextType;
|
14262 | !noInstanceContextType ? warningWithoutStack$1(false, 'contextType was defined as an instance property on %s. Use a static ' + 'property to define contextType instead.', name) : void 0;
|
14263 |
|
14264 | if (disableLegacyContext) {
|
14265 | if (ctor.childContextTypes) {
|
14266 | warningWithoutStack$1(false, '%s uses the legacy childContextTypes API which is no longer supported. ' + 'Use React.createContext() instead.', name);
|
14267 | }
|
14268 |
|
14269 | if (ctor.contextTypes) {
|
14270 | warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with static contextType instead.', name);
|
14271 | }
|
14272 | } else {
|
14273 | var noInstanceContextTypes = !instance.contextTypes;
|
14274 | !noInstanceContextTypes ? warningWithoutStack$1(false, 'contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name) : void 0;
|
14275 |
|
14276 | if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) {
|
14277 | didWarnAboutContextTypeAndContextTypes.add(ctor);
|
14278 | warningWithoutStack$1(false, '%s declares both contextTypes and contextType static properties. ' + 'The legacy contextTypes property will be ignored.', name);
|
14279 | }
|
14280 | }
|
14281 |
|
14282 | var noComponentShouldUpdate = typeof instance.componentShouldUpdate !== 'function';
|
14283 | !noComponentShouldUpdate ? warningWithoutStack$1(false, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', name) : void 0;
|
14284 |
|
14285 | if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') {
|
14286 | warningWithoutStack$1(false, '%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentName(ctor) || 'A pure component');
|
14287 | }
|
14288 |
|
14289 | var noComponentDidUnmount = typeof instance.componentDidUnmount !== 'function';
|
14290 | !noComponentDidUnmount ? warningWithoutStack$1(false, '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name) : void 0;
|
14291 | var noComponentDidReceiveProps = typeof instance.componentDidReceiveProps !== 'function';
|
14292 | !noComponentDidReceiveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name) : void 0;
|
14293 | var noComponentWillRecieveProps = typeof instance.componentWillRecieveProps !== 'function';
|
14294 | !noComponentWillRecieveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name) : void 0;
|
14295 | var noUnsafeComponentWillRecieveProps = typeof instance.UNSAFE_componentWillRecieveProps !== 'function';
|
14296 | !noUnsafeComponentWillRecieveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name) : void 0;
|
14297 | var hasMutatedProps = instance.props !== newProps;
|
14298 | !(instance.props === undefined || !hasMutatedProps) ? warningWithoutStack$1(false, '%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name) : void 0;
|
14299 | var noInstanceDefaultProps = !instance.defaultProps;
|
14300 | !noInstanceDefaultProps ? warningWithoutStack$1(false, 'Setting defaultProps as an instance property on %s is not supported and will be ignored.' + ' Instead, define defaultProps as a static property on %s.', name, name) : void 0;
|
14301 |
|
14302 | if (typeof instance.getSnapshotBeforeUpdate === 'function' && typeof instance.componentDidUpdate !== 'function' && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor)) {
|
14303 | didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor);
|
14304 | warningWithoutStack$1(false, '%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' + 'This component defines getSnapshotBeforeUpdate() only.', getComponentName(ctor));
|
14305 | }
|
14306 |
|
14307 | var noInstanceGetDerivedStateFromProps = typeof instance.getDerivedStateFromProps !== 'function';
|
14308 | !noInstanceGetDerivedStateFromProps ? warningWithoutStack$1(false, '%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0;
|
14309 | var noInstanceGetDerivedStateFromCatch = typeof instance.getDerivedStateFromError !== 'function';
|
14310 | !noInstanceGetDerivedStateFromCatch ? warningWithoutStack$1(false, '%s: getDerivedStateFromError() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0;
|
14311 | var noStaticGetSnapshotBeforeUpdate = typeof ctor.getSnapshotBeforeUpdate !== 'function';
|
14312 | !noStaticGetSnapshotBeforeUpdate ? warningWithoutStack$1(false, '%s: getSnapshotBeforeUpdate() is defined as a static method ' + 'and will be ignored. Instead, declare it as an instance method.', name) : void 0;
|
14313 | var _state = instance.state;
|
14314 |
|
14315 | if (_state && (typeof _state !== 'object' || isArray$1(_state))) {
|
14316 | warningWithoutStack$1(false, '%s.state: must be set to an object or null', name);
|
14317 | }
|
14318 |
|
14319 | if (typeof instance.getChildContext === 'function') {
|
14320 | !(typeof ctor.childContextTypes === 'object') ? warningWithoutStack$1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name) : void 0;
|
14321 | }
|
14322 | }
|
14323 | }
|
14324 |
|
14325 | function adoptClassInstance(workInProgress, instance) {
|
14326 | instance.updater = classComponentUpdater;
|
14327 | workInProgress.stateNode = instance;
|
14328 |
|
14329 | set(instance, workInProgress);
|
14330 |
|
14331 | {
|
14332 | instance._reactInternalInstance = fakeInternalInstance;
|
14333 | }
|
14334 | }
|
14335 |
|
14336 | function constructClassInstance(workInProgress, ctor, props, renderExpirationTime) {
|
14337 | var isLegacyContextConsumer = false;
|
14338 | var unmaskedContext = emptyContextObject;
|
14339 | var context = emptyContextObject;
|
14340 | var contextType = ctor.contextType;
|
14341 |
|
14342 | {
|
14343 | if ('contextType' in ctor) {
|
14344 | var isValid =
|
14345 | contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined;
|
14346 |
|
14347 | if (!isValid && !didWarnAboutInvalidateContextType.has(ctor)) {
|
14348 | didWarnAboutInvalidateContextType.add(ctor);
|
14349 | var addendum = '';
|
14350 |
|
14351 | if (contextType === undefined) {
|
14352 | 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.';
|
14353 | } else if (typeof contextType !== 'object') {
|
14354 | addendum = ' However, it is set to a ' + typeof contextType + '.';
|
14355 | } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) {
|
14356 | addendum = ' Did you accidentally pass the Context.Provider instead?';
|
14357 | } else if (contextType._context !== undefined) {
|
14358 |
|
14359 | addendum = ' Did you accidentally pass the Context.Consumer instead?';
|
14360 | } else {
|
14361 | addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.';
|
14362 | }
|
14363 |
|
14364 | warningWithoutStack$1(false, '%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentName(ctor) || 'Component', addendum);
|
14365 | }
|
14366 | }
|
14367 | }
|
14368 |
|
14369 | if (typeof contextType === 'object' && contextType !== null) {
|
14370 | context = readContext(contextType);
|
14371 | } else if (!disableLegacyContext) {
|
14372 | unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
14373 | var contextTypes = ctor.contextTypes;
|
14374 | isLegacyContextConsumer = contextTypes !== null && contextTypes !== undefined;
|
14375 | context = isLegacyContextConsumer ? getMaskedContext(workInProgress, unmaskedContext) : emptyContextObject;
|
14376 | }
|
14377 |
|
14378 |
|
14379 | {
|
14380 | if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
14381 | new ctor(props, context);
|
14382 | }
|
14383 | }
|
14384 |
|
14385 | var instance = new ctor(props, context);
|
14386 | var state = workInProgress.memoizedState = instance.state !== null && instance.state !== undefined ? instance.state : null;
|
14387 | adoptClassInstance(workInProgress, instance);
|
14388 |
|
14389 | {
|
14390 | if (typeof ctor.getDerivedStateFromProps === 'function' && state === null) {
|
14391 | var componentName = getComponentName(ctor) || 'Component';
|
14392 |
|
14393 | if (!didWarnAboutUninitializedState.has(componentName)) {
|
14394 | didWarnAboutUninitializedState.add(componentName);
|
14395 | 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, instance.state === null ? 'null' : 'undefined', componentName);
|
14396 | }
|
14397 | }
|
14398 |
|
14399 |
|
14400 |
|
14401 |
|
14402 | if (typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function') {
|
14403 | var foundWillMountName = null;
|
14404 | var foundWillReceivePropsName = null;
|
14405 | var foundWillUpdateName = null;
|
14406 |
|
14407 | if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) {
|
14408 | foundWillMountName = 'componentWillMount';
|
14409 | } else if (typeof instance.UNSAFE_componentWillMount === 'function') {
|
14410 | foundWillMountName = 'UNSAFE_componentWillMount';
|
14411 | }
|
14412 |
|
14413 | if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
|
14414 | foundWillReceivePropsName = 'componentWillReceiveProps';
|
14415 | } else if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
|
14416 | foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
|
14417 | }
|
14418 |
|
14419 | if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
|
14420 | foundWillUpdateName = 'componentWillUpdate';
|
14421 | } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
|
14422 | foundWillUpdateName = 'UNSAFE_componentWillUpdate';
|
14423 | }
|
14424 |
|
14425 | if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
|
14426 | var _componentName = getComponentName(ctor) || 'Component';
|
14427 |
|
14428 | var newApiName = typeof ctor.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()';
|
14429 |
|
14430 | if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) {
|
14431 | didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName);
|
14432 | warningWithoutStack$1(false, 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + '%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n' + 'The above lifecycles should be removed. Learn more about this warning here:\n' + 'https://fb.me/react-unsafe-component-lifecycles', _componentName, newApiName, foundWillMountName !== null ? "\n " + foundWillMountName : '', foundWillReceivePropsName !== null ? "\n " + foundWillReceivePropsName : '', foundWillUpdateName !== null ? "\n " + foundWillUpdateName : '');
|
14433 | }
|
14434 | }
|
14435 | }
|
14436 | }
|
14437 |
|
14438 |
|
14439 |
|
14440 | if (isLegacyContextConsumer) {
|
14441 | cacheContext(workInProgress, unmaskedContext, context);
|
14442 | }
|
14443 |
|
14444 | return instance;
|
14445 | }
|
14446 |
|
14447 | function callComponentWillMount(workInProgress, instance) {
|
14448 | startPhaseTimer(workInProgress, 'componentWillMount');
|
14449 | var oldState = instance.state;
|
14450 |
|
14451 | if (typeof instance.componentWillMount === 'function') {
|
14452 | instance.componentWillMount();
|
14453 | }
|
14454 |
|
14455 | if (typeof instance.UNSAFE_componentWillMount === 'function') {
|
14456 | instance.UNSAFE_componentWillMount();
|
14457 | }
|
14458 |
|
14459 | stopPhaseTimer();
|
14460 |
|
14461 | if (oldState !== instance.state) {
|
14462 | {
|
14463 | warningWithoutStack$1(false, '%s.componentWillMount(): Assigning directly to this.state is ' + "deprecated (except inside a component's " + 'constructor). Use setState instead.', getComponentName(workInProgress.type) || 'Component');
|
14464 | }
|
14465 |
|
14466 | classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
|
14467 | }
|
14468 | }
|
14469 |
|
14470 | function callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext) {
|
14471 | var oldState = instance.state;
|
14472 | startPhaseTimer(workInProgress, 'componentWillReceiveProps');
|
14473 |
|
14474 | if (typeof instance.componentWillReceiveProps === 'function') {
|
14475 | instance.componentWillReceiveProps(newProps, nextContext);
|
14476 | }
|
14477 |
|
14478 | if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
|
14479 | instance.UNSAFE_componentWillReceiveProps(newProps, nextContext);
|
14480 | }
|
14481 |
|
14482 | stopPhaseTimer();
|
14483 |
|
14484 | if (instance.state !== oldState) {
|
14485 | {
|
14486 | var componentName = getComponentName(workInProgress.type) || 'Component';
|
14487 |
|
14488 | if (!didWarnAboutStateAssignmentForComponent.has(componentName)) {
|
14489 | didWarnAboutStateAssignmentForComponent.add(componentName);
|
14490 | warningWithoutStack$1(false, '%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName);
|
14491 | }
|
14492 | }
|
14493 |
|
14494 | classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
|
14495 | }
|
14496 | }
|
14497 |
|
14498 |
|
14499 | function mountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) {
|
14500 | {
|
14501 | checkClassInstance(workInProgress, ctor, newProps);
|
14502 | }
|
14503 |
|
14504 | var instance = workInProgress.stateNode;
|
14505 | instance.props = newProps;
|
14506 | instance.state = workInProgress.memoizedState;
|
14507 | instance.refs = emptyRefsObject;
|
14508 | var contextType = ctor.contextType;
|
14509 |
|
14510 | if (typeof contextType === 'object' && contextType !== null) {
|
14511 | instance.context = readContext(contextType);
|
14512 | } else if (disableLegacyContext) {
|
14513 | instance.context = emptyContextObject;
|
14514 | } else {
|
14515 | var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
14516 | instance.context = getMaskedContext(workInProgress, unmaskedContext);
|
14517 | }
|
14518 |
|
14519 | {
|
14520 | if (instance.state === newProps) {
|
14521 | var componentName = getComponentName(ctor) || 'Component';
|
14522 |
|
14523 | if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) {
|
14524 | didWarnAboutDirectlyAssigningPropsToState.add(componentName);
|
14525 | warningWithoutStack$1(false, '%s: It is not recommended to assign props directly to state ' + "because updates to props won't be reflected in state. " + 'In most cases, it is better to use props directly.', componentName);
|
14526 | }
|
14527 | }
|
14528 |
|
14529 | if (workInProgress.mode & StrictMode) {
|
14530 | ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, instance);
|
14531 | }
|
14532 |
|
14533 | if (warnAboutDeprecatedLifecycles) {
|
14534 | ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance);
|
14535 | }
|
14536 | }
|
14537 |
|
14538 | var updateQueue = workInProgress.updateQueue;
|
14539 |
|
14540 | if (updateQueue !== null) {
|
14541 | processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
|
14542 | instance.state = workInProgress.memoizedState;
|
14543 | }
|
14544 |
|
14545 | var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
|
14546 |
|
14547 | if (typeof getDerivedStateFromProps === 'function') {
|
14548 | applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
|
14549 | instance.state = workInProgress.memoizedState;
|
14550 | }
|
14551 |
|
14552 |
|
14553 |
|
14554 | if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
|
14555 | callComponentWillMount(workInProgress, instance);
|
14556 |
|
14557 |
|
14558 | updateQueue = workInProgress.updateQueue;
|
14559 |
|
14560 | if (updateQueue !== null) {
|
14561 | processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
|
14562 | instance.state = workInProgress.memoizedState;
|
14563 | }
|
14564 | }
|
14565 |
|
14566 | if (typeof instance.componentDidMount === 'function') {
|
14567 | workInProgress.effectTag |= Update;
|
14568 | }
|
14569 | }
|
14570 |
|
14571 | function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) {
|
14572 | var instance = workInProgress.stateNode;
|
14573 | var oldProps = workInProgress.memoizedProps;
|
14574 | instance.props = oldProps;
|
14575 | var oldContext = instance.context;
|
14576 | var contextType = ctor.contextType;
|
14577 | var nextContext = emptyContextObject;
|
14578 |
|
14579 | if (typeof contextType === 'object' && contextType !== null) {
|
14580 | nextContext = readContext(contextType);
|
14581 | } else if (!disableLegacyContext) {
|
14582 | var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
14583 | nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext);
|
14584 | }
|
14585 |
|
14586 | var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
|
14587 | var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
|
14588 |
|
14589 |
|
14590 |
|
14591 |
|
14592 |
|
14593 | if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
|
14594 | if (oldProps !== newProps || oldContext !== nextContext) {
|
14595 | callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
|
14596 | }
|
14597 | }
|
14598 |
|
14599 | resetHasForceUpdateBeforeProcessing();
|
14600 | var oldState = workInProgress.memoizedState;
|
14601 | var newState = instance.state = oldState;
|
14602 | var updateQueue = workInProgress.updateQueue;
|
14603 |
|
14604 | if (updateQueue !== null) {
|
14605 | processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
|
14606 | newState = workInProgress.memoizedState;
|
14607 | }
|
14608 |
|
14609 | if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
|
14610 |
|
14611 |
|
14612 | if (typeof instance.componentDidMount === 'function') {
|
14613 | workInProgress.effectTag |= Update;
|
14614 | }
|
14615 |
|
14616 | return false;
|
14617 | }
|
14618 |
|
14619 | if (typeof getDerivedStateFromProps === 'function') {
|
14620 | applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
|
14621 | newState = workInProgress.memoizedState;
|
14622 | }
|
14623 |
|
14624 | var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
|
14625 |
|
14626 | if (shouldUpdate) {
|
14627 |
|
14628 |
|
14629 | if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
|
14630 | startPhaseTimer(workInProgress, 'componentWillMount');
|
14631 |
|
14632 | if (typeof instance.componentWillMount === 'function') {
|
14633 | instance.componentWillMount();
|
14634 | }
|
14635 |
|
14636 | if (typeof instance.UNSAFE_componentWillMount === 'function') {
|
14637 | instance.UNSAFE_componentWillMount();
|
14638 | }
|
14639 |
|
14640 | stopPhaseTimer();
|
14641 | }
|
14642 |
|
14643 | if (typeof instance.componentDidMount === 'function') {
|
14644 | workInProgress.effectTag |= Update;
|
14645 | }
|
14646 | } else {
|
14647 |
|
14648 |
|
14649 | if (typeof instance.componentDidMount === 'function') {
|
14650 | workInProgress.effectTag |= Update;
|
14651 | }
|
14652 |
|
14653 |
|
14654 |
|
14655 | workInProgress.memoizedProps = newProps;
|
14656 | workInProgress.memoizedState = newState;
|
14657 | }
|
14658 |
|
14659 |
|
14660 |
|
14661 | instance.props = newProps;
|
14662 | instance.state = newState;
|
14663 | instance.context = nextContext;
|
14664 | return shouldUpdate;
|
14665 | }
|
14666 |
|
14667 |
|
14668 | function updateClassInstance(current, workInProgress, ctor, newProps, renderExpirationTime) {
|
14669 | var instance = workInProgress.stateNode;
|
14670 | var oldProps = workInProgress.memoizedProps;
|
14671 | instance.props = workInProgress.type === workInProgress.elementType ? oldProps : resolveDefaultProps(workInProgress.type, oldProps);
|
14672 | var oldContext = instance.context;
|
14673 | var contextType = ctor.contextType;
|
14674 | var nextContext = emptyContextObject;
|
14675 |
|
14676 | if (typeof contextType === 'object' && contextType !== null) {
|
14677 | nextContext = readContext(contextType);
|
14678 | } else if (!disableLegacyContext) {
|
14679 | var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
14680 | nextContext = getMaskedContext(workInProgress, nextUnmaskedContext);
|
14681 | }
|
14682 |
|
14683 | var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
|
14684 | var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
|
14685 |
|
14686 |
|
14687 |
|
14688 |
|
14689 |
|
14690 | if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
|
14691 | if (oldProps !== newProps || oldContext !== nextContext) {
|
14692 | callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
|
14693 | }
|
14694 | }
|
14695 |
|
14696 | resetHasForceUpdateBeforeProcessing();
|
14697 | var oldState = workInProgress.memoizedState;
|
14698 | var newState = instance.state = oldState;
|
14699 | var updateQueue = workInProgress.updateQueue;
|
14700 |
|
14701 | if (updateQueue !== null) {
|
14702 | processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
|
14703 | newState = workInProgress.memoizedState;
|
14704 | }
|
14705 |
|
14706 | if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
|
14707 |
|
14708 |
|
14709 | if (typeof instance.componentDidUpdate === 'function') {
|
14710 | if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
14711 | workInProgress.effectTag |= Update;
|
14712 | }
|
14713 | }
|
14714 |
|
14715 | if (typeof instance.getSnapshotBeforeUpdate === 'function') {
|
14716 | if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
14717 | workInProgress.effectTag |= Snapshot;
|
14718 | }
|
14719 | }
|
14720 |
|
14721 | return false;
|
14722 | }
|
14723 |
|
14724 | if (typeof getDerivedStateFromProps === 'function') {
|
14725 | applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
|
14726 | newState = workInProgress.memoizedState;
|
14727 | }
|
14728 |
|
14729 | var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
|
14730 |
|
14731 | if (shouldUpdate) {
|
14732 |
|
14733 |
|
14734 | if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) {
|
14735 | startPhaseTimer(workInProgress, 'componentWillUpdate');
|
14736 |
|
14737 | if (typeof instance.componentWillUpdate === 'function') {
|
14738 | instance.componentWillUpdate(newProps, newState, nextContext);
|
14739 | }
|
14740 |
|
14741 | if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
|
14742 | instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext);
|
14743 | }
|
14744 |
|
14745 | stopPhaseTimer();
|
14746 | }
|
14747 |
|
14748 | if (typeof instance.componentDidUpdate === 'function') {
|
14749 | workInProgress.effectTag |= Update;
|
14750 | }
|
14751 |
|
14752 | if (typeof instance.getSnapshotBeforeUpdate === 'function') {
|
14753 | workInProgress.effectTag |= Snapshot;
|
14754 | }
|
14755 | } else {
|
14756 |
|
14757 |
|
14758 | if (typeof instance.componentDidUpdate === 'function') {
|
14759 | if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
14760 | workInProgress.effectTag |= Update;
|
14761 | }
|
14762 | }
|
14763 |
|
14764 | if (typeof instance.getSnapshotBeforeUpdate === 'function') {
|
14765 | if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
14766 | workInProgress.effectTag |= Snapshot;
|
14767 | }
|
14768 | }
|
14769 |
|
14770 |
|
14771 |
|
14772 | workInProgress.memoizedProps = newProps;
|
14773 | workInProgress.memoizedState = newState;
|
14774 | }
|
14775 |
|
14776 |
|
14777 |
|
14778 | instance.props = newProps;
|
14779 | instance.state = newState;
|
14780 | instance.context = nextContext;
|
14781 | return shouldUpdate;
|
14782 | }
|
14783 |
|
14784 | var didWarnAboutMaps;
|
14785 | var didWarnAboutGenerators;
|
14786 | var didWarnAboutStringRefs;
|
14787 | var ownerHasKeyUseWarning;
|
14788 | var ownerHasFunctionTypeWarning;
|
14789 |
|
14790 | var warnForMissingKey = function (child) {};
|
14791 |
|
14792 | {
|
14793 | didWarnAboutMaps = false;
|
14794 | didWarnAboutGenerators = false;
|
14795 | didWarnAboutStringRefs = {};
|
14796 | |
14797 |
|
14798 |
|
14799 |
|
14800 |
|
14801 |
|
14802 | ownerHasKeyUseWarning = {};
|
14803 | ownerHasFunctionTypeWarning = {};
|
14804 |
|
14805 | warnForMissingKey = function (child) {
|
14806 | if (child === null || typeof child !== 'object') {
|
14807 | return;
|
14808 | }
|
14809 |
|
14810 | if (!child._store || child._store.validated || child.key != null) {
|
14811 | return;
|
14812 | }
|
14813 |
|
14814 | (function () {
|
14815 | if (!(typeof child._store === 'object')) {
|
14816 | {
|
14817 | throw ReactError(Error("React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue."));
|
14818 | }
|
14819 | }
|
14820 | })();
|
14821 |
|
14822 | child._store.validated = true;
|
14823 | var currentComponentErrorInfo = 'Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.' + getCurrentFiberStackInDev();
|
14824 |
|
14825 | if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
14826 | return;
|
14827 | }
|
14828 |
|
14829 | ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
14830 | warning$1(false, 'Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.');
|
14831 | };
|
14832 | }
|
14833 |
|
14834 | var isArray = Array.isArray;
|
14835 |
|
14836 | function coerceRef(returnFiber, current$$1, element) {
|
14837 | var mixedRef = element.ref;
|
14838 |
|
14839 | if (mixedRef !== null && typeof mixedRef !== 'function' && typeof mixedRef !== 'object') {
|
14840 | {
|
14841 |
|
14842 |
|
14843 | if (returnFiber.mode & StrictMode || warnAboutStringRefs) {
|
14844 | var componentName = getComponentName(returnFiber.type) || 'Component';
|
14845 |
|
14846 | if (!didWarnAboutStringRefs[componentName]) {
|
14847 | if (warnAboutStringRefs) {
|
14848 | warningWithoutStack$1(false, 'Component "%s" contains the string ref "%s". Support for string refs ' + 'will be removed in a future major release. We recommend using ' + 'useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-string-ref%s', componentName, mixedRef, getStackByFiberInDevAndProd(returnFiber));
|
14849 | } else {
|
14850 | warningWithoutStack$1(false, 'A string ref, "%s", has been found within a strict mode tree. ' + 'String refs are a source of potential bugs and should be avoided. ' + 'We recommend using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-string-ref%s', mixedRef, getStackByFiberInDevAndProd(returnFiber));
|
14851 | }
|
14852 |
|
14853 | didWarnAboutStringRefs[componentName] = true;
|
14854 | }
|
14855 | }
|
14856 | }
|
14857 |
|
14858 | if (element._owner) {
|
14859 | var owner = element._owner;
|
14860 | var inst;
|
14861 |
|
14862 | if (owner) {
|
14863 | var ownerFiber = owner;
|
14864 |
|
14865 | (function () {
|
14866 | if (!(ownerFiber.tag === ClassComponent)) {
|
14867 | {
|
14868 | throw ReactError(Error("Function components cannot have refs. Did you mean to use React.forwardRef()?"));
|
14869 | }
|
14870 | }
|
14871 | })();
|
14872 |
|
14873 | inst = ownerFiber.stateNode;
|
14874 | }
|
14875 |
|
14876 | (function () {
|
14877 | if (!inst) {
|
14878 | {
|
14879 | throw ReactError(Error("Missing owner for string ref " + mixedRef + ". This error is likely caused by a bug in React. Please file an issue."));
|
14880 | }
|
14881 | }
|
14882 | })();
|
14883 |
|
14884 | var stringRef = '' + mixedRef;
|
14885 |
|
14886 | if (current$$1 !== null && current$$1.ref !== null && typeof current$$1.ref === 'function' && current$$1.ref._stringRef === stringRef) {
|
14887 | return current$$1.ref;
|
14888 | }
|
14889 |
|
14890 | var ref = function (value) {
|
14891 | var refs = inst.refs;
|
14892 |
|
14893 | if (refs === emptyRefsObject) {
|
14894 |
|
14895 | refs = inst.refs = {};
|
14896 | }
|
14897 |
|
14898 | if (value === null) {
|
14899 | delete refs[stringRef];
|
14900 | } else {
|
14901 | refs[stringRef] = value;
|
14902 | }
|
14903 | };
|
14904 |
|
14905 | ref._stringRef = stringRef;
|
14906 | return ref;
|
14907 | } else {
|
14908 | (function () {
|
14909 | if (!(typeof mixedRef === 'string')) {
|
14910 | {
|
14911 | throw ReactError(Error("Expected ref to be a function, a string, an object returned by React.createRef(), or null."));
|
14912 | }
|
14913 | }
|
14914 | })();
|
14915 |
|
14916 | (function () {
|
14917 | if (!element._owner) {
|
14918 | {
|
14919 | throw ReactError(Error("Element ref was specified as a string (" + mixedRef + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information."));
|
14920 | }
|
14921 | }
|
14922 | })();
|
14923 | }
|
14924 | }
|
14925 |
|
14926 | return mixedRef;
|
14927 | }
|
14928 |
|
14929 | function throwOnInvalidObjectType(returnFiber, newChild) {
|
14930 | if (returnFiber.type !== 'textarea') {
|
14931 | var addendum = '';
|
14932 |
|
14933 | {
|
14934 | addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getCurrentFiberStackInDev();
|
14935 | }
|
14936 |
|
14937 | (function () {
|
14938 | {
|
14939 | {
|
14940 | throw ReactError(Error("Objects are not valid as a React child (found: " + (Object.prototype.toString.call(newChild) === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : newChild) + ")." + addendum));
|
14941 | }
|
14942 | }
|
14943 | })();
|
14944 | }
|
14945 | }
|
14946 |
|
14947 | function warnOnFunctionType() {
|
14948 | var currentComponentErrorInfo = 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.' + getCurrentFiberStackInDev();
|
14949 |
|
14950 | if (ownerHasFunctionTypeWarning[currentComponentErrorInfo]) {
|
14951 | return;
|
14952 | }
|
14953 |
|
14954 | ownerHasFunctionTypeWarning[currentComponentErrorInfo] = true;
|
14955 | warning$1(false, 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.');
|
14956 | }
|
14957 |
|
14958 |
|
14959 |
|
14960 |
|
14961 |
|
14962 | function ChildReconciler(shouldTrackSideEffects) {
|
14963 | function deleteChild(returnFiber, childToDelete) {
|
14964 | if (!shouldTrackSideEffects) {
|
14965 |
|
14966 | return;
|
14967 | }
|
14968 |
|
14969 |
|
14970 |
|
14971 |
|
14972 |
|
14973 |
|
14974 | var last = returnFiber.lastEffect;
|
14975 |
|
14976 | if (last !== null) {
|
14977 | last.nextEffect = childToDelete;
|
14978 | returnFiber.lastEffect = childToDelete;
|
14979 | } else {
|
14980 | returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
|
14981 | }
|
14982 |
|
14983 | childToDelete.nextEffect = null;
|
14984 | childToDelete.effectTag = Deletion;
|
14985 | }
|
14986 |
|
14987 | function deleteRemainingChildren(returnFiber, currentFirstChild) {
|
14988 | if (!shouldTrackSideEffects) {
|
14989 |
|
14990 | return null;
|
14991 | }
|
14992 |
|
14993 |
|
14994 |
|
14995 | var childToDelete = currentFirstChild;
|
14996 |
|
14997 | while (childToDelete !== null) {
|
14998 | deleteChild(returnFiber, childToDelete);
|
14999 | childToDelete = childToDelete.sibling;
|
15000 | }
|
15001 |
|
15002 | return null;
|
15003 | }
|
15004 |
|
15005 | function mapRemainingChildren(returnFiber, currentFirstChild) {
|
15006 |
|
15007 |
|
15008 |
|
15009 | var existingChildren = new Map();
|
15010 | var existingChild = currentFirstChild;
|
15011 |
|
15012 | while (existingChild !== null) {
|
15013 | if (existingChild.key !== null) {
|
15014 | existingChildren.set(existingChild.key, existingChild);
|
15015 | } else {
|
15016 | existingChildren.set(existingChild.index, existingChild);
|
15017 | }
|
15018 |
|
15019 | existingChild = existingChild.sibling;
|
15020 | }
|
15021 |
|
15022 | return existingChildren;
|
15023 | }
|
15024 |
|
15025 | function useFiber(fiber, pendingProps, expirationTime) {
|
15026 |
|
15027 |
|
15028 | var clone = createWorkInProgress(fiber, pendingProps, expirationTime);
|
15029 | clone.index = 0;
|
15030 | clone.sibling = null;
|
15031 | return clone;
|
15032 | }
|
15033 |
|
15034 | function placeChild(newFiber, lastPlacedIndex, newIndex) {
|
15035 | newFiber.index = newIndex;
|
15036 |
|
15037 | if (!shouldTrackSideEffects) {
|
15038 |
|
15039 | return lastPlacedIndex;
|
15040 | }
|
15041 |
|
15042 | var current$$1 = newFiber.alternate;
|
15043 |
|
15044 | if (current$$1 !== null) {
|
15045 | var oldIndex = current$$1.index;
|
15046 |
|
15047 | if (oldIndex < lastPlacedIndex) {
|
15048 |
|
15049 | newFiber.effectTag = Placement;
|
15050 | return lastPlacedIndex;
|
15051 | } else {
|
15052 |
|
15053 | return oldIndex;
|
15054 | }
|
15055 | } else {
|
15056 |
|
15057 | newFiber.effectTag = Placement;
|
15058 | return lastPlacedIndex;
|
15059 | }
|
15060 | }
|
15061 |
|
15062 | function placeSingleChild(newFiber) {
|
15063 |
|
15064 |
|
15065 | if (shouldTrackSideEffects && newFiber.alternate === null) {
|
15066 | newFiber.effectTag = Placement;
|
15067 | }
|
15068 |
|
15069 | return newFiber;
|
15070 | }
|
15071 |
|
15072 | function updateTextNode(returnFiber, current$$1, textContent, expirationTime) {
|
15073 | if (current$$1 === null || current$$1.tag !== HostText) {
|
15074 |
|
15075 | var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
|
15076 | created.return = returnFiber;
|
15077 | return created;
|
15078 | } else {
|
15079 |
|
15080 | var existing = useFiber(current$$1, textContent, expirationTime);
|
15081 | existing.return = returnFiber;
|
15082 | return existing;
|
15083 | }
|
15084 | }
|
15085 |
|
15086 | function updateElement(returnFiber, current$$1, element, expirationTime) {
|
15087 | if (current$$1 !== null && (current$$1.elementType === element.type || (
|
15088 | isCompatibleFamilyForHotReloading(current$$1, element)))) {
|
15089 |
|
15090 | var existing = useFiber(current$$1, element.props, expirationTime);
|
15091 | existing.ref = coerceRef(returnFiber, current$$1, element);
|
15092 | existing.return = returnFiber;
|
15093 |
|
15094 | {
|
15095 | existing._debugSource = element._source;
|
15096 | existing._debugOwner = element._owner;
|
15097 | }
|
15098 |
|
15099 | return existing;
|
15100 | } else {
|
15101 |
|
15102 | var created = createFiberFromElement(element, returnFiber.mode, expirationTime);
|
15103 | created.ref = coerceRef(returnFiber, current$$1, element);
|
15104 | created.return = returnFiber;
|
15105 | return created;
|
15106 | }
|
15107 | }
|
15108 |
|
15109 | function updatePortal(returnFiber, current$$1, portal, expirationTime) {
|
15110 | if (current$$1 === null || current$$1.tag !== HostPortal || current$$1.stateNode.containerInfo !== portal.containerInfo || current$$1.stateNode.implementation !== portal.implementation) {
|
15111 |
|
15112 | var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
|
15113 | created.return = returnFiber;
|
15114 | return created;
|
15115 | } else {
|
15116 |
|
15117 | var existing = useFiber(current$$1, portal.children || [], expirationTime);
|
15118 | existing.return = returnFiber;
|
15119 | return existing;
|
15120 | }
|
15121 | }
|
15122 |
|
15123 | function updateFragment(returnFiber, current$$1, fragment, expirationTime, key) {
|
15124 | if (current$$1 === null || current$$1.tag !== Fragment) {
|
15125 |
|
15126 | var created = createFiberFromFragment(fragment, returnFiber.mode, expirationTime, key);
|
15127 | created.return = returnFiber;
|
15128 | return created;
|
15129 | } else {
|
15130 |
|
15131 | var existing = useFiber(current$$1, fragment, expirationTime);
|
15132 | existing.return = returnFiber;
|
15133 | return existing;
|
15134 | }
|
15135 | }
|
15136 |
|
15137 | function createChild(returnFiber, newChild, expirationTime) {
|
15138 | if (typeof newChild === 'string' || typeof newChild === 'number') {
|
15139 |
|
15140 |
|
15141 |
|
15142 | var created = createFiberFromText('' + newChild, returnFiber.mode, expirationTime);
|
15143 | created.return = returnFiber;
|
15144 | return created;
|
15145 | }
|
15146 |
|
15147 | if (typeof newChild === 'object' && newChild !== null) {
|
15148 | switch (newChild.$$typeof) {
|
15149 | case REACT_ELEMENT_TYPE:
|
15150 | {
|
15151 | var _created = createFiberFromElement(newChild, returnFiber.mode, expirationTime);
|
15152 |
|
15153 | _created.ref = coerceRef(returnFiber, null, newChild);
|
15154 | _created.return = returnFiber;
|
15155 | return _created;
|
15156 | }
|
15157 |
|
15158 | case REACT_PORTAL_TYPE:
|
15159 | {
|
15160 | var _created2 = createFiberFromPortal(newChild, returnFiber.mode, expirationTime);
|
15161 |
|
15162 | _created2.return = returnFiber;
|
15163 | return _created2;
|
15164 | }
|
15165 | }
|
15166 |
|
15167 | if (isArray(newChild) || getIteratorFn(newChild)) {
|
15168 | var _created3 = createFiberFromFragment(newChild, returnFiber.mode, expirationTime, null);
|
15169 |
|
15170 | _created3.return = returnFiber;
|
15171 | return _created3;
|
15172 | }
|
15173 |
|
15174 | throwOnInvalidObjectType(returnFiber, newChild);
|
15175 | }
|
15176 |
|
15177 | {
|
15178 | if (typeof newChild === 'function') {
|
15179 | warnOnFunctionType();
|
15180 | }
|
15181 | }
|
15182 |
|
15183 | return null;
|
15184 | }
|
15185 |
|
15186 | function updateSlot(returnFiber, oldFiber, newChild, expirationTime) {
|
15187 |
|
15188 | var key = oldFiber !== null ? oldFiber.key : null;
|
15189 |
|
15190 | if (typeof newChild === 'string' || typeof newChild === 'number') {
|
15191 |
|
15192 |
|
15193 |
|
15194 | if (key !== null) {
|
15195 | return null;
|
15196 | }
|
15197 |
|
15198 | return updateTextNode(returnFiber, oldFiber, '' + newChild, expirationTime);
|
15199 | }
|
15200 |
|
15201 | if (typeof newChild === 'object' && newChild !== null) {
|
15202 | switch (newChild.$$typeof) {
|
15203 | case REACT_ELEMENT_TYPE:
|
15204 | {
|
15205 | if (newChild.key === key) {
|
15206 | if (newChild.type === REACT_FRAGMENT_TYPE) {
|
15207 | return updateFragment(returnFiber, oldFiber, newChild.props.children, expirationTime, key);
|
15208 | }
|
15209 |
|
15210 | return updateElement(returnFiber, oldFiber, newChild, expirationTime);
|
15211 | } else {
|
15212 | return null;
|
15213 | }
|
15214 | }
|
15215 |
|
15216 | case REACT_PORTAL_TYPE:
|
15217 | {
|
15218 | if (newChild.key === key) {
|
15219 | return updatePortal(returnFiber, oldFiber, newChild, expirationTime);
|
15220 | } else {
|
15221 | return null;
|
15222 | }
|
15223 | }
|
15224 | }
|
15225 |
|
15226 | if (isArray(newChild) || getIteratorFn(newChild)) {
|
15227 | if (key !== null) {
|
15228 | return null;
|
15229 | }
|
15230 |
|
15231 | return updateFragment(returnFiber, oldFiber, newChild, expirationTime, null);
|
15232 | }
|
15233 |
|
15234 | throwOnInvalidObjectType(returnFiber, newChild);
|
15235 | }
|
15236 |
|
15237 | {
|
15238 | if (typeof newChild === 'function') {
|
15239 | warnOnFunctionType();
|
15240 | }
|
15241 | }
|
15242 |
|
15243 | return null;
|
15244 | }
|
15245 |
|
15246 | function updateFromMap(existingChildren, returnFiber, newIdx, newChild, expirationTime) {
|
15247 | if (typeof newChild === 'string' || typeof newChild === 'number') {
|
15248 |
|
15249 |
|
15250 | var matchedFiber = existingChildren.get(newIdx) || null;
|
15251 | return updateTextNode(returnFiber, matchedFiber, '' + newChild, expirationTime);
|
15252 | }
|
15253 |
|
15254 | if (typeof newChild === 'object' && newChild !== null) {
|
15255 | switch (newChild.$$typeof) {
|
15256 | case REACT_ELEMENT_TYPE:
|
15257 | {
|
15258 | var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
|
15259 |
|
15260 | if (newChild.type === REACT_FRAGMENT_TYPE) {
|
15261 | return updateFragment(returnFiber, _matchedFiber, newChild.props.children, expirationTime, newChild.key);
|
15262 | }
|
15263 |
|
15264 | return updateElement(returnFiber, _matchedFiber, newChild, expirationTime);
|
15265 | }
|
15266 |
|
15267 | case REACT_PORTAL_TYPE:
|
15268 | {
|
15269 | var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
|
15270 |
|
15271 | return updatePortal(returnFiber, _matchedFiber2, newChild, expirationTime);
|
15272 | }
|
15273 | }
|
15274 |
|
15275 | if (isArray(newChild) || getIteratorFn(newChild)) {
|
15276 | var _matchedFiber3 = existingChildren.get(newIdx) || null;
|
15277 |
|
15278 | return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null);
|
15279 | }
|
15280 |
|
15281 | throwOnInvalidObjectType(returnFiber, newChild);
|
15282 | }
|
15283 |
|
15284 | {
|
15285 | if (typeof newChild === 'function') {
|
15286 | warnOnFunctionType();
|
15287 | }
|
15288 | }
|
15289 |
|
15290 | return null;
|
15291 | }
|
15292 | |
15293 |
|
15294 |
|
15295 |
|
15296 |
|
15297 | function warnOnInvalidKey(child, knownKeys) {
|
15298 | {
|
15299 | if (typeof child !== 'object' || child === null) {
|
15300 | return knownKeys;
|
15301 | }
|
15302 |
|
15303 | switch (child.$$typeof) {
|
15304 | case REACT_ELEMENT_TYPE:
|
15305 | case REACT_PORTAL_TYPE:
|
15306 | warnForMissingKey(child);
|
15307 | var key = child.key;
|
15308 |
|
15309 | if (typeof key !== 'string') {
|
15310 | break;
|
15311 | }
|
15312 |
|
15313 | if (knownKeys === null) {
|
15314 | knownKeys = new Set();
|
15315 | knownKeys.add(key);
|
15316 | break;
|
15317 | }
|
15318 |
|
15319 | if (!knownKeys.has(key)) {
|
15320 | knownKeys.add(key);
|
15321 | break;
|
15322 | }
|
15323 |
|
15324 | warning$1(false, 'Encountered two children with the same key, `%s`. ' + 'Keys should be unique so that components maintain their identity ' + 'across updates. Non-unique keys may cause children to be ' + 'duplicated and/or omitted — the behavior is unsupported and ' + 'could change in a future version.', key);
|
15325 | break;
|
15326 |
|
15327 | default:
|
15328 | break;
|
15329 | }
|
15330 | }
|
15331 |
|
15332 | return knownKeys;
|
15333 | }
|
15334 |
|
15335 | function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, expirationTime) {
|
15336 |
|
15337 |
|
15338 |
|
15339 |
|
15340 |
|
15341 |
|
15342 |
|
15343 |
|
15344 |
|
15345 |
|
15346 |
|
15347 |
|
15348 |
|
15349 |
|
15350 |
|
15351 | {
|
15352 |
|
15353 | var knownKeys = null;
|
15354 |
|
15355 | for (var i = 0; i < newChildren.length; i++) {
|
15356 | var child = newChildren[i];
|
15357 | knownKeys = warnOnInvalidKey(child, knownKeys);
|
15358 | }
|
15359 | }
|
15360 |
|
15361 | var resultingFirstChild = null;
|
15362 | var previousNewFiber = null;
|
15363 | var oldFiber = currentFirstChild;
|
15364 | var lastPlacedIndex = 0;
|
15365 | var newIdx = 0;
|
15366 | var nextOldFiber = null;
|
15367 |
|
15368 | for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) {
|
15369 | if (oldFiber.index > newIdx) {
|
15370 | nextOldFiber = oldFiber;
|
15371 | oldFiber = null;
|
15372 | } else {
|
15373 | nextOldFiber = oldFiber.sibling;
|
15374 | }
|
15375 |
|
15376 | var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], expirationTime);
|
15377 |
|
15378 | if (newFiber === null) {
|
15379 |
|
15380 |
|
15381 |
|
15382 |
|
15383 | if (oldFiber === null) {
|
15384 | oldFiber = nextOldFiber;
|
15385 | }
|
15386 |
|
15387 | break;
|
15388 | }
|
15389 |
|
15390 | if (shouldTrackSideEffects) {
|
15391 | if (oldFiber && newFiber.alternate === null) {
|
15392 |
|
15393 |
|
15394 | deleteChild(returnFiber, oldFiber);
|
15395 | }
|
15396 | }
|
15397 |
|
15398 | lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
|
15399 |
|
15400 | if (previousNewFiber === null) {
|
15401 |
|
15402 | resultingFirstChild = newFiber;
|
15403 | } else {
|
15404 |
|
15405 |
|
15406 |
|
15407 |
|
15408 | previousNewFiber.sibling = newFiber;
|
15409 | }
|
15410 |
|
15411 | previousNewFiber = newFiber;
|
15412 | oldFiber = nextOldFiber;
|
15413 | }
|
15414 |
|
15415 | if (newIdx === newChildren.length) {
|
15416 |
|
15417 | deleteRemainingChildren(returnFiber, oldFiber);
|
15418 | return resultingFirstChild;
|
15419 | }
|
15420 |
|
15421 | if (oldFiber === null) {
|
15422 |
|
15423 |
|
15424 | for (; newIdx < newChildren.length; newIdx++) {
|
15425 | var _newFiber = createChild(returnFiber, newChildren[newIdx], expirationTime);
|
15426 |
|
15427 | if (_newFiber === null) {
|
15428 | continue;
|
15429 | }
|
15430 |
|
15431 | lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx);
|
15432 |
|
15433 | if (previousNewFiber === null) {
|
15434 |
|
15435 | resultingFirstChild = _newFiber;
|
15436 | } else {
|
15437 | previousNewFiber.sibling = _newFiber;
|
15438 | }
|
15439 |
|
15440 | previousNewFiber = _newFiber;
|
15441 | }
|
15442 |
|
15443 | return resultingFirstChild;
|
15444 | }
|
15445 |
|
15446 |
|
15447 | var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
|
15448 |
|
15449 | for (; newIdx < newChildren.length; newIdx++) {
|
15450 | var _newFiber2 = updateFromMap(existingChildren, returnFiber, newIdx, newChildren[newIdx], expirationTime);
|
15451 |
|
15452 | if (_newFiber2 !== null) {
|
15453 | if (shouldTrackSideEffects) {
|
15454 | if (_newFiber2.alternate !== null) {
|
15455 |
|
15456 |
|
15457 |
|
15458 |
|
15459 | existingChildren.delete(_newFiber2.key === null ? newIdx : _newFiber2.key);
|
15460 | }
|
15461 | }
|
15462 |
|
15463 | lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx);
|
15464 |
|
15465 | if (previousNewFiber === null) {
|
15466 | resultingFirstChild = _newFiber2;
|
15467 | } else {
|
15468 | previousNewFiber.sibling = _newFiber2;
|
15469 | }
|
15470 |
|
15471 | previousNewFiber = _newFiber2;
|
15472 | }
|
15473 | }
|
15474 |
|
15475 | if (shouldTrackSideEffects) {
|
15476 |
|
15477 |
|
15478 | existingChildren.forEach(function (child) {
|
15479 | return deleteChild(returnFiber, child);
|
15480 | });
|
15481 | }
|
15482 |
|
15483 | return resultingFirstChild;
|
15484 | }
|
15485 |
|
15486 | function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, expirationTime) {
|
15487 |
|
15488 |
|
15489 | var iteratorFn = getIteratorFn(newChildrenIterable);
|
15490 |
|
15491 | (function () {
|
15492 | if (!(typeof iteratorFn === 'function')) {
|
15493 | {
|
15494 | throw ReactError(Error("An object is not an iterable. This error is likely caused by a bug in React. Please file an issue."));
|
15495 | }
|
15496 | }
|
15497 | })();
|
15498 |
|
15499 | {
|
15500 |
|
15501 |
|
15502 | if (typeof Symbol === 'function' &&
|
15503 | newChildrenIterable[Symbol.toStringTag] === 'Generator') {
|
15504 | !didWarnAboutGenerators ? warning$1(false, 'Using Generators as children is unsupported and will likely yield ' + 'unexpected results because enumerating a generator mutates it. ' + 'You may convert it to an array with `Array.from()` or the ' + '`[...spread]` operator before rendering. Keep in mind ' + 'you might need to polyfill these features for older browsers.') : void 0;
|
15505 | didWarnAboutGenerators = true;
|
15506 | }
|
15507 |
|
15508 |
|
15509 | if (newChildrenIterable.entries === iteratorFn) {
|
15510 | !didWarnAboutMaps ? warning$1(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.') : void 0;
|
15511 | didWarnAboutMaps = true;
|
15512 | }
|
15513 |
|
15514 |
|
15515 |
|
15516 | var _newChildren = iteratorFn.call(newChildrenIterable);
|
15517 |
|
15518 | if (_newChildren) {
|
15519 | var knownKeys = null;
|
15520 |
|
15521 | var _step = _newChildren.next();
|
15522 |
|
15523 | for (; !_step.done; _step = _newChildren.next()) {
|
15524 | var child = _step.value;
|
15525 | knownKeys = warnOnInvalidKey(child, knownKeys);
|
15526 | }
|
15527 | }
|
15528 | }
|
15529 |
|
15530 | var newChildren = iteratorFn.call(newChildrenIterable);
|
15531 |
|
15532 | (function () {
|
15533 | if (!(newChildren != null)) {
|
15534 | {
|
15535 | throw ReactError(Error("An iterable object provided no iterator."));
|
15536 | }
|
15537 | }
|
15538 | })();
|
15539 |
|
15540 | var resultingFirstChild = null;
|
15541 | var previousNewFiber = null;
|
15542 | var oldFiber = currentFirstChild;
|
15543 | var lastPlacedIndex = 0;
|
15544 | var newIdx = 0;
|
15545 | var nextOldFiber = null;
|
15546 | var step = newChildren.next();
|
15547 |
|
15548 | for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) {
|
15549 | if (oldFiber.index > newIdx) {
|
15550 | nextOldFiber = oldFiber;
|
15551 | oldFiber = null;
|
15552 | } else {
|
15553 | nextOldFiber = oldFiber.sibling;
|
15554 | }
|
15555 |
|
15556 | var newFiber = updateSlot(returnFiber, oldFiber, step.value, expirationTime);
|
15557 |
|
15558 | if (newFiber === null) {
|
15559 |
|
15560 |
|
15561 |
|
15562 |
|
15563 | if (oldFiber === null) {
|
15564 | oldFiber = nextOldFiber;
|
15565 | }
|
15566 |
|
15567 | break;
|
15568 | }
|
15569 |
|
15570 | if (shouldTrackSideEffects) {
|
15571 | if (oldFiber && newFiber.alternate === null) {
|
15572 |
|
15573 |
|
15574 | deleteChild(returnFiber, oldFiber);
|
15575 | }
|
15576 | }
|
15577 |
|
15578 | lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
|
15579 |
|
15580 | if (previousNewFiber === null) {
|
15581 |
|
15582 | resultingFirstChild = newFiber;
|
15583 | } else {
|
15584 |
|
15585 |
|
15586 |
|
15587 |
|
15588 | previousNewFiber.sibling = newFiber;
|
15589 | }
|
15590 |
|
15591 | previousNewFiber = newFiber;
|
15592 | oldFiber = nextOldFiber;
|
15593 | }
|
15594 |
|
15595 | if (step.done) {
|
15596 |
|
15597 | deleteRemainingChildren(returnFiber, oldFiber);
|
15598 | return resultingFirstChild;
|
15599 | }
|
15600 |
|
15601 | if (oldFiber === null) {
|
15602 |
|
15603 |
|
15604 | for (; !step.done; newIdx++, step = newChildren.next()) {
|
15605 | var _newFiber3 = createChild(returnFiber, step.value, expirationTime);
|
15606 |
|
15607 | if (_newFiber3 === null) {
|
15608 | continue;
|
15609 | }
|
15610 |
|
15611 | lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx);
|
15612 |
|
15613 | if (previousNewFiber === null) {
|
15614 |
|
15615 | resultingFirstChild = _newFiber3;
|
15616 | } else {
|
15617 | previousNewFiber.sibling = _newFiber3;
|
15618 | }
|
15619 |
|
15620 | previousNewFiber = _newFiber3;
|
15621 | }
|
15622 |
|
15623 | return resultingFirstChild;
|
15624 | }
|
15625 |
|
15626 |
|
15627 | var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
|
15628 |
|
15629 | for (; !step.done; newIdx++, step = newChildren.next()) {
|
15630 | var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, expirationTime);
|
15631 |
|
15632 | if (_newFiber4 !== null) {
|
15633 | if (shouldTrackSideEffects) {
|
15634 | if (_newFiber4.alternate !== null) {
|
15635 |
|
15636 |
|
15637 |
|
15638 |
|
15639 | existingChildren.delete(_newFiber4.key === null ? newIdx : _newFiber4.key);
|
15640 | }
|
15641 | }
|
15642 |
|
15643 | lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx);
|
15644 |
|
15645 | if (previousNewFiber === null) {
|
15646 | resultingFirstChild = _newFiber4;
|
15647 | } else {
|
15648 | previousNewFiber.sibling = _newFiber4;
|
15649 | }
|
15650 |
|
15651 | previousNewFiber = _newFiber4;
|
15652 | }
|
15653 | }
|
15654 |
|
15655 | if (shouldTrackSideEffects) {
|
15656 |
|
15657 |
|
15658 | existingChildren.forEach(function (child) {
|
15659 | return deleteChild(returnFiber, child);
|
15660 | });
|
15661 | }
|
15662 |
|
15663 | return resultingFirstChild;
|
15664 | }
|
15665 |
|
15666 | function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent, expirationTime) {
|
15667 |
|
15668 |
|
15669 | if (currentFirstChild !== null && currentFirstChild.tag === HostText) {
|
15670 |
|
15671 |
|
15672 | deleteRemainingChildren(returnFiber, currentFirstChild.sibling);
|
15673 | var existing = useFiber(currentFirstChild, textContent, expirationTime);
|
15674 | existing.return = returnFiber;
|
15675 | return existing;
|
15676 | }
|
15677 |
|
15678 |
|
15679 |
|
15680 | deleteRemainingChildren(returnFiber, currentFirstChild);
|
15681 | var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
|
15682 | created.return = returnFiber;
|
15683 | return created;
|
15684 | }
|
15685 |
|
15686 | function reconcileSingleElement(returnFiber, currentFirstChild, element, expirationTime) {
|
15687 | var key = element.key;
|
15688 | var child = currentFirstChild;
|
15689 |
|
15690 | while (child !== null) {
|
15691 |
|
15692 |
|
15693 | if (child.key === key) {
|
15694 | if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.elementType === element.type || (
|
15695 | isCompatibleFamilyForHotReloading(child, element))) {
|
15696 | deleteRemainingChildren(returnFiber, child.sibling);
|
15697 | var existing = useFiber(child, element.type === REACT_FRAGMENT_TYPE ? element.props.children : element.props, expirationTime);
|
15698 | existing.ref = coerceRef(returnFiber, child, element);
|
15699 | existing.return = returnFiber;
|
15700 |
|
15701 | {
|
15702 | existing._debugSource = element._source;
|
15703 | existing._debugOwner = element._owner;
|
15704 | }
|
15705 |
|
15706 | return existing;
|
15707 | } else {
|
15708 | deleteRemainingChildren(returnFiber, child);
|
15709 | break;
|
15710 | }
|
15711 | } else {
|
15712 | deleteChild(returnFiber, child);
|
15713 | }
|
15714 |
|
15715 | child = child.sibling;
|
15716 | }
|
15717 |
|
15718 | if (element.type === REACT_FRAGMENT_TYPE) {
|
15719 | var created = createFiberFromFragment(element.props.children, returnFiber.mode, expirationTime, element.key);
|
15720 | created.return = returnFiber;
|
15721 | return created;
|
15722 | } else {
|
15723 | var _created4 = createFiberFromElement(element, returnFiber.mode, expirationTime);
|
15724 |
|
15725 | _created4.ref = coerceRef(returnFiber, currentFirstChild, element);
|
15726 | _created4.return = returnFiber;
|
15727 | return _created4;
|
15728 | }
|
15729 | }
|
15730 |
|
15731 | function reconcileSinglePortal(returnFiber, currentFirstChild, portal, expirationTime) {
|
15732 | var key = portal.key;
|
15733 | var child = currentFirstChild;
|
15734 |
|
15735 | while (child !== null) {
|
15736 |
|
15737 |
|
15738 | if (child.key === key) {
|
15739 | if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) {
|
15740 | deleteRemainingChildren(returnFiber, child.sibling);
|
15741 | var existing = useFiber(child, portal.children || [], expirationTime);
|
15742 | existing.return = returnFiber;
|
15743 | return existing;
|
15744 | } else {
|
15745 | deleteRemainingChildren(returnFiber, child);
|
15746 | break;
|
15747 | }
|
15748 | } else {
|
15749 | deleteChild(returnFiber, child);
|
15750 | }
|
15751 |
|
15752 | child = child.sibling;
|
15753 | }
|
15754 |
|
15755 | var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
|
15756 | created.return = returnFiber;
|
15757 | return created;
|
15758 | }
|
15759 |
|
15760 |
|
15761 |
|
15762 |
|
15763 | function reconcileChildFibers(returnFiber, currentFirstChild, newChild, expirationTime) {
|
15764 |
|
15765 |
|
15766 |
|
15767 |
|
15768 |
|
15769 |
|
15770 |
|
15771 | var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null;
|
15772 |
|
15773 | if (isUnkeyedTopLevelFragment) {
|
15774 | newChild = newChild.props.children;
|
15775 | }
|
15776 |
|
15777 |
|
15778 | var isObject = typeof newChild === 'object' && newChild !== null;
|
15779 |
|
15780 | if (isObject) {
|
15781 | switch (newChild.$$typeof) {
|
15782 | case REACT_ELEMENT_TYPE:
|
15783 | return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, expirationTime));
|
15784 |
|
15785 | case REACT_PORTAL_TYPE:
|
15786 | return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, expirationTime));
|
15787 | }
|
15788 | }
|
15789 |
|
15790 | if (typeof newChild === 'string' || typeof newChild === 'number') {
|
15791 | return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, '' + newChild, expirationTime));
|
15792 | }
|
15793 |
|
15794 | if (isArray(newChild)) {
|
15795 | return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, expirationTime);
|
15796 | }
|
15797 |
|
15798 | if (getIteratorFn(newChild)) {
|
15799 | return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, expirationTime);
|
15800 | }
|
15801 |
|
15802 | if (isObject) {
|
15803 | throwOnInvalidObjectType(returnFiber, newChild);
|
15804 | }
|
15805 |
|
15806 | {
|
15807 | if (typeof newChild === 'function') {
|
15808 | warnOnFunctionType();
|
15809 | }
|
15810 | }
|
15811 |
|
15812 | if (typeof newChild === 'undefined' && !isUnkeyedTopLevelFragment) {
|
15813 |
|
15814 |
|
15815 |
|
15816 | switch (returnFiber.tag) {
|
15817 | case ClassComponent:
|
15818 | {
|
15819 | {
|
15820 | var instance = returnFiber.stateNode;
|
15821 |
|
15822 | if (instance.render._isMockFunction) {
|
15823 |
|
15824 | break;
|
15825 | }
|
15826 | }
|
15827 | }
|
15828 |
|
15829 |
|
15830 |
|
15831 |
|
15832 | case FunctionComponent:
|
15833 | {
|
15834 | var Component = returnFiber.type;
|
15835 |
|
15836 | (function () {
|
15837 | {
|
15838 | {
|
15839 | throw ReactError(Error((Component.displayName || Component.name || 'Component') + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null."));
|
15840 | }
|
15841 | }
|
15842 | })();
|
15843 | }
|
15844 | }
|
15845 | }
|
15846 |
|
15847 |
|
15848 | return deleteRemainingChildren(returnFiber, currentFirstChild);
|
15849 | }
|
15850 |
|
15851 | return reconcileChildFibers;
|
15852 | }
|
15853 |
|
15854 | var reconcileChildFibers = ChildReconciler(true);
|
15855 | var mountChildFibers = ChildReconciler(false);
|
15856 | function cloneChildFibers(current$$1, workInProgress) {
|
15857 | (function () {
|
15858 | if (!(current$$1 === null || workInProgress.child === current$$1.child)) {
|
15859 | {
|
15860 | throw ReactError(Error("Resuming work not yet implemented."));
|
15861 | }
|
15862 | }
|
15863 | })();
|
15864 |
|
15865 | if (workInProgress.child === null) {
|
15866 | return;
|
15867 | }
|
15868 |
|
15869 | var currentChild = workInProgress.child;
|
15870 | var newChild = createWorkInProgress(currentChild, currentChild.pendingProps, currentChild.expirationTime);
|
15871 | workInProgress.child = newChild;
|
15872 | newChild.return = workInProgress;
|
15873 |
|
15874 | while (currentChild.sibling !== null) {
|
15875 | currentChild = currentChild.sibling;
|
15876 | newChild = newChild.sibling = createWorkInProgress(currentChild, currentChild.pendingProps, currentChild.expirationTime);
|
15877 | newChild.return = workInProgress;
|
15878 | }
|
15879 |
|
15880 | newChild.sibling = null;
|
15881 | }
|
15882 |
|
15883 | function resetChildFibers(workInProgress, renderExpirationTime) {
|
15884 | var child = workInProgress.child;
|
15885 |
|
15886 | while (child !== null) {
|
15887 | resetWorkInProgress(child, renderExpirationTime);
|
15888 | child = child.sibling;
|
15889 | }
|
15890 | }
|
15891 |
|
15892 | var NO_CONTEXT = {};
|
15893 | var contextStackCursor$1 = createCursor(NO_CONTEXT);
|
15894 | var contextFiberStackCursor = createCursor(NO_CONTEXT);
|
15895 | var rootInstanceStackCursor = createCursor(NO_CONTEXT);
|
15896 |
|
15897 | function requiredContext(c) {
|
15898 | (function () {
|
15899 | if (!(c !== NO_CONTEXT)) {
|
15900 | {
|
15901 | throw ReactError(Error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."));
|
15902 | }
|
15903 | }
|
15904 | })();
|
15905 |
|
15906 | return c;
|
15907 | }
|
15908 |
|
15909 | function getRootHostContainer() {
|
15910 | var rootInstance = requiredContext(rootInstanceStackCursor.current);
|
15911 | return rootInstance;
|
15912 | }
|
15913 |
|
15914 | function pushHostContainer(fiber, nextRootInstance) {
|
15915 |
|
15916 |
|
15917 | push(rootInstanceStackCursor, nextRootInstance, fiber);
|
15918 |
|
15919 |
|
15920 | push(contextFiberStackCursor, fiber, fiber);
|
15921 |
|
15922 |
|
15923 |
|
15924 |
|
15925 |
|
15926 | push(contextStackCursor$1, NO_CONTEXT, fiber);
|
15927 | var nextRootContext = getRootHostContext(nextRootInstance);
|
15928 |
|
15929 | pop(contextStackCursor$1, fiber);
|
15930 | push(contextStackCursor$1, nextRootContext, fiber);
|
15931 | }
|
15932 |
|
15933 | function popHostContainer(fiber) {
|
15934 | pop(contextStackCursor$1, fiber);
|
15935 | pop(contextFiberStackCursor, fiber);
|
15936 | pop(rootInstanceStackCursor, fiber);
|
15937 | }
|
15938 |
|
15939 | function getHostContext() {
|
15940 | var context = requiredContext(contextStackCursor$1.current);
|
15941 | return context;
|
15942 | }
|
15943 |
|
15944 | function pushHostContext(fiber) {
|
15945 | var rootInstance = requiredContext(rootInstanceStackCursor.current);
|
15946 | var context = requiredContext(contextStackCursor$1.current);
|
15947 | var nextContext = getChildHostContext(context, fiber.type, rootInstance);
|
15948 |
|
15949 | if (context === nextContext) {
|
15950 | return;
|
15951 | }
|
15952 |
|
15953 |
|
15954 |
|
15955 | push(contextFiberStackCursor, fiber, fiber);
|
15956 | push(contextStackCursor$1, nextContext, fiber);
|
15957 | }
|
15958 |
|
15959 | function popHostContext(fiber) {
|
15960 |
|
15961 |
|
15962 | if (contextFiberStackCursor.current !== fiber) {
|
15963 | return;
|
15964 | }
|
15965 |
|
15966 | pop(contextStackCursor$1, fiber);
|
15967 | pop(contextFiberStackCursor, fiber);
|
15968 | }
|
15969 |
|
15970 | var DefaultSuspenseContext = 0;
|
15971 |
|
15972 |
|
15973 |
|
15974 |
|
15975 | var SubtreeSuspenseContextMask = 1;
|
15976 |
|
15977 |
|
15978 |
|
15979 |
|
15980 |
|
15981 |
|
15982 |
|
15983 | var InvisibleParentSuspenseContext = 1;
|
15984 |
|
15985 |
|
15986 |
|
15987 | var ForceSuspenseFallback = 2;
|
15988 | var suspenseStackCursor = createCursor(DefaultSuspenseContext);
|
15989 | function hasSuspenseContext(parentContext, flag) {
|
15990 | return (parentContext & flag) !== 0;
|
15991 | }
|
15992 | function setDefaultShallowSuspenseContext(parentContext) {
|
15993 | return parentContext & SubtreeSuspenseContextMask;
|
15994 | }
|
15995 | function setShallowSuspenseContext(parentContext, shallowContext) {
|
15996 | return parentContext & SubtreeSuspenseContextMask | shallowContext;
|
15997 | }
|
15998 | function addSubtreeSuspenseContext(parentContext, subtreeContext) {
|
15999 | return parentContext | subtreeContext;
|
16000 | }
|
16001 | function pushSuspenseContext(fiber, newContext) {
|
16002 | push(suspenseStackCursor, newContext, fiber);
|
16003 | }
|
16004 | function popSuspenseContext(fiber) {
|
16005 | pop(suspenseStackCursor, fiber);
|
16006 | }
|
16007 |
|
16008 | function shouldCaptureSuspense(workInProgress, hasInvisibleParent) {
|
16009 |
|
16010 |
|
16011 | var nextState = workInProgress.memoizedState;
|
16012 |
|
16013 | if (nextState !== null) {
|
16014 | if (nextState.dehydrated !== null) {
|
16015 |
|
16016 | return true;
|
16017 | }
|
16018 |
|
16019 | return false;
|
16020 | }
|
16021 |
|
16022 | var props = workInProgress.memoizedProps;
|
16023 |
|
16024 | if (props.fallback === undefined) {
|
16025 | return false;
|
16026 | }
|
16027 |
|
16028 |
|
16029 | if (props.unstable_avoidThisFallback !== true) {
|
16030 | return true;
|
16031 | }
|
16032 |
|
16033 |
|
16034 |
|
16035 | if (hasInvisibleParent) {
|
16036 | return false;
|
16037 | }
|
16038 |
|
16039 |
|
16040 | return true;
|
16041 | }
|
16042 | function findFirstSuspended(row) {
|
16043 | var node = row;
|
16044 |
|
16045 | while (node !== null) {
|
16046 | if (node.tag === SuspenseComponent) {
|
16047 | var state = node.memoizedState;
|
16048 |
|
16049 | if (state !== null) {
|
16050 | var dehydrated = state.dehydrated;
|
16051 |
|
16052 | if (dehydrated === null || isSuspenseInstancePending(dehydrated) || isSuspenseInstanceFallback(dehydrated)) {
|
16053 | return node;
|
16054 | }
|
16055 | }
|
16056 | } else if (node.tag === SuspenseListComponent &&
|
16057 |
|
16058 | node.memoizedProps.revealOrder !== undefined) {
|
16059 | var didSuspend = (node.effectTag & DidCapture) !== NoEffect;
|
16060 |
|
16061 | if (didSuspend) {
|
16062 | return node;
|
16063 | }
|
16064 | } else if (node.child !== null) {
|
16065 | node.child.return = node;
|
16066 | node = node.child;
|
16067 | continue;
|
16068 | }
|
16069 |
|
16070 | if (node === row) {
|
16071 | return null;
|
16072 | }
|
16073 |
|
16074 | while (node.sibling === null) {
|
16075 | if (node.return === null || node.return === row) {
|
16076 | return null;
|
16077 | }
|
16078 |
|
16079 | node = node.return;
|
16080 | }
|
16081 |
|
16082 | node.sibling.return = node.return;
|
16083 | node = node.sibling;
|
16084 | }
|
16085 |
|
16086 | return null;
|
16087 | }
|
16088 |
|
16089 | var emptyObject = {};
|
16090 | var isArray$2 = Array.isArray;
|
16091 | function createResponderInstance(responder, responderProps, responderState, fiber) {
|
16092 | return {
|
16093 | fiber: fiber,
|
16094 | props: responderProps,
|
16095 | responder: responder,
|
16096 | rootEventTypes: null,
|
16097 | state: responderState
|
16098 | };
|
16099 | }
|
16100 |
|
16101 | function mountEventResponder$1(responder, responderProps, fiber, respondersMap, rootContainerInstance) {
|
16102 | var responderState = emptyObject;
|
16103 | var getInitialState = responder.getInitialState;
|
16104 |
|
16105 | if (getInitialState !== null) {
|
16106 | responderState = getInitialState(responderProps);
|
16107 | }
|
16108 |
|
16109 | var responderInstance = createResponderInstance(responder, responderProps, responderState, fiber);
|
16110 |
|
16111 | if (!rootContainerInstance) {
|
16112 | var node = fiber;
|
16113 |
|
16114 | while (node !== null) {
|
16115 | var tag = node.tag;
|
16116 |
|
16117 | if (tag === HostComponent) {
|
16118 | rootContainerInstance = node.stateNode;
|
16119 | break;
|
16120 | } else if (tag === HostRoot) {
|
16121 | rootContainerInstance = node.stateNode.containerInfo;
|
16122 | break;
|
16123 | }
|
16124 |
|
16125 | node = node.return;
|
16126 | }
|
16127 | }
|
16128 |
|
16129 | mountResponderInstance(responder, responderInstance, responderProps, responderState, rootContainerInstance);
|
16130 | respondersMap.set(responder, responderInstance);
|
16131 | }
|
16132 |
|
16133 | function updateEventListener(listener, fiber, visistedResponders, respondersMap, rootContainerInstance) {
|
16134 | var responder;
|
16135 | var props;
|
16136 |
|
16137 | if (listener) {
|
16138 | responder = listener.responder;
|
16139 | props = listener.props;
|
16140 | }
|
16141 |
|
16142 | (function () {
|
16143 | if (!(responder && responder.$$typeof === REACT_RESPONDER_TYPE)) {
|
16144 | {
|
16145 | throw ReactError(Error("An invalid value was used as an event listener. Expect one or many event listeners created via React.unstable_useResponder()."));
|
16146 | }
|
16147 | }
|
16148 | })();
|
16149 |
|
16150 | var listenerProps = props;
|
16151 |
|
16152 | if (visistedResponders.has(responder)) {
|
16153 |
|
16154 | {
|
16155 | warning$1(false, 'Duplicate event responder "%s" found in event listeners. ' + 'Event listeners passed to elements cannot use the same event responder more than once.', responder.displayName);
|
16156 | }
|
16157 |
|
16158 | return;
|
16159 | }
|
16160 |
|
16161 | visistedResponders.add(responder);
|
16162 | var responderInstance = respondersMap.get(responder);
|
16163 |
|
16164 | if (responderInstance === undefined) {
|
16165 |
|
16166 | mountEventResponder$1(responder, listenerProps, fiber, respondersMap, rootContainerInstance);
|
16167 | } else {
|
16168 |
|
16169 | responderInstance.props = listenerProps;
|
16170 | responderInstance.fiber = fiber;
|
16171 | }
|
16172 | }
|
16173 |
|
16174 | function updateEventListeners(listeners, fiber, rootContainerInstance) {
|
16175 | var visistedResponders = new Set();
|
16176 | var dependencies = fiber.dependencies;
|
16177 |
|
16178 | if (listeners != null) {
|
16179 | if (dependencies === null) {
|
16180 | dependencies = fiber.dependencies = {
|
16181 | expirationTime: NoWork,
|
16182 | firstContext: null,
|
16183 | responders: new Map()
|
16184 | };
|
16185 | }
|
16186 |
|
16187 | var respondersMap = dependencies.responders;
|
16188 |
|
16189 | if (respondersMap === null) {
|
16190 | respondersMap = new Map();
|
16191 | }
|
16192 |
|
16193 | if (isArray$2(listeners)) {
|
16194 | for (var i = 0, length = listeners.length; i < length; i++) {
|
16195 | var listener = listeners[i];
|
16196 | updateEventListener(listener, fiber, visistedResponders, respondersMap, rootContainerInstance);
|
16197 | }
|
16198 | } else {
|
16199 | updateEventListener(listeners, fiber, visistedResponders, respondersMap, rootContainerInstance);
|
16200 | }
|
16201 | }
|
16202 |
|
16203 | if (dependencies !== null) {
|
16204 | var _respondersMap = dependencies.responders;
|
16205 |
|
16206 | if (_respondersMap !== null) {
|
16207 |
|
16208 | var mountedResponders = Array.from(_respondersMap.keys());
|
16209 |
|
16210 | for (var _i = 0, _length = mountedResponders.length; _i < _length; _i++) {
|
16211 | var mountedResponder = mountedResponders[_i];
|
16212 |
|
16213 | if (!visistedResponders.has(mountedResponder)) {
|
16214 | var responderInstance = _respondersMap.get(mountedResponder);
|
16215 |
|
16216 | unmountResponderInstance(responderInstance);
|
16217 |
|
16218 | _respondersMap.delete(mountedResponder);
|
16219 | }
|
16220 | }
|
16221 | }
|
16222 | }
|
16223 | }
|
16224 | function createResponderListener(responder, props) {
|
16225 | var eventResponderListener = {
|
16226 | responder: responder,
|
16227 | props: props
|
16228 | };
|
16229 |
|
16230 | {
|
16231 | Object.freeze(eventResponderListener);
|
16232 | }
|
16233 |
|
16234 | return eventResponderListener;
|
16235 | }
|
16236 |
|
16237 | var NoEffect$1 =
|
16238 |
|
16239 | 0;
|
16240 | var UnmountSnapshot =
|
16241 |
|
16242 | 2;
|
16243 | var UnmountMutation =
|
16244 |
|
16245 | 4;
|
16246 | var MountMutation =
|
16247 |
|
16248 | 8;
|
16249 | var UnmountLayout =
|
16250 |
|
16251 | 16;
|
16252 | var MountLayout =
|
16253 |
|
16254 | 32;
|
16255 | var MountPassive =
|
16256 |
|
16257 | 64;
|
16258 | var UnmountPassive =
|
16259 |
|
16260 | 128;
|
16261 |
|
16262 | var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
16263 | var didWarnAboutMismatchedHooksForComponent;
|
16264 |
|
16265 | {
|
16266 | didWarnAboutMismatchedHooksForComponent = new Set();
|
16267 | }
|
16268 |
|
16269 |
|
16270 | var renderExpirationTime$1 = NoWork;
|
16271 |
|
16272 |
|
16273 | var currentlyRenderingFiber$1 = null;
|
16274 |
|
16275 |
|
16276 |
|
16277 |
|
16278 | var currentHook = null;
|
16279 | var nextCurrentHook = null;
|
16280 | var firstWorkInProgressHook = null;
|
16281 | var workInProgressHook = null;
|
16282 | var nextWorkInProgressHook = null;
|
16283 | var remainingExpirationTime = NoWork;
|
16284 | var componentUpdateQueue = null;
|
16285 | var sideEffectTag = 0;
|
16286 |
|
16287 |
|
16288 |
|
16289 |
|
16290 |
|
16291 |
|
16292 |
|
16293 |
|
16294 | var didScheduleRenderPhaseUpdate = false;
|
16295 |
|
16296 | var renderPhaseUpdates = null;
|
16297 |
|
16298 | var numberOfReRenders = 0;
|
16299 | var RE_RENDER_LIMIT = 25;
|
16300 |
|
16301 | var currentHookNameInDev = null;
|
16302 |
|
16303 |
|
16304 |
|
16305 | var hookTypesDev = null;
|
16306 | var hookTypesUpdateIndexDev = -1;
|
16307 |
|
16308 |
|
16309 |
|
16310 | var ignorePreviousDependencies = false;
|
16311 |
|
16312 | function mountHookTypesDev() {
|
16313 | {
|
16314 | var hookName = currentHookNameInDev;
|
16315 |
|
16316 | if (hookTypesDev === null) {
|
16317 | hookTypesDev = [hookName];
|
16318 | } else {
|
16319 | hookTypesDev.push(hookName);
|
16320 | }
|
16321 | }
|
16322 | }
|
16323 |
|
16324 | function updateHookTypesDev() {
|
16325 | {
|
16326 | var hookName = currentHookNameInDev;
|
16327 |
|
16328 | if (hookTypesDev !== null) {
|
16329 | hookTypesUpdateIndexDev++;
|
16330 |
|
16331 | if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) {
|
16332 | warnOnHookMismatchInDev(hookName);
|
16333 | }
|
16334 | }
|
16335 | }
|
16336 | }
|
16337 |
|
16338 | function checkDepsAreArrayDev(deps) {
|
16339 | {
|
16340 | if (deps !== undefined && deps !== null && !Array.isArray(deps)) {
|
16341 |
|
16342 |
|
16343 | warning$1(false, '%s received a final argument that is not an array (instead, received `%s`). When ' + 'specified, the final argument must be an array.', currentHookNameInDev, typeof deps);
|
16344 | }
|
16345 | }
|
16346 | }
|
16347 |
|
16348 | function warnOnHookMismatchInDev(currentHookName) {
|
16349 | {
|
16350 | var componentName = getComponentName(currentlyRenderingFiber$1.type);
|
16351 |
|
16352 | if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) {
|
16353 | didWarnAboutMismatchedHooksForComponent.add(componentName);
|
16354 |
|
16355 | if (hookTypesDev !== null) {
|
16356 | var table = '';
|
16357 | var secondColumnStart = 30;
|
16358 |
|
16359 | for (var i = 0; i <= hookTypesUpdateIndexDev; i++) {
|
16360 | var oldHookName = hookTypesDev[i];
|
16361 | var newHookName = i === hookTypesUpdateIndexDev ? currentHookName : oldHookName;
|
16362 | var row = i + 1 + ". " + oldHookName;
|
16363 |
|
16364 |
|
16365 | while (row.length < secondColumnStart) {
|
16366 | row += ' ';
|
16367 | }
|
16368 |
|
16369 | row += newHookName + '\n';
|
16370 | table += row;
|
16371 | }
|
16372 |
|
16373 | warning$1(false, 'React has detected a change in the order of Hooks called by %s. ' + 'This will lead to bugs and errors if not fixed. ' + 'For more information, read the Rules of Hooks: https://fb.me/rules-of-hooks\n\n' + ' Previous render Next render\n' + ' ------------------------------------------------------\n' + '%s' + ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n', componentName, table);
|
16374 | }
|
16375 | }
|
16376 | }
|
16377 | }
|
16378 |
|
16379 | function throwInvalidHookError() {
|
16380 | (function () {
|
16381 | {
|
16382 | {
|
16383 | throw ReactError(Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem."));
|
16384 | }
|
16385 | }
|
16386 | })();
|
16387 | }
|
16388 |
|
16389 | function areHookInputsEqual(nextDeps, prevDeps) {
|
16390 | {
|
16391 | if (ignorePreviousDependencies) {
|
16392 |
|
16393 | return false;
|
16394 | }
|
16395 | }
|
16396 |
|
16397 | if (prevDeps === null) {
|
16398 | {
|
16399 | 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);
|
16400 | }
|
16401 |
|
16402 | return false;
|
16403 | }
|
16404 |
|
16405 | {
|
16406 |
|
16407 |
|
16408 | if (nextDeps.length !== prevDeps.length) {
|
16409 | 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, "[" + prevDeps.join(', ') + "]", "[" + nextDeps.join(', ') + "]");
|
16410 | }
|
16411 | }
|
16412 |
|
16413 | for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
|
16414 | if (is$1(nextDeps[i], prevDeps[i])) {
|
16415 | continue;
|
16416 | }
|
16417 |
|
16418 | return false;
|
16419 | }
|
16420 |
|
16421 | return true;
|
16422 | }
|
16423 |
|
16424 | function renderWithHooks(current, workInProgress, Component, props, refOrContext, nextRenderExpirationTime) {
|
16425 | renderExpirationTime$1 = nextRenderExpirationTime;
|
16426 | currentlyRenderingFiber$1 = workInProgress;
|
16427 | nextCurrentHook = current !== null ? current.memoizedState : null;
|
16428 |
|
16429 | {
|
16430 | hookTypesDev = current !== null ? current._debugHookTypes : null;
|
16431 | hookTypesUpdateIndexDev = -1;
|
16432 |
|
16433 | ignorePreviousDependencies = current !== null && current.type !== workInProgress.type;
|
16434 | }
|
16435 |
|
16436 |
|
16437 |
|
16438 |
|
16439 |
|
16440 |
|
16441 |
|
16442 |
|
16443 |
|
16444 |
|
16445 |
|
16446 |
|
16447 |
|
16448 |
|
16449 |
|
16450 |
|
16451 | {
|
16452 | if (nextCurrentHook !== null) {
|
16453 | ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
|
16454 | } else if (hookTypesDev !== null) {
|
16455 |
|
16456 |
|
16457 |
|
16458 |
|
16459 |
|
16460 | ReactCurrentDispatcher$1.current = HooksDispatcherOnMountWithHookTypesInDEV;
|
16461 | } else {
|
16462 | ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV;
|
16463 | }
|
16464 | }
|
16465 |
|
16466 | var children = Component(props, refOrContext);
|
16467 |
|
16468 | if (didScheduleRenderPhaseUpdate) {
|
16469 | do {
|
16470 | didScheduleRenderPhaseUpdate = false;
|
16471 | numberOfReRenders += 1;
|
16472 |
|
16473 | {
|
16474 |
|
16475 |
|
16476 | ignorePreviousDependencies = false;
|
16477 | }
|
16478 |
|
16479 |
|
16480 | nextCurrentHook = current !== null ? current.memoizedState : null;
|
16481 | nextWorkInProgressHook = firstWorkInProgressHook;
|
16482 | currentHook = null;
|
16483 | workInProgressHook = null;
|
16484 | componentUpdateQueue = null;
|
16485 |
|
16486 | {
|
16487 |
|
16488 | hookTypesUpdateIndexDev = -1;
|
16489 | }
|
16490 |
|
16491 | ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
|
16492 | children = Component(props, refOrContext);
|
16493 | } while (didScheduleRenderPhaseUpdate);
|
16494 |
|
16495 | renderPhaseUpdates = null;
|
16496 | numberOfReRenders = 0;
|
16497 | }
|
16498 |
|
16499 |
|
16500 |
|
16501 | ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
|
16502 | var renderedWork = currentlyRenderingFiber$1;
|
16503 | renderedWork.memoizedState = firstWorkInProgressHook;
|
16504 | renderedWork.expirationTime = remainingExpirationTime;
|
16505 | renderedWork.updateQueue = componentUpdateQueue;
|
16506 | renderedWork.effectTag |= sideEffectTag;
|
16507 |
|
16508 | {
|
16509 | renderedWork._debugHookTypes = hookTypesDev;
|
16510 | }
|
16511 |
|
16512 |
|
16513 |
|
16514 | var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null;
|
16515 | renderExpirationTime$1 = NoWork;
|
16516 | currentlyRenderingFiber$1 = null;
|
16517 | currentHook = null;
|
16518 | nextCurrentHook = null;
|
16519 | firstWorkInProgressHook = null;
|
16520 | workInProgressHook = null;
|
16521 | nextWorkInProgressHook = null;
|
16522 |
|
16523 | {
|
16524 | currentHookNameInDev = null;
|
16525 | hookTypesDev = null;
|
16526 | hookTypesUpdateIndexDev = -1;
|
16527 | }
|
16528 |
|
16529 | remainingExpirationTime = NoWork;
|
16530 | componentUpdateQueue = null;
|
16531 | sideEffectTag = 0;
|
16532 |
|
16533 |
|
16534 |
|
16535 |
|
16536 | (function () {
|
16537 | if (!!didRenderTooFewHooks) {
|
16538 | {
|
16539 | throw ReactError(Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement."));
|
16540 | }
|
16541 | }
|
16542 | })();
|
16543 |
|
16544 | return children;
|
16545 | }
|
16546 | function bailoutHooks(current, workInProgress, expirationTime) {
|
16547 | workInProgress.updateQueue = current.updateQueue;
|
16548 | workInProgress.effectTag &= ~(Passive | Update);
|
16549 |
|
16550 | if (current.expirationTime <= expirationTime) {
|
16551 | current.expirationTime = NoWork;
|
16552 | }
|
16553 | }
|
16554 | function resetHooks() {
|
16555 |
|
16556 |
|
16557 | ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
|
16558 |
|
16559 |
|
16560 |
|
16561 | renderExpirationTime$1 = NoWork;
|
16562 | currentlyRenderingFiber$1 = null;
|
16563 | currentHook = null;
|
16564 | nextCurrentHook = null;
|
16565 | firstWorkInProgressHook = null;
|
16566 | workInProgressHook = null;
|
16567 | nextWorkInProgressHook = null;
|
16568 |
|
16569 | {
|
16570 | hookTypesDev = null;
|
16571 | hookTypesUpdateIndexDev = -1;
|
16572 | currentHookNameInDev = null;
|
16573 | }
|
16574 |
|
16575 | remainingExpirationTime = NoWork;
|
16576 | componentUpdateQueue = null;
|
16577 | sideEffectTag = 0;
|
16578 | didScheduleRenderPhaseUpdate = false;
|
16579 | renderPhaseUpdates = null;
|
16580 | numberOfReRenders = 0;
|
16581 | }
|
16582 |
|
16583 | function mountWorkInProgressHook() {
|
16584 | var hook = {
|
16585 | memoizedState: null,
|
16586 | baseState: null,
|
16587 | queue: null,
|
16588 | baseUpdate: null,
|
16589 | next: null
|
16590 | };
|
16591 |
|
16592 | if (workInProgressHook === null) {
|
16593 |
|
16594 | firstWorkInProgressHook = workInProgressHook = hook;
|
16595 | } else {
|
16596 |
|
16597 | workInProgressHook = workInProgressHook.next = hook;
|
16598 | }
|
16599 |
|
16600 | return workInProgressHook;
|
16601 | }
|
16602 |
|
16603 | function updateWorkInProgressHook() {
|
16604 |
|
16605 |
|
16606 |
|
16607 |
|
16608 |
|
16609 | if (nextWorkInProgressHook !== null) {
|
16610 |
|
16611 | workInProgressHook = nextWorkInProgressHook;
|
16612 | nextWorkInProgressHook = workInProgressHook.next;
|
16613 | currentHook = nextCurrentHook;
|
16614 | nextCurrentHook = currentHook !== null ? currentHook.next : null;
|
16615 | } else {
|
16616 |
|
16617 | (function () {
|
16618 | if (!(nextCurrentHook !== null)) {
|
16619 | {
|
16620 | throw ReactError(Error("Rendered more hooks than during the previous render."));
|
16621 | }
|
16622 | }
|
16623 | })();
|
16624 |
|
16625 | currentHook = nextCurrentHook;
|
16626 | var newHook = {
|
16627 | memoizedState: currentHook.memoizedState,
|
16628 | baseState: currentHook.baseState,
|
16629 | queue: currentHook.queue,
|
16630 | baseUpdate: currentHook.baseUpdate,
|
16631 | next: null
|
16632 | };
|
16633 |
|
16634 | if (workInProgressHook === null) {
|
16635 |
|
16636 | workInProgressHook = firstWorkInProgressHook = newHook;
|
16637 | } else {
|
16638 |
|
16639 | workInProgressHook = workInProgressHook.next = newHook;
|
16640 | }
|
16641 |
|
16642 | nextCurrentHook = currentHook.next;
|
16643 | }
|
16644 |
|
16645 | return workInProgressHook;
|
16646 | }
|
16647 |
|
16648 | function createFunctionComponentUpdateQueue() {
|
16649 | return {
|
16650 | lastEffect: null
|
16651 | };
|
16652 | }
|
16653 |
|
16654 | function basicStateReducer(state, action) {
|
16655 | return typeof action === 'function' ? action(state) : action;
|
16656 | }
|
16657 |
|
16658 | function mountReducer(reducer, initialArg, init) {
|
16659 | var hook = mountWorkInProgressHook();
|
16660 | var initialState;
|
16661 |
|
16662 | if (init !== undefined) {
|
16663 | initialState = init(initialArg);
|
16664 | } else {
|
16665 | initialState = initialArg;
|
16666 | }
|
16667 |
|
16668 | hook.memoizedState = hook.baseState = initialState;
|
16669 | var queue = hook.queue = {
|
16670 | last: null,
|
16671 | dispatch: null,
|
16672 | lastRenderedReducer: reducer,
|
16673 | lastRenderedState: initialState
|
16674 | };
|
16675 | var dispatch = queue.dispatch = dispatchAction.bind(null,
|
16676 | currentlyRenderingFiber$1, queue);
|
16677 | return [hook.memoizedState, dispatch];
|
16678 | }
|
16679 |
|
16680 | function updateReducer(reducer, initialArg, init) {
|
16681 | var hook = updateWorkInProgressHook();
|
16682 | var queue = hook.queue;
|
16683 |
|
16684 | (function () {
|
16685 | if (!(queue !== null)) {
|
16686 | {
|
16687 | throw ReactError(Error("Should have a queue. This is likely a bug in React. Please file an issue."));
|
16688 | }
|
16689 | }
|
16690 | })();
|
16691 |
|
16692 | queue.lastRenderedReducer = reducer;
|
16693 |
|
16694 | if (numberOfReRenders > 0) {
|
16695 |
|
16696 |
|
16697 | var _dispatch = queue.dispatch;
|
16698 |
|
16699 | if (renderPhaseUpdates !== null) {
|
16700 |
|
16701 | var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
|
16702 |
|
16703 | if (firstRenderPhaseUpdate !== undefined) {
|
16704 | renderPhaseUpdates.delete(queue);
|
16705 | var newState = hook.memoizedState;
|
16706 | var update = firstRenderPhaseUpdate;
|
16707 |
|
16708 | do {
|
16709 |
|
16710 |
|
16711 |
|
16712 | var action = update.action;
|
16713 | newState = reducer(newState, action);
|
16714 | update = update.next;
|
16715 | } while (update !== null);
|
16716 |
|
16717 |
|
16718 |
|
16719 | if (!is$1(newState, hook.memoizedState)) {
|
16720 | markWorkInProgressReceivedUpdate();
|
16721 | }
|
16722 |
|
16723 | hook.memoizedState = newState;
|
16724 |
|
16725 |
|
16726 |
|
16727 |
|
16728 | if (hook.baseUpdate === queue.last) {
|
16729 | hook.baseState = newState;
|
16730 | }
|
16731 |
|
16732 | queue.lastRenderedState = newState;
|
16733 | return [newState, _dispatch];
|
16734 | }
|
16735 | }
|
16736 |
|
16737 | return [hook.memoizedState, _dispatch];
|
16738 | }
|
16739 |
|
16740 |
|
16741 | var last = queue.last;
|
16742 |
|
16743 | var baseUpdate = hook.baseUpdate;
|
16744 | var baseState = hook.baseState;
|
16745 |
|
16746 | var first;
|
16747 |
|
16748 | if (baseUpdate !== null) {
|
16749 | if (last !== null) {
|
16750 |
|
16751 |
|
16752 |
|
16753 | last.next = null;
|
16754 | }
|
16755 |
|
16756 | first = baseUpdate.next;
|
16757 | } else {
|
16758 | first = last !== null ? last.next : null;
|
16759 | }
|
16760 |
|
16761 | if (first !== null) {
|
16762 | var _newState = baseState;
|
16763 | var newBaseState = null;
|
16764 | var newBaseUpdate = null;
|
16765 | var prevUpdate = baseUpdate;
|
16766 | var _update = first;
|
16767 | var didSkip = false;
|
16768 |
|
16769 | do {
|
16770 | var updateExpirationTime = _update.expirationTime;
|
16771 |
|
16772 | if (updateExpirationTime < renderExpirationTime$1) {
|
16773 |
|
16774 |
|
16775 |
|
16776 | if (!didSkip) {
|
16777 | didSkip = true;
|
16778 | newBaseUpdate = prevUpdate;
|
16779 | newBaseState = _newState;
|
16780 | }
|
16781 |
|
16782 |
|
16783 | if (updateExpirationTime > remainingExpirationTime) {
|
16784 | remainingExpirationTime = updateExpirationTime;
|
16785 | markUnprocessedUpdateTime(remainingExpirationTime);
|
16786 | }
|
16787 | } else {
|
16788 |
|
16789 |
|
16790 |
|
16791 |
|
16792 |
|
16793 |
|
16794 |
|
16795 | markRenderEventTimeAndConfig(updateExpirationTime, _update.suspenseConfig);
|
16796 |
|
16797 | if (_update.eagerReducer === reducer) {
|
16798 |
|
16799 |
|
16800 | _newState = _update.eagerState;
|
16801 | } else {
|
16802 | var _action = _update.action;
|
16803 | _newState = reducer(_newState, _action);
|
16804 | }
|
16805 | }
|
16806 |
|
16807 | prevUpdate = _update;
|
16808 | _update = _update.next;
|
16809 | } while (_update !== null && _update !== first);
|
16810 |
|
16811 | if (!didSkip) {
|
16812 | newBaseUpdate = prevUpdate;
|
16813 | newBaseState = _newState;
|
16814 | }
|
16815 |
|
16816 |
|
16817 |
|
16818 | if (!is$1(_newState, hook.memoizedState)) {
|
16819 | markWorkInProgressReceivedUpdate();
|
16820 | }
|
16821 |
|
16822 | hook.memoizedState = _newState;
|
16823 | hook.baseUpdate = newBaseUpdate;
|
16824 | hook.baseState = newBaseState;
|
16825 | queue.lastRenderedState = _newState;
|
16826 | }
|
16827 |
|
16828 | var dispatch = queue.dispatch;
|
16829 | return [hook.memoizedState, dispatch];
|
16830 | }
|
16831 |
|
16832 | function mountState(initialState) {
|
16833 | var hook = mountWorkInProgressHook();
|
16834 |
|
16835 | if (typeof initialState === 'function') {
|
16836 | initialState = initialState();
|
16837 | }
|
16838 |
|
16839 | hook.memoizedState = hook.baseState = initialState;
|
16840 | var queue = hook.queue = {
|
16841 | last: null,
|
16842 | dispatch: null,
|
16843 | lastRenderedReducer: basicStateReducer,
|
16844 | lastRenderedState: initialState
|
16845 | };
|
16846 | var dispatch = queue.dispatch = dispatchAction.bind(null,
|
16847 | currentlyRenderingFiber$1, queue);
|
16848 | return [hook.memoizedState, dispatch];
|
16849 | }
|
16850 |
|
16851 | function updateState(initialState) {
|
16852 | return updateReducer(basicStateReducer, initialState);
|
16853 | }
|
16854 |
|
16855 | function pushEffect(tag, create, destroy, deps) {
|
16856 | var effect = {
|
16857 | tag: tag,
|
16858 | create: create,
|
16859 | destroy: destroy,
|
16860 | deps: deps,
|
16861 |
|
16862 | next: null
|
16863 | };
|
16864 |
|
16865 | if (componentUpdateQueue === null) {
|
16866 | componentUpdateQueue = createFunctionComponentUpdateQueue();
|
16867 | componentUpdateQueue.lastEffect = effect.next = effect;
|
16868 | } else {
|
16869 | var lastEffect = componentUpdateQueue.lastEffect;
|
16870 |
|
16871 | if (lastEffect === null) {
|
16872 | componentUpdateQueue.lastEffect = effect.next = effect;
|
16873 | } else {
|
16874 | var firstEffect = lastEffect.next;
|
16875 | lastEffect.next = effect;
|
16876 | effect.next = firstEffect;
|
16877 | componentUpdateQueue.lastEffect = effect;
|
16878 | }
|
16879 | }
|
16880 |
|
16881 | return effect;
|
16882 | }
|
16883 |
|
16884 | function mountRef(initialValue) {
|
16885 | var hook = mountWorkInProgressHook();
|
16886 | var ref = {
|
16887 | current: initialValue
|
16888 | };
|
16889 |
|
16890 | {
|
16891 | Object.seal(ref);
|
16892 | }
|
16893 |
|
16894 | hook.memoizedState = ref;
|
16895 | return ref;
|
16896 | }
|
16897 |
|
16898 | function updateRef(initialValue) {
|
16899 | var hook = updateWorkInProgressHook();
|
16900 | return hook.memoizedState;
|
16901 | }
|
16902 |
|
16903 | function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
|
16904 | var hook = mountWorkInProgressHook();
|
16905 | var nextDeps = deps === undefined ? null : deps;
|
16906 | sideEffectTag |= fiberEffectTag;
|
16907 | hook.memoizedState = pushEffect(hookEffectTag, create, undefined, nextDeps);
|
16908 | }
|
16909 |
|
16910 | function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
|
16911 | var hook = updateWorkInProgressHook();
|
16912 | var nextDeps = deps === undefined ? null : deps;
|
16913 | var destroy = undefined;
|
16914 |
|
16915 | if (currentHook !== null) {
|
16916 | var prevEffect = currentHook.memoizedState;
|
16917 | destroy = prevEffect.destroy;
|
16918 |
|
16919 | if (nextDeps !== null) {
|
16920 | var prevDeps = prevEffect.deps;
|
16921 |
|
16922 | if (areHookInputsEqual(nextDeps, prevDeps)) {
|
16923 | pushEffect(NoEffect$1, create, destroy, nextDeps);
|
16924 | return;
|
16925 | }
|
16926 | }
|
16927 | }
|
16928 |
|
16929 | sideEffectTag |= fiberEffectTag;
|
16930 | hook.memoizedState = pushEffect(hookEffectTag, create, destroy, nextDeps);
|
16931 | }
|
16932 |
|
16933 | function mountEffect(create, deps) {
|
16934 | {
|
16935 |
|
16936 | if ('undefined' !== typeof jest) {
|
16937 | warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1);
|
16938 | }
|
16939 | }
|
16940 |
|
16941 | return mountEffectImpl(Update | Passive, UnmountPassive | MountPassive, create, deps);
|
16942 | }
|
16943 |
|
16944 | function updateEffect(create, deps) {
|
16945 | {
|
16946 |
|
16947 | if ('undefined' !== typeof jest) {
|
16948 | warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1);
|
16949 | }
|
16950 | }
|
16951 |
|
16952 | return updateEffectImpl(Update | Passive, UnmountPassive | MountPassive, create, deps);
|
16953 | }
|
16954 |
|
16955 | function mountLayoutEffect(create, deps) {
|
16956 | return mountEffectImpl(Update, UnmountMutation | MountLayout, create, deps);
|
16957 | }
|
16958 |
|
16959 | function updateLayoutEffect(create, deps) {
|
16960 | return updateEffectImpl(Update, UnmountMutation | MountLayout, create, deps);
|
16961 | }
|
16962 |
|
16963 | function imperativeHandleEffect(create, ref) {
|
16964 | if (typeof ref === 'function') {
|
16965 | var refCallback = ref;
|
16966 |
|
16967 | var _inst = create();
|
16968 |
|
16969 | refCallback(_inst);
|
16970 | return function () {
|
16971 | refCallback(null);
|
16972 | };
|
16973 | } else if (ref !== null && ref !== undefined) {
|
16974 | var refObject = ref;
|
16975 |
|
16976 | {
|
16977 | !refObject.hasOwnProperty('current') ? warning$1(false, 'Expected useImperativeHandle() first argument to either be a ' + 'ref callback or React.createRef() object. Instead received: %s.', 'an object with keys {' + Object.keys(refObject).join(', ') + '}') : void 0;
|
16978 | }
|
16979 |
|
16980 | var _inst2 = create();
|
16981 |
|
16982 | refObject.current = _inst2;
|
16983 | return function () {
|
16984 | refObject.current = null;
|
16985 | };
|
16986 | }
|
16987 | }
|
16988 |
|
16989 | function mountImperativeHandle(ref, create, deps) {
|
16990 | {
|
16991 | !(typeof create === 'function') ? warning$1(false, 'Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null') : void 0;
|
16992 | }
|
16993 |
|
16994 |
|
16995 | var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
|
16996 | return mountEffectImpl(Update, UnmountMutation | MountLayout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
|
16997 | }
|
16998 |
|
16999 | function updateImperativeHandle(ref, create, deps) {
|
17000 | {
|
17001 | !(typeof create === 'function') ? warning$1(false, 'Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null') : void 0;
|
17002 | }
|
17003 |
|
17004 |
|
17005 | var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
|
17006 | return updateEffectImpl(Update, UnmountMutation | MountLayout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
|
17007 | }
|
17008 |
|
17009 | function mountDebugValue(value, formatterFn) {
|
17010 |
|
17011 |
|
17012 | }
|
17013 |
|
17014 | var updateDebugValue = mountDebugValue;
|
17015 |
|
17016 | function mountCallback(callback, deps) {
|
17017 | var hook = mountWorkInProgressHook();
|
17018 | var nextDeps = deps === undefined ? null : deps;
|
17019 | hook.memoizedState = [callback, nextDeps];
|
17020 | return callback;
|
17021 | }
|
17022 |
|
17023 | function updateCallback(callback, deps) {
|
17024 | var hook = updateWorkInProgressHook();
|
17025 | var nextDeps = deps === undefined ? null : deps;
|
17026 | var prevState = hook.memoizedState;
|
17027 |
|
17028 | if (prevState !== null) {
|
17029 | if (nextDeps !== null) {
|
17030 | var prevDeps = prevState[1];
|
17031 |
|
17032 | if (areHookInputsEqual(nextDeps, prevDeps)) {
|
17033 | return prevState[0];
|
17034 | }
|
17035 | }
|
17036 | }
|
17037 |
|
17038 | hook.memoizedState = [callback, nextDeps];
|
17039 | return callback;
|
17040 | }
|
17041 |
|
17042 | function mountMemo(nextCreate, deps) {
|
17043 | var hook = mountWorkInProgressHook();
|
17044 | var nextDeps = deps === undefined ? null : deps;
|
17045 | var nextValue = nextCreate();
|
17046 | hook.memoizedState = [nextValue, nextDeps];
|
17047 | return nextValue;
|
17048 | }
|
17049 |
|
17050 | function updateMemo(nextCreate, deps) {
|
17051 | var hook = updateWorkInProgressHook();
|
17052 | var nextDeps = deps === undefined ? null : deps;
|
17053 | var prevState = hook.memoizedState;
|
17054 |
|
17055 | if (prevState !== null) {
|
17056 |
|
17057 | if (nextDeps !== null) {
|
17058 | var prevDeps = prevState[1];
|
17059 |
|
17060 | if (areHookInputsEqual(nextDeps, prevDeps)) {
|
17061 | return prevState[0];
|
17062 | }
|
17063 | }
|
17064 | }
|
17065 |
|
17066 | var nextValue = nextCreate();
|
17067 | hook.memoizedState = [nextValue, nextDeps];
|
17068 | return nextValue;
|
17069 | }
|
17070 |
|
17071 | function dispatchAction(fiber, queue, action) {
|
17072 | (function () {
|
17073 | if (!(numberOfReRenders < RE_RENDER_LIMIT)) {
|
17074 | {
|
17075 | throw ReactError(Error("Too many re-renders. React limits the number of renders to prevent an infinite loop."));
|
17076 | }
|
17077 | }
|
17078 | })();
|
17079 |
|
17080 | {
|
17081 | !(typeof arguments[3] !== 'function') ? warning$1(false, "State updates from the useState() and useReducer() Hooks don't support the " + 'second callback argument. To execute a side effect after ' + 'rendering, declare it in the component body with useEffect().') : void 0;
|
17082 | }
|
17083 |
|
17084 | var alternate = fiber.alternate;
|
17085 |
|
17086 | if (fiber === currentlyRenderingFiber$1 || alternate !== null && alternate === currentlyRenderingFiber$1) {
|
17087 |
|
17088 |
|
17089 |
|
17090 | didScheduleRenderPhaseUpdate = true;
|
17091 | var update = {
|
17092 | expirationTime: renderExpirationTime$1,
|
17093 | suspenseConfig: null,
|
17094 | action: action,
|
17095 | eagerReducer: null,
|
17096 | eagerState: null,
|
17097 | next: null
|
17098 | };
|
17099 |
|
17100 | {
|
17101 | update.priority = getCurrentPriorityLevel();
|
17102 | }
|
17103 |
|
17104 | if (renderPhaseUpdates === null) {
|
17105 | renderPhaseUpdates = new Map();
|
17106 | }
|
17107 |
|
17108 | var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
|
17109 |
|
17110 | if (firstRenderPhaseUpdate === undefined) {
|
17111 | renderPhaseUpdates.set(queue, update);
|
17112 | } else {
|
17113 |
|
17114 | var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
|
17115 |
|
17116 | while (lastRenderPhaseUpdate.next !== null) {
|
17117 | lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
|
17118 | }
|
17119 |
|
17120 | lastRenderPhaseUpdate.next = update;
|
17121 | }
|
17122 | } else {
|
17123 | var currentTime = requestCurrentTime();
|
17124 | var suspenseConfig = requestCurrentSuspenseConfig();
|
17125 | var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
17126 | var _update2 = {
|
17127 | expirationTime: expirationTime,
|
17128 | suspenseConfig: suspenseConfig,
|
17129 | action: action,
|
17130 | eagerReducer: null,
|
17131 | eagerState: null,
|
17132 | next: null
|
17133 | };
|
17134 |
|
17135 | {
|
17136 | _update2.priority = getCurrentPriorityLevel();
|
17137 | }
|
17138 |
|
17139 |
|
17140 | var last = queue.last;
|
17141 |
|
17142 | if (last === null) {
|
17143 |
|
17144 | _update2.next = _update2;
|
17145 | } else {
|
17146 | var first = last.next;
|
17147 |
|
17148 | if (first !== null) {
|
17149 |
|
17150 | _update2.next = first;
|
17151 | }
|
17152 |
|
17153 | last.next = _update2;
|
17154 | }
|
17155 |
|
17156 | queue.last = _update2;
|
17157 |
|
17158 | if (fiber.expirationTime === NoWork && (alternate === null || alternate.expirationTime === NoWork)) {
|
17159 |
|
17160 |
|
17161 |
|
17162 | var lastRenderedReducer = queue.lastRenderedReducer;
|
17163 |
|
17164 | if (lastRenderedReducer !== null) {
|
17165 | var prevDispatcher;
|
17166 |
|
17167 | {
|
17168 | prevDispatcher = ReactCurrentDispatcher$1.current;
|
17169 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
17170 | }
|
17171 |
|
17172 | try {
|
17173 | var currentState = queue.lastRenderedState;
|
17174 | var eagerState = lastRenderedReducer(currentState, action);
|
17175 |
|
17176 |
|
17177 |
|
17178 |
|
17179 | _update2.eagerReducer = lastRenderedReducer;
|
17180 | _update2.eagerState = eagerState;
|
17181 |
|
17182 | if (is$1(eagerState, currentState)) {
|
17183 |
|
17184 |
|
17185 |
|
17186 |
|
17187 | return;
|
17188 | }
|
17189 | } catch (error) {
|
17190 | } finally {
|
17191 | {
|
17192 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
17193 | }
|
17194 | }
|
17195 | }
|
17196 | }
|
17197 |
|
17198 | {
|
17199 |
|
17200 | if ('undefined' !== typeof jest) {
|
17201 | warnIfNotScopedWithMatchingAct(fiber);
|
17202 | warnIfNotCurrentlyActingUpdatesInDev(fiber);
|
17203 | }
|
17204 | }
|
17205 |
|
17206 | scheduleWork(fiber, expirationTime);
|
17207 | }
|
17208 | }
|
17209 |
|
17210 | var ContextOnlyDispatcher = {
|
17211 | readContext: readContext,
|
17212 | useCallback: throwInvalidHookError,
|
17213 | useContext: throwInvalidHookError,
|
17214 | useEffect: throwInvalidHookError,
|
17215 | useImperativeHandle: throwInvalidHookError,
|
17216 | useLayoutEffect: throwInvalidHookError,
|
17217 | useMemo: throwInvalidHookError,
|
17218 | useReducer: throwInvalidHookError,
|
17219 | useRef: throwInvalidHookError,
|
17220 | useState: throwInvalidHookError,
|
17221 | useDebugValue: throwInvalidHookError,
|
17222 | useResponder: throwInvalidHookError
|
17223 | };
|
17224 | var HooksDispatcherOnMountInDEV = null;
|
17225 | var HooksDispatcherOnMountWithHookTypesInDEV = null;
|
17226 | var HooksDispatcherOnUpdateInDEV = null;
|
17227 | var InvalidNestedHooksDispatcherOnMountInDEV = null;
|
17228 | var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
17229 |
|
17230 | {
|
17231 | var warnInvalidContextAccess = function () {
|
17232 | 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().');
|
17233 | };
|
17234 |
|
17235 | var warnInvalidHookAccess = function () {
|
17236 | 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');
|
17237 | };
|
17238 |
|
17239 | HooksDispatcherOnMountInDEV = {
|
17240 | readContext: function (context, observedBits) {
|
17241 | return readContext(context, observedBits);
|
17242 | },
|
17243 | useCallback: function (callback, deps) {
|
17244 | currentHookNameInDev = 'useCallback';
|
17245 | mountHookTypesDev();
|
17246 | checkDepsAreArrayDev(deps);
|
17247 | return mountCallback(callback, deps);
|
17248 | },
|
17249 | useContext: function (context, observedBits) {
|
17250 | currentHookNameInDev = 'useContext';
|
17251 | mountHookTypesDev();
|
17252 | return readContext(context, observedBits);
|
17253 | },
|
17254 | useEffect: function (create, deps) {
|
17255 | currentHookNameInDev = 'useEffect';
|
17256 | mountHookTypesDev();
|
17257 | checkDepsAreArrayDev(deps);
|
17258 | return mountEffect(create, deps);
|
17259 | },
|
17260 | useImperativeHandle: function (ref, create, deps) {
|
17261 | currentHookNameInDev = 'useImperativeHandle';
|
17262 | mountHookTypesDev();
|
17263 | checkDepsAreArrayDev(deps);
|
17264 | return mountImperativeHandle(ref, create, deps);
|
17265 | },
|
17266 | useLayoutEffect: function (create, deps) {
|
17267 | currentHookNameInDev = 'useLayoutEffect';
|
17268 | mountHookTypesDev();
|
17269 | checkDepsAreArrayDev(deps);
|
17270 | return mountLayoutEffect(create, deps);
|
17271 | },
|
17272 | useMemo: function (create, deps) {
|
17273 | currentHookNameInDev = 'useMemo';
|
17274 | mountHookTypesDev();
|
17275 | checkDepsAreArrayDev(deps);
|
17276 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
17277 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
17278 |
|
17279 | try {
|
17280 | return mountMemo(create, deps);
|
17281 | } finally {
|
17282 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
17283 | }
|
17284 | },
|
17285 | useReducer: function (reducer, initialArg, init) {
|
17286 | currentHookNameInDev = 'useReducer';
|
17287 | mountHookTypesDev();
|
17288 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
17289 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
17290 |
|
17291 | try {
|
17292 | return mountReducer(reducer, initialArg, init);
|
17293 | } finally {
|
17294 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
17295 | }
|
17296 | },
|
17297 | useRef: function (initialValue) {
|
17298 | currentHookNameInDev = 'useRef';
|
17299 | mountHookTypesDev();
|
17300 | return mountRef(initialValue);
|
17301 | },
|
17302 | useState: function (initialState) {
|
17303 | currentHookNameInDev = 'useState';
|
17304 | mountHookTypesDev();
|
17305 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
17306 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
17307 |
|
17308 | try {
|
17309 | return mountState(initialState);
|
17310 | } finally {
|
17311 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
17312 | }
|
17313 | },
|
17314 | useDebugValue: function (value, formatterFn) {
|
17315 | currentHookNameInDev = 'useDebugValue';
|
17316 | mountHookTypesDev();
|
17317 | return mountDebugValue(value, formatterFn);
|
17318 | },
|
17319 | useResponder: function (responder, props) {
|
17320 | currentHookNameInDev = 'useResponder';
|
17321 | mountHookTypesDev();
|
17322 | return createResponderListener(responder, props);
|
17323 | }
|
17324 | };
|
17325 | HooksDispatcherOnMountWithHookTypesInDEV = {
|
17326 | readContext: function (context, observedBits) {
|
17327 | return readContext(context, observedBits);
|
17328 | },
|
17329 | useCallback: function (callback, deps) {
|
17330 | currentHookNameInDev = 'useCallback';
|
17331 | updateHookTypesDev();
|
17332 | return mountCallback(callback, deps);
|
17333 | },
|
17334 | useContext: function (context, observedBits) {
|
17335 | currentHookNameInDev = 'useContext';
|
17336 | updateHookTypesDev();
|
17337 | return readContext(context, observedBits);
|
17338 | },
|
17339 | useEffect: function (create, deps) {
|
17340 | currentHookNameInDev = 'useEffect';
|
17341 | updateHookTypesDev();
|
17342 | return mountEffect(create, deps);
|
17343 | },
|
17344 | useImperativeHandle: function (ref, create, deps) {
|
17345 | currentHookNameInDev = 'useImperativeHandle';
|
17346 | updateHookTypesDev();
|
17347 | return mountImperativeHandle(ref, create, deps);
|
17348 | },
|
17349 | useLayoutEffect: function (create, deps) {
|
17350 | currentHookNameInDev = 'useLayoutEffect';
|
17351 | updateHookTypesDev();
|
17352 | return mountLayoutEffect(create, deps);
|
17353 | },
|
17354 | useMemo: function (create, deps) {
|
17355 | currentHookNameInDev = 'useMemo';
|
17356 | updateHookTypesDev();
|
17357 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
17358 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
17359 |
|
17360 | try {
|
17361 | return mountMemo(create, deps);
|
17362 | } finally {
|
17363 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
17364 | }
|
17365 | },
|
17366 | useReducer: function (reducer, initialArg, init) {
|
17367 | currentHookNameInDev = 'useReducer';
|
17368 | updateHookTypesDev();
|
17369 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
17370 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
17371 |
|
17372 | try {
|
17373 | return mountReducer(reducer, initialArg, init);
|
17374 | } finally {
|
17375 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
17376 | }
|
17377 | },
|
17378 | useRef: function (initialValue) {
|
17379 | currentHookNameInDev = 'useRef';
|
17380 | updateHookTypesDev();
|
17381 | return mountRef(initialValue);
|
17382 | },
|
17383 | useState: function (initialState) {
|
17384 | currentHookNameInDev = 'useState';
|
17385 | updateHookTypesDev();
|
17386 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
17387 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
17388 |
|
17389 | try {
|
17390 | return mountState(initialState);
|
17391 | } finally {
|
17392 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
17393 | }
|
17394 | },
|
17395 | useDebugValue: function (value, formatterFn) {
|
17396 | currentHookNameInDev = 'useDebugValue';
|
17397 | updateHookTypesDev();
|
17398 | return mountDebugValue(value, formatterFn);
|
17399 | },
|
17400 | useResponder: function (responder, props) {
|
17401 | currentHookNameInDev = 'useResponder';
|
17402 | updateHookTypesDev();
|
17403 | return createResponderListener(responder, props);
|
17404 | }
|
17405 | };
|
17406 | HooksDispatcherOnUpdateInDEV = {
|
17407 | readContext: function (context, observedBits) {
|
17408 | return readContext(context, observedBits);
|
17409 | },
|
17410 | useCallback: function (callback, deps) {
|
17411 | currentHookNameInDev = 'useCallback';
|
17412 | updateHookTypesDev();
|
17413 | return updateCallback(callback, deps);
|
17414 | },
|
17415 | useContext: function (context, observedBits) {
|
17416 | currentHookNameInDev = 'useContext';
|
17417 | updateHookTypesDev();
|
17418 | return readContext(context, observedBits);
|
17419 | },
|
17420 | useEffect: function (create, deps) {
|
17421 | currentHookNameInDev = 'useEffect';
|
17422 | updateHookTypesDev();
|
17423 | return updateEffect(create, deps);
|
17424 | },
|
17425 | useImperativeHandle: function (ref, create, deps) {
|
17426 | currentHookNameInDev = 'useImperativeHandle';
|
17427 | updateHookTypesDev();
|
17428 | return updateImperativeHandle(ref, create, deps);
|
17429 | },
|
17430 | useLayoutEffect: function (create, deps) {
|
17431 | currentHookNameInDev = 'useLayoutEffect';
|
17432 | updateHookTypesDev();
|
17433 | return updateLayoutEffect(create, deps);
|
17434 | },
|
17435 | useMemo: function (create, deps) {
|
17436 | currentHookNameInDev = 'useMemo';
|
17437 | updateHookTypesDev();
|
17438 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
17439 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
17440 |
|
17441 | try {
|
17442 | return updateMemo(create, deps);
|
17443 | } finally {
|
17444 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
17445 | }
|
17446 | },
|
17447 | useReducer: function (reducer, initialArg, init) {
|
17448 | currentHookNameInDev = 'useReducer';
|
17449 | updateHookTypesDev();
|
17450 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
17451 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
17452 |
|
17453 | try {
|
17454 | return updateReducer(reducer, initialArg, init);
|
17455 | } finally {
|
17456 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
17457 | }
|
17458 | },
|
17459 | useRef: function (initialValue) {
|
17460 | currentHookNameInDev = 'useRef';
|
17461 | updateHookTypesDev();
|
17462 | return updateRef(initialValue);
|
17463 | },
|
17464 | useState: function (initialState) {
|
17465 | currentHookNameInDev = 'useState';
|
17466 | updateHookTypesDev();
|
17467 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
17468 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
17469 |
|
17470 | try {
|
17471 | return updateState(initialState);
|
17472 | } finally {
|
17473 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
17474 | }
|
17475 | },
|
17476 | useDebugValue: function (value, formatterFn) {
|
17477 | currentHookNameInDev = 'useDebugValue';
|
17478 | updateHookTypesDev();
|
17479 | return updateDebugValue(value, formatterFn);
|
17480 | },
|
17481 | useResponder: function (responder, props) {
|
17482 | currentHookNameInDev = 'useResponder';
|
17483 | updateHookTypesDev();
|
17484 | return createResponderListener(responder, props);
|
17485 | }
|
17486 | };
|
17487 | InvalidNestedHooksDispatcherOnMountInDEV = {
|
17488 | readContext: function (context, observedBits) {
|
17489 | warnInvalidContextAccess();
|
17490 | return readContext(context, observedBits);
|
17491 | },
|
17492 | useCallback: function (callback, deps) {
|
17493 | currentHookNameInDev = 'useCallback';
|
17494 | warnInvalidHookAccess();
|
17495 | mountHookTypesDev();
|
17496 | return mountCallback(callback, deps);
|
17497 | },
|
17498 | useContext: function (context, observedBits) {
|
17499 | currentHookNameInDev = 'useContext';
|
17500 | warnInvalidHookAccess();
|
17501 | mountHookTypesDev();
|
17502 | return readContext(context, observedBits);
|
17503 | },
|
17504 | useEffect: function (create, deps) {
|
17505 | currentHookNameInDev = 'useEffect';
|
17506 | warnInvalidHookAccess();
|
17507 | mountHookTypesDev();
|
17508 | return mountEffect(create, deps);
|
17509 | },
|
17510 | useImperativeHandle: function (ref, create, deps) {
|
17511 | currentHookNameInDev = 'useImperativeHandle';
|
17512 | warnInvalidHookAccess();
|
17513 | mountHookTypesDev();
|
17514 | return mountImperativeHandle(ref, create, deps);
|
17515 | },
|
17516 | useLayoutEffect: function (create, deps) {
|
17517 | currentHookNameInDev = 'useLayoutEffect';
|
17518 | warnInvalidHookAccess();
|
17519 | mountHookTypesDev();
|
17520 | return mountLayoutEffect(create, deps);
|
17521 | },
|
17522 | useMemo: function (create, deps) {
|
17523 | currentHookNameInDev = 'useMemo';
|
17524 | warnInvalidHookAccess();
|
17525 | mountHookTypesDev();
|
17526 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
17527 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
17528 |
|
17529 | try {
|
17530 | return mountMemo(create, deps);
|
17531 | } finally {
|
17532 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
17533 | }
|
17534 | },
|
17535 | useReducer: function (reducer, initialArg, init) {
|
17536 | currentHookNameInDev = 'useReducer';
|
17537 | warnInvalidHookAccess();
|
17538 | mountHookTypesDev();
|
17539 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
17540 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
17541 |
|
17542 | try {
|
17543 | return mountReducer(reducer, initialArg, init);
|
17544 | } finally {
|
17545 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
17546 | }
|
17547 | },
|
17548 | useRef: function (initialValue) {
|
17549 | currentHookNameInDev = 'useRef';
|
17550 | warnInvalidHookAccess();
|
17551 | mountHookTypesDev();
|
17552 | return mountRef(initialValue);
|
17553 | },
|
17554 | useState: function (initialState) {
|
17555 | currentHookNameInDev = 'useState';
|
17556 | warnInvalidHookAccess();
|
17557 | mountHookTypesDev();
|
17558 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
17559 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
17560 |
|
17561 | try {
|
17562 | return mountState(initialState);
|
17563 | } finally {
|
17564 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
17565 | }
|
17566 | },
|
17567 | useDebugValue: function (value, formatterFn) {
|
17568 | currentHookNameInDev = 'useDebugValue';
|
17569 | warnInvalidHookAccess();
|
17570 | mountHookTypesDev();
|
17571 | return mountDebugValue(value, formatterFn);
|
17572 | },
|
17573 | useResponder: function (responder, props) {
|
17574 | currentHookNameInDev = 'useResponder';
|
17575 | warnInvalidHookAccess();
|
17576 | mountHookTypesDev();
|
17577 | return createResponderListener(responder, props);
|
17578 | }
|
17579 | };
|
17580 | InvalidNestedHooksDispatcherOnUpdateInDEV = {
|
17581 | readContext: function (context, observedBits) {
|
17582 | warnInvalidContextAccess();
|
17583 | return readContext(context, observedBits);
|
17584 | },
|
17585 | useCallback: function (callback, deps) {
|
17586 | currentHookNameInDev = 'useCallback';
|
17587 | warnInvalidHookAccess();
|
17588 | updateHookTypesDev();
|
17589 | return updateCallback(callback, deps);
|
17590 | },
|
17591 | useContext: function (context, observedBits) {
|
17592 | currentHookNameInDev = 'useContext';
|
17593 | warnInvalidHookAccess();
|
17594 | updateHookTypesDev();
|
17595 | return readContext(context, observedBits);
|
17596 | },
|
17597 | useEffect: function (create, deps) {
|
17598 | currentHookNameInDev = 'useEffect';
|
17599 | warnInvalidHookAccess();
|
17600 | updateHookTypesDev();
|
17601 | return updateEffect(create, deps);
|
17602 | },
|
17603 | useImperativeHandle: function (ref, create, deps) {
|
17604 | currentHookNameInDev = 'useImperativeHandle';
|
17605 | warnInvalidHookAccess();
|
17606 | updateHookTypesDev();
|
17607 | return updateImperativeHandle(ref, create, deps);
|
17608 | },
|
17609 | useLayoutEffect: function (create, deps) {
|
17610 | currentHookNameInDev = 'useLayoutEffect';
|
17611 | warnInvalidHookAccess();
|
17612 | updateHookTypesDev();
|
17613 | return updateLayoutEffect(create, deps);
|
17614 | },
|
17615 | useMemo: function (create, deps) {
|
17616 | currentHookNameInDev = 'useMemo';
|
17617 | warnInvalidHookAccess();
|
17618 | updateHookTypesDev();
|
17619 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
17620 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
17621 |
|
17622 | try {
|
17623 | return updateMemo(create, deps);
|
17624 | } finally {
|
17625 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
17626 | }
|
17627 | },
|
17628 | useReducer: function (reducer, initialArg, init) {
|
17629 | currentHookNameInDev = 'useReducer';
|
17630 | warnInvalidHookAccess();
|
17631 | updateHookTypesDev();
|
17632 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
17633 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
17634 |
|
17635 | try {
|
17636 | return updateReducer(reducer, initialArg, init);
|
17637 | } finally {
|
17638 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
17639 | }
|
17640 | },
|
17641 | useRef: function (initialValue) {
|
17642 | currentHookNameInDev = 'useRef';
|
17643 | warnInvalidHookAccess();
|
17644 | updateHookTypesDev();
|
17645 | return updateRef(initialValue);
|
17646 | },
|
17647 | useState: function (initialState) {
|
17648 | currentHookNameInDev = 'useState';
|
17649 | warnInvalidHookAccess();
|
17650 | updateHookTypesDev();
|
17651 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
17652 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
17653 |
|
17654 | try {
|
17655 | return updateState(initialState);
|
17656 | } finally {
|
17657 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
17658 | }
|
17659 | },
|
17660 | useDebugValue: function (value, formatterFn) {
|
17661 | currentHookNameInDev = 'useDebugValue';
|
17662 | warnInvalidHookAccess();
|
17663 | updateHookTypesDev();
|
17664 | return updateDebugValue(value, formatterFn);
|
17665 | },
|
17666 | useResponder: function (responder, props) {
|
17667 | currentHookNameInDev = 'useResponder';
|
17668 | warnInvalidHookAccess();
|
17669 | updateHookTypesDev();
|
17670 | return createResponderListener(responder, props);
|
17671 | }
|
17672 | };
|
17673 | }
|
17674 |
|
17675 |
|
17676 |
|
17677 | var now$1 = unstable_now;
|
17678 | var commitTime = 0;
|
17679 | var profilerStartTime = -1;
|
17680 |
|
17681 | function getCommitTime() {
|
17682 | return commitTime;
|
17683 | }
|
17684 |
|
17685 | function recordCommitTime() {
|
17686 | if (!enableProfilerTimer) {
|
17687 | return;
|
17688 | }
|
17689 |
|
17690 | commitTime = now$1();
|
17691 | }
|
17692 |
|
17693 | function startProfilerTimer(fiber) {
|
17694 | if (!enableProfilerTimer) {
|
17695 | return;
|
17696 | }
|
17697 |
|
17698 | profilerStartTime = now$1();
|
17699 |
|
17700 | if (fiber.actualStartTime < 0) {
|
17701 | fiber.actualStartTime = now$1();
|
17702 | }
|
17703 | }
|
17704 |
|
17705 | function stopProfilerTimerIfRunning(fiber) {
|
17706 | if (!enableProfilerTimer) {
|
17707 | return;
|
17708 | }
|
17709 |
|
17710 | profilerStartTime = -1;
|
17711 | }
|
17712 |
|
17713 | function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) {
|
17714 | if (!enableProfilerTimer) {
|
17715 | return;
|
17716 | }
|
17717 |
|
17718 | if (profilerStartTime >= 0) {
|
17719 | var elapsedTime = now$1() - profilerStartTime;
|
17720 | fiber.actualDuration += elapsedTime;
|
17721 |
|
17722 | if (overrideBaseTime) {
|
17723 | fiber.selfBaseDuration = elapsedTime;
|
17724 | }
|
17725 |
|
17726 | profilerStartTime = -1;
|
17727 | }
|
17728 | }
|
17729 |
|
17730 |
|
17731 |
|
17732 | var hydrationParentFiber = null;
|
17733 | var nextHydratableInstance = null;
|
17734 | var isHydrating = false;
|
17735 |
|
17736 | function warnIfHydrating() {
|
17737 | {
|
17738 | !!isHydrating ? warning$1(false, 'We should not be hydrating here. This is a bug in React. Please file a bug.') : void 0;
|
17739 | }
|
17740 | }
|
17741 |
|
17742 | function enterHydrationState(fiber) {
|
17743 | if (!supportsHydration) {
|
17744 | return false;
|
17745 | }
|
17746 |
|
17747 | var parentInstance = fiber.stateNode.containerInfo;
|
17748 | nextHydratableInstance = getFirstHydratableChild(parentInstance);
|
17749 | hydrationParentFiber = fiber;
|
17750 | isHydrating = true;
|
17751 | return true;
|
17752 | }
|
17753 |
|
17754 | function reenterHydrationStateFromDehydratedSuspenseInstance(fiber, suspenseInstance) {
|
17755 | if (!supportsHydration) {
|
17756 | return false;
|
17757 | }
|
17758 |
|
17759 | nextHydratableInstance = getNextHydratableSibling(suspenseInstance);
|
17760 | popToNextHostParent(fiber);
|
17761 | isHydrating = true;
|
17762 | return true;
|
17763 | }
|
17764 |
|
17765 | function deleteHydratableInstance(returnFiber, instance) {
|
17766 | {
|
17767 | switch (returnFiber.tag) {
|
17768 | case HostRoot:
|
17769 | didNotHydrateContainerInstance(returnFiber.stateNode.containerInfo, instance);
|
17770 | break;
|
17771 |
|
17772 | case HostComponent:
|
17773 | didNotHydrateInstance(returnFiber.type, returnFiber.memoizedProps, returnFiber.stateNode, instance);
|
17774 | break;
|
17775 | }
|
17776 | }
|
17777 |
|
17778 | var childToDelete = createFiberFromHostInstanceForDeletion();
|
17779 | childToDelete.stateNode = instance;
|
17780 | childToDelete.return = returnFiber;
|
17781 | childToDelete.effectTag = Deletion;
|
17782 |
|
17783 |
|
17784 |
|
17785 |
|
17786 |
|
17787 | if (returnFiber.lastEffect !== null) {
|
17788 | returnFiber.lastEffect.nextEffect = childToDelete;
|
17789 | returnFiber.lastEffect = childToDelete;
|
17790 | } else {
|
17791 | returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
|
17792 | }
|
17793 | }
|
17794 |
|
17795 | function insertNonHydratedInstance(returnFiber, fiber) {
|
17796 | fiber.effectTag = fiber.effectTag & ~Hydrating | Placement;
|
17797 |
|
17798 | {
|
17799 | switch (returnFiber.tag) {
|
17800 | case HostRoot:
|
17801 | {
|
17802 | var parentContainer = returnFiber.stateNode.containerInfo;
|
17803 |
|
17804 | switch (fiber.tag) {
|
17805 | case HostComponent:
|
17806 | var type = fiber.type;
|
17807 | var props = fiber.pendingProps;
|
17808 | didNotFindHydratableContainerInstance(parentContainer, type, props);
|
17809 | break;
|
17810 |
|
17811 | case HostText:
|
17812 | var text = fiber.pendingProps;
|
17813 | didNotFindHydratableContainerTextInstance(parentContainer, text);
|
17814 | break;
|
17815 |
|
17816 | case SuspenseComponent:
|
17817 |
|
17818 | break;
|
17819 | }
|
17820 |
|
17821 | break;
|
17822 | }
|
17823 |
|
17824 | case HostComponent:
|
17825 | {
|
17826 | var parentType = returnFiber.type;
|
17827 | var parentProps = returnFiber.memoizedProps;
|
17828 | var parentInstance = returnFiber.stateNode;
|
17829 |
|
17830 | switch (fiber.tag) {
|
17831 | case HostComponent:
|
17832 | var _type = fiber.type;
|
17833 | var _props = fiber.pendingProps;
|
17834 | didNotFindHydratableInstance(parentType, parentProps, parentInstance, _type, _props);
|
17835 | break;
|
17836 |
|
17837 | case HostText:
|
17838 | var _text = fiber.pendingProps;
|
17839 | didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text);
|
17840 | break;
|
17841 |
|
17842 | case SuspenseComponent:
|
17843 | didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance);
|
17844 | break;
|
17845 | }
|
17846 |
|
17847 | break;
|
17848 | }
|
17849 |
|
17850 | default:
|
17851 | return;
|
17852 | }
|
17853 | }
|
17854 | }
|
17855 |
|
17856 | function tryHydrate(fiber, nextInstance) {
|
17857 | switch (fiber.tag) {
|
17858 | case HostComponent:
|
17859 | {
|
17860 | var type = fiber.type;
|
17861 | var props = fiber.pendingProps;
|
17862 | var instance = canHydrateInstance(nextInstance, type, props);
|
17863 |
|
17864 | if (instance !== null) {
|
17865 | fiber.stateNode = instance;
|
17866 | return true;
|
17867 | }
|
17868 |
|
17869 | return false;
|
17870 | }
|
17871 |
|
17872 | case HostText:
|
17873 | {
|
17874 | var text = fiber.pendingProps;
|
17875 | var textInstance = canHydrateTextInstance(nextInstance, text);
|
17876 |
|
17877 | if (textInstance !== null) {
|
17878 | fiber.stateNode = textInstance;
|
17879 | return true;
|
17880 | }
|
17881 |
|
17882 | return false;
|
17883 | }
|
17884 |
|
17885 | case SuspenseComponent:
|
17886 | {
|
17887 | if (enableSuspenseServerRenderer) {
|
17888 | var suspenseInstance = canHydrateSuspenseInstance(nextInstance);
|
17889 |
|
17890 | if (suspenseInstance !== null) {
|
17891 | var suspenseState = {
|
17892 | dehydrated: suspenseInstance,
|
17893 | retryTime: Never
|
17894 | };
|
17895 | fiber.memoizedState = suspenseState;
|
17896 |
|
17897 |
|
17898 |
|
17899 |
|
17900 | var dehydratedFragment = createFiberFromDehydratedFragment(suspenseInstance);
|
17901 | dehydratedFragment.return = fiber;
|
17902 | fiber.child = dehydratedFragment;
|
17903 | return true;
|
17904 | }
|
17905 | }
|
17906 |
|
17907 | return false;
|
17908 | }
|
17909 |
|
17910 | default:
|
17911 | return false;
|
17912 | }
|
17913 | }
|
17914 |
|
17915 | function tryToClaimNextHydratableInstance(fiber) {
|
17916 | if (!isHydrating) {
|
17917 | return;
|
17918 | }
|
17919 |
|
17920 | var nextInstance = nextHydratableInstance;
|
17921 |
|
17922 | if (!nextInstance) {
|
17923 |
|
17924 | insertNonHydratedInstance(hydrationParentFiber, fiber);
|
17925 | isHydrating = false;
|
17926 | hydrationParentFiber = fiber;
|
17927 | return;
|
17928 | }
|
17929 |
|
17930 | var firstAttemptedInstance = nextInstance;
|
17931 |
|
17932 | if (!tryHydrate(fiber, nextInstance)) {
|
17933 |
|
17934 |
|
17935 |
|
17936 | nextInstance = getNextHydratableSibling(firstAttemptedInstance);
|
17937 |
|
17938 | if (!nextInstance || !tryHydrate(fiber, nextInstance)) {
|
17939 |
|
17940 | insertNonHydratedInstance(hydrationParentFiber, fiber);
|
17941 | isHydrating = false;
|
17942 | hydrationParentFiber = fiber;
|
17943 | return;
|
17944 | }
|
17945 |
|
17946 |
|
17947 |
|
17948 |
|
17949 |
|
17950 | deleteHydratableInstance(hydrationParentFiber, firstAttemptedInstance);
|
17951 | }
|
17952 |
|
17953 | hydrationParentFiber = fiber;
|
17954 | nextHydratableInstance = getFirstHydratableChild(nextInstance);
|
17955 | }
|
17956 |
|
17957 | function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
|
17958 | if (!supportsHydration) {
|
17959 | (function () {
|
17960 | {
|
17961 | {
|
17962 | throw ReactError(Error("Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."));
|
17963 | }
|
17964 | }
|
17965 | })();
|
17966 | }
|
17967 |
|
17968 | var instance = fiber.stateNode;
|
17969 | var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber);
|
17970 |
|
17971 | fiber.updateQueue = updatePayload;
|
17972 |
|
17973 |
|
17974 | if (updatePayload !== null) {
|
17975 | return true;
|
17976 | }
|
17977 |
|
17978 | return false;
|
17979 | }
|
17980 |
|
17981 | function prepareToHydrateHostTextInstance(fiber) {
|
17982 | if (!supportsHydration) {
|
17983 | (function () {
|
17984 | {
|
17985 | {
|
17986 | throw ReactError(Error("Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."));
|
17987 | }
|
17988 | }
|
17989 | })();
|
17990 | }
|
17991 |
|
17992 | var textInstance = fiber.stateNode;
|
17993 | var textContent = fiber.memoizedProps;
|
17994 | var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber);
|
17995 |
|
17996 | {
|
17997 | if (shouldUpdate) {
|
17998 |
|
17999 |
|
18000 | var returnFiber = hydrationParentFiber;
|
18001 |
|
18002 | if (returnFiber !== null) {
|
18003 | switch (returnFiber.tag) {
|
18004 | case HostRoot:
|
18005 | {
|
18006 | var parentContainer = returnFiber.stateNode.containerInfo;
|
18007 | didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, textContent);
|
18008 | break;
|
18009 | }
|
18010 |
|
18011 | case HostComponent:
|
18012 | {
|
18013 | var parentType = returnFiber.type;
|
18014 | var parentProps = returnFiber.memoizedProps;
|
18015 | var parentInstance = returnFiber.stateNode;
|
18016 | didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, textContent);
|
18017 | break;
|
18018 | }
|
18019 | }
|
18020 | }
|
18021 | }
|
18022 | }
|
18023 |
|
18024 | return shouldUpdate;
|
18025 | }
|
18026 |
|
18027 | function prepareToHydrateHostSuspenseInstance(fiber) {
|
18028 | if (!supportsHydration) {
|
18029 | (function () {
|
18030 | {
|
18031 | {
|
18032 | throw ReactError(Error("Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."));
|
18033 | }
|
18034 | }
|
18035 | })();
|
18036 | }
|
18037 |
|
18038 | var suspenseState = fiber.memoizedState;
|
18039 | var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null;
|
18040 |
|
18041 | (function () {
|
18042 | if (!suspenseInstance) {
|
18043 | {
|
18044 | throw ReactError(Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue."));
|
18045 | }
|
18046 | }
|
18047 | })();
|
18048 |
|
18049 | hydrateSuspenseInstance(suspenseInstance, fiber);
|
18050 | }
|
18051 |
|
18052 | function skipPastDehydratedSuspenseInstance(fiber) {
|
18053 | if (!supportsHydration) {
|
18054 | (function () {
|
18055 | {
|
18056 | {
|
18057 | throw ReactError(Error("Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."));
|
18058 | }
|
18059 | }
|
18060 | })();
|
18061 | }
|
18062 |
|
18063 | var suspenseState = fiber.memoizedState;
|
18064 | var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null;
|
18065 |
|
18066 | (function () {
|
18067 | if (!suspenseInstance) {
|
18068 | {
|
18069 | throw ReactError(Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue."));
|
18070 | }
|
18071 | }
|
18072 | })();
|
18073 |
|
18074 | return getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
|
18075 | }
|
18076 |
|
18077 | function popToNextHostParent(fiber) {
|
18078 | var parent = fiber.return;
|
18079 |
|
18080 | while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot && parent.tag !== SuspenseComponent) {
|
18081 | parent = parent.return;
|
18082 | }
|
18083 |
|
18084 | hydrationParentFiber = parent;
|
18085 | }
|
18086 |
|
18087 | function popHydrationState(fiber) {
|
18088 | if (!supportsHydration) {
|
18089 | return false;
|
18090 | }
|
18091 |
|
18092 | if (fiber !== hydrationParentFiber) {
|
18093 |
|
18094 |
|
18095 | return false;
|
18096 | }
|
18097 |
|
18098 | if (!isHydrating) {
|
18099 |
|
18100 |
|
18101 |
|
18102 | popToNextHostParent(fiber);
|
18103 | isHydrating = true;
|
18104 | return false;
|
18105 | }
|
18106 |
|
18107 | var type = fiber.type;
|
18108 |
|
18109 |
|
18110 |
|
18111 |
|
18112 |
|
18113 | if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) {
|
18114 | var nextInstance = nextHydratableInstance;
|
18115 |
|
18116 | while (nextInstance) {
|
18117 | deleteHydratableInstance(fiber, nextInstance);
|
18118 | nextInstance = getNextHydratableSibling(nextInstance);
|
18119 | }
|
18120 | }
|
18121 |
|
18122 | popToNextHostParent(fiber);
|
18123 |
|
18124 | if (fiber.tag === SuspenseComponent) {
|
18125 | nextHydratableInstance = skipPastDehydratedSuspenseInstance(fiber);
|
18126 | } else {
|
18127 | nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
|
18128 | }
|
18129 |
|
18130 | return true;
|
18131 | }
|
18132 |
|
18133 | function resetHydrationState() {
|
18134 | if (!supportsHydration) {
|
18135 | return;
|
18136 | }
|
18137 |
|
18138 | hydrationParentFiber = null;
|
18139 | nextHydratableInstance = null;
|
18140 | isHydrating = false;
|
18141 | }
|
18142 |
|
18143 | var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner;
|
18144 | var didReceiveUpdate = false;
|
18145 | var didWarnAboutBadClass;
|
18146 | var didWarnAboutModulePatternComponent;
|
18147 | var didWarnAboutContextTypeOnFunctionComponent;
|
18148 | var didWarnAboutGetDerivedStateOnFunctionComponent;
|
18149 | var didWarnAboutFunctionRefs;
|
18150 | var didWarnAboutReassigningProps;
|
18151 | var didWarnAboutMaxDuration;
|
18152 | var didWarnAboutRevealOrder;
|
18153 | var didWarnAboutTailOptions;
|
18154 | var didWarnAboutDefaultPropsOnFunctionComponent;
|
18155 |
|
18156 | {
|
18157 | didWarnAboutBadClass = {};
|
18158 | didWarnAboutModulePatternComponent = {};
|
18159 | didWarnAboutContextTypeOnFunctionComponent = {};
|
18160 | didWarnAboutGetDerivedStateOnFunctionComponent = {};
|
18161 | didWarnAboutFunctionRefs = {};
|
18162 | didWarnAboutReassigningProps = false;
|
18163 | didWarnAboutMaxDuration = false;
|
18164 | didWarnAboutRevealOrder = {};
|
18165 | didWarnAboutTailOptions = {};
|
18166 | didWarnAboutDefaultPropsOnFunctionComponent = {};
|
18167 | }
|
18168 |
|
18169 | function reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime) {
|
18170 | if (current$$1 === null) {
|
18171 |
|
18172 |
|
18173 |
|
18174 |
|
18175 | workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
|
18176 | } else {
|
18177 |
|
18178 |
|
18179 |
|
18180 |
|
18181 |
|
18182 | workInProgress.child = reconcileChildFibers(workInProgress, current$$1.child, nextChildren, renderExpirationTime);
|
18183 | }
|
18184 | }
|
18185 |
|
18186 | function forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime) {
|
18187 |
|
18188 |
|
18189 |
|
18190 |
|
18191 |
|
18192 |
|
18193 |
|
18194 |
|
18195 | workInProgress.child = reconcileChildFibers(workInProgress, current$$1.child, null, renderExpirationTime);
|
18196 |
|
18197 |
|
18198 |
|
18199 |
|
18200 | workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
|
18201 | }
|
18202 |
|
18203 | function updateForwardRef(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
|
18204 |
|
18205 |
|
18206 |
|
18207 | {
|
18208 | if (workInProgress.type !== workInProgress.elementType) {
|
18209 |
|
18210 |
|
18211 | var innerPropTypes = Component.propTypes;
|
18212 |
|
18213 | if (innerPropTypes) {
|
18214 | checkPropTypes_1(innerPropTypes, nextProps,
|
18215 | 'prop', getComponentName(Component), getCurrentFiberStackInDev);
|
18216 | }
|
18217 | }
|
18218 | }
|
18219 |
|
18220 | var render = Component.render;
|
18221 | var ref = workInProgress.ref;
|
18222 |
|
18223 | var nextChildren;
|
18224 | prepareToReadContext(workInProgress, renderExpirationTime);
|
18225 |
|
18226 | {
|
18227 | ReactCurrentOwner$3.current = workInProgress;
|
18228 | setCurrentPhase('render');
|
18229 | nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
|
18230 |
|
18231 | if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
18232 |
|
18233 | if (workInProgress.memoizedState !== null) {
|
18234 | nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
|
18235 | }
|
18236 | }
|
18237 |
|
18238 | setCurrentPhase(null);
|
18239 | }
|
18240 |
|
18241 | if (current$$1 !== null && !didReceiveUpdate) {
|
18242 | bailoutHooks(current$$1, workInProgress, renderExpirationTime);
|
18243 | return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
18244 | }
|
18245 |
|
18246 |
|
18247 | workInProgress.effectTag |= PerformedWork;
|
18248 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
18249 | return workInProgress.child;
|
18250 | }
|
18251 |
|
18252 | function updateMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
|
18253 | if (current$$1 === null) {
|
18254 | var type = Component.type;
|
18255 |
|
18256 | if (isSimpleFunctionComponent(type) && Component.compare === null &&
|
18257 | Component.defaultProps === undefined) {
|
18258 | var resolvedType = type;
|
18259 |
|
18260 | {
|
18261 | resolvedType = resolveFunctionForHotReloading(type);
|
18262 | }
|
18263 |
|
18264 |
|
18265 |
|
18266 |
|
18267 | workInProgress.tag = SimpleMemoComponent;
|
18268 | workInProgress.type = resolvedType;
|
18269 |
|
18270 | {
|
18271 | validateFunctionComponentInDev(workInProgress, type);
|
18272 | }
|
18273 |
|
18274 | return updateSimpleMemoComponent(current$$1, workInProgress, resolvedType, nextProps, updateExpirationTime, renderExpirationTime);
|
18275 | }
|
18276 |
|
18277 | {
|
18278 | var innerPropTypes = type.propTypes;
|
18279 |
|
18280 | if (innerPropTypes) {
|
18281 |
|
18282 |
|
18283 | checkPropTypes_1(innerPropTypes, nextProps,
|
18284 | 'prop', getComponentName(type), getCurrentFiberStackInDev);
|
18285 | }
|
18286 | }
|
18287 |
|
18288 | var child = createFiberFromTypeAndProps(Component.type, null, nextProps, null, workInProgress.mode, renderExpirationTime);
|
18289 | child.ref = workInProgress.ref;
|
18290 | child.return = workInProgress;
|
18291 | workInProgress.child = child;
|
18292 | return child;
|
18293 | }
|
18294 |
|
18295 | {
|
18296 | var _type = Component.type;
|
18297 | var _innerPropTypes = _type.propTypes;
|
18298 |
|
18299 | if (_innerPropTypes) {
|
18300 |
|
18301 |
|
18302 | checkPropTypes_1(_innerPropTypes, nextProps,
|
18303 | 'prop', getComponentName(_type), getCurrentFiberStackInDev);
|
18304 | }
|
18305 | }
|
18306 |
|
18307 | var currentChild = current$$1.child;
|
18308 |
|
18309 | if (updateExpirationTime < renderExpirationTime) {
|
18310 |
|
18311 |
|
18312 | var prevProps = currentChild.memoizedProps;
|
18313 |
|
18314 | var compare = Component.compare;
|
18315 | compare = compare !== null ? compare : shallowEqual;
|
18316 |
|
18317 | if (compare(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
|
18318 | return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
18319 | }
|
18320 | }
|
18321 |
|
18322 |
|
18323 | workInProgress.effectTag |= PerformedWork;
|
18324 | var newChild = createWorkInProgress(currentChild, nextProps, renderExpirationTime);
|
18325 | newChild.ref = workInProgress.ref;
|
18326 | newChild.return = workInProgress;
|
18327 | workInProgress.child = newChild;
|
18328 | return newChild;
|
18329 | }
|
18330 |
|
18331 | function updateSimpleMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
|
18332 |
|
18333 |
|
18334 |
|
18335 | {
|
18336 | if (workInProgress.type !== workInProgress.elementType) {
|
18337 |
|
18338 |
|
18339 | var outerMemoType = workInProgress.elementType;
|
18340 |
|
18341 | if (outerMemoType.$$typeof === REACT_LAZY_TYPE) {
|
18342 |
|
18343 |
|
18344 |
|
18345 | outerMemoType = refineResolvedLazyComponent(outerMemoType);
|
18346 | }
|
18347 |
|
18348 | var outerPropTypes = outerMemoType && outerMemoType.propTypes;
|
18349 |
|
18350 | if (outerPropTypes) {
|
18351 | checkPropTypes_1(outerPropTypes, nextProps,
|
18352 | 'prop', getComponentName(outerMemoType), getCurrentFiberStackInDev);
|
18353 | }
|
18354 |
|
18355 | }
|
18356 | }
|
18357 |
|
18358 | if (current$$1 !== null) {
|
18359 | var prevProps = current$$1.memoizedProps;
|
18360 |
|
18361 | if (shallowEqual(prevProps, nextProps) && current$$1.ref === workInProgress.ref && (
|
18362 | workInProgress.type === current$$1.type)) {
|
18363 | didReceiveUpdate = false;
|
18364 |
|
18365 | if (updateExpirationTime < renderExpirationTime) {
|
18366 | return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
18367 | }
|
18368 | }
|
18369 | }
|
18370 |
|
18371 | return updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
|
18372 | }
|
18373 |
|
18374 | function updateFragment(current$$1, workInProgress, renderExpirationTime) {
|
18375 | var nextChildren = workInProgress.pendingProps;
|
18376 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
18377 | return workInProgress.child;
|
18378 | }
|
18379 |
|
18380 | function updateMode(current$$1, workInProgress, renderExpirationTime) {
|
18381 | var nextChildren = workInProgress.pendingProps.children;
|
18382 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
18383 | return workInProgress.child;
|
18384 | }
|
18385 |
|
18386 | function updateProfiler(current$$1, workInProgress, renderExpirationTime) {
|
18387 | if (enableProfilerTimer) {
|
18388 | workInProgress.effectTag |= Update;
|
18389 | }
|
18390 |
|
18391 | var nextProps = workInProgress.pendingProps;
|
18392 | var nextChildren = nextProps.children;
|
18393 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
18394 | return workInProgress.child;
|
18395 | }
|
18396 |
|
18397 | function markRef(current$$1, workInProgress) {
|
18398 | var ref = workInProgress.ref;
|
18399 |
|
18400 | if (current$$1 === null && ref !== null || current$$1 !== null && current$$1.ref !== ref) {
|
18401 |
|
18402 | workInProgress.effectTag |= Ref;
|
18403 | }
|
18404 | }
|
18405 |
|
18406 | function updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
|
18407 | {
|
18408 | if (workInProgress.type !== workInProgress.elementType) {
|
18409 |
|
18410 |
|
18411 | var innerPropTypes = Component.propTypes;
|
18412 |
|
18413 | if (innerPropTypes) {
|
18414 | checkPropTypes_1(innerPropTypes, nextProps,
|
18415 | 'prop', getComponentName(Component), getCurrentFiberStackInDev);
|
18416 | }
|
18417 | }
|
18418 | }
|
18419 |
|
18420 | var context;
|
18421 |
|
18422 | if (!disableLegacyContext) {
|
18423 | var unmaskedContext = getUnmaskedContext(workInProgress, Component, true);
|
18424 | context = getMaskedContext(workInProgress, unmaskedContext);
|
18425 | }
|
18426 |
|
18427 | var nextChildren;
|
18428 | prepareToReadContext(workInProgress, renderExpirationTime);
|
18429 |
|
18430 | {
|
18431 | ReactCurrentOwner$3.current = workInProgress;
|
18432 | setCurrentPhase('render');
|
18433 | nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
|
18434 |
|
18435 | if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
18436 |
|
18437 | if (workInProgress.memoizedState !== null) {
|
18438 | nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
|
18439 | }
|
18440 | }
|
18441 |
|
18442 | setCurrentPhase(null);
|
18443 | }
|
18444 |
|
18445 | if (current$$1 !== null && !didReceiveUpdate) {
|
18446 | bailoutHooks(current$$1, workInProgress, renderExpirationTime);
|
18447 | return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
18448 | }
|
18449 |
|
18450 |
|
18451 | workInProgress.effectTag |= PerformedWork;
|
18452 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
18453 | return workInProgress.child;
|
18454 | }
|
18455 |
|
18456 | function updateClassComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
|
18457 | {
|
18458 | if (workInProgress.type !== workInProgress.elementType) {
|
18459 |
|
18460 |
|
18461 | var innerPropTypes = Component.propTypes;
|
18462 |
|
18463 | if (innerPropTypes) {
|
18464 | checkPropTypes_1(innerPropTypes, nextProps,
|
18465 | 'prop', getComponentName(Component), getCurrentFiberStackInDev);
|
18466 | }
|
18467 | }
|
18468 | }
|
18469 |
|
18470 |
|
18471 |
|
18472 |
|
18473 | var hasContext;
|
18474 |
|
18475 | if (isContextProvider(Component)) {
|
18476 | hasContext = true;
|
18477 | pushContextProvider(workInProgress);
|
18478 | } else {
|
18479 | hasContext = false;
|
18480 | }
|
18481 |
|
18482 | prepareToReadContext(workInProgress, renderExpirationTime);
|
18483 | var instance = workInProgress.stateNode;
|
18484 | var shouldUpdate;
|
18485 |
|
18486 | if (instance === null) {
|
18487 | if (current$$1 !== null) {
|
18488 |
|
18489 |
|
18490 |
|
18491 |
|
18492 | current$$1.alternate = null;
|
18493 | workInProgress.alternate = null;
|
18494 |
|
18495 | workInProgress.effectTag |= Placement;
|
18496 | }
|
18497 |
|
18498 |
|
18499 | constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
18500 | mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
18501 | shouldUpdate = true;
|
18502 | } else if (current$$1 === null) {
|
18503 |
|
18504 | shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
18505 | } else {
|
18506 | shouldUpdate = updateClassInstance(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
|
18507 | }
|
18508 |
|
18509 | var nextUnitOfWork = finishClassComponent(current$$1, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime);
|
18510 |
|
18511 | {
|
18512 | var inst = workInProgress.stateNode;
|
18513 |
|
18514 | if (inst.props !== nextProps) {
|
18515 | !didWarnAboutReassigningProps ? warning$1(false, 'It looks like %s is reassigning its own `this.props` while rendering. ' + 'This is not supported and can lead to confusing bugs.', getComponentName(workInProgress.type) || 'a component') : void 0;
|
18516 | didWarnAboutReassigningProps = true;
|
18517 | }
|
18518 | }
|
18519 |
|
18520 | return nextUnitOfWork;
|
18521 | }
|
18522 |
|
18523 | function finishClassComponent(current$$1, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime) {
|
18524 |
|
18525 | markRef(current$$1, workInProgress);
|
18526 | var didCaptureError = (workInProgress.effectTag & DidCapture) !== NoEffect;
|
18527 |
|
18528 | if (!shouldUpdate && !didCaptureError) {
|
18529 |
|
18530 | if (hasContext) {
|
18531 | invalidateContextProvider(workInProgress, Component, false);
|
18532 | }
|
18533 |
|
18534 | return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
18535 | }
|
18536 |
|
18537 | var instance = workInProgress.stateNode;
|
18538 |
|
18539 | ReactCurrentOwner$3.current = workInProgress;
|
18540 | var nextChildren;
|
18541 |
|
18542 | if (didCaptureError && typeof Component.getDerivedStateFromError !== 'function') {
|
18543 |
|
18544 |
|
18545 |
|
18546 |
|
18547 |
|
18548 | nextChildren = null;
|
18549 |
|
18550 | if (enableProfilerTimer) {
|
18551 | stopProfilerTimerIfRunning(workInProgress);
|
18552 | }
|
18553 | } else {
|
18554 | {
|
18555 | setCurrentPhase('render');
|
18556 | nextChildren = instance.render();
|
18557 |
|
18558 | if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
18559 | instance.render();
|
18560 | }
|
18561 |
|
18562 | setCurrentPhase(null);
|
18563 | }
|
18564 | }
|
18565 |
|
18566 |
|
18567 | workInProgress.effectTag |= PerformedWork;
|
18568 |
|
18569 | if (current$$1 !== null && didCaptureError) {
|
18570 |
|
18571 |
|
18572 |
|
18573 |
|
18574 | forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
18575 | } else {
|
18576 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
18577 | }
|
18578 |
|
18579 |
|
18580 |
|
18581 | workInProgress.memoizedState = instance.state;
|
18582 |
|
18583 | if (hasContext) {
|
18584 | invalidateContextProvider(workInProgress, Component, true);
|
18585 | }
|
18586 |
|
18587 | return workInProgress.child;
|
18588 | }
|
18589 |
|
18590 | function pushHostRootContext(workInProgress) {
|
18591 | var root = workInProgress.stateNode;
|
18592 |
|
18593 | if (root.pendingContext) {
|
18594 | pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context);
|
18595 | } else if (root.context) {
|
18596 |
|
18597 | pushTopLevelContextObject(workInProgress, root.context, false);
|
18598 | }
|
18599 |
|
18600 | pushHostContainer(workInProgress, root.containerInfo);
|
18601 | }
|
18602 |
|
18603 | function updateHostRoot(current$$1, workInProgress, renderExpirationTime) {
|
18604 | pushHostRootContext(workInProgress);
|
18605 | var updateQueue = workInProgress.updateQueue;
|
18606 |
|
18607 | (function () {
|
18608 | if (!(updateQueue !== null)) {
|
18609 | {
|
18610 | throw ReactError(Error("If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue."));
|
18611 | }
|
18612 | }
|
18613 | })();
|
18614 |
|
18615 | var nextProps = workInProgress.pendingProps;
|
18616 | var prevState = workInProgress.memoizedState;
|
18617 | var prevChildren = prevState !== null ? prevState.element : null;
|
18618 | processUpdateQueue(workInProgress, updateQueue, nextProps, null, renderExpirationTime);
|
18619 | var nextState = workInProgress.memoizedState;
|
18620 |
|
18621 |
|
18622 | var nextChildren = nextState.element;
|
18623 |
|
18624 | if (nextChildren === prevChildren) {
|
18625 |
|
18626 |
|
18627 | resetHydrationState();
|
18628 | return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
18629 | }
|
18630 |
|
18631 | var root = workInProgress.stateNode;
|
18632 |
|
18633 | if (root.hydrate && enterHydrationState(workInProgress)) {
|
18634 |
|
18635 |
|
18636 |
|
18637 |
|
18638 | var child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
|
18639 | workInProgress.child = child;
|
18640 | var node = child;
|
18641 |
|
18642 | while (node) {
|
18643 |
|
18644 |
|
18645 |
|
18646 |
|
18647 |
|
18648 |
|
18649 | node.effectTag = node.effectTag & ~Placement | Hydrating;
|
18650 | node = node.sibling;
|
18651 | }
|
18652 | } else {
|
18653 |
|
18654 |
|
18655 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
18656 | resetHydrationState();
|
18657 | }
|
18658 |
|
18659 | return workInProgress.child;
|
18660 | }
|
18661 |
|
18662 | function updateHostComponent(current$$1, workInProgress, renderExpirationTime) {
|
18663 | pushHostContext(workInProgress);
|
18664 |
|
18665 | if (current$$1 === null) {
|
18666 | tryToClaimNextHydratableInstance(workInProgress);
|
18667 | }
|
18668 |
|
18669 | var type = workInProgress.type;
|
18670 | var nextProps = workInProgress.pendingProps;
|
18671 | var prevProps = current$$1 !== null ? current$$1.memoizedProps : null;
|
18672 | var nextChildren = nextProps.children;
|
18673 | var isDirectTextChild = shouldSetTextContent(type, nextProps);
|
18674 |
|
18675 | if (isDirectTextChild) {
|
18676 |
|
18677 |
|
18678 |
|
18679 |
|
18680 | nextChildren = null;
|
18681 | } else if (prevProps !== null && shouldSetTextContent(type, prevProps)) {
|
18682 |
|
18683 |
|
18684 | workInProgress.effectTag |= ContentReset;
|
18685 | }
|
18686 |
|
18687 | markRef(current$$1, workInProgress);
|
18688 |
|
18689 | if (workInProgress.mode & ConcurrentMode && renderExpirationTime !== Never && shouldDeprioritizeSubtree(type, nextProps)) {
|
18690 | if (enableSchedulerTracing) {
|
18691 | markSpawnedWork(Never);
|
18692 | }
|
18693 |
|
18694 |
|
18695 | workInProgress.expirationTime = workInProgress.childExpirationTime = Never;
|
18696 | return null;
|
18697 | }
|
18698 |
|
18699 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
18700 | return workInProgress.child;
|
18701 | }
|
18702 |
|
18703 | function updateHostText(current$$1, workInProgress) {
|
18704 | if (current$$1 === null) {
|
18705 | tryToClaimNextHydratableInstance(workInProgress);
|
18706 | }
|
18707 |
|
18708 |
|
18709 |
|
18710 | return null;
|
18711 | }
|
18712 |
|
18713 | function mountLazyComponent(_current, workInProgress, elementType, updateExpirationTime, renderExpirationTime) {
|
18714 | if (_current !== null) {
|
18715 |
|
18716 |
|
18717 |
|
18718 |
|
18719 | _current.alternate = null;
|
18720 | workInProgress.alternate = null;
|
18721 |
|
18722 | workInProgress.effectTag |= Placement;
|
18723 | }
|
18724 |
|
18725 | var props = workInProgress.pendingProps;
|
18726 |
|
18727 |
|
18728 | cancelWorkTimer(workInProgress);
|
18729 | var Component = readLazyComponentType(elementType);
|
18730 |
|
18731 | workInProgress.type = Component;
|
18732 | var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component);
|
18733 | startWorkTimer(workInProgress);
|
18734 | var resolvedProps = resolveDefaultProps(Component, props);
|
18735 | var child;
|
18736 |
|
18737 | switch (resolvedTag) {
|
18738 | case FunctionComponent:
|
18739 | {
|
18740 | {
|
18741 | validateFunctionComponentInDev(workInProgress, Component);
|
18742 | workInProgress.type = Component = resolveFunctionForHotReloading(Component);
|
18743 | }
|
18744 |
|
18745 | child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
|
18746 | break;
|
18747 | }
|
18748 |
|
18749 | case ClassComponent:
|
18750 | {
|
18751 | {
|
18752 | workInProgress.type = Component = resolveClassForHotReloading(Component);
|
18753 | }
|
18754 |
|
18755 | child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
|
18756 | break;
|
18757 | }
|
18758 |
|
18759 | case ForwardRef:
|
18760 | {
|
18761 | {
|
18762 | workInProgress.type = Component = resolveForwardRefForHotReloading(Component);
|
18763 | }
|
18764 |
|
18765 | child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderExpirationTime);
|
18766 | break;
|
18767 | }
|
18768 |
|
18769 | case MemoComponent:
|
18770 | {
|
18771 | {
|
18772 | if (workInProgress.type !== workInProgress.elementType) {
|
18773 | var outerPropTypes = Component.propTypes;
|
18774 |
|
18775 | if (outerPropTypes) {
|
18776 | checkPropTypes_1(outerPropTypes, resolvedProps,
|
18777 | 'prop', getComponentName(Component), getCurrentFiberStackInDev);
|
18778 | }
|
18779 | }
|
18780 | }
|
18781 |
|
18782 | child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps),
|
18783 | updateExpirationTime, renderExpirationTime);
|
18784 | break;
|
18785 | }
|
18786 |
|
18787 | default:
|
18788 | {
|
18789 | var hint = '';
|
18790 |
|
18791 | {
|
18792 | if (Component !== null && typeof Component === 'object' && Component.$$typeof === REACT_LAZY_TYPE) {
|
18793 | hint = ' Did you wrap a component in React.lazy() more than once?';
|
18794 | }
|
18795 | }
|
18796 |
|
18797 |
|
18798 |
|
18799 |
|
18800 | (function () {
|
18801 | {
|
18802 | {
|
18803 | throw ReactError(Error("Element type is invalid. Received a promise that resolves to: " + Component + ". Lazy element type must resolve to a class or function." + hint));
|
18804 | }
|
18805 | }
|
18806 | })();
|
18807 | }
|
18808 | }
|
18809 |
|
18810 | return child;
|
18811 | }
|
18812 |
|
18813 | function mountIncompleteClassComponent(_current, workInProgress, Component, nextProps, renderExpirationTime) {
|
18814 | if (_current !== null) {
|
18815 |
|
18816 |
|
18817 |
|
18818 |
|
18819 | _current.alternate = null;
|
18820 | workInProgress.alternate = null;
|
18821 |
|
18822 | workInProgress.effectTag |= Placement;
|
18823 | }
|
18824 |
|
18825 |
|
18826 | workInProgress.tag = ClassComponent;
|
18827 |
|
18828 |
|
18829 |
|
18830 |
|
18831 | var hasContext;
|
18832 |
|
18833 | if (isContextProvider(Component)) {
|
18834 | hasContext = true;
|
18835 | pushContextProvider(workInProgress);
|
18836 | } else {
|
18837 | hasContext = false;
|
18838 | }
|
18839 |
|
18840 | prepareToReadContext(workInProgress, renderExpirationTime);
|
18841 | constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
18842 | mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
18843 | return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
|
18844 | }
|
18845 |
|
18846 | function mountIndeterminateComponent(_current, workInProgress, Component, renderExpirationTime) {
|
18847 | if (_current !== null) {
|
18848 |
|
18849 |
|
18850 |
|
18851 |
|
18852 | _current.alternate = null;
|
18853 | workInProgress.alternate = null;
|
18854 |
|
18855 | workInProgress.effectTag |= Placement;
|
18856 | }
|
18857 |
|
18858 | var props = workInProgress.pendingProps;
|
18859 | var context;
|
18860 |
|
18861 | if (!disableLegacyContext) {
|
18862 | var unmaskedContext = getUnmaskedContext(workInProgress, Component, false);
|
18863 | context = getMaskedContext(workInProgress, unmaskedContext);
|
18864 | }
|
18865 |
|
18866 | prepareToReadContext(workInProgress, renderExpirationTime);
|
18867 | var value;
|
18868 |
|
18869 | {
|
18870 | if (Component.prototype && typeof Component.prototype.render === 'function') {
|
18871 | var componentName = getComponentName(Component) || 'Unknown';
|
18872 |
|
18873 | if (!didWarnAboutBadClass[componentName]) {
|
18874 | 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.', componentName, componentName);
|
18875 | didWarnAboutBadClass[componentName] = true;
|
18876 | }
|
18877 | }
|
18878 |
|
18879 | if (workInProgress.mode & StrictMode) {
|
18880 | ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null);
|
18881 | }
|
18882 |
|
18883 | ReactCurrentOwner$3.current = workInProgress;
|
18884 | value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
|
18885 | }
|
18886 |
|
18887 |
|
18888 | workInProgress.effectTag |= PerformedWork;
|
18889 |
|
18890 | if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
|
18891 | {
|
18892 | var _componentName = getComponentName(Component) || 'Unknown';
|
18893 |
|
18894 | if (!didWarnAboutModulePatternComponent[_componentName]) {
|
18895 | 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.', _componentName, _componentName, _componentName);
|
18896 | didWarnAboutModulePatternComponent[_componentName] = true;
|
18897 | }
|
18898 | }
|
18899 |
|
18900 |
|
18901 | workInProgress.tag = ClassComponent;
|
18902 |
|
18903 | resetHooks();
|
18904 |
|
18905 |
|
18906 |
|
18907 | var hasContext = false;
|
18908 |
|
18909 | if (isContextProvider(Component)) {
|
18910 | hasContext = true;
|
18911 | pushContextProvider(workInProgress);
|
18912 | } else {
|
18913 | hasContext = false;
|
18914 | }
|
18915 |
|
18916 | workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null;
|
18917 | var getDerivedStateFromProps = Component.getDerivedStateFromProps;
|
18918 |
|
18919 | if (typeof getDerivedStateFromProps === 'function') {
|
18920 | applyDerivedStateFromProps(workInProgress, Component, getDerivedStateFromProps, props);
|
18921 | }
|
18922 |
|
18923 | adoptClassInstance(workInProgress, value);
|
18924 | mountClassInstance(workInProgress, Component, props, renderExpirationTime);
|
18925 | return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
|
18926 | } else {
|
18927 |
|
18928 | workInProgress.tag = FunctionComponent;
|
18929 |
|
18930 | {
|
18931 | if (disableLegacyContext && Component.contextTypes) {
|
18932 | warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with React.useContext() instead.', getComponentName(Component) || 'Unknown');
|
18933 | }
|
18934 |
|
18935 | if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
18936 |
|
18937 | if (workInProgress.memoizedState !== null) {
|
18938 | value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
|
18939 | }
|
18940 | }
|
18941 | }
|
18942 |
|
18943 | reconcileChildren(null, workInProgress, value, renderExpirationTime);
|
18944 |
|
18945 | {
|
18946 | validateFunctionComponentInDev(workInProgress, Component);
|
18947 | }
|
18948 |
|
18949 | return workInProgress.child;
|
18950 | }
|
18951 | }
|
18952 |
|
18953 | function validateFunctionComponentInDev(workInProgress, Component) {
|
18954 | if (Component) {
|
18955 | !!Component.childContextTypes ? warningWithoutStack$1(false, '%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component') : void 0;
|
18956 | }
|
18957 |
|
18958 | if (workInProgress.ref !== null) {
|
18959 | var info = '';
|
18960 | var ownerName = getCurrentFiberOwnerNameInDevOrNull();
|
18961 |
|
18962 | if (ownerName) {
|
18963 | info += '\n\nCheck the render method of `' + ownerName + '`.';
|
18964 | }
|
18965 |
|
18966 | var warningKey = ownerName || workInProgress._debugID || '';
|
18967 | var debugSource = workInProgress._debugSource;
|
18968 |
|
18969 | if (debugSource) {
|
18970 | warningKey = debugSource.fileName + ':' + debugSource.lineNumber;
|
18971 | }
|
18972 |
|
18973 | if (!didWarnAboutFunctionRefs[warningKey]) {
|
18974 | didWarnAboutFunctionRefs[warningKey] = true;
|
18975 | warning$1(false, 'Function components cannot be given refs. ' + 'Attempts to access this ref will fail. ' + 'Did you mean to use React.forwardRef()?%s', info);
|
18976 | }
|
18977 | }
|
18978 |
|
18979 | if (warnAboutDefaultPropsOnFunctionComponents && Component.defaultProps !== undefined) {
|
18980 | var componentName = getComponentName(Component) || 'Unknown';
|
18981 |
|
18982 | if (!didWarnAboutDefaultPropsOnFunctionComponent[componentName]) {
|
18983 | warningWithoutStack$1(false, '%s: Support for defaultProps will be removed from function components ' + 'in a future major release. Use JavaScript default parameters instead.', componentName);
|
18984 | didWarnAboutDefaultPropsOnFunctionComponent[componentName] = true;
|
18985 | }
|
18986 | }
|
18987 |
|
18988 | if (typeof Component.getDerivedStateFromProps === 'function') {
|
18989 | var _componentName2 = getComponentName(Component) || 'Unknown';
|
18990 |
|
18991 | if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2]) {
|
18992 | warningWithoutStack$1(false, '%s: Function components do not support getDerivedStateFromProps.', _componentName2);
|
18993 | didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] = true;
|
18994 | }
|
18995 | }
|
18996 |
|
18997 | if (typeof Component.contextType === 'object' && Component.contextType !== null) {
|
18998 | var _componentName3 = getComponentName(Component) || 'Unknown';
|
18999 |
|
19000 | if (!didWarnAboutContextTypeOnFunctionComponent[_componentName3]) {
|
19001 | warningWithoutStack$1(false, '%s: Function components do not support contextType.', _componentName3);
|
19002 | didWarnAboutContextTypeOnFunctionComponent[_componentName3] = true;
|
19003 | }
|
19004 | }
|
19005 | }
|
19006 |
|
19007 | var SUSPENDED_MARKER = {
|
19008 | dehydrated: null,
|
19009 | retryTime: Never
|
19010 | };
|
19011 |
|
19012 | function shouldRemainOnFallback(suspenseContext, current$$1, workInProgress) {
|
19013 |
|
19014 |
|
19015 | return hasSuspenseContext(suspenseContext, ForceSuspenseFallback) && (current$$1 === null || current$$1.memoizedState !== null);
|
19016 | }
|
19017 |
|
19018 | function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
|
19019 | var mode = workInProgress.mode;
|
19020 | var nextProps = workInProgress.pendingProps;
|
19021 |
|
19022 | {
|
19023 | if (shouldSuspend(workInProgress)) {
|
19024 | workInProgress.effectTag |= DidCapture;
|
19025 | }
|
19026 | }
|
19027 |
|
19028 | var suspenseContext = suspenseStackCursor.current;
|
19029 | var nextDidTimeout = false;
|
19030 | var didSuspend = (workInProgress.effectTag & DidCapture) !== NoEffect;
|
19031 |
|
19032 | if (didSuspend || shouldRemainOnFallback(suspenseContext, current$$1, workInProgress)) {
|
19033 |
|
19034 |
|
19035 | nextDidTimeout = true;
|
19036 | workInProgress.effectTag &= ~DidCapture;
|
19037 | } else {
|
19038 |
|
19039 | if (current$$1 === null || current$$1.memoizedState !== null) {
|
19040 |
|
19041 |
|
19042 |
|
19043 |
|
19044 |
|
19045 | if (nextProps.fallback !== undefined && nextProps.unstable_avoidThisFallback !== true) {
|
19046 | suspenseContext = addSubtreeSuspenseContext(suspenseContext, InvisibleParentSuspenseContext);
|
19047 | }
|
19048 | }
|
19049 | }
|
19050 |
|
19051 | suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
|
19052 | pushSuspenseContext(workInProgress, suspenseContext);
|
19053 |
|
19054 | {
|
19055 | if ('maxDuration' in nextProps) {
|
19056 | if (!didWarnAboutMaxDuration) {
|
19057 | didWarnAboutMaxDuration = true;
|
19058 | warning$1(false, 'maxDuration has been removed from React. ' + 'Remove the maxDuration prop.');
|
19059 | }
|
19060 | }
|
19061 | }
|
19062 |
|
19063 |
|
19064 |
|
19065 |
|
19066 |
|
19067 |
|
19068 |
|
19069 |
|
19070 |
|
19071 |
|
19072 |
|
19073 |
|
19074 |
|
19075 |
|
19076 |
|
19077 |
|
19078 |
|
19079 |
|
19080 |
|
19081 |
|
19082 |
|
19083 |
|
19084 | if (current$$1 === null) {
|
19085 | if (enableSuspenseServerRenderer) {
|
19086 |
|
19087 |
|
19088 | if (nextProps.fallback !== undefined) {
|
19089 | tryToClaimNextHydratableInstance(workInProgress);
|
19090 |
|
19091 | var suspenseState = workInProgress.memoizedState;
|
19092 |
|
19093 | if (suspenseState !== null) {
|
19094 | var dehydrated = suspenseState.dehydrated;
|
19095 |
|
19096 | if (dehydrated !== null) {
|
19097 | return mountDehydratedSuspenseComponent(workInProgress, dehydrated, renderExpirationTime);
|
19098 | }
|
19099 | }
|
19100 | }
|
19101 | }
|
19102 |
|
19103 |
|
19104 |
|
19105 | if (nextDidTimeout) {
|
19106 |
|
19107 | var nextFallbackChildren = nextProps.fallback;
|
19108 | var primaryChildFragment = createFiberFromFragment(null, mode, NoWork, null);
|
19109 | primaryChildFragment.return = workInProgress;
|
19110 |
|
19111 | if ((workInProgress.mode & BatchedMode) === NoMode) {
|
19112 |
|
19113 |
|
19114 | var progressedState = workInProgress.memoizedState;
|
19115 | var progressedPrimaryChild = progressedState !== null ? workInProgress.child.child : workInProgress.child;
|
19116 | primaryChildFragment.child = progressedPrimaryChild;
|
19117 | var progressedChild = progressedPrimaryChild;
|
19118 |
|
19119 | while (progressedChild !== null) {
|
19120 | progressedChild.return = primaryChildFragment;
|
19121 | progressedChild = progressedChild.sibling;
|
19122 | }
|
19123 | }
|
19124 |
|
19125 | var fallbackChildFragment = createFiberFromFragment(nextFallbackChildren, mode, renderExpirationTime, null);
|
19126 | fallbackChildFragment.return = workInProgress;
|
19127 | primaryChildFragment.sibling = fallbackChildFragment;
|
19128 |
|
19129 |
|
19130 | workInProgress.memoizedState = SUSPENDED_MARKER;
|
19131 | workInProgress.child = primaryChildFragment;
|
19132 | return fallbackChildFragment;
|
19133 | } else {
|
19134 |
|
19135 | var nextPrimaryChildren = nextProps.children;
|
19136 | workInProgress.memoizedState = null;
|
19137 | return workInProgress.child = mountChildFibers(workInProgress, null, nextPrimaryChildren, renderExpirationTime);
|
19138 | }
|
19139 | } else {
|
19140 |
|
19141 |
|
19142 | var prevState = current$$1.memoizedState;
|
19143 |
|
19144 | if (prevState !== null) {
|
19145 | if (enableSuspenseServerRenderer) {
|
19146 | var _dehydrated = prevState.dehydrated;
|
19147 |
|
19148 | if (_dehydrated !== null) {
|
19149 | if (!didSuspend) {
|
19150 | return updateDehydratedSuspenseComponent(current$$1, workInProgress, _dehydrated, prevState, renderExpirationTime);
|
19151 | } else if (workInProgress.memoizedState !== null) {
|
19152 |
|
19153 |
|
19154 | workInProgress.child = current$$1.child;
|
19155 |
|
19156 |
|
19157 | workInProgress.effectTag |= DidCapture;
|
19158 | return null;
|
19159 | } else {
|
19160 |
|
19161 |
|
19162 |
|
19163 |
|
19164 | var _nextFallbackChildren = nextProps.fallback;
|
19165 |
|
19166 | var _primaryChildFragment = createFiberFromFragment(
|
19167 |
|
19168 | null, mode, NoWork, null);
|
19169 |
|
19170 | _primaryChildFragment.return = workInProgress;
|
19171 |
|
19172 |
|
19173 | _primaryChildFragment.child = null;
|
19174 |
|
19175 | if ((workInProgress.mode & BatchedMode) === NoMode) {
|
19176 |
|
19177 |
|
19178 | var _progressedChild = _primaryChildFragment.child = workInProgress.child;
|
19179 |
|
19180 | while (_progressedChild !== null) {
|
19181 | _progressedChild.return = _primaryChildFragment;
|
19182 | _progressedChild = _progressedChild.sibling;
|
19183 | }
|
19184 | } else {
|
19185 |
|
19186 |
|
19187 | reconcileChildFibers(workInProgress, current$$1.child, null, renderExpirationTime);
|
19188 | }
|
19189 |
|
19190 |
|
19191 |
|
19192 | if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
|
19193 |
|
19194 | var treeBaseDuration = 0;
|
19195 | var hiddenChild = _primaryChildFragment.child;
|
19196 |
|
19197 | while (hiddenChild !== null) {
|
19198 | treeBaseDuration += hiddenChild.treeBaseDuration;
|
19199 | hiddenChild = hiddenChild.sibling;
|
19200 | }
|
19201 |
|
19202 | _primaryChildFragment.treeBaseDuration = treeBaseDuration;
|
19203 | }
|
19204 |
|
19205 |
|
19206 | var _fallbackChildFragment = createFiberFromFragment(_nextFallbackChildren, mode, renderExpirationTime, null);
|
19207 |
|
19208 | _fallbackChildFragment.return = workInProgress;
|
19209 | _primaryChildFragment.sibling = _fallbackChildFragment;
|
19210 | _fallbackChildFragment.effectTag |= Placement;
|
19211 | _primaryChildFragment.childExpirationTime = NoWork;
|
19212 | workInProgress.memoizedState = SUSPENDED_MARKER;
|
19213 | workInProgress.child = _primaryChildFragment;
|
19214 |
|
19215 |
|
19216 | return _fallbackChildFragment;
|
19217 | }
|
19218 | }
|
19219 | }
|
19220 |
|
19221 |
|
19222 |
|
19223 | var currentPrimaryChildFragment = current$$1.child;
|
19224 | var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
|
19225 |
|
19226 | if (nextDidTimeout) {
|
19227 |
|
19228 |
|
19229 | var _nextFallbackChildren2 = nextProps.fallback;
|
19230 |
|
19231 | var _primaryChildFragment2 = createWorkInProgress(currentPrimaryChildFragment, currentPrimaryChildFragment.pendingProps, NoWork);
|
19232 |
|
19233 | _primaryChildFragment2.return = workInProgress;
|
19234 |
|
19235 | if ((workInProgress.mode & BatchedMode) === NoMode) {
|
19236 |
|
19237 |
|
19238 | var _progressedState = workInProgress.memoizedState;
|
19239 |
|
19240 | var _progressedPrimaryChild = _progressedState !== null ? workInProgress.child.child : workInProgress.child;
|
19241 |
|
19242 | if (_progressedPrimaryChild !== currentPrimaryChildFragment.child) {
|
19243 | _primaryChildFragment2.child = _progressedPrimaryChild;
|
19244 | var _progressedChild2 = _progressedPrimaryChild;
|
19245 |
|
19246 | while (_progressedChild2 !== null) {
|
19247 | _progressedChild2.return = _primaryChildFragment2;
|
19248 | _progressedChild2 = _progressedChild2.sibling;
|
19249 | }
|
19250 | }
|
19251 | }
|
19252 |
|
19253 |
|
19254 |
|
19255 | if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
|
19256 |
|
19257 | var _treeBaseDuration = 0;
|
19258 | var _hiddenChild = _primaryChildFragment2.child;
|
19259 |
|
19260 | while (_hiddenChild !== null) {
|
19261 | _treeBaseDuration += _hiddenChild.treeBaseDuration;
|
19262 | _hiddenChild = _hiddenChild.sibling;
|
19263 | }
|
19264 |
|
19265 | _primaryChildFragment2.treeBaseDuration = _treeBaseDuration;
|
19266 | }
|
19267 |
|
19268 |
|
19269 |
|
19270 | var _fallbackChildFragment2 = createWorkInProgress(currentFallbackChildFragment, _nextFallbackChildren2, currentFallbackChildFragment.expirationTime);
|
19271 |
|
19272 | _fallbackChildFragment2.return = workInProgress;
|
19273 | _primaryChildFragment2.sibling = _fallbackChildFragment2;
|
19274 | _primaryChildFragment2.childExpirationTime = NoWork;
|
19275 |
|
19276 |
|
19277 | workInProgress.memoizedState = SUSPENDED_MARKER;
|
19278 | workInProgress.child = _primaryChildFragment2;
|
19279 | return _fallbackChildFragment2;
|
19280 | } else {
|
19281 |
|
19282 |
|
19283 | var _nextPrimaryChildren = nextProps.children;
|
19284 | var currentPrimaryChild = currentPrimaryChildFragment.child;
|
19285 | var primaryChild = reconcileChildFibers(workInProgress, currentPrimaryChild, _nextPrimaryChildren, renderExpirationTime);
|
19286 |
|
19287 |
|
19288 |
|
19289 |
|
19290 |
|
19291 |
|
19292 | workInProgress.memoizedState = null;
|
19293 | return workInProgress.child = primaryChild;
|
19294 | }
|
19295 | } else {
|
19296 |
|
19297 |
|
19298 | var _currentPrimaryChild = current$$1.child;
|
19299 |
|
19300 | if (nextDidTimeout) {
|
19301 |
|
19302 |
|
19303 | var _nextFallbackChildren3 = nextProps.fallback;
|
19304 |
|
19305 | var _primaryChildFragment3 = createFiberFromFragment(
|
19306 |
|
19307 | null, mode, NoWork, null);
|
19308 |
|
19309 | _primaryChildFragment3.return = workInProgress;
|
19310 | _primaryChildFragment3.child = _currentPrimaryChild;
|
19311 |
|
19312 | if (_currentPrimaryChild !== null) {
|
19313 | _currentPrimaryChild.return = _primaryChildFragment3;
|
19314 | }
|
19315 |
|
19316 |
|
19317 |
|
19318 |
|
19319 |
|
19320 | if ((workInProgress.mode & BatchedMode) === NoMode) {
|
19321 |
|
19322 |
|
19323 | var _progressedState2 = workInProgress.memoizedState;
|
19324 |
|
19325 | var _progressedPrimaryChild2 = _progressedState2 !== null ? workInProgress.child.child : workInProgress.child;
|
19326 |
|
19327 | _primaryChildFragment3.child = _progressedPrimaryChild2;
|
19328 | var _progressedChild3 = _progressedPrimaryChild2;
|
19329 |
|
19330 | while (_progressedChild3 !== null) {
|
19331 | _progressedChild3.return = _primaryChildFragment3;
|
19332 | _progressedChild3 = _progressedChild3.sibling;
|
19333 | }
|
19334 | }
|
19335 |
|
19336 |
|
19337 |
|
19338 | if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
|
19339 |
|
19340 | var _treeBaseDuration2 = 0;
|
19341 | var _hiddenChild2 = _primaryChildFragment3.child;
|
19342 |
|
19343 | while (_hiddenChild2 !== null) {
|
19344 | _treeBaseDuration2 += _hiddenChild2.treeBaseDuration;
|
19345 | _hiddenChild2 = _hiddenChild2.sibling;
|
19346 | }
|
19347 |
|
19348 | _primaryChildFragment3.treeBaseDuration = _treeBaseDuration2;
|
19349 | }
|
19350 |
|
19351 |
|
19352 | var _fallbackChildFragment3 = createFiberFromFragment(_nextFallbackChildren3, mode, renderExpirationTime, null);
|
19353 |
|
19354 | _fallbackChildFragment3.return = workInProgress;
|
19355 | _primaryChildFragment3.sibling = _fallbackChildFragment3;
|
19356 | _fallbackChildFragment3.effectTag |= Placement;
|
19357 | _primaryChildFragment3.childExpirationTime = NoWork;
|
19358 |
|
19359 |
|
19360 | workInProgress.memoizedState = SUSPENDED_MARKER;
|
19361 | workInProgress.child = _primaryChildFragment3;
|
19362 | return _fallbackChildFragment3;
|
19363 | } else {
|
19364 |
|
19365 |
|
19366 | workInProgress.memoizedState = null;
|
19367 | var _nextPrimaryChildren2 = nextProps.children;
|
19368 | return workInProgress.child = reconcileChildFibers(workInProgress, _currentPrimaryChild, _nextPrimaryChildren2, renderExpirationTime);
|
19369 | }
|
19370 | }
|
19371 | }
|
19372 | }
|
19373 |
|
19374 | function retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, renderExpirationTime) {
|
19375 |
|
19376 | workInProgress.memoizedState = null;
|
19377 |
|
19378 | var nextProps = workInProgress.pendingProps;
|
19379 | var nextChildren = nextProps.children;
|
19380 |
|
19381 |
|
19382 |
|
19383 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
19384 | return workInProgress.child;
|
19385 | }
|
19386 |
|
19387 | function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, renderExpirationTime) {
|
19388 |
|
19389 |
|
19390 | if ((workInProgress.mode & BatchedMode) === NoMode) {
|
19391 | {
|
19392 | warning$1(false, 'Cannot hydrate Suspense in legacy mode. Switch from ' + 'ReactDOM.hydrate(element, container) to ' + 'ReactDOM.unstable_createSyncRoot(container, { hydrate: true })' + '.render(element) or remove the Suspense components from ' + 'the server rendered components.');
|
19393 | }
|
19394 |
|
19395 | workInProgress.expirationTime = Sync;
|
19396 | } else if (isSuspenseInstanceFallback(suspenseInstance)) {
|
19397 |
|
19398 |
|
19399 |
|
19400 |
|
19401 |
|
19402 |
|
19403 |
|
19404 |
|
19405 |
|
19406 |
|
19407 | var serverDisplayTime = requestCurrentTime();
|
19408 |
|
19409 | var newExpirationTime = computeAsyncExpiration(serverDisplayTime);
|
19410 |
|
19411 | if (enableSchedulerTracing) {
|
19412 | markSpawnedWork(newExpirationTime);
|
19413 | }
|
19414 |
|
19415 | workInProgress.expirationTime = newExpirationTime;
|
19416 | } else {
|
19417 |
|
19418 |
|
19419 | workInProgress.expirationTime = Never;
|
19420 |
|
19421 | if (enableSchedulerTracing) {
|
19422 | markSpawnedWork(Never);
|
19423 | }
|
19424 | }
|
19425 |
|
19426 | return null;
|
19427 | }
|
19428 |
|
19429 | function updateDehydratedSuspenseComponent(current$$1, workInProgress, suspenseInstance, suspenseState, renderExpirationTime) {
|
19430 |
|
19431 |
|
19432 | warnIfHydrating();
|
19433 |
|
19434 | if ((workInProgress.mode & BatchedMode) === NoMode) {
|
19435 | return retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, renderExpirationTime);
|
19436 | }
|
19437 |
|
19438 | if (isSuspenseInstanceFallback(suspenseInstance)) {
|
19439 |
|
19440 |
|
19441 |
|
19442 | return retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, renderExpirationTime);
|
19443 | }
|
19444 |
|
19445 |
|
19446 |
|
19447 | var hasContextChanged$$1 = current$$1.childExpirationTime >= renderExpirationTime;
|
19448 |
|
19449 | if (didReceiveUpdate || hasContextChanged$$1) {
|
19450 |
|
19451 |
|
19452 |
|
19453 | if (renderExpirationTime < Sync) {
|
19454 | if (suspenseState.retryTime <= renderExpirationTime) {
|
19455 |
|
19456 |
|
19457 | var attemptHydrationAtExpirationTime = renderExpirationTime + 1;
|
19458 | suspenseState.retryTime = attemptHydrationAtExpirationTime;
|
19459 | scheduleWork(current$$1, attemptHydrationAtExpirationTime);
|
19460 | } else {
|
19461 |
|
19462 |
|
19463 |
|
19464 |
|
19465 |
|
19466 | }
|
19467 | }
|
19468 |
|
19469 |
|
19470 |
|
19471 |
|
19472 |
|
19473 |
|
19474 | renderDidSuspendDelayIfPossible();
|
19475 | return retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, renderExpirationTime);
|
19476 | } else if (isSuspenseInstancePending(suspenseInstance)) {
|
19477 |
|
19478 |
|
19479 |
|
19480 |
|
19481 |
|
19482 |
|
19483 |
|
19484 |
|
19485 |
|
19486 | workInProgress.effectTag |= DidCapture;
|
19487 |
|
19488 | workInProgress.child = current$$1.child;
|
19489 |
|
19490 | registerSuspenseInstanceRetry(suspenseInstance, retryDehydratedSuspenseBoundary.bind(null, current$$1));
|
19491 | return null;
|
19492 | } else {
|
19493 |
|
19494 | reenterHydrationStateFromDehydratedSuspenseInstance(workInProgress, suspenseInstance);
|
19495 | var nextProps = workInProgress.pendingProps;
|
19496 | var nextChildren = nextProps.children;
|
19497 | var child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
|
19498 | var node = child;
|
19499 |
|
19500 | while (node) {
|
19501 |
|
19502 |
|
19503 |
|
19504 |
|
19505 |
|
19506 |
|
19507 | node.effectTag |= Hydrating;
|
19508 | node = node.sibling;
|
19509 | }
|
19510 |
|
19511 | workInProgress.child = child;
|
19512 | return workInProgress.child;
|
19513 | }
|
19514 | }
|
19515 |
|
19516 | function propagateSuspenseContextChange(workInProgress, firstChild, renderExpirationTime) {
|
19517 |
|
19518 |
|
19519 |
|
19520 | var node = firstChild;
|
19521 |
|
19522 | while (node !== null) {
|
19523 | if (node.tag === SuspenseComponent) {
|
19524 | var state = node.memoizedState;
|
19525 |
|
19526 | if (state !== null) {
|
19527 | if (node.expirationTime < renderExpirationTime) {
|
19528 | node.expirationTime = renderExpirationTime;
|
19529 | }
|
19530 |
|
19531 | var alternate = node.alternate;
|
19532 |
|
19533 | if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
|
19534 | alternate.expirationTime = renderExpirationTime;
|
19535 | }
|
19536 |
|
19537 | scheduleWorkOnParentPath(node.return, renderExpirationTime);
|
19538 | }
|
19539 | } else if (node.child !== null) {
|
19540 | node.child.return = node;
|
19541 | node = node.child;
|
19542 | continue;
|
19543 | }
|
19544 |
|
19545 | if (node === workInProgress) {
|
19546 | return;
|
19547 | }
|
19548 |
|
19549 | while (node.sibling === null) {
|
19550 | if (node.return === null || node.return === workInProgress) {
|
19551 | return;
|
19552 | }
|
19553 |
|
19554 | node = node.return;
|
19555 | }
|
19556 |
|
19557 | node.sibling.return = node.return;
|
19558 | node = node.sibling;
|
19559 | }
|
19560 | }
|
19561 |
|
19562 | function findLastContentRow(firstChild) {
|
19563 |
|
19564 |
|
19565 |
|
19566 |
|
19567 |
|
19568 |
|
19569 |
|
19570 | var row = firstChild;
|
19571 | var lastContentRow = null;
|
19572 |
|
19573 | while (row !== null) {
|
19574 | var currentRow = row.alternate;
|
19575 |
|
19576 | if (currentRow !== null && findFirstSuspended(currentRow) === null) {
|
19577 | lastContentRow = row;
|
19578 | }
|
19579 |
|
19580 | row = row.sibling;
|
19581 | }
|
19582 |
|
19583 | return lastContentRow;
|
19584 | }
|
19585 |
|
19586 | function validateRevealOrder(revealOrder) {
|
19587 | {
|
19588 | if (revealOrder !== undefined && revealOrder !== 'forwards' && revealOrder !== 'backwards' && revealOrder !== 'together' && !didWarnAboutRevealOrder[revealOrder]) {
|
19589 | didWarnAboutRevealOrder[revealOrder] = true;
|
19590 |
|
19591 | if (typeof revealOrder === 'string') {
|
19592 | switch (revealOrder.toLowerCase()) {
|
19593 | case 'together':
|
19594 | case 'forwards':
|
19595 | case 'backwards':
|
19596 | {
|
19597 | warning$1(false, '"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'Use lowercase "%s" instead.', revealOrder, revealOrder.toLowerCase());
|
19598 | break;
|
19599 | }
|
19600 |
|
19601 | case 'forward':
|
19602 | case 'backward':
|
19603 | {
|
19604 | warning$1(false, '"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'React uses the -s suffix in the spelling. Use "%ss" instead.', revealOrder, revealOrder.toLowerCase());
|
19605 | break;
|
19606 | }
|
19607 |
|
19608 | default:
|
19609 | warning$1(false, '"%s" is not a supported revealOrder on <SuspenseList />. ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder);
|
19610 | break;
|
19611 | }
|
19612 | } else {
|
19613 | warning$1(false, '%s is not a supported value for revealOrder on <SuspenseList />. ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder);
|
19614 | }
|
19615 | }
|
19616 | }
|
19617 | }
|
19618 |
|
19619 | function validateTailOptions(tailMode, revealOrder) {
|
19620 | {
|
19621 | if (tailMode !== undefined && !didWarnAboutTailOptions[tailMode]) {
|
19622 | if (tailMode !== 'collapsed' && tailMode !== 'hidden') {
|
19623 | didWarnAboutTailOptions[tailMode] = true;
|
19624 | warning$1(false, '"%s" is not a supported value for tail on <SuspenseList />. ' + 'Did you mean "collapsed" or "hidden"?', tailMode);
|
19625 | } else if (revealOrder !== 'forwards' && revealOrder !== 'backwards') {
|
19626 | didWarnAboutTailOptions[tailMode] = true;
|
19627 | warning$1(false, '<SuspenseList tail="%s" /> is only valid if revealOrder is ' + '"forwards" or "backwards". ' + 'Did you mean to specify revealOrder="forwards"?', tailMode);
|
19628 | }
|
19629 | }
|
19630 | }
|
19631 | }
|
19632 |
|
19633 | function validateSuspenseListNestedChild(childSlot, index) {
|
19634 | {
|
19635 | var isArray = Array.isArray(childSlot);
|
19636 | var isIterable = !isArray && typeof getIteratorFn(childSlot) === 'function';
|
19637 |
|
19638 | if (isArray || isIterable) {
|
19639 | var type = isArray ? 'array' : 'iterable';
|
19640 | warning$1(false, 'A nested %s was passed to row #%s in <SuspenseList />. Wrap it in ' + 'an additional SuspenseList to configure its revealOrder: ' + '<SuspenseList revealOrder=...> ... ' + '<SuspenseList revealOrder=...>{%s}</SuspenseList> ... ' + '</SuspenseList>', type, index, type);
|
19641 | return false;
|
19642 | }
|
19643 | }
|
19644 |
|
19645 | return true;
|
19646 | }
|
19647 |
|
19648 | function validateSuspenseListChildren(children, revealOrder) {
|
19649 | {
|
19650 | if ((revealOrder === 'forwards' || revealOrder === 'backwards') && children !== undefined && children !== null && children !== false) {
|
19651 | if (Array.isArray(children)) {
|
19652 | for (var i = 0; i < children.length; i++) {
|
19653 | if (!validateSuspenseListNestedChild(children[i], i)) {
|
19654 | return;
|
19655 | }
|
19656 | }
|
19657 | } else {
|
19658 | var iteratorFn = getIteratorFn(children);
|
19659 |
|
19660 | if (typeof iteratorFn === 'function') {
|
19661 | var childrenIterator = iteratorFn.call(children);
|
19662 |
|
19663 | if (childrenIterator) {
|
19664 | var step = childrenIterator.next();
|
19665 | var _i = 0;
|
19666 |
|
19667 | for (; !step.done; step = childrenIterator.next()) {
|
19668 | if (!validateSuspenseListNestedChild(step.value, _i)) {
|
19669 | return;
|
19670 | }
|
19671 |
|
19672 | _i++;
|
19673 | }
|
19674 | }
|
19675 | } else {
|
19676 | warning$1(false, 'A single row was passed to a <SuspenseList revealOrder="%s" />. ' + 'This is not useful since it needs multiple rows. ' + 'Did you mean to pass multiple children or an array?', revealOrder);
|
19677 | }
|
19678 | }
|
19679 | }
|
19680 | }
|
19681 | }
|
19682 |
|
19683 | function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode) {
|
19684 | var renderState = workInProgress.memoizedState;
|
19685 |
|
19686 | if (renderState === null) {
|
19687 | workInProgress.memoizedState = {
|
19688 | isBackwards: isBackwards,
|
19689 | rendering: null,
|
19690 | last: lastContentRow,
|
19691 | tail: tail,
|
19692 | tailExpiration: 0,
|
19693 | tailMode: tailMode
|
19694 | };
|
19695 | } else {
|
19696 |
|
19697 | renderState.isBackwards = isBackwards;
|
19698 | renderState.rendering = null;
|
19699 | renderState.last = lastContentRow;
|
19700 | renderState.tail = tail;
|
19701 | renderState.tailExpiration = 0;
|
19702 | renderState.tailMode = tailMode;
|
19703 | }
|
19704 | }
|
19705 |
|
19706 |
|
19707 |
|
19708 |
|
19709 |
|
19710 |
|
19711 |
|
19712 |
|
19713 | function updateSuspenseListComponent(current$$1, workInProgress, renderExpirationTime) {
|
19714 | var nextProps = workInProgress.pendingProps;
|
19715 | var revealOrder = nextProps.revealOrder;
|
19716 | var tailMode = nextProps.tail;
|
19717 | var newChildren = nextProps.children;
|
19718 | validateRevealOrder(revealOrder);
|
19719 | validateTailOptions(tailMode, revealOrder);
|
19720 | validateSuspenseListChildren(newChildren, revealOrder);
|
19721 | reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
|
19722 | var suspenseContext = suspenseStackCursor.current;
|
19723 | var shouldForceFallback = hasSuspenseContext(suspenseContext, ForceSuspenseFallback);
|
19724 |
|
19725 | if (shouldForceFallback) {
|
19726 | suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback);
|
19727 | workInProgress.effectTag |= DidCapture;
|
19728 | } else {
|
19729 | var didSuspendBefore = current$$1 !== null && (current$$1.effectTag & DidCapture) !== NoEffect;
|
19730 |
|
19731 | if (didSuspendBefore) {
|
19732 |
|
19733 |
|
19734 |
|
19735 | propagateSuspenseContextChange(workInProgress, workInProgress.child, renderExpirationTime);
|
19736 | }
|
19737 |
|
19738 | suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
|
19739 | }
|
19740 |
|
19741 | pushSuspenseContext(workInProgress, suspenseContext);
|
19742 |
|
19743 | if ((workInProgress.mode & BatchedMode) === NoMode) {
|
19744 |
|
19745 |
|
19746 | workInProgress.memoizedState = null;
|
19747 | } else {
|
19748 | switch (revealOrder) {
|
19749 | case 'forwards':
|
19750 | {
|
19751 | var lastContentRow = findLastContentRow(workInProgress.child);
|
19752 | var tail;
|
19753 |
|
19754 | if (lastContentRow === null) {
|
19755 |
|
19756 |
|
19757 | tail = workInProgress.child;
|
19758 | workInProgress.child = null;
|
19759 | } else {
|
19760 |
|
19761 |
|
19762 | tail = lastContentRow.sibling;
|
19763 | lastContentRow.sibling = null;
|
19764 | }
|
19765 |
|
19766 | initSuspenseListRenderState(workInProgress, false,
|
19767 | tail, lastContentRow, tailMode);
|
19768 | break;
|
19769 | }
|
19770 |
|
19771 | case 'backwards':
|
19772 | {
|
19773 |
|
19774 |
|
19775 |
|
19776 |
|
19777 | var _tail = null;
|
19778 | var row = workInProgress.child;
|
19779 | workInProgress.child = null;
|
19780 |
|
19781 | while (row !== null) {
|
19782 | var currentRow = row.alternate;
|
19783 |
|
19784 | if (currentRow !== null && findFirstSuspended(currentRow) === null) {
|
19785 |
|
19786 | workInProgress.child = row;
|
19787 | break;
|
19788 | }
|
19789 |
|
19790 | var nextRow = row.sibling;
|
19791 | row.sibling = _tail;
|
19792 | _tail = row;
|
19793 | row = nextRow;
|
19794 | }
|
19795 |
|
19796 |
|
19797 | initSuspenseListRenderState(workInProgress, true,
|
19798 | _tail, null,
|
19799 | tailMode);
|
19800 | break;
|
19801 | }
|
19802 |
|
19803 | case 'together':
|
19804 | {
|
19805 | initSuspenseListRenderState(workInProgress, false,
|
19806 | null,
|
19807 | null,
|
19808 | undefined);
|
19809 | break;
|
19810 | }
|
19811 |
|
19812 | default:
|
19813 | {
|
19814 |
|
19815 |
|
19816 | workInProgress.memoizedState = null;
|
19817 | }
|
19818 | }
|
19819 | }
|
19820 |
|
19821 | return workInProgress.child;
|
19822 | }
|
19823 |
|
19824 | function updatePortalComponent(current$$1, workInProgress, renderExpirationTime) {
|
19825 | pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
|
19826 | var nextChildren = workInProgress.pendingProps;
|
19827 |
|
19828 | if (current$$1 === null) {
|
19829 |
|
19830 |
|
19831 |
|
19832 |
|
19833 |
|
19834 | workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
|
19835 | } else {
|
19836 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
19837 | }
|
19838 |
|
19839 | return workInProgress.child;
|
19840 | }
|
19841 |
|
19842 | function updateContextProvider(current$$1, workInProgress, renderExpirationTime) {
|
19843 | var providerType = workInProgress.type;
|
19844 | var context = providerType._context;
|
19845 | var newProps = workInProgress.pendingProps;
|
19846 | var oldProps = workInProgress.memoizedProps;
|
19847 | var newValue = newProps.value;
|
19848 |
|
19849 | {
|
19850 | var providerPropTypes = workInProgress.type.propTypes;
|
19851 |
|
19852 | if (providerPropTypes) {
|
19853 | checkPropTypes_1(providerPropTypes, newProps, 'prop', 'Context.Provider', getCurrentFiberStackInDev);
|
19854 | }
|
19855 | }
|
19856 |
|
19857 | pushProvider(workInProgress, newValue);
|
19858 |
|
19859 | if (oldProps !== null) {
|
19860 | var oldValue = oldProps.value;
|
19861 | var changedBits = calculateChangedBits(context, newValue, oldValue);
|
19862 |
|
19863 | if (changedBits === 0) {
|
19864 |
|
19865 | if (oldProps.children === newProps.children && !hasContextChanged()) {
|
19866 | return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
19867 | }
|
19868 | } else {
|
19869 |
|
19870 |
|
19871 | propagateContextChange(workInProgress, context, changedBits, renderExpirationTime);
|
19872 | }
|
19873 | }
|
19874 |
|
19875 | var newChildren = newProps.children;
|
19876 | reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
|
19877 | return workInProgress.child;
|
19878 | }
|
19879 |
|
19880 | var hasWarnedAboutUsingContextAsConsumer = false;
|
19881 |
|
19882 | function updateContextConsumer(current$$1, workInProgress, renderExpirationTime) {
|
19883 | var context = workInProgress.type;
|
19884 |
|
19885 |
|
19886 |
|
19887 |
|
19888 |
|
19889 |
|
19890 |
|
19891 | {
|
19892 | if (context._context === undefined) {
|
19893 |
|
19894 |
|
19895 |
|
19896 | if (context !== context.Consumer) {
|
19897 | if (!hasWarnedAboutUsingContextAsConsumer) {
|
19898 | hasWarnedAboutUsingContextAsConsumer = true;
|
19899 | 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?');
|
19900 | }
|
19901 | }
|
19902 | } else {
|
19903 | context = context._context;
|
19904 | }
|
19905 | }
|
19906 |
|
19907 | var newProps = workInProgress.pendingProps;
|
19908 | var render = newProps.children;
|
19909 |
|
19910 | {
|
19911 | !(typeof render === 'function') ? warningWithoutStack$1(false, 'A context consumer was rendered with multiple children, or a child ' + "that isn't a function. A context consumer expects a single child " + 'that is a function. If you did pass a function, make sure there ' + 'is no trailing or leading whitespace around it.') : void 0;
|
19912 | }
|
19913 |
|
19914 | prepareToReadContext(workInProgress, renderExpirationTime);
|
19915 | var newValue = readContext(context, newProps.unstable_observedBits);
|
19916 | var newChildren;
|
19917 |
|
19918 | {
|
19919 | ReactCurrentOwner$3.current = workInProgress;
|
19920 | setCurrentPhase('render');
|
19921 | newChildren = render(newValue);
|
19922 | setCurrentPhase(null);
|
19923 | }
|
19924 |
|
19925 |
|
19926 | workInProgress.effectTag |= PerformedWork;
|
19927 | reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
|
19928 | return workInProgress.child;
|
19929 | }
|
19930 |
|
19931 | function updateFundamentalComponent$1(current$$1, workInProgress, renderExpirationTime) {
|
19932 | var fundamentalImpl = workInProgress.type.impl;
|
19933 |
|
19934 | if (fundamentalImpl.reconcileChildren === false) {
|
19935 | return null;
|
19936 | }
|
19937 |
|
19938 | var nextProps = workInProgress.pendingProps;
|
19939 | var nextChildren = nextProps.children;
|
19940 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
19941 | return workInProgress.child;
|
19942 | }
|
19943 |
|
19944 | function updateScopeComponent(current$$1, workInProgress, renderExpirationTime) {
|
19945 | var nextProps = workInProgress.pendingProps;
|
19946 | var nextChildren = nextProps.children;
|
19947 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
19948 | return workInProgress.child;
|
19949 | }
|
19950 |
|
19951 | function markWorkInProgressReceivedUpdate() {
|
19952 | didReceiveUpdate = true;
|
19953 | }
|
19954 |
|
19955 | function bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime) {
|
19956 | cancelWorkTimer(workInProgress);
|
19957 |
|
19958 | if (current$$1 !== null) {
|
19959 |
|
19960 | workInProgress.dependencies = current$$1.dependencies;
|
19961 | }
|
19962 |
|
19963 | if (enableProfilerTimer) {
|
19964 |
|
19965 | stopProfilerTimerIfRunning(workInProgress);
|
19966 | }
|
19967 |
|
19968 | var updateExpirationTime = workInProgress.expirationTime;
|
19969 |
|
19970 | if (updateExpirationTime !== NoWork) {
|
19971 | markUnprocessedUpdateTime(updateExpirationTime);
|
19972 | }
|
19973 |
|
19974 |
|
19975 | var childExpirationTime = workInProgress.childExpirationTime;
|
19976 |
|
19977 | if (childExpirationTime < renderExpirationTime) {
|
19978 |
|
19979 |
|
19980 |
|
19981 | return null;
|
19982 | } else {
|
19983 |
|
19984 |
|
19985 | cloneChildFibers(current$$1, workInProgress);
|
19986 | return workInProgress.child;
|
19987 | }
|
19988 | }
|
19989 |
|
19990 | function remountFiber(current$$1, oldWorkInProgress, newWorkInProgress) {
|
19991 | {
|
19992 | var returnFiber = oldWorkInProgress.return;
|
19993 |
|
19994 | if (returnFiber === null) {
|
19995 | throw new Error('Cannot swap the root fiber.');
|
19996 | }
|
19997 |
|
19998 |
|
19999 |
|
20000 | current$$1.alternate = null;
|
20001 | oldWorkInProgress.alternate = null;
|
20002 |
|
20003 | newWorkInProgress.index = oldWorkInProgress.index;
|
20004 | newWorkInProgress.sibling = oldWorkInProgress.sibling;
|
20005 | newWorkInProgress.return = oldWorkInProgress.return;
|
20006 | newWorkInProgress.ref = oldWorkInProgress.ref;
|
20007 |
|
20008 | if (oldWorkInProgress === returnFiber.child) {
|
20009 | returnFiber.child = newWorkInProgress;
|
20010 | } else {
|
20011 | var prevSibling = returnFiber.child;
|
20012 |
|
20013 | if (prevSibling === null) {
|
20014 | throw new Error('Expected parent to have a child.');
|
20015 | }
|
20016 |
|
20017 | while (prevSibling.sibling !== oldWorkInProgress) {
|
20018 | prevSibling = prevSibling.sibling;
|
20019 |
|
20020 | if (prevSibling === null) {
|
20021 | throw new Error('Expected to find the previous sibling.');
|
20022 | }
|
20023 | }
|
20024 |
|
20025 | prevSibling.sibling = newWorkInProgress;
|
20026 | }
|
20027 |
|
20028 |
|
20029 |
|
20030 | var last = returnFiber.lastEffect;
|
20031 |
|
20032 | if (last !== null) {
|
20033 | last.nextEffect = current$$1;
|
20034 | returnFiber.lastEffect = current$$1;
|
20035 | } else {
|
20036 | returnFiber.firstEffect = returnFiber.lastEffect = current$$1;
|
20037 | }
|
20038 |
|
20039 | current$$1.nextEffect = null;
|
20040 | current$$1.effectTag = Deletion;
|
20041 | newWorkInProgress.effectTag |= Placement;
|
20042 |
|
20043 | return newWorkInProgress;
|
20044 | }
|
20045 | }
|
20046 |
|
20047 | function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
20048 | var updateExpirationTime = workInProgress.expirationTime;
|
20049 |
|
20050 | {
|
20051 | if (workInProgress._debugNeedsRemount && current$$1 !== null) {
|
20052 |
|
20053 | return remountFiber(current$$1, workInProgress, createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.expirationTime));
|
20054 | }
|
20055 | }
|
20056 |
|
20057 | if (current$$1 !== null) {
|
20058 | var oldProps = current$$1.memoizedProps;
|
20059 | var newProps = workInProgress.pendingProps;
|
20060 |
|
20061 | if (oldProps !== newProps || hasContextChanged() || (
|
20062 | workInProgress.type !== current$$1.type)) {
|
20063 |
|
20064 |
|
20065 | didReceiveUpdate = true;
|
20066 | } else if (updateExpirationTime < renderExpirationTime) {
|
20067 | didReceiveUpdate = false;
|
20068 |
|
20069 |
|
20070 |
|
20071 | switch (workInProgress.tag) {
|
20072 | case HostRoot:
|
20073 | pushHostRootContext(workInProgress);
|
20074 | resetHydrationState();
|
20075 | break;
|
20076 |
|
20077 | case HostComponent:
|
20078 | pushHostContext(workInProgress);
|
20079 |
|
20080 | if (workInProgress.mode & ConcurrentMode && renderExpirationTime !== Never && shouldDeprioritizeSubtree(workInProgress.type, newProps)) {
|
20081 | if (enableSchedulerTracing) {
|
20082 | markSpawnedWork(Never);
|
20083 | }
|
20084 |
|
20085 |
|
20086 | workInProgress.expirationTime = workInProgress.childExpirationTime = Never;
|
20087 | return null;
|
20088 | }
|
20089 |
|
20090 | break;
|
20091 |
|
20092 | case ClassComponent:
|
20093 | {
|
20094 | var Component = workInProgress.type;
|
20095 |
|
20096 | if (isContextProvider(Component)) {
|
20097 | pushContextProvider(workInProgress);
|
20098 | }
|
20099 |
|
20100 | break;
|
20101 | }
|
20102 |
|
20103 | case HostPortal:
|
20104 | pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
|
20105 | break;
|
20106 |
|
20107 | case ContextProvider:
|
20108 | {
|
20109 | var newValue = workInProgress.memoizedProps.value;
|
20110 | pushProvider(workInProgress, newValue);
|
20111 | break;
|
20112 | }
|
20113 |
|
20114 | case Profiler:
|
20115 | if (enableProfilerTimer) {
|
20116 | workInProgress.effectTag |= Update;
|
20117 | }
|
20118 |
|
20119 | break;
|
20120 |
|
20121 | case SuspenseComponent:
|
20122 | {
|
20123 | var state = workInProgress.memoizedState;
|
20124 |
|
20125 | if (state !== null) {
|
20126 | if (enableSuspenseServerRenderer) {
|
20127 | if (state.dehydrated !== null) {
|
20128 | pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
|
20129 |
|
20130 |
|
20131 |
|
20132 | workInProgress.effectTag |= DidCapture;
|
20133 | break;
|
20134 | }
|
20135 | }
|
20136 |
|
20137 |
|
20138 |
|
20139 |
|
20140 |
|
20141 | var primaryChildFragment = workInProgress.child;
|
20142 | var primaryChildExpirationTime = primaryChildFragment.childExpirationTime;
|
20143 |
|
20144 | if (primaryChildExpirationTime !== NoWork && primaryChildExpirationTime >= renderExpirationTime) {
|
20145 |
|
20146 |
|
20147 | return updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
|
20148 | } else {
|
20149 | pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
|
20150 |
|
20151 |
|
20152 | var child = bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
20153 |
|
20154 | if (child !== null) {
|
20155 |
|
20156 |
|
20157 | return child.sibling;
|
20158 | } else {
|
20159 | return null;
|
20160 | }
|
20161 | }
|
20162 | } else {
|
20163 | pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
|
20164 | }
|
20165 |
|
20166 | break;
|
20167 | }
|
20168 |
|
20169 | case SuspenseListComponent:
|
20170 | {
|
20171 | var didSuspendBefore = (current$$1.effectTag & DidCapture) !== NoEffect;
|
20172 | var hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime;
|
20173 |
|
20174 | if (didSuspendBefore) {
|
20175 | if (hasChildWork) {
|
20176 |
|
20177 |
|
20178 |
|
20179 |
|
20180 |
|
20181 | return updateSuspenseListComponent(current$$1, workInProgress, renderExpirationTime);
|
20182 | }
|
20183 |
|
20184 |
|
20185 |
|
20186 |
|
20187 | workInProgress.effectTag |= DidCapture;
|
20188 | }
|
20189 |
|
20190 |
|
20191 |
|
20192 |
|
20193 | var renderState = workInProgress.memoizedState;
|
20194 |
|
20195 | if (renderState !== null) {
|
20196 |
|
20197 |
|
20198 | renderState.rendering = null;
|
20199 | renderState.tail = null;
|
20200 | }
|
20201 |
|
20202 | pushSuspenseContext(workInProgress, suspenseStackCursor.current);
|
20203 |
|
20204 | if (hasChildWork) {
|
20205 | break;
|
20206 | } else {
|
20207 |
|
20208 |
|
20209 |
|
20210 | return null;
|
20211 | }
|
20212 | }
|
20213 | }
|
20214 |
|
20215 | return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
20216 | } else {
|
20217 |
|
20218 |
|
20219 |
|
20220 |
|
20221 | didReceiveUpdate = false;
|
20222 | }
|
20223 | } else {
|
20224 | didReceiveUpdate = false;
|
20225 | }
|
20226 |
|
20227 |
|
20228 | workInProgress.expirationTime = NoWork;
|
20229 |
|
20230 | switch (workInProgress.tag) {
|
20231 | case IndeterminateComponent:
|
20232 | {
|
20233 | return mountIndeterminateComponent(current$$1, workInProgress, workInProgress.type, renderExpirationTime);
|
20234 | }
|
20235 |
|
20236 | case LazyComponent:
|
20237 | {
|
20238 | var elementType = workInProgress.elementType;
|
20239 | return mountLazyComponent(current$$1, workInProgress, elementType, updateExpirationTime, renderExpirationTime);
|
20240 | }
|
20241 |
|
20242 | case FunctionComponent:
|
20243 | {
|
20244 | var _Component = workInProgress.type;
|
20245 | var unresolvedProps = workInProgress.pendingProps;
|
20246 | var resolvedProps = workInProgress.elementType === _Component ? unresolvedProps : resolveDefaultProps(_Component, unresolvedProps);
|
20247 | return updateFunctionComponent(current$$1, workInProgress, _Component, resolvedProps, renderExpirationTime);
|
20248 | }
|
20249 |
|
20250 | case ClassComponent:
|
20251 | {
|
20252 | var _Component2 = workInProgress.type;
|
20253 | var _unresolvedProps = workInProgress.pendingProps;
|
20254 |
|
20255 | var _resolvedProps = workInProgress.elementType === _Component2 ? _unresolvedProps : resolveDefaultProps(_Component2, _unresolvedProps);
|
20256 |
|
20257 | return updateClassComponent(current$$1, workInProgress, _Component2, _resolvedProps, renderExpirationTime);
|
20258 | }
|
20259 |
|
20260 | case HostRoot:
|
20261 | return updateHostRoot(current$$1, workInProgress, renderExpirationTime);
|
20262 |
|
20263 | case HostComponent:
|
20264 | return updateHostComponent(current$$1, workInProgress, renderExpirationTime);
|
20265 |
|
20266 | case HostText:
|
20267 | return updateHostText(current$$1, workInProgress);
|
20268 |
|
20269 | case SuspenseComponent:
|
20270 | return updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
|
20271 |
|
20272 | case HostPortal:
|
20273 | return updatePortalComponent(current$$1, workInProgress, renderExpirationTime);
|
20274 |
|
20275 | case ForwardRef:
|
20276 | {
|
20277 | var type = workInProgress.type;
|
20278 | var _unresolvedProps2 = workInProgress.pendingProps;
|
20279 |
|
20280 | var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
20281 |
|
20282 | return updateForwardRef(current$$1, workInProgress, type, _resolvedProps2, renderExpirationTime);
|
20283 | }
|
20284 |
|
20285 | case Fragment:
|
20286 | return updateFragment(current$$1, workInProgress, renderExpirationTime);
|
20287 |
|
20288 | case Mode:
|
20289 | return updateMode(current$$1, workInProgress, renderExpirationTime);
|
20290 |
|
20291 | case Profiler:
|
20292 | return updateProfiler(current$$1, workInProgress, renderExpirationTime);
|
20293 |
|
20294 | case ContextProvider:
|
20295 | return updateContextProvider(current$$1, workInProgress, renderExpirationTime);
|
20296 |
|
20297 | case ContextConsumer:
|
20298 | return updateContextConsumer(current$$1, workInProgress, renderExpirationTime);
|
20299 |
|
20300 | case MemoComponent:
|
20301 | {
|
20302 | var _type2 = workInProgress.type;
|
20303 | var _unresolvedProps3 = workInProgress.pendingProps;
|
20304 |
|
20305 | var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3);
|
20306 |
|
20307 | {
|
20308 | if (workInProgress.type !== workInProgress.elementType) {
|
20309 | var outerPropTypes = _type2.propTypes;
|
20310 |
|
20311 | if (outerPropTypes) {
|
20312 | checkPropTypes_1(outerPropTypes, _resolvedProps3,
|
20313 | 'prop', getComponentName(_type2), getCurrentFiberStackInDev);
|
20314 | }
|
20315 | }
|
20316 | }
|
20317 |
|
20318 | _resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3);
|
20319 | return updateMemoComponent(current$$1, workInProgress, _type2, _resolvedProps3, updateExpirationTime, renderExpirationTime);
|
20320 | }
|
20321 |
|
20322 | case SimpleMemoComponent:
|
20323 | {
|
20324 | return updateSimpleMemoComponent(current$$1, workInProgress, workInProgress.type, workInProgress.pendingProps, updateExpirationTime, renderExpirationTime);
|
20325 | }
|
20326 |
|
20327 | case IncompleteClassComponent:
|
20328 | {
|
20329 | var _Component3 = workInProgress.type;
|
20330 | var _unresolvedProps4 = workInProgress.pendingProps;
|
20331 |
|
20332 | var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4);
|
20333 |
|
20334 | return mountIncompleteClassComponent(current$$1, workInProgress, _Component3, _resolvedProps4, renderExpirationTime);
|
20335 | }
|
20336 |
|
20337 | case SuspenseListComponent:
|
20338 | {
|
20339 | return updateSuspenseListComponent(current$$1, workInProgress, renderExpirationTime);
|
20340 | }
|
20341 |
|
20342 | case FundamentalComponent:
|
20343 | {
|
20344 | if (enableFundamentalAPI) {
|
20345 | return updateFundamentalComponent$1(current$$1, workInProgress, renderExpirationTime);
|
20346 | }
|
20347 |
|
20348 | break;
|
20349 | }
|
20350 |
|
20351 | case ScopeComponent:
|
20352 | {
|
20353 | if (enableScopeAPI) {
|
20354 | return updateScopeComponent(current$$1, workInProgress, renderExpirationTime);
|
20355 | }
|
20356 |
|
20357 | break;
|
20358 | }
|
20359 | }
|
20360 |
|
20361 | (function () {
|
20362 | {
|
20363 | {
|
20364 | throw ReactError(Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."));
|
20365 | }
|
20366 | }
|
20367 | })();
|
20368 | }
|
20369 |
|
20370 | function createFundamentalStateInstance(currentFiber, props, impl, state) {
|
20371 | return {
|
20372 | currentFiber: currentFiber,
|
20373 | impl: impl,
|
20374 | instance: null,
|
20375 | prevProps: null,
|
20376 | props: props,
|
20377 | state: state
|
20378 | };
|
20379 | }
|
20380 |
|
20381 | function isFiberSuspenseAndTimedOut(fiber) {
|
20382 | return fiber.tag === SuspenseComponent && fiber.memoizedState !== null;
|
20383 | }
|
20384 |
|
20385 | function getSuspenseFallbackChild(fiber) {
|
20386 | return fiber.child.sibling.child;
|
20387 | }
|
20388 |
|
20389 | function collectScopedNodes(node, fn, scopedNodes) {
|
20390 | if (enableScopeAPI) {
|
20391 | if (node.tag === HostComponent) {
|
20392 | var _type = node.type,
|
20393 | memoizedProps = node.memoizedProps;
|
20394 |
|
20395 | if (fn(_type, memoizedProps) === true) {
|
20396 | scopedNodes.push(getPublicInstance(node.stateNode));
|
20397 | }
|
20398 | }
|
20399 |
|
20400 | var child = node.child;
|
20401 |
|
20402 | if (isFiberSuspenseAndTimedOut(node)) {
|
20403 | child = getSuspenseFallbackChild(node);
|
20404 | }
|
20405 |
|
20406 | if (child !== null) {
|
20407 | collectScopedNodesFromChildren(child, fn, scopedNodes);
|
20408 | }
|
20409 | }
|
20410 | }
|
20411 |
|
20412 | function collectScopedNodesFromChildren(startingChild, fn, scopedNodes) {
|
20413 | var child = startingChild;
|
20414 |
|
20415 | while (child !== null) {
|
20416 | collectScopedNodes(child, fn, scopedNodes);
|
20417 | child = child.sibling;
|
20418 | }
|
20419 | }
|
20420 |
|
20421 | function collectNearestScopeMethods(node, scope, childrenScopes) {
|
20422 | if (isValidScopeNode(node, scope)) {
|
20423 | childrenScopes.push(node.stateNode.methods);
|
20424 | } else {
|
20425 | var child = node.child;
|
20426 |
|
20427 | if (isFiberSuspenseAndTimedOut(node)) {
|
20428 | child = getSuspenseFallbackChild(node);
|
20429 | }
|
20430 |
|
20431 | if (child !== null) {
|
20432 | collectNearestChildScopeMethods(child, scope, childrenScopes);
|
20433 | }
|
20434 | }
|
20435 | }
|
20436 |
|
20437 | function collectNearestChildScopeMethods(startingChild, scope, childrenScopes) {
|
20438 | var child = startingChild;
|
20439 |
|
20440 | while (child !== null) {
|
20441 | collectNearestScopeMethods(child, scope, childrenScopes);
|
20442 | child = child.sibling;
|
20443 | }
|
20444 | }
|
20445 |
|
20446 | function isValidScopeNode(node, scope) {
|
20447 | return node.tag === ScopeComponent && node.type === scope;
|
20448 | }
|
20449 |
|
20450 | function createScopeMethods(scope, instance) {
|
20451 | var fn = scope.fn;
|
20452 | return {
|
20453 | getChildren: function () {
|
20454 | var currentFiber = instance.fiber;
|
20455 | var child = currentFiber.child;
|
20456 | var childrenScopes = [];
|
20457 |
|
20458 | if (child !== null) {
|
20459 | collectNearestChildScopeMethods(child, scope, childrenScopes);
|
20460 | }
|
20461 |
|
20462 | return childrenScopes.length === 0 ? null : childrenScopes;
|
20463 | },
|
20464 | getChildrenFromRoot: function () {
|
20465 | var currentFiber = instance.fiber;
|
20466 | var node = currentFiber;
|
20467 |
|
20468 | while (node !== null) {
|
20469 | var parent = node.return;
|
20470 |
|
20471 | if (parent === null) {
|
20472 | break;
|
20473 | }
|
20474 |
|
20475 | node = parent;
|
20476 |
|
20477 | if (node.tag === ScopeComponent && node.type === scope) {
|
20478 | break;
|
20479 | }
|
20480 | }
|
20481 |
|
20482 | var childrenScopes = [];
|
20483 | collectNearestChildScopeMethods(node.child, scope, childrenScopes);
|
20484 | return childrenScopes.length === 0 ? null : childrenScopes;
|
20485 | },
|
20486 | getParent: function () {
|
20487 | var node = instance.fiber.return;
|
20488 |
|
20489 | while (node !== null) {
|
20490 | if (node.tag === ScopeComponent && node.type === scope) {
|
20491 | return node.stateNode.methods;
|
20492 | }
|
20493 |
|
20494 | node = node.return;
|
20495 | }
|
20496 |
|
20497 | return null;
|
20498 | },
|
20499 | getProps: function () {
|
20500 | var currentFiber = instance.fiber;
|
20501 | return currentFiber.memoizedProps;
|
20502 | },
|
20503 | getScopedNodes: function () {
|
20504 | var currentFiber = instance.fiber;
|
20505 | var child = currentFiber.child;
|
20506 | var scopedNodes = [];
|
20507 |
|
20508 | if (child !== null) {
|
20509 | collectScopedNodesFromChildren(child, fn, scopedNodes);
|
20510 | }
|
20511 |
|
20512 | return scopedNodes.length === 0 ? null : scopedNodes;
|
20513 | }
|
20514 | };
|
20515 | }
|
20516 |
|
20517 | function markUpdate(workInProgress) {
|
20518 |
|
20519 |
|
20520 | workInProgress.effectTag |= Update;
|
20521 | }
|
20522 |
|
20523 | function markRef$1(workInProgress) {
|
20524 | workInProgress.effectTag |= Ref;
|
20525 | }
|
20526 |
|
20527 | var appendAllChildren;
|
20528 | var updateHostContainer;
|
20529 | var updateHostComponent$1;
|
20530 | var updateHostText$1;
|
20531 |
|
20532 | if (supportsMutation) {
|
20533 |
|
20534 | appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
|
20535 |
|
20536 |
|
20537 | var node = workInProgress.child;
|
20538 |
|
20539 | while (node !== null) {
|
20540 | if (node.tag === HostComponent || node.tag === HostText) {
|
20541 | appendInitialChild(parent, node.stateNode);
|
20542 | } else if (enableFundamentalAPI && node.tag === FundamentalComponent) {
|
20543 | appendInitialChild(parent, node.stateNode.instance);
|
20544 | } else if (node.tag === HostPortal) {
|
20545 |
|
20546 |
|
20547 | } else if (node.child !== null) {
|
20548 | node.child.return = node;
|
20549 | node = node.child;
|
20550 | continue;
|
20551 | }
|
20552 |
|
20553 | if (node === workInProgress) {
|
20554 | return;
|
20555 | }
|
20556 |
|
20557 | while (node.sibling === null) {
|
20558 | if (node.return === null || node.return === workInProgress) {
|
20559 | return;
|
20560 | }
|
20561 |
|
20562 | node = node.return;
|
20563 | }
|
20564 |
|
20565 | node.sibling.return = node.return;
|
20566 | node = node.sibling;
|
20567 | }
|
20568 | };
|
20569 |
|
20570 | updateHostContainer = function (workInProgress) {
|
20571 | };
|
20572 |
|
20573 | updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) {
|
20574 |
|
20575 |
|
20576 | var oldProps = current.memoizedProps;
|
20577 |
|
20578 | if (oldProps === newProps) {
|
20579 |
|
20580 |
|
20581 | return;
|
20582 | }
|
20583 |
|
20584 |
|
20585 |
|
20586 |
|
20587 |
|
20588 | var instance = workInProgress.stateNode;
|
20589 | var currentHostContext = getHostContext();
|
20590 |
|
20591 |
|
20592 |
|
20593 | var updatePayload = prepareUpdate(instance, type, oldProps, newProps, rootContainerInstance, currentHostContext);
|
20594 |
|
20595 | workInProgress.updateQueue = updatePayload;
|
20596 |
|
20597 |
|
20598 | if (updatePayload) {
|
20599 | markUpdate(workInProgress);
|
20600 | }
|
20601 | };
|
20602 |
|
20603 | updateHostText$1 = function (current, workInProgress, oldText, newText) {
|
20604 |
|
20605 | if (oldText !== newText) {
|
20606 | markUpdate(workInProgress);
|
20607 | }
|
20608 | };
|
20609 | } else if (supportsPersistence) {
|
20610 |
|
20611 | appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
|
20612 |
|
20613 |
|
20614 | var node = workInProgress.child;
|
20615 |
|
20616 | while (node !== null) {
|
20617 |
|
20618 | branches: if (node.tag === HostComponent) {
|
20619 | var instance = node.stateNode;
|
20620 |
|
20621 | if (needsVisibilityToggle && isHidden) {
|
20622 |
|
20623 | var props = node.memoizedProps;
|
20624 | var type = node.type;
|
20625 | instance = cloneHiddenInstance(instance, type, props, node);
|
20626 | }
|
20627 |
|
20628 | appendInitialChild(parent, instance);
|
20629 | } else if (node.tag === HostText) {
|
20630 | var _instance = node.stateNode;
|
20631 |
|
20632 | if (needsVisibilityToggle && isHidden) {
|
20633 |
|
20634 | var text = node.memoizedProps;
|
20635 | _instance = cloneHiddenTextInstance(_instance, text, node);
|
20636 | }
|
20637 |
|
20638 | appendInitialChild(parent, _instance);
|
20639 | } else if (enableFundamentalAPI && node.tag === FundamentalComponent) {
|
20640 | var _instance2 = node.stateNode.instance;
|
20641 |
|
20642 | if (needsVisibilityToggle && isHidden) {
|
20643 |
|
20644 | var _props = node.memoizedProps;
|
20645 | var _type = node.type;
|
20646 | _instance2 = cloneHiddenInstance(_instance2, _type, _props, node);
|
20647 | }
|
20648 |
|
20649 | appendInitialChild(parent, _instance2);
|
20650 | } else if (node.tag === HostPortal) {
|
20651 |
|
20652 |
|
20653 | } else if (node.tag === SuspenseComponent) {
|
20654 | if ((node.effectTag & Update) !== NoEffect) {
|
20655 |
|
20656 | var newIsHidden = node.memoizedState !== null;
|
20657 |
|
20658 | if (newIsHidden) {
|
20659 | var primaryChildParent = node.child;
|
20660 |
|
20661 | if (primaryChildParent !== null) {
|
20662 | if (primaryChildParent.child !== null) {
|
20663 | primaryChildParent.child.return = primaryChildParent;
|
20664 | appendAllChildren(parent, primaryChildParent, true, newIsHidden);
|
20665 | }
|
20666 |
|
20667 | var fallbackChildParent = primaryChildParent.sibling;
|
20668 |
|
20669 | if (fallbackChildParent !== null) {
|
20670 | fallbackChildParent.return = node;
|
20671 | node = fallbackChildParent;
|
20672 | continue;
|
20673 | }
|
20674 | }
|
20675 | }
|
20676 | }
|
20677 |
|
20678 | if (node.child !== null) {
|
20679 |
|
20680 | node.child.return = node;
|
20681 | node = node.child;
|
20682 | continue;
|
20683 | }
|
20684 | } else if (node.child !== null) {
|
20685 | node.child.return = node;
|
20686 | node = node.child;
|
20687 | continue;
|
20688 | }
|
20689 |
|
20690 |
|
20691 | node = node;
|
20692 |
|
20693 | if (node === workInProgress) {
|
20694 | return;
|
20695 | }
|
20696 |
|
20697 | while (node.sibling === null) {
|
20698 | if (node.return === null || node.return === workInProgress) {
|
20699 | return;
|
20700 | }
|
20701 |
|
20702 | node = node.return;
|
20703 | }
|
20704 |
|
20705 | node.sibling.return = node.return;
|
20706 | node = node.sibling;
|
20707 | }
|
20708 | };
|
20709 |
|
20710 |
|
20711 | var appendAllChildrenToContainer = function (containerChildSet, workInProgress, needsVisibilityToggle, isHidden) {
|
20712 |
|
20713 |
|
20714 | var node = workInProgress.child;
|
20715 |
|
20716 | while (node !== null) {
|
20717 |
|
20718 | branches: if (node.tag === HostComponent) {
|
20719 | var instance = node.stateNode;
|
20720 |
|
20721 | if (needsVisibilityToggle && isHidden) {
|
20722 |
|
20723 | var props = node.memoizedProps;
|
20724 | var type = node.type;
|
20725 | instance = cloneHiddenInstance(instance, type, props, node);
|
20726 | }
|
20727 |
|
20728 | appendChildToContainerChildSet(containerChildSet, instance);
|
20729 | } else if (node.tag === HostText) {
|
20730 | var _instance3 = node.stateNode;
|
20731 |
|
20732 | if (needsVisibilityToggle && isHidden) {
|
20733 |
|
20734 | var text = node.memoizedProps;
|
20735 | _instance3 = cloneHiddenTextInstance(_instance3, text, node);
|
20736 | }
|
20737 |
|
20738 | appendChildToContainerChildSet(containerChildSet, _instance3);
|
20739 | } else if (enableFundamentalAPI && node.tag === FundamentalComponent) {
|
20740 | var _instance4 = node.stateNode.instance;
|
20741 |
|
20742 | if (needsVisibilityToggle && isHidden) {
|
20743 |
|
20744 | var _props2 = node.memoizedProps;
|
20745 | var _type2 = node.type;
|
20746 | _instance4 = cloneHiddenInstance(_instance4, _type2, _props2, node);
|
20747 | }
|
20748 |
|
20749 | appendChildToContainerChildSet(containerChildSet, _instance4);
|
20750 | } else if (node.tag === HostPortal) {
|
20751 |
|
20752 |
|
20753 | } else if (node.tag === SuspenseComponent) {
|
20754 | if ((node.effectTag & Update) !== NoEffect) {
|
20755 |
|
20756 | var newIsHidden = node.memoizedState !== null;
|
20757 |
|
20758 | if (newIsHidden) {
|
20759 | var primaryChildParent = node.child;
|
20760 |
|
20761 | if (primaryChildParent !== null) {
|
20762 | if (primaryChildParent.child !== null) {
|
20763 | primaryChildParent.child.return = primaryChildParent;
|
20764 | appendAllChildrenToContainer(containerChildSet, primaryChildParent, true, newIsHidden);
|
20765 | }
|
20766 |
|
20767 | var fallbackChildParent = primaryChildParent.sibling;
|
20768 |
|
20769 | if (fallbackChildParent !== null) {
|
20770 | fallbackChildParent.return = node;
|
20771 | node = fallbackChildParent;
|
20772 | continue;
|
20773 | }
|
20774 | }
|
20775 | }
|
20776 | }
|
20777 |
|
20778 | if (node.child !== null) {
|
20779 |
|
20780 | node.child.return = node;
|
20781 | node = node.child;
|
20782 | continue;
|
20783 | }
|
20784 | } else if (node.child !== null) {
|
20785 | node.child.return = node;
|
20786 | node = node.child;
|
20787 | continue;
|
20788 | }
|
20789 |
|
20790 |
|
20791 | node = node;
|
20792 |
|
20793 | if (node === workInProgress) {
|
20794 | return;
|
20795 | }
|
20796 |
|
20797 | while (node.sibling === null) {
|
20798 | if (node.return === null || node.return === workInProgress) {
|
20799 | return;
|
20800 | }
|
20801 |
|
20802 | node = node.return;
|
20803 | }
|
20804 |
|
20805 | node.sibling.return = node.return;
|
20806 | node = node.sibling;
|
20807 | }
|
20808 | };
|
20809 |
|
20810 | updateHostContainer = function (workInProgress) {
|
20811 | var portalOrRoot = workInProgress.stateNode;
|
20812 | var childrenUnchanged = workInProgress.firstEffect === null;
|
20813 |
|
20814 | if (childrenUnchanged) {
|
20815 | } else {
|
20816 | var container = portalOrRoot.containerInfo;
|
20817 | var newChildSet = createContainerChildSet(container);
|
20818 |
|
20819 | appendAllChildrenToContainer(newChildSet, workInProgress, false, false);
|
20820 | portalOrRoot.pendingChildren = newChildSet;
|
20821 |
|
20822 | markUpdate(workInProgress);
|
20823 | finalizeContainerChildren(container, newChildSet);
|
20824 | }
|
20825 | };
|
20826 |
|
20827 | updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) {
|
20828 | var currentInstance = current.stateNode;
|
20829 | var oldProps = current.memoizedProps;
|
20830 |
|
20831 |
|
20832 | var childrenUnchanged = workInProgress.firstEffect === null;
|
20833 |
|
20834 | if (childrenUnchanged && oldProps === newProps) {
|
20835 |
|
20836 |
|
20837 | workInProgress.stateNode = currentInstance;
|
20838 | return;
|
20839 | }
|
20840 |
|
20841 | var recyclableInstance = workInProgress.stateNode;
|
20842 | var currentHostContext = getHostContext();
|
20843 | var updatePayload = null;
|
20844 |
|
20845 | if (oldProps !== newProps) {
|
20846 | updatePayload = prepareUpdate(recyclableInstance, type, oldProps, newProps, rootContainerInstance, currentHostContext);
|
20847 | }
|
20848 |
|
20849 | if (childrenUnchanged && updatePayload === null) {
|
20850 |
|
20851 |
|
20852 | workInProgress.stateNode = currentInstance;
|
20853 | return;
|
20854 | }
|
20855 |
|
20856 | var newInstance = cloneInstance(currentInstance, updatePayload, type, oldProps, newProps, workInProgress, childrenUnchanged, recyclableInstance);
|
20857 |
|
20858 | if (finalizeInitialChildren(newInstance, type, newProps, rootContainerInstance, currentHostContext)) {
|
20859 | markUpdate(workInProgress);
|
20860 | }
|
20861 |
|
20862 | workInProgress.stateNode = newInstance;
|
20863 |
|
20864 | if (childrenUnchanged) {
|
20865 |
|
20866 |
|
20867 |
|
20868 | markUpdate(workInProgress);
|
20869 | } else {
|
20870 |
|
20871 | appendAllChildren(newInstance, workInProgress, false, false);
|
20872 | }
|
20873 | };
|
20874 |
|
20875 | updateHostText$1 = function (current, workInProgress, oldText, newText) {
|
20876 | if (oldText !== newText) {
|
20877 |
|
20878 | var rootContainerInstance = getRootHostContainer();
|
20879 | var currentHostContext = getHostContext();
|
20880 | workInProgress.stateNode = createTextInstance(newText, rootContainerInstance, currentHostContext, workInProgress);
|
20881 |
|
20882 |
|
20883 | markUpdate(workInProgress);
|
20884 | }
|
20885 | };
|
20886 | } else {
|
20887 |
|
20888 | updateHostContainer = function (workInProgress) {
|
20889 | };
|
20890 |
|
20891 | updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) {
|
20892 | };
|
20893 |
|
20894 | updateHostText$1 = function (current, workInProgress, oldText, newText) {
|
20895 | };
|
20896 | }
|
20897 |
|
20898 | function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) {
|
20899 | switch (renderState.tailMode) {
|
20900 | case 'hidden':
|
20901 | {
|
20902 |
|
20903 |
|
20904 |
|
20905 |
|
20906 |
|
20907 | var tailNode = renderState.tail;
|
20908 | var lastTailNode = null;
|
20909 |
|
20910 | while (tailNode !== null) {
|
20911 | if (tailNode.alternate !== null) {
|
20912 | lastTailNode = tailNode;
|
20913 | }
|
20914 |
|
20915 | tailNode = tailNode.sibling;
|
20916 | }
|
20917 |
|
20918 |
|
20919 |
|
20920 | if (lastTailNode === null) {
|
20921 |
|
20922 | renderState.tail = null;
|
20923 | } else {
|
20924 |
|
20925 |
|
20926 | lastTailNode.sibling = null;
|
20927 | }
|
20928 |
|
20929 | break;
|
20930 | }
|
20931 |
|
20932 | case 'collapsed':
|
20933 | {
|
20934 |
|
20935 |
|
20936 |
|
20937 |
|
20938 |
|
20939 | var _tailNode = renderState.tail;
|
20940 | var _lastTailNode = null;
|
20941 |
|
20942 | while (_tailNode !== null) {
|
20943 | if (_tailNode.alternate !== null) {
|
20944 | _lastTailNode = _tailNode;
|
20945 | }
|
20946 |
|
20947 | _tailNode = _tailNode.sibling;
|
20948 | }
|
20949 |
|
20950 |
|
20951 |
|
20952 | if (_lastTailNode === null) {
|
20953 |
|
20954 | if (!hasRenderedATailFallback && renderState.tail !== null) {
|
20955 |
|
20956 |
|
20957 | renderState.tail.sibling = null;
|
20958 | } else {
|
20959 | renderState.tail = null;
|
20960 | }
|
20961 | } else {
|
20962 |
|
20963 |
|
20964 | _lastTailNode.sibling = null;
|
20965 | }
|
20966 |
|
20967 | break;
|
20968 | }
|
20969 | }
|
20970 | }
|
20971 |
|
20972 | function completeWork(current, workInProgress, renderExpirationTime) {
|
20973 | var newProps = workInProgress.pendingProps;
|
20974 |
|
20975 | switch (workInProgress.tag) {
|
20976 | case IndeterminateComponent:
|
20977 | break;
|
20978 |
|
20979 | case LazyComponent:
|
20980 | break;
|
20981 |
|
20982 | case SimpleMemoComponent:
|
20983 | case FunctionComponent:
|
20984 | break;
|
20985 |
|
20986 | case ClassComponent:
|
20987 | {
|
20988 | var Component = workInProgress.type;
|
20989 |
|
20990 | if (isContextProvider(Component)) {
|
20991 | popContext(workInProgress);
|
20992 | }
|
20993 |
|
20994 | break;
|
20995 | }
|
20996 |
|
20997 | case HostRoot:
|
20998 | {
|
20999 | popHostContainer(workInProgress);
|
21000 | popTopLevelContextObject(workInProgress);
|
21001 | var fiberRoot = workInProgress.stateNode;
|
21002 |
|
21003 | if (fiberRoot.pendingContext) {
|
21004 | fiberRoot.context = fiberRoot.pendingContext;
|
21005 | fiberRoot.pendingContext = null;
|
21006 | }
|
21007 |
|
21008 | if (current === null || current.child === null) {
|
21009 |
|
21010 |
|
21011 | var wasHydrated = popHydrationState(workInProgress);
|
21012 |
|
21013 | if (wasHydrated) {
|
21014 |
|
21015 |
|
21016 | markUpdate(workInProgress);
|
21017 | }
|
21018 | }
|
21019 |
|
21020 | updateHostContainer(workInProgress);
|
21021 | break;
|
21022 | }
|
21023 |
|
21024 | case HostComponent:
|
21025 | {
|
21026 | popHostContext(workInProgress);
|
21027 | var rootContainerInstance = getRootHostContainer();
|
21028 | var type = workInProgress.type;
|
21029 |
|
21030 | if (current !== null && workInProgress.stateNode != null) {
|
21031 | updateHostComponent$1(current, workInProgress, type, newProps, rootContainerInstance);
|
21032 |
|
21033 | if (enableFlareAPI) {
|
21034 | var prevListeners = current.memoizedProps.listeners;
|
21035 | var nextListeners = newProps.listeners;
|
21036 |
|
21037 | if (prevListeners !== nextListeners) {
|
21038 | markUpdate(workInProgress);
|
21039 | }
|
21040 | }
|
21041 |
|
21042 | if (current.ref !== workInProgress.ref) {
|
21043 | markRef$1(workInProgress);
|
21044 | }
|
21045 | } else {
|
21046 | if (!newProps) {
|
21047 | (function () {
|
21048 | if (!(workInProgress.stateNode !== null)) {
|
21049 | {
|
21050 | throw ReactError(Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue."));
|
21051 | }
|
21052 | }
|
21053 | })();
|
21054 |
|
21055 |
|
21056 | break;
|
21057 | }
|
21058 |
|
21059 | var currentHostContext = getHostContext();
|
21060 |
|
21061 |
|
21062 |
|
21063 |
|
21064 | var _wasHydrated = popHydrationState(workInProgress);
|
21065 |
|
21066 | if (_wasHydrated) {
|
21067 |
|
21068 |
|
21069 | if (prepareToHydrateHostInstance(workInProgress, rootContainerInstance, currentHostContext)) {
|
21070 |
|
21071 |
|
21072 | markUpdate(workInProgress);
|
21073 | }
|
21074 |
|
21075 | if (enableFlareAPI) {
|
21076 | var listeners = newProps.listeners;
|
21077 |
|
21078 | if (listeners != null) {
|
21079 | updateEventListeners(listeners, workInProgress, rootContainerInstance);
|
21080 | }
|
21081 | }
|
21082 | } else {
|
21083 | var instance = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress);
|
21084 | appendAllChildren(instance, workInProgress, false, false);
|
21085 |
|
21086 | workInProgress.stateNode = instance;
|
21087 |
|
21088 | if (enableFlareAPI) {
|
21089 | var _listeners = newProps.listeners;
|
21090 |
|
21091 | if (_listeners != null) {
|
21092 | updateEventListeners(_listeners, workInProgress, rootContainerInstance);
|
21093 | }
|
21094 | }
|
21095 |
|
21096 |
|
21097 |
|
21098 |
|
21099 | if (finalizeInitialChildren(instance, type, newProps, rootContainerInstance, currentHostContext)) {
|
21100 | markUpdate(workInProgress);
|
21101 | }
|
21102 | }
|
21103 |
|
21104 | if (workInProgress.ref !== null) {
|
21105 |
|
21106 | markRef$1(workInProgress);
|
21107 | }
|
21108 | }
|
21109 |
|
21110 | break;
|
21111 | }
|
21112 |
|
21113 | case HostText:
|
21114 | {
|
21115 | var newText = newProps;
|
21116 |
|
21117 | if (current && workInProgress.stateNode != null) {
|
21118 | var oldText = current.memoizedProps;
|
21119 |
|
21120 |
|
21121 | updateHostText$1(current, workInProgress, oldText, newText);
|
21122 | } else {
|
21123 | if (typeof newText !== 'string') {
|
21124 | (function () {
|
21125 | if (!(workInProgress.stateNode !== null)) {
|
21126 | {
|
21127 | throw ReactError(Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue."));
|
21128 | }
|
21129 | }
|
21130 | })();
|
21131 |
|
21132 | }
|
21133 |
|
21134 | var _rootContainerInstance = getRootHostContainer();
|
21135 |
|
21136 | var _currentHostContext = getHostContext();
|
21137 |
|
21138 | var _wasHydrated2 = popHydrationState(workInProgress);
|
21139 |
|
21140 | if (_wasHydrated2) {
|
21141 | if (prepareToHydrateHostTextInstance(workInProgress)) {
|
21142 | markUpdate(workInProgress);
|
21143 | }
|
21144 | } else {
|
21145 | workInProgress.stateNode = createTextInstance(newText, _rootContainerInstance, _currentHostContext, workInProgress);
|
21146 | }
|
21147 | }
|
21148 |
|
21149 | break;
|
21150 | }
|
21151 |
|
21152 | case ForwardRef:
|
21153 | break;
|
21154 |
|
21155 | case SuspenseComponent:
|
21156 | {
|
21157 | popSuspenseContext(workInProgress);
|
21158 | var nextState = workInProgress.memoizedState;
|
21159 |
|
21160 | if (enableSuspenseServerRenderer) {
|
21161 | if (nextState !== null && nextState.dehydrated !== null) {
|
21162 | if (current === null) {
|
21163 | var _wasHydrated3 = popHydrationState(workInProgress);
|
21164 |
|
21165 | (function () {
|
21166 | if (!_wasHydrated3) {
|
21167 | {
|
21168 | throw ReactError(Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React."));
|
21169 | }
|
21170 | }
|
21171 | })();
|
21172 |
|
21173 | prepareToHydrateHostSuspenseInstance(workInProgress);
|
21174 |
|
21175 | if (enableSchedulerTracing) {
|
21176 | markSpawnedWork(Never);
|
21177 | }
|
21178 |
|
21179 | return null;
|
21180 | } else {
|
21181 |
|
21182 |
|
21183 |
|
21184 |
|
21185 | resetHydrationState();
|
21186 |
|
21187 | if ((workInProgress.effectTag & DidCapture) === NoEffect) {
|
21188 |
|
21189 | workInProgress.memoizedState = null;
|
21190 | }
|
21191 |
|
21192 |
|
21193 |
|
21194 |
|
21195 |
|
21196 |
|
21197 | workInProgress.effectTag |= Update;
|
21198 | return null;
|
21199 | }
|
21200 | }
|
21201 | }
|
21202 |
|
21203 | if ((workInProgress.effectTag & DidCapture) !== NoEffect) {
|
21204 |
|
21205 | workInProgress.expirationTime = renderExpirationTime;
|
21206 |
|
21207 | return workInProgress;
|
21208 | }
|
21209 |
|
21210 | var nextDidTimeout = nextState !== null;
|
21211 | var prevDidTimeout = false;
|
21212 |
|
21213 | if (current === null) {
|
21214 |
|
21215 |
|
21216 |
|
21217 | popHydrationState(workInProgress);
|
21218 | } else {
|
21219 | var prevState = current.memoizedState;
|
21220 | prevDidTimeout = prevState !== null;
|
21221 |
|
21222 | if (!nextDidTimeout && prevState !== null) {
|
21223 |
|
21224 |
|
21225 |
|
21226 |
|
21227 | var currentFallbackChild = current.child.sibling;
|
21228 |
|
21229 | if (currentFallbackChild !== null) {
|
21230 |
|
21231 | var first = workInProgress.firstEffect;
|
21232 |
|
21233 | if (first !== null) {
|
21234 | workInProgress.firstEffect = currentFallbackChild;
|
21235 | currentFallbackChild.nextEffect = first;
|
21236 | } else {
|
21237 | workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChild;
|
21238 | currentFallbackChild.nextEffect = null;
|
21239 | }
|
21240 |
|
21241 | currentFallbackChild.effectTag = Deletion;
|
21242 | }
|
21243 | }
|
21244 | }
|
21245 |
|
21246 | if (nextDidTimeout && !prevDidTimeout) {
|
21247 |
|
21248 |
|
21249 |
|
21250 |
|
21251 |
|
21252 | if ((workInProgress.mode & BatchedMode) !== NoMode) {
|
21253 |
|
21254 |
|
21255 |
|
21256 |
|
21257 |
|
21258 |
|
21259 |
|
21260 | var hasInvisibleChildContext = current === null && workInProgress.memoizedProps.unstable_avoidThisFallback !== true;
|
21261 |
|
21262 | if (hasInvisibleChildContext || hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext)) {
|
21263 |
|
21264 |
|
21265 | renderDidSuspend();
|
21266 | } else {
|
21267 |
|
21268 |
|
21269 | renderDidSuspendDelayIfPossible();
|
21270 | }
|
21271 | }
|
21272 | }
|
21273 |
|
21274 | if (supportsPersistence) {
|
21275 |
|
21276 | if (nextDidTimeout) {
|
21277 |
|
21278 |
|
21279 |
|
21280 | workInProgress.effectTag |= Update;
|
21281 | }
|
21282 | }
|
21283 |
|
21284 | if (supportsMutation) {
|
21285 |
|
21286 | if (nextDidTimeout || prevDidTimeout) {
|
21287 |
|
21288 |
|
21289 |
|
21290 |
|
21291 |
|
21292 | workInProgress.effectTag |= Update;
|
21293 | }
|
21294 | }
|
21295 |
|
21296 | if (enableSuspenseCallback && workInProgress.updateQueue !== null && workInProgress.memoizedProps.suspenseCallback != null) {
|
21297 |
|
21298 | workInProgress.effectTag |= Update;
|
21299 | }
|
21300 |
|
21301 | break;
|
21302 | }
|
21303 |
|
21304 | case Fragment:
|
21305 | break;
|
21306 |
|
21307 | case Mode:
|
21308 | break;
|
21309 |
|
21310 | case Profiler:
|
21311 | break;
|
21312 |
|
21313 | case HostPortal:
|
21314 | popHostContainer(workInProgress);
|
21315 | updateHostContainer(workInProgress);
|
21316 | break;
|
21317 |
|
21318 | case ContextProvider:
|
21319 |
|
21320 | popProvider(workInProgress);
|
21321 | break;
|
21322 |
|
21323 | case ContextConsumer:
|
21324 | break;
|
21325 |
|
21326 | case MemoComponent:
|
21327 | break;
|
21328 |
|
21329 | case IncompleteClassComponent:
|
21330 | {
|
21331 |
|
21332 |
|
21333 | var _Component = workInProgress.type;
|
21334 |
|
21335 | if (isContextProvider(_Component)) {
|
21336 | popContext(workInProgress);
|
21337 | }
|
21338 |
|
21339 | break;
|
21340 | }
|
21341 |
|
21342 | case SuspenseListComponent:
|
21343 | {
|
21344 | popSuspenseContext(workInProgress);
|
21345 | var renderState = workInProgress.memoizedState;
|
21346 |
|
21347 | if (renderState === null) {
|
21348 |
|
21349 |
|
21350 | break;
|
21351 | }
|
21352 |
|
21353 | var didSuspendAlready = (workInProgress.effectTag & DidCapture) !== NoEffect;
|
21354 | var renderedTail = renderState.rendering;
|
21355 |
|
21356 | if (renderedTail === null) {
|
21357 |
|
21358 | if (!didSuspendAlready) {
|
21359 |
|
21360 |
|
21361 |
|
21362 |
|
21363 |
|
21364 |
|
21365 |
|
21366 |
|
21367 |
|
21368 | var cannotBeSuspended = renderHasNotSuspendedYet() && (current === null || (current.effectTag & DidCapture) === NoEffect);
|
21369 |
|
21370 | if (!cannotBeSuspended) {
|
21371 | var row = workInProgress.child;
|
21372 |
|
21373 | while (row !== null) {
|
21374 | var suspended = findFirstSuspended(row);
|
21375 |
|
21376 | if (suspended !== null) {
|
21377 | didSuspendAlready = true;
|
21378 | workInProgress.effectTag |= DidCapture;
|
21379 | cutOffTailIfNeeded(renderState, false);
|
21380 |
|
21381 |
|
21382 |
|
21383 |
|
21384 |
|
21385 |
|
21386 |
|
21387 |
|
21388 |
|
21389 |
|
21390 |
|
21391 |
|
21392 | var newThennables = suspended.updateQueue;
|
21393 |
|
21394 | if (newThennables !== null) {
|
21395 | workInProgress.updateQueue = newThennables;
|
21396 | workInProgress.effectTag |= Update;
|
21397 | }
|
21398 |
|
21399 |
|
21400 |
|
21401 |
|
21402 | workInProgress.firstEffect = workInProgress.lastEffect = null;
|
21403 |
|
21404 | resetChildFibers(workInProgress, renderExpirationTime);
|
21405 |
|
21406 |
|
21407 | pushSuspenseContext(workInProgress, setShallowSuspenseContext(suspenseStackCursor.current, ForceSuspenseFallback));
|
21408 | return workInProgress.child;
|
21409 | }
|
21410 |
|
21411 | row = row.sibling;
|
21412 | }
|
21413 | }
|
21414 | } else {
|
21415 | cutOffTailIfNeeded(renderState, false);
|
21416 | }
|
21417 |
|
21418 | } else {
|
21419 |
|
21420 | if (!didSuspendAlready) {
|
21421 | var _suspended = findFirstSuspended(renderedTail);
|
21422 |
|
21423 | if (_suspended !== null) {
|
21424 | workInProgress.effectTag |= DidCapture;
|
21425 | didSuspendAlready = true;
|
21426 | cutOffTailIfNeeded(renderState, true);
|
21427 |
|
21428 | if (renderState.tail === null && renderState.tailMode === 'hidden') {
|
21429 |
|
21430 |
|
21431 | var _newThennables = _suspended.updateQueue;
|
21432 |
|
21433 | if (_newThennables !== null) {
|
21434 | workInProgress.updateQueue = _newThennables;
|
21435 | workInProgress.effectTag |= Update;
|
21436 | }
|
21437 |
|
21438 |
|
21439 |
|
21440 | var lastEffect = workInProgress.lastEffect = renderState.lastEffect;
|
21441 |
|
21442 | if (lastEffect !== null) {
|
21443 | lastEffect.nextEffect = null;
|
21444 | }
|
21445 |
|
21446 |
|
21447 | return null;
|
21448 | }
|
21449 | } else if (now() > renderState.tailExpiration && renderExpirationTime > Never) {
|
21450 |
|
21451 |
|
21452 |
|
21453 | workInProgress.effectTag |= DidCapture;
|
21454 | didSuspendAlready = true;
|
21455 | cutOffTailIfNeeded(renderState, false);
|
21456 |
|
21457 |
|
21458 |
|
21459 |
|
21460 |
|
21461 | var nextPriority = renderExpirationTime - 1;
|
21462 | workInProgress.expirationTime = workInProgress.childExpirationTime = nextPriority;
|
21463 |
|
21464 | if (enableSchedulerTracing) {
|
21465 | markSpawnedWork(nextPriority);
|
21466 | }
|
21467 | }
|
21468 | }
|
21469 |
|
21470 | if (renderState.isBackwards) {
|
21471 |
|
21472 |
|
21473 |
|
21474 |
|
21475 |
|
21476 | renderedTail.sibling = workInProgress.child;
|
21477 | workInProgress.child = renderedTail;
|
21478 | } else {
|
21479 | var previousSibling = renderState.last;
|
21480 |
|
21481 | if (previousSibling !== null) {
|
21482 | previousSibling.sibling = renderedTail;
|
21483 | } else {
|
21484 | workInProgress.child = renderedTail;
|
21485 | }
|
21486 |
|
21487 | renderState.last = renderedTail;
|
21488 | }
|
21489 | }
|
21490 |
|
21491 | if (renderState.tail !== null) {
|
21492 |
|
21493 | if (renderState.tailExpiration === 0) {
|
21494 |
|
21495 |
|
21496 | var TAIL_EXPIRATION_TIMEOUT_MS = 500;
|
21497 | renderState.tailExpiration = now() + TAIL_EXPIRATION_TIMEOUT_MS;
|
21498 | }
|
21499 |
|
21500 |
|
21501 | var next = renderState.tail;
|
21502 | renderState.rendering = next;
|
21503 | renderState.tail = next.sibling;
|
21504 | renderState.lastEffect = workInProgress.lastEffect;
|
21505 | next.sibling = null;
|
21506 |
|
21507 |
|
21508 |
|
21509 | var suspenseContext = suspenseStackCursor.current;
|
21510 |
|
21511 | if (didSuspendAlready) {
|
21512 | suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback);
|
21513 | } else {
|
21514 | suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
|
21515 | }
|
21516 |
|
21517 | pushSuspenseContext(workInProgress, suspenseContext);
|
21518 |
|
21519 | return next;
|
21520 | }
|
21521 |
|
21522 | break;
|
21523 | }
|
21524 |
|
21525 | case FundamentalComponent:
|
21526 | {
|
21527 | if (enableFundamentalAPI) {
|
21528 | var fundamentalImpl = workInProgress.type.impl;
|
21529 | var fundamentalInstance = workInProgress.stateNode;
|
21530 |
|
21531 | if (fundamentalInstance === null) {
|
21532 | var getInitialState = fundamentalImpl.getInitialState;
|
21533 | var fundamentalState;
|
21534 |
|
21535 | if (getInitialState !== undefined) {
|
21536 | fundamentalState = getInitialState(newProps);
|
21537 | }
|
21538 |
|
21539 | fundamentalInstance = workInProgress.stateNode = createFundamentalStateInstance(workInProgress, newProps, fundamentalImpl, fundamentalState || {});
|
21540 |
|
21541 | var _instance5 = getFundamentalComponentInstance(fundamentalInstance);
|
21542 |
|
21543 | fundamentalInstance.instance = _instance5;
|
21544 |
|
21545 | if (fundamentalImpl.reconcileChildren === false) {
|
21546 | return null;
|
21547 | }
|
21548 |
|
21549 | appendAllChildren(_instance5, workInProgress, false, false);
|
21550 | mountFundamentalComponent(fundamentalInstance);
|
21551 | } else {
|
21552 |
|
21553 | var prevProps = fundamentalInstance.props;
|
21554 | fundamentalInstance.prevProps = prevProps;
|
21555 | fundamentalInstance.props = newProps;
|
21556 | fundamentalInstance.currentFiber = workInProgress;
|
21557 |
|
21558 | if (supportsPersistence) {
|
21559 | var _instance6 = cloneFundamentalInstance(fundamentalInstance);
|
21560 |
|
21561 | fundamentalInstance.instance = _instance6;
|
21562 | appendAllChildren(_instance6, workInProgress, false, false);
|
21563 | }
|
21564 |
|
21565 | var shouldUpdate = shouldUpdateFundamentalComponent(fundamentalInstance);
|
21566 |
|
21567 | if (shouldUpdate) {
|
21568 | markUpdate(workInProgress);
|
21569 | }
|
21570 | }
|
21571 | }
|
21572 |
|
21573 | break;
|
21574 | }
|
21575 |
|
21576 | case ScopeComponent:
|
21577 | {
|
21578 | if (enableScopeAPI) {
|
21579 | if (current === null) {
|
21580 | var _type3 = workInProgress.type;
|
21581 | var scopeInstance = {
|
21582 | fiber: workInProgress,
|
21583 | methods: null
|
21584 | };
|
21585 | workInProgress.stateNode = scopeInstance;
|
21586 | scopeInstance.methods = createScopeMethods(_type3, scopeInstance);
|
21587 |
|
21588 | if (enableFlareAPI) {
|
21589 | var _listeners2 = newProps.listeners;
|
21590 |
|
21591 | if (_listeners2 != null) {
|
21592 | var _rootContainerInstance2 = getRootHostContainer();
|
21593 |
|
21594 | updateEventListeners(_listeners2, workInProgress, _rootContainerInstance2);
|
21595 | }
|
21596 | }
|
21597 |
|
21598 | if (workInProgress.ref !== null) {
|
21599 | markRef$1(workInProgress);
|
21600 | markUpdate(workInProgress);
|
21601 | }
|
21602 | } else {
|
21603 | if (enableFlareAPI) {
|
21604 | var _prevListeners = current.memoizedProps.listeners;
|
21605 | var _nextListeners = newProps.listeners;
|
21606 |
|
21607 | if (_prevListeners !== _nextListeners || workInProgress.ref !== null) {
|
21608 | markUpdate(workInProgress);
|
21609 | }
|
21610 | } else {
|
21611 | if (workInProgress.ref !== null) {
|
21612 | markUpdate(workInProgress);
|
21613 | }
|
21614 | }
|
21615 |
|
21616 | if (current.ref !== workInProgress.ref) {
|
21617 | markRef$1(workInProgress);
|
21618 | }
|
21619 | }
|
21620 | }
|
21621 |
|
21622 | break;
|
21623 | }
|
21624 |
|
21625 | default:
|
21626 | (function () {
|
21627 | {
|
21628 | {
|
21629 | throw ReactError(Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."));
|
21630 | }
|
21631 | }
|
21632 | })();
|
21633 |
|
21634 | }
|
21635 |
|
21636 | return null;
|
21637 | }
|
21638 |
|
21639 | function unwindWork(workInProgress, renderExpirationTime) {
|
21640 | switch (workInProgress.tag) {
|
21641 | case ClassComponent:
|
21642 | {
|
21643 | var Component = workInProgress.type;
|
21644 |
|
21645 | if (isContextProvider(Component)) {
|
21646 | popContext(workInProgress);
|
21647 | }
|
21648 |
|
21649 | var effectTag = workInProgress.effectTag;
|
21650 |
|
21651 | if (effectTag & ShouldCapture) {
|
21652 | workInProgress.effectTag = effectTag & ~ShouldCapture | DidCapture;
|
21653 | return workInProgress;
|
21654 | }
|
21655 |
|
21656 | return null;
|
21657 | }
|
21658 |
|
21659 | case HostRoot:
|
21660 | {
|
21661 | popHostContainer(workInProgress);
|
21662 | popTopLevelContextObject(workInProgress);
|
21663 | var _effectTag = workInProgress.effectTag;
|
21664 |
|
21665 | (function () {
|
21666 | if (!((_effectTag & DidCapture) === NoEffect)) {
|
21667 | {
|
21668 | throw ReactError(Error("The root failed to unmount after an error. This is likely a bug in React. Please file an issue."));
|
21669 | }
|
21670 | }
|
21671 | })();
|
21672 |
|
21673 | workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
|
21674 | return workInProgress;
|
21675 | }
|
21676 |
|
21677 | case HostComponent:
|
21678 | {
|
21679 |
|
21680 | popHostContext(workInProgress);
|
21681 | return null;
|
21682 | }
|
21683 |
|
21684 | case SuspenseComponent:
|
21685 | {
|
21686 | popSuspenseContext(workInProgress);
|
21687 |
|
21688 | if (enableSuspenseServerRenderer) {
|
21689 | var suspenseState = workInProgress.memoizedState;
|
21690 |
|
21691 | if (suspenseState !== null && suspenseState.dehydrated !== null) {
|
21692 | (function () {
|
21693 | if (!(workInProgress.alternate !== null)) {
|
21694 | {
|
21695 | throw ReactError(Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue."));
|
21696 | }
|
21697 | }
|
21698 | })();
|
21699 |
|
21700 | resetHydrationState();
|
21701 | }
|
21702 | }
|
21703 |
|
21704 | var _effectTag2 = workInProgress.effectTag;
|
21705 |
|
21706 | if (_effectTag2 & ShouldCapture) {
|
21707 | workInProgress.effectTag = _effectTag2 & ~ShouldCapture | DidCapture;
|
21708 |
|
21709 | return workInProgress;
|
21710 | }
|
21711 |
|
21712 | return null;
|
21713 | }
|
21714 |
|
21715 | case SuspenseListComponent:
|
21716 | {
|
21717 | popSuspenseContext(workInProgress);
|
21718 |
|
21719 |
|
21720 | return null;
|
21721 | }
|
21722 |
|
21723 | case HostPortal:
|
21724 | popHostContainer(workInProgress);
|
21725 | return null;
|
21726 |
|
21727 | case ContextProvider:
|
21728 | popProvider(workInProgress);
|
21729 | return null;
|
21730 |
|
21731 | default:
|
21732 | return null;
|
21733 | }
|
21734 | }
|
21735 |
|
21736 | function unwindInterruptedWork(interruptedWork) {
|
21737 | switch (interruptedWork.tag) {
|
21738 | case ClassComponent:
|
21739 | {
|
21740 | var childContextTypes = interruptedWork.type.childContextTypes;
|
21741 |
|
21742 | if (childContextTypes !== null && childContextTypes !== undefined) {
|
21743 | popContext(interruptedWork);
|
21744 | }
|
21745 |
|
21746 | break;
|
21747 | }
|
21748 |
|
21749 | case HostRoot:
|
21750 | {
|
21751 | popHostContainer(interruptedWork);
|
21752 | popTopLevelContextObject(interruptedWork);
|
21753 | break;
|
21754 | }
|
21755 |
|
21756 | case HostComponent:
|
21757 | {
|
21758 | popHostContext(interruptedWork);
|
21759 | break;
|
21760 | }
|
21761 |
|
21762 | case HostPortal:
|
21763 | popHostContainer(interruptedWork);
|
21764 | break;
|
21765 |
|
21766 | case SuspenseComponent:
|
21767 | popSuspenseContext(interruptedWork);
|
21768 | break;
|
21769 |
|
21770 | case SuspenseListComponent:
|
21771 | popSuspenseContext(interruptedWork);
|
21772 | break;
|
21773 |
|
21774 | case ContextProvider:
|
21775 | popProvider(interruptedWork);
|
21776 | break;
|
21777 |
|
21778 | default:
|
21779 | break;
|
21780 | }
|
21781 | }
|
21782 |
|
21783 | function createCapturedValue(value, source) {
|
21784 |
|
21785 |
|
21786 | return {
|
21787 | value: value,
|
21788 | source: source,
|
21789 | stack: getStackByFiberInDevAndProd(source)
|
21790 | };
|
21791 | }
|
21792 |
|
21793 |
|
21794 |
|
21795 |
|
21796 | function showErrorDialog(capturedError) {
|
21797 | return true;
|
21798 | }
|
21799 |
|
21800 | function logCapturedError(capturedError) {
|
21801 | var logError = showErrorDialog(capturedError);
|
21802 |
|
21803 |
|
21804 | if (logError === false) {
|
21805 | return;
|
21806 | }
|
21807 |
|
21808 | var error = capturedError.error;
|
21809 |
|
21810 | {
|
21811 | var componentName = capturedError.componentName,
|
21812 | componentStack = capturedError.componentStack,
|
21813 | errorBoundaryName = capturedError.errorBoundaryName,
|
21814 | errorBoundaryFound = capturedError.errorBoundaryFound,
|
21815 | willRetry = capturedError.willRetry;
|
21816 |
|
21817 |
|
21818 |
|
21819 | if (error != null && error._suppressLogging) {
|
21820 | if (errorBoundaryFound && willRetry) {
|
21821 |
|
21822 |
|
21823 |
|
21824 | return;
|
21825 | }
|
21826 |
|
21827 |
|
21828 |
|
21829 |
|
21830 |
|
21831 | console.error(error);
|
21832 |
|
21833 | }
|
21834 |
|
21835 | var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : 'The above error occurred in one of your React components:';
|
21836 | var errorBoundaryMessage;
|
21837 |
|
21838 | if (errorBoundaryFound && errorBoundaryName) {
|
21839 | if (willRetry) {
|
21840 | errorBoundaryMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + errorBoundaryName + ".");
|
21841 | } else {
|
21842 | errorBoundaryMessage = "This error was initially handled by the error boundary " + errorBoundaryName + ".\n" + "Recreating the tree from scratch failed so React will unmount the tree.";
|
21843 | }
|
21844 | } else {
|
21845 | errorBoundaryMessage = 'Consider adding an error boundary to your tree to customize error handling behavior.\n' + 'Visit https://fb.me/react-error-boundaries to learn more about error boundaries.';
|
21846 | }
|
21847 |
|
21848 | var combinedMessage = "" + componentNameMessage + componentStack + "\n\n" + ("" + errorBoundaryMessage);
|
21849 |
|
21850 |
|
21851 |
|
21852 |
|
21853 | console.error(combinedMessage);
|
21854 | }
|
21855 | }
|
21856 |
|
21857 | var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
|
21858 |
|
21859 | {
|
21860 | didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
|
21861 | }
|
21862 |
|
21863 | var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
|
21864 | function logError(boundary, errorInfo) {
|
21865 | var source = errorInfo.source;
|
21866 | var stack = errorInfo.stack;
|
21867 |
|
21868 | if (stack === null && source !== null) {
|
21869 | stack = getStackByFiberInDevAndProd(source);
|
21870 | }
|
21871 |
|
21872 | var capturedError = {
|
21873 | componentName: source !== null ? getComponentName(source.type) : null,
|
21874 | componentStack: stack !== null ? stack : '',
|
21875 | error: errorInfo.value,
|
21876 | errorBoundary: null,
|
21877 | errorBoundaryName: null,
|
21878 | errorBoundaryFound: false,
|
21879 | willRetry: false
|
21880 | };
|
21881 |
|
21882 | if (boundary !== null && boundary.tag === ClassComponent) {
|
21883 | capturedError.errorBoundary = boundary.stateNode;
|
21884 | capturedError.errorBoundaryName = getComponentName(boundary.type);
|
21885 | capturedError.errorBoundaryFound = true;
|
21886 | capturedError.willRetry = true;
|
21887 | }
|
21888 |
|
21889 | try {
|
21890 | logCapturedError(capturedError);
|
21891 | } catch (e) {
|
21892 |
|
21893 |
|
21894 |
|
21895 |
|
21896 | setTimeout(function () {
|
21897 | throw e;
|
21898 | });
|
21899 | }
|
21900 | }
|
21901 |
|
21902 | var callComponentWillUnmountWithTimer = function (current$$1, instance) {
|
21903 | startPhaseTimer(current$$1, 'componentWillUnmount');
|
21904 | instance.props = current$$1.memoizedProps;
|
21905 | instance.state = current$$1.memoizedState;
|
21906 | instance.componentWillUnmount();
|
21907 | stopPhaseTimer();
|
21908 | };
|
21909 |
|
21910 |
|
21911 | function safelyCallComponentWillUnmount(current$$1, instance) {
|
21912 | {
|
21913 | invokeGuardedCallback(null, callComponentWillUnmountWithTimer, null, current$$1, instance);
|
21914 |
|
21915 | if (hasCaughtError()) {
|
21916 | var unmountError = clearCaughtError();
|
21917 | captureCommitPhaseError(current$$1, unmountError);
|
21918 | }
|
21919 | }
|
21920 | }
|
21921 |
|
21922 | function safelyDetachRef(current$$1) {
|
21923 | var ref = current$$1.ref;
|
21924 |
|
21925 | if (ref !== null) {
|
21926 | if (typeof ref === 'function') {
|
21927 | {
|
21928 | invokeGuardedCallback(null, ref, null, null);
|
21929 |
|
21930 | if (hasCaughtError()) {
|
21931 | var refError = clearCaughtError();
|
21932 | captureCommitPhaseError(current$$1, refError);
|
21933 | }
|
21934 | }
|
21935 | } else {
|
21936 | ref.current = null;
|
21937 | }
|
21938 | }
|
21939 | }
|
21940 |
|
21941 | function safelyCallDestroy(current$$1, destroy) {
|
21942 | {
|
21943 | invokeGuardedCallback(null, destroy, null);
|
21944 |
|
21945 | if (hasCaughtError()) {
|
21946 | var error = clearCaughtError();
|
21947 | captureCommitPhaseError(current$$1, error);
|
21948 | }
|
21949 | }
|
21950 | }
|
21951 |
|
21952 | function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
21953 | switch (finishedWork.tag) {
|
21954 | case FunctionComponent:
|
21955 | case ForwardRef:
|
21956 | case SimpleMemoComponent:
|
21957 | {
|
21958 | commitHookEffectList(UnmountSnapshot, NoEffect$1, finishedWork);
|
21959 | return;
|
21960 | }
|
21961 |
|
21962 | case ClassComponent:
|
21963 | {
|
21964 | if (finishedWork.effectTag & Snapshot) {
|
21965 | if (current$$1 !== null) {
|
21966 | var prevProps = current$$1.memoizedProps;
|
21967 | var prevState = current$$1.memoizedState;
|
21968 | startPhaseTimer(finishedWork, 'getSnapshotBeforeUpdate');
|
21969 | var instance = finishedWork.stateNode;
|
21970 |
|
21971 |
|
21972 |
|
21973 | {
|
21974 | if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
21975 | !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
21976 | !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
21977 | }
|
21978 | }
|
21979 |
|
21980 | var snapshot = instance.getSnapshotBeforeUpdate(finishedWork.elementType === finishedWork.type ? prevProps : resolveDefaultProps(finishedWork.type, prevProps), prevState);
|
21981 |
|
21982 | {
|
21983 | var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate;
|
21984 |
|
21985 | if (snapshot === undefined && !didWarnSet.has(finishedWork.type)) {
|
21986 | didWarnSet.add(finishedWork.type);
|
21987 | warningWithoutStack$1(false, '%s.getSnapshotBeforeUpdate(): A snapshot value (or null) ' + 'must be returned. You have returned undefined.', getComponentName(finishedWork.type));
|
21988 | }
|
21989 | }
|
21990 |
|
21991 | instance.__reactInternalSnapshotBeforeUpdate = snapshot;
|
21992 | stopPhaseTimer();
|
21993 | }
|
21994 | }
|
21995 |
|
21996 | return;
|
21997 | }
|
21998 |
|
21999 | case HostRoot:
|
22000 | case HostComponent:
|
22001 | case HostText:
|
22002 | case HostPortal:
|
22003 | case IncompleteClassComponent:
|
22004 |
|
22005 | return;
|
22006 |
|
22007 | default:
|
22008 | {
|
22009 | (function () {
|
22010 | {
|
22011 | {
|
22012 | throw ReactError(Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue."));
|
22013 | }
|
22014 | }
|
22015 | })();
|
22016 | }
|
22017 | }
|
22018 | }
|
22019 |
|
22020 | function commitHookEffectList(unmountTag, mountTag, finishedWork) {
|
22021 | var updateQueue = finishedWork.updateQueue;
|
22022 | var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
|
22023 |
|
22024 | if (lastEffect !== null) {
|
22025 | var firstEffect = lastEffect.next;
|
22026 | var effect = firstEffect;
|
22027 |
|
22028 | do {
|
22029 | if ((effect.tag & unmountTag) !== NoEffect$1) {
|
22030 |
|
22031 | var destroy = effect.destroy;
|
22032 | effect.destroy = undefined;
|
22033 |
|
22034 | if (destroy !== undefined) {
|
22035 | destroy();
|
22036 | }
|
22037 | }
|
22038 |
|
22039 | if ((effect.tag & mountTag) !== NoEffect$1) {
|
22040 |
|
22041 | var create = effect.create;
|
22042 | effect.destroy = create();
|
22043 |
|
22044 | {
|
22045 | var _destroy = effect.destroy;
|
22046 |
|
22047 | if (_destroy !== undefined && typeof _destroy !== 'function') {
|
22048 | var addendum = void 0;
|
22049 |
|
22050 | if (_destroy === null) {
|
22051 | addendum = ' You returned null. If your effect does not require clean ' + 'up, return undefined (or nothing).';
|
22052 | } else if (typeof _destroy.then === 'function') {
|
22053 | addendum = '\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. ' + 'Instead, write the async function inside your effect ' + 'and call it immediately:\n\n' + 'useEffect(() => {\n' + ' async function fetchData() {\n' + ' // You can await here\n' + ' const response = await MyAPI.getData(someId);\n' + ' // ...\n' + ' }\n' + ' fetchData();\n' + "}, [someId]); // Or [] if effect doesn't need props or state\n\n" + 'Learn more about data fetching with Hooks: https://fb.me/react-hooks-data-fetching';
|
22054 | } else {
|
22055 | addendum = ' You returned: ' + _destroy;
|
22056 | }
|
22057 |
|
22058 | warningWithoutStack$1(false, 'An effect function must not return anything besides a function, ' + 'which is used for clean-up.%s%s', addendum, getStackByFiberInDevAndProd(finishedWork));
|
22059 | }
|
22060 | }
|
22061 | }
|
22062 |
|
22063 | effect = effect.next;
|
22064 | } while (effect !== firstEffect);
|
22065 | }
|
22066 | }
|
22067 |
|
22068 | function commitPassiveHookEffects(finishedWork) {
|
22069 | if ((finishedWork.effectTag & Passive) !== NoEffect) {
|
22070 | switch (finishedWork.tag) {
|
22071 | case FunctionComponent:
|
22072 | case ForwardRef:
|
22073 | case SimpleMemoComponent:
|
22074 | {
|
22075 | commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork);
|
22076 | commitHookEffectList(NoEffect$1, MountPassive, finishedWork);
|
22077 | break;
|
22078 | }
|
22079 |
|
22080 | default:
|
22081 | break;
|
22082 | }
|
22083 | }
|
22084 | }
|
22085 |
|
22086 | function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpirationTime) {
|
22087 | switch (finishedWork.tag) {
|
22088 | case FunctionComponent:
|
22089 | case ForwardRef:
|
22090 | case SimpleMemoComponent:
|
22091 | {
|
22092 | commitHookEffectList(UnmountLayout, MountLayout, finishedWork);
|
22093 | break;
|
22094 | }
|
22095 |
|
22096 | case ClassComponent:
|
22097 | {
|
22098 | var instance = finishedWork.stateNode;
|
22099 |
|
22100 | if (finishedWork.effectTag & Update) {
|
22101 | if (current$$1 === null) {
|
22102 | startPhaseTimer(finishedWork, 'componentDidMount');
|
22103 |
|
22104 |
|
22105 |
|
22106 | {
|
22107 | if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
22108 | !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
22109 | !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
22110 | }
|
22111 | }
|
22112 |
|
22113 | instance.componentDidMount();
|
22114 | stopPhaseTimer();
|
22115 | } else {
|
22116 | var prevProps = finishedWork.elementType === finishedWork.type ? current$$1.memoizedProps : resolveDefaultProps(finishedWork.type, current$$1.memoizedProps);
|
22117 | var prevState = current$$1.memoizedState;
|
22118 | startPhaseTimer(finishedWork, 'componentDidUpdate');
|
22119 |
|
22120 |
|
22121 |
|
22122 | {
|
22123 | if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
22124 | !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
22125 | !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
22126 | }
|
22127 | }
|
22128 |
|
22129 | instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate);
|
22130 | stopPhaseTimer();
|
22131 | }
|
22132 | }
|
22133 |
|
22134 | var updateQueue = finishedWork.updateQueue;
|
22135 |
|
22136 | if (updateQueue !== null) {
|
22137 | {
|
22138 | if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
22139 | !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
22140 | !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
22141 | }
|
22142 | }
|
22143 |
|
22144 |
|
22145 |
|
22146 |
|
22147 | commitUpdateQueue(finishedWork, updateQueue, instance, committedExpirationTime);
|
22148 | }
|
22149 |
|
22150 | return;
|
22151 | }
|
22152 |
|
22153 | case HostRoot:
|
22154 | {
|
22155 | var _updateQueue = finishedWork.updateQueue;
|
22156 |
|
22157 | if (_updateQueue !== null) {
|
22158 | var _instance = null;
|
22159 |
|
22160 | if (finishedWork.child !== null) {
|
22161 | switch (finishedWork.child.tag) {
|
22162 | case HostComponent:
|
22163 | _instance = getPublicInstance(finishedWork.child.stateNode);
|
22164 | break;
|
22165 |
|
22166 | case ClassComponent:
|
22167 | _instance = finishedWork.child.stateNode;
|
22168 | break;
|
22169 | }
|
22170 | }
|
22171 |
|
22172 | commitUpdateQueue(finishedWork, _updateQueue, _instance, committedExpirationTime);
|
22173 | }
|
22174 |
|
22175 | return;
|
22176 | }
|
22177 |
|
22178 | case HostComponent:
|
22179 | {
|
22180 | var _instance2 = finishedWork.stateNode;
|
22181 |
|
22182 |
|
22183 |
|
22184 |
|
22185 | if (current$$1 === null && finishedWork.effectTag & Update) {
|
22186 | var type = finishedWork.type;
|
22187 | var props = finishedWork.memoizedProps;
|
22188 | commitMount(_instance2, type, props, finishedWork);
|
22189 | }
|
22190 |
|
22191 | return;
|
22192 | }
|
22193 |
|
22194 | case HostText:
|
22195 | {
|
22196 |
|
22197 | return;
|
22198 | }
|
22199 |
|
22200 | case HostPortal:
|
22201 | {
|
22202 |
|
22203 | return;
|
22204 | }
|
22205 |
|
22206 | case Profiler:
|
22207 | {
|
22208 | if (enableProfilerTimer) {
|
22209 | var onRender = finishedWork.memoizedProps.onRender;
|
22210 |
|
22211 | if (typeof onRender === 'function') {
|
22212 | if (enableSchedulerTracing) {
|
22213 | onRender(finishedWork.memoizedProps.id, current$$1 === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, getCommitTime(), finishedRoot.memoizedInteractions);
|
22214 | } else {
|
22215 | onRender(finishedWork.memoizedProps.id, current$$1 === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, getCommitTime());
|
22216 | }
|
22217 | }
|
22218 | }
|
22219 |
|
22220 | return;
|
22221 | }
|
22222 |
|
22223 | case SuspenseComponent:
|
22224 | {
|
22225 | commitSuspenseHydrationCallbacks(finishedRoot, finishedWork);
|
22226 | return;
|
22227 | }
|
22228 |
|
22229 | case SuspenseListComponent:
|
22230 | case IncompleteClassComponent:
|
22231 | case FundamentalComponent:
|
22232 | case ScopeComponent:
|
22233 | return;
|
22234 |
|
22235 | default:
|
22236 | {
|
22237 | (function () {
|
22238 | {
|
22239 | {
|
22240 | throw ReactError(Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue."));
|
22241 | }
|
22242 | }
|
22243 | })();
|
22244 | }
|
22245 | }
|
22246 | }
|
22247 |
|
22248 | function hideOrUnhideAllChildren(finishedWork, isHidden) {
|
22249 | if (supportsMutation) {
|
22250 |
|
22251 |
|
22252 | var node = finishedWork;
|
22253 |
|
22254 | while (true) {
|
22255 | if (node.tag === HostComponent) {
|
22256 | var instance = node.stateNode;
|
22257 |
|
22258 | if (isHidden) {
|
22259 | hideInstance(instance);
|
22260 | } else {
|
22261 | unhideInstance(node.stateNode, node.memoizedProps);
|
22262 | }
|
22263 | } else if (node.tag === HostText) {
|
22264 | var _instance3 = node.stateNode;
|
22265 |
|
22266 | if (isHidden) {
|
22267 | hideTextInstance(_instance3);
|
22268 | } else {
|
22269 | unhideTextInstance(_instance3, node.memoizedProps);
|
22270 | }
|
22271 | } else if (node.tag === SuspenseComponent && node.memoizedState !== null && node.memoizedState.dehydrated === null) {
|
22272 |
|
22273 |
|
22274 | var fallbackChildFragment = node.child.sibling;
|
22275 | fallbackChildFragment.return = node;
|
22276 | node = fallbackChildFragment;
|
22277 | continue;
|
22278 | } else if (node.child !== null) {
|
22279 | node.child.return = node;
|
22280 | node = node.child;
|
22281 | continue;
|
22282 | }
|
22283 |
|
22284 | if (node === finishedWork) {
|
22285 | return;
|
22286 | }
|
22287 |
|
22288 | while (node.sibling === null) {
|
22289 | if (node.return === null || node.return === finishedWork) {
|
22290 | return;
|
22291 | }
|
22292 |
|
22293 | node = node.return;
|
22294 | }
|
22295 |
|
22296 | node.sibling.return = node.return;
|
22297 | node = node.sibling;
|
22298 | }
|
22299 | }
|
22300 | }
|
22301 |
|
22302 | function commitAttachRef(finishedWork) {
|
22303 | var ref = finishedWork.ref;
|
22304 |
|
22305 | if (ref !== null) {
|
22306 | var instance = finishedWork.stateNode;
|
22307 | var instanceToUse;
|
22308 |
|
22309 | switch (finishedWork.tag) {
|
22310 | case HostComponent:
|
22311 | instanceToUse = getPublicInstance(instance);
|
22312 | break;
|
22313 |
|
22314 | default:
|
22315 | instanceToUse = instance;
|
22316 | }
|
22317 |
|
22318 |
|
22319 | if (enableScopeAPI && finishedWork.tag === ScopeComponent) {
|
22320 | instanceToUse = instance.methods;
|
22321 | }
|
22322 |
|
22323 | if (typeof ref === 'function') {
|
22324 | ref(instanceToUse);
|
22325 | } else {
|
22326 | {
|
22327 | if (!ref.hasOwnProperty('current')) {
|
22328 | warningWithoutStack$1(false, 'Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().%s', getComponentName(finishedWork.type), getStackByFiberInDevAndProd(finishedWork));
|
22329 | }
|
22330 | }
|
22331 |
|
22332 | ref.current = instanceToUse;
|
22333 | }
|
22334 | }
|
22335 | }
|
22336 |
|
22337 | function commitDetachRef(current$$1) {
|
22338 | var currentRef = current$$1.ref;
|
22339 |
|
22340 | if (currentRef !== null) {
|
22341 | if (typeof currentRef === 'function') {
|
22342 | currentRef(null);
|
22343 | } else {
|
22344 | currentRef.current = null;
|
22345 | }
|
22346 | }
|
22347 | }
|
22348 |
|
22349 |
|
22350 |
|
22351 |
|
22352 | function commitUnmount(finishedRoot, current$$1, renderPriorityLevel) {
|
22353 | onCommitUnmount(current$$1);
|
22354 |
|
22355 | switch (current$$1.tag) {
|
22356 | case FunctionComponent:
|
22357 | case ForwardRef:
|
22358 | case MemoComponent:
|
22359 | case SimpleMemoComponent:
|
22360 | {
|
22361 | var updateQueue = current$$1.updateQueue;
|
22362 |
|
22363 | if (updateQueue !== null) {
|
22364 | var lastEffect = updateQueue.lastEffect;
|
22365 |
|
22366 | if (lastEffect !== null) {
|
22367 | var firstEffect = lastEffect.next;
|
22368 |
|
22369 |
|
22370 |
|
22371 |
|
22372 |
|
22373 |
|
22374 |
|
22375 |
|
22376 |
|
22377 |
|
22378 |
|
22379 |
|
22380 | var priorityLevel = renderPriorityLevel > NormalPriority ? NormalPriority : renderPriorityLevel;
|
22381 | runWithPriority$2(priorityLevel, function () {
|
22382 | var effect = firstEffect;
|
22383 |
|
22384 | do {
|
22385 | var destroy = effect.destroy;
|
22386 |
|
22387 | if (destroy !== undefined) {
|
22388 | safelyCallDestroy(current$$1, destroy);
|
22389 | }
|
22390 |
|
22391 | effect = effect.next;
|
22392 | } while (effect !== firstEffect);
|
22393 | });
|
22394 | }
|
22395 | }
|
22396 |
|
22397 | break;
|
22398 | }
|
22399 |
|
22400 | case ClassComponent:
|
22401 | {
|
22402 | safelyDetachRef(current$$1);
|
22403 | var instance = current$$1.stateNode;
|
22404 |
|
22405 | if (typeof instance.componentWillUnmount === 'function') {
|
22406 | safelyCallComponentWillUnmount(current$$1, instance);
|
22407 | }
|
22408 |
|
22409 | return;
|
22410 | }
|
22411 |
|
22412 | case HostComponent:
|
22413 | {
|
22414 | if (enableFlareAPI) {
|
22415 | var dependencies = current$$1.dependencies;
|
22416 |
|
22417 | if (dependencies !== null) {
|
22418 | var respondersMap = dependencies.responders;
|
22419 |
|
22420 | if (respondersMap !== null) {
|
22421 | var responderInstances = Array.from(respondersMap.values());
|
22422 |
|
22423 | for (var i = 0, length = responderInstances.length; i < length; i++) {
|
22424 | var responderInstance = responderInstances[i];
|
22425 | unmountResponderInstance(responderInstance);
|
22426 | }
|
22427 |
|
22428 | dependencies.responders = null;
|
22429 | }
|
22430 | }
|
22431 | }
|
22432 |
|
22433 | safelyDetachRef(current$$1);
|
22434 | return;
|
22435 | }
|
22436 |
|
22437 | case HostPortal:
|
22438 | {
|
22439 |
|
22440 |
|
22441 |
|
22442 | if (supportsMutation) {
|
22443 | unmountHostComponents(finishedRoot, current$$1, renderPriorityLevel);
|
22444 | } else if (supportsPersistence) {
|
22445 | emptyPortalContainer(current$$1);
|
22446 | }
|
22447 |
|
22448 | return;
|
22449 | }
|
22450 |
|
22451 | case FundamentalComponent:
|
22452 | {
|
22453 | if (enableFundamentalAPI) {
|
22454 | var fundamentalInstance = current$$1.stateNode;
|
22455 |
|
22456 | if (fundamentalInstance !== null) {
|
22457 | unmountFundamentalComponent(fundamentalInstance);
|
22458 | current$$1.stateNode = null;
|
22459 | }
|
22460 | }
|
22461 |
|
22462 | return;
|
22463 | }
|
22464 |
|
22465 | case DehydratedFragment:
|
22466 | {
|
22467 | if (enableSuspenseCallback) {
|
22468 | var hydrationCallbacks = finishedRoot.hydrationCallbacks;
|
22469 |
|
22470 | if (hydrationCallbacks !== null) {
|
22471 | var onDeleted = hydrationCallbacks.onDeleted;
|
22472 |
|
22473 | if (onDeleted) {
|
22474 | onDeleted(current$$1.stateNode);
|
22475 | }
|
22476 | }
|
22477 | }
|
22478 |
|
22479 | return;
|
22480 | }
|
22481 |
|
22482 | case ScopeComponent:
|
22483 | {
|
22484 | if (enableScopeAPI) {
|
22485 | safelyDetachRef(current$$1);
|
22486 | }
|
22487 | }
|
22488 | }
|
22489 | }
|
22490 |
|
22491 | function commitNestedUnmounts(finishedRoot, root, renderPriorityLevel) {
|
22492 |
|
22493 |
|
22494 |
|
22495 |
|
22496 |
|
22497 | var node = root;
|
22498 |
|
22499 | while (true) {
|
22500 | commitUnmount(finishedRoot, node, renderPriorityLevel);
|
22501 |
|
22502 |
|
22503 | if (node.child !== null && (
|
22504 |
|
22505 | !supportsMutation || node.tag !== HostPortal)) {
|
22506 | node.child.return = node;
|
22507 | node = node.child;
|
22508 | continue;
|
22509 | }
|
22510 |
|
22511 | if (node === root) {
|
22512 | return;
|
22513 | }
|
22514 |
|
22515 | while (node.sibling === null) {
|
22516 | if (node.return === null || node.return === root) {
|
22517 | return;
|
22518 | }
|
22519 |
|
22520 | node = node.return;
|
22521 | }
|
22522 |
|
22523 | node.sibling.return = node.return;
|
22524 | node = node.sibling;
|
22525 | }
|
22526 | }
|
22527 |
|
22528 | function detachFiber(current$$1) {
|
22529 | var alternate = current$$1.alternate;
|
22530 |
|
22531 |
|
22532 |
|
22533 |
|
22534 |
|
22535 | current$$1.return = null;
|
22536 | current$$1.child = null;
|
22537 | current$$1.memoizedState = null;
|
22538 | current$$1.updateQueue = null;
|
22539 | current$$1.dependencies = null;
|
22540 | current$$1.alternate = null;
|
22541 | current$$1.firstEffect = null;
|
22542 | current$$1.lastEffect = null;
|
22543 | current$$1.pendingProps = null;
|
22544 | current$$1.memoizedProps = null;
|
22545 |
|
22546 | if (alternate !== null) {
|
22547 | detachFiber(alternate);
|
22548 | }
|
22549 | }
|
22550 |
|
22551 | function emptyPortalContainer(current$$1) {
|
22552 | if (!supportsPersistence) {
|
22553 | return;
|
22554 | }
|
22555 |
|
22556 | var portal = current$$1.stateNode;
|
22557 | var containerInfo = portal.containerInfo;
|
22558 | var emptyChildSet = createContainerChildSet(containerInfo);
|
22559 | replaceContainerChildren(containerInfo, emptyChildSet);
|
22560 | }
|
22561 |
|
22562 | function commitContainer(finishedWork) {
|
22563 | if (!supportsPersistence) {
|
22564 | return;
|
22565 | }
|
22566 |
|
22567 | switch (finishedWork.tag) {
|
22568 | case ClassComponent:
|
22569 | case HostComponent:
|
22570 | case HostText:
|
22571 | case FundamentalComponent:
|
22572 | {
|
22573 | return;
|
22574 | }
|
22575 |
|
22576 | case HostRoot:
|
22577 | case HostPortal:
|
22578 | {
|
22579 | var portalOrRoot = finishedWork.stateNode;
|
22580 | var containerInfo = portalOrRoot.containerInfo,
|
22581 | pendingChildren = portalOrRoot.pendingChildren;
|
22582 | replaceContainerChildren(containerInfo, pendingChildren);
|
22583 | return;
|
22584 | }
|
22585 |
|
22586 | default:
|
22587 | {
|
22588 | (function () {
|
22589 | {
|
22590 | {
|
22591 | throw ReactError(Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue."));
|
22592 | }
|
22593 | }
|
22594 | })();
|
22595 | }
|
22596 | }
|
22597 | }
|
22598 |
|
22599 | function getHostParentFiber(fiber) {
|
22600 | var parent = fiber.return;
|
22601 |
|
22602 | while (parent !== null) {
|
22603 | if (isHostParent(parent)) {
|
22604 | return parent;
|
22605 | }
|
22606 |
|
22607 | parent = parent.return;
|
22608 | }
|
22609 |
|
22610 | (function () {
|
22611 | {
|
22612 | {
|
22613 | throw ReactError(Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."));
|
22614 | }
|
22615 | }
|
22616 | })();
|
22617 | }
|
22618 |
|
22619 | function isHostParent(fiber) {
|
22620 | return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal;
|
22621 | }
|
22622 |
|
22623 | function getHostSibling(fiber) {
|
22624 |
|
22625 |
|
22626 |
|
22627 |
|
22628 | var node = fiber;
|
22629 |
|
22630 | siblings: while (true) {
|
22631 |
|
22632 | while (node.sibling === null) {
|
22633 | if (node.return === null || isHostParent(node.return)) {
|
22634 |
|
22635 |
|
22636 | return null;
|
22637 | }
|
22638 |
|
22639 | node = node.return;
|
22640 | }
|
22641 |
|
22642 | node.sibling.return = node.return;
|
22643 | node = node.sibling;
|
22644 |
|
22645 | while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedFragment) {
|
22646 |
|
22647 |
|
22648 | if (node.effectTag & Placement) {
|
22649 |
|
22650 | continue siblings;
|
22651 | }
|
22652 |
|
22653 |
|
22654 |
|
22655 | if (node.child === null || node.tag === HostPortal) {
|
22656 | continue siblings;
|
22657 | } else {
|
22658 | node.child.return = node;
|
22659 | node = node.child;
|
22660 | }
|
22661 | }
|
22662 |
|
22663 |
|
22664 | if (!(node.effectTag & Placement)) {
|
22665 |
|
22666 | return node.stateNode;
|
22667 | }
|
22668 | }
|
22669 | }
|
22670 |
|
22671 | function commitPlacement(finishedWork) {
|
22672 | if (!supportsMutation) {
|
22673 | return;
|
22674 | }
|
22675 |
|
22676 |
|
22677 | var parentFiber = getHostParentFiber(finishedWork);
|
22678 |
|
22679 | var parent;
|
22680 | var isContainer;
|
22681 | var parentStateNode = parentFiber.stateNode;
|
22682 |
|
22683 | switch (parentFiber.tag) {
|
22684 | case HostComponent:
|
22685 | parent = parentStateNode;
|
22686 | isContainer = false;
|
22687 | break;
|
22688 |
|
22689 | case HostRoot:
|
22690 | parent = parentStateNode.containerInfo;
|
22691 | isContainer = true;
|
22692 | break;
|
22693 |
|
22694 | case HostPortal:
|
22695 | parent = parentStateNode.containerInfo;
|
22696 | isContainer = true;
|
22697 | break;
|
22698 |
|
22699 | case FundamentalComponent:
|
22700 | if (enableFundamentalAPI) {
|
22701 | parent = parentStateNode.instance;
|
22702 | isContainer = false;
|
22703 | }
|
22704 |
|
22705 |
|
22706 |
|
22707 | default:
|
22708 | (function () {
|
22709 | {
|
22710 | {
|
22711 | throw ReactError(Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue."));
|
22712 | }
|
22713 | }
|
22714 | })();
|
22715 |
|
22716 | }
|
22717 |
|
22718 | if (parentFiber.effectTag & ContentReset) {
|
22719 |
|
22720 | resetTextContent(parent);
|
22721 |
|
22722 | parentFiber.effectTag &= ~ContentReset;
|
22723 | }
|
22724 |
|
22725 | var before = getHostSibling(finishedWork);
|
22726 |
|
22727 |
|
22728 | var node = finishedWork;
|
22729 |
|
22730 | while (true) {
|
22731 | var isHost = node.tag === HostComponent || node.tag === HostText;
|
22732 |
|
22733 | if (isHost || enableFundamentalAPI && node.tag === FundamentalComponent) {
|
22734 | var stateNode = isHost ? node.stateNode : node.stateNode.instance;
|
22735 |
|
22736 | if (before) {
|
22737 | if (isContainer) {
|
22738 | insertInContainerBefore(parent, stateNode, before);
|
22739 | } else {
|
22740 | insertBefore(parent, stateNode, before);
|
22741 | }
|
22742 | } else {
|
22743 | if (isContainer) {
|
22744 | appendChildToContainer(parent, stateNode);
|
22745 | } else {
|
22746 | appendChild(parent, stateNode);
|
22747 | }
|
22748 | }
|
22749 | } else if (node.tag === HostPortal) {
|
22750 |
|
22751 |
|
22752 | } else if (node.child !== null) {
|
22753 | node.child.return = node;
|
22754 | node = node.child;
|
22755 | continue;
|
22756 | }
|
22757 |
|
22758 | if (node === finishedWork) {
|
22759 | return;
|
22760 | }
|
22761 |
|
22762 | while (node.sibling === null) {
|
22763 | if (node.return === null || node.return === finishedWork) {
|
22764 | return;
|
22765 | }
|
22766 |
|
22767 | node = node.return;
|
22768 | }
|
22769 |
|
22770 | node.sibling.return = node.return;
|
22771 | node = node.sibling;
|
22772 | }
|
22773 | }
|
22774 |
|
22775 | function unmountHostComponents(finishedRoot, current$$1, renderPriorityLevel) {
|
22776 |
|
22777 |
|
22778 | var node = current$$1;
|
22779 |
|
22780 |
|
22781 | var currentParentIsValid = false;
|
22782 |
|
22783 | var currentParent;
|
22784 | var currentParentIsContainer;
|
22785 |
|
22786 | while (true) {
|
22787 | if (!currentParentIsValid) {
|
22788 | var parent = node.return;
|
22789 |
|
22790 | findParent: while (true) {
|
22791 | (function () {
|
22792 | if (!(parent !== null)) {
|
22793 | {
|
22794 | throw ReactError(Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."));
|
22795 | }
|
22796 | }
|
22797 | })();
|
22798 |
|
22799 | var parentStateNode = parent.stateNode;
|
22800 |
|
22801 | switch (parent.tag) {
|
22802 | case HostComponent:
|
22803 | currentParent = parentStateNode;
|
22804 | currentParentIsContainer = false;
|
22805 | break findParent;
|
22806 |
|
22807 | case HostRoot:
|
22808 | currentParent = parentStateNode.containerInfo;
|
22809 | currentParentIsContainer = true;
|
22810 | break findParent;
|
22811 |
|
22812 | case HostPortal:
|
22813 | currentParent = parentStateNode.containerInfo;
|
22814 | currentParentIsContainer = true;
|
22815 | break findParent;
|
22816 |
|
22817 | case FundamentalComponent:
|
22818 | if (enableFundamentalAPI) {
|
22819 | currentParent = parentStateNode.instance;
|
22820 | currentParentIsContainer = false;
|
22821 | }
|
22822 |
|
22823 | }
|
22824 |
|
22825 | parent = parent.return;
|
22826 | }
|
22827 |
|
22828 | currentParentIsValid = true;
|
22829 | }
|
22830 |
|
22831 | if (node.tag === HostComponent || node.tag === HostText) {
|
22832 | commitNestedUnmounts(finishedRoot, node, renderPriorityLevel);
|
22833 |
|
22834 |
|
22835 | if (currentParentIsContainer) {
|
22836 | removeChildFromContainer(currentParent, node.stateNode);
|
22837 | } else {
|
22838 | removeChild(currentParent, node.stateNode);
|
22839 | }
|
22840 |
|
22841 | } else if (enableFundamentalAPI && node.tag === FundamentalComponent) {
|
22842 | var fundamentalNode = node.stateNode.instance;
|
22843 | commitNestedUnmounts(finishedRoot, node, renderPriorityLevel);
|
22844 |
|
22845 |
|
22846 | if (currentParentIsContainer) {
|
22847 | removeChildFromContainer(currentParent, fundamentalNode);
|
22848 | } else {
|
22849 | removeChild(currentParent, fundamentalNode);
|
22850 | }
|
22851 | } else if (enableSuspenseServerRenderer && node.tag === DehydratedFragment) {
|
22852 | if (enableSuspenseCallback) {
|
22853 | var hydrationCallbacks = finishedRoot.hydrationCallbacks;
|
22854 |
|
22855 | if (hydrationCallbacks !== null) {
|
22856 | var onDeleted = hydrationCallbacks.onDeleted;
|
22857 |
|
22858 | if (onDeleted) {
|
22859 | onDeleted(node.stateNode);
|
22860 | }
|
22861 | }
|
22862 | }
|
22863 |
|
22864 |
|
22865 | if (currentParentIsContainer) {
|
22866 | clearSuspenseBoundaryFromContainer(currentParent, node.stateNode);
|
22867 | } else {
|
22868 | clearSuspenseBoundary(currentParent, node.stateNode);
|
22869 | }
|
22870 | } else if (node.tag === HostPortal) {
|
22871 | if (node.child !== null) {
|
22872 |
|
22873 |
|
22874 | currentParent = node.stateNode.containerInfo;
|
22875 | currentParentIsContainer = true;
|
22876 |
|
22877 | node.child.return = node;
|
22878 | node = node.child;
|
22879 | continue;
|
22880 | }
|
22881 | } else {
|
22882 | commitUnmount(finishedRoot, node, renderPriorityLevel);
|
22883 |
|
22884 | if (node.child !== null) {
|
22885 | node.child.return = node;
|
22886 | node = node.child;
|
22887 | continue;
|
22888 | }
|
22889 | }
|
22890 |
|
22891 | if (node === current$$1) {
|
22892 | return;
|
22893 | }
|
22894 |
|
22895 | while (node.sibling === null) {
|
22896 | if (node.return === null || node.return === current$$1) {
|
22897 | return;
|
22898 | }
|
22899 |
|
22900 | node = node.return;
|
22901 |
|
22902 | if (node.tag === HostPortal) {
|
22903 |
|
22904 |
|
22905 | currentParentIsValid = false;
|
22906 | }
|
22907 | }
|
22908 |
|
22909 | node.sibling.return = node.return;
|
22910 | node = node.sibling;
|
22911 | }
|
22912 | }
|
22913 |
|
22914 | function commitDeletion(finishedRoot, current$$1, renderPriorityLevel) {
|
22915 | if (supportsMutation) {
|
22916 |
|
22917 |
|
22918 | unmountHostComponents(finishedRoot, current$$1, renderPriorityLevel);
|
22919 | } else {
|
22920 |
|
22921 | commitNestedUnmounts(finishedRoot, current$$1, renderPriorityLevel);
|
22922 | }
|
22923 |
|
22924 | detachFiber(current$$1);
|
22925 | }
|
22926 |
|
22927 | function commitWork(current$$1, finishedWork) {
|
22928 | if (!supportsMutation) {
|
22929 | switch (finishedWork.tag) {
|
22930 | case FunctionComponent:
|
22931 | case ForwardRef:
|
22932 | case MemoComponent:
|
22933 | case SimpleMemoComponent:
|
22934 | {
|
22935 |
|
22936 |
|
22937 | commitHookEffectList(UnmountMutation, MountMutation, finishedWork);
|
22938 | return;
|
22939 | }
|
22940 |
|
22941 | case Profiler:
|
22942 | {
|
22943 | return;
|
22944 | }
|
22945 |
|
22946 | case SuspenseComponent:
|
22947 | {
|
22948 | commitSuspenseComponent(finishedWork);
|
22949 | attachSuspenseRetryListeners(finishedWork);
|
22950 | return;
|
22951 | }
|
22952 |
|
22953 | case SuspenseListComponent:
|
22954 | {
|
22955 | attachSuspenseRetryListeners(finishedWork);
|
22956 | return;
|
22957 | }
|
22958 |
|
22959 | case HostRoot:
|
22960 | {
|
22961 | if (supportsHydration) {
|
22962 | var root = finishedWork.stateNode;
|
22963 |
|
22964 | if (root.hydrate) {
|
22965 |
|
22966 | root.hydrate = false;
|
22967 | commitHydratedContainer(root.containerInfo);
|
22968 | }
|
22969 | }
|
22970 |
|
22971 | break;
|
22972 | }
|
22973 | }
|
22974 |
|
22975 | commitContainer(finishedWork);
|
22976 | return;
|
22977 | }
|
22978 |
|
22979 | switch (finishedWork.tag) {
|
22980 | case FunctionComponent:
|
22981 | case ForwardRef:
|
22982 | case MemoComponent:
|
22983 | case SimpleMemoComponent:
|
22984 | {
|
22985 |
|
22986 |
|
22987 | commitHookEffectList(UnmountMutation, MountMutation, finishedWork);
|
22988 | return;
|
22989 | }
|
22990 |
|
22991 | case ClassComponent:
|
22992 | {
|
22993 | return;
|
22994 | }
|
22995 |
|
22996 | case HostComponent:
|
22997 | {
|
22998 | var instance = finishedWork.stateNode;
|
22999 |
|
23000 | if (instance != null) {
|
23001 |
|
23002 | var newProps = finishedWork.memoizedProps;
|
23003 |
|
23004 |
|
23005 |
|
23006 | var oldProps = current$$1 !== null ? current$$1.memoizedProps : newProps;
|
23007 | var type = finishedWork.type;
|
23008 |
|
23009 | var updatePayload = finishedWork.updateQueue;
|
23010 | finishedWork.updateQueue = null;
|
23011 |
|
23012 | if (updatePayload !== null) {
|
23013 | commitUpdate(instance, updatePayload, type, oldProps, newProps, finishedWork);
|
23014 | }
|
23015 |
|
23016 | if (enableFlareAPI) {
|
23017 | var prevListeners = oldProps.listeners;
|
23018 | var nextListeners = newProps.listeners;
|
23019 |
|
23020 | if (prevListeners !== nextListeners) {
|
23021 | updateEventListeners(nextListeners, finishedWork, null);
|
23022 | }
|
23023 | }
|
23024 | }
|
23025 |
|
23026 | return;
|
23027 | }
|
23028 |
|
23029 | case HostText:
|
23030 | {
|
23031 | (function () {
|
23032 | if (!(finishedWork.stateNode !== null)) {
|
23033 | {
|
23034 | throw ReactError(Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue."));
|
23035 | }
|
23036 | }
|
23037 | })();
|
23038 |
|
23039 | var textInstance = finishedWork.stateNode;
|
23040 | var newText = finishedWork.memoizedProps;
|
23041 |
|
23042 |
|
23043 |
|
23044 | var oldText = current$$1 !== null ? current$$1.memoizedProps : newText;
|
23045 | commitTextUpdate(textInstance, oldText, newText);
|
23046 | return;
|
23047 | }
|
23048 |
|
23049 | case HostRoot:
|
23050 | {
|
23051 | if (supportsHydration) {
|
23052 | var _root = finishedWork.stateNode;
|
23053 |
|
23054 | if (_root.hydrate) {
|
23055 |
|
23056 | _root.hydrate = false;
|
23057 | commitHydratedContainer(_root.containerInfo);
|
23058 | }
|
23059 | }
|
23060 |
|
23061 | return;
|
23062 | }
|
23063 |
|
23064 | case Profiler:
|
23065 | {
|
23066 | return;
|
23067 | }
|
23068 |
|
23069 | case SuspenseComponent:
|
23070 | {
|
23071 | commitSuspenseComponent(finishedWork);
|
23072 | attachSuspenseRetryListeners(finishedWork);
|
23073 | return;
|
23074 | }
|
23075 |
|
23076 | case SuspenseListComponent:
|
23077 | {
|
23078 | attachSuspenseRetryListeners(finishedWork);
|
23079 | return;
|
23080 | }
|
23081 |
|
23082 | case IncompleteClassComponent:
|
23083 | {
|
23084 | return;
|
23085 | }
|
23086 |
|
23087 | case FundamentalComponent:
|
23088 | {
|
23089 | if (enableFundamentalAPI) {
|
23090 | var fundamentalInstance = finishedWork.stateNode;
|
23091 | updateFundamentalComponent(fundamentalInstance);
|
23092 | }
|
23093 |
|
23094 | return;
|
23095 | }
|
23096 |
|
23097 | case ScopeComponent:
|
23098 | {
|
23099 | if (enableScopeAPI) {
|
23100 | var scopeInstance = finishedWork.stateNode;
|
23101 | scopeInstance.fiber = finishedWork;
|
23102 |
|
23103 | if (enableFlareAPI) {
|
23104 | var _newProps = finishedWork.memoizedProps;
|
23105 |
|
23106 | var _oldProps = current$$1 !== null ? current$$1.memoizedProps : _newProps;
|
23107 |
|
23108 | var _prevListeners = _oldProps.listeners;
|
23109 | var _nextListeners = _newProps.listeners;
|
23110 |
|
23111 | if (_prevListeners !== _nextListeners) {
|
23112 | updateEventListeners(_nextListeners, finishedWork, null);
|
23113 | }
|
23114 | }
|
23115 | }
|
23116 |
|
23117 | return;
|
23118 | }
|
23119 |
|
23120 | default:
|
23121 | {
|
23122 | (function () {
|
23123 | {
|
23124 | {
|
23125 | throw ReactError(Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue."));
|
23126 | }
|
23127 | }
|
23128 | })();
|
23129 | }
|
23130 | }
|
23131 | }
|
23132 |
|
23133 | function commitSuspenseComponent(finishedWork) {
|
23134 | var newState = finishedWork.memoizedState;
|
23135 | var newDidTimeout;
|
23136 | var primaryChildParent = finishedWork;
|
23137 |
|
23138 | if (newState === null) {
|
23139 | newDidTimeout = false;
|
23140 | } else {
|
23141 | newDidTimeout = true;
|
23142 | primaryChildParent = finishedWork.child;
|
23143 | markCommitTimeOfFallback();
|
23144 | }
|
23145 |
|
23146 | if (supportsMutation && primaryChildParent !== null) {
|
23147 | hideOrUnhideAllChildren(primaryChildParent, newDidTimeout);
|
23148 | }
|
23149 |
|
23150 | if (enableSuspenseCallback && newState !== null) {
|
23151 | var suspenseCallback = finishedWork.memoizedProps.suspenseCallback;
|
23152 |
|
23153 | if (typeof suspenseCallback === 'function') {
|
23154 | var thenables = finishedWork.updateQueue;
|
23155 |
|
23156 | if (thenables !== null) {
|
23157 | suspenseCallback(new Set(thenables));
|
23158 | }
|
23159 | } else {
|
23160 | if (suspenseCallback !== undefined) {
|
23161 | warning$1(false, 'Unexpected type for suspenseCallback.');
|
23162 | }
|
23163 | }
|
23164 | }
|
23165 | }
|
23166 |
|
23167 | function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) {
|
23168 | if (!supportsHydration) {
|
23169 | return;
|
23170 | }
|
23171 |
|
23172 | var newState = finishedWork.memoizedState;
|
23173 |
|
23174 | if (newState === null) {
|
23175 | var current$$1 = finishedWork.alternate;
|
23176 |
|
23177 | if (current$$1 !== null) {
|
23178 | var prevState = current$$1.memoizedState;
|
23179 |
|
23180 | if (prevState !== null) {
|
23181 | var suspenseInstance = prevState.dehydrated;
|
23182 |
|
23183 | if (suspenseInstance !== null) {
|
23184 | commitHydratedSuspenseInstance(suspenseInstance);
|
23185 |
|
23186 | if (enableSuspenseCallback) {
|
23187 | var hydrationCallbacks = finishedRoot.hydrationCallbacks;
|
23188 |
|
23189 | if (hydrationCallbacks !== null) {
|
23190 | var onHydrated = hydrationCallbacks.onHydrated;
|
23191 |
|
23192 | if (onHydrated) {
|
23193 | onHydrated(suspenseInstance);
|
23194 | }
|
23195 | }
|
23196 | }
|
23197 | }
|
23198 | }
|
23199 | }
|
23200 | }
|
23201 | }
|
23202 |
|
23203 | function attachSuspenseRetryListeners(finishedWork) {
|
23204 |
|
23205 |
|
23206 |
|
23207 | var thenables = finishedWork.updateQueue;
|
23208 |
|
23209 | if (thenables !== null) {
|
23210 | finishedWork.updateQueue = null;
|
23211 | var retryCache = finishedWork.stateNode;
|
23212 |
|
23213 | if (retryCache === null) {
|
23214 | retryCache = finishedWork.stateNode = new PossiblyWeakSet();
|
23215 | }
|
23216 |
|
23217 | thenables.forEach(function (thenable) {
|
23218 |
|
23219 | var retry = resolveRetryThenable.bind(null, finishedWork, thenable);
|
23220 |
|
23221 | if (!retryCache.has(thenable)) {
|
23222 | if (enableSchedulerTracing) {
|
23223 | if (thenable.__reactDoNotTraceInteractions !== true) {
|
23224 | retry = unstable_wrap(retry);
|
23225 | }
|
23226 | }
|
23227 |
|
23228 | retryCache.add(thenable);
|
23229 | thenable.then(retry, retry);
|
23230 | }
|
23231 | });
|
23232 | }
|
23233 | }
|
23234 |
|
23235 | function commitResetTextContent(current$$1) {
|
23236 | if (!supportsMutation) {
|
23237 | return;
|
23238 | }
|
23239 |
|
23240 | resetTextContent(current$$1.stateNode);
|
23241 | }
|
23242 |
|
23243 | var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map;
|
23244 |
|
23245 | function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
|
23246 | var update = createUpdate(expirationTime, null);
|
23247 |
|
23248 | update.tag = CaptureUpdate;
|
23249 |
|
23250 |
|
23251 | update.payload = {
|
23252 | element: null
|
23253 | };
|
23254 | var error = errorInfo.value;
|
23255 |
|
23256 | update.callback = function () {
|
23257 | onUncaughtError(error);
|
23258 | logError(fiber, errorInfo);
|
23259 | };
|
23260 |
|
23261 | return update;
|
23262 | }
|
23263 |
|
23264 | function createClassErrorUpdate(fiber, errorInfo, expirationTime) {
|
23265 | var update = createUpdate(expirationTime, null);
|
23266 | update.tag = CaptureUpdate;
|
23267 | var getDerivedStateFromError = fiber.type.getDerivedStateFromError;
|
23268 |
|
23269 | if (typeof getDerivedStateFromError === 'function') {
|
23270 | var error = errorInfo.value;
|
23271 |
|
23272 | update.payload = function () {
|
23273 | logError(fiber, errorInfo);
|
23274 | return getDerivedStateFromError(error);
|
23275 | };
|
23276 | }
|
23277 |
|
23278 | var inst = fiber.stateNode;
|
23279 |
|
23280 | if (inst !== null && typeof inst.componentDidCatch === 'function') {
|
23281 | update.callback = function callback() {
|
23282 | {
|
23283 | markFailedErrorBoundaryForHotReloading(fiber);
|
23284 | }
|
23285 |
|
23286 | if (typeof getDerivedStateFromError !== 'function') {
|
23287 |
|
23288 |
|
23289 |
|
23290 |
|
23291 |
|
23292 | markLegacyErrorBoundaryAsFailed(this);
|
23293 |
|
23294 | logError(fiber, errorInfo);
|
23295 | }
|
23296 |
|
23297 | var error = errorInfo.value;
|
23298 | var stack = errorInfo.stack;
|
23299 | this.componentDidCatch(error, {
|
23300 | componentStack: stack !== null ? stack : ''
|
23301 | });
|
23302 |
|
23303 | {
|
23304 | if (typeof getDerivedStateFromError !== 'function') {
|
23305 |
|
23306 |
|
23307 |
|
23308 | !(fiber.expirationTime === Sync) ? warningWithoutStack$1(false, '%s: Error boundaries should implement getDerivedStateFromError(). ' + 'In that method, return a state update to display an error message or fallback UI.', getComponentName(fiber.type) || 'Unknown') : void 0;
|
23309 | }
|
23310 | }
|
23311 | };
|
23312 | } else {
|
23313 | update.callback = function () {
|
23314 | markFailedErrorBoundaryForHotReloading(fiber);
|
23315 | };
|
23316 | }
|
23317 |
|
23318 | return update;
|
23319 | }
|
23320 |
|
23321 | function attachPingListener(root, renderExpirationTime, thenable) {
|
23322 |
|
23323 |
|
23324 |
|
23325 | var pingCache = root.pingCache;
|
23326 | var threadIDs;
|
23327 |
|
23328 | if (pingCache === null) {
|
23329 | pingCache = root.pingCache = new PossiblyWeakMap$1();
|
23330 | threadIDs = new Set();
|
23331 | pingCache.set(thenable, threadIDs);
|
23332 | } else {
|
23333 | threadIDs = pingCache.get(thenable);
|
23334 |
|
23335 | if (threadIDs === undefined) {
|
23336 | threadIDs = new Set();
|
23337 | pingCache.set(thenable, threadIDs);
|
23338 | }
|
23339 | }
|
23340 |
|
23341 | if (!threadIDs.has(renderExpirationTime)) {
|
23342 |
|
23343 | threadIDs.add(renderExpirationTime);
|
23344 | var ping = pingSuspendedRoot.bind(null, root, thenable, renderExpirationTime);
|
23345 | thenable.then(ping, ping);
|
23346 | }
|
23347 | }
|
23348 |
|
23349 | function throwException(root, returnFiber, sourceFiber, value, renderExpirationTime) {
|
23350 |
|
23351 | sourceFiber.effectTag |= Incomplete;
|
23352 |
|
23353 | sourceFiber.firstEffect = sourceFiber.lastEffect = null;
|
23354 |
|
23355 | if (value !== null && typeof value === 'object' && typeof value.then === 'function') {
|
23356 |
|
23357 | var thenable = value;
|
23358 | checkForWrongSuspensePriorityInDEV(sourceFiber);
|
23359 | var hasInvisibleParentBoundary = hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext);
|
23360 |
|
23361 | var _workInProgress = returnFiber;
|
23362 |
|
23363 | do {
|
23364 | if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress, hasInvisibleParentBoundary)) {
|
23365 |
|
23366 |
|
23367 |
|
23368 | var thenables = _workInProgress.updateQueue;
|
23369 |
|
23370 | if (thenables === null) {
|
23371 | var updateQueue = new Set();
|
23372 | updateQueue.add(thenable);
|
23373 | _workInProgress.updateQueue = updateQueue;
|
23374 | } else {
|
23375 | thenables.add(thenable);
|
23376 | }
|
23377 |
|
23378 |
|
23379 |
|
23380 |
|
23381 |
|
23382 |
|
23383 |
|
23384 |
|
23385 |
|
23386 | if ((_workInProgress.mode & BatchedMode) === NoMode) {
|
23387 | _workInProgress.effectTag |= DidCapture;
|
23388 |
|
23389 |
|
23390 |
|
23391 | sourceFiber.effectTag &= ~(LifecycleEffectMask | Incomplete);
|
23392 |
|
23393 | if (sourceFiber.tag === ClassComponent) {
|
23394 | var currentSourceFiber = sourceFiber.alternate;
|
23395 |
|
23396 | if (currentSourceFiber === null) {
|
23397 |
|
23398 |
|
23399 |
|
23400 | sourceFiber.tag = IncompleteClassComponent;
|
23401 | } else {
|
23402 |
|
23403 |
|
23404 |
|
23405 | var update = createUpdate(Sync, null);
|
23406 | update.tag = ForceUpdate;
|
23407 | enqueueUpdate(sourceFiber, update);
|
23408 | }
|
23409 | }
|
23410 |
|
23411 |
|
23412 |
|
23413 | sourceFiber.expirationTime = Sync;
|
23414 |
|
23415 | return;
|
23416 | }
|
23417 |
|
23418 |
|
23419 |
|
23420 |
|
23421 |
|
23422 |
|
23423 |
|
23424 |
|
23425 |
|
23426 |
|
23427 |
|
23428 |
|
23429 |
|
23430 |
|
23431 |
|
23432 |
|
23433 |
|
23434 |
|
23435 |
|
23436 |
|
23437 |
|
23438 |
|
23439 |
|
23440 |
|
23441 |
|
23442 |
|
23443 |
|
23444 |
|
23445 |
|
23446 |
|
23447 |
|
23448 |
|
23449 |
|
23450 |
|
23451 |
|
23452 |
|
23453 |
|
23454 |
|
23455 |
|
23456 |
|
23457 |
|
23458 | attachPingListener(root, renderExpirationTime, thenable);
|
23459 | _workInProgress.effectTag |= ShouldCapture;
|
23460 | _workInProgress.expirationTime = renderExpirationTime;
|
23461 | return;
|
23462 | }
|
23463 |
|
23464 |
|
23465 |
|
23466 | _workInProgress = _workInProgress.return;
|
23467 | } while (_workInProgress !== null);
|
23468 |
|
23469 |
|
23470 |
|
23471 | value = new Error((getComponentName(sourceFiber.type) || 'A React component') + ' suspended while rendering, but no fallback UI was specified.\n' + '\n' + 'Add a <Suspense fallback=...> component higher in the tree to ' + 'provide a loading indicator or placeholder to display.' + getStackByFiberInDevAndProd(sourceFiber));
|
23472 | }
|
23473 |
|
23474 |
|
23475 |
|
23476 |
|
23477 | renderDidError();
|
23478 | value = createCapturedValue(value, sourceFiber);
|
23479 | var workInProgress = returnFiber;
|
23480 |
|
23481 | do {
|
23482 | switch (workInProgress.tag) {
|
23483 | case HostRoot:
|
23484 | {
|
23485 | var _errorInfo = value;
|
23486 | workInProgress.effectTag |= ShouldCapture;
|
23487 | workInProgress.expirationTime = renderExpirationTime;
|
23488 |
|
23489 | var _update = createRootErrorUpdate(workInProgress, _errorInfo, renderExpirationTime);
|
23490 |
|
23491 | enqueueCapturedUpdate(workInProgress, _update);
|
23492 | return;
|
23493 | }
|
23494 |
|
23495 | case ClassComponent:
|
23496 |
|
23497 | var errorInfo = value;
|
23498 | var ctor = workInProgress.type;
|
23499 | var instance = workInProgress.stateNode;
|
23500 |
|
23501 | if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromError === 'function' || instance !== null && typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance))) {
|
23502 | workInProgress.effectTag |= ShouldCapture;
|
23503 | workInProgress.expirationTime = renderExpirationTime;
|
23504 |
|
23505 | var _update2 = createClassErrorUpdate(workInProgress, errorInfo, renderExpirationTime);
|
23506 |
|
23507 | enqueueCapturedUpdate(workInProgress, _update2);
|
23508 | return;
|
23509 | }
|
23510 |
|
23511 | break;
|
23512 |
|
23513 | default:
|
23514 | break;
|
23515 | }
|
23516 |
|
23517 | workInProgress = workInProgress.return;
|
23518 | } while (workInProgress !== null);
|
23519 | }
|
23520 |
|
23521 | var ceil = Math.ceil;
|
23522 | var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
23523 | var ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner;
|
23524 | var IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing;
|
23525 | var NoContext =
|
23526 |
|
23527 | 0;
|
23528 | var BatchedContext =
|
23529 |
|
23530 | 1;
|
23531 | var EventContext =
|
23532 |
|
23533 | 2;
|
23534 | var DiscreteEventContext =
|
23535 |
|
23536 | 4;
|
23537 | var LegacyUnbatchedContext =
|
23538 |
|
23539 | 8;
|
23540 | var RenderContext =
|
23541 |
|
23542 | 16;
|
23543 | var CommitContext =
|
23544 |
|
23545 | 32;
|
23546 | var RootIncomplete = 0;
|
23547 | var RootFatalErrored = 1;
|
23548 | var RootErrored = 2;
|
23549 | var RootSuspended = 3;
|
23550 | var RootSuspendedWithDelay = 4;
|
23551 | var RootCompleted = 5;
|
23552 | var RootLocked = 6;
|
23553 |
|
23554 | var executionContext = NoContext;
|
23555 |
|
23556 | var workInProgressRoot = null;
|
23557 |
|
23558 | var workInProgress = null;
|
23559 |
|
23560 | var renderExpirationTime = NoWork;
|
23561 |
|
23562 | var workInProgressRootExitStatus = RootIncomplete;
|
23563 |
|
23564 | var workInProgressRootFatalError = null;
|
23565 |
|
23566 |
|
23567 |
|
23568 |
|
23569 | var workInProgressRootLatestProcessedExpirationTime = Sync;
|
23570 | var workInProgressRootLatestSuspenseTimeout = Sync;
|
23571 | var workInProgressRootCanSuspendUsingConfig = null;
|
23572 |
|
23573 |
|
23574 | var workInProgressRootNextUnprocessedUpdateTime = NoWork;
|
23575 |
|
23576 |
|
23577 |
|
23578 | var workInProgressRootHasPendingPing = false;
|
23579 |
|
23580 |
|
23581 | var globalMostRecentFallbackTime = 0;
|
23582 | var FALLBACK_THROTTLE_MS = 500;
|
23583 | var nextEffect = null;
|
23584 | var hasUncaughtError = false;
|
23585 | var firstUncaughtError = null;
|
23586 | var legacyErrorBoundariesThatAlreadyFailed = null;
|
23587 | var rootDoesHavePassiveEffects = false;
|
23588 | var rootWithPendingPassiveEffects = null;
|
23589 | var pendingPassiveEffectsRenderPriority = NoPriority;
|
23590 | var pendingPassiveEffectsExpirationTime = NoWork;
|
23591 | var rootsWithPendingDiscreteUpdates = null;
|
23592 |
|
23593 | var NESTED_UPDATE_LIMIT = 50;
|
23594 | var nestedUpdateCount = 0;
|
23595 | var rootWithNestedUpdates = null;
|
23596 | var NESTED_PASSIVE_UPDATE_LIMIT = 50;
|
23597 | var nestedPassiveUpdateCount = 0;
|
23598 | var interruptedBy = null;
|
23599 |
|
23600 |
|
23601 |
|
23602 |
|
23603 | var spawnedWorkDuringRender = null;
|
23604 |
|
23605 |
|
23606 |
|
23607 |
|
23608 |
|
23609 |
|
23610 |
|
23611 | var currentEventTime = NoWork;
|
23612 | function requestCurrentTime() {
|
23613 | if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
23614 |
|
23615 | return msToExpirationTime(now());
|
23616 | }
|
23617 |
|
23618 |
|
23619 | if (currentEventTime !== NoWork) {
|
23620 |
|
23621 | return currentEventTime;
|
23622 | }
|
23623 |
|
23624 |
|
23625 | currentEventTime = msToExpirationTime(now());
|
23626 | return currentEventTime;
|
23627 | }
|
23628 | function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
23629 | var mode = fiber.mode;
|
23630 |
|
23631 | if ((mode & BatchedMode) === NoMode) {
|
23632 | return Sync;
|
23633 | }
|
23634 |
|
23635 | var priorityLevel = getCurrentPriorityLevel();
|
23636 |
|
23637 | if ((mode & ConcurrentMode) === NoMode) {
|
23638 | return priorityLevel === ImmediatePriority ? Sync : Batched;
|
23639 | }
|
23640 |
|
23641 | if ((executionContext & RenderContext) !== NoContext) {
|
23642 |
|
23643 |
|
23644 | return renderExpirationTime;
|
23645 | }
|
23646 |
|
23647 | var expirationTime;
|
23648 |
|
23649 | if (suspenseConfig !== null) {
|
23650 |
|
23651 | expirationTime = computeSuspenseExpiration(currentTime, suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION);
|
23652 | } else {
|
23653 |
|
23654 | switch (priorityLevel) {
|
23655 | case ImmediatePriority:
|
23656 | expirationTime = Sync;
|
23657 | break;
|
23658 |
|
23659 | case UserBlockingPriority$2:
|
23660 |
|
23661 | expirationTime = computeInteractiveExpiration(currentTime);
|
23662 | break;
|
23663 |
|
23664 | case NormalPriority:
|
23665 | case LowPriority:
|
23666 |
|
23667 |
|
23668 | expirationTime = computeAsyncExpiration(currentTime);
|
23669 | break;
|
23670 |
|
23671 | case IdlePriority:
|
23672 | expirationTime = Idle;
|
23673 | break;
|
23674 |
|
23675 | default:
|
23676 | (function () {
|
23677 | {
|
23678 | {
|
23679 | throw ReactError(Error("Expected a valid priority level"));
|
23680 | }
|
23681 | }
|
23682 | })();
|
23683 |
|
23684 | }
|
23685 | }
|
23686 |
|
23687 |
|
23688 |
|
23689 |
|
23690 |
|
23691 |
|
23692 | if (workInProgressRoot !== null && expirationTime === renderExpirationTime) {
|
23693 |
|
23694 | expirationTime -= 1;
|
23695 | }
|
23696 |
|
23697 | return expirationTime;
|
23698 | }
|
23699 | var lastUniqueAsyncExpiration = NoWork;
|
23700 | function computeUniqueAsyncExpiration() {
|
23701 | var currentTime = requestCurrentTime();
|
23702 | var result = computeAsyncExpiration(currentTime);
|
23703 |
|
23704 | if (result <= lastUniqueAsyncExpiration) {
|
23705 |
|
23706 |
|
23707 |
|
23708 | result -= 1;
|
23709 | }
|
23710 |
|
23711 | lastUniqueAsyncExpiration = result;
|
23712 | return result;
|
23713 | }
|
23714 | function scheduleUpdateOnFiber(fiber, expirationTime) {
|
23715 | checkForNestedUpdates();
|
23716 | warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber);
|
23717 | var root = markUpdateTimeFromFiberToRoot(fiber, expirationTime);
|
23718 |
|
23719 | if (root === null) {
|
23720 | warnAboutUpdateOnUnmountedFiberInDEV(fiber);
|
23721 | return;
|
23722 | }
|
23723 |
|
23724 | checkForInterruption(fiber, expirationTime);
|
23725 | recordScheduleUpdate();
|
23726 |
|
23727 |
|
23728 | var priorityLevel = getCurrentPriorityLevel();
|
23729 |
|
23730 | if (expirationTime === Sync) {
|
23731 | if (
|
23732 | (executionContext & LegacyUnbatchedContext) !== NoContext &&
|
23733 | (executionContext & (RenderContext | CommitContext)) === NoContext) {
|
23734 |
|
23735 | schedulePendingInteractions(root, expirationTime);
|
23736 |
|
23737 |
|
23738 |
|
23739 | performSyncWorkOnRoot(root);
|
23740 | } else {
|
23741 | ensureRootIsScheduled(root);
|
23742 | schedulePendingInteractions(root, expirationTime);
|
23743 |
|
23744 | if (executionContext === NoContext) {
|
23745 |
|
23746 |
|
23747 |
|
23748 |
|
23749 |
|
23750 | flushSyncCallbackQueue();
|
23751 | }
|
23752 | }
|
23753 | } else {
|
23754 | ensureRootIsScheduled(root);
|
23755 | schedulePendingInteractions(root, expirationTime);
|
23756 | }
|
23757 |
|
23758 | if ((executionContext & DiscreteEventContext) !== NoContext && (
|
23759 |
|
23760 | priorityLevel === UserBlockingPriority$2 || priorityLevel === ImmediatePriority)) {
|
23761 |
|
23762 |
|
23763 | if (rootsWithPendingDiscreteUpdates === null) {
|
23764 | rootsWithPendingDiscreteUpdates = new Map([[root, expirationTime]]);
|
23765 | } else {
|
23766 | var lastDiscreteTime = rootsWithPendingDiscreteUpdates.get(root);
|
23767 |
|
23768 | if (lastDiscreteTime === undefined || lastDiscreteTime > expirationTime) {
|
23769 | rootsWithPendingDiscreteUpdates.set(root, expirationTime);
|
23770 | }
|
23771 | }
|
23772 | }
|
23773 | }
|
23774 | var scheduleWork = scheduleUpdateOnFiber;
|
23775 |
|
23776 |
|
23777 |
|
23778 |
|
23779 | function markUpdateTimeFromFiberToRoot(fiber, expirationTime) {
|
23780 |
|
23781 | if (fiber.expirationTime < expirationTime) {
|
23782 | fiber.expirationTime = expirationTime;
|
23783 | }
|
23784 |
|
23785 | var alternate = fiber.alternate;
|
23786 |
|
23787 | if (alternate !== null && alternate.expirationTime < expirationTime) {
|
23788 | alternate.expirationTime = expirationTime;
|
23789 | }
|
23790 |
|
23791 |
|
23792 | var node = fiber.return;
|
23793 | var root = null;
|
23794 |
|
23795 | if (node === null && fiber.tag === HostRoot) {
|
23796 | root = fiber.stateNode;
|
23797 | } else {
|
23798 | while (node !== null) {
|
23799 | alternate = node.alternate;
|
23800 |
|
23801 | if (node.childExpirationTime < expirationTime) {
|
23802 | node.childExpirationTime = expirationTime;
|
23803 |
|
23804 | if (alternate !== null && alternate.childExpirationTime < expirationTime) {
|
23805 | alternate.childExpirationTime = expirationTime;
|
23806 | }
|
23807 | } else if (alternate !== null && alternate.childExpirationTime < expirationTime) {
|
23808 | alternate.childExpirationTime = expirationTime;
|
23809 | }
|
23810 |
|
23811 | if (node.return === null && node.tag === HostRoot) {
|
23812 | root = node.stateNode;
|
23813 | break;
|
23814 | }
|
23815 |
|
23816 | node = node.return;
|
23817 | }
|
23818 | }
|
23819 |
|
23820 | if (root !== null) {
|
23821 | if (workInProgressRoot === root) {
|
23822 |
|
23823 |
|
23824 | markUnprocessedUpdateTime(expirationTime);
|
23825 |
|
23826 | if (workInProgressRootExitStatus === RootSuspendedWithDelay) {
|
23827 |
|
23828 |
|
23829 |
|
23830 |
|
23831 |
|
23832 |
|
23833 |
|
23834 |
|
23835 |
|
23836 |
|
23837 |
|
23838 |
|
23839 |
|
23840 | markRootSuspendedAtTime(root, renderExpirationTime);
|
23841 | }
|
23842 | }
|
23843 |
|
23844 |
|
23845 | markRootUpdatedAtTime(root, expirationTime);
|
23846 | }
|
23847 |
|
23848 | return root;
|
23849 | }
|
23850 |
|
23851 | function getNextRootExpirationTimeToWorkOn(root) {
|
23852 |
|
23853 |
|
23854 |
|
23855 | var lastExpiredTime = root.lastExpiredTime;
|
23856 |
|
23857 | if (lastExpiredTime !== NoWork) {
|
23858 | return lastExpiredTime;
|
23859 | }
|
23860 |
|
23861 |
|
23862 |
|
23863 | var firstPendingTime = root.firstPendingTime;
|
23864 |
|
23865 | if (!isRootSuspendedAtTime(root, firstPendingTime)) {
|
23866 |
|
23867 | return firstPendingTime;
|
23868 | }
|
23869 |
|
23870 |
|
23871 |
|
23872 |
|
23873 | var lastPingedTime = root.lastPingedTime;
|
23874 | var nextKnownPendingLevel = root.nextKnownPendingLevel;
|
23875 | return lastPingedTime > nextKnownPendingLevel ? lastPingedTime : nextKnownPendingLevel;
|
23876 | }
|
23877 |
|
23878 |
|
23879 |
|
23880 |
|
23881 |
|
23882 |
|
23883 | function ensureRootIsScheduled(root) {
|
23884 | var lastExpiredTime = root.lastExpiredTime;
|
23885 |
|
23886 | if (lastExpiredTime !== NoWork) {
|
23887 |
|
23888 | root.callbackExpirationTime = Sync;
|
23889 | root.callbackPriority = ImmediatePriority;
|
23890 | root.callbackNode = scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root));
|
23891 | return;
|
23892 | }
|
23893 |
|
23894 | var expirationTime = getNextRootExpirationTimeToWorkOn(root);
|
23895 | var existingCallbackNode = root.callbackNode;
|
23896 |
|
23897 | if (expirationTime === NoWork) {
|
23898 |
|
23899 | if (existingCallbackNode !== null) {
|
23900 | root.callbackNode = null;
|
23901 | root.callbackExpirationTime = NoWork;
|
23902 | root.callbackPriority = NoPriority;
|
23903 | }
|
23904 |
|
23905 | return;
|
23906 | }
|
23907 |
|
23908 |
|
23909 |
|
23910 | var currentTime = requestCurrentTime();
|
23911 | var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime);
|
23912 |
|
23913 |
|
23914 | if (existingCallbackNode !== null) {
|
23915 | var existingCallbackPriority = root.callbackPriority;
|
23916 | var existingCallbackExpirationTime = root.callbackExpirationTime;
|
23917 |
|
23918 | if (
|
23919 | existingCallbackExpirationTime === expirationTime &&
|
23920 | existingCallbackPriority >= priorityLevel) {
|
23921 |
|
23922 | return;
|
23923 | }
|
23924 |
|
23925 |
|
23926 |
|
23927 |
|
23928 | cancelCallback(existingCallbackNode);
|
23929 | }
|
23930 |
|
23931 | root.callbackExpirationTime = expirationTime;
|
23932 | root.callbackPriority = priorityLevel;
|
23933 | var callbackNode;
|
23934 |
|
23935 | if (expirationTime === Sync) {
|
23936 |
|
23937 | callbackNode = scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root));
|
23938 | } else if (disableSchedulerTimeoutBasedOnReactExpirationTime) {
|
23939 | callbackNode = scheduleCallback(priorityLevel, performConcurrentWorkOnRoot.bind(null, root));
|
23940 | } else {
|
23941 | callbackNode = scheduleCallback(priorityLevel, performConcurrentWorkOnRoot.bind(null, root),
|
23942 |
|
23943 | {
|
23944 | timeout: expirationTimeToMs(expirationTime) - now()
|
23945 | });
|
23946 | }
|
23947 |
|
23948 | root.callbackNode = callbackNode;
|
23949 | }
|
23950 |
|
23951 |
|
23952 |
|
23953 | function performConcurrentWorkOnRoot(root, didTimeout) {
|
23954 |
|
23955 |
|
23956 | currentEventTime = NoWork;
|
23957 |
|
23958 | if (didTimeout) {
|
23959 |
|
23960 |
|
23961 | var currentTime = requestCurrentTime();
|
23962 | markRootExpiredAtTime(root, currentTime);
|
23963 |
|
23964 | ensureRootIsScheduled(root);
|
23965 | return null;
|
23966 | }
|
23967 |
|
23968 |
|
23969 |
|
23970 | var expirationTime = getNextRootExpirationTimeToWorkOn(root);
|
23971 |
|
23972 | if (expirationTime !== NoWork) {
|
23973 | var originalCallbackNode = root.callbackNode;
|
23974 |
|
23975 | (function () {
|
23976 | if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
23977 | {
|
23978 | throw ReactError(Error("Should not already be working."));
|
23979 | }
|
23980 | }
|
23981 | })();
|
23982 |
|
23983 | flushPassiveEffects();
|
23984 |
|
23985 |
|
23986 | if (root !== workInProgressRoot || expirationTime !== renderExpirationTime) {
|
23987 | prepareFreshStack(root, expirationTime);
|
23988 | startWorkOnPendingInteractions(root, expirationTime);
|
23989 | }
|
23990 |
|
23991 |
|
23992 |
|
23993 | if (workInProgress !== null) {
|
23994 | var prevExecutionContext = executionContext;
|
23995 | executionContext |= RenderContext;
|
23996 | var prevDispatcher = pushDispatcher(root);
|
23997 | var prevInteractions = pushInteractions(root);
|
23998 | startWorkLoopTimer(workInProgress);
|
23999 |
|
24000 | do {
|
24001 | try {
|
24002 | workLoopConcurrent();
|
24003 | break;
|
24004 | } catch (thrownValue) {
|
24005 | handleError(root, thrownValue);
|
24006 | }
|
24007 | } while (true);
|
24008 |
|
24009 | resetContextDependencies();
|
24010 | executionContext = prevExecutionContext;
|
24011 | popDispatcher(prevDispatcher);
|
24012 |
|
24013 | if (enableSchedulerTracing) {
|
24014 | popInteractions(prevInteractions);
|
24015 | }
|
24016 |
|
24017 | if (workInProgressRootExitStatus === RootFatalErrored) {
|
24018 | var fatalError = workInProgressRootFatalError;
|
24019 | stopInterruptedWorkLoopTimer();
|
24020 | prepareFreshStack(root, expirationTime);
|
24021 | markRootSuspendedAtTime(root, expirationTime);
|
24022 | ensureRootIsScheduled(root);
|
24023 | throw fatalError;
|
24024 | }
|
24025 |
|
24026 | if (workInProgress !== null) {
|
24027 |
|
24028 | stopInterruptedWorkLoopTimer();
|
24029 | } else {
|
24030 |
|
24031 |
|
24032 | stopFinishedWorkLoopTimer();
|
24033 | var finishedWork = root.finishedWork = root.current.alternate;
|
24034 | root.finishedExpirationTime = expirationTime;
|
24035 | resolveLocksOnRoot(root, expirationTime);
|
24036 | finishConcurrentRender(root, finishedWork, workInProgressRootExitStatus, expirationTime);
|
24037 | }
|
24038 |
|
24039 | ensureRootIsScheduled(root);
|
24040 |
|
24041 | if (root.callbackNode === originalCallbackNode) {
|
24042 |
|
24043 |
|
24044 | return performConcurrentWorkOnRoot.bind(null, root);
|
24045 | }
|
24046 | }
|
24047 | }
|
24048 |
|
24049 | return null;
|
24050 | }
|
24051 |
|
24052 | function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime) {
|
24053 |
|
24054 | workInProgressRoot = null;
|
24055 |
|
24056 | switch (exitStatus) {
|
24057 | case RootIncomplete:
|
24058 | case RootFatalErrored:
|
24059 | {
|
24060 | (function () {
|
24061 | {
|
24062 | {
|
24063 | throw ReactError(Error("Root did not complete. This is a bug in React."));
|
24064 | }
|
24065 | }
|
24066 | })();
|
24067 | }
|
24068 |
|
24069 |
|
24070 |
|
24071 |
|
24072 | case RootErrored:
|
24073 | {
|
24074 | if (expirationTime !== Idle) {
|
24075 |
|
24076 |
|
24077 |
|
24078 |
|
24079 |
|
24080 | markRootExpiredAtTime(root, Idle);
|
24081 | break;
|
24082 | }
|
24083 |
|
24084 |
|
24085 | commitRoot(root);
|
24086 | break;
|
24087 | }
|
24088 |
|
24089 | case RootSuspended:
|
24090 | {
|
24091 | markRootSuspendedAtTime(root, expirationTime);
|
24092 | var lastSuspendedTime = root.lastSuspendedTime;
|
24093 |
|
24094 | if (expirationTime === lastSuspendedTime) {
|
24095 | root.nextKnownPendingLevel = getRemainingExpirationTime(finishedWork);
|
24096 | }
|
24097 |
|
24098 | flushSuspensePriorityWarningInDEV();
|
24099 |
|
24100 |
|
24101 |
|
24102 |
|
24103 |
|
24104 | var hasNotProcessedNewUpdates = workInProgressRootLatestProcessedExpirationTime === Sync;
|
24105 |
|
24106 | if (hasNotProcessedNewUpdates &&
|
24107 | !(true && flushSuspenseFallbacksInTests && IsThisRendererActing.current)) {
|
24108 |
|
24109 |
|
24110 |
|
24111 |
|
24112 |
|
24113 |
|
24114 | var msUntilTimeout = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now();
|
24115 |
|
24116 | if (msUntilTimeout > 10) {
|
24117 | if (workInProgressRootHasPendingPing) {
|
24118 | var lastPingedTime = root.lastPingedTime;
|
24119 |
|
24120 | if (lastPingedTime === NoWork || lastPingedTime >= expirationTime) {
|
24121 |
|
24122 |
|
24123 | root.lastPingedTime = expirationTime;
|
24124 | prepareFreshStack(root, expirationTime);
|
24125 | break;
|
24126 | }
|
24127 | }
|
24128 |
|
24129 | var nextTime = getNextRootExpirationTimeToWorkOn(root);
|
24130 |
|
24131 | if (nextTime !== NoWork && nextTime !== expirationTime) {
|
24132 |
|
24133 | break;
|
24134 | }
|
24135 |
|
24136 | if (lastSuspendedTime !== NoWork && lastSuspendedTime !== expirationTime) {
|
24137 |
|
24138 |
|
24139 |
|
24140 | root.lastPingedTime = lastSuspendedTime;
|
24141 | break;
|
24142 | }
|
24143 |
|
24144 |
|
24145 |
|
24146 |
|
24147 | root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), msUntilTimeout);
|
24148 | break;
|
24149 | }
|
24150 | }
|
24151 |
|
24152 |
|
24153 | commitRoot(root);
|
24154 | break;
|
24155 | }
|
24156 |
|
24157 | case RootSuspendedWithDelay:
|
24158 | {
|
24159 | markRootSuspendedAtTime(root, expirationTime);
|
24160 | var _lastSuspendedTime = root.lastSuspendedTime;
|
24161 |
|
24162 | if (expirationTime === _lastSuspendedTime) {
|
24163 | root.nextKnownPendingLevel = getRemainingExpirationTime(finishedWork);
|
24164 | }
|
24165 |
|
24166 | flushSuspensePriorityWarningInDEV();
|
24167 |
|
24168 | if (
|
24169 | !(true && flushSuspenseFallbacksInTests && IsThisRendererActing.current)) {
|
24170 |
|
24171 |
|
24172 | if (workInProgressRootHasPendingPing) {
|
24173 | var _lastPingedTime = root.lastPingedTime;
|
24174 |
|
24175 | if (_lastPingedTime === NoWork || _lastPingedTime >= expirationTime) {
|
24176 |
|
24177 |
|
24178 | root.lastPingedTime = expirationTime;
|
24179 | prepareFreshStack(root, expirationTime);
|
24180 | break;
|
24181 | }
|
24182 | }
|
24183 |
|
24184 | var _nextTime = getNextRootExpirationTimeToWorkOn(root);
|
24185 |
|
24186 | if (_nextTime !== NoWork && _nextTime !== expirationTime) {
|
24187 |
|
24188 | break;
|
24189 | }
|
24190 |
|
24191 | if (_lastSuspendedTime !== NoWork && _lastSuspendedTime !== expirationTime) {
|
24192 |
|
24193 |
|
24194 |
|
24195 | root.lastPingedTime = _lastSuspendedTime;
|
24196 | break;
|
24197 | }
|
24198 |
|
24199 | var _msUntilTimeout;
|
24200 |
|
24201 | if (workInProgressRootLatestSuspenseTimeout !== Sync) {
|
24202 |
|
24203 |
|
24204 | _msUntilTimeout = expirationTimeToMs(workInProgressRootLatestSuspenseTimeout) - now();
|
24205 | } else if (workInProgressRootLatestProcessedExpirationTime === Sync) {
|
24206 |
|
24207 |
|
24208 |
|
24209 | _msUntilTimeout = 0;
|
24210 | } else {
|
24211 |
|
24212 |
|
24213 | var eventTimeMs = inferTimeFromExpirationTime(workInProgressRootLatestProcessedExpirationTime);
|
24214 | var currentTimeMs = now();
|
24215 | var timeUntilExpirationMs = expirationTimeToMs(expirationTime) - currentTimeMs;
|
24216 | var timeElapsed = currentTimeMs - eventTimeMs;
|
24217 |
|
24218 | if (timeElapsed < 0) {
|
24219 |
|
24220 | timeElapsed = 0;
|
24221 | }
|
24222 |
|
24223 | _msUntilTimeout = jnd(timeElapsed) - timeElapsed;
|
24224 |
|
24225 |
|
24226 |
|
24227 | if (timeUntilExpirationMs < _msUntilTimeout) {
|
24228 | _msUntilTimeout = timeUntilExpirationMs;
|
24229 | }
|
24230 | }
|
24231 |
|
24232 |
|
24233 | if (_msUntilTimeout > 10) {
|
24234 |
|
24235 |
|
24236 |
|
24237 | root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), _msUntilTimeout);
|
24238 | break;
|
24239 | }
|
24240 | }
|
24241 |
|
24242 |
|
24243 | commitRoot(root);
|
24244 | break;
|
24245 | }
|
24246 |
|
24247 | case RootCompleted:
|
24248 | {
|
24249 |
|
24250 | if (
|
24251 | !(true && flushSuspenseFallbacksInTests && IsThisRendererActing.current) && workInProgressRootLatestProcessedExpirationTime !== Sync && workInProgressRootCanSuspendUsingConfig !== null) {
|
24252 |
|
24253 |
|
24254 |
|
24255 |
|
24256 | var _msUntilTimeout2 = computeMsUntilSuspenseLoadingDelay(workInProgressRootLatestProcessedExpirationTime, expirationTime, workInProgressRootCanSuspendUsingConfig);
|
24257 |
|
24258 | if (_msUntilTimeout2 > 10) {
|
24259 | markRootSuspendedAtTime(root, expirationTime);
|
24260 | root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), _msUntilTimeout2);
|
24261 | break;
|
24262 | }
|
24263 | }
|
24264 |
|
24265 | commitRoot(root);
|
24266 | break;
|
24267 | }
|
24268 |
|
24269 | case RootLocked:
|
24270 | {
|
24271 |
|
24272 |
|
24273 |
|
24274 | markRootSuspendedAtTime(root, expirationTime);
|
24275 | break;
|
24276 | }
|
24277 |
|
24278 | default:
|
24279 | {
|
24280 | (function () {
|
24281 | {
|
24282 | {
|
24283 | throw ReactError(Error("Unknown root exit status."));
|
24284 | }
|
24285 | }
|
24286 | })();
|
24287 | }
|
24288 | }
|
24289 | }
|
24290 |
|
24291 |
|
24292 |
|
24293 | function performSyncWorkOnRoot(root) {
|
24294 |
|
24295 | var lastExpiredTime = root.lastExpiredTime;
|
24296 | var expirationTime = lastExpiredTime !== NoWork ? lastExpiredTime : Sync;
|
24297 |
|
24298 | if (root.finishedExpirationTime === expirationTime) {
|
24299 |
|
24300 |
|
24301 |
|
24302 | commitRoot(root);
|
24303 | } else {
|
24304 | (function () {
|
24305 | if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
24306 | {
|
24307 | throw ReactError(Error("Should not already be working."));
|
24308 | }
|
24309 | }
|
24310 | })();
|
24311 |
|
24312 | flushPassiveEffects();
|
24313 |
|
24314 |
|
24315 | if (root !== workInProgressRoot || expirationTime !== renderExpirationTime) {
|
24316 | prepareFreshStack(root, expirationTime);
|
24317 | startWorkOnPendingInteractions(root, expirationTime);
|
24318 | }
|
24319 |
|
24320 |
|
24321 |
|
24322 | if (workInProgress !== null) {
|
24323 | var prevExecutionContext = executionContext;
|
24324 | executionContext |= RenderContext;
|
24325 | var prevDispatcher = pushDispatcher(root);
|
24326 | var prevInteractions = pushInteractions(root);
|
24327 | startWorkLoopTimer(workInProgress);
|
24328 |
|
24329 | do {
|
24330 | try {
|
24331 | workLoopSync();
|
24332 | break;
|
24333 | } catch (thrownValue) {
|
24334 | handleError(root, thrownValue);
|
24335 | }
|
24336 | } while (true);
|
24337 |
|
24338 | resetContextDependencies();
|
24339 | executionContext = prevExecutionContext;
|
24340 | popDispatcher(prevDispatcher);
|
24341 |
|
24342 | if (enableSchedulerTracing) {
|
24343 | popInteractions(prevInteractions);
|
24344 | }
|
24345 |
|
24346 | if (workInProgressRootExitStatus === RootFatalErrored) {
|
24347 | var fatalError = workInProgressRootFatalError;
|
24348 | stopInterruptedWorkLoopTimer();
|
24349 | prepareFreshStack(root, expirationTime);
|
24350 | markRootSuspendedAtTime(root, expirationTime);
|
24351 | ensureRootIsScheduled(root);
|
24352 | throw fatalError;
|
24353 | }
|
24354 |
|
24355 | if (workInProgress !== null) {
|
24356 |
|
24357 | (function () {
|
24358 | {
|
24359 | {
|
24360 | throw ReactError(Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue."));
|
24361 | }
|
24362 | }
|
24363 | })();
|
24364 | } else {
|
24365 |
|
24366 |
|
24367 |
|
24368 | stopFinishedWorkLoopTimer();
|
24369 | root.finishedWork = root.current.alternate;
|
24370 | root.finishedExpirationTime = expirationTime;
|
24371 | resolveLocksOnRoot(root, expirationTime);
|
24372 | finishSyncRender(root, workInProgressRootExitStatus, expirationTime);
|
24373 | }
|
24374 |
|
24375 |
|
24376 |
|
24377 | ensureRootIsScheduled(root);
|
24378 | }
|
24379 | }
|
24380 |
|
24381 | return null;
|
24382 | }
|
24383 |
|
24384 | function finishSyncRender(root, exitStatus, expirationTime) {
|
24385 | if (exitStatus === RootLocked) {
|
24386 |
|
24387 |
|
24388 |
|
24389 | markRootSuspendedAtTime(root, expirationTime);
|
24390 | } else {
|
24391 |
|
24392 | workInProgressRoot = null;
|
24393 |
|
24394 | {
|
24395 | if (exitStatus === RootSuspended || exitStatus === RootSuspendedWithDelay) {
|
24396 | flushSuspensePriorityWarningInDEV();
|
24397 | }
|
24398 | }
|
24399 |
|
24400 | commitRoot(root);
|
24401 | }
|
24402 | }
|
24403 |
|
24404 | function flushRoot(root, expirationTime) {
|
24405 | if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
24406 | (function () {
|
24407 | {
|
24408 | {
|
24409 | throw ReactError(Error("work.commit(): Cannot commit while already rendering. This likely means you attempted to commit from inside a lifecycle method."));
|
24410 | }
|
24411 | }
|
24412 | })();
|
24413 | }
|
24414 |
|
24415 | markRootExpiredAtTime(root, expirationTime);
|
24416 | ensureRootIsScheduled(root);
|
24417 | flushSyncCallbackQueue();
|
24418 | }
|
24419 | function flushDiscreteUpdates() {
|
24420 |
|
24421 |
|
24422 |
|
24423 |
|
24424 | if ((executionContext & (BatchedContext | RenderContext | CommitContext)) !== NoContext) {
|
24425 | if (true && (executionContext & RenderContext) !== NoContext) {
|
24426 | warning$1(false, 'unstable_flushDiscreteUpdates: Cannot flush updates when React is ' + 'already rendering.');
|
24427 | }
|
24428 |
|
24429 |
|
24430 |
|
24431 |
|
24432 | return;
|
24433 | }
|
24434 |
|
24435 | flushPendingDiscreteUpdates();
|
24436 |
|
24437 |
|
24438 | flushPassiveEffects();
|
24439 | }
|
24440 |
|
24441 | function resolveLocksOnRoot(root, expirationTime) {
|
24442 | var firstBatch = root.firstBatch;
|
24443 |
|
24444 | if (firstBatch !== null && firstBatch._defer && firstBatch._expirationTime >= expirationTime) {
|
24445 | scheduleCallback(NormalPriority, function () {
|
24446 | firstBatch._onComplete();
|
24447 |
|
24448 | return null;
|
24449 | });
|
24450 | workInProgressRootExitStatus = RootLocked;
|
24451 | }
|
24452 | }
|
24453 |
|
24454 |
|
24455 |
|
24456 |
|
24457 | function flushPendingDiscreteUpdates() {
|
24458 | if (rootsWithPendingDiscreteUpdates !== null) {
|
24459 |
|
24460 |
|
24461 | var roots = rootsWithPendingDiscreteUpdates;
|
24462 | rootsWithPendingDiscreteUpdates = null;
|
24463 | roots.forEach(function (expirationTime, root) {
|
24464 | markRootExpiredAtTime(root, expirationTime);
|
24465 | ensureRootIsScheduled(root);
|
24466 | });
|
24467 |
|
24468 | flushSyncCallbackQueue();
|
24469 | }
|
24470 | }
|
24471 |
|
24472 | function batchedUpdates$1(fn, a) {
|
24473 | var prevExecutionContext = executionContext;
|
24474 | executionContext |= BatchedContext;
|
24475 |
|
24476 | try {
|
24477 | return fn(a);
|
24478 | } finally {
|
24479 | executionContext = prevExecutionContext;
|
24480 |
|
24481 | if (executionContext === NoContext) {
|
24482 |
|
24483 | flushSyncCallbackQueue();
|
24484 | }
|
24485 | }
|
24486 | }
|
24487 | function batchedEventUpdates$1(fn, a) {
|
24488 | var prevExecutionContext = executionContext;
|
24489 | executionContext |= EventContext;
|
24490 |
|
24491 | try {
|
24492 | return fn(a);
|
24493 | } finally {
|
24494 | executionContext = prevExecutionContext;
|
24495 |
|
24496 | if (executionContext === NoContext) {
|
24497 |
|
24498 | flushSyncCallbackQueue();
|
24499 | }
|
24500 | }
|
24501 | }
|
24502 | function discreteUpdates$1(fn, a, b, c) {
|
24503 | var prevExecutionContext = executionContext;
|
24504 | executionContext |= DiscreteEventContext;
|
24505 |
|
24506 | try {
|
24507 |
|
24508 | return runWithPriority$2(UserBlockingPriority$2, fn.bind(null, a, b, c));
|
24509 | } finally {
|
24510 | executionContext = prevExecutionContext;
|
24511 |
|
24512 | if (executionContext === NoContext) {
|
24513 |
|
24514 | flushSyncCallbackQueue();
|
24515 | }
|
24516 | }
|
24517 | }
|
24518 | function unbatchedUpdates(fn, a) {
|
24519 | var prevExecutionContext = executionContext;
|
24520 | executionContext &= ~BatchedContext;
|
24521 | executionContext |= LegacyUnbatchedContext;
|
24522 |
|
24523 | try {
|
24524 | return fn(a);
|
24525 | } finally {
|
24526 | executionContext = prevExecutionContext;
|
24527 |
|
24528 | if (executionContext === NoContext) {
|
24529 |
|
24530 | flushSyncCallbackQueue();
|
24531 | }
|
24532 | }
|
24533 | }
|
24534 | function flushSync(fn, a) {
|
24535 | if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
24536 | (function () {
|
24537 | {
|
24538 | {
|
24539 | throw ReactError(Error("flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering."));
|
24540 | }
|
24541 | }
|
24542 | })();
|
24543 | }
|
24544 |
|
24545 | var prevExecutionContext = executionContext;
|
24546 | executionContext |= BatchedContext;
|
24547 |
|
24548 | try {
|
24549 | return runWithPriority$2(ImmediatePriority, fn.bind(null, a));
|
24550 | } finally {
|
24551 | executionContext = prevExecutionContext;
|
24552 |
|
24553 |
|
24554 |
|
24555 | flushSyncCallbackQueue();
|
24556 | }
|
24557 | }
|
24558 | function flushControlled(fn) {
|
24559 | var prevExecutionContext = executionContext;
|
24560 | executionContext |= BatchedContext;
|
24561 |
|
24562 | try {
|
24563 | runWithPriority$2(ImmediatePriority, fn);
|
24564 | } finally {
|
24565 | executionContext = prevExecutionContext;
|
24566 |
|
24567 | if (executionContext === NoContext) {
|
24568 |
|
24569 | flushSyncCallbackQueue();
|
24570 | }
|
24571 | }
|
24572 | }
|
24573 |
|
24574 | function prepareFreshStack(root, expirationTime) {
|
24575 | root.finishedWork = null;
|
24576 | root.finishedExpirationTime = NoWork;
|
24577 | var timeoutHandle = root.timeoutHandle;
|
24578 |
|
24579 | if (timeoutHandle !== noTimeout) {
|
24580 |
|
24581 |
|
24582 | root.timeoutHandle = noTimeout;
|
24583 |
|
24584 | cancelTimeout(timeoutHandle);
|
24585 | }
|
24586 |
|
24587 | if (workInProgress !== null) {
|
24588 | var interruptedWork = workInProgress.return;
|
24589 |
|
24590 | while (interruptedWork !== null) {
|
24591 | unwindInterruptedWork(interruptedWork);
|
24592 | interruptedWork = interruptedWork.return;
|
24593 | }
|
24594 | }
|
24595 |
|
24596 | workInProgressRoot = root;
|
24597 | workInProgress = createWorkInProgress(root.current, null, expirationTime);
|
24598 | renderExpirationTime = expirationTime;
|
24599 | workInProgressRootExitStatus = RootIncomplete;
|
24600 | workInProgressRootFatalError = null;
|
24601 | workInProgressRootLatestProcessedExpirationTime = Sync;
|
24602 | workInProgressRootLatestSuspenseTimeout = Sync;
|
24603 | workInProgressRootCanSuspendUsingConfig = null;
|
24604 | workInProgressRootNextUnprocessedUpdateTime = NoWork;
|
24605 | workInProgressRootHasPendingPing = false;
|
24606 |
|
24607 | if (enableSchedulerTracing) {
|
24608 | spawnedWorkDuringRender = null;
|
24609 | }
|
24610 |
|
24611 | {
|
24612 | ReactStrictModeWarnings.discardPendingWarnings();
|
24613 | componentsThatTriggeredHighPriSuspend = null;
|
24614 | }
|
24615 | }
|
24616 |
|
24617 | function handleError(root, thrownValue) {
|
24618 | do {
|
24619 | try {
|
24620 |
|
24621 | resetContextDependencies();
|
24622 | resetHooks();
|
24623 |
|
24624 | if (workInProgress === null || workInProgress.return === null) {
|
24625 |
|
24626 |
|
24627 |
|
24628 |
|
24629 | workInProgressRootExitStatus = RootFatalErrored;
|
24630 | workInProgressRootFatalError = thrownValue;
|
24631 | return null;
|
24632 | }
|
24633 |
|
24634 | if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
|
24635 |
|
24636 |
|
24637 |
|
24638 | stopProfilerTimerIfRunningAndRecordDelta(workInProgress, true);
|
24639 | }
|
24640 |
|
24641 | throwException(root, workInProgress.return, workInProgress, thrownValue, renderExpirationTime);
|
24642 | workInProgress = completeUnitOfWork(workInProgress);
|
24643 | } catch (yetAnotherThrownValue) {
|
24644 |
|
24645 | thrownValue = yetAnotherThrownValue;
|
24646 | continue;
|
24647 | }
|
24648 |
|
24649 |
|
24650 | return;
|
24651 | } while (true);
|
24652 | }
|
24653 |
|
24654 | function pushDispatcher(root) {
|
24655 | var prevDispatcher = ReactCurrentDispatcher.current;
|
24656 | ReactCurrentDispatcher.current = ContextOnlyDispatcher;
|
24657 |
|
24658 | if (prevDispatcher === null) {
|
24659 |
|
24660 |
|
24661 |
|
24662 | return ContextOnlyDispatcher;
|
24663 | } else {
|
24664 | return prevDispatcher;
|
24665 | }
|
24666 | }
|
24667 |
|
24668 | function popDispatcher(prevDispatcher) {
|
24669 | ReactCurrentDispatcher.current = prevDispatcher;
|
24670 | }
|
24671 |
|
24672 | function pushInteractions(root) {
|
24673 | if (enableSchedulerTracing) {
|
24674 | var prevInteractions = __interactionsRef.current;
|
24675 | __interactionsRef.current = root.memoizedInteractions;
|
24676 | return prevInteractions;
|
24677 | }
|
24678 |
|
24679 | return null;
|
24680 | }
|
24681 |
|
24682 | function popInteractions(prevInteractions) {
|
24683 | if (enableSchedulerTracing) {
|
24684 | __interactionsRef.current = prevInteractions;
|
24685 | }
|
24686 | }
|
24687 |
|
24688 | function markCommitTimeOfFallback() {
|
24689 | globalMostRecentFallbackTime = now();
|
24690 | }
|
24691 | function markRenderEventTimeAndConfig(expirationTime, suspenseConfig) {
|
24692 | if (expirationTime < workInProgressRootLatestProcessedExpirationTime && expirationTime > Idle) {
|
24693 | workInProgressRootLatestProcessedExpirationTime = expirationTime;
|
24694 | }
|
24695 |
|
24696 | if (suspenseConfig !== null) {
|
24697 | if (expirationTime < workInProgressRootLatestSuspenseTimeout && expirationTime > Idle) {
|
24698 | workInProgressRootLatestSuspenseTimeout = expirationTime;
|
24699 |
|
24700 | workInProgressRootCanSuspendUsingConfig = suspenseConfig;
|
24701 | }
|
24702 | }
|
24703 | }
|
24704 | function markUnprocessedUpdateTime(expirationTime) {
|
24705 | if (expirationTime > workInProgressRootNextUnprocessedUpdateTime) {
|
24706 | workInProgressRootNextUnprocessedUpdateTime = expirationTime;
|
24707 | }
|
24708 | }
|
24709 | function renderDidSuspend() {
|
24710 | if (workInProgressRootExitStatus === RootIncomplete) {
|
24711 | workInProgressRootExitStatus = RootSuspended;
|
24712 | }
|
24713 | }
|
24714 | function renderDidSuspendDelayIfPossible() {
|
24715 | if (workInProgressRootExitStatus === RootIncomplete || workInProgressRootExitStatus === RootSuspended) {
|
24716 | workInProgressRootExitStatus = RootSuspendedWithDelay;
|
24717 | }
|
24718 |
|
24719 |
|
24720 | if (workInProgressRootNextUnprocessedUpdateTime !== NoWork && workInProgressRoot !== null) {
|
24721 |
|
24722 |
|
24723 |
|
24724 |
|
24725 | markRootSuspendedAtTime(workInProgressRoot, renderExpirationTime);
|
24726 | markRootUpdatedAtTime(workInProgressRoot, workInProgressRootNextUnprocessedUpdateTime);
|
24727 | }
|
24728 | }
|
24729 | function renderDidError() {
|
24730 | if (workInProgressRootExitStatus !== RootCompleted) {
|
24731 | workInProgressRootExitStatus = RootErrored;
|
24732 | }
|
24733 | }
|
24734 |
|
24735 |
|
24736 | function renderHasNotSuspendedYet() {
|
24737 |
|
24738 |
|
24739 | return workInProgressRootExitStatus === RootIncomplete;
|
24740 | }
|
24741 |
|
24742 | function inferTimeFromExpirationTime(expirationTime) {
|
24743 |
|
24744 |
|
24745 | var earliestExpirationTimeMs = expirationTimeToMs(expirationTime);
|
24746 | return earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION;
|
24747 | }
|
24748 |
|
24749 | function inferTimeFromExpirationTimeWithSuspenseConfig(expirationTime, suspenseConfig) {
|
24750 |
|
24751 |
|
24752 |
|
24753 | var earliestExpirationTimeMs = expirationTimeToMs(expirationTime);
|
24754 | return earliestExpirationTimeMs - (suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION);
|
24755 | }
|
24756 |
|
24757 |
|
24758 |
|
24759 |
|
24760 | function workLoopSync() {
|
24761 |
|
24762 | while (workInProgress !== null) {
|
24763 | workInProgress = performUnitOfWork(workInProgress);
|
24764 | }
|
24765 | }
|
24766 |
|
24767 |
|
24768 |
|
24769 | function workLoopConcurrent() {
|
24770 |
|
24771 | while (workInProgress !== null && !shouldYield()) {
|
24772 | workInProgress = performUnitOfWork(workInProgress);
|
24773 | }
|
24774 | }
|
24775 |
|
24776 | function performUnitOfWork(unitOfWork) {
|
24777 |
|
24778 |
|
24779 |
|
24780 | var current$$1 = unitOfWork.alternate;
|
24781 | startWorkTimer(unitOfWork);
|
24782 | setCurrentFiber(unitOfWork);
|
24783 | var next;
|
24784 |
|
24785 | if (enableProfilerTimer && (unitOfWork.mode & ProfileMode) !== NoMode) {
|
24786 | startProfilerTimer(unitOfWork);
|
24787 | next = beginWork$$1(current$$1, unitOfWork, renderExpirationTime);
|
24788 | stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true);
|
24789 | } else {
|
24790 | next = beginWork$$1(current$$1, unitOfWork, renderExpirationTime);
|
24791 | }
|
24792 |
|
24793 | resetCurrentFiber();
|
24794 | unitOfWork.memoizedProps = unitOfWork.pendingProps;
|
24795 |
|
24796 | if (next === null) {
|
24797 |
|
24798 | next = completeUnitOfWork(unitOfWork);
|
24799 | }
|
24800 |
|
24801 | ReactCurrentOwner$2.current = null;
|
24802 | return next;
|
24803 | }
|
24804 |
|
24805 | function completeUnitOfWork(unitOfWork) {
|
24806 |
|
24807 |
|
24808 | workInProgress = unitOfWork;
|
24809 |
|
24810 | do {
|
24811 |
|
24812 |
|
24813 |
|
24814 | var current$$1 = workInProgress.alternate;
|
24815 | var returnFiber = workInProgress.return;
|
24816 |
|
24817 | if ((workInProgress.effectTag & Incomplete) === NoEffect) {
|
24818 | setCurrentFiber(workInProgress);
|
24819 | var next = void 0;
|
24820 |
|
24821 | if (!enableProfilerTimer || (workInProgress.mode & ProfileMode) === NoMode) {
|
24822 | next = completeWork(current$$1, workInProgress, renderExpirationTime);
|
24823 | } else {
|
24824 | startProfilerTimer(workInProgress);
|
24825 | next = completeWork(current$$1, workInProgress, renderExpirationTime);
|
24826 |
|
24827 | stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false);
|
24828 | }
|
24829 |
|
24830 | stopWorkTimer(workInProgress);
|
24831 | resetCurrentFiber();
|
24832 | resetChildExpirationTime(workInProgress);
|
24833 |
|
24834 | if (next !== null) {
|
24835 |
|
24836 | return next;
|
24837 | }
|
24838 |
|
24839 | if (returnFiber !== null &&
|
24840 | (returnFiber.effectTag & Incomplete) === NoEffect) {
|
24841 |
|
24842 |
|
24843 |
|
24844 | if (returnFiber.firstEffect === null) {
|
24845 | returnFiber.firstEffect = workInProgress.firstEffect;
|
24846 | }
|
24847 |
|
24848 | if (workInProgress.lastEffect !== null) {
|
24849 | if (returnFiber.lastEffect !== null) {
|
24850 | returnFiber.lastEffect.nextEffect = workInProgress.firstEffect;
|
24851 | }
|
24852 |
|
24853 | returnFiber.lastEffect = workInProgress.lastEffect;
|
24854 | }
|
24855 |
|
24856 |
|
24857 |
|
24858 |
|
24859 |
|
24860 |
|
24861 |
|
24862 | var effectTag = workInProgress.effectTag;
|
24863 |
|
24864 |
|
24865 |
|
24866 | if (effectTag > PerformedWork) {
|
24867 | if (returnFiber.lastEffect !== null) {
|
24868 | returnFiber.lastEffect.nextEffect = workInProgress;
|
24869 | } else {
|
24870 | returnFiber.firstEffect = workInProgress;
|
24871 | }
|
24872 |
|
24873 | returnFiber.lastEffect = workInProgress;
|
24874 | }
|
24875 | }
|
24876 | } else {
|
24877 |
|
24878 |
|
24879 |
|
24880 | var _next = unwindWork(workInProgress, renderExpirationTime);
|
24881 |
|
24882 |
|
24883 | if (enableProfilerTimer && (workInProgress.mode & ProfileMode) !== NoMode) {
|
24884 |
|
24885 | stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false);
|
24886 |
|
24887 | var actualDuration = workInProgress.actualDuration;
|
24888 | var child = workInProgress.child;
|
24889 |
|
24890 | while (child !== null) {
|
24891 | actualDuration += child.actualDuration;
|
24892 | child = child.sibling;
|
24893 | }
|
24894 |
|
24895 | workInProgress.actualDuration = actualDuration;
|
24896 | }
|
24897 |
|
24898 | if (_next !== null) {
|
24899 |
|
24900 |
|
24901 |
|
24902 |
|
24903 |
|
24904 |
|
24905 | stopFailedWorkTimer(workInProgress);
|
24906 | _next.effectTag &= HostEffectMask;
|
24907 | return _next;
|
24908 | }
|
24909 |
|
24910 | stopWorkTimer(workInProgress);
|
24911 |
|
24912 | if (returnFiber !== null) {
|
24913 |
|
24914 | returnFiber.firstEffect = returnFiber.lastEffect = null;
|
24915 | returnFiber.effectTag |= Incomplete;
|
24916 | }
|
24917 | }
|
24918 |
|
24919 | var siblingFiber = workInProgress.sibling;
|
24920 |
|
24921 | if (siblingFiber !== null) {
|
24922 |
|
24923 | return siblingFiber;
|
24924 | }
|
24925 |
|
24926 |
|
24927 | workInProgress = returnFiber;
|
24928 | } while (workInProgress !== null);
|
24929 |
|
24930 |
|
24931 | if (workInProgressRootExitStatus === RootIncomplete) {
|
24932 | workInProgressRootExitStatus = RootCompleted;
|
24933 | }
|
24934 |
|
24935 | return null;
|
24936 | }
|
24937 |
|
24938 | function getRemainingExpirationTime(fiber) {
|
24939 | var updateExpirationTime = fiber.expirationTime;
|
24940 | var childExpirationTime = fiber.childExpirationTime;
|
24941 | return updateExpirationTime > childExpirationTime ? updateExpirationTime : childExpirationTime;
|
24942 | }
|
24943 |
|
24944 | function resetChildExpirationTime(completedWork) {
|
24945 | if (renderExpirationTime !== Never && completedWork.childExpirationTime === Never) {
|
24946 |
|
24947 |
|
24948 | return;
|
24949 | }
|
24950 |
|
24951 | var newChildExpirationTime = NoWork;
|
24952 |
|
24953 | if (enableProfilerTimer && (completedWork.mode & ProfileMode) !== NoMode) {
|
24954 |
|
24955 |
|
24956 | var actualDuration = completedWork.actualDuration;
|
24957 | var treeBaseDuration = completedWork.selfBaseDuration;
|
24958 |
|
24959 |
|
24960 |
|
24961 |
|
24962 |
|
24963 |
|
24964 |
|
24965 | var shouldBubbleActualDurations = completedWork.alternate === null || completedWork.child !== completedWork.alternate.child;
|
24966 | var child = completedWork.child;
|
24967 |
|
24968 | while (child !== null) {
|
24969 | var childUpdateExpirationTime = child.expirationTime;
|
24970 | var childChildExpirationTime = child.childExpirationTime;
|
24971 |
|
24972 | if (childUpdateExpirationTime > newChildExpirationTime) {
|
24973 | newChildExpirationTime = childUpdateExpirationTime;
|
24974 | }
|
24975 |
|
24976 | if (childChildExpirationTime > newChildExpirationTime) {
|
24977 | newChildExpirationTime = childChildExpirationTime;
|
24978 | }
|
24979 |
|
24980 | if (shouldBubbleActualDurations) {
|
24981 | actualDuration += child.actualDuration;
|
24982 | }
|
24983 |
|
24984 | treeBaseDuration += child.treeBaseDuration;
|
24985 | child = child.sibling;
|
24986 | }
|
24987 |
|
24988 | completedWork.actualDuration = actualDuration;
|
24989 | completedWork.treeBaseDuration = treeBaseDuration;
|
24990 | } else {
|
24991 | var _child = completedWork.child;
|
24992 |
|
24993 | while (_child !== null) {
|
24994 | var _childUpdateExpirationTime = _child.expirationTime;
|
24995 | var _childChildExpirationTime = _child.childExpirationTime;
|
24996 |
|
24997 | if (_childUpdateExpirationTime > newChildExpirationTime) {
|
24998 | newChildExpirationTime = _childUpdateExpirationTime;
|
24999 | }
|
25000 |
|
25001 | if (_childChildExpirationTime > newChildExpirationTime) {
|
25002 | newChildExpirationTime = _childChildExpirationTime;
|
25003 | }
|
25004 |
|
25005 | _child = _child.sibling;
|
25006 | }
|
25007 | }
|
25008 |
|
25009 | completedWork.childExpirationTime = newChildExpirationTime;
|
25010 | }
|
25011 |
|
25012 | function commitRoot(root) {
|
25013 | var renderPriorityLevel = getCurrentPriorityLevel();
|
25014 | runWithPriority$2(ImmediatePriority, commitRootImpl.bind(null, root, renderPriorityLevel));
|
25015 | return null;
|
25016 | }
|
25017 |
|
25018 | function commitRootImpl(root, renderPriorityLevel) {
|
25019 | flushPassiveEffects();
|
25020 | flushRenderPhaseStrictModeWarningsInDEV();
|
25021 |
|
25022 | (function () {
|
25023 | if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
25024 | {
|
25025 | throw ReactError(Error("Should not already be working."));
|
25026 | }
|
25027 | }
|
25028 | })();
|
25029 |
|
25030 | var finishedWork = root.finishedWork;
|
25031 | var expirationTime = root.finishedExpirationTime;
|
25032 |
|
25033 | if (finishedWork === null) {
|
25034 | return null;
|
25035 | }
|
25036 |
|
25037 | root.finishedWork = null;
|
25038 | root.finishedExpirationTime = NoWork;
|
25039 |
|
25040 | (function () {
|
25041 | if (!(finishedWork !== root.current)) {
|
25042 | {
|
25043 | throw ReactError(Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue."));
|
25044 | }
|
25045 | }
|
25046 | })();
|
25047 |
|
25048 |
|
25049 |
|
25050 | root.callbackNode = null;
|
25051 | root.callbackExpirationTime = NoWork;
|
25052 | root.callbackPriority = NoPriority;
|
25053 | root.nextKnownPendingLevel = NoWork;
|
25054 | startCommitTimer();
|
25055 |
|
25056 |
|
25057 | var remainingExpirationTimeBeforeCommit = getRemainingExpirationTime(finishedWork);
|
25058 | markRootFinishedAtTime(root, expirationTime, remainingExpirationTimeBeforeCommit);
|
25059 |
|
25060 | if (root === workInProgressRoot) {
|
25061 |
|
25062 | workInProgressRoot = null;
|
25063 | workInProgress = null;
|
25064 | renderExpirationTime = NoWork;
|
25065 | } else {}
|
25066 |
|
25067 |
|
25068 |
|
25069 |
|
25070 |
|
25071 | var firstEffect;
|
25072 |
|
25073 | if (finishedWork.effectTag > PerformedWork) {
|
25074 |
|
25075 |
|
25076 |
|
25077 |
|
25078 | if (finishedWork.lastEffect !== null) {
|
25079 | finishedWork.lastEffect.nextEffect = finishedWork;
|
25080 | firstEffect = finishedWork.firstEffect;
|
25081 | } else {
|
25082 | firstEffect = finishedWork;
|
25083 | }
|
25084 | } else {
|
25085 |
|
25086 | firstEffect = finishedWork.firstEffect;
|
25087 | }
|
25088 |
|
25089 | if (firstEffect !== null) {
|
25090 | var prevExecutionContext = executionContext;
|
25091 | executionContext |= CommitContext;
|
25092 | var prevInteractions = pushInteractions(root);
|
25093 |
|
25094 | ReactCurrentOwner$2.current = null;
|
25095 |
|
25096 |
|
25097 |
|
25098 |
|
25099 |
|
25100 |
|
25101 | startCommitSnapshotEffectsTimer();
|
25102 | prepareForCommit(root.containerInfo);
|
25103 | nextEffect = firstEffect;
|
25104 |
|
25105 | do {
|
25106 | {
|
25107 | invokeGuardedCallback(null, commitBeforeMutationEffects, null);
|
25108 |
|
25109 | if (hasCaughtError()) {
|
25110 | (function () {
|
25111 | if (!(nextEffect !== null)) {
|
25112 | {
|
25113 | throw ReactError(Error("Should be working on an effect."));
|
25114 | }
|
25115 | }
|
25116 | })();
|
25117 |
|
25118 | var error = clearCaughtError();
|
25119 | captureCommitPhaseError(nextEffect, error);
|
25120 | nextEffect = nextEffect.nextEffect;
|
25121 | }
|
25122 | }
|
25123 | } while (nextEffect !== null);
|
25124 |
|
25125 | stopCommitSnapshotEffectsTimer();
|
25126 |
|
25127 | if (enableProfilerTimer) {
|
25128 |
|
25129 |
|
25130 | recordCommitTime();
|
25131 | }
|
25132 |
|
25133 |
|
25134 | startCommitHostEffectsTimer();
|
25135 | nextEffect = firstEffect;
|
25136 |
|
25137 | do {
|
25138 | {
|
25139 | invokeGuardedCallback(null, commitMutationEffects, null, root, renderPriorityLevel);
|
25140 |
|
25141 | if (hasCaughtError()) {
|
25142 | (function () {
|
25143 | if (!(nextEffect !== null)) {
|
25144 | {
|
25145 | throw ReactError(Error("Should be working on an effect."));
|
25146 | }
|
25147 | }
|
25148 | })();
|
25149 |
|
25150 | var _error = clearCaughtError();
|
25151 |
|
25152 | captureCommitPhaseError(nextEffect, _error);
|
25153 | nextEffect = nextEffect.nextEffect;
|
25154 | }
|
25155 | }
|
25156 | } while (nextEffect !== null);
|
25157 |
|
25158 | stopCommitHostEffectsTimer();
|
25159 | resetAfterCommit(root.containerInfo);
|
25160 |
|
25161 |
|
25162 |
|
25163 |
|
25164 | root.current = finishedWork;
|
25165 |
|
25166 |
|
25167 |
|
25168 | startCommitLifeCyclesTimer();
|
25169 | nextEffect = firstEffect;
|
25170 |
|
25171 | do {
|
25172 | {
|
25173 | invokeGuardedCallback(null, commitLayoutEffects, null, root, expirationTime);
|
25174 |
|
25175 | if (hasCaughtError()) {
|
25176 | (function () {
|
25177 | if (!(nextEffect !== null)) {
|
25178 | {
|
25179 | throw ReactError(Error("Should be working on an effect."));
|
25180 | }
|
25181 | }
|
25182 | })();
|
25183 |
|
25184 | var _error2 = clearCaughtError();
|
25185 |
|
25186 | captureCommitPhaseError(nextEffect, _error2);
|
25187 | nextEffect = nextEffect.nextEffect;
|
25188 | }
|
25189 | }
|
25190 | } while (nextEffect !== null);
|
25191 |
|
25192 | stopCommitLifeCyclesTimer();
|
25193 | nextEffect = null;
|
25194 |
|
25195 |
|
25196 | requestPaint();
|
25197 |
|
25198 | if (enableSchedulerTracing) {
|
25199 | popInteractions(prevInteractions);
|
25200 | }
|
25201 |
|
25202 | executionContext = prevExecutionContext;
|
25203 | } else {
|
25204 |
|
25205 | root.current = finishedWork;
|
25206 |
|
25207 |
|
25208 |
|
25209 | startCommitSnapshotEffectsTimer();
|
25210 | stopCommitSnapshotEffectsTimer();
|
25211 |
|
25212 | if (enableProfilerTimer) {
|
25213 | recordCommitTime();
|
25214 | }
|
25215 |
|
25216 | startCommitHostEffectsTimer();
|
25217 | stopCommitHostEffectsTimer();
|
25218 | startCommitLifeCyclesTimer();
|
25219 | stopCommitLifeCyclesTimer();
|
25220 | }
|
25221 |
|
25222 | stopCommitTimer();
|
25223 | var rootDidHavePassiveEffects = rootDoesHavePassiveEffects;
|
25224 |
|
25225 | if (rootDoesHavePassiveEffects) {
|
25226 |
|
25227 |
|
25228 | rootDoesHavePassiveEffects = false;
|
25229 | rootWithPendingPassiveEffects = root;
|
25230 | pendingPassiveEffectsExpirationTime = expirationTime;
|
25231 | pendingPassiveEffectsRenderPriority = renderPriorityLevel;
|
25232 | } else {
|
25233 |
|
25234 |
|
25235 |
|
25236 | nextEffect = firstEffect;
|
25237 |
|
25238 | while (nextEffect !== null) {
|
25239 | var nextNextEffect = nextEffect.nextEffect;
|
25240 | nextEffect.nextEffect = null;
|
25241 | nextEffect = nextNextEffect;
|
25242 | }
|
25243 | }
|
25244 |
|
25245 |
|
25246 | var remainingExpirationTime = root.firstPendingTime;
|
25247 |
|
25248 | if (remainingExpirationTime !== NoWork) {
|
25249 | if (enableSchedulerTracing) {
|
25250 | if (spawnedWorkDuringRender !== null) {
|
25251 | var expirationTimes = spawnedWorkDuringRender;
|
25252 | spawnedWorkDuringRender = null;
|
25253 |
|
25254 | for (var i = 0; i < expirationTimes.length; i++) {
|
25255 | scheduleInteractions(root, expirationTimes[i], root.memoizedInteractions);
|
25256 | }
|
25257 | }
|
25258 |
|
25259 | schedulePendingInteractions(root, remainingExpirationTime);
|
25260 | }
|
25261 | } else {
|
25262 |
|
25263 |
|
25264 | legacyErrorBoundariesThatAlreadyFailed = null;
|
25265 | }
|
25266 |
|
25267 | if (enableSchedulerTracing) {
|
25268 | if (!rootDidHavePassiveEffects) {
|
25269 |
|
25270 |
|
25271 |
|
25272 |
|
25273 | finishPendingInteractions(root, expirationTime);
|
25274 | }
|
25275 | }
|
25276 |
|
25277 | if (remainingExpirationTime === Sync) {
|
25278 |
|
25279 |
|
25280 | if (root === rootWithNestedUpdates) {
|
25281 | nestedUpdateCount++;
|
25282 | } else {
|
25283 | nestedUpdateCount = 0;
|
25284 | rootWithNestedUpdates = root;
|
25285 | }
|
25286 | } else {
|
25287 | nestedUpdateCount = 0;
|
25288 | }
|
25289 |
|
25290 | onCommitRoot(finishedWork.stateNode, expirationTime);
|
25291 |
|
25292 |
|
25293 | ensureRootIsScheduled(root);
|
25294 |
|
25295 | if (hasUncaughtError) {
|
25296 | hasUncaughtError = false;
|
25297 | var _error3 = firstUncaughtError;
|
25298 | firstUncaughtError = null;
|
25299 | throw _error3;
|
25300 | }
|
25301 |
|
25302 | if ((executionContext & LegacyUnbatchedContext) !== NoContext) {
|
25303 |
|
25304 |
|
25305 |
|
25306 |
|
25307 | return null;
|
25308 | }
|
25309 |
|
25310 |
|
25311 | flushSyncCallbackQueue();
|
25312 | return null;
|
25313 | }
|
25314 |
|
25315 | function commitBeforeMutationEffects() {
|
25316 | while (nextEffect !== null) {
|
25317 | var effectTag = nextEffect.effectTag;
|
25318 |
|
25319 | if ((effectTag & Snapshot) !== NoEffect) {
|
25320 | setCurrentFiber(nextEffect);
|
25321 | recordEffect();
|
25322 | var current$$1 = nextEffect.alternate;
|
25323 | commitBeforeMutationLifeCycles(current$$1, nextEffect);
|
25324 | resetCurrentFiber();
|
25325 | }
|
25326 |
|
25327 | if ((effectTag & Passive) !== NoEffect) {
|
25328 |
|
25329 |
|
25330 | if (!rootDoesHavePassiveEffects) {
|
25331 | rootDoesHavePassiveEffects = true;
|
25332 | scheduleCallback(NormalPriority, function () {
|
25333 | flushPassiveEffects();
|
25334 | return null;
|
25335 | });
|
25336 | }
|
25337 | }
|
25338 |
|
25339 | nextEffect = nextEffect.nextEffect;
|
25340 | }
|
25341 | }
|
25342 |
|
25343 | function commitMutationEffects(root, renderPriorityLevel) {
|
25344 |
|
25345 | while (nextEffect !== null) {
|
25346 | setCurrentFiber(nextEffect);
|
25347 | var effectTag = nextEffect.effectTag;
|
25348 |
|
25349 | if (effectTag & ContentReset) {
|
25350 | commitResetTextContent(nextEffect);
|
25351 | }
|
25352 |
|
25353 | if (effectTag & Ref) {
|
25354 | var current$$1 = nextEffect.alternate;
|
25355 |
|
25356 | if (current$$1 !== null) {
|
25357 | commitDetachRef(current$$1);
|
25358 | }
|
25359 | }
|
25360 |
|
25361 |
|
25362 |
|
25363 |
|
25364 |
|
25365 | var primaryEffectTag = effectTag & (Placement | Update | Deletion | Hydrating);
|
25366 |
|
25367 | switch (primaryEffectTag) {
|
25368 | case Placement:
|
25369 | {
|
25370 | commitPlacement(nextEffect);
|
25371 |
|
25372 |
|
25373 |
|
25374 |
|
25375 | nextEffect.effectTag &= ~Placement;
|
25376 | break;
|
25377 | }
|
25378 |
|
25379 | case PlacementAndUpdate:
|
25380 | {
|
25381 |
|
25382 | commitPlacement(nextEffect);
|
25383 |
|
25384 |
|
25385 | nextEffect.effectTag &= ~Placement;
|
25386 |
|
25387 | var _current = nextEffect.alternate;
|
25388 | commitWork(_current, nextEffect);
|
25389 | break;
|
25390 | }
|
25391 |
|
25392 | case Hydrating:
|
25393 | {
|
25394 | nextEffect.effectTag &= ~Hydrating;
|
25395 | break;
|
25396 | }
|
25397 |
|
25398 | case HydratingAndUpdate:
|
25399 | {
|
25400 | nextEffect.effectTag &= ~Hydrating;
|
25401 |
|
25402 | var _current2 = nextEffect.alternate;
|
25403 | commitWork(_current2, nextEffect);
|
25404 | break;
|
25405 | }
|
25406 |
|
25407 | case Update:
|
25408 | {
|
25409 | var _current3 = nextEffect.alternate;
|
25410 | commitWork(_current3, nextEffect);
|
25411 | break;
|
25412 | }
|
25413 |
|
25414 | case Deletion:
|
25415 | {
|
25416 | commitDeletion(root, nextEffect, renderPriorityLevel);
|
25417 | break;
|
25418 | }
|
25419 | }
|
25420 |
|
25421 |
|
25422 | recordEffect();
|
25423 | resetCurrentFiber();
|
25424 | nextEffect = nextEffect.nextEffect;
|
25425 | }
|
25426 | }
|
25427 |
|
25428 | function commitLayoutEffects(root, committedExpirationTime) {
|
25429 |
|
25430 | while (nextEffect !== null) {
|
25431 | setCurrentFiber(nextEffect);
|
25432 | var effectTag = nextEffect.effectTag;
|
25433 |
|
25434 | if (effectTag & (Update | Callback)) {
|
25435 | recordEffect();
|
25436 | var current$$1 = nextEffect.alternate;
|
25437 | commitLifeCycles(root, current$$1, nextEffect, committedExpirationTime);
|
25438 | }
|
25439 |
|
25440 | if (effectTag & Ref) {
|
25441 | recordEffect();
|
25442 | commitAttachRef(nextEffect);
|
25443 | }
|
25444 |
|
25445 | resetCurrentFiber();
|
25446 | nextEffect = nextEffect.nextEffect;
|
25447 | }
|
25448 | }
|
25449 |
|
25450 | function flushPassiveEffects() {
|
25451 | if (pendingPassiveEffectsRenderPriority !== NoPriority) {
|
25452 | var priorityLevel = pendingPassiveEffectsRenderPriority > NormalPriority ? NormalPriority : pendingPassiveEffectsRenderPriority;
|
25453 | pendingPassiveEffectsRenderPriority = NoPriority;
|
25454 | return runWithPriority$2(priorityLevel, flushPassiveEffectsImpl);
|
25455 | }
|
25456 | }
|
25457 |
|
25458 | function flushPassiveEffectsImpl() {
|
25459 | if (rootWithPendingPassiveEffects === null) {
|
25460 | return false;
|
25461 | }
|
25462 |
|
25463 | var root = rootWithPendingPassiveEffects;
|
25464 | var expirationTime = pendingPassiveEffectsExpirationTime;
|
25465 | rootWithPendingPassiveEffects = null;
|
25466 | pendingPassiveEffectsExpirationTime = NoWork;
|
25467 |
|
25468 | (function () {
|
25469 | if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
25470 | {
|
25471 | throw ReactError(Error("Cannot flush passive effects while already rendering."));
|
25472 | }
|
25473 | }
|
25474 | })();
|
25475 |
|
25476 | var prevExecutionContext = executionContext;
|
25477 | executionContext |= CommitContext;
|
25478 | var prevInteractions = pushInteractions(root);
|
25479 |
|
25480 |
|
25481 |
|
25482 | var effect = root.current.firstEffect;
|
25483 |
|
25484 | while (effect !== null) {
|
25485 | {
|
25486 | setCurrentFiber(effect);
|
25487 | invokeGuardedCallback(null, commitPassiveHookEffects, null, effect);
|
25488 |
|
25489 | if (hasCaughtError()) {
|
25490 | (function () {
|
25491 | if (!(effect !== null)) {
|
25492 | {
|
25493 | throw ReactError(Error("Should be working on an effect."));
|
25494 | }
|
25495 | }
|
25496 | })();
|
25497 |
|
25498 | var error = clearCaughtError();
|
25499 | captureCommitPhaseError(effect, error);
|
25500 | }
|
25501 |
|
25502 | resetCurrentFiber();
|
25503 | }
|
25504 |
|
25505 | var nextNextEffect = effect.nextEffect;
|
25506 |
|
25507 | effect.nextEffect = null;
|
25508 | effect = nextNextEffect;
|
25509 | }
|
25510 |
|
25511 | if (enableSchedulerTracing) {
|
25512 | popInteractions(prevInteractions);
|
25513 | finishPendingInteractions(root, expirationTime);
|
25514 | }
|
25515 |
|
25516 | executionContext = prevExecutionContext;
|
25517 | flushSyncCallbackQueue();
|
25518 |
|
25519 |
|
25520 | nestedPassiveUpdateCount = rootWithPendingPassiveEffects === null ? 0 : nestedPassiveUpdateCount + 1;
|
25521 | return true;
|
25522 | }
|
25523 |
|
25524 | function isAlreadyFailedLegacyErrorBoundary(instance) {
|
25525 | return legacyErrorBoundariesThatAlreadyFailed !== null && legacyErrorBoundariesThatAlreadyFailed.has(instance);
|
25526 | }
|
25527 | function markLegacyErrorBoundaryAsFailed(instance) {
|
25528 | if (legacyErrorBoundariesThatAlreadyFailed === null) {
|
25529 | legacyErrorBoundariesThatAlreadyFailed = new Set([instance]);
|
25530 | } else {
|
25531 | legacyErrorBoundariesThatAlreadyFailed.add(instance);
|
25532 | }
|
25533 | }
|
25534 |
|
25535 | function prepareToThrowUncaughtError(error) {
|
25536 | if (!hasUncaughtError) {
|
25537 | hasUncaughtError = true;
|
25538 | firstUncaughtError = error;
|
25539 | }
|
25540 | }
|
25541 |
|
25542 | var onUncaughtError = prepareToThrowUncaughtError;
|
25543 |
|
25544 | function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) {
|
25545 | var errorInfo = createCapturedValue(error, sourceFiber);
|
25546 | var update = createRootErrorUpdate(rootFiber, errorInfo, Sync);
|
25547 | enqueueUpdate(rootFiber, update);
|
25548 | var root = markUpdateTimeFromFiberToRoot(rootFiber, Sync);
|
25549 |
|
25550 | if (root !== null) {
|
25551 | ensureRootIsScheduled(root);
|
25552 | schedulePendingInteractions(root, Sync);
|
25553 | }
|
25554 | }
|
25555 |
|
25556 | function captureCommitPhaseError(sourceFiber, error) {
|
25557 | if (sourceFiber.tag === HostRoot) {
|
25558 |
|
25559 |
|
25560 | captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error);
|
25561 | return;
|
25562 | }
|
25563 |
|
25564 | var fiber = sourceFiber.return;
|
25565 |
|
25566 | while (fiber !== null) {
|
25567 | if (fiber.tag === HostRoot) {
|
25568 | captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error);
|
25569 | return;
|
25570 | } else if (fiber.tag === ClassComponent) {
|
25571 | var ctor = fiber.type;
|
25572 | var instance = fiber.stateNode;
|
25573 |
|
25574 | if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
|
25575 | var errorInfo = createCapturedValue(error, sourceFiber);
|
25576 | var update = createClassErrorUpdate(fiber, errorInfo,
|
25577 | Sync);
|
25578 | enqueueUpdate(fiber, update);
|
25579 | var root = markUpdateTimeFromFiberToRoot(fiber, Sync);
|
25580 |
|
25581 | if (root !== null) {
|
25582 | ensureRootIsScheduled(root);
|
25583 | schedulePendingInteractions(root, Sync);
|
25584 | }
|
25585 |
|
25586 | return;
|
25587 | }
|
25588 | }
|
25589 |
|
25590 | fiber = fiber.return;
|
25591 | }
|
25592 | }
|
25593 | function pingSuspendedRoot(root, thenable, suspendedTime) {
|
25594 | var pingCache = root.pingCache;
|
25595 |
|
25596 | if (pingCache !== null) {
|
25597 |
|
25598 |
|
25599 | pingCache.delete(thenable);
|
25600 | }
|
25601 |
|
25602 | if (workInProgressRoot === root && renderExpirationTime === suspendedTime) {
|
25603 |
|
25604 |
|
25605 |
|
25606 |
|
25607 |
|
25608 |
|
25609 |
|
25610 |
|
25611 |
|
25612 |
|
25613 |
|
25614 | if (workInProgressRootExitStatus === RootSuspendedWithDelay || workInProgressRootExitStatus === RootSuspended && workInProgressRootLatestProcessedExpirationTime === Sync && now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) {
|
25615 |
|
25616 |
|
25617 | prepareFreshStack(root, renderExpirationTime);
|
25618 | } else {
|
25619 |
|
25620 |
|
25621 | workInProgressRootHasPendingPing = true;
|
25622 | }
|
25623 |
|
25624 | return;
|
25625 | }
|
25626 |
|
25627 | if (!isRootSuspendedAtTime(root, suspendedTime)) {
|
25628 |
|
25629 | return;
|
25630 | }
|
25631 |
|
25632 | var lastPingedTime = root.lastPingedTime;
|
25633 |
|
25634 | if (lastPingedTime !== NoWork && lastPingedTime < suspendedTime) {
|
25635 |
|
25636 | return;
|
25637 | }
|
25638 |
|
25639 |
|
25640 | root.lastPingedTime = suspendedTime;
|
25641 |
|
25642 | if (root.finishedExpirationTime === suspendedTime) {
|
25643 |
|
25644 | root.finishedExpirationTime = NoWork;
|
25645 | root.finishedWork = null;
|
25646 | }
|
25647 |
|
25648 | ensureRootIsScheduled(root);
|
25649 | schedulePendingInteractions(root, suspendedTime);
|
25650 | }
|
25651 |
|
25652 | function retryTimedOutBoundary(boundaryFiber, retryTime) {
|
25653 |
|
25654 |
|
25655 |
|
25656 |
|
25657 | if (retryTime === Never) {
|
25658 | var suspenseConfig = null;
|
25659 |
|
25660 | var currentTime = requestCurrentTime();
|
25661 | retryTime = computeExpirationForFiber(currentTime, boundaryFiber, suspenseConfig);
|
25662 | }
|
25663 |
|
25664 |
|
25665 | var root = markUpdateTimeFromFiberToRoot(boundaryFiber, retryTime);
|
25666 |
|
25667 | if (root !== null) {
|
25668 | ensureRootIsScheduled(root);
|
25669 | schedulePendingInteractions(root, retryTime);
|
25670 | }
|
25671 | }
|
25672 |
|
25673 | function retryDehydratedSuspenseBoundary(boundaryFiber) {
|
25674 | var suspenseState = boundaryFiber.memoizedState;
|
25675 | var retryTime = Never;
|
25676 |
|
25677 | if (suspenseState !== null) {
|
25678 | retryTime = suspenseState.retryTime;
|
25679 | }
|
25680 |
|
25681 | retryTimedOutBoundary(boundaryFiber, retryTime);
|
25682 | }
|
25683 | function resolveRetryThenable(boundaryFiber, thenable) {
|
25684 | var retryTime = Never;
|
25685 |
|
25686 | var retryCache;
|
25687 |
|
25688 | if (enableSuspenseServerRenderer) {
|
25689 | switch (boundaryFiber.tag) {
|
25690 | case SuspenseComponent:
|
25691 | retryCache = boundaryFiber.stateNode;
|
25692 | var suspenseState = boundaryFiber.memoizedState;
|
25693 |
|
25694 | if (suspenseState !== null) {
|
25695 | retryTime = suspenseState.retryTime;
|
25696 | }
|
25697 |
|
25698 | break;
|
25699 |
|
25700 | case SuspenseListComponent:
|
25701 | retryCache = boundaryFiber.stateNode;
|
25702 | break;
|
25703 |
|
25704 | default:
|
25705 | (function () {
|
25706 | {
|
25707 | {
|
25708 | throw ReactError(Error("Pinged unknown suspense boundary type. This is probably a bug in React."));
|
25709 | }
|
25710 | }
|
25711 | })();
|
25712 |
|
25713 | }
|
25714 | } else {
|
25715 | retryCache = boundaryFiber.stateNode;
|
25716 | }
|
25717 |
|
25718 | if (retryCache !== null) {
|
25719 |
|
25720 |
|
25721 | retryCache.delete(thenable);
|
25722 | }
|
25723 |
|
25724 | retryTimedOutBoundary(boundaryFiber, retryTime);
|
25725 | }
|
25726 |
|
25727 |
|
25728 |
|
25729 |
|
25730 |
|
25731 |
|
25732 |
|
25733 |
|
25734 |
|
25735 | function jnd(timeElapsed) {
|
25736 | return timeElapsed < 120 ? 120 : timeElapsed < 480 ? 480 : timeElapsed < 1080 ? 1080 : timeElapsed < 1920 ? 1920 : timeElapsed < 3000 ? 3000 : timeElapsed < 4320 ? 4320 : ceil(timeElapsed / 1960) * 1960;
|
25737 | }
|
25738 |
|
25739 | function computeMsUntilSuspenseLoadingDelay(mostRecentEventTime, committedExpirationTime, suspenseConfig) {
|
25740 | var busyMinDurationMs = suspenseConfig.busyMinDurationMs | 0;
|
25741 |
|
25742 | if (busyMinDurationMs <= 0) {
|
25743 | return 0;
|
25744 | }
|
25745 |
|
25746 | var busyDelayMs = suspenseConfig.busyDelayMs | 0;
|
25747 |
|
25748 | var currentTimeMs = now();
|
25749 | var eventTimeMs = inferTimeFromExpirationTimeWithSuspenseConfig(mostRecentEventTime, suspenseConfig);
|
25750 | var timeElapsed = currentTimeMs - eventTimeMs;
|
25751 |
|
25752 | if (timeElapsed <= busyDelayMs) {
|
25753 |
|
25754 |
|
25755 | return 0;
|
25756 | }
|
25757 |
|
25758 | var msUntilTimeout = busyDelayMs + busyMinDurationMs - timeElapsed;
|
25759 |
|
25760 | return msUntilTimeout;
|
25761 | }
|
25762 |
|
25763 | function checkForNestedUpdates() {
|
25764 | if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
|
25765 | nestedUpdateCount = 0;
|
25766 | rootWithNestedUpdates = null;
|
25767 |
|
25768 | (function () {
|
25769 | {
|
25770 | {
|
25771 | throw ReactError(Error("Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops."));
|
25772 | }
|
25773 | }
|
25774 | })();
|
25775 | }
|
25776 |
|
25777 | {
|
25778 | if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) {
|
25779 | nestedPassiveUpdateCount = 0;
|
25780 | warning$1(false, 'Maximum update depth exceeded. This can happen when a component ' + "calls setState inside useEffect, but useEffect either doesn't " + 'have a dependency array, or one of the dependencies changes on ' + 'every render.');
|
25781 | }
|
25782 | }
|
25783 | }
|
25784 |
|
25785 | function flushRenderPhaseStrictModeWarningsInDEV() {
|
25786 | {
|
25787 | ReactStrictModeWarnings.flushLegacyContextWarning();
|
25788 |
|
25789 | if (warnAboutDeprecatedLifecycles) {
|
25790 | ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings();
|
25791 | }
|
25792 | }
|
25793 | }
|
25794 |
|
25795 | function stopFinishedWorkLoopTimer() {
|
25796 | var didCompleteRoot = true;
|
25797 | stopWorkLoopTimer(interruptedBy, didCompleteRoot);
|
25798 | interruptedBy = null;
|
25799 | }
|
25800 |
|
25801 | function stopInterruptedWorkLoopTimer() {
|
25802 |
|
25803 | var didCompleteRoot = false;
|
25804 | stopWorkLoopTimer(interruptedBy, didCompleteRoot);
|
25805 | interruptedBy = null;
|
25806 | }
|
25807 |
|
25808 | function checkForInterruption(fiberThatReceivedUpdate, updateExpirationTime) {
|
25809 | if (enableUserTimingAPI && workInProgressRoot !== null && updateExpirationTime > renderExpirationTime) {
|
25810 | interruptedBy = fiberThatReceivedUpdate;
|
25811 | }
|
25812 | }
|
25813 |
|
25814 | var didWarnStateUpdateForUnmountedComponent = null;
|
25815 |
|
25816 | function warnAboutUpdateOnUnmountedFiberInDEV(fiber) {
|
25817 | {
|
25818 | var tag = fiber.tag;
|
25819 |
|
25820 | if (tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent) {
|
25821 |
|
25822 | return;
|
25823 | }
|
25824 |
|
25825 |
|
25826 |
|
25827 | var componentName = getComponentName(fiber.type) || 'ReactComponent';
|
25828 |
|
25829 | if (didWarnStateUpdateForUnmountedComponent !== null) {
|
25830 | if (didWarnStateUpdateForUnmountedComponent.has(componentName)) {
|
25831 | return;
|
25832 | }
|
25833 |
|
25834 | didWarnStateUpdateForUnmountedComponent.add(componentName);
|
25835 | } else {
|
25836 | didWarnStateUpdateForUnmountedComponent = new Set([componentName]);
|
25837 | }
|
25838 |
|
25839 | warningWithoutStack$1(false, "Can't perform a React state update on an unmounted component. This " + 'is a no-op, but it indicates a memory leak in your application. To ' + 'fix, cancel all subscriptions and asynchronous tasks in %s.%s', tag === ClassComponent ? 'the componentWillUnmount method' : 'a useEffect cleanup function', getStackByFiberInDevAndProd(fiber));
|
25840 | }
|
25841 | }
|
25842 |
|
25843 | var beginWork$$1;
|
25844 |
|
25845 | if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
|
25846 | var dummyFiber = null;
|
25847 |
|
25848 | beginWork$$1 = function (current$$1, unitOfWork, expirationTime) {
|
25849 |
|
25850 |
|
25851 |
|
25852 |
|
25853 |
|
25854 | var originalWorkInProgressCopy = assignFiberPropertiesInDEV(dummyFiber, unitOfWork);
|
25855 |
|
25856 | try {
|
25857 | return beginWork$1(current$$1, unitOfWork, expirationTime);
|
25858 | } catch (originalError) {
|
25859 | if (originalError !== null && typeof originalError === 'object' && typeof originalError.then === 'function') {
|
25860 |
|
25861 | throw originalError;
|
25862 | }
|
25863 |
|
25864 |
|
25865 |
|
25866 | resetContextDependencies();
|
25867 | resetHooks();
|
25868 |
|
25869 | unwindInterruptedWork(unitOfWork);
|
25870 |
|
25871 | assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy);
|
25872 |
|
25873 | if (enableProfilerTimer && unitOfWork.mode & ProfileMode) {
|
25874 |
|
25875 | startProfilerTimer(unitOfWork);
|
25876 | }
|
25877 |
|
25878 |
|
25879 | invokeGuardedCallback(null, beginWork$1, null, current$$1, unitOfWork, expirationTime);
|
25880 |
|
25881 | if (hasCaughtError()) {
|
25882 | var replayError = clearCaughtError();
|
25883 |
|
25884 |
|
25885 | throw replayError;
|
25886 | } else {
|
25887 |
|
25888 | throw originalError;
|
25889 | }
|
25890 | }
|
25891 | };
|
25892 | } else {
|
25893 | beginWork$$1 = beginWork$1;
|
25894 | }
|
25895 |
|
25896 | var didWarnAboutUpdateInRender = false;
|
25897 | var didWarnAboutUpdateInGetChildContext = false;
|
25898 |
|
25899 | function warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber) {
|
25900 | {
|
25901 | if (fiber.tag === ClassComponent) {
|
25902 | switch (phase) {
|
25903 | case 'getChildContext':
|
25904 | if (didWarnAboutUpdateInGetChildContext) {
|
25905 | return;
|
25906 | }
|
25907 |
|
25908 | warningWithoutStack$1(false, 'setState(...): Cannot call setState() inside getChildContext()');
|
25909 | didWarnAboutUpdateInGetChildContext = true;
|
25910 | break;
|
25911 |
|
25912 | case 'render':
|
25913 | if (didWarnAboutUpdateInRender) {
|
25914 | return;
|
25915 | }
|
25916 |
|
25917 | warningWithoutStack$1(false, 'Cannot update during an existing state transition (such as ' + 'within `render`). Render methods should be a pure function of ' + 'props and state.');
|
25918 | didWarnAboutUpdateInRender = true;
|
25919 | break;
|
25920 | }
|
25921 | }
|
25922 | }
|
25923 | }
|
25924 |
|
25925 |
|
25926 | var IsThisRendererActing = {
|
25927 | current: false
|
25928 | };
|
25929 | function warnIfNotScopedWithMatchingAct(fiber) {
|
25930 | {
|
25931 | if (warnsIfNotActing === true && IsSomeRendererActing.current === true && IsThisRendererActing.current !== true) {
|
25932 | warningWithoutStack$1(false, "It looks like you're using the wrong act() around your test interactions.\n" + 'Be sure to use the matching version of act() corresponding to your renderer:\n\n' + '// for react-dom:\n' + "import {act} from 'react-dom/test-utils';\n" + '// ...\n' + 'act(() => ...);\n\n' + '// for react-test-renderer:\n' + "import TestRenderer from 'react-test-renderer';\n" + 'const {act} = TestRenderer;\n' + '// ...\n' + 'act(() => ...);' + '%s', getStackByFiberInDevAndProd(fiber));
|
25933 | }
|
25934 | }
|
25935 | }
|
25936 | function warnIfNotCurrentlyActingEffectsInDEV(fiber) {
|
25937 | {
|
25938 | if (warnsIfNotActing === true && (fiber.mode & StrictMode) !== NoMode && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) {
|
25939 | warningWithoutStack$1(false, 'An update to %s ran an effect, but was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://fb.me/react-wrap-tests-with-act' + '%s', getComponentName(fiber.type), getStackByFiberInDevAndProd(fiber));
|
25940 | }
|
25941 | }
|
25942 | }
|
25943 |
|
25944 | function warnIfNotCurrentlyActingUpdatesInDEV(fiber) {
|
25945 | {
|
25946 | if (warnsIfNotActing === true && executionContext === NoContext && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) {
|
25947 | warningWithoutStack$1(false, 'An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://fb.me/react-wrap-tests-with-act' + '%s', getComponentName(fiber.type), getStackByFiberInDevAndProd(fiber));
|
25948 | }
|
25949 | }
|
25950 | }
|
25951 |
|
25952 | var warnIfNotCurrentlyActingUpdatesInDev = warnIfNotCurrentlyActingUpdatesInDEV;
|
25953 |
|
25954 | var didWarnAboutUnmockedScheduler = false;
|
25955 |
|
25956 |
|
25957 |
|
25958 |
|
25959 | function warnIfUnmockedScheduler(fiber) {
|
25960 | {
|
25961 | if (didWarnAboutUnmockedScheduler === false && unstable_flushAllWithoutAsserting === undefined) {
|
25962 | if (fiber.mode & BatchedMode || fiber.mode & ConcurrentMode) {
|
25963 | didWarnAboutUnmockedScheduler = true;
|
25964 | warningWithoutStack$1(false, 'In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \n' + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + 'For more info, visit https://fb.me/react-mock-scheduler');
|
25965 | } else if (warnAboutUnmockedScheduler === true) {
|
25966 | didWarnAboutUnmockedScheduler = true;
|
25967 | warningWithoutStack$1(false, 'Starting from React v17, the "scheduler" module will need to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \n' + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + 'For more info, visit https://fb.me/react-mock-scheduler');
|
25968 | }
|
25969 | }
|
25970 | }
|
25971 | }
|
25972 | var componentsThatTriggeredHighPriSuspend = null;
|
25973 | function checkForWrongSuspensePriorityInDEV(sourceFiber) {
|
25974 | {
|
25975 | var currentPriorityLevel = getCurrentPriorityLevel();
|
25976 |
|
25977 | if ((sourceFiber.mode & ConcurrentMode) !== NoEffect && (currentPriorityLevel === UserBlockingPriority$2 || currentPriorityLevel === ImmediatePriority)) {
|
25978 | var workInProgressNode = sourceFiber;
|
25979 |
|
25980 | while (workInProgressNode !== null) {
|
25981 |
|
25982 | var current$$1 = workInProgressNode.alternate;
|
25983 |
|
25984 | if (current$$1 !== null) {
|
25985 |
|
25986 |
|
25987 | switch (workInProgressNode.tag) {
|
25988 | case ClassComponent:
|
25989 |
|
25990 |
|
25991 | var updateQueue = current$$1.updateQueue;
|
25992 |
|
25993 | if (updateQueue !== null) {
|
25994 | var update = updateQueue.firstUpdate;
|
25995 |
|
25996 | while (update !== null) {
|
25997 | var priorityLevel = update.priority;
|
25998 |
|
25999 | if (priorityLevel === UserBlockingPriority$2 || priorityLevel === ImmediatePriority) {
|
26000 | if (componentsThatTriggeredHighPriSuspend === null) {
|
26001 | componentsThatTriggeredHighPriSuspend = new Set([getComponentName(workInProgressNode.type)]);
|
26002 | } else {
|
26003 | componentsThatTriggeredHighPriSuspend.add(getComponentName(workInProgressNode.type));
|
26004 | }
|
26005 |
|
26006 | break;
|
26007 | }
|
26008 |
|
26009 | update = update.next;
|
26010 | }
|
26011 | }
|
26012 |
|
26013 | break;
|
26014 |
|
26015 | case FunctionComponent:
|
26016 | case ForwardRef:
|
26017 | case SimpleMemoComponent:
|
26018 | if (workInProgressNode.memoizedState !== null && workInProgressNode.memoizedState.baseUpdate !== null) {
|
26019 | var _update = workInProgressNode.memoizedState.baseUpdate;
|
26020 |
|
26021 |
|
26022 | while (_update !== null) {
|
26023 | var priority = _update.priority;
|
26024 |
|
26025 | if (priority === UserBlockingPriority$2 || priority === ImmediatePriority) {
|
26026 | if (componentsThatTriggeredHighPriSuspend === null) {
|
26027 | componentsThatTriggeredHighPriSuspend = new Set([getComponentName(workInProgressNode.type)]);
|
26028 | } else {
|
26029 | componentsThatTriggeredHighPriSuspend.add(getComponentName(workInProgressNode.type));
|
26030 | }
|
26031 |
|
26032 | break;
|
26033 | }
|
26034 |
|
26035 | if (_update.next === workInProgressNode.memoizedState.baseUpdate) {
|
26036 | break;
|
26037 | }
|
26038 |
|
26039 | _update = _update.next;
|
26040 | }
|
26041 | }
|
26042 |
|
26043 | break;
|
26044 |
|
26045 | default:
|
26046 | break;
|
26047 | }
|
26048 | }
|
26049 |
|
26050 | workInProgressNode = workInProgressNode.return;
|
26051 | }
|
26052 | }
|
26053 | }
|
26054 | }
|
26055 |
|
26056 | function flushSuspensePriorityWarningInDEV() {
|
26057 | {
|
26058 | if (componentsThatTriggeredHighPriSuspend !== null) {
|
26059 | var componentNames = [];
|
26060 | componentsThatTriggeredHighPriSuspend.forEach(function (name) {
|
26061 | return componentNames.push(name);
|
26062 | });
|
26063 | componentsThatTriggeredHighPriSuspend = null;
|
26064 |
|
26065 | if (componentNames.length > 0) {
|
26066 | warningWithoutStack$1(false, '%s triggered a user-blocking update that suspended.' + '\n\n' + 'The fix is to split the update into multiple parts: a user-blocking ' + 'update to provide immediate feedback, and another update that ' + 'triggers the bulk of the changes.' + '\n\n' + 'Refer to the documentation for useSuspenseTransition to learn how ' + 'to implement this pattern.',
|
26067 | componentNames.sort().join(', '));
|
26068 | }
|
26069 | }
|
26070 | }
|
26071 | }
|
26072 |
|
26073 | function computeThreadID(root, expirationTime) {
|
26074 |
|
26075 | return expirationTime * 1000 + root.interactionThreadID;
|
26076 | }
|
26077 |
|
26078 | function markSpawnedWork(expirationTime) {
|
26079 | if (!enableSchedulerTracing) {
|
26080 | return;
|
26081 | }
|
26082 |
|
26083 | if (spawnedWorkDuringRender === null) {
|
26084 | spawnedWorkDuringRender = [expirationTime];
|
26085 | } else {
|
26086 | spawnedWorkDuringRender.push(expirationTime);
|
26087 | }
|
26088 | }
|
26089 |
|
26090 | function scheduleInteractions(root, expirationTime, interactions) {
|
26091 | if (!enableSchedulerTracing) {
|
26092 | return;
|
26093 | }
|
26094 |
|
26095 | if (interactions.size > 0) {
|
26096 | var pendingInteractionMap = root.pendingInteractionMap;
|
26097 | var pendingInteractions = pendingInteractionMap.get(expirationTime);
|
26098 |
|
26099 | if (pendingInteractions != null) {
|
26100 | interactions.forEach(function (interaction) {
|
26101 | if (!pendingInteractions.has(interaction)) {
|
26102 |
|
26103 | interaction.__count++;
|
26104 | }
|
26105 |
|
26106 | pendingInteractions.add(interaction);
|
26107 | });
|
26108 | } else {
|
26109 | pendingInteractionMap.set(expirationTime, new Set(interactions));
|
26110 |
|
26111 | interactions.forEach(function (interaction) {
|
26112 | interaction.__count++;
|
26113 | });
|
26114 | }
|
26115 |
|
26116 | var subscriber = __subscriberRef.current;
|
26117 |
|
26118 | if (subscriber !== null) {
|
26119 | var threadID = computeThreadID(root, expirationTime);
|
26120 | subscriber.onWorkScheduled(interactions, threadID);
|
26121 | }
|
26122 | }
|
26123 | }
|
26124 |
|
26125 | function schedulePendingInteractions(root, expirationTime) {
|
26126 |
|
26127 |
|
26128 |
|
26129 | if (!enableSchedulerTracing) {
|
26130 | return;
|
26131 | }
|
26132 |
|
26133 | scheduleInteractions(root, expirationTime, __interactionsRef.current);
|
26134 | }
|
26135 |
|
26136 | function startWorkOnPendingInteractions(root, expirationTime) {
|
26137 |
|
26138 | if (!enableSchedulerTracing) {
|
26139 | return;
|
26140 | }
|
26141 |
|
26142 |
|
26143 |
|
26144 |
|
26145 | var interactions = new Set();
|
26146 | root.pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
|
26147 | if (scheduledExpirationTime >= expirationTime) {
|
26148 | scheduledInteractions.forEach(function (interaction) {
|
26149 | return interactions.add(interaction);
|
26150 | });
|
26151 | }
|
26152 | });
|
26153 |
|
26154 |
|
26155 |
|
26156 |
|
26157 |
|
26158 | root.memoizedInteractions = interactions;
|
26159 |
|
26160 | if (interactions.size > 0) {
|
26161 | var subscriber = __subscriberRef.current;
|
26162 |
|
26163 | if (subscriber !== null) {
|
26164 | var threadID = computeThreadID(root, expirationTime);
|
26165 |
|
26166 | try {
|
26167 | subscriber.onWorkStarted(interactions, threadID);
|
26168 | } catch (error) {
|
26169 |
|
26170 | scheduleCallback(ImmediatePriority, function () {
|
26171 | throw error;
|
26172 | });
|
26173 | }
|
26174 | }
|
26175 | }
|
26176 | }
|
26177 |
|
26178 | function finishPendingInteractions(root, committedExpirationTime) {
|
26179 | if (!enableSchedulerTracing) {
|
26180 | return;
|
26181 | }
|
26182 |
|
26183 | var earliestRemainingTimeAfterCommit = root.firstPendingTime;
|
26184 | var subscriber;
|
26185 |
|
26186 | try {
|
26187 | subscriber = __subscriberRef.current;
|
26188 |
|
26189 | if (subscriber !== null && root.memoizedInteractions.size > 0) {
|
26190 | var threadID = computeThreadID(root, committedExpirationTime);
|
26191 | subscriber.onWorkStopped(root.memoizedInteractions, threadID);
|
26192 | }
|
26193 | } catch (error) {
|
26194 |
|
26195 | scheduleCallback(ImmediatePriority, function () {
|
26196 | throw error;
|
26197 | });
|
26198 | } finally {
|
26199 |
|
26200 |
|
26201 |
|
26202 | var pendingInteractionMap = root.pendingInteractionMap;
|
26203 | pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
|
26204 |
|
26205 |
|
26206 |
|
26207 | if (scheduledExpirationTime > earliestRemainingTimeAfterCommit) {
|
26208 | pendingInteractionMap.delete(scheduledExpirationTime);
|
26209 | scheduledInteractions.forEach(function (interaction) {
|
26210 | interaction.__count--;
|
26211 |
|
26212 | if (subscriber !== null && interaction.__count === 0) {
|
26213 | try {
|
26214 | subscriber.onInteractionScheduledWorkCompleted(interaction);
|
26215 | } catch (error) {
|
26216 |
|
26217 | scheduleCallback(ImmediatePriority, function () {
|
26218 | throw error;
|
26219 | });
|
26220 | }
|
26221 | }
|
26222 | });
|
26223 | }
|
26224 | });
|
26225 | }
|
26226 | }
|
26227 |
|
26228 | var onCommitFiberRoot = null;
|
26229 | var onCommitFiberUnmount = null;
|
26230 | var hasLoggedError = false;
|
26231 | var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined';
|
26232 | function injectInternals(internals) {
|
26233 | if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
|
26234 |
|
26235 | return false;
|
26236 | }
|
26237 |
|
26238 | var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
26239 |
|
26240 | if (hook.isDisabled) {
|
26241 |
|
26242 |
|
26243 |
|
26244 | return true;
|
26245 | }
|
26246 |
|
26247 | if (!hook.supportsFiber) {
|
26248 | {
|
26249 | warningWithoutStack$1(false, 'The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://fb.me/react-devtools');
|
26250 | }
|
26251 |
|
26252 |
|
26253 | return true;
|
26254 | }
|
26255 |
|
26256 | try {
|
26257 | var rendererID = hook.inject(internals);
|
26258 |
|
26259 | onCommitFiberRoot = function (root, expirationTime) {
|
26260 | try {
|
26261 | var didError = (root.current.effectTag & DidCapture) === DidCapture;
|
26262 |
|
26263 | if (enableProfilerTimer) {
|
26264 | var currentTime = requestCurrentTime();
|
26265 | var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime);
|
26266 | hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError);
|
26267 | } else {
|
26268 | hook.onCommitFiberRoot(rendererID, root, undefined, didError);
|
26269 | }
|
26270 | } catch (err) {
|
26271 | if (true && !hasLoggedError) {
|
26272 | hasLoggedError = true;
|
26273 | warningWithoutStack$1(false, 'React DevTools encountered an error: %s', err);
|
26274 | }
|
26275 | }
|
26276 | };
|
26277 |
|
26278 | onCommitFiberUnmount = function (fiber) {
|
26279 | try {
|
26280 | hook.onCommitFiberUnmount(rendererID, fiber);
|
26281 | } catch (err) {
|
26282 | if (true && !hasLoggedError) {
|
26283 | hasLoggedError = true;
|
26284 | warningWithoutStack$1(false, 'React DevTools encountered an error: %s', err);
|
26285 | }
|
26286 | }
|
26287 | };
|
26288 | } catch (err) {
|
26289 |
|
26290 | {
|
26291 | warningWithoutStack$1(false, 'React DevTools encountered an error: %s.', err);
|
26292 | }
|
26293 | }
|
26294 |
|
26295 |
|
26296 | return true;
|
26297 | }
|
26298 | function onCommitRoot(root, expirationTime) {
|
26299 | if (typeof onCommitFiberRoot === 'function') {
|
26300 | onCommitFiberRoot(root, expirationTime);
|
26301 | }
|
26302 | }
|
26303 | function onCommitUnmount(fiber) {
|
26304 | if (typeof onCommitFiberUnmount === 'function') {
|
26305 | onCommitFiberUnmount(fiber);
|
26306 | }
|
26307 | }
|
26308 |
|
26309 | var hasBadMapPolyfill;
|
26310 |
|
26311 | {
|
26312 | hasBadMapPolyfill = false;
|
26313 |
|
26314 | try {
|
26315 | var nonExtensibleObject = Object.preventExtensions({});
|
26316 | var testMap = new Map([[nonExtensibleObject, null]]);
|
26317 | var testSet = new Set([nonExtensibleObject]);
|
26318 |
|
26319 |
|
26320 |
|
26321 | testMap.set(0, 0);
|
26322 | testSet.add(0);
|
26323 | } catch (e) {
|
26324 |
|
26325 | hasBadMapPolyfill = true;
|
26326 | }
|
26327 | }
|
26328 |
|
26329 | var debugCounter = 1;
|
26330 |
|
26331 | function FiberNode(tag, pendingProps, key, mode) {
|
26332 |
|
26333 | this.tag = tag;
|
26334 | this.key = key;
|
26335 | this.elementType = null;
|
26336 | this.type = null;
|
26337 | this.stateNode = null;
|
26338 |
|
26339 | this.return = null;
|
26340 | this.child = null;
|
26341 | this.sibling = null;
|
26342 | this.index = 0;
|
26343 | this.ref = null;
|
26344 | this.pendingProps = pendingProps;
|
26345 | this.memoizedProps = null;
|
26346 | this.updateQueue = null;
|
26347 | this.memoizedState = null;
|
26348 | this.dependencies = null;
|
26349 | this.mode = mode;
|
26350 |
|
26351 | this.effectTag = NoEffect;
|
26352 | this.nextEffect = null;
|
26353 | this.firstEffect = null;
|
26354 | this.lastEffect = null;
|
26355 | this.expirationTime = NoWork;
|
26356 | this.childExpirationTime = NoWork;
|
26357 | this.alternate = null;
|
26358 |
|
26359 | if (enableProfilerTimer) {
|
26360 |
|
26361 |
|
26362 |
|
26363 |
|
26364 |
|
26365 |
|
26366 |
|
26367 |
|
26368 |
|
26369 |
|
26370 |
|
26371 |
|
26372 | this.actualDuration = Number.NaN;
|
26373 | this.actualStartTime = Number.NaN;
|
26374 | this.selfBaseDuration = Number.NaN;
|
26375 | this.treeBaseDuration = Number.NaN;
|
26376 |
|
26377 |
|
26378 |
|
26379 | this.actualDuration = 0;
|
26380 | this.actualStartTime = -1;
|
26381 | this.selfBaseDuration = 0;
|
26382 | this.treeBaseDuration = 0;
|
26383 | }
|
26384 |
|
26385 |
|
26386 |
|
26387 | if (enableUserTimingAPI) {
|
26388 | this._debugID = debugCounter++;
|
26389 | this._debugIsCurrentlyTiming = false;
|
26390 | }
|
26391 |
|
26392 | {
|
26393 | this._debugSource = null;
|
26394 | this._debugOwner = null;
|
26395 | this._debugNeedsRemount = false;
|
26396 | this._debugHookTypes = null;
|
26397 |
|
26398 | if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') {
|
26399 | Object.preventExtensions(this);
|
26400 | }
|
26401 | }
|
26402 | }
|
26403 |
|
26404 |
|
26405 |
|
26406 |
|
26407 |
|
26408 |
|
26409 |
|
26410 |
|
26411 |
|
26412 |
|
26413 |
|
26414 |
|
26415 |
|
26416 |
|
26417 | var createFiber = function (tag, pendingProps, key, mode) {
|
26418 |
|
26419 | return new FiberNode(tag, pendingProps, key, mode);
|
26420 | };
|
26421 |
|
26422 | function shouldConstruct(Component) {
|
26423 | var prototype = Component.prototype;
|
26424 | return !!(prototype && prototype.isReactComponent);
|
26425 | }
|
26426 |
|
26427 | function isSimpleFunctionComponent(type) {
|
26428 | return typeof type === 'function' && !shouldConstruct(type) && type.defaultProps === undefined;
|
26429 | }
|
26430 | function resolveLazyComponentTag(Component) {
|
26431 | if (typeof Component === 'function') {
|
26432 | return shouldConstruct(Component) ? ClassComponent : FunctionComponent;
|
26433 | } else if (Component !== undefined && Component !== null) {
|
26434 | var $$typeof = Component.$$typeof;
|
26435 |
|
26436 | if ($$typeof === REACT_FORWARD_REF_TYPE) {
|
26437 | return ForwardRef;
|
26438 | }
|
26439 |
|
26440 | if ($$typeof === REACT_MEMO_TYPE) {
|
26441 | return MemoComponent;
|
26442 | }
|
26443 | }
|
26444 |
|
26445 | return IndeterminateComponent;
|
26446 | }
|
26447 |
|
26448 | function createWorkInProgress(current, pendingProps, expirationTime) {
|
26449 | var workInProgress = current.alternate;
|
26450 |
|
26451 | if (workInProgress === null) {
|
26452 |
|
26453 |
|
26454 |
|
26455 |
|
26456 |
|
26457 | workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
|
26458 | workInProgress.elementType = current.elementType;
|
26459 | workInProgress.type = current.type;
|
26460 | workInProgress.stateNode = current.stateNode;
|
26461 |
|
26462 | {
|
26463 |
|
26464 | workInProgress._debugID = current._debugID;
|
26465 | workInProgress._debugSource = current._debugSource;
|
26466 | workInProgress._debugOwner = current._debugOwner;
|
26467 | workInProgress._debugHookTypes = current._debugHookTypes;
|
26468 | }
|
26469 |
|
26470 | workInProgress.alternate = current;
|
26471 | current.alternate = workInProgress;
|
26472 | } else {
|
26473 | workInProgress.pendingProps = pendingProps;
|
26474 |
|
26475 |
|
26476 | workInProgress.effectTag = NoEffect;
|
26477 |
|
26478 | workInProgress.nextEffect = null;
|
26479 | workInProgress.firstEffect = null;
|
26480 | workInProgress.lastEffect = null;
|
26481 |
|
26482 | if (enableProfilerTimer) {
|
26483 |
|
26484 |
|
26485 |
|
26486 |
|
26487 | workInProgress.actualDuration = 0;
|
26488 | workInProgress.actualStartTime = -1;
|
26489 | }
|
26490 | }
|
26491 |
|
26492 | workInProgress.childExpirationTime = current.childExpirationTime;
|
26493 | workInProgress.expirationTime = current.expirationTime;
|
26494 | workInProgress.child = current.child;
|
26495 | workInProgress.memoizedProps = current.memoizedProps;
|
26496 | workInProgress.memoizedState = current.memoizedState;
|
26497 | workInProgress.updateQueue = current.updateQueue;
|
26498 |
|
26499 |
|
26500 | var currentDependencies = current.dependencies;
|
26501 | workInProgress.dependencies = currentDependencies === null ? null : {
|
26502 | expirationTime: currentDependencies.expirationTime,
|
26503 | firstContext: currentDependencies.firstContext,
|
26504 | responders: currentDependencies.responders
|
26505 | };
|
26506 |
|
26507 | workInProgress.sibling = current.sibling;
|
26508 | workInProgress.index = current.index;
|
26509 | workInProgress.ref = current.ref;
|
26510 |
|
26511 | if (enableProfilerTimer) {
|
26512 | workInProgress.selfBaseDuration = current.selfBaseDuration;
|
26513 | workInProgress.treeBaseDuration = current.treeBaseDuration;
|
26514 | }
|
26515 |
|
26516 | {
|
26517 | workInProgress._debugNeedsRemount = current._debugNeedsRemount;
|
26518 |
|
26519 | switch (workInProgress.tag) {
|
26520 | case IndeterminateComponent:
|
26521 | case FunctionComponent:
|
26522 | case SimpleMemoComponent:
|
26523 | workInProgress.type = resolveFunctionForHotReloading(current.type);
|
26524 | break;
|
26525 |
|
26526 | case ClassComponent:
|
26527 | workInProgress.type = resolveClassForHotReloading(current.type);
|
26528 | break;
|
26529 |
|
26530 | case ForwardRef:
|
26531 | workInProgress.type = resolveForwardRefForHotReloading(current.type);
|
26532 | break;
|
26533 |
|
26534 | default:
|
26535 | break;
|
26536 | }
|
26537 | }
|
26538 |
|
26539 | return workInProgress;
|
26540 | }
|
26541 |
|
26542 | function resetWorkInProgress(workInProgress, renderExpirationTime) {
|
26543 |
|
26544 |
|
26545 |
|
26546 |
|
26547 |
|
26548 |
|
26549 |
|
26550 |
|
26551 | workInProgress.effectTag &= Placement;
|
26552 |
|
26553 | workInProgress.nextEffect = null;
|
26554 | workInProgress.firstEffect = null;
|
26555 | workInProgress.lastEffect = null;
|
26556 | var current = workInProgress.alternate;
|
26557 |
|
26558 | if (current === null) {
|
26559 |
|
26560 | workInProgress.childExpirationTime = NoWork;
|
26561 | workInProgress.expirationTime = renderExpirationTime;
|
26562 | workInProgress.child = null;
|
26563 | workInProgress.memoizedProps = null;
|
26564 | workInProgress.memoizedState = null;
|
26565 | workInProgress.updateQueue = null;
|
26566 | workInProgress.dependencies = null;
|
26567 |
|
26568 | if (enableProfilerTimer) {
|
26569 |
|
26570 |
|
26571 | workInProgress.selfBaseDuration = 0;
|
26572 | workInProgress.treeBaseDuration = 0;
|
26573 | }
|
26574 | } else {
|
26575 |
|
26576 | workInProgress.childExpirationTime = current.childExpirationTime;
|
26577 | workInProgress.expirationTime = current.expirationTime;
|
26578 | workInProgress.child = current.child;
|
26579 | workInProgress.memoizedProps = current.memoizedProps;
|
26580 | workInProgress.memoizedState = current.memoizedState;
|
26581 | workInProgress.updateQueue = current.updateQueue;
|
26582 |
|
26583 |
|
26584 | var currentDependencies = current.dependencies;
|
26585 | workInProgress.dependencies = currentDependencies === null ? null : {
|
26586 | expirationTime: currentDependencies.expirationTime,
|
26587 | firstContext: currentDependencies.firstContext,
|
26588 | responders: currentDependencies.responders
|
26589 | };
|
26590 |
|
26591 | if (enableProfilerTimer) {
|
26592 |
|
26593 |
|
26594 | workInProgress.selfBaseDuration = current.selfBaseDuration;
|
26595 | workInProgress.treeBaseDuration = current.treeBaseDuration;
|
26596 | }
|
26597 | }
|
26598 |
|
26599 | return workInProgress;
|
26600 | }
|
26601 | function createHostRootFiber(tag) {
|
26602 | var mode;
|
26603 |
|
26604 | if (tag === ConcurrentRoot) {
|
26605 | mode = ConcurrentMode | BatchedMode | StrictMode;
|
26606 | } else if (tag === BatchedRoot) {
|
26607 | mode = BatchedMode | StrictMode;
|
26608 | } else {
|
26609 | mode = NoMode;
|
26610 | }
|
26611 |
|
26612 | if (enableProfilerTimer && isDevToolsPresent) {
|
26613 |
|
26614 |
|
26615 |
|
26616 | mode |= ProfileMode;
|
26617 | }
|
26618 |
|
26619 | return createFiber(HostRoot, null, null, mode);
|
26620 | }
|
26621 | function createFiberFromTypeAndProps(type, // React$ElementType
|
26622 | key, pendingProps, owner, mode, expirationTime) {
|
26623 | var fiber;
|
26624 | var fiberTag = IndeterminateComponent;
|
26625 |
|
26626 | var resolvedType = type;
|
26627 |
|
26628 | if (typeof type === 'function') {
|
26629 | if (shouldConstruct(type)) {
|
26630 | fiberTag = ClassComponent;
|
26631 |
|
26632 | {
|
26633 | resolvedType = resolveClassForHotReloading(resolvedType);
|
26634 | }
|
26635 | } else {
|
26636 | {
|
26637 | resolvedType = resolveFunctionForHotReloading(resolvedType);
|
26638 | }
|
26639 | }
|
26640 | } else if (typeof type === 'string') {
|
26641 | fiberTag = HostComponent;
|
26642 | } else {
|
26643 | getTag: switch (type) {
|
26644 | case REACT_FRAGMENT_TYPE:
|
26645 | return createFiberFromFragment(pendingProps.children, mode, expirationTime, key);
|
26646 |
|
26647 | case REACT_CONCURRENT_MODE_TYPE:
|
26648 | fiberTag = Mode;
|
26649 | mode |= ConcurrentMode | BatchedMode | StrictMode;
|
26650 | break;
|
26651 |
|
26652 | case REACT_STRICT_MODE_TYPE:
|
26653 | fiberTag = Mode;
|
26654 | mode |= StrictMode;
|
26655 | break;
|
26656 |
|
26657 | case REACT_PROFILER_TYPE:
|
26658 | return createFiberFromProfiler(pendingProps, mode, expirationTime, key);
|
26659 |
|
26660 | case REACT_SUSPENSE_TYPE:
|
26661 | return createFiberFromSuspense(pendingProps, mode, expirationTime, key);
|
26662 |
|
26663 | case REACT_SUSPENSE_LIST_TYPE:
|
26664 | return createFiberFromSuspenseList(pendingProps, mode, expirationTime, key);
|
26665 |
|
26666 | default:
|
26667 | {
|
26668 | if (typeof type === 'object' && type !== null) {
|
26669 | switch (type.$$typeof) {
|
26670 | case REACT_PROVIDER_TYPE:
|
26671 | fiberTag = ContextProvider;
|
26672 | break getTag;
|
26673 |
|
26674 | case REACT_CONTEXT_TYPE:
|
26675 |
|
26676 | fiberTag = ContextConsumer;
|
26677 | break getTag;
|
26678 |
|
26679 | case REACT_FORWARD_REF_TYPE:
|
26680 | fiberTag = ForwardRef;
|
26681 |
|
26682 | {
|
26683 | resolvedType = resolveForwardRefForHotReloading(resolvedType);
|
26684 | }
|
26685 |
|
26686 | break getTag;
|
26687 |
|
26688 | case REACT_MEMO_TYPE:
|
26689 | fiberTag = MemoComponent;
|
26690 | break getTag;
|
26691 |
|
26692 | case REACT_LAZY_TYPE:
|
26693 | fiberTag = LazyComponent;
|
26694 | resolvedType = null;
|
26695 | break getTag;
|
26696 |
|
26697 | case REACT_FUNDAMENTAL_TYPE:
|
26698 | if (enableFundamentalAPI) {
|
26699 | return createFiberFromFundamental(type, pendingProps, mode, expirationTime, key);
|
26700 | }
|
26701 |
|
26702 | break;
|
26703 |
|
26704 | case REACT_SCOPE_TYPE:
|
26705 | if (enableScopeAPI) {
|
26706 | return createFiberFromScope(type, pendingProps, mode, expirationTime, key);
|
26707 | }
|
26708 |
|
26709 | }
|
26710 | }
|
26711 |
|
26712 | var info = '';
|
26713 |
|
26714 | {
|
26715 | if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
26716 | 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.';
|
26717 | }
|
26718 |
|
26719 | var ownerName = owner ? getComponentName(owner.type) : null;
|
26720 |
|
26721 | if (ownerName) {
|
26722 | info += '\n\nCheck the render method of `' + ownerName + '`.';
|
26723 | }
|
26724 | }
|
26725 |
|
26726 | (function () {
|
26727 | {
|
26728 | {
|
26729 | throw ReactError(Error("Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + (type == null ? type : typeof type) + "." + info));
|
26730 | }
|
26731 | }
|
26732 | })();
|
26733 | }
|
26734 | }
|
26735 | }
|
26736 |
|
26737 | fiber = createFiber(fiberTag, pendingProps, key, mode);
|
26738 | fiber.elementType = type;
|
26739 | fiber.type = resolvedType;
|
26740 | fiber.expirationTime = expirationTime;
|
26741 | return fiber;
|
26742 | }
|
26743 | function createFiberFromElement(element, mode, expirationTime) {
|
26744 | var owner = null;
|
26745 |
|
26746 | {
|
26747 | owner = element._owner;
|
26748 | }
|
26749 |
|
26750 | var type = element.type;
|
26751 | var key = element.key;
|
26752 | var pendingProps = element.props;
|
26753 | var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, expirationTime);
|
26754 |
|
26755 | {
|
26756 | fiber._debugSource = element._source;
|
26757 | fiber._debugOwner = element._owner;
|
26758 | }
|
26759 |
|
26760 | return fiber;
|
26761 | }
|
26762 | function createFiberFromFragment(elements, mode, expirationTime, key) {
|
26763 | var fiber = createFiber(Fragment, elements, key, mode);
|
26764 | fiber.expirationTime = expirationTime;
|
26765 | return fiber;
|
26766 | }
|
26767 | function createFiberFromFundamental(fundamentalComponent, pendingProps, mode, expirationTime, key) {
|
26768 | var fiber = createFiber(FundamentalComponent, pendingProps, key, mode);
|
26769 | fiber.elementType = fundamentalComponent;
|
26770 | fiber.type = fundamentalComponent;
|
26771 | fiber.expirationTime = expirationTime;
|
26772 | return fiber;
|
26773 | }
|
26774 |
|
26775 | function createFiberFromScope(scope, pendingProps, mode, expirationTime, key) {
|
26776 | var fiber = createFiber(ScopeComponent, pendingProps, key, mode);
|
26777 | fiber.type = scope;
|
26778 | fiber.elementType = scope;
|
26779 | fiber.expirationTime = expirationTime;
|
26780 | return fiber;
|
26781 | }
|
26782 |
|
26783 | function createFiberFromProfiler(pendingProps, mode, expirationTime, key) {
|
26784 | {
|
26785 | if (typeof pendingProps.id !== 'string' || typeof pendingProps.onRender !== 'function') {
|
26786 | warningWithoutStack$1(false, 'Profiler must specify an "id" string and "onRender" function as props');
|
26787 | }
|
26788 | }
|
26789 |
|
26790 | var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode);
|
26791 |
|
26792 | fiber.elementType = REACT_PROFILER_TYPE;
|
26793 | fiber.type = REACT_PROFILER_TYPE;
|
26794 | fiber.expirationTime = expirationTime;
|
26795 | return fiber;
|
26796 | }
|
26797 |
|
26798 | function createFiberFromSuspense(pendingProps, mode, expirationTime, key) {
|
26799 | var fiber = createFiber(SuspenseComponent, pendingProps, key, mode);
|
26800 |
|
26801 |
|
26802 |
|
26803 | fiber.type = REACT_SUSPENSE_TYPE;
|
26804 | fiber.elementType = REACT_SUSPENSE_TYPE;
|
26805 | fiber.expirationTime = expirationTime;
|
26806 | return fiber;
|
26807 | }
|
26808 | function createFiberFromSuspenseList(pendingProps, mode, expirationTime, key) {
|
26809 | var fiber = createFiber(SuspenseListComponent, pendingProps, key, mode);
|
26810 |
|
26811 | {
|
26812 |
|
26813 |
|
26814 |
|
26815 | fiber.type = REACT_SUSPENSE_LIST_TYPE;
|
26816 | }
|
26817 |
|
26818 | fiber.elementType = REACT_SUSPENSE_LIST_TYPE;
|
26819 | fiber.expirationTime = expirationTime;
|
26820 | return fiber;
|
26821 | }
|
26822 | function createFiberFromText(content, mode, expirationTime) {
|
26823 | var fiber = createFiber(HostText, content, null, mode);
|
26824 | fiber.expirationTime = expirationTime;
|
26825 | return fiber;
|
26826 | }
|
26827 | function createFiberFromHostInstanceForDeletion() {
|
26828 | var fiber = createFiber(HostComponent, null, null, NoMode);
|
26829 |
|
26830 | fiber.elementType = 'DELETED';
|
26831 | fiber.type = 'DELETED';
|
26832 | return fiber;
|
26833 | }
|
26834 | function createFiberFromDehydratedFragment(dehydratedNode) {
|
26835 | var fiber = createFiber(DehydratedFragment, null, null, NoMode);
|
26836 | fiber.stateNode = dehydratedNode;
|
26837 | return fiber;
|
26838 | }
|
26839 | function createFiberFromPortal(portal, mode, expirationTime) {
|
26840 | var pendingProps = portal.children !== null ? portal.children : [];
|
26841 | var fiber = createFiber(HostPortal, pendingProps, portal.key, mode);
|
26842 | fiber.expirationTime = expirationTime;
|
26843 | fiber.stateNode = {
|
26844 | containerInfo: portal.containerInfo,
|
26845 | pendingChildren: null,
|
26846 |
|
26847 | implementation: portal.implementation
|
26848 | };
|
26849 | return fiber;
|
26850 | }
|
26851 |
|
26852 | function assignFiberPropertiesInDEV(target, source) {
|
26853 | if (target === null) {
|
26854 |
|
26855 |
|
26856 | target = createFiber(IndeterminateComponent, null, null, NoMode);
|
26857 | }
|
26858 |
|
26859 |
|
26860 |
|
26861 |
|
26862 |
|
26863 |
|
26864 | target.tag = source.tag;
|
26865 | target.key = source.key;
|
26866 | target.elementType = source.elementType;
|
26867 | target.type = source.type;
|
26868 | target.stateNode = source.stateNode;
|
26869 | target.return = source.return;
|
26870 | target.child = source.child;
|
26871 | target.sibling = source.sibling;
|
26872 | target.index = source.index;
|
26873 | target.ref = source.ref;
|
26874 | target.pendingProps = source.pendingProps;
|
26875 | target.memoizedProps = source.memoizedProps;
|
26876 | target.updateQueue = source.updateQueue;
|
26877 | target.memoizedState = source.memoizedState;
|
26878 | target.dependencies = source.dependencies;
|
26879 | target.mode = source.mode;
|
26880 | target.effectTag = source.effectTag;
|
26881 | target.nextEffect = source.nextEffect;
|
26882 | target.firstEffect = source.firstEffect;
|
26883 | target.lastEffect = source.lastEffect;
|
26884 | target.expirationTime = source.expirationTime;
|
26885 | target.childExpirationTime = source.childExpirationTime;
|
26886 | target.alternate = source.alternate;
|
26887 |
|
26888 | if (enableProfilerTimer) {
|
26889 | target.actualDuration = source.actualDuration;
|
26890 | target.actualStartTime = source.actualStartTime;
|
26891 | target.selfBaseDuration = source.selfBaseDuration;
|
26892 | target.treeBaseDuration = source.treeBaseDuration;
|
26893 | }
|
26894 |
|
26895 | target._debugID = source._debugID;
|
26896 | target._debugSource = source._debugSource;
|
26897 | target._debugOwner = source._debugOwner;
|
26898 | target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming;
|
26899 | target._debugNeedsRemount = source._debugNeedsRemount;
|
26900 | target._debugHookTypes = source._debugHookTypes;
|
26901 | return target;
|
26902 | }
|
26903 |
|
26904 | function FiberRootNode(containerInfo, tag, hydrate) {
|
26905 | this.tag = tag;
|
26906 | this.current = null;
|
26907 | this.containerInfo = containerInfo;
|
26908 | this.pendingChildren = null;
|
26909 | this.pingCache = null;
|
26910 | this.finishedExpirationTime = NoWork;
|
26911 | this.finishedWork = null;
|
26912 | this.timeoutHandle = noTimeout;
|
26913 | this.context = null;
|
26914 | this.pendingContext = null;
|
26915 | this.hydrate = hydrate;
|
26916 | this.firstBatch = null;
|
26917 | this.callbackNode = null;
|
26918 | this.callbackPriority = NoPriority;
|
26919 | this.firstPendingTime = NoWork;
|
26920 | this.firstSuspendedTime = NoWork;
|
26921 | this.lastSuspendedTime = NoWork;
|
26922 | this.nextKnownPendingLevel = NoWork;
|
26923 | this.lastPingedTime = NoWork;
|
26924 | this.lastExpiredTime = NoWork;
|
26925 |
|
26926 | if (enableSchedulerTracing) {
|
26927 | this.interactionThreadID = unstable_getThreadID();
|
26928 | this.memoizedInteractions = new Set();
|
26929 | this.pendingInteractionMap = new Map();
|
26930 | }
|
26931 |
|
26932 | if (enableSuspenseCallback) {
|
26933 | this.hydrationCallbacks = null;
|
26934 | }
|
26935 | }
|
26936 |
|
26937 | function createFiberRoot(containerInfo, tag, hydrate, hydrationCallbacks) {
|
26938 | var root = new FiberRootNode(containerInfo, tag, hydrate);
|
26939 |
|
26940 | if (enableSuspenseCallback) {
|
26941 | root.hydrationCallbacks = hydrationCallbacks;
|
26942 | }
|
26943 |
|
26944 |
|
26945 |
|
26946 | var uninitializedFiber = createHostRootFiber(tag);
|
26947 | root.current = uninitializedFiber;
|
26948 | uninitializedFiber.stateNode = root;
|
26949 | return root;
|
26950 | }
|
26951 | function isRootSuspendedAtTime(root, expirationTime) {
|
26952 | var firstSuspendedTime = root.firstSuspendedTime;
|
26953 | var lastSuspendedTime = root.lastSuspendedTime;
|
26954 | return firstSuspendedTime !== NoWork && firstSuspendedTime >= expirationTime && lastSuspendedTime <= expirationTime;
|
26955 | }
|
26956 | function markRootSuspendedAtTime(root, expirationTime) {
|
26957 | var firstSuspendedTime = root.firstSuspendedTime;
|
26958 | var lastSuspendedTime = root.lastSuspendedTime;
|
26959 |
|
26960 | if (firstSuspendedTime < expirationTime) {
|
26961 | root.firstSuspendedTime = expirationTime;
|
26962 | }
|
26963 |
|
26964 | if (lastSuspendedTime > expirationTime || firstSuspendedTime === NoWork) {
|
26965 | root.lastSuspendedTime = expirationTime;
|
26966 | }
|
26967 |
|
26968 | if (expirationTime <= root.lastPingedTime) {
|
26969 | root.lastPingedTime = NoWork;
|
26970 | }
|
26971 |
|
26972 | if (expirationTime <= root.lastExpiredTime) {
|
26973 | root.lastExpiredTime = NoWork;
|
26974 | }
|
26975 | }
|
26976 | function markRootUpdatedAtTime(root, expirationTime) {
|
26977 |
|
26978 | var firstPendingTime = root.firstPendingTime;
|
26979 |
|
26980 | if (expirationTime > firstPendingTime) {
|
26981 | root.firstPendingTime = expirationTime;
|
26982 | }
|
26983 |
|
26984 |
|
26985 |
|
26986 | var firstSuspendedTime = root.firstSuspendedTime;
|
26987 |
|
26988 | if (firstSuspendedTime !== NoWork) {
|
26989 | if (expirationTime >= firstSuspendedTime) {
|
26990 |
|
26991 | root.firstSuspendedTime = root.lastSuspendedTime = root.nextKnownPendingLevel = NoWork;
|
26992 | } else if (expirationTime >= root.lastSuspendedTime) {
|
26993 | root.lastSuspendedTime = expirationTime + 1;
|
26994 | }
|
26995 |
|
26996 |
|
26997 |
|
26998 | if (expirationTime > root.nextKnownPendingLevel) {
|
26999 | root.nextKnownPendingLevel = expirationTime;
|
27000 | }
|
27001 | }
|
27002 | }
|
27003 | function markRootFinishedAtTime(root, finishedExpirationTime, remainingExpirationTime) {
|
27004 |
|
27005 | root.firstPendingTime = remainingExpirationTime;
|
27006 |
|
27007 |
|
27008 | if (finishedExpirationTime <= root.lastSuspendedTime) {
|
27009 |
|
27010 | root.firstSuspendedTime = root.lastSuspendedTime = root.nextKnownPendingLevel = NoWork;
|
27011 | } else if (finishedExpirationTime <= root.firstSuspendedTime) {
|
27012 |
|
27013 |
|
27014 |
|
27015 | root.firstSuspendedTime = finishedExpirationTime - 1;
|
27016 | }
|
27017 |
|
27018 | if (finishedExpirationTime <= root.lastPingedTime) {
|
27019 |
|
27020 | root.lastPingedTime = NoWork;
|
27021 | }
|
27022 |
|
27023 | if (finishedExpirationTime <= root.lastExpiredTime) {
|
27024 |
|
27025 | root.lastExpiredTime = NoWork;
|
27026 | }
|
27027 | }
|
27028 | function markRootExpiredAtTime(root, expirationTime) {
|
27029 | var lastExpiredTime = root.lastExpiredTime;
|
27030 |
|
27031 | if (lastExpiredTime === NoWork || lastExpiredTime > expirationTime) {
|
27032 | root.lastExpiredTime = expirationTime;
|
27033 | }
|
27034 | }
|
27035 |
|
27036 |
|
27037 |
|
27038 |
|
27039 |
|
27040 | var ReactFiberInstrumentation = {
|
27041 | debugTool: null
|
27042 | };
|
27043 | var ReactFiberInstrumentation_1 = ReactFiberInstrumentation;
|
27044 |
|
27045 | var didWarnAboutNestedUpdates;
|
27046 | var didWarnAboutFindNodeInStrictMode;
|
27047 |
|
27048 | {
|
27049 | didWarnAboutNestedUpdates = false;
|
27050 | didWarnAboutFindNodeInStrictMode = {};
|
27051 | }
|
27052 |
|
27053 | function getContextForSubtree(parentComponent) {
|
27054 | if (!parentComponent) {
|
27055 | return emptyContextObject;
|
27056 | }
|
27057 |
|
27058 | var fiber = get(parentComponent);
|
27059 | var parentContext = findCurrentUnmaskedContext(fiber);
|
27060 |
|
27061 | if (fiber.tag === ClassComponent) {
|
27062 | var Component = fiber.type;
|
27063 |
|
27064 | if (isContextProvider(Component)) {
|
27065 | return processChildContext(fiber, Component, parentContext);
|
27066 | }
|
27067 | }
|
27068 |
|
27069 | return parentContext;
|
27070 | }
|
27071 |
|
27072 | function scheduleRootUpdate(current$$1, element, expirationTime, suspenseConfig, callback) {
|
27073 | {
|
27074 | if (phase === 'render' && current !== null && !didWarnAboutNestedUpdates) {
|
27075 | didWarnAboutNestedUpdates = true;
|
27076 | warningWithoutStack$1(false, 'Render methods should be a pure function of props and state; ' + 'triggering nested component updates from render is not allowed. ' + 'If necessary, trigger nested updates in componentDidUpdate.\n\n' + 'Check the render method of %s.', getComponentName(current.type) || 'Unknown');
|
27077 | }
|
27078 | }
|
27079 |
|
27080 | var update = createUpdate(expirationTime, suspenseConfig);
|
27081 |
|
27082 |
|
27083 | update.payload = {
|
27084 | element: element
|
27085 | };
|
27086 | callback = callback === undefined ? null : callback;
|
27087 |
|
27088 | if (callback !== null) {
|
27089 | !(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
|
27090 | update.callback = callback;
|
27091 | }
|
27092 |
|
27093 | enqueueUpdate(current$$1, update);
|
27094 | scheduleWork(current$$1, expirationTime);
|
27095 | return expirationTime;
|
27096 | }
|
27097 |
|
27098 | function updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, suspenseConfig, callback) {
|
27099 |
|
27100 | var current$$1 = container.current;
|
27101 |
|
27102 | {
|
27103 | if (ReactFiberInstrumentation_1.debugTool) {
|
27104 | if (current$$1.alternate === null) {
|
27105 | ReactFiberInstrumentation_1.debugTool.onMountContainer(container);
|
27106 | } else if (element === null) {
|
27107 | ReactFiberInstrumentation_1.debugTool.onUnmountContainer(container);
|
27108 | } else {
|
27109 | ReactFiberInstrumentation_1.debugTool.onUpdateContainer(container);
|
27110 | }
|
27111 | }
|
27112 | }
|
27113 |
|
27114 | var context = getContextForSubtree(parentComponent);
|
27115 |
|
27116 | if (container.context === null) {
|
27117 | container.context = context;
|
27118 | } else {
|
27119 | container.pendingContext = context;
|
27120 | }
|
27121 |
|
27122 | return scheduleRootUpdate(current$$1, element, expirationTime, suspenseConfig, callback);
|
27123 | }
|
27124 |
|
27125 | function findHostInstance(component) {
|
27126 | var fiber = get(component);
|
27127 |
|
27128 | if (fiber === undefined) {
|
27129 | if (typeof component.render === 'function') {
|
27130 | (function () {
|
27131 | {
|
27132 | {
|
27133 | throw ReactError(Error("Unable to find node on an unmounted component."));
|
27134 | }
|
27135 | }
|
27136 | })();
|
27137 | } else {
|
27138 | (function () {
|
27139 | {
|
27140 | {
|
27141 | throw ReactError(Error("Argument appears to not be a ReactComponent. Keys: " + Object.keys(component)));
|
27142 | }
|
27143 | }
|
27144 | })();
|
27145 | }
|
27146 | }
|
27147 |
|
27148 | var hostFiber = findCurrentHostFiber(fiber);
|
27149 |
|
27150 | if (hostFiber === null) {
|
27151 | return null;
|
27152 | }
|
27153 |
|
27154 | return hostFiber.stateNode;
|
27155 | }
|
27156 |
|
27157 | function findHostInstanceWithWarning(component, methodName) {
|
27158 | {
|
27159 | var fiber = get(component);
|
27160 |
|
27161 | if (fiber === undefined) {
|
27162 | if (typeof component.render === 'function') {
|
27163 | (function () {
|
27164 | {
|
27165 | {
|
27166 | throw ReactError(Error("Unable to find node on an unmounted component."));
|
27167 | }
|
27168 | }
|
27169 | })();
|
27170 | } else {
|
27171 | (function () {
|
27172 | {
|
27173 | {
|
27174 | throw ReactError(Error("Argument appears to not be a ReactComponent. Keys: " + Object.keys(component)));
|
27175 | }
|
27176 | }
|
27177 | })();
|
27178 | }
|
27179 | }
|
27180 |
|
27181 | var hostFiber = findCurrentHostFiber(fiber);
|
27182 |
|
27183 | if (hostFiber === null) {
|
27184 | return null;
|
27185 | }
|
27186 |
|
27187 | if (hostFiber.mode & StrictMode) {
|
27188 | var componentName = getComponentName(fiber.type) || 'Component';
|
27189 |
|
27190 | if (!didWarnAboutFindNodeInStrictMode[componentName]) {
|
27191 | didWarnAboutFindNodeInStrictMode[componentName] = true;
|
27192 |
|
27193 | if (fiber.mode & StrictMode) {
|
27194 | warningWithoutStack$1(false, '%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which is inside StrictMode. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-find-node%s', methodName, methodName, componentName, getStackByFiberInDevAndProd(hostFiber));
|
27195 | } else {
|
27196 | warningWithoutStack$1(false, '%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which renders StrictMode children. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-find-node%s', methodName, methodName, componentName, getStackByFiberInDevAndProd(hostFiber));
|
27197 | }
|
27198 | }
|
27199 | }
|
27200 |
|
27201 | return hostFiber.stateNode;
|
27202 | }
|
27203 |
|
27204 | return findHostInstance(component);
|
27205 | }
|
27206 |
|
27207 | function createContainer(containerInfo, tag, hydrate, hydrationCallbacks) {
|
27208 | return createFiberRoot(containerInfo, tag, hydrate, hydrationCallbacks);
|
27209 | }
|
27210 | function updateContainer(element, container, parentComponent, callback) {
|
27211 | var current$$1 = container.current;
|
27212 | var currentTime = requestCurrentTime();
|
27213 |
|
27214 | {
|
27215 |
|
27216 | if ('undefined' !== typeof jest) {
|
27217 | warnIfUnmockedScheduler(current$$1);
|
27218 | warnIfNotScopedWithMatchingAct(current$$1);
|
27219 | }
|
27220 | }
|
27221 |
|
27222 | var suspenseConfig = requestCurrentSuspenseConfig();
|
27223 | var expirationTime = computeExpirationForFiber(currentTime, current$$1, suspenseConfig);
|
27224 | return updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, suspenseConfig, callback);
|
27225 | }
|
27226 | function getPublicRootInstance(container) {
|
27227 | var containerFiber = container.current;
|
27228 |
|
27229 | if (!containerFiber.child) {
|
27230 | return null;
|
27231 | }
|
27232 |
|
27233 | switch (containerFiber.child.tag) {
|
27234 | case HostComponent:
|
27235 | return getPublicInstance(containerFiber.child.stateNode);
|
27236 |
|
27237 | default:
|
27238 | return containerFiber.child.stateNode;
|
27239 | }
|
27240 | }
|
27241 | function attemptSynchronousHydration$1(fiber) {
|
27242 | switch (fiber.tag) {
|
27243 | case HostRoot:
|
27244 | var root = fiber.stateNode;
|
27245 |
|
27246 | if (root.hydrate) {
|
27247 |
|
27248 | flushRoot(root, root.firstPendingTime);
|
27249 | }
|
27250 |
|
27251 | break;
|
27252 |
|
27253 | case SuspenseComponent:
|
27254 | flushSync(function () {
|
27255 | return scheduleWork(fiber, Sync);
|
27256 | });
|
27257 | break;
|
27258 | }
|
27259 | }
|
27260 | function findHostInstanceWithNoPortals(fiber) {
|
27261 | var hostFiber = findCurrentHostFiberWithNoPortals(fiber);
|
27262 |
|
27263 | if (hostFiber === null) {
|
27264 | return null;
|
27265 | }
|
27266 |
|
27267 | if (hostFiber.tag === FundamentalComponent) {
|
27268 | return hostFiber.stateNode.instance;
|
27269 | }
|
27270 |
|
27271 | return hostFiber.stateNode;
|
27272 | }
|
27273 |
|
27274 | var shouldSuspendImpl = function (fiber) {
|
27275 | return false;
|
27276 | };
|
27277 |
|
27278 | function shouldSuspend(fiber) {
|
27279 | return shouldSuspendImpl(fiber);
|
27280 | }
|
27281 | var overrideHookState = null;
|
27282 | var overrideProps = null;
|
27283 | var scheduleUpdate = null;
|
27284 | var setSuspenseHandler = null;
|
27285 |
|
27286 | {
|
27287 | var copyWithSetImpl = function (obj, path, idx, value) {
|
27288 | if (idx >= path.length) {
|
27289 | return value;
|
27290 | }
|
27291 |
|
27292 | var key = path[idx];
|
27293 | var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj);
|
27294 |
|
27295 | updated[key] = copyWithSetImpl(obj[key], path, idx + 1, value);
|
27296 | return updated;
|
27297 | };
|
27298 |
|
27299 | var copyWithSet = function (obj, path, value) {
|
27300 | return copyWithSetImpl(obj, path, 0, value);
|
27301 | };
|
27302 |
|
27303 |
|
27304 | overrideHookState = function (fiber, id, path, value) {
|
27305 |
|
27306 |
|
27307 | var currentHook = fiber.memoizedState;
|
27308 |
|
27309 | while (currentHook !== null && id > 0) {
|
27310 | currentHook = currentHook.next;
|
27311 | id--;
|
27312 | }
|
27313 |
|
27314 | if (currentHook !== null) {
|
27315 | var newState = copyWithSet(currentHook.memoizedState, path, value);
|
27316 | currentHook.memoizedState = newState;
|
27317 | currentHook.baseState = newState;
|
27318 |
|
27319 |
|
27320 |
|
27321 |
|
27322 |
|
27323 | fiber.memoizedProps = _assign({}, fiber.memoizedProps);
|
27324 | scheduleWork(fiber, Sync);
|
27325 | }
|
27326 | };
|
27327 |
|
27328 |
|
27329 | overrideProps = function (fiber, path, value) {
|
27330 | fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value);
|
27331 |
|
27332 | if (fiber.alternate) {
|
27333 | fiber.alternate.pendingProps = fiber.pendingProps;
|
27334 | }
|
27335 |
|
27336 | scheduleWork(fiber, Sync);
|
27337 | };
|
27338 |
|
27339 | scheduleUpdate = function (fiber) {
|
27340 | scheduleWork(fiber, Sync);
|
27341 | };
|
27342 |
|
27343 | setSuspenseHandler = function (newShouldSuspendImpl) {
|
27344 | shouldSuspendImpl = newShouldSuspendImpl;
|
27345 | };
|
27346 | }
|
27347 |
|
27348 | function injectIntoDevTools(devToolsConfig) {
|
27349 | var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance;
|
27350 | var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
27351 | return injectInternals(_assign({}, devToolsConfig, {
|
27352 | overrideHookState: overrideHookState,
|
27353 | overrideProps: overrideProps,
|
27354 | setSuspenseHandler: setSuspenseHandler,
|
27355 | scheduleUpdate: scheduleUpdate,
|
27356 | currentDispatcherRef: ReactCurrentDispatcher,
|
27357 | findHostInstanceByFiber: function (fiber) {
|
27358 | var hostFiber = findCurrentHostFiber(fiber);
|
27359 |
|
27360 | if (hostFiber === null) {
|
27361 | return null;
|
27362 | }
|
27363 |
|
27364 | return hostFiber.stateNode;
|
27365 | },
|
27366 | findFiberByHostInstance: function (instance) {
|
27367 | if (!findFiberByHostInstance) {
|
27368 |
|
27369 | return null;
|
27370 | }
|
27371 |
|
27372 | return findFiberByHostInstance(instance);
|
27373 | },
|
27374 |
|
27375 | findHostInstancesForRefresh: findHostInstancesForRefresh,
|
27376 | scheduleRefresh: scheduleRefresh,
|
27377 | scheduleRoot: scheduleRoot,
|
27378 | setRefreshHandler: setRefreshHandler,
|
27379 |
|
27380 | getCurrentFiber: function () {
|
27381 | return current;
|
27382 | }
|
27383 | }));
|
27384 | }
|
27385 |
|
27386 |
|
27387 |
|
27388 |
|
27389 | function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
|
27390 | implementation) {
|
27391 | var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
27392 | return {
|
27393 |
|
27394 | $$typeof: REACT_PORTAL_TYPE,
|
27395 | key: key == null ? null : '' + key,
|
27396 | children: children,
|
27397 | containerInfo: containerInfo,
|
27398 | implementation: implementation
|
27399 | };
|
27400 | }
|
27401 |
|
27402 |
|
27403 |
|
27404 | var ReactVersion = '16.10.0';
|
27405 |
|
27406 |
|
27407 |
|
27408 | setAttemptSynchronousHydration(attemptSynchronousHydration$1);
|
27409 | var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
27410 | var topLevelUpdateWarnings;
|
27411 | var warnOnInvalidCallback;
|
27412 | var didWarnAboutUnstableCreatePortal = false;
|
27413 |
|
27414 | {
|
27415 | if (typeof Map !== 'function' ||
|
27416 | Map.prototype == null || typeof Map.prototype.forEach !== 'function' || typeof Set !== 'function' ||
|
27417 | Set.prototype == null || typeof Set.prototype.clear !== 'function' || typeof Set.prototype.forEach !== 'function') {
|
27418 | warningWithoutStack$1(false, 'React depends on Map and Set built-in types. Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
|
27419 | }
|
27420 |
|
27421 | topLevelUpdateWarnings = function (container) {
|
27422 | if (container._reactRootContainer && container.nodeType !== COMMENT_NODE) {
|
27423 | var hostInstance = findHostInstanceWithNoPortals(container._reactRootContainer._internalRoot.current);
|
27424 |
|
27425 | if (hostInstance) {
|
27426 | !(hostInstance.parentNode === container) ? warningWithoutStack$1(false, 'render(...): It looks like the React-rendered content of this ' + 'container was removed without using React. This is not ' + 'supported and will cause errors. Instead, call ' + 'ReactDOM.unmountComponentAtNode to empty a container.') : void 0;
|
27427 | }
|
27428 | }
|
27429 |
|
27430 | var isRootRenderedBySomeReact = !!container._reactRootContainer;
|
27431 | var rootEl = getReactRootElementInContainer(container);
|
27432 | var hasNonRootReactChild = !!(rootEl && getInstanceFromNode$1(rootEl));
|
27433 | !(!hasNonRootReactChild || isRootRenderedBySomeReact) ? warningWithoutStack$1(false, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : void 0;
|
27434 | !(container.nodeType !== ELEMENT_NODE || !container.tagName || container.tagName.toUpperCase() !== 'BODY') ? warningWithoutStack$1(false, 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : void 0;
|
27435 | };
|
27436 |
|
27437 | warnOnInvalidCallback = function (callback, callerName) {
|
27438 | !(callback === null || typeof callback === 'function') ? warningWithoutStack$1(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback) : void 0;
|
27439 | };
|
27440 | }
|
27441 |
|
27442 | setRestoreImplementation(restoreControlledState$$1);
|
27443 |
|
27444 | function ReactBatch(root) {
|
27445 | var expirationTime = computeUniqueAsyncExpiration();
|
27446 | this._expirationTime = expirationTime;
|
27447 | this._root = root;
|
27448 | this._next = null;
|
27449 | this._callbacks = null;
|
27450 | this._didComplete = false;
|
27451 | this._hasChildren = false;
|
27452 | this._children = null;
|
27453 | this._defer = true;
|
27454 | }
|
27455 |
|
27456 | ReactBatch.prototype.render = function (children) {
|
27457 | var _this = this;
|
27458 |
|
27459 | (function () {
|
27460 | if (!_this._defer) {
|
27461 | {
|
27462 | throw ReactError(Error("batch.render: Cannot render a batch that already committed."));
|
27463 | }
|
27464 | }
|
27465 | })();
|
27466 |
|
27467 | this._hasChildren = true;
|
27468 | this._children = children;
|
27469 | var internalRoot = this._root._internalRoot;
|
27470 | var expirationTime = this._expirationTime;
|
27471 | var work = new ReactWork();
|
27472 | updateContainerAtExpirationTime(children, internalRoot, null, expirationTime, null, work._onCommit);
|
27473 | return work;
|
27474 | };
|
27475 |
|
27476 | ReactBatch.prototype.then = function (onComplete) {
|
27477 | if (this._didComplete) {
|
27478 | onComplete();
|
27479 | return;
|
27480 | }
|
27481 |
|
27482 | var callbacks = this._callbacks;
|
27483 |
|
27484 | if (callbacks === null) {
|
27485 | callbacks = this._callbacks = [];
|
27486 | }
|
27487 |
|
27488 | callbacks.push(onComplete);
|
27489 | };
|
27490 |
|
27491 | ReactBatch.prototype.commit = function () {
|
27492 | var _this2 = this;
|
27493 |
|
27494 | var internalRoot = this._root._internalRoot;
|
27495 | var firstBatch = internalRoot.firstBatch;
|
27496 |
|
27497 | (function () {
|
27498 | if (!(_this2._defer && firstBatch !== null)) {
|
27499 | {
|
27500 | throw ReactError(Error("batch.commit: Cannot commit a batch multiple times."));
|
27501 | }
|
27502 | }
|
27503 | })();
|
27504 |
|
27505 | if (!this._hasChildren) {
|
27506 |
|
27507 | this._next = null;
|
27508 | this._defer = false;
|
27509 | return;
|
27510 | }
|
27511 |
|
27512 | var expirationTime = this._expirationTime;
|
27513 |
|
27514 | if (firstBatch !== this) {
|
27515 |
|
27516 |
|
27517 |
|
27518 | if (this._hasChildren) {
|
27519 | expirationTime = this._expirationTime = firstBatch._expirationTime;
|
27520 |
|
27521 |
|
27522 |
|
27523 |
|
27524 | this.render(this._children);
|
27525 | }
|
27526 |
|
27527 |
|
27528 | var previous = null;
|
27529 | var batch = firstBatch;
|
27530 |
|
27531 | while (batch !== this) {
|
27532 | previous = batch;
|
27533 | batch = batch._next;
|
27534 | }
|
27535 |
|
27536 | (function () {
|
27537 | if (!(previous !== null)) {
|
27538 | {
|
27539 | throw ReactError(Error("batch.commit: Cannot commit a batch multiple times."));
|
27540 | }
|
27541 | }
|
27542 | })();
|
27543 |
|
27544 | previous._next = batch._next;
|
27545 |
|
27546 | this._next = firstBatch;
|
27547 | firstBatch = internalRoot.firstBatch = this;
|
27548 | }
|
27549 |
|
27550 |
|
27551 | this._defer = false;
|
27552 | flushRoot(internalRoot, expirationTime);
|
27553 |
|
27554 | var next = this._next;
|
27555 | this._next = null;
|
27556 | firstBatch = internalRoot.firstBatch = next;
|
27557 |
|
27558 | if (firstBatch !== null && firstBatch._hasChildren) {
|
27559 | firstBatch.render(firstBatch._children);
|
27560 | }
|
27561 | };
|
27562 |
|
27563 | ReactBatch.prototype._onComplete = function () {
|
27564 | if (this._didComplete) {
|
27565 | return;
|
27566 | }
|
27567 |
|
27568 | this._didComplete = true;
|
27569 | var callbacks = this._callbacks;
|
27570 |
|
27571 | if (callbacks === null) {
|
27572 | return;
|
27573 | }
|
27574 |
|
27575 |
|
27576 | for (var i = 0; i < callbacks.length; i++) {
|
27577 | var _callback = callbacks[i];
|
27578 |
|
27579 | _callback();
|
27580 | }
|
27581 | };
|
27582 |
|
27583 | function ReactWork() {
|
27584 | this._callbacks = null;
|
27585 | this._didCommit = false;
|
27586 |
|
27587 |
|
27588 | this._onCommit = this._onCommit.bind(this);
|
27589 | }
|
27590 |
|
27591 | ReactWork.prototype.then = function (onCommit) {
|
27592 | if (this._didCommit) {
|
27593 | onCommit();
|
27594 | return;
|
27595 | }
|
27596 |
|
27597 | var callbacks = this._callbacks;
|
27598 |
|
27599 | if (callbacks === null) {
|
27600 | callbacks = this._callbacks = [];
|
27601 | }
|
27602 |
|
27603 | callbacks.push(onCommit);
|
27604 | };
|
27605 |
|
27606 | ReactWork.prototype._onCommit = function () {
|
27607 | if (this._didCommit) {
|
27608 | return;
|
27609 | }
|
27610 |
|
27611 | this._didCommit = true;
|
27612 | var callbacks = this._callbacks;
|
27613 |
|
27614 | if (callbacks === null) {
|
27615 | return;
|
27616 | }
|
27617 |
|
27618 |
|
27619 | for (var i = 0; i < callbacks.length; i++) {
|
27620 | var _callback2 = callbacks[i];
|
27621 |
|
27622 | (function () {
|
27623 | if (!(typeof _callback2 === 'function')) {
|
27624 | {
|
27625 | throw ReactError(Error("Invalid argument passed as callback. Expected a function. Instead received: " + _callback2));
|
27626 | }
|
27627 | }
|
27628 | })();
|
27629 |
|
27630 | _callback2();
|
27631 | }
|
27632 | };
|
27633 |
|
27634 | function createRootImpl(container, tag, options) {
|
27635 |
|
27636 | var hydrate = options != null && options.hydrate === true;
|
27637 | var hydrationCallbacks = options != null && options.hydrationOptions || null;
|
27638 | var root = createContainer(container, tag, hydrate, hydrationCallbacks);
|
27639 | markContainerAsRoot(root.current, container);
|
27640 |
|
27641 | if (hydrate && tag !== LegacyRoot) {
|
27642 | var doc = container.nodeType === DOCUMENT_NODE ? container : container.ownerDocument;
|
27643 | eagerlyTrapReplayableEvents(doc);
|
27644 | }
|
27645 |
|
27646 | return root;
|
27647 | }
|
27648 |
|
27649 | function ReactSyncRoot(container, tag, options) {
|
27650 | this._internalRoot = createRootImpl(container, tag, options);
|
27651 | }
|
27652 |
|
27653 | function ReactRoot(container, options) {
|
27654 | this._internalRoot = createRootImpl(container, ConcurrentRoot, options);
|
27655 | }
|
27656 |
|
27657 | ReactRoot.prototype.render = ReactSyncRoot.prototype.render = function (children, callback) {
|
27658 | var root = this._internalRoot;
|
27659 | var work = new ReactWork();
|
27660 | callback = callback === undefined ? null : callback;
|
27661 |
|
27662 | {
|
27663 | warnOnInvalidCallback(callback, 'render');
|
27664 | }
|
27665 |
|
27666 | if (callback !== null) {
|
27667 | work.then(callback);
|
27668 | }
|
27669 |
|
27670 | updateContainer(children, root, null, work._onCommit);
|
27671 | return work;
|
27672 | };
|
27673 |
|
27674 | ReactRoot.prototype.unmount = ReactSyncRoot.prototype.unmount = function (callback) {
|
27675 | var root = this._internalRoot;
|
27676 | var work = new ReactWork();
|
27677 | callback = callback === undefined ? null : callback;
|
27678 |
|
27679 | {
|
27680 | warnOnInvalidCallback(callback, 'render');
|
27681 | }
|
27682 |
|
27683 | if (callback !== null) {
|
27684 | work.then(callback);
|
27685 | }
|
27686 |
|
27687 | updateContainer(null, root, null, work._onCommit);
|
27688 | return work;
|
27689 | };
|
27690 |
|
27691 |
|
27692 | ReactRoot.prototype.createBatch = function () {
|
27693 | var batch = new ReactBatch(this);
|
27694 | var expirationTime = batch._expirationTime;
|
27695 | var internalRoot = this._internalRoot;
|
27696 | var firstBatch = internalRoot.firstBatch;
|
27697 |
|
27698 | if (firstBatch === null) {
|
27699 | internalRoot.firstBatch = batch;
|
27700 | batch._next = null;
|
27701 | } else {
|
27702 |
|
27703 | var insertAfter = null;
|
27704 | var insertBefore = firstBatch;
|
27705 |
|
27706 | while (insertBefore !== null && insertBefore._expirationTime >= expirationTime) {
|
27707 | insertAfter = insertBefore;
|
27708 | insertBefore = insertBefore._next;
|
27709 | }
|
27710 |
|
27711 | batch._next = insertBefore;
|
27712 |
|
27713 | if (insertAfter !== null) {
|
27714 | insertAfter._next = batch;
|
27715 | }
|
27716 | }
|
27717 |
|
27718 | return batch;
|
27719 | };
|
27720 |
|
27721 |
|
27722 |
|
27723 |
|
27724 |
|
27725 |
|
27726 |
|
27727 |
|
27728 |
|
27729 | function isValidContainer(node) {
|
27730 | return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || node.nodeType === COMMENT_NODE && node.nodeValue === ' react-mount-point-unstable '));
|
27731 | }
|
27732 |
|
27733 | function getReactRootElementInContainer(container) {
|
27734 | if (!container) {
|
27735 | return null;
|
27736 | }
|
27737 |
|
27738 | if (container.nodeType === DOCUMENT_NODE) {
|
27739 | return container.documentElement;
|
27740 | } else {
|
27741 | return container.firstChild;
|
27742 | }
|
27743 | }
|
27744 |
|
27745 | function shouldHydrateDueToLegacyHeuristic(container) {
|
27746 | var rootElement = getReactRootElementInContainer(container);
|
27747 | return !!(rootElement && rootElement.nodeType === ELEMENT_NODE && rootElement.hasAttribute(ROOT_ATTRIBUTE_NAME));
|
27748 | }
|
27749 |
|
27750 | setBatchingImplementation(batchedUpdates$1, discreteUpdates$1, flushDiscreteUpdates, batchedEventUpdates$1);
|
27751 | var warnedAboutHydrateAPI = false;
|
27752 |
|
27753 | function legacyCreateRootFromDOMContainer(container, forceHydrate) {
|
27754 | var shouldHydrate = forceHydrate || shouldHydrateDueToLegacyHeuristic(container);
|
27755 |
|
27756 | if (!shouldHydrate) {
|
27757 | var warned = false;
|
27758 | var rootSibling;
|
27759 |
|
27760 | while (rootSibling = container.lastChild) {
|
27761 | {
|
27762 | if (!warned && rootSibling.nodeType === ELEMENT_NODE && rootSibling.hasAttribute(ROOT_ATTRIBUTE_NAME)) {
|
27763 | warned = true;
|
27764 | warningWithoutStack$1(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.');
|
27765 | }
|
27766 | }
|
27767 |
|
27768 | container.removeChild(rootSibling);
|
27769 | }
|
27770 | }
|
27771 |
|
27772 | {
|
27773 | if (shouldHydrate && !forceHydrate && !warnedAboutHydrateAPI) {
|
27774 | warnedAboutHydrateAPI = true;
|
27775 | lowPriorityWarningWithoutStack$1(false, 'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' + 'will stop working in React v17. Replace the ReactDOM.render() call ' + 'with ReactDOM.hydrate() if you want React to attach to the server HTML.');
|
27776 | }
|
27777 | }
|
27778 |
|
27779 |
|
27780 | return new ReactSyncRoot(container, LegacyRoot, shouldHydrate ? {
|
27781 | hydrate: true
|
27782 | } : undefined);
|
27783 | }
|
27784 |
|
27785 | function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) {
|
27786 | {
|
27787 | topLevelUpdateWarnings(container);
|
27788 | warnOnInvalidCallback(callback === undefined ? null : callback, 'render');
|
27789 | }
|
27790 |
|
27791 |
|
27792 |
|
27793 | var root = container._reactRootContainer;
|
27794 | var fiberRoot;
|
27795 |
|
27796 | if (!root) {
|
27797 |
|
27798 | root = container._reactRootContainer = legacyCreateRootFromDOMContainer(container, forceHydrate);
|
27799 | fiberRoot = root._internalRoot;
|
27800 |
|
27801 | if (typeof callback === 'function') {
|
27802 | var originalCallback = callback;
|
27803 |
|
27804 | callback = function () {
|
27805 | var instance = getPublicRootInstance(fiberRoot);
|
27806 | originalCallback.call(instance);
|
27807 | };
|
27808 | }
|
27809 |
|
27810 |
|
27811 | unbatchedUpdates(function () {
|
27812 | updateContainer(children, fiberRoot, parentComponent, callback);
|
27813 | });
|
27814 | } else {
|
27815 | fiberRoot = root._internalRoot;
|
27816 |
|
27817 | if (typeof callback === 'function') {
|
27818 | var _originalCallback = callback;
|
27819 |
|
27820 | callback = function () {
|
27821 | var instance = getPublicRootInstance(fiberRoot);
|
27822 |
|
27823 | _originalCallback.call(instance);
|
27824 | };
|
27825 | }
|
27826 |
|
27827 |
|
27828 | updateContainer(children, fiberRoot, parentComponent, callback);
|
27829 | }
|
27830 |
|
27831 | return getPublicRootInstance(fiberRoot);
|
27832 | }
|
27833 |
|
27834 | function createPortal$$1(children, container) {
|
27835 | var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
27836 |
|
27837 | (function () {
|
27838 | if (!isValidContainer(container)) {
|
27839 | {
|
27840 | throw ReactError(Error("Target container is not a DOM element."));
|
27841 | }
|
27842 | }
|
27843 | })();
|
27844 |
|
27845 |
|
27846 | return createPortal$1(children, container, null, key);
|
27847 | }
|
27848 |
|
27849 | var ReactDOM = {
|
27850 | createPortal: createPortal$$1,
|
27851 | findDOMNode: function (componentOrElement) {
|
27852 | {
|
27853 | var owner = ReactCurrentOwner.current;
|
27854 |
|
27855 | if (owner !== null && owner.stateNode !== null) {
|
27856 | var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender;
|
27857 | !warnedAboutRefsInRender ? warningWithoutStack$1(false, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(owner.type) || 'A component') : void 0;
|
27858 | owner.stateNode._warnedAboutRefsInRender = true;
|
27859 | }
|
27860 | }
|
27861 |
|
27862 | if (componentOrElement == null) {
|
27863 | return null;
|
27864 | }
|
27865 |
|
27866 | if (componentOrElement.nodeType === ELEMENT_NODE) {
|
27867 | return componentOrElement;
|
27868 | }
|
27869 |
|
27870 | {
|
27871 | return findHostInstanceWithWarning(componentOrElement, 'findDOMNode');
|
27872 | }
|
27873 |
|
27874 | return findHostInstance(componentOrElement);
|
27875 | },
|
27876 | hydrate: function (element, container, callback) {
|
27877 | (function () {
|
27878 | if (!isValidContainer(container)) {
|
27879 | {
|
27880 | throw ReactError(Error("Target container is not a DOM element."));
|
27881 | }
|
27882 | }
|
27883 | })();
|
27884 |
|
27885 | {
|
27886 | !!container._reactHasBeenPassedToCreateRootDEV ? warningWithoutStack$1(false, 'You are calling ReactDOM.hydrate() on a container that was previously ' + 'passed to ReactDOM.%s(). This is not supported. ' + 'Did you mean to call createRoot(container, {hydrate: true}).render(element)?', enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot') : void 0;
|
27887 | }
|
27888 |
|
27889 |
|
27890 | return legacyRenderSubtreeIntoContainer(null, element, container, true, callback);
|
27891 | },
|
27892 | render: function (element, container, callback) {
|
27893 | (function () {
|
27894 | if (!isValidContainer(container)) {
|
27895 | {
|
27896 | throw ReactError(Error("Target container is not a DOM element."));
|
27897 | }
|
27898 | }
|
27899 | })();
|
27900 |
|
27901 | {
|
27902 | !!container._reactHasBeenPassedToCreateRootDEV ? warningWithoutStack$1(false, 'You are calling ReactDOM.render() on a container that was previously ' + 'passed to ReactDOM.%s(). This is not supported. ' + 'Did you mean to call root.render(element)?', enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot') : void 0;
|
27903 | }
|
27904 |
|
27905 | return legacyRenderSubtreeIntoContainer(null, element, container, false, callback);
|
27906 | },
|
27907 | unstable_renderSubtreeIntoContainer: function (parentComponent, element, containerNode, callback) {
|
27908 | (function () {
|
27909 | if (!isValidContainer(containerNode)) {
|
27910 | {
|
27911 | throw ReactError(Error("Target container is not a DOM element."));
|
27912 | }
|
27913 | }
|
27914 | })();
|
27915 |
|
27916 | (function () {
|
27917 | if (!(parentComponent != null && has$1(parentComponent))) {
|
27918 | {
|
27919 | throw ReactError(Error("parentComponent must be a valid React Component"));
|
27920 | }
|
27921 | }
|
27922 | })();
|
27923 |
|
27924 | return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback);
|
27925 | },
|
27926 | unmountComponentAtNode: function (container) {
|
27927 | (function () {
|
27928 | if (!isValidContainer(container)) {
|
27929 | {
|
27930 | throw ReactError(Error("unmountComponentAtNode(...): Target container is not a DOM element."));
|
27931 | }
|
27932 | }
|
27933 | })();
|
27934 |
|
27935 | {
|
27936 | !!container._reactHasBeenPassedToCreateRootDEV ? warningWithoutStack$1(false, 'You are calling ReactDOM.unmountComponentAtNode() on a container that was previously ' + 'passed to ReactDOM.%s(). This is not supported. Did you mean to call root.unmount()?', enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot') : void 0;
|
27937 | }
|
27938 |
|
27939 | if (container._reactRootContainer) {
|
27940 | {
|
27941 | var rootEl = getReactRootElementInContainer(container);
|
27942 | var renderedByDifferentReact = rootEl && !getInstanceFromNode$1(rootEl);
|
27943 | !!renderedByDifferentReact ? warningWithoutStack$1(false, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.') : void 0;
|
27944 | }
|
27945 |
|
27946 |
|
27947 | unbatchedUpdates(function () {
|
27948 | legacyRenderSubtreeIntoContainer(null, null, container, false, function () {
|
27949 | container._reactRootContainer = null;
|
27950 | });
|
27951 | });
|
27952 |
|
27953 |
|
27954 | return true;
|
27955 | } else {
|
27956 | {
|
27957 | var _rootEl = getReactRootElementInContainer(container);
|
27958 |
|
27959 | var hasNonRootReactChild = !!(_rootEl && getInstanceFromNode$1(_rootEl));
|
27960 |
|
27961 | var isContainerReactRoot = container.nodeType === ELEMENT_NODE && isValidContainer(container.parentNode) && !!container.parentNode._reactRootContainer;
|
27962 | !!hasNonRootReactChild ? warningWithoutStack$1(false, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : void 0;
|
27963 | }
|
27964 |
|
27965 | return false;
|
27966 | }
|
27967 | },
|
27968 |
|
27969 |
|
27970 | unstable_createPortal: function () {
|
27971 | if (!didWarnAboutUnstableCreatePortal) {
|
27972 | didWarnAboutUnstableCreatePortal = true;
|
27973 | lowPriorityWarningWithoutStack$1(false, 'The ReactDOM.unstable_createPortal() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactDOM.createPortal() instead. It has the exact same API, ' + 'but without the "unstable_" prefix.');
|
27974 | }
|
27975 |
|
27976 | return createPortal$$1.apply(void 0, arguments);
|
27977 | },
|
27978 | unstable_batchedUpdates: batchedUpdates$1,
|
27979 |
|
27980 | unstable_interactiveUpdates: function (fn, a, b, c) {
|
27981 | flushDiscreteUpdates();
|
27982 | return discreteUpdates$1(fn, a, b, c);
|
27983 | },
|
27984 | unstable_discreteUpdates: discreteUpdates$1,
|
27985 | unstable_flushDiscreteUpdates: flushDiscreteUpdates,
|
27986 | flushSync: flushSync,
|
27987 | unstable_createRoot: createRoot,
|
27988 | unstable_createSyncRoot: createSyncRoot,
|
27989 | unstable_flushControlled: flushControlled,
|
27990 | __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
|
27991 |
|
27992 |
|
27993 | Events: [getInstanceFromNode$1, getNodeFromInstance$1, getFiberCurrentPropsFromNode$1, injection.injectEventPluginsByName, eventNameDispatchConfigs, accumulateTwoPhaseDispatches, accumulateDirectDispatches, enqueueStateRestore, restoreStateIfNeeded, dispatchEvent, runEventsInBatch, flushPassiveEffects, IsThisRendererActing]
|
27994 | }
|
27995 | };
|
27996 |
|
27997 | function createRoot(container, options) {
|
27998 | var functionName = enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot';
|
27999 |
|
28000 | (function () {
|
28001 | if (!isValidContainer(container)) {
|
28002 | {
|
28003 | throw ReactError(Error(functionName + "(...): Target container is not a DOM element."));
|
28004 | }
|
28005 | }
|
28006 | })();
|
28007 |
|
28008 | warnIfReactDOMContainerInDEV(container);
|
28009 | return new ReactRoot(container, options);
|
28010 | }
|
28011 |
|
28012 | function createSyncRoot(container, options) {
|
28013 | var functionName = enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot';
|
28014 |
|
28015 | (function () {
|
28016 | if (!isValidContainer(container)) {
|
28017 | {
|
28018 | throw ReactError(Error(functionName + "(...): Target container is not a DOM element."));
|
28019 | }
|
28020 | }
|
28021 | })();
|
28022 |
|
28023 | warnIfReactDOMContainerInDEV(container);
|
28024 | return new ReactSyncRoot(container, BatchedRoot, options);
|
28025 | }
|
28026 |
|
28027 | function warnIfReactDOMContainerInDEV(container) {
|
28028 | {
|
28029 | !!container._reactRootContainer ? warningWithoutStack$1(false, 'You are calling ReactDOM.%s() on a container that was previously ' + 'passed to ReactDOM.render(). This is not supported.', enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot') : void 0;
|
28030 | container._reactHasBeenPassedToCreateRootDEV = true;
|
28031 | }
|
28032 | }
|
28033 |
|
28034 | if (enableStableConcurrentModeAPIs) {
|
28035 | ReactDOM.createRoot = createRoot;
|
28036 | ReactDOM.createSyncRoot = createSyncRoot;
|
28037 | }
|
28038 |
|
28039 | var foundDevTools = injectIntoDevTools({
|
28040 | findFiberByHostInstance: getClosestInstanceFromNode,
|
28041 | bundleType: 1,
|
28042 | version: ReactVersion,
|
28043 | rendererPackageName: 'react-dom'
|
28044 | });
|
28045 |
|
28046 | {
|
28047 | if (!foundDevTools && canUseDOM && window.top === window.self) {
|
28048 |
|
28049 | if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
|
28050 | var protocol = window.location.protocol;
|
28051 |
|
28052 | if (/^(https?|file):$/.test(protocol)) {
|
28053 | console.info('%cDownload the React DevTools ' + 'for a better development experience: ' + 'https://fb.me/react-devtools' + (protocol === 'file:' ? '\nYou might need to use a local HTTP server (instead of file://): ' + 'https://fb.me/react-devtools-faq' : ''), 'font-weight:bold');
|
28054 | }
|
28055 | }
|
28056 | }
|
28057 | }
|
28058 |
|
28059 |
|
28060 |
|
28061 | var ReactDOM$2 = Object.freeze({
|
28062 | default: ReactDOM
|
28063 | });
|
28064 |
|
28065 | var ReactDOM$3 = ( ReactDOM$2 && ReactDOM ) || ReactDOM$2;
|
28066 |
|
28067 |
|
28068 |
|
28069 |
|
28070 |
|
28071 | var reactDom = ReactDOM$3.default || ReactDOM$3;
|
28072 |
|
28073 | return reactDom;
|
28074 |
|
28075 | })));
|