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() :
|
14 | typeof define === 'function' && define.amd ? define(factory) :
|
15 | (global.React = factory());
|
16 | }(this, (function () { 'use strict';
|
17 |
|
18 |
|
19 |
|
20 | var ReactVersion = '16.9.0-rc.0';
|
21 |
|
22 |
|
23 |
|
24 | var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
25 |
|
26 | var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
27 | var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
28 | var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
29 | var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
30 | var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
31 | var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
32 | var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
33 |
|
34 |
|
35 |
|
36 | var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
37 | var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
38 | var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
39 | var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
40 | var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
41 | var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
42 | var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
43 | var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
44 |
|
45 | var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
46 | var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
47 |
|
48 | function getIteratorFn(maybeIterable) {
|
49 | if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
50 | return null;
|
51 | }
|
52 | var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
53 | if (typeof maybeIterator === 'function') {
|
54 | return maybeIterator;
|
55 | }
|
56 | return null;
|
57 | }
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
68 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
69 | var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
70 |
|
71 | function toObject(val) {
|
72 | if (val === null || val === undefined) {
|
73 | throw new TypeError('Object.assign cannot be called with null or undefined');
|
74 | }
|
75 |
|
76 | return Object(val);
|
77 | }
|
78 |
|
79 | function shouldUseNative() {
|
80 | try {
|
81 | if (!Object.assign) {
|
82 | return false;
|
83 | }
|
84 |
|
85 |
|
86 |
|
87 |
|
88 | var test1 = new String('abc');
|
89 | test1[5] = 'de';
|
90 | if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
91 | return false;
|
92 | }
|
93 |
|
94 |
|
95 | var test2 = {};
|
96 | for (var i = 0; i < 10; i++) {
|
97 | test2['_' + String.fromCharCode(i)] = i;
|
98 | }
|
99 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
100 | return test2[n];
|
101 | });
|
102 | if (order2.join('') !== '0123456789') {
|
103 | return false;
|
104 | }
|
105 |
|
106 |
|
107 | var test3 = {};
|
108 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
109 | test3[letter] = letter;
|
110 | });
|
111 | if (Object.keys(Object.assign({}, test3)).join('') !==
|
112 | 'abcdefghijklmnopqrst') {
|
113 | return false;
|
114 | }
|
115 |
|
116 | return true;
|
117 | } catch (err) {
|
118 |
|
119 | return false;
|
120 | }
|
121 | }
|
122 |
|
123 | var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
124 | var from;
|
125 | var to = toObject(target);
|
126 | var symbols;
|
127 |
|
128 | for (var s = 1; s < arguments.length; s++) {
|
129 | from = Object(arguments[s]);
|
130 |
|
131 | for (var key in from) {
|
132 | if (hasOwnProperty.call(from, key)) {
|
133 | to[key] = from[key];
|
134 | }
|
135 | }
|
136 |
|
137 | if (getOwnPropertySymbols) {
|
138 | symbols = getOwnPropertySymbols(from);
|
139 | for (var i = 0; i < symbols.length; i++) {
|
140 | if (propIsEnumerable.call(from, symbols[i])) {
|
141 | to[symbols[i]] = from[symbols[i]];
|
142 | }
|
143 | }
|
144 | }
|
145 | }
|
146 |
|
147 | return to;
|
148 | };
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 |
|
158 | function ReactError(error) {
|
159 | error.name = 'Invariant Violation';
|
160 | return error;
|
161 | }
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 | var lowPriorityWarning = function () {};
|
189 |
|
190 | {
|
191 | var printWarning = function (format) {
|
192 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
193 | args[_key - 1] = arguments[_key];
|
194 | }
|
195 |
|
196 | var argIndex = 0;
|
197 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
198 | return args[argIndex++];
|
199 | });
|
200 | if (typeof console !== 'undefined') {
|
201 | console.warn(message);
|
202 | }
|
203 | try {
|
204 |
|
205 |
|
206 |
|
207 | throw new Error(message);
|
208 | } catch (x) {}
|
209 | };
|
210 |
|
211 | lowPriorityWarning = function (condition, format) {
|
212 | if (format === undefined) {
|
213 | throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
|
214 | }
|
215 | if (!condition) {
|
216 | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
217 | args[_key2 - 2] = arguments[_key2];
|
218 | }
|
219 |
|
220 | printWarning.apply(undefined, [format].concat(args));
|
221 | }
|
222 | };
|
223 | }
|
224 |
|
225 | var lowPriorityWarning$1 = lowPriorityWarning;
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 | var warningWithoutStack = function () {};
|
235 |
|
236 | {
|
237 | warningWithoutStack = function (condition, format) {
|
238 | for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
239 | args[_key - 2] = arguments[_key];
|
240 | }
|
241 |
|
242 | if (format === undefined) {
|
243 | throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
244 | }
|
245 | if (args.length > 8) {
|
246 |
|
247 | throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
|
248 | }
|
249 | if (condition) {
|
250 | return;
|
251 | }
|
252 | if (typeof console !== 'undefined') {
|
253 | var argsWithFormat = args.map(function (item) {
|
254 | return '' + item;
|
255 | });
|
256 | argsWithFormat.unshift('Warning: ' + format);
|
257 |
|
258 |
|
259 |
|
260 | Function.prototype.apply.call(console.error, console, argsWithFormat);
|
261 | }
|
262 | try {
|
263 |
|
264 |
|
265 |
|
266 | var argIndex = 0;
|
267 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
268 | return args[argIndex++];
|
269 | });
|
270 | throw new Error(message);
|
271 | } catch (x) {}
|
272 | };
|
273 | }
|
274 |
|
275 | var warningWithoutStack$1 = warningWithoutStack;
|
276 |
|
277 | var didWarnStateUpdateForUnmountedComponent = {};
|
278 |
|
279 | function warnNoop(publicInstance, callerName) {
|
280 | {
|
281 | var _constructor = publicInstance.constructor;
|
282 | var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
283 | var warningKey = componentName + '.' + callerName;
|
284 | if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
285 | return;
|
286 | }
|
287 | warningWithoutStack$1(false, "Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
|
288 | didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
289 | }
|
290 | }
|
291 |
|
292 |
|
293 |
|
294 |
|
295 | var ReactNoopUpdateQueue = {
|
296 | |
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 |
|
303 | isMounted: function (publicInstance) {
|
304 | return false;
|
305 | },
|
306 |
|
307 | |
308 |
|
309 |
|
310 |
|
311 |
|
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 |
|
319 |
|
320 |
|
321 |
|
322 | enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
323 | warnNoop(publicInstance, 'forceUpdate');
|
324 | },
|
325 |
|
326 | |
327 |
|
328 |
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 |
|
337 |
|
338 |
|
339 | enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
340 | warnNoop(publicInstance, 'replaceState');
|
341 | },
|
342 |
|
343 | |
344 |
|
345 |
|
346 |
|
347 |
|
348 |
|
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 |
|
355 | enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
356 | warnNoop(publicInstance, 'setState');
|
357 | }
|
358 | };
|
359 |
|
360 | var emptyObject = {};
|
361 | {
|
362 | Object.freeze(emptyObject);
|
363 | }
|
364 |
|
365 |
|
366 |
|
367 |
|
368 | function Component(props, context, updater) {
|
369 | this.props = props;
|
370 | this.context = context;
|
371 |
|
372 | this.refs = emptyObject;
|
373 |
|
374 |
|
375 | this.updater = updater || ReactNoopUpdateQueue;
|
376 | }
|
377 |
|
378 | Component.prototype.isReactComponent = {};
|
379 |
|
380 |
|
381 |
|
382 |
|
383 |
|
384 |
|
385 |
|
386 |
|
387 |
|
388 |
|
389 |
|
390 |
|
391 |
|
392 |
|
393 |
|
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 | Component.prototype.setState = function (partialState, callback) {
|
406 | (function () {
|
407 | if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
|
408 | {
|
409 | throw ReactError(Error('setState(...): takes an object of state variables to update or a function which returns an object of state variables.'));
|
410 | }
|
411 | }
|
412 | })();
|
413 | this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
414 | };
|
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 |
|
429 |
|
430 | Component.prototype.forceUpdate = function (callback) {
|
431 | this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
432 | };
|
433 |
|
434 |
|
435 |
|
436 |
|
437 |
|
438 |
|
439 | {
|
440 | var deprecatedAPIs = {
|
441 | isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
442 | replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
443 | };
|
444 | var defineDeprecationWarning = function (methodName, info) {
|
445 | Object.defineProperty(Component.prototype, methodName, {
|
446 | get: function () {
|
447 | lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
448 | return undefined;
|
449 | }
|
450 | });
|
451 | };
|
452 | for (var fnName in deprecatedAPIs) {
|
453 | if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
454 | defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
455 | }
|
456 | }
|
457 | }
|
458 |
|
459 | function ComponentDummy() {}
|
460 | ComponentDummy.prototype = Component.prototype;
|
461 |
|
462 |
|
463 |
|
464 |
|
465 | function PureComponent(props, context, updater) {
|
466 | this.props = props;
|
467 | this.context = context;
|
468 |
|
469 | this.refs = emptyObject;
|
470 | this.updater = updater || ReactNoopUpdateQueue;
|
471 | }
|
472 |
|
473 | var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
474 | pureComponentPrototype.constructor = PureComponent;
|
475 |
|
476 | objectAssign(pureComponentPrototype, Component.prototype);
|
477 | pureComponentPrototype.isPureReactComponent = true;
|
478 |
|
479 |
|
480 | function createRef() {
|
481 | var refObject = {
|
482 | current: null
|
483 | };
|
484 | {
|
485 | Object.seal(refObject);
|
486 | }
|
487 | return refObject;
|
488 | }
|
489 |
|
490 |
|
491 |
|
492 |
|
493 | var ReactCurrentDispatcher = {
|
494 | |
495 |
|
496 |
|
497 |
|
498 | current: null
|
499 | };
|
500 |
|
501 |
|
502 |
|
503 |
|
504 |
|
505 | var ReactCurrentBatchConfig = {
|
506 | suspense: null
|
507 | };
|
508 |
|
509 |
|
510 |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 | var ReactCurrentOwner = {
|
516 | |
517 |
|
518 |
|
519 |
|
520 | current: null
|
521 | };
|
522 |
|
523 | var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
524 |
|
525 | var describeComponentFrame = function (name, source, ownerName) {
|
526 | var sourceInfo = '';
|
527 | if (source) {
|
528 | var path = source.fileName;
|
529 | var fileName = path.replace(BEFORE_SLASH_RE, '');
|
530 | {
|
531 |
|
532 |
|
533 | if (/^index\./.test(fileName)) {
|
534 | var match = path.match(BEFORE_SLASH_RE);
|
535 | if (match) {
|
536 | var pathBeforeSlash = match[1];
|
537 | if (pathBeforeSlash) {
|
538 | var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
539 | fileName = folderName + '/' + fileName;
|
540 | }
|
541 | }
|
542 | }
|
543 | }
|
544 | sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
545 | } else if (ownerName) {
|
546 | sourceInfo = ' (created by ' + ownerName + ')';
|
547 | }
|
548 | return '\n in ' + (name || 'Unknown') + sourceInfo;
|
549 | };
|
550 |
|
551 | var Resolved = 1;
|
552 |
|
553 |
|
554 | function refineResolvedLazyComponent(lazyComponent) {
|
555 | return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
556 | }
|
557 |
|
558 | function getWrappedName(outerType, innerType, wrapperName) {
|
559 | var functionName = innerType.displayName || innerType.name || '';
|
560 | return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
|
561 | }
|
562 |
|
563 | function getComponentName(type) {
|
564 | if (type == null) {
|
565 |
|
566 | return null;
|
567 | }
|
568 | {
|
569 | if (typeof type.tag === 'number') {
|
570 | warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
571 | }
|
572 | }
|
573 | if (typeof type === 'function') {
|
574 | return type.displayName || type.name || null;
|
575 | }
|
576 | if (typeof type === 'string') {
|
577 | return type;
|
578 | }
|
579 | switch (type) {
|
580 | case REACT_FRAGMENT_TYPE:
|
581 | return 'Fragment';
|
582 | case REACT_PORTAL_TYPE:
|
583 | return 'Portal';
|
584 | case REACT_PROFILER_TYPE:
|
585 | return 'Profiler';
|
586 | case REACT_STRICT_MODE_TYPE:
|
587 | return 'StrictMode';
|
588 | case REACT_SUSPENSE_TYPE:
|
589 | return 'Suspense';
|
590 | case REACT_SUSPENSE_LIST_TYPE:
|
591 | return 'SuspenseList';
|
592 | }
|
593 | if (typeof type === 'object') {
|
594 | switch (type.$$typeof) {
|
595 | case REACT_CONTEXT_TYPE:
|
596 | return 'Context.Consumer';
|
597 | case REACT_PROVIDER_TYPE:
|
598 | return 'Context.Provider';
|
599 | case REACT_FORWARD_REF_TYPE:
|
600 | return getWrappedName(type, type.render, 'ForwardRef');
|
601 | case REACT_MEMO_TYPE:
|
602 | return getComponentName(type.type);
|
603 | case REACT_LAZY_TYPE:
|
604 | {
|
605 | var thenable = type;
|
606 | var resolvedThenable = refineResolvedLazyComponent(thenable);
|
607 | if (resolvedThenable) {
|
608 | return getComponentName(resolvedThenable);
|
609 | }
|
610 | break;
|
611 | }
|
612 | }
|
613 | }
|
614 | return null;
|
615 | }
|
616 |
|
617 | var ReactDebugCurrentFrame = {};
|
618 |
|
619 | var currentlyValidatingElement = null;
|
620 |
|
621 | function setCurrentlyValidatingElement(element) {
|
622 | {
|
623 | currentlyValidatingElement = element;
|
624 | }
|
625 | }
|
626 |
|
627 | {
|
628 |
|
629 | ReactDebugCurrentFrame.getCurrentStack = null;
|
630 |
|
631 | ReactDebugCurrentFrame.getStackAddendum = function () {
|
632 | var stack = '';
|
633 |
|
634 |
|
635 | if (currentlyValidatingElement) {
|
636 | var name = getComponentName(currentlyValidatingElement.type);
|
637 | var owner = currentlyValidatingElement._owner;
|
638 | stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
|
639 | }
|
640 |
|
641 |
|
642 | var impl = ReactDebugCurrentFrame.getCurrentStack;
|
643 | if (impl) {
|
644 | stack += impl() || '';
|
645 | }
|
646 |
|
647 | return stack;
|
648 | };
|
649 | }
|
650 |
|
651 |
|
652 |
|
653 |
|
654 |
|
655 | var IsSomeRendererActing = {
|
656 | current: false
|
657 | };
|
658 |
|
659 | var ReactSharedInternals = {
|
660 | ReactCurrentDispatcher: ReactCurrentDispatcher,
|
661 | ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
662 | ReactCurrentOwner: ReactCurrentOwner,
|
663 | IsSomeRendererActing: IsSomeRendererActing,
|
664 |
|
665 | assign: objectAssign
|
666 | };
|
667 |
|
668 | {
|
669 | objectAssign(ReactSharedInternals, {
|
670 |
|
671 | ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
672 |
|
673 |
|
674 | ReactComponentTreeHook: {}
|
675 | });
|
676 | }
|
677 |
|
678 |
|
679 |
|
680 |
|
681 |
|
682 |
|
683 |
|
684 |
|
685 | var warning = warningWithoutStack$1;
|
686 |
|
687 | {
|
688 | warning = function (condition, format) {
|
689 | if (condition) {
|
690 | return;
|
691 | }
|
692 | var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
693 | var stack = ReactDebugCurrentFrame.getStackAddendum();
|
694 |
|
695 |
|
696 | for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
697 | args[_key - 2] = arguments[_key];
|
698 | }
|
699 |
|
700 | warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
|
701 | };
|
702 | }
|
703 |
|
704 | var warning$1 = warning;
|
705 |
|
706 | var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
707 |
|
708 | var RESERVED_PROPS = {
|
709 | key: true,
|
710 | ref: true,
|
711 | __self: true,
|
712 | __source: true
|
713 | };
|
714 |
|
715 | var specialPropKeyWarningShown = void 0;
|
716 | var specialPropRefWarningShown = void 0;
|
717 |
|
718 | function hasValidRef(config) {
|
719 | {
|
720 | if (hasOwnProperty$1.call(config, 'ref')) {
|
721 | var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
722 | if (getter && getter.isReactWarning) {
|
723 | return false;
|
724 | }
|
725 | }
|
726 | }
|
727 | return config.ref !== undefined;
|
728 | }
|
729 |
|
730 | function hasValidKey(config) {
|
731 | {
|
732 | if (hasOwnProperty$1.call(config, 'key')) {
|
733 | var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
734 | if (getter && getter.isReactWarning) {
|
735 | return false;
|
736 | }
|
737 | }
|
738 | }
|
739 | return config.key !== undefined;
|
740 | }
|
741 |
|
742 | function defineKeyPropWarningGetter(props, displayName) {
|
743 | var warnAboutAccessingKey = function () {
|
744 | if (!specialPropKeyWarningShown) {
|
745 | specialPropKeyWarningShown = true;
|
746 | warningWithoutStack$1(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
747 | }
|
748 | };
|
749 | warnAboutAccessingKey.isReactWarning = true;
|
750 | Object.defineProperty(props, 'key', {
|
751 | get: warnAboutAccessingKey,
|
752 | configurable: true
|
753 | });
|
754 | }
|
755 |
|
756 | function defineRefPropWarningGetter(props, displayName) {
|
757 | var warnAboutAccessingRef = function () {
|
758 | if (!specialPropRefWarningShown) {
|
759 | specialPropRefWarningShown = true;
|
760 | warningWithoutStack$1(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
761 | }
|
762 | };
|
763 | warnAboutAccessingRef.isReactWarning = true;
|
764 | Object.defineProperty(props, 'ref', {
|
765 | get: warnAboutAccessingRef,
|
766 | configurable: true
|
767 | });
|
768 | }
|
769 |
|
770 | /**
|
771 | * Factory method to create a new React element. This no longer adheres to
|
772 | * the class pattern, so do not use new to call it. Also, no instanceof check
|
773 | * will work. Instead test $$typeof field against Symbol.for('react.element') to check
|
774 | * if something is a React Element.
|
775 | *
|
776 | * @param {*} type
|
777 | * @param {*} props
|
778 | * @param {*} key
|
779 | * @param {string|object} ref
|
780 | * @param {*} owner
|
781 | * @param {*} self A *temporary* helper to detect places where `this` is
|
782 | * different from the `owner` when React.createElement is called, so that we
|
783 | * can warn. We want to get rid of owner and replace string `ref`s with arrow
|
784 | * functions, and as long as `this` and owner are the same, there will be no
|
785 | * change in behavior.
|
786 | * @param {*} source An annotation object (added by a transpiler or otherwise)
|
787 | * indicating filename, line number, and/or other information.
|
788 | * @internal
|
789 | */
|
790 | var ReactElement = function (type, key, ref, self, source, owner, props) {
|
791 | var element = {
|
792 |
|
793 | $$typeof: REACT_ELEMENT_TYPE,
|
794 |
|
795 |
|
796 | type: type,
|
797 | key: key,
|
798 | ref: ref,
|
799 | props: props,
|
800 |
|
801 |
|
802 | _owner: owner
|
803 | };
|
804 |
|
805 | {
|
806 |
|
807 |
|
808 |
|
809 |
|
810 | element._store = {};
|
811 |
|
812 |
|
813 |
|
814 |
|
815 |
|
816 | Object.defineProperty(element._store, 'validated', {
|
817 | configurable: false,
|
818 | enumerable: false,
|
819 | writable: true,
|
820 | value: false
|
821 | });
|
822 |
|
823 | Object.defineProperty(element, '_self', {
|
824 | configurable: false,
|
825 | enumerable: false,
|
826 | writable: false,
|
827 | value: self
|
828 | });
|
829 |
|
830 |
|
831 | Object.defineProperty(element, '_source', {
|
832 | configurable: false,
|
833 | enumerable: false,
|
834 | writable: false,
|
835 | value: source
|
836 | });
|
837 | if (Object.freeze) {
|
838 | Object.freeze(element.props);
|
839 | Object.freeze(element);
|
840 | }
|
841 | }
|
842 |
|
843 | return element;
|
844 | };
|
845 |
|
846 |
|
847 |
|
848 |
|
849 |
|
850 |
|
851 |
|
852 |
|
853 |
|
854 |
|
855 |
|
856 |
|
857 |
|
858 |
|
859 |
|
860 | function jsxDEV(type, config, maybeKey, source, self) {
|
861 | var propName = void 0;
|
862 |
|
863 |
|
864 | var props = {};
|
865 |
|
866 | var key = null;
|
867 | var ref = null;
|
868 |
|
869 | if (hasValidRef(config)) {
|
870 | ref = config.ref;
|
871 | }
|
872 |
|
873 | if (hasValidKey(config)) {
|
874 | key = '' + config.key;
|
875 | }
|
876 |
|
877 |
|
878 | for (propName in config) {
|
879 | if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
880 | props[propName] = config[propName];
|
881 | }
|
882 | }
|
883 |
|
884 |
|
885 |
|
886 | if (maybeKey !== undefined) {
|
887 | key = '' + maybeKey;
|
888 | }
|
889 |
|
890 |
|
891 | if (type && type.defaultProps) {
|
892 | var defaultProps = type.defaultProps;
|
893 | for (propName in defaultProps) {
|
894 | if (props[propName] === undefined) {
|
895 | props[propName] = defaultProps[propName];
|
896 | }
|
897 | }
|
898 | }
|
899 |
|
900 | if (key || ref) {
|
901 | var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
902 | if (key) {
|
903 | defineKeyPropWarningGetter(props, displayName);
|
904 | }
|
905 | if (ref) {
|
906 | defineRefPropWarningGetter(props, displayName);
|
907 | }
|
908 | }
|
909 |
|
910 | return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
911 | }
|
912 |
|
913 |
|
914 |
|
915 |
|
916 |
|
917 | function createElement(type, config, children) {
|
918 | var propName = void 0;
|
919 |
|
920 |
|
921 | var props = {};
|
922 |
|
923 | var key = null;
|
924 | var ref = null;
|
925 | var self = null;
|
926 | var source = null;
|
927 |
|
928 | if (config != null) {
|
929 | if (hasValidRef(config)) {
|
930 | ref = config.ref;
|
931 | }
|
932 | if (hasValidKey(config)) {
|
933 | key = '' + config.key;
|
934 | }
|
935 |
|
936 | self = config.__self === undefined ? null : config.__self;
|
937 | source = config.__source === undefined ? null : config.__source;
|
938 |
|
939 | for (propName in config) {
|
940 | if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
941 | props[propName] = config[propName];
|
942 | }
|
943 | }
|
944 | }
|
945 |
|
946 |
|
947 |
|
948 | var childrenLength = arguments.length - 2;
|
949 | if (childrenLength === 1) {
|
950 | props.children = children;
|
951 | } else if (childrenLength > 1) {
|
952 | var childArray = Array(childrenLength);
|
953 | for (var i = 0; i < childrenLength; i++) {
|
954 | childArray[i] = arguments[i + 2];
|
955 | }
|
956 | {
|
957 | if (Object.freeze) {
|
958 | Object.freeze(childArray);
|
959 | }
|
960 | }
|
961 | props.children = childArray;
|
962 | }
|
963 |
|
964 |
|
965 | if (type && type.defaultProps) {
|
966 | var defaultProps = type.defaultProps;
|
967 | for (propName in defaultProps) {
|
968 | if (props[propName] === undefined) {
|
969 | props[propName] = defaultProps[propName];
|
970 | }
|
971 | }
|
972 | }
|
973 | {
|
974 | if (key || ref) {
|
975 | var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
976 | if (key) {
|
977 | defineKeyPropWarningGetter(props, displayName);
|
978 | }
|
979 | if (ref) {
|
980 | defineRefPropWarningGetter(props, displayName);
|
981 | }
|
982 | }
|
983 | }
|
984 | return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
985 | }
|
986 |
|
987 |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 |
|
993 | function cloneAndReplaceKey(oldElement, newKey) {
|
994 | var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
995 |
|
996 | return newElement;
|
997 | }
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 |
|
1003 | function cloneElement(element, config, children) {
|
1004 | (function () {
|
1005 | if (!!(element === null || element === undefined)) {
|
1006 | {
|
1007 | throw ReactError(Error('React.cloneElement(...): The argument must be a React element, but you passed ' + element + '.'));
|
1008 | }
|
1009 | }
|
1010 | })();
|
1011 |
|
1012 | var propName = void 0;
|
1013 |
|
1014 |
|
1015 | var props = objectAssign({}, element.props);
|
1016 |
|
1017 |
|
1018 | var key = element.key;
|
1019 | var ref = element.ref;
|
1020 |
|
1021 | var self = element._self;
|
1022 |
|
1023 |
|
1024 |
|
1025 | var source = element._source;
|
1026 |
|
1027 |
|
1028 | var owner = element._owner;
|
1029 |
|
1030 | if (config != null) {
|
1031 | if (hasValidRef(config)) {
|
1032 |
|
1033 | ref = config.ref;
|
1034 | owner = ReactCurrentOwner.current;
|
1035 | }
|
1036 | if (hasValidKey(config)) {
|
1037 | key = '' + config.key;
|
1038 | }
|
1039 |
|
1040 |
|
1041 | var defaultProps = void 0;
|
1042 | if (element.type && element.type.defaultProps) {
|
1043 | defaultProps = element.type.defaultProps;
|
1044 | }
|
1045 | for (propName in config) {
|
1046 | if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
1047 | if (config[propName] === undefined && defaultProps !== undefined) {
|
1048 |
|
1049 | props[propName] = defaultProps[propName];
|
1050 | } else {
|
1051 | props[propName] = config[propName];
|
1052 | }
|
1053 | }
|
1054 | }
|
1055 | }
|
1056 |
|
1057 |
|
1058 |
|
1059 | var childrenLength = arguments.length - 2;
|
1060 | if (childrenLength === 1) {
|
1061 | props.children = children;
|
1062 | } else if (childrenLength > 1) {
|
1063 | var childArray = Array(childrenLength);
|
1064 | for (var i = 0; i < childrenLength; i++) {
|
1065 | childArray[i] = arguments[i + 2];
|
1066 | }
|
1067 | props.children = childArray;
|
1068 | }
|
1069 |
|
1070 | return ReactElement(element.type, key, ref, self, source, owner, props);
|
1071 | }
|
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 |
|
1080 | function isValidElement(object) {
|
1081 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
1082 | }
|
1083 |
|
1084 | var SEPARATOR = '.';
|
1085 | var SUBSEPARATOR = ':';
|
1086 |
|
1087 |
|
1088 |
|
1089 |
|
1090 |
|
1091 |
|
1092 |
|
1093 | function escape(key) {
|
1094 | var escapeRegex = /[=:]/g;
|
1095 | var escaperLookup = {
|
1096 | '=': '=0',
|
1097 | ':': '=2'
|
1098 | };
|
1099 | var escapedString = ('' + key).replace(escapeRegex, function (match) {
|
1100 | return escaperLookup[match];
|
1101 | });
|
1102 |
|
1103 | return '$' + escapedString;
|
1104 | }
|
1105 |
|
1106 |
|
1107 |
|
1108 |
|
1109 |
|
1110 |
|
1111 | var didWarnAboutMaps = false;
|
1112 |
|
1113 | var userProvidedKeyEscapeRegex = /\/+/g;
|
1114 | function escapeUserProvidedKey(text) {
|
1115 | return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
1116 | }
|
1117 |
|
1118 | var POOL_SIZE = 10;
|
1119 | var traverseContextPool = [];
|
1120 | function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
|
1121 | if (traverseContextPool.length) {
|
1122 | var traverseContext = traverseContextPool.pop();
|
1123 | traverseContext.result = mapResult;
|
1124 | traverseContext.keyPrefix = keyPrefix;
|
1125 | traverseContext.func = mapFunction;
|
1126 | traverseContext.context = mapContext;
|
1127 | traverseContext.count = 0;
|
1128 | return traverseContext;
|
1129 | } else {
|
1130 | return {
|
1131 | result: mapResult,
|
1132 | keyPrefix: keyPrefix,
|
1133 | func: mapFunction,
|
1134 | context: mapContext,
|
1135 | count: 0
|
1136 | };
|
1137 | }
|
1138 | }
|
1139 |
|
1140 | function releaseTraverseContext(traverseContext) {
|
1141 | traverseContext.result = null;
|
1142 | traverseContext.keyPrefix = null;
|
1143 | traverseContext.func = null;
|
1144 | traverseContext.context = null;
|
1145 | traverseContext.count = 0;
|
1146 | if (traverseContextPool.length < POOL_SIZE) {
|
1147 | traverseContextPool.push(traverseContext);
|
1148 | }
|
1149 | }
|
1150 |
|
1151 |
|
1152 |
|
1153 |
|
1154 |
|
1155 |
|
1156 |
|
1157 |
|
1158 |
|
1159 | function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
|
1160 | var type = typeof children;
|
1161 |
|
1162 | if (type === 'undefined' || type === 'boolean') {
|
1163 |
|
1164 | children = null;
|
1165 | }
|
1166 |
|
1167 | var invokeCallback = false;
|
1168 |
|
1169 | if (children === null) {
|
1170 | invokeCallback = true;
|
1171 | } else {
|
1172 | switch (type) {
|
1173 | case 'string':
|
1174 | case 'number':
|
1175 | invokeCallback = true;
|
1176 | break;
|
1177 | case 'object':
|
1178 | switch (children.$$typeof) {
|
1179 | case REACT_ELEMENT_TYPE:
|
1180 | case REACT_PORTAL_TYPE:
|
1181 | invokeCallback = true;
|
1182 | }
|
1183 | }
|
1184 | }
|
1185 |
|
1186 | if (invokeCallback) {
|
1187 | callback(traverseContext, children,
|
1188 |
|
1189 |
|
1190 | nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
1191 | return 1;
|
1192 | }
|
1193 |
|
1194 | var child = void 0;
|
1195 | var nextName = void 0;
|
1196 | var subtreeCount = 0;
|
1197 | var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
1198 |
|
1199 | if (Array.isArray(children)) {
|
1200 | for (var i = 0; i < children.length; i++) {
|
1201 | child = children[i];
|
1202 | nextName = nextNamePrefix + getComponentKey(child, i);
|
1203 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
1204 | }
|
1205 | } else {
|
1206 | var iteratorFn = getIteratorFn(children);
|
1207 | if (typeof iteratorFn === 'function') {
|
1208 | {
|
1209 |
|
1210 | if (iteratorFn === children.entries) {
|
1211 | !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;
|
1212 | didWarnAboutMaps = true;
|
1213 | }
|
1214 | }
|
1215 |
|
1216 | var iterator = iteratorFn.call(children);
|
1217 | var step = void 0;
|
1218 | var ii = 0;
|
1219 | while (!(step = iterator.next()).done) {
|
1220 | child = step.value;
|
1221 | nextName = nextNamePrefix + getComponentKey(child, ii++);
|
1222 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
1223 | }
|
1224 | } else if (type === 'object') {
|
1225 | var addendum = '';
|
1226 | {
|
1227 | addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
|
1228 | }
|
1229 | var childrenString = '' + children;
|
1230 | (function () {
|
1231 | {
|
1232 | {
|
1233 | throw ReactError(Error('Objects are not valid as a React child (found: ' + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + ').' + addendum));
|
1234 | }
|
1235 | }
|
1236 | })();
|
1237 | }
|
1238 | }
|
1239 |
|
1240 | return subtreeCount;
|
1241 | }
|
1242 |
|
1243 |
|
1244 |
|
1245 |
|
1246 |
|
1247 |
|
1248 |
|
1249 |
|
1250 |
|
1251 |
|
1252 |
|
1253 |
|
1254 |
|
1255 |
|
1256 |
|
1257 |
|
1258 |
|
1259 | function traverseAllChildren(children, callback, traverseContext) {
|
1260 | if (children == null) {
|
1261 | return 0;
|
1262 | }
|
1263 |
|
1264 | return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
1265 | }
|
1266 |
|
1267 |
|
1268 |
|
1269 |
|
1270 |
|
1271 |
|
1272 |
|
1273 |
|
1274 | function getComponentKey(component, index) {
|
1275 |
|
1276 |
|
1277 | if (typeof component === 'object' && component !== null && component.key != null) {
|
1278 |
|
1279 | return escape(component.key);
|
1280 | }
|
1281 |
|
1282 | return index.toString(36);
|
1283 | }
|
1284 |
|
1285 | function forEachSingleChild(bookKeeping, child, name) {
|
1286 | var func = bookKeeping.func,
|
1287 | context = bookKeeping.context;
|
1288 |
|
1289 | func.call(context, child, bookKeeping.count++);
|
1290 | }
|
1291 |
|
1292 |
|
1293 |
|
1294 |
|
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 |
|
1300 |
|
1301 |
|
1302 |
|
1303 |
|
1304 | function forEachChildren(children, forEachFunc, forEachContext) {
|
1305 | if (children == null) {
|
1306 | return children;
|
1307 | }
|
1308 | var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
|
1309 | traverseAllChildren(children, forEachSingleChild, traverseContext);
|
1310 | releaseTraverseContext(traverseContext);
|
1311 | }
|
1312 |
|
1313 | function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
1314 | var result = bookKeeping.result,
|
1315 | keyPrefix = bookKeeping.keyPrefix,
|
1316 | func = bookKeeping.func,
|
1317 | context = bookKeeping.context;
|
1318 |
|
1319 |
|
1320 | var mappedChild = func.call(context, child, bookKeeping.count++);
|
1321 | if (Array.isArray(mappedChild)) {
|
1322 | mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
|
1323 | return c;
|
1324 | });
|
1325 | } else if (mappedChild != null) {
|
1326 | if (isValidElement(mappedChild)) {
|
1327 | mappedChild = cloneAndReplaceKey(mappedChild,
|
1328 |
|
1329 |
|
1330 | keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
1331 | }
|
1332 | result.push(mappedChild);
|
1333 | }
|
1334 | }
|
1335 |
|
1336 | function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
1337 | var escapedPrefix = '';
|
1338 | if (prefix != null) {
|
1339 | escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
1340 | }
|
1341 | var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
|
1342 | traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
|
1343 | releaseTraverseContext(traverseContext);
|
1344 | }
|
1345 |
|
1346 |
|
1347 |
|
1348 |
|
1349 |
|
1350 |
|
1351 |
|
1352 |
|
1353 |
|
1354 |
|
1355 |
|
1356 |
|
1357 |
|
1358 |
|
1359 | function mapChildren(children, func, context) {
|
1360 | if (children == null) {
|
1361 | return children;
|
1362 | }
|
1363 | var result = [];
|
1364 | mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
1365 | return result;
|
1366 | }
|
1367 |
|
1368 |
|
1369 |
|
1370 |
|
1371 |
|
1372 |
|
1373 |
|
1374 |
|
1375 |
|
1376 |
|
1377 | function countChildren(children) {
|
1378 | return traverseAllChildren(children, function () {
|
1379 | return null;
|
1380 | }, null);
|
1381 | }
|
1382 |
|
1383 |
|
1384 |
|
1385 |
|
1386 |
|
1387 |
|
1388 |
|
1389 | function toArray(children) {
|
1390 | var result = [];
|
1391 | mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
|
1392 | return child;
|
1393 | });
|
1394 | return result;
|
1395 | }
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 |
|
1402 |
|
1403 |
|
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 |
|
1409 |
|
1410 |
|
1411 | function onlyChild(children) {
|
1412 | (function () {
|
1413 | if (!isValidElement(children)) {
|
1414 | {
|
1415 | throw ReactError(Error('React.Children.only expected to receive a single React element child.'));
|
1416 | }
|
1417 | }
|
1418 | })();
|
1419 | return children;
|
1420 | }
|
1421 |
|
1422 | function createContext(defaultValue, calculateChangedBits) {
|
1423 | if (calculateChangedBits === undefined) {
|
1424 | calculateChangedBits = null;
|
1425 | } else {
|
1426 | {
|
1427 | !(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warningWithoutStack$1(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
|
1428 | }
|
1429 | }
|
1430 |
|
1431 | var context = {
|
1432 | $$typeof: REACT_CONTEXT_TYPE,
|
1433 | _calculateChangedBits: calculateChangedBits,
|
1434 |
|
1435 |
|
1436 |
|
1437 |
|
1438 |
|
1439 | _currentValue: defaultValue,
|
1440 | _currentValue2: defaultValue,
|
1441 |
|
1442 |
|
1443 | _threadCount: 0,
|
1444 |
|
1445 | Provider: null,
|
1446 | Consumer: null
|
1447 | };
|
1448 |
|
1449 | context.Provider = {
|
1450 | $$typeof: REACT_PROVIDER_TYPE,
|
1451 | _context: context
|
1452 | };
|
1453 |
|
1454 | var hasWarnedAboutUsingNestedContextConsumers = false;
|
1455 | var hasWarnedAboutUsingConsumerProvider = false;
|
1456 |
|
1457 | {
|
1458 |
|
1459 |
|
1460 |
|
1461 | var Consumer = {
|
1462 | $$typeof: REACT_CONTEXT_TYPE,
|
1463 | _context: context,
|
1464 | _calculateChangedBits: context._calculateChangedBits
|
1465 | };
|
1466 |
|
1467 | Object.defineProperties(Consumer, {
|
1468 | Provider: {
|
1469 | get: function () {
|
1470 | if (!hasWarnedAboutUsingConsumerProvider) {
|
1471 | hasWarnedAboutUsingConsumerProvider = true;
|
1472 | warning$1(false, 'Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
|
1473 | }
|
1474 | return context.Provider;
|
1475 | },
|
1476 | set: function (_Provider) {
|
1477 | context.Provider = _Provider;
|
1478 | }
|
1479 | },
|
1480 | _currentValue: {
|
1481 | get: function () {
|
1482 | return context._currentValue;
|
1483 | },
|
1484 | set: function (_currentValue) {
|
1485 | context._currentValue = _currentValue;
|
1486 | }
|
1487 | },
|
1488 | _currentValue2: {
|
1489 | get: function () {
|
1490 | return context._currentValue2;
|
1491 | },
|
1492 | set: function (_currentValue2) {
|
1493 | context._currentValue2 = _currentValue2;
|
1494 | }
|
1495 | },
|
1496 | _threadCount: {
|
1497 | get: function () {
|
1498 | return context._threadCount;
|
1499 | },
|
1500 | set: function (_threadCount) {
|
1501 | context._threadCount = _threadCount;
|
1502 | }
|
1503 | },
|
1504 | Consumer: {
|
1505 | get: function () {
|
1506 | if (!hasWarnedAboutUsingNestedContextConsumers) {
|
1507 | hasWarnedAboutUsingNestedContextConsumers = true;
|
1508 | warning$1(false, 'Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
|
1509 | }
|
1510 | return context.Consumer;
|
1511 | }
|
1512 | }
|
1513 | });
|
1514 |
|
1515 | context.Consumer = Consumer;
|
1516 | }
|
1517 |
|
1518 | {
|
1519 | context._currentRenderer = null;
|
1520 | context._currentRenderer2 = null;
|
1521 | }
|
1522 |
|
1523 | return context;
|
1524 | }
|
1525 |
|
1526 | function lazy(ctor) {
|
1527 | var lazyType = {
|
1528 | $$typeof: REACT_LAZY_TYPE,
|
1529 | _ctor: ctor,
|
1530 |
|
1531 | _status: -1,
|
1532 | _result: null
|
1533 | };
|
1534 |
|
1535 | {
|
1536 |
|
1537 | var defaultProps = void 0;
|
1538 | var propTypes = void 0;
|
1539 | Object.defineProperties(lazyType, {
|
1540 | defaultProps: {
|
1541 | configurable: true,
|
1542 | get: function () {
|
1543 | return defaultProps;
|
1544 | },
|
1545 | set: function (newDefaultProps) {
|
1546 | warning$1(false, 'React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
1547 | defaultProps = newDefaultProps;
|
1548 |
|
1549 | Object.defineProperty(lazyType, 'defaultProps', {
|
1550 | enumerable: true
|
1551 | });
|
1552 | }
|
1553 | },
|
1554 | propTypes: {
|
1555 | configurable: true,
|
1556 | get: function () {
|
1557 | return propTypes;
|
1558 | },
|
1559 | set: function (newPropTypes) {
|
1560 | warning$1(false, 'React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
1561 | propTypes = newPropTypes;
|
1562 |
|
1563 | Object.defineProperty(lazyType, 'propTypes', {
|
1564 | enumerable: true
|
1565 | });
|
1566 | }
|
1567 | }
|
1568 | });
|
1569 | }
|
1570 |
|
1571 | return lazyType;
|
1572 | }
|
1573 |
|
1574 | function forwardRef(render) {
|
1575 | {
|
1576 | if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
1577 | warningWithoutStack$1(false, 'forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
1578 | } else if (typeof render !== 'function') {
|
1579 | warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
1580 | } else {
|
1581 | !(
|
1582 |
|
1583 | render.length === 0 || render.length === 2) ? warningWithoutStack$1(false, 'forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.') : void 0;
|
1584 | }
|
1585 |
|
1586 | if (render != null) {
|
1587 | !(render.defaultProps == null && render.propTypes == null) ? warningWithoutStack$1(false, 'forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?') : void 0;
|
1588 | }
|
1589 | }
|
1590 |
|
1591 | return {
|
1592 | $$typeof: REACT_FORWARD_REF_TYPE,
|
1593 | render: render
|
1594 | };
|
1595 | }
|
1596 |
|
1597 | function isValidElementType(type) {
|
1598 | return typeof type === 'string' || typeof type === 'function' ||
|
1599 |
|
1600 | type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE);
|
1601 | }
|
1602 |
|
1603 | function memo(type, compare) {
|
1604 | {
|
1605 | if (!isValidElementType(type)) {
|
1606 | warningWithoutStack$1(false, 'memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
1607 | }
|
1608 | }
|
1609 | return {
|
1610 | $$typeof: REACT_MEMO_TYPE,
|
1611 | type: type,
|
1612 | compare: compare === undefined ? null : compare
|
1613 | };
|
1614 | }
|
1615 |
|
1616 | function resolveDispatcher() {
|
1617 | var dispatcher = ReactCurrentDispatcher.current;
|
1618 | (function () {
|
1619 | if (!(dispatcher !== null)) {
|
1620 | {
|
1621 | 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.'));
|
1622 | }
|
1623 | }
|
1624 | })();
|
1625 | return dispatcher;
|
1626 | }
|
1627 |
|
1628 | function useContext(Context, unstable_observedBits) {
|
1629 | var dispatcher = resolveDispatcher();
|
1630 | {
|
1631 | !(unstable_observedBits === undefined) ? warning$1(false, 'useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://fb.me/rules-of-hooks' : '') : void 0;
|
1632 |
|
1633 |
|
1634 | if (Context._context !== undefined) {
|
1635 | var realContext = Context._context;
|
1636 |
|
1637 |
|
1638 | if (realContext.Consumer === Context) {
|
1639 | warning$1(false, 'Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
|
1640 | } else if (realContext.Provider === Context) {
|
1641 | warning$1(false, 'Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
1642 | }
|
1643 | }
|
1644 | }
|
1645 | return dispatcher.useContext(Context, unstable_observedBits);
|
1646 | }
|
1647 |
|
1648 | function useState(initialState) {
|
1649 | var dispatcher = resolveDispatcher();
|
1650 | return dispatcher.useState(initialState);
|
1651 | }
|
1652 |
|
1653 | function useReducer(reducer, initialArg, init) {
|
1654 | var dispatcher = resolveDispatcher();
|
1655 | return dispatcher.useReducer(reducer, initialArg, init);
|
1656 | }
|
1657 |
|
1658 | function useRef(initialValue) {
|
1659 | var dispatcher = resolveDispatcher();
|
1660 | return dispatcher.useRef(initialValue);
|
1661 | }
|
1662 |
|
1663 | function useEffect(create, inputs) {
|
1664 | var dispatcher = resolveDispatcher();
|
1665 | return dispatcher.useEffect(create, inputs);
|
1666 | }
|
1667 |
|
1668 | function useLayoutEffect(create, inputs) {
|
1669 | var dispatcher = resolveDispatcher();
|
1670 | return dispatcher.useLayoutEffect(create, inputs);
|
1671 | }
|
1672 |
|
1673 | function useCallback(callback, inputs) {
|
1674 | var dispatcher = resolveDispatcher();
|
1675 | return dispatcher.useCallback(callback, inputs);
|
1676 | }
|
1677 |
|
1678 | function useMemo(create, inputs) {
|
1679 | var dispatcher = resolveDispatcher();
|
1680 | return dispatcher.useMemo(create, inputs);
|
1681 | }
|
1682 |
|
1683 | function useImperativeHandle(ref, create, inputs) {
|
1684 | var dispatcher = resolveDispatcher();
|
1685 | return dispatcher.useImperativeHandle(ref, create, inputs);
|
1686 | }
|
1687 |
|
1688 | function useDebugValue(value, formatterFn) {
|
1689 | {
|
1690 | var dispatcher = resolveDispatcher();
|
1691 | return dispatcher.useDebugValue(value, formatterFn);
|
1692 | }
|
1693 | }
|
1694 |
|
1695 | var emptyObject$1 = {};
|
1696 |
|
1697 | function useResponder(responder, listenerProps) {
|
1698 | var dispatcher = resolveDispatcher();
|
1699 | {
|
1700 | if (responder == null || responder.$$typeof !== REACT_RESPONDER_TYPE) {
|
1701 | warning$1(false, 'useResponder: invalid first argument. Expected an event responder, but instead got %s', responder);
|
1702 | return;
|
1703 | }
|
1704 | }
|
1705 | return dispatcher.useResponder(responder, listenerProps || emptyObject$1);
|
1706 | }
|
1707 |
|
1708 |
|
1709 | function withSuspenseConfig(scope, config) {
|
1710 | var previousConfig = ReactCurrentBatchConfig.suspense;
|
1711 | ReactCurrentBatchConfig.suspense = config === undefined ? null : config;
|
1712 | try {
|
1713 | scope();
|
1714 | } finally {
|
1715 | ReactCurrentBatchConfig.suspense = previousConfig;
|
1716 | }
|
1717 | }
|
1718 |
|
1719 |
|
1720 |
|
1721 |
|
1722 |
|
1723 |
|
1724 |
|
1725 |
|
1726 |
|
1727 |
|
1728 | var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
1729 |
|
1730 | var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
1731 |
|
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 |
|
1737 |
|
1738 |
|
1739 |
|
1740 |
|
1741 | var printWarning$1 = function() {};
|
1742 |
|
1743 | {
|
1744 | var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
1745 | var loggedTypeFailures = {};
|
1746 |
|
1747 | printWarning$1 = function(text) {
|
1748 | var message = 'Warning: ' + text;
|
1749 | if (typeof console !== 'undefined') {
|
1750 | console.error(message);
|
1751 | }
|
1752 | try {
|
1753 |
|
1754 |
|
1755 |
|
1756 | throw new Error(message);
|
1757 | } catch (x) {}
|
1758 | };
|
1759 | }
|
1760 |
|
1761 |
|
1762 |
|
1763 |
|
1764 |
|
1765 |
|
1766 |
|
1767 |
|
1768 |
|
1769 |
|
1770 |
|
1771 |
|
1772 | function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
1773 | {
|
1774 | for (var typeSpecName in typeSpecs) {
|
1775 | if (typeSpecs.hasOwnProperty(typeSpecName)) {
|
1776 | var error;
|
1777 |
|
1778 |
|
1779 |
|
1780 | try {
|
1781 |
|
1782 |
|
1783 | if (typeof typeSpecs[typeSpecName] !== 'function') {
|
1784 | var err = Error(
|
1785 | (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
1786 | 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
|
1787 | );
|
1788 | err.name = 'Invariant Violation';
|
1789 | throw err;
|
1790 | }
|
1791 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
1792 | } catch (ex) {
|
1793 | error = ex;
|
1794 | }
|
1795 | if (error && !(error instanceof Error)) {
|
1796 | printWarning$1(
|
1797 | (componentName || 'React class') + ': type specification of ' +
|
1798 | location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
1799 | 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
1800 | 'You may have forgotten to pass an argument to the type checker ' +
|
1801 | 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
1802 | 'shape all require an argument).'
|
1803 | );
|
1804 |
|
1805 | }
|
1806 | if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
1807 |
|
1808 |
|
1809 | loggedTypeFailures[error.message] = true;
|
1810 |
|
1811 | var stack = getStack ? getStack() : '';
|
1812 |
|
1813 | printWarning$1(
|
1814 | 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
1815 | );
|
1816 | }
|
1817 | }
|
1818 | }
|
1819 | }
|
1820 | }
|
1821 |
|
1822 | var checkPropTypes_1 = checkPropTypes;
|
1823 |
|
1824 |
|
1825 |
|
1826 |
|
1827 |
|
1828 |
|
1829 |
|
1830 |
|
1831 | var propTypesMisspellWarningShown = void 0;
|
1832 |
|
1833 | {
|
1834 | propTypesMisspellWarningShown = false;
|
1835 | }
|
1836 |
|
1837 | function getDeclarationErrorAddendum() {
|
1838 | if (ReactCurrentOwner.current) {
|
1839 | var name = getComponentName(ReactCurrentOwner.current.type);
|
1840 | if (name) {
|
1841 | return '\n\nCheck the render method of `' + name + '`.';
|
1842 | }
|
1843 | }
|
1844 | return '';
|
1845 | }
|
1846 |
|
1847 | function getSourceInfoErrorAddendum(source) {
|
1848 | if (source !== undefined) {
|
1849 | var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
1850 | var lineNumber = source.lineNumber;
|
1851 | return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
1852 | }
|
1853 | return '';
|
1854 | }
|
1855 |
|
1856 | function getSourceInfoErrorAddendumForProps(elementProps) {
|
1857 | if (elementProps !== null && elementProps !== undefined) {
|
1858 | return getSourceInfoErrorAddendum(elementProps.__source);
|
1859 | }
|
1860 | return '';
|
1861 | }
|
1862 |
|
1863 |
|
1864 |
|
1865 |
|
1866 |
|
1867 |
|
1868 | var ownerHasKeyUseWarning = {};
|
1869 |
|
1870 | function getCurrentComponentErrorInfo(parentType) {
|
1871 | var info = getDeclarationErrorAddendum();
|
1872 |
|
1873 | if (!info) {
|
1874 | var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
1875 | if (parentName) {
|
1876 | info = '\n\nCheck the top-level render call using <' + parentName + '>.';
|
1877 | }
|
1878 | }
|
1879 | return info;
|
1880 | }
|
1881 |
|
1882 |
|
1883 |
|
1884 |
|
1885 |
|
1886 |
|
1887 |
|
1888 |
|
1889 |
|
1890 |
|
1891 |
|
1892 |
|
1893 | function validateExplicitKey(element, parentType) {
|
1894 | if (!element._store || element._store.validated || element.key != null) {
|
1895 | return;
|
1896 | }
|
1897 | element._store.validated = true;
|
1898 |
|
1899 | var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
1900 | if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
1901 | return;
|
1902 | }
|
1903 | ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
1904 |
|
1905 |
|
1906 |
|
1907 |
|
1908 | var childOwner = '';
|
1909 | if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
1910 |
|
1911 | childOwner = ' It was passed a child from ' + getComponentName(element._owner.type) + '.';
|
1912 | }
|
1913 |
|
1914 | setCurrentlyValidatingElement(element);
|
1915 | {
|
1916 | warning$1(false, 'Each child in a list should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
1917 | }
|
1918 | setCurrentlyValidatingElement(null);
|
1919 | }
|
1920 |
|
1921 |
|
1922 |
|
1923 |
|
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 | function validateChildKeys(node, parentType) {
|
1931 | if (typeof node !== 'object') {
|
1932 | return;
|
1933 | }
|
1934 | if (Array.isArray(node)) {
|
1935 | for (var i = 0; i < node.length; i++) {
|
1936 | var child = node[i];
|
1937 | if (isValidElement(child)) {
|
1938 | validateExplicitKey(child, parentType);
|
1939 | }
|
1940 | }
|
1941 | } else if (isValidElement(node)) {
|
1942 |
|
1943 | if (node._store) {
|
1944 | node._store.validated = true;
|
1945 | }
|
1946 | } else if (node) {
|
1947 | var iteratorFn = getIteratorFn(node);
|
1948 | if (typeof iteratorFn === 'function') {
|
1949 |
|
1950 |
|
1951 | if (iteratorFn !== node.entries) {
|
1952 | var iterator = iteratorFn.call(node);
|
1953 | var step = void 0;
|
1954 | while (!(step = iterator.next()).done) {
|
1955 | if (isValidElement(step.value)) {
|
1956 | validateExplicitKey(step.value, parentType);
|
1957 | }
|
1958 | }
|
1959 | }
|
1960 | }
|
1961 | }
|
1962 | }
|
1963 |
|
1964 |
|
1965 |
|
1966 |
|
1967 |
|
1968 |
|
1969 |
|
1970 | function validatePropTypes(element) {
|
1971 | var type = element.type;
|
1972 | if (type === null || type === undefined || typeof type === 'string') {
|
1973 | return;
|
1974 | }
|
1975 | var name = getComponentName(type);
|
1976 | var propTypes = void 0;
|
1977 | if (typeof type === 'function') {
|
1978 | propTypes = type.propTypes;
|
1979 | } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE ||
|
1980 |
|
1981 |
|
1982 | type.$$typeof === REACT_MEMO_TYPE)) {
|
1983 | propTypes = type.propTypes;
|
1984 | } else {
|
1985 | return;
|
1986 | }
|
1987 | if (propTypes) {
|
1988 | setCurrentlyValidatingElement(element);
|
1989 | checkPropTypes_1(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
1990 | setCurrentlyValidatingElement(null);
|
1991 | } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
1992 | propTypesMisspellWarningShown = true;
|
1993 | warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
|
1994 | }
|
1995 | if (typeof type.getDefaultProps === 'function') {
|
1996 | !type.getDefaultProps.isReactClassApproved ? warningWithoutStack$1(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
|
1997 | }
|
1998 | }
|
1999 |
|
2000 |
|
2001 |
|
2002 |
|
2003 |
|
2004 | function validateFragmentProps(fragment) {
|
2005 | setCurrentlyValidatingElement(fragment);
|
2006 |
|
2007 | var keys = Object.keys(fragment.props);
|
2008 | for (var i = 0; i < keys.length; i++) {
|
2009 | var key = keys[i];
|
2010 | if (key !== 'children' && key !== 'key') {
|
2011 | warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
2012 | break;
|
2013 | }
|
2014 | }
|
2015 |
|
2016 | if (fragment.ref !== null) {
|
2017 | warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
|
2018 | }
|
2019 |
|
2020 | setCurrentlyValidatingElement(null);
|
2021 | }
|
2022 |
|
2023 | function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
2024 | var validType = isValidElementType(type);
|
2025 |
|
2026 |
|
2027 |
|
2028 | if (!validType) {
|
2029 | var info = '';
|
2030 | if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
2031 | 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.";
|
2032 | }
|
2033 |
|
2034 | var sourceInfo = getSourceInfoErrorAddendum(source);
|
2035 | if (sourceInfo) {
|
2036 | info += sourceInfo;
|
2037 | } else {
|
2038 | info += getDeclarationErrorAddendum();
|
2039 | }
|
2040 |
|
2041 | var typeString = void 0;
|
2042 | if (type === null) {
|
2043 | typeString = 'null';
|
2044 | } else if (Array.isArray(type)) {
|
2045 | typeString = 'array';
|
2046 | } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
2047 | typeString = '<' + (getComponentName(type.type) || 'Unknown') + ' />';
|
2048 | info = ' Did you accidentally export a JSX literal instead of a component?';
|
2049 | } else {
|
2050 | typeString = typeof type;
|
2051 | }
|
2052 |
|
2053 | warning$1(false, 'React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
2054 | }
|
2055 |
|
2056 | var element = jsxDEV(type, props, key, source, self);
|
2057 |
|
2058 |
|
2059 |
|
2060 | if (element == null) {
|
2061 | return element;
|
2062 | }
|
2063 |
|
2064 |
|
2065 |
|
2066 |
|
2067 |
|
2068 |
|
2069 | if (validType) {
|
2070 | var children = props.children;
|
2071 | if (children !== undefined) {
|
2072 | if (isStaticChildren) {
|
2073 | for (var i = 0; i < children.length; i++) {
|
2074 | validateChildKeys(children[i], type);
|
2075 | }
|
2076 | } else {
|
2077 | validateChildKeys(children, type);
|
2078 | }
|
2079 | }
|
2080 | }
|
2081 |
|
2082 | if (props.key !== undefined) {
|
2083 | warning$1(false, 'React.jsx: Spreading a key to JSX is a deprecated pattern. ' + 'Explicitly pass a key after spreading props in your JSX call. ' + 'E.g. <ComponentName {...props} key={key} />');
|
2084 | }
|
2085 |
|
2086 | if (type === REACT_FRAGMENT_TYPE) {
|
2087 | validateFragmentProps(element);
|
2088 | } else {
|
2089 | validatePropTypes(element);
|
2090 | }
|
2091 |
|
2092 | return element;
|
2093 | }
|
2094 |
|
2095 |
|
2096 |
|
2097 |
|
2098 |
|
2099 | function jsxWithValidationStatic(type, props, key) {
|
2100 | return jsxWithValidation(type, props, key, true);
|
2101 | }
|
2102 |
|
2103 | function jsxWithValidationDynamic(type, props, key) {
|
2104 | return jsxWithValidation(type, props, key, false);
|
2105 | }
|
2106 |
|
2107 | function createElementWithValidation(type, props, children) {
|
2108 | var validType = isValidElementType(type);
|
2109 |
|
2110 |
|
2111 |
|
2112 | if (!validType) {
|
2113 | var info = '';
|
2114 | if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
2115 | 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.";
|
2116 | }
|
2117 |
|
2118 | var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
2119 | if (sourceInfo) {
|
2120 | info += sourceInfo;
|
2121 | } else {
|
2122 | info += getDeclarationErrorAddendum();
|
2123 | }
|
2124 |
|
2125 | var typeString = void 0;
|
2126 | if (type === null) {
|
2127 | typeString = 'null';
|
2128 | } else if (Array.isArray(type)) {
|
2129 | typeString = 'array';
|
2130 | } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
2131 | typeString = '<' + (getComponentName(type.type) || 'Unknown') + ' />';
|
2132 | info = ' Did you accidentally export a JSX literal instead of a component?';
|
2133 | } else {
|
2134 | typeString = typeof type;
|
2135 | }
|
2136 |
|
2137 | warning$1(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
2138 | }
|
2139 |
|
2140 | var element = createElement.apply(this, arguments);
|
2141 |
|
2142 |
|
2143 |
|
2144 | if (element == null) {
|
2145 | return element;
|
2146 | }
|
2147 |
|
2148 |
|
2149 |
|
2150 |
|
2151 |
|
2152 |
|
2153 | if (validType) {
|
2154 | for (var i = 2; i < arguments.length; i++) {
|
2155 | validateChildKeys(arguments[i], type);
|
2156 | }
|
2157 | }
|
2158 |
|
2159 | if (type === REACT_FRAGMENT_TYPE) {
|
2160 | validateFragmentProps(element);
|
2161 | } else {
|
2162 | validatePropTypes(element);
|
2163 | }
|
2164 |
|
2165 | return element;
|
2166 | }
|
2167 |
|
2168 | function createFactoryWithValidation(type) {
|
2169 | var validatedFactory = createElementWithValidation.bind(null, type);
|
2170 | validatedFactory.type = type;
|
2171 |
|
2172 | {
|
2173 | Object.defineProperty(validatedFactory, 'type', {
|
2174 | enumerable: false,
|
2175 | get: function () {
|
2176 | lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
2177 | Object.defineProperty(this, 'type', {
|
2178 | value: type
|
2179 | });
|
2180 | return type;
|
2181 | }
|
2182 | });
|
2183 | }
|
2184 |
|
2185 | return validatedFactory;
|
2186 | }
|
2187 |
|
2188 | function cloneElementWithValidation(element, props, children) {
|
2189 | var newElement = cloneElement.apply(this, arguments);
|
2190 | for (var i = 2; i < arguments.length; i++) {
|
2191 | validateChildKeys(arguments[i], newElement.type);
|
2192 | }
|
2193 | validatePropTypes(newElement);
|
2194 | return newElement;
|
2195 | }
|
2196 |
|
2197 | var enableSchedulerDebugging = false;
|
2198 | var enableIsInputPending = false;
|
2199 | var requestIdleCallbackBeforeFirstFrame = false;
|
2200 | var requestTimerEventBeforeFirstFrame = false;
|
2201 | var enableMessageLoopImplementation = false;
|
2202 |
|
2203 |
|
2204 |
|
2205 |
|
2206 |
|
2207 |
|
2208 |
|
2209 |
|
2210 |
|
2211 | var requestHostCallback = void 0;
|
2212 |
|
2213 | var requestHostTimeout = void 0;
|
2214 | var cancelHostTimeout = void 0;
|
2215 | var shouldYieldToHost = void 0;
|
2216 | var requestPaint = void 0;
|
2217 | var getCurrentTime = void 0;
|
2218 | var forceFrameRate = void 0;
|
2219 |
|
2220 | if (
|
2221 |
|
2222 |
|
2223 | typeof window === 'undefined' ||
|
2224 |
|
2225 | typeof MessageChannel !== 'function') {
|
2226 |
|
2227 |
|
2228 | var _callback = null;
|
2229 | var _timeoutID = null;
|
2230 | var _flushCallback = function () {
|
2231 | if (_callback !== null) {
|
2232 | try {
|
2233 | var currentTime = getCurrentTime();
|
2234 | var hasRemainingTime = true;
|
2235 | _callback(hasRemainingTime, currentTime);
|
2236 | _callback = null;
|
2237 | } catch (e) {
|
2238 | setTimeout(_flushCallback, 0);
|
2239 | throw e;
|
2240 | }
|
2241 | }
|
2242 | };
|
2243 | getCurrentTime = function () {
|
2244 | return Date.now();
|
2245 | };
|
2246 | requestHostCallback = function (cb) {
|
2247 | if (_callback !== null) {
|
2248 |
|
2249 | setTimeout(requestHostCallback, 0, cb);
|
2250 | } else {
|
2251 | _callback = cb;
|
2252 | setTimeout(_flushCallback, 0);
|
2253 | }
|
2254 | };
|
2255 | requestHostTimeout = function (cb, ms) {
|
2256 | _timeoutID = setTimeout(cb, ms);
|
2257 | };
|
2258 | cancelHostTimeout = function () {
|
2259 | clearTimeout(_timeoutID);
|
2260 | };
|
2261 | shouldYieldToHost = function () {
|
2262 | return false;
|
2263 | };
|
2264 | requestPaint = forceFrameRate = function () {};
|
2265 | } else {
|
2266 |
|
2267 | var performance = window.performance;
|
2268 | var _Date = window.Date;
|
2269 | var _setTimeout = window.setTimeout;
|
2270 | var _clearTimeout = window.clearTimeout;
|
2271 | var requestAnimationFrame = window.requestAnimationFrame;
|
2272 | var cancelAnimationFrame = window.cancelAnimationFrame;
|
2273 | var requestIdleCallback = window.requestIdleCallback;
|
2274 |
|
2275 | if (typeof console !== 'undefined') {
|
2276 |
|
2277 | if (typeof requestAnimationFrame !== 'function') {
|
2278 | console.error("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
|
2279 | }
|
2280 | if (typeof cancelAnimationFrame !== 'function') {
|
2281 | console.error("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
|
2282 | }
|
2283 | }
|
2284 |
|
2285 | var requestIdleCallbackBeforeFirstFrame$1 = requestIdleCallbackBeforeFirstFrame && typeof requestIdleCallback === 'function' && typeof cancelIdleCallback === 'function';
|
2286 |
|
2287 | getCurrentTime = typeof performance === 'object' && typeof performance.now === 'function' ? function () {
|
2288 | return performance.now();
|
2289 | } : function () {
|
2290 | return _Date.now();
|
2291 | };
|
2292 |
|
2293 | var isRAFLoopRunning = false;
|
2294 | var isMessageLoopRunning = false;
|
2295 | var scheduledHostCallback = null;
|
2296 | var rAFTimeoutID = -1;
|
2297 | var taskTimeoutID = -1;
|
2298 |
|
2299 | var frameLength = enableMessageLoopImplementation ?
|
2300 |
|
2301 |
|
2302 | 5 :
|
2303 |
|
2304 |
|
2305 |
|
2306 | 33.33;
|
2307 |
|
2308 | var prevRAFTime = -1;
|
2309 | var prevRAFInterval = -1;
|
2310 | var frameDeadline = 0;
|
2311 |
|
2312 | var fpsLocked = false;
|
2313 |
|
2314 |
|
2315 |
|
2316 | var maxFrameLength = 300;
|
2317 | var needsPaint = false;
|
2318 |
|
2319 | if (enableIsInputPending && navigator !== undefined && navigator.scheduling !== undefined && navigator.scheduling.isInputPending !== undefined) {
|
2320 | var scheduling = navigator.scheduling;
|
2321 | shouldYieldToHost = function () {
|
2322 | var currentTime = getCurrentTime();
|
2323 | if (currentTime >= frameDeadline) {
|
2324 |
|
2325 |
|
2326 |
|
2327 |
|
2328 |
|
2329 |
|
2330 |
|
2331 |
|
2332 | if (needsPaint || scheduling.isInputPending()) {
|
2333 |
|
2334 | return true;
|
2335 | }
|
2336 |
|
2337 |
|
2338 | return currentTime >= frameDeadline + maxFrameLength;
|
2339 | } else {
|
2340 |
|
2341 | return false;
|
2342 | }
|
2343 | };
|
2344 |
|
2345 | requestPaint = function () {
|
2346 | needsPaint = true;
|
2347 | };
|
2348 | } else {
|
2349 |
|
2350 |
|
2351 | shouldYieldToHost = function () {
|
2352 | return getCurrentTime() >= frameDeadline;
|
2353 | };
|
2354 |
|
2355 |
|
2356 | requestPaint = function () {};
|
2357 | }
|
2358 |
|
2359 | forceFrameRate = function (fps) {
|
2360 | if (fps < 0 || fps > 125) {
|
2361 | console.error('forceFrameRate takes a positive int between 0 and 125, ' + 'forcing framerates higher than 125 fps is not unsupported');
|
2362 | return;
|
2363 | }
|
2364 | if (fps > 0) {
|
2365 | frameLength = Math.floor(1000 / fps);
|
2366 | fpsLocked = true;
|
2367 | } else {
|
2368 |
|
2369 | frameLength = 33.33;
|
2370 | fpsLocked = false;
|
2371 | }
|
2372 | };
|
2373 |
|
2374 | var performWorkUntilDeadline = function () {
|
2375 | if (enableMessageLoopImplementation) {
|
2376 | if (scheduledHostCallback !== null) {
|
2377 | var currentTime = getCurrentTime();
|
2378 |
|
2379 |
|
2380 |
|
2381 | frameDeadline = currentTime + frameLength;
|
2382 | var hasTimeRemaining = true;
|
2383 | try {
|
2384 | var hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime);
|
2385 | if (!hasMoreWork) {
|
2386 | isMessageLoopRunning = false;
|
2387 | scheduledHostCallback = null;
|
2388 | } else {
|
2389 |
|
2390 |
|
2391 | port.postMessage(null);
|
2392 | }
|
2393 | } catch (error) {
|
2394 |
|
2395 |
|
2396 | port.postMessage(null);
|
2397 | throw error;
|
2398 | }
|
2399 | }
|
2400 |
|
2401 |
|
2402 | needsPaint = false;
|
2403 | } else {
|
2404 | if (scheduledHostCallback !== null) {
|
2405 | var _currentTime = getCurrentTime();
|
2406 | var _hasTimeRemaining = frameDeadline - _currentTime > 0;
|
2407 | try {
|
2408 | var _hasMoreWork = scheduledHostCallback(_hasTimeRemaining, _currentTime);
|
2409 | if (!_hasMoreWork) {
|
2410 | scheduledHostCallback = null;
|
2411 | }
|
2412 | } catch (error) {
|
2413 |
|
2414 |
|
2415 |
|
2416 | port.postMessage(null);
|
2417 | throw error;
|
2418 | }
|
2419 | }
|
2420 |
|
2421 |
|
2422 | needsPaint = false;
|
2423 | }
|
2424 | };
|
2425 |
|
2426 | var channel = new MessageChannel();
|
2427 | var port = channel.port2;
|
2428 | channel.port1.onmessage = performWorkUntilDeadline;
|
2429 |
|
2430 | var onAnimationFrame = function (rAFTime) {
|
2431 | if (scheduledHostCallback === null) {
|
2432 |
|
2433 | prevRAFTime = -1;
|
2434 | prevRAFInterval = -1;
|
2435 | isRAFLoopRunning = false;
|
2436 | return;
|
2437 | }
|
2438 |
|
2439 |
|
2440 |
|
2441 |
|
2442 |
|
2443 |
|
2444 |
|
2445 |
|
2446 |
|
2447 | isRAFLoopRunning = true;
|
2448 | requestAnimationFrame(function (nextRAFTime) {
|
2449 | _clearTimeout(rAFTimeoutID);
|
2450 | onAnimationFrame(nextRAFTime);
|
2451 | });
|
2452 |
|
2453 |
|
2454 |
|
2455 |
|
2456 | var onTimeout = function () {
|
2457 | frameDeadline = getCurrentTime() + frameLength / 2;
|
2458 | performWorkUntilDeadline();
|
2459 | rAFTimeoutID = _setTimeout(onTimeout, frameLength * 3);
|
2460 | };
|
2461 | rAFTimeoutID = _setTimeout(onTimeout, frameLength * 3);
|
2462 |
|
2463 | if (prevRAFTime !== -1 &&
|
2464 |
|
2465 |
|
2466 | rAFTime - prevRAFTime > 0.1) {
|
2467 | var rAFInterval = rAFTime - prevRAFTime;
|
2468 | if (!fpsLocked && prevRAFInterval !== -1) {
|
2469 |
|
2470 |
|
2471 |
|
2472 |
|
2473 |
|
2474 |
|
2475 |
|
2476 |
|
2477 |
|
2478 | if (rAFInterval < frameLength && prevRAFInterval < frameLength) {
|
2479 | frameLength = rAFInterval < prevRAFInterval ? prevRAFInterval : rAFInterval;
|
2480 | if (frameLength < 8.33) {
|
2481 |
|
2482 |
|
2483 |
|
2484 | frameLength = 8.33;
|
2485 | }
|
2486 | }
|
2487 | }
|
2488 | prevRAFInterval = rAFInterval;
|
2489 | }
|
2490 | prevRAFTime = rAFTime;
|
2491 | frameDeadline = rAFTime + frameLength;
|
2492 |
|
2493 |
|
2494 | port.postMessage(null);
|
2495 | };
|
2496 |
|
2497 | requestHostCallback = function (callback) {
|
2498 | scheduledHostCallback = callback;
|
2499 | if (enableMessageLoopImplementation) {
|
2500 | if (!isMessageLoopRunning) {
|
2501 | isMessageLoopRunning = true;
|
2502 | port.postMessage(null);
|
2503 | }
|
2504 | } else {
|
2505 | if (!isRAFLoopRunning) {
|
2506 |
|
2507 | isRAFLoopRunning = true;
|
2508 | requestAnimationFrame(function (rAFTime) {
|
2509 | if (requestIdleCallbackBeforeFirstFrame$1) {
|
2510 | cancelIdleCallback(idleCallbackID);
|
2511 | }
|
2512 | if (requestTimerEventBeforeFirstFrame) {
|
2513 | _clearTimeout(idleTimeoutID);
|
2514 | }
|
2515 | onAnimationFrame(rAFTime);
|
2516 | });
|
2517 |
|
2518 |
|
2519 |
|
2520 |
|
2521 |
|
2522 |
|
2523 |
|
2524 |
|
2525 |
|
2526 | var idleCallbackID = void 0;
|
2527 | if (requestIdleCallbackBeforeFirstFrame$1) {
|
2528 | idleCallbackID = requestIdleCallback(function onIdleCallbackBeforeFirstFrame() {
|
2529 | if (requestTimerEventBeforeFirstFrame) {
|
2530 | _clearTimeout(idleTimeoutID);
|
2531 | }
|
2532 | frameDeadline = getCurrentTime() + frameLength;
|
2533 | performWorkUntilDeadline();
|
2534 | });
|
2535 | }
|
2536 |
|
2537 |
|
2538 |
|
2539 |
|
2540 |
|
2541 | var idleTimeoutID = void 0;
|
2542 | if (requestTimerEventBeforeFirstFrame) {
|
2543 | idleTimeoutID = _setTimeout(function onTimerEventBeforeFirstFrame() {
|
2544 | if (requestIdleCallbackBeforeFirstFrame$1) {
|
2545 | cancelIdleCallback(idleCallbackID);
|
2546 | }
|
2547 | frameDeadline = getCurrentTime() + frameLength;
|
2548 | performWorkUntilDeadline();
|
2549 | }, 0);
|
2550 | }
|
2551 | }
|
2552 | }
|
2553 | };
|
2554 |
|
2555 | requestHostTimeout = function (callback, ms) {
|
2556 | taskTimeoutID = _setTimeout(function () {
|
2557 | callback(getCurrentTime());
|
2558 | }, ms);
|
2559 | };
|
2560 |
|
2561 | cancelHostTimeout = function () {
|
2562 | _clearTimeout(taskTimeoutID);
|
2563 | taskTimeoutID = -1;
|
2564 | };
|
2565 | }
|
2566 |
|
2567 |
|
2568 |
|
2569 |
|
2570 | var ImmediatePriority = 1;
|
2571 | var UserBlockingPriority = 2;
|
2572 | var NormalPriority = 3;
|
2573 | var LowPriority = 4;
|
2574 | var IdlePriority = 5;
|
2575 |
|
2576 |
|
2577 |
|
2578 |
|
2579 | var maxSigned31BitInt = 1073741823;
|
2580 |
|
2581 |
|
2582 | var IMMEDIATE_PRIORITY_TIMEOUT = -1;
|
2583 |
|
2584 | var USER_BLOCKING_PRIORITY = 250;
|
2585 | var NORMAL_PRIORITY_TIMEOUT = 5000;
|
2586 | var LOW_PRIORITY_TIMEOUT = 10000;
|
2587 |
|
2588 | var IDLE_PRIORITY = maxSigned31BitInt;
|
2589 |
|
2590 |
|
2591 | var firstTask = null;
|
2592 | var firstDelayedTask = null;
|
2593 |
|
2594 |
|
2595 | var isSchedulerPaused = false;
|
2596 |
|
2597 | var currentTask = null;
|
2598 | var currentPriorityLevel = NormalPriority;
|
2599 |
|
2600 |
|
2601 | var isPerformingWork = false;
|
2602 |
|
2603 | var isHostCallbackScheduled = false;
|
2604 | var isHostTimeoutScheduled = false;
|
2605 |
|
2606 | function scheduler_flushTaskAtPriority_Immediate(callback, didTimeout) {
|
2607 | return callback(didTimeout);
|
2608 | }
|
2609 | function scheduler_flushTaskAtPriority_UserBlocking(callback, didTimeout) {
|
2610 | return callback(didTimeout);
|
2611 | }
|
2612 | function scheduler_flushTaskAtPriority_Normal(callback, didTimeout) {
|
2613 | return callback(didTimeout);
|
2614 | }
|
2615 | function scheduler_flushTaskAtPriority_Low(callback, didTimeout) {
|
2616 | return callback(didTimeout);
|
2617 | }
|
2618 | function scheduler_flushTaskAtPriority_Idle(callback, didTimeout) {
|
2619 | return callback(didTimeout);
|
2620 | }
|
2621 |
|
2622 | function flushTask(task, currentTime) {
|
2623 |
|
2624 |
|
2625 | var next = task.next;
|
2626 | if (next === task) {
|
2627 |
|
2628 | firstTask = null;
|
2629 | } else {
|
2630 |
|
2631 | if (task === firstTask) {
|
2632 | firstTask = next;
|
2633 | }
|
2634 | var previous = task.previous;
|
2635 | previous.next = next;
|
2636 | next.previous = previous;
|
2637 | }
|
2638 | task.next = task.previous = null;
|
2639 |
|
2640 |
|
2641 | var callback = task.callback;
|
2642 | var previousPriorityLevel = currentPriorityLevel;
|
2643 | var previousTask = currentTask;
|
2644 | currentPriorityLevel = task.priorityLevel;
|
2645 | currentTask = task;
|
2646 | var continuationCallback;
|
2647 | try {
|
2648 | var didUserCallbackTimeout = task.expirationTime <= currentTime;
|
2649 |
|
2650 |
|
2651 | switch (currentPriorityLevel) {
|
2652 | case ImmediatePriority:
|
2653 | continuationCallback = scheduler_flushTaskAtPriority_Immediate(callback, didUserCallbackTimeout);
|
2654 | break;
|
2655 | case UserBlockingPriority:
|
2656 | continuationCallback = scheduler_flushTaskAtPriority_UserBlocking(callback, didUserCallbackTimeout);
|
2657 | break;
|
2658 | case NormalPriority:
|
2659 | continuationCallback = scheduler_flushTaskAtPriority_Normal(callback, didUserCallbackTimeout);
|
2660 | break;
|
2661 | case LowPriority:
|
2662 | continuationCallback = scheduler_flushTaskAtPriority_Low(callback, didUserCallbackTimeout);
|
2663 | break;
|
2664 | case IdlePriority:
|
2665 | continuationCallback = scheduler_flushTaskAtPriority_Idle(callback, didUserCallbackTimeout);
|
2666 | break;
|
2667 | }
|
2668 | } catch (error) {
|
2669 | throw error;
|
2670 | } finally {
|
2671 | currentPriorityLevel = previousPriorityLevel;
|
2672 | currentTask = previousTask;
|
2673 | }
|
2674 |
|
2675 |
|
2676 |
|
2677 | if (typeof continuationCallback === 'function') {
|
2678 | var expirationTime = task.expirationTime;
|
2679 | var continuationTask = task;
|
2680 | continuationTask.callback = continuationCallback;
|
2681 |
|
2682 |
|
2683 |
|
2684 |
|
2685 |
|
2686 | if (firstTask === null) {
|
2687 |
|
2688 | firstTask = continuationTask.next = continuationTask.previous = continuationTask;
|
2689 | } else {
|
2690 | var nextAfterContinuation = null;
|
2691 | var t = firstTask;
|
2692 | do {
|
2693 | if (expirationTime <= t.expirationTime) {
|
2694 |
|
2695 |
|
2696 | nextAfterContinuation = t;
|
2697 | break;
|
2698 | }
|
2699 | t = t.next;
|
2700 | } while (t !== firstTask);
|
2701 | if (nextAfterContinuation === null) {
|
2702 |
|
2703 |
|
2704 | nextAfterContinuation = firstTask;
|
2705 | } else if (nextAfterContinuation === firstTask) {
|
2706 |
|
2707 | firstTask = continuationTask;
|
2708 | }
|
2709 |
|
2710 | var _previous = nextAfterContinuation.previous;
|
2711 | _previous.next = nextAfterContinuation.previous = continuationTask;
|
2712 | continuationTask.next = nextAfterContinuation;
|
2713 | continuationTask.previous = _previous;
|
2714 | }
|
2715 | }
|
2716 | }
|
2717 |
|
2718 | function advanceTimers(currentTime) {
|
2719 |
|
2720 | if (firstDelayedTask !== null && firstDelayedTask.startTime <= currentTime) {
|
2721 | do {
|
2722 | var task = firstDelayedTask;
|
2723 | var next = task.next;
|
2724 | if (task === next) {
|
2725 | firstDelayedTask = null;
|
2726 | } else {
|
2727 | firstDelayedTask = next;
|
2728 | var previous = task.previous;
|
2729 | previous.next = next;
|
2730 | next.previous = previous;
|
2731 | }
|
2732 | task.next = task.previous = null;
|
2733 | insertScheduledTask(task, task.expirationTime);
|
2734 | } while (firstDelayedTask !== null && firstDelayedTask.startTime <= currentTime);
|
2735 | }
|
2736 | }
|
2737 |
|
2738 | function handleTimeout(currentTime) {
|
2739 | isHostTimeoutScheduled = false;
|
2740 | advanceTimers(currentTime);
|
2741 |
|
2742 | if (!isHostCallbackScheduled) {
|
2743 | if (firstTask !== null) {
|
2744 | isHostCallbackScheduled = true;
|
2745 | requestHostCallback(flushWork);
|
2746 | } else if (firstDelayedTask !== null) {
|
2747 | requestHostTimeout(handleTimeout, firstDelayedTask.startTime - currentTime);
|
2748 | }
|
2749 | }
|
2750 | }
|
2751 |
|
2752 | function flushWork(hasTimeRemaining, initialTime) {
|
2753 |
|
2754 | if (enableSchedulerDebugging && isSchedulerPaused) {
|
2755 | return;
|
2756 | }
|
2757 |
|
2758 |
|
2759 | isHostCallbackScheduled = false;
|
2760 | if (isHostTimeoutScheduled) {
|
2761 |
|
2762 | isHostTimeoutScheduled = false;
|
2763 | cancelHostTimeout();
|
2764 | }
|
2765 |
|
2766 | var currentTime = initialTime;
|
2767 | advanceTimers(currentTime);
|
2768 |
|
2769 | isPerformingWork = true;
|
2770 | try {
|
2771 | if (!hasTimeRemaining) {
|
2772 |
|
2773 |
|
2774 |
|
2775 | while (firstTask !== null && firstTask.expirationTime <= currentTime && !(enableSchedulerDebugging && isSchedulerPaused)) {
|
2776 | flushTask(firstTask, currentTime);
|
2777 | currentTime = getCurrentTime();
|
2778 | advanceTimers(currentTime);
|
2779 | }
|
2780 | } else {
|
2781 |
|
2782 | if (firstTask !== null) {
|
2783 | do {
|
2784 | flushTask(firstTask, currentTime);
|
2785 | currentTime = getCurrentTime();
|
2786 | advanceTimers(currentTime);
|
2787 | } while (firstTask !== null && !shouldYieldToHost() && !(enableSchedulerDebugging && isSchedulerPaused));
|
2788 | }
|
2789 | }
|
2790 |
|
2791 | if (firstTask !== null) {
|
2792 | return true;
|
2793 | } else {
|
2794 | if (firstDelayedTask !== null) {
|
2795 | requestHostTimeout(handleTimeout, firstDelayedTask.startTime - currentTime);
|
2796 | }
|
2797 | return false;
|
2798 | }
|
2799 | } finally {
|
2800 | isPerformingWork = false;
|
2801 | }
|
2802 | }
|
2803 |
|
2804 | function unstable_runWithPriority(priorityLevel, eventHandler) {
|
2805 | switch (priorityLevel) {
|
2806 | case ImmediatePriority:
|
2807 | case UserBlockingPriority:
|
2808 | case NormalPriority:
|
2809 | case LowPriority:
|
2810 | case IdlePriority:
|
2811 | break;
|
2812 | default:
|
2813 | priorityLevel = NormalPriority;
|
2814 | }
|
2815 |
|
2816 | var previousPriorityLevel = currentPriorityLevel;
|
2817 | currentPriorityLevel = priorityLevel;
|
2818 |
|
2819 | try {
|
2820 | return eventHandler();
|
2821 | } finally {
|
2822 | currentPriorityLevel = previousPriorityLevel;
|
2823 | }
|
2824 | }
|
2825 |
|
2826 | function unstable_next(eventHandler) {
|
2827 | var priorityLevel;
|
2828 | switch (currentPriorityLevel) {
|
2829 | case ImmediatePriority:
|
2830 | case UserBlockingPriority:
|
2831 | case NormalPriority:
|
2832 |
|
2833 | priorityLevel = NormalPriority;
|
2834 | break;
|
2835 | default:
|
2836 |
|
2837 | priorityLevel = currentPriorityLevel;
|
2838 | break;
|
2839 | }
|
2840 |
|
2841 | var previousPriorityLevel = currentPriorityLevel;
|
2842 | currentPriorityLevel = priorityLevel;
|
2843 |
|
2844 | try {
|
2845 | return eventHandler();
|
2846 | } finally {
|
2847 | currentPriorityLevel = previousPriorityLevel;
|
2848 | }
|
2849 | }
|
2850 |
|
2851 | function unstable_wrapCallback(callback) {
|
2852 | var parentPriorityLevel = currentPriorityLevel;
|
2853 | return function () {
|
2854 |
|
2855 | var previousPriorityLevel = currentPriorityLevel;
|
2856 | currentPriorityLevel = parentPriorityLevel;
|
2857 |
|
2858 | try {
|
2859 | return callback.apply(this, arguments);
|
2860 | } finally {
|
2861 | currentPriorityLevel = previousPriorityLevel;
|
2862 | }
|
2863 | };
|
2864 | }
|
2865 |
|
2866 | function timeoutForPriorityLevel(priorityLevel) {
|
2867 | switch (priorityLevel) {
|
2868 | case ImmediatePriority:
|
2869 | return IMMEDIATE_PRIORITY_TIMEOUT;
|
2870 | case UserBlockingPriority:
|
2871 | return USER_BLOCKING_PRIORITY;
|
2872 | case IdlePriority:
|
2873 | return IDLE_PRIORITY;
|
2874 | case LowPriority:
|
2875 | return LOW_PRIORITY_TIMEOUT;
|
2876 | case NormalPriority:
|
2877 | default:
|
2878 | return NORMAL_PRIORITY_TIMEOUT;
|
2879 | }
|
2880 | }
|
2881 |
|
2882 | function unstable_scheduleCallback(priorityLevel, callback, options) {
|
2883 | var currentTime = getCurrentTime();
|
2884 |
|
2885 | var startTime;
|
2886 | var timeout;
|
2887 | if (typeof options === 'object' && options !== null) {
|
2888 | var delay = options.delay;
|
2889 | if (typeof delay === 'number' && delay > 0) {
|
2890 | startTime = currentTime + delay;
|
2891 | } else {
|
2892 | startTime = currentTime;
|
2893 | }
|
2894 | timeout = typeof options.timeout === 'number' ? options.timeout : timeoutForPriorityLevel(priorityLevel);
|
2895 | } else {
|
2896 | timeout = timeoutForPriorityLevel(priorityLevel);
|
2897 | startTime = currentTime;
|
2898 | }
|
2899 |
|
2900 | var expirationTime = startTime + timeout;
|
2901 |
|
2902 | var newTask = {
|
2903 | callback: callback,
|
2904 | priorityLevel: priorityLevel,
|
2905 | startTime: startTime,
|
2906 | expirationTime: expirationTime,
|
2907 | next: null,
|
2908 | previous: null
|
2909 | };
|
2910 |
|
2911 | if (startTime > currentTime) {
|
2912 |
|
2913 | insertDelayedTask(newTask, startTime);
|
2914 | if (firstTask === null && firstDelayedTask === newTask) {
|
2915 |
|
2916 | if (isHostTimeoutScheduled) {
|
2917 |
|
2918 | cancelHostTimeout();
|
2919 | } else {
|
2920 | isHostTimeoutScheduled = true;
|
2921 | }
|
2922 |
|
2923 | requestHostTimeout(handleTimeout, startTime - currentTime);
|
2924 | }
|
2925 | } else {
|
2926 | insertScheduledTask(newTask, expirationTime);
|
2927 |
|
2928 |
|
2929 | if (!isHostCallbackScheduled && !isPerformingWork) {
|
2930 | isHostCallbackScheduled = true;
|
2931 | requestHostCallback(flushWork);
|
2932 | }
|
2933 | }
|
2934 |
|
2935 | return newTask;
|
2936 | }
|
2937 |
|
2938 | function insertScheduledTask(newTask, expirationTime) {
|
2939 |
|
2940 |
|
2941 |
|
2942 | if (firstTask === null) {
|
2943 |
|
2944 | firstTask = newTask.next = newTask.previous = newTask;
|
2945 | } else {
|
2946 | var next = null;
|
2947 | var task = firstTask;
|
2948 | do {
|
2949 | if (expirationTime < task.expirationTime) {
|
2950 |
|
2951 | next = task;
|
2952 | break;
|
2953 | }
|
2954 | task = task.next;
|
2955 | } while (task !== firstTask);
|
2956 |
|
2957 | if (next === null) {
|
2958 |
|
2959 |
|
2960 | next = firstTask;
|
2961 | } else if (next === firstTask) {
|
2962 |
|
2963 | firstTask = newTask;
|
2964 | }
|
2965 |
|
2966 | var previous = next.previous;
|
2967 | previous.next = next.previous = newTask;
|
2968 | newTask.next = next;
|
2969 | newTask.previous = previous;
|
2970 | }
|
2971 | }
|
2972 |
|
2973 | function insertDelayedTask(newTask, startTime) {
|
2974 |
|
2975 | if (firstDelayedTask === null) {
|
2976 |
|
2977 | firstDelayedTask = newTask.next = newTask.previous = newTask;
|
2978 | } else {
|
2979 | var next = null;
|
2980 | var task = firstDelayedTask;
|
2981 | do {
|
2982 | if (startTime < task.startTime) {
|
2983 |
|
2984 | next = task;
|
2985 | break;
|
2986 | }
|
2987 | task = task.next;
|
2988 | } while (task !== firstDelayedTask);
|
2989 |
|
2990 | if (next === null) {
|
2991 |
|
2992 |
|
2993 | next = firstDelayedTask;
|
2994 | } else if (next === firstDelayedTask) {
|
2995 |
|
2996 | firstDelayedTask = newTask;
|
2997 | }
|
2998 |
|
2999 | var previous = next.previous;
|
3000 | previous.next = next.previous = newTask;
|
3001 | newTask.next = next;
|
3002 | newTask.previous = previous;
|
3003 | }
|
3004 | }
|
3005 |
|
3006 | function unstable_pauseExecution() {
|
3007 | isSchedulerPaused = true;
|
3008 | }
|
3009 |
|
3010 | function unstable_continueExecution() {
|
3011 | isSchedulerPaused = false;
|
3012 | if (!isHostCallbackScheduled && !isPerformingWork) {
|
3013 | isHostCallbackScheduled = true;
|
3014 | requestHostCallback(flushWork);
|
3015 | }
|
3016 | }
|
3017 |
|
3018 | function unstable_getFirstCallbackNode() {
|
3019 | return firstTask;
|
3020 | }
|
3021 |
|
3022 | function unstable_cancelCallback(task) {
|
3023 | var next = task.next;
|
3024 | if (next === null) {
|
3025 |
|
3026 | return;
|
3027 | }
|
3028 |
|
3029 | if (task === next) {
|
3030 | if (task === firstTask) {
|
3031 | firstTask = null;
|
3032 | } else if (task === firstDelayedTask) {
|
3033 | firstDelayedTask = null;
|
3034 | }
|
3035 | } else {
|
3036 | if (task === firstTask) {
|
3037 | firstTask = next;
|
3038 | } else if (task === firstDelayedTask) {
|
3039 | firstDelayedTask = next;
|
3040 | }
|
3041 | var previous = task.previous;
|
3042 | previous.next = next;
|
3043 | next.previous = previous;
|
3044 | }
|
3045 |
|
3046 | task.next = task.previous = null;
|
3047 | }
|
3048 |
|
3049 | function unstable_getCurrentPriorityLevel() {
|
3050 | return currentPriorityLevel;
|
3051 | }
|
3052 |
|
3053 | function unstable_shouldYield() {
|
3054 | var currentTime = getCurrentTime();
|
3055 | advanceTimers(currentTime);
|
3056 | return currentTask !== null && firstTask !== null && firstTask.startTime <= currentTime && firstTask.expirationTime < currentTask.expirationTime || shouldYieldToHost();
|
3057 | }
|
3058 |
|
3059 | var unstable_requestPaint = requestPaint;
|
3060 |
|
3061 |
|
3062 |
|
3063 | var Scheduler = Object.freeze({
|
3064 | unstable_ImmediatePriority: ImmediatePriority,
|
3065 | unstable_UserBlockingPriority: UserBlockingPriority,
|
3066 | unstable_NormalPriority: NormalPriority,
|
3067 | unstable_IdlePriority: IdlePriority,
|
3068 | unstable_LowPriority: LowPriority,
|
3069 | unstable_runWithPriority: unstable_runWithPriority,
|
3070 | unstable_next: unstable_next,
|
3071 | unstable_scheduleCallback: unstable_scheduleCallback,
|
3072 | unstable_cancelCallback: unstable_cancelCallback,
|
3073 | unstable_wrapCallback: unstable_wrapCallback,
|
3074 | unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel,
|
3075 | unstable_shouldYield: unstable_shouldYield,
|
3076 | unstable_requestPaint: unstable_requestPaint,
|
3077 | unstable_continueExecution: unstable_continueExecution,
|
3078 | unstable_pauseExecution: unstable_pauseExecution,
|
3079 | unstable_getFirstCallbackNode: unstable_getFirstCallbackNode,
|
3080 | get unstable_now () { return getCurrentTime; },
|
3081 | get unstable_forceFrameRate () { return forceFrameRate; }
|
3082 | });
|
3083 |
|
3084 |
|
3085 |
|
3086 |
|
3087 |
|
3088 |
|
3089 |
|
3090 |
|
3091 |
|
3092 |
|
3093 |
|
3094 |
|
3095 |
|
3096 |
|
3097 |
|
3098 |
|
3099 |
|
3100 |
|
3101 |
|
3102 |
|
3103 |
|
3104 | var enableSchedulerTracing = true;
|
3105 |
|
3106 |
|
3107 |
|
3108 |
|
3109 |
|
3110 |
|
3111 |
|
3112 |
|
3113 |
|
3114 |
|
3115 |
|
3116 |
|
3117 |
|
3118 |
|
3119 |
|
3120 |
|
3121 |
|
3122 |
|
3123 |
|
3124 |
|
3125 |
|
3126 |
|
3127 |
|
3128 |
|
3129 |
|
3130 |
|
3131 |
|
3132 |
|
3133 | var enableFlareAPI = false;
|
3134 |
|
3135 |
|
3136 | var enableFundamentalAPI = false;
|
3137 |
|
3138 |
|
3139 | var enableJSXTransformAPI = false;
|
3140 |
|
3141 |
|
3142 |
|
3143 |
|
3144 |
|
3145 |
|
3146 |
|
3147 |
|
3148 |
|
3149 |
|
3150 |
|
3151 |
|
3152 |
|
3153 |
|
3154 |
|
3155 |
|
3156 |
|
3157 |
|
3158 |
|
3159 |
|
3160 |
|
3161 |
|
3162 |
|
3163 |
|
3164 |
|
3165 | var DEFAULT_THREAD_ID = 0;
|
3166 |
|
3167 |
|
3168 | var interactionIDCounter = 0;
|
3169 | var threadIDCounter = 0;
|
3170 |
|
3171 |
|
3172 |
|
3173 |
|
3174 |
|
3175 | var interactionsRef = null;
|
3176 |
|
3177 |
|
3178 | var subscriberRef = null;
|
3179 |
|
3180 | if (enableSchedulerTracing) {
|
3181 | interactionsRef = {
|
3182 | current: new Set()
|
3183 | };
|
3184 | subscriberRef = {
|
3185 | current: null
|
3186 | };
|
3187 | }
|
3188 |
|
3189 | function unstable_clear(callback) {
|
3190 | if (!enableSchedulerTracing) {
|
3191 | return callback();
|
3192 | }
|
3193 |
|
3194 | var prevInteractions = interactionsRef.current;
|
3195 | interactionsRef.current = new Set();
|
3196 |
|
3197 | try {
|
3198 | return callback();
|
3199 | } finally {
|
3200 | interactionsRef.current = prevInteractions;
|
3201 | }
|
3202 | }
|
3203 |
|
3204 | function unstable_getCurrent() {
|
3205 | if (!enableSchedulerTracing) {
|
3206 | return null;
|
3207 | } else {
|
3208 | return interactionsRef.current;
|
3209 | }
|
3210 | }
|
3211 |
|
3212 | function unstable_getThreadID() {
|
3213 | return ++threadIDCounter;
|
3214 | }
|
3215 |
|
3216 | function unstable_trace(name, timestamp, callback) {
|
3217 | var threadID = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THREAD_ID;
|
3218 |
|
3219 | if (!enableSchedulerTracing) {
|
3220 | return callback();
|
3221 | }
|
3222 |
|
3223 | var interaction = {
|
3224 | __count: 1,
|
3225 | id: interactionIDCounter++,
|
3226 | name: name,
|
3227 | timestamp: timestamp
|
3228 | };
|
3229 |
|
3230 | var prevInteractions = interactionsRef.current;
|
3231 |
|
3232 |
|
3233 |
|
3234 |
|
3235 | var interactions = new Set(prevInteractions);
|
3236 | interactions.add(interaction);
|
3237 | interactionsRef.current = interactions;
|
3238 |
|
3239 | var subscriber = subscriberRef.current;
|
3240 | var returnValue = void 0;
|
3241 |
|
3242 | try {
|
3243 | if (subscriber !== null) {
|
3244 | subscriber.onInteractionTraced(interaction);
|
3245 | }
|
3246 | } finally {
|
3247 | try {
|
3248 | if (subscriber !== null) {
|
3249 | subscriber.onWorkStarted(interactions, threadID);
|
3250 | }
|
3251 | } finally {
|
3252 | try {
|
3253 | returnValue = callback();
|
3254 | } finally {
|
3255 | interactionsRef.current = prevInteractions;
|
3256 |
|
3257 | try {
|
3258 | if (subscriber !== null) {
|
3259 | subscriber.onWorkStopped(interactions, threadID);
|
3260 | }
|
3261 | } finally {
|
3262 | interaction.__count--;
|
3263 |
|
3264 |
|
3265 |
|
3266 | if (subscriber !== null && interaction.__count === 0) {
|
3267 | subscriber.onInteractionScheduledWorkCompleted(interaction);
|
3268 | }
|
3269 | }
|
3270 | }
|
3271 | }
|
3272 | }
|
3273 |
|
3274 | return returnValue;
|
3275 | }
|
3276 |
|
3277 | function unstable_wrap(callback) {
|
3278 | var threadID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_THREAD_ID;
|
3279 |
|
3280 | if (!enableSchedulerTracing) {
|
3281 | return callback;
|
3282 | }
|
3283 |
|
3284 | var wrappedInteractions = interactionsRef.current;
|
3285 |
|
3286 | var subscriber = subscriberRef.current;
|
3287 | if (subscriber !== null) {
|
3288 | subscriber.onWorkScheduled(wrappedInteractions, threadID);
|
3289 | }
|
3290 |
|
3291 |
|
3292 |
|
3293 | wrappedInteractions.forEach(function (interaction) {
|
3294 | interaction.__count++;
|
3295 | });
|
3296 |
|
3297 | var hasRun = false;
|
3298 |
|
3299 | function wrapped() {
|
3300 | var prevInteractions = interactionsRef.current;
|
3301 | interactionsRef.current = wrappedInteractions;
|
3302 |
|
3303 | subscriber = subscriberRef.current;
|
3304 |
|
3305 | try {
|
3306 | var returnValue = void 0;
|
3307 |
|
3308 | try {
|
3309 | if (subscriber !== null) {
|
3310 | subscriber.onWorkStarted(wrappedInteractions, threadID);
|
3311 | }
|
3312 | } finally {
|
3313 | try {
|
3314 | returnValue = callback.apply(undefined, arguments);
|
3315 | } finally {
|
3316 | interactionsRef.current = prevInteractions;
|
3317 |
|
3318 | if (subscriber !== null) {
|
3319 | subscriber.onWorkStopped(wrappedInteractions, threadID);
|
3320 | }
|
3321 | }
|
3322 | }
|
3323 |
|
3324 | return returnValue;
|
3325 | } finally {
|
3326 | if (!hasRun) {
|
3327 |
|
3328 |
|
3329 |
|
3330 | hasRun = true;
|
3331 |
|
3332 |
|
3333 |
|
3334 |
|
3335 | wrappedInteractions.forEach(function (interaction) {
|
3336 | interaction.__count--;
|
3337 |
|
3338 | if (subscriber !== null && interaction.__count === 0) {
|
3339 | subscriber.onInteractionScheduledWorkCompleted(interaction);
|
3340 | }
|
3341 | });
|
3342 | }
|
3343 | }
|
3344 | }
|
3345 |
|
3346 | wrapped.cancel = function cancel() {
|
3347 | subscriber = subscriberRef.current;
|
3348 |
|
3349 | try {
|
3350 | if (subscriber !== null) {
|
3351 | subscriber.onWorkCanceled(wrappedInteractions, threadID);
|
3352 | }
|
3353 | } finally {
|
3354 |
|
3355 |
|
3356 |
|
3357 | wrappedInteractions.forEach(function (interaction) {
|
3358 | interaction.__count--;
|
3359 |
|
3360 | if (subscriber && interaction.__count === 0) {
|
3361 | subscriber.onInteractionScheduledWorkCompleted(interaction);
|
3362 | }
|
3363 | });
|
3364 | }
|
3365 | };
|
3366 |
|
3367 | return wrapped;
|
3368 | }
|
3369 |
|
3370 | var subscribers = null;
|
3371 | if (enableSchedulerTracing) {
|
3372 | subscribers = new Set();
|
3373 | }
|
3374 |
|
3375 | function unstable_subscribe(subscriber) {
|
3376 | if (enableSchedulerTracing) {
|
3377 | subscribers.add(subscriber);
|
3378 |
|
3379 | if (subscribers.size === 1) {
|
3380 | subscriberRef.current = {
|
3381 | onInteractionScheduledWorkCompleted: onInteractionScheduledWorkCompleted,
|
3382 | onInteractionTraced: onInteractionTraced,
|
3383 | onWorkCanceled: onWorkCanceled,
|
3384 | onWorkScheduled: onWorkScheduled,
|
3385 | onWorkStarted: onWorkStarted,
|
3386 | onWorkStopped: onWorkStopped
|
3387 | };
|
3388 | }
|
3389 | }
|
3390 | }
|
3391 |
|
3392 | function unstable_unsubscribe(subscriber) {
|
3393 | if (enableSchedulerTracing) {
|
3394 | subscribers.delete(subscriber);
|
3395 |
|
3396 | if (subscribers.size === 0) {
|
3397 | subscriberRef.current = null;
|
3398 | }
|
3399 | }
|
3400 | }
|
3401 |
|
3402 | function onInteractionTraced(interaction) {
|
3403 | var didCatchError = false;
|
3404 | var caughtError = null;
|
3405 |
|
3406 | subscribers.forEach(function (subscriber) {
|
3407 | try {
|
3408 | subscriber.onInteractionTraced(interaction);
|
3409 | } catch (error) {
|
3410 | if (!didCatchError) {
|
3411 | didCatchError = true;
|
3412 | caughtError = error;
|
3413 | }
|
3414 | }
|
3415 | });
|
3416 |
|
3417 | if (didCatchError) {
|
3418 | throw caughtError;
|
3419 | }
|
3420 | }
|
3421 |
|
3422 | function onInteractionScheduledWorkCompleted(interaction) {
|
3423 | var didCatchError = false;
|
3424 | var caughtError = null;
|
3425 |
|
3426 | subscribers.forEach(function (subscriber) {
|
3427 | try {
|
3428 | subscriber.onInteractionScheduledWorkCompleted(interaction);
|
3429 | } catch (error) {
|
3430 | if (!didCatchError) {
|
3431 | didCatchError = true;
|
3432 | caughtError = error;
|
3433 | }
|
3434 | }
|
3435 | });
|
3436 |
|
3437 | if (didCatchError) {
|
3438 | throw caughtError;
|
3439 | }
|
3440 | }
|
3441 |
|
3442 | function onWorkScheduled(interactions, threadID) {
|
3443 | var didCatchError = false;
|
3444 | var caughtError = null;
|
3445 |
|
3446 | subscribers.forEach(function (subscriber) {
|
3447 | try {
|
3448 | subscriber.onWorkScheduled(interactions, threadID);
|
3449 | } catch (error) {
|
3450 | if (!didCatchError) {
|
3451 | didCatchError = true;
|
3452 | caughtError = error;
|
3453 | }
|
3454 | }
|
3455 | });
|
3456 |
|
3457 | if (didCatchError) {
|
3458 | throw caughtError;
|
3459 | }
|
3460 | }
|
3461 |
|
3462 | function onWorkStarted(interactions, threadID) {
|
3463 | var didCatchError = false;
|
3464 | var caughtError = null;
|
3465 |
|
3466 | subscribers.forEach(function (subscriber) {
|
3467 | try {
|
3468 | subscriber.onWorkStarted(interactions, threadID);
|
3469 | } catch (error) {
|
3470 | if (!didCatchError) {
|
3471 | didCatchError = true;
|
3472 | caughtError = error;
|
3473 | }
|
3474 | }
|
3475 | });
|
3476 |
|
3477 | if (didCatchError) {
|
3478 | throw caughtError;
|
3479 | }
|
3480 | }
|
3481 |
|
3482 | function onWorkStopped(interactions, threadID) {
|
3483 | var didCatchError = false;
|
3484 | var caughtError = null;
|
3485 |
|
3486 | subscribers.forEach(function (subscriber) {
|
3487 | try {
|
3488 | subscriber.onWorkStopped(interactions, threadID);
|
3489 | } catch (error) {
|
3490 | if (!didCatchError) {
|
3491 | didCatchError = true;
|
3492 | caughtError = error;
|
3493 | }
|
3494 | }
|
3495 | });
|
3496 |
|
3497 | if (didCatchError) {
|
3498 | throw caughtError;
|
3499 | }
|
3500 | }
|
3501 |
|
3502 | function onWorkCanceled(interactions, threadID) {
|
3503 | var didCatchError = false;
|
3504 | var caughtError = null;
|
3505 |
|
3506 | subscribers.forEach(function (subscriber) {
|
3507 | try {
|
3508 | subscriber.onWorkCanceled(interactions, threadID);
|
3509 | } catch (error) {
|
3510 | if (!didCatchError) {
|
3511 | didCatchError = true;
|
3512 | caughtError = error;
|
3513 | }
|
3514 | }
|
3515 | });
|
3516 |
|
3517 | if (didCatchError) {
|
3518 | throw caughtError;
|
3519 | }
|
3520 | }
|
3521 |
|
3522 |
|
3523 |
|
3524 | var SchedulerTracing = Object.freeze({
|
3525 | get __interactionsRef () { return interactionsRef; },
|
3526 | get __subscriberRef () { return subscriberRef; },
|
3527 | unstable_clear: unstable_clear,
|
3528 | unstable_getCurrent: unstable_getCurrent,
|
3529 | unstable_getThreadID: unstable_getThreadID,
|
3530 | unstable_trace: unstable_trace,
|
3531 | unstable_wrap: unstable_wrap,
|
3532 | unstable_subscribe: unstable_subscribe,
|
3533 | unstable_unsubscribe: unstable_unsubscribe
|
3534 | });
|
3535 |
|
3536 | var ReactSharedInternals$2 = {
|
3537 | ReactCurrentDispatcher: ReactCurrentDispatcher,
|
3538 | ReactCurrentOwner: ReactCurrentOwner,
|
3539 | IsSomeRendererActing: IsSomeRendererActing,
|
3540 |
|
3541 | assign: objectAssign
|
3542 | };
|
3543 |
|
3544 | {
|
3545 | objectAssign(ReactSharedInternals$2, {
|
3546 |
|
3547 | ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
3548 |
|
3549 |
|
3550 | ReactComponentTreeHook: {}
|
3551 | });
|
3552 | }
|
3553 |
|
3554 |
|
3555 |
|
3556 |
|
3557 |
|
3558 |
|
3559 | objectAssign(ReactSharedInternals$2, {
|
3560 | Scheduler: Scheduler,
|
3561 | SchedulerTracing: SchedulerTracing
|
3562 | });
|
3563 |
|
3564 | var hasBadMapPolyfill = void 0;
|
3565 |
|
3566 | {
|
3567 | hasBadMapPolyfill = false;
|
3568 | try {
|
3569 | var frozenObject = Object.freeze({});
|
3570 | var testMap = new Map([[frozenObject, null]]);
|
3571 | var testSet = new Set([frozenObject]);
|
3572 |
|
3573 |
|
3574 |
|
3575 | testMap.set(0, 0);
|
3576 | testSet.add(0);
|
3577 | } catch (e) {
|
3578 |
|
3579 | hasBadMapPolyfill = true;
|
3580 | }
|
3581 | }
|
3582 |
|
3583 | function createFundamentalComponent(impl) {
|
3584 |
|
3585 |
|
3586 |
|
3587 | if (true && !hasBadMapPolyfill) {
|
3588 | Object.freeze(impl);
|
3589 | }
|
3590 | var fundamantalComponent = {
|
3591 | $$typeof: REACT_FUNDAMENTAL_TYPE,
|
3592 | impl: impl
|
3593 | };
|
3594 | {
|
3595 | Object.freeze(fundamantalComponent);
|
3596 | }
|
3597 | return fundamantalComponent;
|
3598 | }
|
3599 |
|
3600 | function createEventResponder(displayName, responderConfig) {
|
3601 | var getInitialState = responderConfig.getInitialState,
|
3602 | onEvent = responderConfig.onEvent,
|
3603 | onMount = responderConfig.onMount,
|
3604 | onUnmount = responderConfig.onUnmount,
|
3605 | onOwnershipChange = responderConfig.onOwnershipChange,
|
3606 | onRootEvent = responderConfig.onRootEvent,
|
3607 | rootEventTypes = responderConfig.rootEventTypes,
|
3608 | targetEventTypes = responderConfig.targetEventTypes;
|
3609 |
|
3610 | var eventResponder = {
|
3611 | $$typeof: REACT_RESPONDER_TYPE,
|
3612 | displayName: displayName,
|
3613 | getInitialState: getInitialState || null,
|
3614 | onEvent: onEvent || null,
|
3615 | onMount: onMount || null,
|
3616 | onOwnershipChange: onOwnershipChange || null,
|
3617 | onRootEvent: onRootEvent || null,
|
3618 | onUnmount: onUnmount || null,
|
3619 | rootEventTypes: rootEventTypes || null,
|
3620 | targetEventTypes: targetEventTypes || null
|
3621 | };
|
3622 |
|
3623 |
|
3624 |
|
3625 | if (true && !hasBadMapPolyfill) {
|
3626 | Object.freeze(eventResponder);
|
3627 | }
|
3628 | return eventResponder;
|
3629 | }
|
3630 |
|
3631 | var React = {
|
3632 | Children: {
|
3633 | map: mapChildren,
|
3634 | forEach: forEachChildren,
|
3635 | count: countChildren,
|
3636 | toArray: toArray,
|
3637 | only: onlyChild
|
3638 | },
|
3639 |
|
3640 | createRef: createRef,
|
3641 | Component: Component,
|
3642 | PureComponent: PureComponent,
|
3643 |
|
3644 | createContext: createContext,
|
3645 | forwardRef: forwardRef,
|
3646 | lazy: lazy,
|
3647 | memo: memo,
|
3648 |
|
3649 | useCallback: useCallback,
|
3650 | useContext: useContext,
|
3651 | useEffect: useEffect,
|
3652 | useImperativeHandle: useImperativeHandle,
|
3653 | useDebugValue: useDebugValue,
|
3654 | useLayoutEffect: useLayoutEffect,
|
3655 | useMemo: useMemo,
|
3656 | useReducer: useReducer,
|
3657 | useRef: useRef,
|
3658 | useState: useState,
|
3659 |
|
3660 | Fragment: REACT_FRAGMENT_TYPE,
|
3661 | Profiler: REACT_PROFILER_TYPE,
|
3662 | StrictMode: REACT_STRICT_MODE_TYPE,
|
3663 | Suspense: REACT_SUSPENSE_TYPE,
|
3664 | unstable_SuspenseList: REACT_SUSPENSE_LIST_TYPE,
|
3665 |
|
3666 | createElement: createElementWithValidation,
|
3667 | cloneElement: cloneElementWithValidation,
|
3668 | createFactory: createFactoryWithValidation,
|
3669 | isValidElement: isValidElement,
|
3670 |
|
3671 | version: ReactVersion,
|
3672 |
|
3673 | unstable_withSuspenseConfig: withSuspenseConfig,
|
3674 |
|
3675 | __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals$2
|
3676 | };
|
3677 |
|
3678 | if (enableFlareAPI) {
|
3679 | React.unstable_useResponder = useResponder;
|
3680 | React.unstable_createResponder = createEventResponder;
|
3681 | }
|
3682 |
|
3683 | if (enableFundamentalAPI) {
|
3684 | React.unstable_createFundamental = createFundamentalComponent;
|
3685 | }
|
3686 |
|
3687 |
|
3688 |
|
3689 |
|
3690 |
|
3691 |
|
3692 | if (enableJSXTransformAPI) {
|
3693 | {
|
3694 | React.jsxDEV = jsxWithValidation;
|
3695 | React.jsx = jsxWithValidationDynamic;
|
3696 | React.jsxs = jsxWithValidationStatic;
|
3697 | }
|
3698 | }
|
3699 |
|
3700 |
|
3701 |
|
3702 | var React$2 = Object.freeze({
|
3703 | default: React
|
3704 | });
|
3705 |
|
3706 | var React$3 = ( React$2 && React ) || React$2;
|
3707 |
|
3708 |
|
3709 |
|
3710 | var react = React$3.default || React$3;
|
3711 |
|
3712 | return react;
|
3713 |
|
3714 | })));
|