1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | 'use strict';
|
12 |
|
13 | if (process.env.NODE_ENV !== "production") {
|
14 | (function() {
|
15 | 'use strict';
|
16 |
|
17 | var React = require('react');
|
18 |
|
19 | var ReactVersion = '18.2.0';
|
20 |
|
21 | var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | function warn(format) {
|
29 | {
|
30 | {
|
31 | for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
32 | args[_key - 1] = arguments[_key];
|
33 | }
|
34 |
|
35 | printWarning('warn', format, args);
|
36 | }
|
37 | }
|
38 | }
|
39 | function error(format) {
|
40 | {
|
41 | {
|
42 | for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
43 | args[_key2 - 1] = arguments[_key2];
|
44 | }
|
45 |
|
46 | printWarning('error', format, args);
|
47 | }
|
48 | }
|
49 | }
|
50 |
|
51 | function printWarning(level, format, args) {
|
52 |
|
53 |
|
54 | {
|
55 | var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
56 | var stack = ReactDebugCurrentFrame.getStackAddendum();
|
57 |
|
58 | if (stack !== '') {
|
59 | format += '%s';
|
60 | args = args.concat([stack]);
|
61 | }
|
62 |
|
63 |
|
64 | var argsWithFormat = args.map(function (item) {
|
65 | return String(item);
|
66 | });
|
67 |
|
68 | argsWithFormat.unshift('Warning: ' + format);
|
69 |
|
70 |
|
71 |
|
72 | Function.prototype.apply.call(console[level], console, argsWithFormat);
|
73 | }
|
74 | }
|
75 |
|
76 | function scheduleWork(callback) {
|
77 | callback();
|
78 | }
|
79 | var VIEW_SIZE = 512;
|
80 | var currentView = null;
|
81 | var writtenBytes = 0;
|
82 | function beginWriting(destination) {
|
83 | currentView = new Uint8Array(VIEW_SIZE);
|
84 | writtenBytes = 0;
|
85 | }
|
86 | function writeChunk(destination, chunk) {
|
87 | if (chunk.length === 0) {
|
88 | return;
|
89 | }
|
90 |
|
91 | if (chunk.length > VIEW_SIZE) {
|
92 |
|
93 |
|
94 |
|
95 | if (writtenBytes > 0) {
|
96 | destination.enqueue(new Uint8Array(currentView.buffer, 0, writtenBytes));
|
97 | currentView = new Uint8Array(VIEW_SIZE);
|
98 | writtenBytes = 0;
|
99 | }
|
100 |
|
101 | destination.enqueue(chunk);
|
102 | return;
|
103 | }
|
104 |
|
105 | var bytesToWrite = chunk;
|
106 | var allowableBytes = currentView.length - writtenBytes;
|
107 |
|
108 | if (allowableBytes < bytesToWrite.length) {
|
109 |
|
110 |
|
111 | if (allowableBytes === 0) {
|
112 |
|
113 | destination.enqueue(currentView);
|
114 | } else {
|
115 |
|
116 |
|
117 | currentView.set(bytesToWrite.subarray(0, allowableBytes), writtenBytes);
|
118 |
|
119 | destination.enqueue(currentView);
|
120 | bytesToWrite = bytesToWrite.subarray(allowableBytes);
|
121 | }
|
122 |
|
123 | currentView = new Uint8Array(VIEW_SIZE);
|
124 | writtenBytes = 0;
|
125 | }
|
126 |
|
127 | currentView.set(bytesToWrite, writtenBytes);
|
128 | writtenBytes += bytesToWrite.length;
|
129 | }
|
130 | function writeChunkAndReturn(destination, chunk) {
|
131 | writeChunk(destination, chunk);
|
132 |
|
133 | return true;
|
134 | }
|
135 | function completeWriting(destination) {
|
136 | if (currentView && writtenBytes > 0) {
|
137 | destination.enqueue(new Uint8Array(currentView.buffer, 0, writtenBytes));
|
138 | currentView = null;
|
139 | writtenBytes = 0;
|
140 | }
|
141 | }
|
142 | function close(destination) {
|
143 | destination.close();
|
144 | }
|
145 | var textEncoder = new TextEncoder();
|
146 | function stringToChunk(content) {
|
147 | return textEncoder.encode(content);
|
148 | }
|
149 | function stringToPrecomputedChunk(content) {
|
150 | return textEncoder.encode(content);
|
151 | }
|
152 | function closeWithError(destination, error) {
|
153 | if (typeof destination.error === 'function') {
|
154 |
|
155 | destination.error(error);
|
156 | } else {
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 | destination.close();
|
164 | }
|
165 | }
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 | function typeName(value) {
|
178 | {
|
179 |
|
180 | var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
181 | var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
182 | return type;
|
183 | }
|
184 | }
|
185 |
|
186 |
|
187 | function willCoercionThrow(value) {
|
188 | {
|
189 | try {
|
190 | testStringCoercion(value);
|
191 | return false;
|
192 | } catch (e) {
|
193 | return true;
|
194 | }
|
195 | }
|
196 | }
|
197 |
|
198 | function testStringCoercion(value) {
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 |
|
221 |
|
222 | return '' + value;
|
223 | }
|
224 |
|
225 | function checkAttributeStringCoercion(value, attributeName) {
|
226 | {
|
227 | if (willCoercionThrow(value)) {
|
228 | error('The provided `%s` attribute is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', attributeName, typeName(value));
|
229 |
|
230 | return testStringCoercion(value);
|
231 | }
|
232 | }
|
233 | }
|
234 | function checkCSSPropertyStringCoercion(value, propName) {
|
235 | {
|
236 | if (willCoercionThrow(value)) {
|
237 | error('The provided `%s` CSS property is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', propName, typeName(value));
|
238 |
|
239 | return testStringCoercion(value);
|
240 | }
|
241 | }
|
242 | }
|
243 | function checkHtmlStringCoercion(value) {
|
244 | {
|
245 | if (willCoercionThrow(value)) {
|
246 | error('The provided HTML markup uses a value of unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
247 |
|
248 | return testStringCoercion(value);
|
249 | }
|
250 | }
|
251 | }
|
252 |
|
253 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
254 |
|
255 |
|
256 |
|
257 | var RESERVED = 0;
|
258 |
|
259 |
|
260 | var STRING = 1;
|
261 |
|
262 |
|
263 |
|
264 |
|
265 | var BOOLEANISH_STRING = 2;
|
266 |
|
267 |
|
268 |
|
269 | var BOOLEAN = 3;
|
270 |
|
271 |
|
272 |
|
273 |
|
274 | var OVERLOADED_BOOLEAN = 4;
|
275 |
|
276 |
|
277 | var NUMERIC = 5;
|
278 |
|
279 |
|
280 | var POSITIVE_NUMERIC = 6;
|
281 |
|
282 |
|
283 | var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
|
284 |
|
285 |
|
286 | var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
287 | var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
288 | var illegalAttributeNameCache = {};
|
289 | var validatedAttributeNameCache = {};
|
290 | function isAttributeNameSafe(attributeName) {
|
291 | if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
|
292 | return true;
|
293 | }
|
294 |
|
295 | if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) {
|
296 | return false;
|
297 | }
|
298 |
|
299 | if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
|
300 | validatedAttributeNameCache[attributeName] = true;
|
301 | return true;
|
302 | }
|
303 |
|
304 | illegalAttributeNameCache[attributeName] = true;
|
305 |
|
306 | {
|
307 | error('Invalid attribute name: `%s`', attributeName);
|
308 | }
|
309 |
|
310 | return false;
|
311 | }
|
312 | function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
|
313 | if (propertyInfo !== null && propertyInfo.type === RESERVED) {
|
314 | return false;
|
315 | }
|
316 |
|
317 | switch (typeof value) {
|
318 | case 'function':
|
319 |
|
320 | case 'symbol':
|
321 |
|
322 | return true;
|
323 |
|
324 | case 'boolean':
|
325 | {
|
326 | if (isCustomComponentTag) {
|
327 | return false;
|
328 | }
|
329 |
|
330 | if (propertyInfo !== null) {
|
331 | return !propertyInfo.acceptsBooleans;
|
332 | } else {
|
333 | var prefix = name.toLowerCase().slice(0, 5);
|
334 | return prefix !== 'data-' && prefix !== 'aria-';
|
335 | }
|
336 | }
|
337 |
|
338 | default:
|
339 | return false;
|
340 | }
|
341 | }
|
342 | function getPropertyInfo(name) {
|
343 | return properties.hasOwnProperty(name) ? properties[name] : null;
|
344 | }
|
345 |
|
346 | function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL, removeEmptyString) {
|
347 | this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
|
348 | this.attributeName = attributeName;
|
349 | this.attributeNamespace = attributeNamespace;
|
350 | this.mustUseProperty = mustUseProperty;
|
351 | this.propertyName = name;
|
352 | this.type = type;
|
353 | this.sanitizeURL = sanitizeURL;
|
354 | this.removeEmptyString = removeEmptyString;
|
355 | }
|
356 |
|
357 |
|
358 |
|
359 |
|
360 | var properties = {};
|
361 |
|
362 | var reservedProps = ['children', 'dangerouslySetInnerHTML',
|
363 |
|
364 |
|
365 | 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'];
|
366 |
|
367 | reservedProps.forEach(function (name) {
|
368 | properties[name] = new PropertyInfoRecord(name, RESERVED, false,
|
369 | name,
|
370 | null,
|
371 | false,
|
372 | false);
|
373 | });
|
374 |
|
375 |
|
376 | [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
|
377 | var name = _ref[0],
|
378 | attributeName = _ref[1];
|
379 | properties[name] = new PropertyInfoRecord(name, STRING, false,
|
380 | attributeName,
|
381 | null,
|
382 | false,
|
383 | false);
|
384 | });
|
385 |
|
386 |
|
387 |
|
388 | ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
|
389 | properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false,
|
390 | name.toLowerCase(),
|
391 | null,
|
392 | false,
|
393 | false);
|
394 | });
|
395 |
|
396 |
|
397 |
|
398 |
|
399 | ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
|
400 | properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false,
|
401 | name,
|
402 | null,
|
403 | false,
|
404 | false);
|
405 | });
|
406 |
|
407 | ['allowFullScreen', 'async',
|
408 |
|
409 | 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'disableRemotePlayback', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless',
|
410 | 'itemScope'].forEach(function (name) {
|
411 | properties[name] = new PropertyInfoRecord(name, BOOLEAN, false,
|
412 | name.toLowerCase(),
|
413 | null,
|
414 | false,
|
415 | false);
|
416 | });
|
417 |
|
418 |
|
419 | ['checked',
|
420 |
|
421 | 'multiple', 'muted', 'selected'
|
422 |
|
423 |
|
424 | ].forEach(function (name) {
|
425 | properties[name] = new PropertyInfoRecord(name, BOOLEAN, true,
|
426 | name,
|
427 | null,
|
428 | false,
|
429 | false);
|
430 | });
|
431 |
|
432 |
|
433 | ['capture', 'download'
|
434 |
|
435 |
|
436 | ].forEach(function (name) {
|
437 | properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false,
|
438 | name,
|
439 | null,
|
440 | false,
|
441 | false);
|
442 | });
|
443 |
|
444 | ['cols', 'rows', 'size', 'span'
|
445 |
|
446 |
|
447 | ].forEach(function (name) {
|
448 | properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false,
|
449 | name,
|
450 | null,
|
451 | false,
|
452 | false);
|
453 | });
|
454 |
|
455 | ['rowSpan', 'start'].forEach(function (name) {
|
456 | properties[name] = new PropertyInfoRecord(name, NUMERIC, false,
|
457 | name.toLowerCase(),
|
458 | null,
|
459 | false,
|
460 | false);
|
461 | });
|
462 | var CAMELIZE = /[\-\:]([a-z])/g;
|
463 |
|
464 | var capitalize = function (token) {
|
465 | return token[1].toUpperCase();
|
466 | };
|
467 |
|
468 |
|
469 |
|
470 |
|
471 |
|
472 |
|
473 | ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height'
|
474 |
|
475 |
|
476 | ].forEach(function (attributeName) {
|
477 | var name = attributeName.replace(CAMELIZE, capitalize);
|
478 | properties[name] = new PropertyInfoRecord(name, STRING, false,
|
479 | attributeName, null,
|
480 | false,
|
481 | false);
|
482 | });
|
483 |
|
484 | ['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'
|
485 |
|
486 |
|
487 | ].forEach(function (attributeName) {
|
488 | var name = attributeName.replace(CAMELIZE, capitalize);
|
489 | properties[name] = new PropertyInfoRecord(name, STRING, false,
|
490 | attributeName, 'http://www.w3.org/1999/xlink', false,
|
491 | false);
|
492 | });
|
493 |
|
494 | ['xml:base', 'xml:lang', 'xml:space'
|
495 |
|
496 |
|
497 | ].forEach(function (attributeName) {
|
498 | var name = attributeName.replace(CAMELIZE, capitalize);
|
499 | properties[name] = new PropertyInfoRecord(name, STRING, false,
|
500 | attributeName, 'http://www.w3.org/XML/1998/namespace', false,
|
501 | false);
|
502 | });
|
503 |
|
504 |
|
505 |
|
506 | ['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
|
507 | properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false,
|
508 | attributeName.toLowerCase(),
|
509 | null,
|
510 | false,
|
511 | false);
|
512 | });
|
513 |
|
514 |
|
515 | var xlinkHref = 'xlinkHref';
|
516 | properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false,
|
517 | 'xlink:href', 'http://www.w3.org/1999/xlink', true,
|
518 | false);
|
519 | ['src', 'href', 'action', 'formAction'].forEach(function (attributeName) {
|
520 | properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false,
|
521 | attributeName.toLowerCase(),
|
522 | null,
|
523 | true,
|
524 | true);
|
525 | });
|
526 |
|
527 |
|
528 |
|
529 |
|
530 | var isUnitlessNumber = {
|
531 | animationIterationCount: true,
|
532 | aspectRatio: true,
|
533 | borderImageOutset: true,
|
534 | borderImageSlice: true,
|
535 | borderImageWidth: true,
|
536 | boxFlex: true,
|
537 | boxFlexGroup: true,
|
538 | boxOrdinalGroup: true,
|
539 | columnCount: true,
|
540 | columns: true,
|
541 | flex: true,
|
542 | flexGrow: true,
|
543 | flexPositive: true,
|
544 | flexShrink: true,
|
545 | flexNegative: true,
|
546 | flexOrder: true,
|
547 | gridArea: true,
|
548 | gridRow: true,
|
549 | gridRowEnd: true,
|
550 | gridRowSpan: true,
|
551 | gridRowStart: true,
|
552 | gridColumn: true,
|
553 | gridColumnEnd: true,
|
554 | gridColumnSpan: true,
|
555 | gridColumnStart: true,
|
556 | fontWeight: true,
|
557 | lineClamp: true,
|
558 | lineHeight: true,
|
559 | opacity: true,
|
560 | order: true,
|
561 | orphans: true,
|
562 | tabSize: true,
|
563 | widows: true,
|
564 | zIndex: true,
|
565 | zoom: true,
|
566 |
|
567 | fillOpacity: true,
|
568 | floodOpacity: true,
|
569 | stopOpacity: true,
|
570 | strokeDasharray: true,
|
571 | strokeDashoffset: true,
|
572 | strokeMiterlimit: true,
|
573 | strokeOpacity: true,
|
574 | strokeWidth: true
|
575 | };
|
576 |
|
577 |
|
578 |
|
579 |
|
580 |
|
581 |
|
582 |
|
583 | function prefixKey(prefix, key) {
|
584 | return prefix + key.charAt(0).toUpperCase() + key.substring(1);
|
585 | }
|
586 |
|
587 |
|
588 |
|
589 |
|
590 |
|
591 |
|
592 | var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
|
593 |
|
594 |
|
595 | Object.keys(isUnitlessNumber).forEach(function (prop) {
|
596 | prefixes.forEach(function (prefix) {
|
597 | isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
|
598 | });
|
599 | });
|
600 |
|
601 | var hasReadOnlyValue = {
|
602 | button: true,
|
603 | checkbox: true,
|
604 | image: true,
|
605 | hidden: true,
|
606 | radio: true,
|
607 | reset: true,
|
608 | submit: true
|
609 | };
|
610 | function checkControlledValueProps(tagName, props) {
|
611 | {
|
612 | if (!(hasReadOnlyValue[props.type] || props.onChange || props.onInput || props.readOnly || props.disabled || props.value == null)) {
|
613 | error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
|
614 | }
|
615 |
|
616 | if (!(props.onChange || props.readOnly || props.disabled || props.checked == null)) {
|
617 | error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
|
618 | }
|
619 | }
|
620 | }
|
621 |
|
622 | function isCustomComponent(tagName, props) {
|
623 | if (tagName.indexOf('-') === -1) {
|
624 | return typeof props.is === 'string';
|
625 | }
|
626 |
|
627 | switch (tagName) {
|
628 |
|
629 |
|
630 |
|
631 |
|
632 | case 'annotation-xml':
|
633 | case 'color-profile':
|
634 | case 'font-face':
|
635 | case 'font-face-src':
|
636 | case 'font-face-uri':
|
637 | case 'font-face-format':
|
638 | case 'font-face-name':
|
639 | case 'missing-glyph':
|
640 | return false;
|
641 |
|
642 | default:
|
643 | return true;
|
644 | }
|
645 | }
|
646 |
|
647 | var ariaProperties = {
|
648 | 'aria-current': 0,
|
649 |
|
650 | 'aria-description': 0,
|
651 | 'aria-details': 0,
|
652 | 'aria-disabled': 0,
|
653 |
|
654 | 'aria-hidden': 0,
|
655 |
|
656 | 'aria-invalid': 0,
|
657 |
|
658 | 'aria-keyshortcuts': 0,
|
659 | 'aria-label': 0,
|
660 | 'aria-roledescription': 0,
|
661 |
|
662 | 'aria-autocomplete': 0,
|
663 | 'aria-checked': 0,
|
664 | 'aria-expanded': 0,
|
665 | 'aria-haspopup': 0,
|
666 | 'aria-level': 0,
|
667 | 'aria-modal': 0,
|
668 | 'aria-multiline': 0,
|
669 | 'aria-multiselectable': 0,
|
670 | 'aria-orientation': 0,
|
671 | 'aria-placeholder': 0,
|
672 | 'aria-pressed': 0,
|
673 | 'aria-readonly': 0,
|
674 | 'aria-required': 0,
|
675 | 'aria-selected': 0,
|
676 | 'aria-sort': 0,
|
677 | 'aria-valuemax': 0,
|
678 | 'aria-valuemin': 0,
|
679 | 'aria-valuenow': 0,
|
680 | 'aria-valuetext': 0,
|
681 |
|
682 | 'aria-atomic': 0,
|
683 | 'aria-busy': 0,
|
684 | 'aria-live': 0,
|
685 | 'aria-relevant': 0,
|
686 |
|
687 | 'aria-dropeffect': 0,
|
688 | 'aria-grabbed': 0,
|
689 |
|
690 | 'aria-activedescendant': 0,
|
691 | 'aria-colcount': 0,
|
692 | 'aria-colindex': 0,
|
693 | 'aria-colspan': 0,
|
694 | 'aria-controls': 0,
|
695 | 'aria-describedby': 0,
|
696 | 'aria-errormessage': 0,
|
697 | 'aria-flowto': 0,
|
698 | 'aria-labelledby': 0,
|
699 | 'aria-owns': 0,
|
700 | 'aria-posinset': 0,
|
701 | 'aria-rowcount': 0,
|
702 | 'aria-rowindex': 0,
|
703 | 'aria-rowspan': 0,
|
704 | 'aria-setsize': 0
|
705 | };
|
706 |
|
707 | var warnedProperties = {};
|
708 | var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
|
709 | var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
710 |
|
711 | function validateProperty(tagName, name) {
|
712 | {
|
713 | if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) {
|
714 | return true;
|
715 | }
|
716 |
|
717 | if (rARIACamel.test(name)) {
|
718 | var ariaName = 'aria-' + name.slice(4).toLowerCase();
|
719 | var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null;
|
720 |
|
721 |
|
722 | if (correctName == null) {
|
723 | error('Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
|
724 |
|
725 | warnedProperties[name] = true;
|
726 | return true;
|
727 | }
|
728 |
|
729 |
|
730 | if (name !== correctName) {
|
731 | error('Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
|
732 |
|
733 | warnedProperties[name] = true;
|
734 | return true;
|
735 | }
|
736 | }
|
737 |
|
738 | if (rARIA.test(name)) {
|
739 | var lowerCasedName = name.toLowerCase();
|
740 | var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null;
|
741 |
|
742 |
|
743 | if (standardName == null) {
|
744 | warnedProperties[name] = true;
|
745 | return false;
|
746 | }
|
747 |
|
748 |
|
749 | if (name !== standardName) {
|
750 | error('Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
|
751 |
|
752 | warnedProperties[name] = true;
|
753 | return true;
|
754 | }
|
755 | }
|
756 | }
|
757 |
|
758 | return true;
|
759 | }
|
760 |
|
761 | function warnInvalidARIAProps(type, props) {
|
762 | {
|
763 | var invalidProps = [];
|
764 |
|
765 | for (var key in props) {
|
766 | var isValid = validateProperty(type, key);
|
767 |
|
768 | if (!isValid) {
|
769 | invalidProps.push(key);
|
770 | }
|
771 | }
|
772 |
|
773 | var unknownPropString = invalidProps.map(function (prop) {
|
774 | return '`' + prop + '`';
|
775 | }).join(', ');
|
776 |
|
777 | if (invalidProps.length === 1) {
|
778 | error('Invalid aria prop %s on <%s> tag. ' + 'For details, see https://reactjs.org/link/invalid-aria-props', unknownPropString, type);
|
779 | } else if (invalidProps.length > 1) {
|
780 | error('Invalid aria props %s on <%s> tag. ' + 'For details, see https://reactjs.org/link/invalid-aria-props', unknownPropString, type);
|
781 | }
|
782 | }
|
783 | }
|
784 |
|
785 | function validateProperties(type, props) {
|
786 | if (isCustomComponent(type, props)) {
|
787 | return;
|
788 | }
|
789 |
|
790 | warnInvalidARIAProps(type, props);
|
791 | }
|
792 |
|
793 | var didWarnValueNull = false;
|
794 | function validateProperties$1(type, props) {
|
795 | {
|
796 | if (type !== 'input' && type !== 'textarea' && type !== 'select') {
|
797 | return;
|
798 | }
|
799 |
|
800 | if (props != null && props.value === null && !didWarnValueNull) {
|
801 | didWarnValueNull = true;
|
802 |
|
803 | if (type === 'select' && props.multiple) {
|
804 | error('`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.', type);
|
805 | } else {
|
806 | error('`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.', type);
|
807 | }
|
808 | }
|
809 | }
|
810 | }
|
811 |
|
812 |
|
813 |
|
814 |
|
815 | var possibleStandardNames = {
|
816 |
|
817 | accept: 'accept',
|
818 | acceptcharset: 'acceptCharset',
|
819 | 'accept-charset': 'acceptCharset',
|
820 | accesskey: 'accessKey',
|
821 | action: 'action',
|
822 | allowfullscreen: 'allowFullScreen',
|
823 | alt: 'alt',
|
824 | as: 'as',
|
825 | async: 'async',
|
826 | autocapitalize: 'autoCapitalize',
|
827 | autocomplete: 'autoComplete',
|
828 | autocorrect: 'autoCorrect',
|
829 | autofocus: 'autoFocus',
|
830 | autoplay: 'autoPlay',
|
831 | autosave: 'autoSave',
|
832 | capture: 'capture',
|
833 | cellpadding: 'cellPadding',
|
834 | cellspacing: 'cellSpacing',
|
835 | challenge: 'challenge',
|
836 | charset: 'charSet',
|
837 | checked: 'checked',
|
838 | children: 'children',
|
839 | cite: 'cite',
|
840 | class: 'className',
|
841 | classid: 'classID',
|
842 | classname: 'className',
|
843 | cols: 'cols',
|
844 | colspan: 'colSpan',
|
845 | content: 'content',
|
846 | contenteditable: 'contentEditable',
|
847 | contextmenu: 'contextMenu',
|
848 | controls: 'controls',
|
849 | controlslist: 'controlsList',
|
850 | coords: 'coords',
|
851 | crossorigin: 'crossOrigin',
|
852 | dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
|
853 | data: 'data',
|
854 | datetime: 'dateTime',
|
855 | default: 'default',
|
856 | defaultchecked: 'defaultChecked',
|
857 | defaultvalue: 'defaultValue',
|
858 | defer: 'defer',
|
859 | dir: 'dir',
|
860 | disabled: 'disabled',
|
861 | disablepictureinpicture: 'disablePictureInPicture',
|
862 | disableremoteplayback: 'disableRemotePlayback',
|
863 | download: 'download',
|
864 | draggable: 'draggable',
|
865 | enctype: 'encType',
|
866 | enterkeyhint: 'enterKeyHint',
|
867 | for: 'htmlFor',
|
868 | form: 'form',
|
869 | formmethod: 'formMethod',
|
870 | formaction: 'formAction',
|
871 | formenctype: 'formEncType',
|
872 | formnovalidate: 'formNoValidate',
|
873 | formtarget: 'formTarget',
|
874 | frameborder: 'frameBorder',
|
875 | headers: 'headers',
|
876 | height: 'height',
|
877 | hidden: 'hidden',
|
878 | high: 'high',
|
879 | href: 'href',
|
880 | hreflang: 'hrefLang',
|
881 | htmlfor: 'htmlFor',
|
882 | httpequiv: 'httpEquiv',
|
883 | 'http-equiv': 'httpEquiv',
|
884 | icon: 'icon',
|
885 | id: 'id',
|
886 | imagesizes: 'imageSizes',
|
887 | imagesrcset: 'imageSrcSet',
|
888 | innerhtml: 'innerHTML',
|
889 | inputmode: 'inputMode',
|
890 | integrity: 'integrity',
|
891 | is: 'is',
|
892 | itemid: 'itemID',
|
893 | itemprop: 'itemProp',
|
894 | itemref: 'itemRef',
|
895 | itemscope: 'itemScope',
|
896 | itemtype: 'itemType',
|
897 | keyparams: 'keyParams',
|
898 | keytype: 'keyType',
|
899 | kind: 'kind',
|
900 | label: 'label',
|
901 | lang: 'lang',
|
902 | list: 'list',
|
903 | loop: 'loop',
|
904 | low: 'low',
|
905 | manifest: 'manifest',
|
906 | marginwidth: 'marginWidth',
|
907 | marginheight: 'marginHeight',
|
908 | max: 'max',
|
909 | maxlength: 'maxLength',
|
910 | media: 'media',
|
911 | mediagroup: 'mediaGroup',
|
912 | method: 'method',
|
913 | min: 'min',
|
914 | minlength: 'minLength',
|
915 | multiple: 'multiple',
|
916 | muted: 'muted',
|
917 | name: 'name',
|
918 | nomodule: 'noModule',
|
919 | nonce: 'nonce',
|
920 | novalidate: 'noValidate',
|
921 | open: 'open',
|
922 | optimum: 'optimum',
|
923 | pattern: 'pattern',
|
924 | placeholder: 'placeholder',
|
925 | playsinline: 'playsInline',
|
926 | poster: 'poster',
|
927 | preload: 'preload',
|
928 | profile: 'profile',
|
929 | radiogroup: 'radioGroup',
|
930 | readonly: 'readOnly',
|
931 | referrerpolicy: 'referrerPolicy',
|
932 | rel: 'rel',
|
933 | required: 'required',
|
934 | reversed: 'reversed',
|
935 | role: 'role',
|
936 | rows: 'rows',
|
937 | rowspan: 'rowSpan',
|
938 | sandbox: 'sandbox',
|
939 | scope: 'scope',
|
940 | scoped: 'scoped',
|
941 | scrolling: 'scrolling',
|
942 | seamless: 'seamless',
|
943 | selected: 'selected',
|
944 | shape: 'shape',
|
945 | size: 'size',
|
946 | sizes: 'sizes',
|
947 | span: 'span',
|
948 | spellcheck: 'spellCheck',
|
949 | src: 'src',
|
950 | srcdoc: 'srcDoc',
|
951 | srclang: 'srcLang',
|
952 | srcset: 'srcSet',
|
953 | start: 'start',
|
954 | step: 'step',
|
955 | style: 'style',
|
956 | summary: 'summary',
|
957 | tabindex: 'tabIndex',
|
958 | target: 'target',
|
959 | title: 'title',
|
960 | type: 'type',
|
961 | usemap: 'useMap',
|
962 | value: 'value',
|
963 | width: 'width',
|
964 | wmode: 'wmode',
|
965 | wrap: 'wrap',
|
966 |
|
967 | about: 'about',
|
968 | accentheight: 'accentHeight',
|
969 | 'accent-height': 'accentHeight',
|
970 | accumulate: 'accumulate',
|
971 | additive: 'additive',
|
972 | alignmentbaseline: 'alignmentBaseline',
|
973 | 'alignment-baseline': 'alignmentBaseline',
|
974 | allowreorder: 'allowReorder',
|
975 | alphabetic: 'alphabetic',
|
976 | amplitude: 'amplitude',
|
977 | arabicform: 'arabicForm',
|
978 | 'arabic-form': 'arabicForm',
|
979 | ascent: 'ascent',
|
980 | attributename: 'attributeName',
|
981 | attributetype: 'attributeType',
|
982 | autoreverse: 'autoReverse',
|
983 | azimuth: 'azimuth',
|
984 | basefrequency: 'baseFrequency',
|
985 | baselineshift: 'baselineShift',
|
986 | 'baseline-shift': 'baselineShift',
|
987 | baseprofile: 'baseProfile',
|
988 | bbox: 'bbox',
|
989 | begin: 'begin',
|
990 | bias: 'bias',
|
991 | by: 'by',
|
992 | calcmode: 'calcMode',
|
993 | capheight: 'capHeight',
|
994 | 'cap-height': 'capHeight',
|
995 | clip: 'clip',
|
996 | clippath: 'clipPath',
|
997 | 'clip-path': 'clipPath',
|
998 | clippathunits: 'clipPathUnits',
|
999 | cliprule: 'clipRule',
|
1000 | 'clip-rule': 'clipRule',
|
1001 | color: 'color',
|
1002 | colorinterpolation: 'colorInterpolation',
|
1003 | 'color-interpolation': 'colorInterpolation',
|
1004 | colorinterpolationfilters: 'colorInterpolationFilters',
|
1005 | 'color-interpolation-filters': 'colorInterpolationFilters',
|
1006 | colorprofile: 'colorProfile',
|
1007 | 'color-profile': 'colorProfile',
|
1008 | colorrendering: 'colorRendering',
|
1009 | 'color-rendering': 'colorRendering',
|
1010 | contentscripttype: 'contentScriptType',
|
1011 | contentstyletype: 'contentStyleType',
|
1012 | cursor: 'cursor',
|
1013 | cx: 'cx',
|
1014 | cy: 'cy',
|
1015 | d: 'd',
|
1016 | datatype: 'datatype',
|
1017 | decelerate: 'decelerate',
|
1018 | descent: 'descent',
|
1019 | diffuseconstant: 'diffuseConstant',
|
1020 | direction: 'direction',
|
1021 | display: 'display',
|
1022 | divisor: 'divisor',
|
1023 | dominantbaseline: 'dominantBaseline',
|
1024 | 'dominant-baseline': 'dominantBaseline',
|
1025 | dur: 'dur',
|
1026 | dx: 'dx',
|
1027 | dy: 'dy',
|
1028 | edgemode: 'edgeMode',
|
1029 | elevation: 'elevation',
|
1030 | enablebackground: 'enableBackground',
|
1031 | 'enable-background': 'enableBackground',
|
1032 | end: 'end',
|
1033 | exponent: 'exponent',
|
1034 | externalresourcesrequired: 'externalResourcesRequired',
|
1035 | fill: 'fill',
|
1036 | fillopacity: 'fillOpacity',
|
1037 | 'fill-opacity': 'fillOpacity',
|
1038 | fillrule: 'fillRule',
|
1039 | 'fill-rule': 'fillRule',
|
1040 | filter: 'filter',
|
1041 | filterres: 'filterRes',
|
1042 | filterunits: 'filterUnits',
|
1043 | floodopacity: 'floodOpacity',
|
1044 | 'flood-opacity': 'floodOpacity',
|
1045 | floodcolor: 'floodColor',
|
1046 | 'flood-color': 'floodColor',
|
1047 | focusable: 'focusable',
|
1048 | fontfamily: 'fontFamily',
|
1049 | 'font-family': 'fontFamily',
|
1050 | fontsize: 'fontSize',
|
1051 | 'font-size': 'fontSize',
|
1052 | fontsizeadjust: 'fontSizeAdjust',
|
1053 | 'font-size-adjust': 'fontSizeAdjust',
|
1054 | fontstretch: 'fontStretch',
|
1055 | 'font-stretch': 'fontStretch',
|
1056 | fontstyle: 'fontStyle',
|
1057 | 'font-style': 'fontStyle',
|
1058 | fontvariant: 'fontVariant',
|
1059 | 'font-variant': 'fontVariant',
|
1060 | fontweight: 'fontWeight',
|
1061 | 'font-weight': 'fontWeight',
|
1062 | format: 'format',
|
1063 | from: 'from',
|
1064 | fx: 'fx',
|
1065 | fy: 'fy',
|
1066 | g1: 'g1',
|
1067 | g2: 'g2',
|
1068 | glyphname: 'glyphName',
|
1069 | 'glyph-name': 'glyphName',
|
1070 | glyphorientationhorizontal: 'glyphOrientationHorizontal',
|
1071 | 'glyph-orientation-horizontal': 'glyphOrientationHorizontal',
|
1072 | glyphorientationvertical: 'glyphOrientationVertical',
|
1073 | 'glyph-orientation-vertical': 'glyphOrientationVertical',
|
1074 | glyphref: 'glyphRef',
|
1075 | gradienttransform: 'gradientTransform',
|
1076 | gradientunits: 'gradientUnits',
|
1077 | hanging: 'hanging',
|
1078 | horizadvx: 'horizAdvX',
|
1079 | 'horiz-adv-x': 'horizAdvX',
|
1080 | horizoriginx: 'horizOriginX',
|
1081 | 'horiz-origin-x': 'horizOriginX',
|
1082 | ideographic: 'ideographic',
|
1083 | imagerendering: 'imageRendering',
|
1084 | 'image-rendering': 'imageRendering',
|
1085 | in2: 'in2',
|
1086 | in: 'in',
|
1087 | inlist: 'inlist',
|
1088 | intercept: 'intercept',
|
1089 | k1: 'k1',
|
1090 | k2: 'k2',
|
1091 | k3: 'k3',
|
1092 | k4: 'k4',
|
1093 | k: 'k',
|
1094 | kernelmatrix: 'kernelMatrix',
|
1095 | kernelunitlength: 'kernelUnitLength',
|
1096 | kerning: 'kerning',
|
1097 | keypoints: 'keyPoints',
|
1098 | keysplines: 'keySplines',
|
1099 | keytimes: 'keyTimes',
|
1100 | lengthadjust: 'lengthAdjust',
|
1101 | letterspacing: 'letterSpacing',
|
1102 | 'letter-spacing': 'letterSpacing',
|
1103 | lightingcolor: 'lightingColor',
|
1104 | 'lighting-color': 'lightingColor',
|
1105 | limitingconeangle: 'limitingConeAngle',
|
1106 | local: 'local',
|
1107 | markerend: 'markerEnd',
|
1108 | 'marker-end': 'markerEnd',
|
1109 | markerheight: 'markerHeight',
|
1110 | markermid: 'markerMid',
|
1111 | 'marker-mid': 'markerMid',
|
1112 | markerstart: 'markerStart',
|
1113 | 'marker-start': 'markerStart',
|
1114 | markerunits: 'markerUnits',
|
1115 | markerwidth: 'markerWidth',
|
1116 | mask: 'mask',
|
1117 | maskcontentunits: 'maskContentUnits',
|
1118 | maskunits: 'maskUnits',
|
1119 | mathematical: 'mathematical',
|
1120 | mode: 'mode',
|
1121 | numoctaves: 'numOctaves',
|
1122 | offset: 'offset',
|
1123 | opacity: 'opacity',
|
1124 | operator: 'operator',
|
1125 | order: 'order',
|
1126 | orient: 'orient',
|
1127 | orientation: 'orientation',
|
1128 | origin: 'origin',
|
1129 | overflow: 'overflow',
|
1130 | overlineposition: 'overlinePosition',
|
1131 | 'overline-position': 'overlinePosition',
|
1132 | overlinethickness: 'overlineThickness',
|
1133 | 'overline-thickness': 'overlineThickness',
|
1134 | paintorder: 'paintOrder',
|
1135 | 'paint-order': 'paintOrder',
|
1136 | panose1: 'panose1',
|
1137 | 'panose-1': 'panose1',
|
1138 | pathlength: 'pathLength',
|
1139 | patterncontentunits: 'patternContentUnits',
|
1140 | patterntransform: 'patternTransform',
|
1141 | patternunits: 'patternUnits',
|
1142 | pointerevents: 'pointerEvents',
|
1143 | 'pointer-events': 'pointerEvents',
|
1144 | points: 'points',
|
1145 | pointsatx: 'pointsAtX',
|
1146 | pointsaty: 'pointsAtY',
|
1147 | pointsatz: 'pointsAtZ',
|
1148 | prefix: 'prefix',
|
1149 | preservealpha: 'preserveAlpha',
|
1150 | preserveaspectratio: 'preserveAspectRatio',
|
1151 | primitiveunits: 'primitiveUnits',
|
1152 | property: 'property',
|
1153 | r: 'r',
|
1154 | radius: 'radius',
|
1155 | refx: 'refX',
|
1156 | refy: 'refY',
|
1157 | renderingintent: 'renderingIntent',
|
1158 | 'rendering-intent': 'renderingIntent',
|
1159 | repeatcount: 'repeatCount',
|
1160 | repeatdur: 'repeatDur',
|
1161 | requiredextensions: 'requiredExtensions',
|
1162 | requiredfeatures: 'requiredFeatures',
|
1163 | resource: 'resource',
|
1164 | restart: 'restart',
|
1165 | result: 'result',
|
1166 | results: 'results',
|
1167 | rotate: 'rotate',
|
1168 | rx: 'rx',
|
1169 | ry: 'ry',
|
1170 | scale: 'scale',
|
1171 | security: 'security',
|
1172 | seed: 'seed',
|
1173 | shaperendering: 'shapeRendering',
|
1174 | 'shape-rendering': 'shapeRendering',
|
1175 | slope: 'slope',
|
1176 | spacing: 'spacing',
|
1177 | specularconstant: 'specularConstant',
|
1178 | specularexponent: 'specularExponent',
|
1179 | speed: 'speed',
|
1180 | spreadmethod: 'spreadMethod',
|
1181 | startoffset: 'startOffset',
|
1182 | stddeviation: 'stdDeviation',
|
1183 | stemh: 'stemh',
|
1184 | stemv: 'stemv',
|
1185 | stitchtiles: 'stitchTiles',
|
1186 | stopcolor: 'stopColor',
|
1187 | 'stop-color': 'stopColor',
|
1188 | stopopacity: 'stopOpacity',
|
1189 | 'stop-opacity': 'stopOpacity',
|
1190 | strikethroughposition: 'strikethroughPosition',
|
1191 | 'strikethrough-position': 'strikethroughPosition',
|
1192 | strikethroughthickness: 'strikethroughThickness',
|
1193 | 'strikethrough-thickness': 'strikethroughThickness',
|
1194 | string: 'string',
|
1195 | stroke: 'stroke',
|
1196 | strokedasharray: 'strokeDasharray',
|
1197 | 'stroke-dasharray': 'strokeDasharray',
|
1198 | strokedashoffset: 'strokeDashoffset',
|
1199 | 'stroke-dashoffset': 'strokeDashoffset',
|
1200 | strokelinecap: 'strokeLinecap',
|
1201 | 'stroke-linecap': 'strokeLinecap',
|
1202 | strokelinejoin: 'strokeLinejoin',
|
1203 | 'stroke-linejoin': 'strokeLinejoin',
|
1204 | strokemiterlimit: 'strokeMiterlimit',
|
1205 | 'stroke-miterlimit': 'strokeMiterlimit',
|
1206 | strokewidth: 'strokeWidth',
|
1207 | 'stroke-width': 'strokeWidth',
|
1208 | strokeopacity: 'strokeOpacity',
|
1209 | 'stroke-opacity': 'strokeOpacity',
|
1210 | suppresscontenteditablewarning: 'suppressContentEditableWarning',
|
1211 | suppresshydrationwarning: 'suppressHydrationWarning',
|
1212 | surfacescale: 'surfaceScale',
|
1213 | systemlanguage: 'systemLanguage',
|
1214 | tablevalues: 'tableValues',
|
1215 | targetx: 'targetX',
|
1216 | targety: 'targetY',
|
1217 | textanchor: 'textAnchor',
|
1218 | 'text-anchor': 'textAnchor',
|
1219 | textdecoration: 'textDecoration',
|
1220 | 'text-decoration': 'textDecoration',
|
1221 | textlength: 'textLength',
|
1222 | textrendering: 'textRendering',
|
1223 | 'text-rendering': 'textRendering',
|
1224 | to: 'to',
|
1225 | transform: 'transform',
|
1226 | typeof: 'typeof',
|
1227 | u1: 'u1',
|
1228 | u2: 'u2',
|
1229 | underlineposition: 'underlinePosition',
|
1230 | 'underline-position': 'underlinePosition',
|
1231 | underlinethickness: 'underlineThickness',
|
1232 | 'underline-thickness': 'underlineThickness',
|
1233 | unicode: 'unicode',
|
1234 | unicodebidi: 'unicodeBidi',
|
1235 | 'unicode-bidi': 'unicodeBidi',
|
1236 | unicoderange: 'unicodeRange',
|
1237 | 'unicode-range': 'unicodeRange',
|
1238 | unitsperem: 'unitsPerEm',
|
1239 | 'units-per-em': 'unitsPerEm',
|
1240 | unselectable: 'unselectable',
|
1241 | valphabetic: 'vAlphabetic',
|
1242 | 'v-alphabetic': 'vAlphabetic',
|
1243 | values: 'values',
|
1244 | vectoreffect: 'vectorEffect',
|
1245 | 'vector-effect': 'vectorEffect',
|
1246 | version: 'version',
|
1247 | vertadvy: 'vertAdvY',
|
1248 | 'vert-adv-y': 'vertAdvY',
|
1249 | vertoriginx: 'vertOriginX',
|
1250 | 'vert-origin-x': 'vertOriginX',
|
1251 | vertoriginy: 'vertOriginY',
|
1252 | 'vert-origin-y': 'vertOriginY',
|
1253 | vhanging: 'vHanging',
|
1254 | 'v-hanging': 'vHanging',
|
1255 | videographic: 'vIdeographic',
|
1256 | 'v-ideographic': 'vIdeographic',
|
1257 | viewbox: 'viewBox',
|
1258 | viewtarget: 'viewTarget',
|
1259 | visibility: 'visibility',
|
1260 | vmathematical: 'vMathematical',
|
1261 | 'v-mathematical': 'vMathematical',
|
1262 | vocab: 'vocab',
|
1263 | widths: 'widths',
|
1264 | wordspacing: 'wordSpacing',
|
1265 | 'word-spacing': 'wordSpacing',
|
1266 | writingmode: 'writingMode',
|
1267 | 'writing-mode': 'writingMode',
|
1268 | x1: 'x1',
|
1269 | x2: 'x2',
|
1270 | x: 'x',
|
1271 | xchannelselector: 'xChannelSelector',
|
1272 | xheight: 'xHeight',
|
1273 | 'x-height': 'xHeight',
|
1274 | xlinkactuate: 'xlinkActuate',
|
1275 | 'xlink:actuate': 'xlinkActuate',
|
1276 | xlinkarcrole: 'xlinkArcrole',
|
1277 | 'xlink:arcrole': 'xlinkArcrole',
|
1278 | xlinkhref: 'xlinkHref',
|
1279 | 'xlink:href': 'xlinkHref',
|
1280 | xlinkrole: 'xlinkRole',
|
1281 | 'xlink:role': 'xlinkRole',
|
1282 | xlinkshow: 'xlinkShow',
|
1283 | 'xlink:show': 'xlinkShow',
|
1284 | xlinktitle: 'xlinkTitle',
|
1285 | 'xlink:title': 'xlinkTitle',
|
1286 | xlinktype: 'xlinkType',
|
1287 | 'xlink:type': 'xlinkType',
|
1288 | xmlbase: 'xmlBase',
|
1289 | 'xml:base': 'xmlBase',
|
1290 | xmllang: 'xmlLang',
|
1291 | 'xml:lang': 'xmlLang',
|
1292 | xmlns: 'xmlns',
|
1293 | 'xml:space': 'xmlSpace',
|
1294 | xmlnsxlink: 'xmlnsXlink',
|
1295 | 'xmlns:xlink': 'xmlnsXlink',
|
1296 | xmlspace: 'xmlSpace',
|
1297 | y1: 'y1',
|
1298 | y2: 'y2',
|
1299 | y: 'y',
|
1300 | ychannelselector: 'yChannelSelector',
|
1301 | z: 'z',
|
1302 | zoomandpan: 'zoomAndPan'
|
1303 | };
|
1304 |
|
1305 | var validateProperty$1 = function () {};
|
1306 |
|
1307 | {
|
1308 | var warnedProperties$1 = {};
|
1309 | var EVENT_NAME_REGEX = /^on./;
|
1310 | var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
|
1311 | var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
|
1312 | var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
1313 |
|
1314 | validateProperty$1 = function (tagName, name, value, eventRegistry) {
|
1315 | if (hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
|
1316 | return true;
|
1317 | }
|
1318 |
|
1319 | var lowerCasedName = name.toLowerCase();
|
1320 |
|
1321 | if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
|
1322 | error('React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
|
1323 |
|
1324 | warnedProperties$1[name] = true;
|
1325 | return true;
|
1326 | }
|
1327 |
|
1328 |
|
1329 | if (eventRegistry != null) {
|
1330 | var registrationNameDependencies = eventRegistry.registrationNameDependencies,
|
1331 | possibleRegistrationNames = eventRegistry.possibleRegistrationNames;
|
1332 |
|
1333 | if (registrationNameDependencies.hasOwnProperty(name)) {
|
1334 | return true;
|
1335 | }
|
1336 |
|
1337 | var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
|
1338 |
|
1339 | if (registrationName != null) {
|
1340 | error('Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName);
|
1341 |
|
1342 | warnedProperties$1[name] = true;
|
1343 | return true;
|
1344 | }
|
1345 |
|
1346 | if (EVENT_NAME_REGEX.test(name)) {
|
1347 | error('Unknown event handler property `%s`. It will be ignored.', name);
|
1348 |
|
1349 | warnedProperties$1[name] = true;
|
1350 | return true;
|
1351 | }
|
1352 | } else if (EVENT_NAME_REGEX.test(name)) {
|
1353 |
|
1354 |
|
1355 |
|
1356 | if (INVALID_EVENT_NAME_REGEX.test(name)) {
|
1357 | error('Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name);
|
1358 | }
|
1359 |
|
1360 | warnedProperties$1[name] = true;
|
1361 | return true;
|
1362 | }
|
1363 |
|
1364 |
|
1365 | if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
|
1366 | return true;
|
1367 | }
|
1368 |
|
1369 | if (lowerCasedName === 'innerhtml') {
|
1370 | error('Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
|
1371 |
|
1372 | warnedProperties$1[name] = true;
|
1373 | return true;
|
1374 | }
|
1375 |
|
1376 | if (lowerCasedName === 'aria') {
|
1377 | error('The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
|
1378 |
|
1379 | warnedProperties$1[name] = true;
|
1380 | return true;
|
1381 | }
|
1382 |
|
1383 | if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
|
1384 | error('Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value);
|
1385 |
|
1386 | warnedProperties$1[name] = true;
|
1387 | return true;
|
1388 | }
|
1389 |
|
1390 | if (typeof value === 'number' && isNaN(value)) {
|
1391 | error('Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name);
|
1392 |
|
1393 | warnedProperties$1[name] = true;
|
1394 | return true;
|
1395 | }
|
1396 |
|
1397 | var propertyInfo = getPropertyInfo(name);
|
1398 | var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED;
|
1399 |
|
1400 | if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
|
1401 | var standardName = possibleStandardNames[lowerCasedName];
|
1402 |
|
1403 | if (standardName !== name) {
|
1404 | error('Invalid DOM property `%s`. Did you mean `%s`?', name, standardName);
|
1405 |
|
1406 | warnedProperties$1[name] = true;
|
1407 | return true;
|
1408 | }
|
1409 | } else if (!isReserved && name !== lowerCasedName) {
|
1410 |
|
1411 |
|
1412 | error('React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.', name, lowerCasedName);
|
1413 |
|
1414 | warnedProperties$1[name] = true;
|
1415 | return true;
|
1416 | }
|
1417 |
|
1418 | if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
|
1419 | if (value) {
|
1420 | error('Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.', value, name, name, value, name);
|
1421 | } else {
|
1422 | error('Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name);
|
1423 | }
|
1424 |
|
1425 | warnedProperties$1[name] = true;
|
1426 | return true;
|
1427 | }
|
1428 |
|
1429 |
|
1430 |
|
1431 | if (isReserved) {
|
1432 | return true;
|
1433 | }
|
1434 |
|
1435 |
|
1436 | if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
|
1437 | warnedProperties$1[name] = true;
|
1438 | return false;
|
1439 | }
|
1440 |
|
1441 |
|
1442 | if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
|
1443 | error('Received the string `%s` for the boolean attribute `%s`. ' + '%s ' + 'Did you mean %s={%s}?', value, name, value === 'false' ? 'The browser will interpret it as a truthy value.' : 'Although this works, it will not work as expected if you pass the string "false".', name, value);
|
1444 |
|
1445 | warnedProperties$1[name] = true;
|
1446 | return true;
|
1447 | }
|
1448 |
|
1449 | return true;
|
1450 | };
|
1451 | }
|
1452 |
|
1453 | var warnUnknownProperties = function (type, props, eventRegistry) {
|
1454 | {
|
1455 | var unknownProps = [];
|
1456 |
|
1457 | for (var key in props) {
|
1458 | var isValid = validateProperty$1(type, key, props[key], eventRegistry);
|
1459 |
|
1460 | if (!isValid) {
|
1461 | unknownProps.push(key);
|
1462 | }
|
1463 | }
|
1464 |
|
1465 | var unknownPropString = unknownProps.map(function (prop) {
|
1466 | return '`' + prop + '`';
|
1467 | }).join(', ');
|
1468 |
|
1469 | if (unknownProps.length === 1) {
|
1470 | error('Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://reactjs.org/link/attribute-behavior ', unknownPropString, type);
|
1471 | } else if (unknownProps.length > 1) {
|
1472 | error('Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://reactjs.org/link/attribute-behavior ', unknownPropString, type);
|
1473 | }
|
1474 | }
|
1475 | };
|
1476 |
|
1477 | function validateProperties$2(type, props, eventRegistry) {
|
1478 | if (isCustomComponent(type, props)) {
|
1479 | return;
|
1480 | }
|
1481 |
|
1482 | warnUnknownProperties(type, props, eventRegistry);
|
1483 | }
|
1484 |
|
1485 | var warnValidStyle = function () {};
|
1486 |
|
1487 | {
|
1488 |
|
1489 | var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
|
1490 | var msPattern = /^-ms-/;
|
1491 | var hyphenPattern = /-(.)/g;
|
1492 |
|
1493 | var badStyleValueWithSemicolonPattern = /;\s*$/;
|
1494 | var warnedStyleNames = {};
|
1495 | var warnedStyleValues = {};
|
1496 | var warnedForNaNValue = false;
|
1497 | var warnedForInfinityValue = false;
|
1498 |
|
1499 | var camelize = function (string) {
|
1500 | return string.replace(hyphenPattern, function (_, character) {
|
1501 | return character.toUpperCase();
|
1502 | });
|
1503 | };
|
1504 |
|
1505 | var warnHyphenatedStyleName = function (name) {
|
1506 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
|
1507 | return;
|
1508 | }
|
1509 |
|
1510 | warnedStyleNames[name] = true;
|
1511 |
|
1512 | error('Unsupported style property %s. Did you mean %s?', name,
|
1513 |
|
1514 |
|
1515 | camelize(name.replace(msPattern, 'ms-')));
|
1516 | };
|
1517 |
|
1518 | var warnBadVendoredStyleName = function (name) {
|
1519 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
|
1520 | return;
|
1521 | }
|
1522 |
|
1523 | warnedStyleNames[name] = true;
|
1524 |
|
1525 | error('Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1));
|
1526 | };
|
1527 |
|
1528 | var warnStyleValueWithSemicolon = function (name, value) {
|
1529 | if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
|
1530 | return;
|
1531 | }
|
1532 |
|
1533 | warnedStyleValues[value] = true;
|
1534 |
|
1535 | error("Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, ''));
|
1536 | };
|
1537 |
|
1538 | var warnStyleValueIsNaN = function (name, value) {
|
1539 | if (warnedForNaNValue) {
|
1540 | return;
|
1541 | }
|
1542 |
|
1543 | warnedForNaNValue = true;
|
1544 |
|
1545 | error('`NaN` is an invalid value for the `%s` css style property.', name);
|
1546 | };
|
1547 |
|
1548 | var warnStyleValueIsInfinity = function (name, value) {
|
1549 | if (warnedForInfinityValue) {
|
1550 | return;
|
1551 | }
|
1552 |
|
1553 | warnedForInfinityValue = true;
|
1554 |
|
1555 | error('`Infinity` is an invalid value for the `%s` css style property.', name);
|
1556 | };
|
1557 |
|
1558 | warnValidStyle = function (name, value) {
|
1559 | if (name.indexOf('-') > -1) {
|
1560 | warnHyphenatedStyleName(name);
|
1561 | } else if (badVendoredStyleNamePattern.test(name)) {
|
1562 | warnBadVendoredStyleName(name);
|
1563 | } else if (badStyleValueWithSemicolonPattern.test(value)) {
|
1564 | warnStyleValueWithSemicolon(name, value);
|
1565 | }
|
1566 |
|
1567 | if (typeof value === 'number') {
|
1568 | if (isNaN(value)) {
|
1569 | warnStyleValueIsNaN(name, value);
|
1570 | } else if (!isFinite(value)) {
|
1571 | warnStyleValueIsInfinity(name, value);
|
1572 | }
|
1573 | }
|
1574 | };
|
1575 | }
|
1576 |
|
1577 | var warnValidStyle$1 = warnValidStyle;
|
1578 |
|
1579 |
|
1580 | var matchHtmlRegExp = /["'&<>]/;
|
1581 |
|
1582 |
|
1583 |
|
1584 |
|
1585 |
|
1586 |
|
1587 |
|
1588 |
|
1589 | function escapeHtml(string) {
|
1590 | {
|
1591 | checkHtmlStringCoercion(string);
|
1592 | }
|
1593 |
|
1594 | var str = '' + string;
|
1595 | var match = matchHtmlRegExp.exec(str);
|
1596 |
|
1597 | if (!match) {
|
1598 | return str;
|
1599 | }
|
1600 |
|
1601 | var escape;
|
1602 | var html = '';
|
1603 | var index;
|
1604 | var lastIndex = 0;
|
1605 |
|
1606 | for (index = match.index; index < str.length; index++) {
|
1607 | switch (str.charCodeAt(index)) {
|
1608 | case 34:
|
1609 |
|
1610 | escape = '"';
|
1611 | break;
|
1612 |
|
1613 | case 38:
|
1614 |
|
1615 | escape = '&';
|
1616 | break;
|
1617 |
|
1618 | case 39:
|
1619 |
|
1620 | escape = ''';
|
1621 |
|
1622 | break;
|
1623 |
|
1624 | case 60:
|
1625 |
|
1626 | escape = '<';
|
1627 | break;
|
1628 |
|
1629 | case 62:
|
1630 |
|
1631 | escape = '>';
|
1632 | break;
|
1633 |
|
1634 | default:
|
1635 | continue;
|
1636 | }
|
1637 |
|
1638 | if (lastIndex !== index) {
|
1639 | html += str.substring(lastIndex, index);
|
1640 | }
|
1641 |
|
1642 | lastIndex = index + 1;
|
1643 | html += escape;
|
1644 | }
|
1645 |
|
1646 | return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
|
1647 | }
|
1648 |
|
1649 |
|
1650 |
|
1651 |
|
1652 |
|
1653 |
|
1654 |
|
1655 |
|
1656 |
|
1657 | function escapeTextForBrowser(text) {
|
1658 | if (typeof text === 'boolean' || typeof text === 'number') {
|
1659 |
|
1660 |
|
1661 |
|
1662 | return '' + text;
|
1663 | }
|
1664 |
|
1665 | return escapeHtml(text);
|
1666 | }
|
1667 |
|
1668 | var uppercasePattern = /([A-Z])/g;
|
1669 | var msPattern$1 = /^ms-/;
|
1670 |
|
1671 |
|
1672 |
|
1673 |
|
1674 |
|
1675 |
|
1676 |
|
1677 |
|
1678 |
|
1679 |
|
1680 |
|
1681 |
|
1682 |
|
1683 |
|
1684 | function hyphenateStyleName(name) {
|
1685 | return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern$1, '-ms-');
|
1686 | }
|
1687 |
|
1688 |
|
1689 |
|
1690 |
|
1691 |
|
1692 |
|
1693 |
|
1694 |
|
1695 |
|
1696 |
|
1697 |
|
1698 | var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
|
1699 | var didWarn = false;
|
1700 |
|
1701 | function sanitizeURL(url) {
|
1702 | {
|
1703 | if (!didWarn && isJavaScriptProtocol.test(url)) {
|
1704 | didWarn = true;
|
1705 |
|
1706 | error('A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url));
|
1707 | }
|
1708 | }
|
1709 | }
|
1710 |
|
1711 | var isArrayImpl = Array.isArray;
|
1712 |
|
1713 | function isArray(a) {
|
1714 | return isArrayImpl(a);
|
1715 | }
|
1716 |
|
1717 | var startInlineScript = stringToPrecomputedChunk('<script>');
|
1718 | var endInlineScript = stringToPrecomputedChunk('</script>');
|
1719 | var startScriptSrc = stringToPrecomputedChunk('<script src="');
|
1720 | var startModuleSrc = stringToPrecomputedChunk('<script type="module" src="');
|
1721 | var endAsyncScript = stringToPrecomputedChunk('" async=""></script>');
|
1722 |
|
1723 |
|
1724 |
|
1725 |
|
1726 |
|
1727 |
|
1728 |
|
1729 |
|
1730 |
|
1731 |
|
1732 |
|
1733 | function escapeBootstrapScriptContent(scriptText) {
|
1734 | {
|
1735 | checkHtmlStringCoercion(scriptText);
|
1736 | }
|
1737 |
|
1738 | return ('' + scriptText).replace(scriptRegex, scriptReplacer);
|
1739 | }
|
1740 |
|
1741 | var scriptRegex = /(<\/|<)(s)(cript)/gi;
|
1742 |
|
1743 | var scriptReplacer = function (match, prefix, s, suffix) {
|
1744 | return "" + prefix + (s === 's' ? "\\u0073" : "\\u0053") + suffix;
|
1745 | };
|
1746 |
|
1747 |
|
1748 | function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules) {
|
1749 | var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix;
|
1750 | var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk('<script nonce="' + escapeTextForBrowser(nonce) + '">');
|
1751 | var bootstrapChunks = [];
|
1752 |
|
1753 | if (bootstrapScriptContent !== undefined) {
|
1754 | bootstrapChunks.push(inlineScriptWithNonce, stringToChunk(escapeBootstrapScriptContent(bootstrapScriptContent)), endInlineScript);
|
1755 | }
|
1756 |
|
1757 | if (bootstrapScripts !== undefined) {
|
1758 | for (var i = 0; i < bootstrapScripts.length; i++) {
|
1759 | bootstrapChunks.push(startScriptSrc, stringToChunk(escapeTextForBrowser(bootstrapScripts[i])), endAsyncScript);
|
1760 | }
|
1761 | }
|
1762 |
|
1763 | if (bootstrapModules !== undefined) {
|
1764 | for (var _i = 0; _i < bootstrapModules.length; _i++) {
|
1765 | bootstrapChunks.push(startModuleSrc, stringToChunk(escapeTextForBrowser(bootstrapModules[_i])), endAsyncScript);
|
1766 | }
|
1767 | }
|
1768 |
|
1769 | return {
|
1770 | bootstrapChunks: bootstrapChunks,
|
1771 | startInlineScript: inlineScriptWithNonce,
|
1772 | placeholderPrefix: stringToPrecomputedChunk(idPrefix + 'P:'),
|
1773 | segmentPrefix: stringToPrecomputedChunk(idPrefix + 'S:'),
|
1774 | boundaryPrefix: idPrefix + 'B:',
|
1775 | idPrefix: idPrefix,
|
1776 | nextSuspenseID: 0,
|
1777 | sentCompleteSegmentFunction: false,
|
1778 | sentCompleteBoundaryFunction: false,
|
1779 | sentClientRenderFunction: false
|
1780 | };
|
1781 | }
|
1782 |
|
1783 |
|
1784 |
|
1785 | var ROOT_HTML_MODE = 0;
|
1786 |
|
1787 | var HTML_MODE = 1;
|
1788 | var SVG_MODE = 2;
|
1789 | var MATHML_MODE = 3;
|
1790 | var HTML_TABLE_MODE = 4;
|
1791 | var HTML_TABLE_BODY_MODE = 5;
|
1792 | var HTML_TABLE_ROW_MODE = 6;
|
1793 | var HTML_COLGROUP_MODE = 7;
|
1794 |
|
1795 |
|
1796 | function createFormatContext(insertionMode, selectedValue) {
|
1797 | return {
|
1798 | insertionMode: insertionMode,
|
1799 | selectedValue: selectedValue
|
1800 | };
|
1801 | }
|
1802 |
|
1803 | function createRootFormatContext(namespaceURI) {
|
1804 | var insertionMode = namespaceURI === 'http://www.w3.org/2000/svg' ? SVG_MODE : namespaceURI === 'http://www.w3.org/1998/Math/MathML' ? MATHML_MODE : ROOT_HTML_MODE;
|
1805 | return createFormatContext(insertionMode, null);
|
1806 | }
|
1807 | function getChildFormatContext(parentContext, type, props) {
|
1808 | switch (type) {
|
1809 | case 'select':
|
1810 | return createFormatContext(HTML_MODE, props.value != null ? props.value : props.defaultValue);
|
1811 |
|
1812 | case 'svg':
|
1813 | return createFormatContext(SVG_MODE, null);
|
1814 |
|
1815 | case 'math':
|
1816 | return createFormatContext(MATHML_MODE, null);
|
1817 |
|
1818 | case 'foreignObject':
|
1819 | return createFormatContext(HTML_MODE, null);
|
1820 |
|
1821 |
|
1822 |
|
1823 | case 'table':
|
1824 | return createFormatContext(HTML_TABLE_MODE, null);
|
1825 |
|
1826 | case 'thead':
|
1827 | case 'tbody':
|
1828 | case 'tfoot':
|
1829 | return createFormatContext(HTML_TABLE_BODY_MODE, null);
|
1830 |
|
1831 | case 'colgroup':
|
1832 | return createFormatContext(HTML_COLGROUP_MODE, null);
|
1833 |
|
1834 | case 'tr':
|
1835 | return createFormatContext(HTML_TABLE_ROW_MODE, null);
|
1836 | }
|
1837 |
|
1838 | if (parentContext.insertionMode >= HTML_TABLE_MODE) {
|
1839 |
|
1840 |
|
1841 | return createFormatContext(HTML_MODE, null);
|
1842 | }
|
1843 |
|
1844 | if (parentContext.insertionMode === ROOT_HTML_MODE) {
|
1845 |
|
1846 | return createFormatContext(HTML_MODE, null);
|
1847 | }
|
1848 |
|
1849 | return parentContext;
|
1850 | }
|
1851 | var UNINITIALIZED_SUSPENSE_BOUNDARY_ID = null;
|
1852 | function assignSuspenseBoundaryID(responseState) {
|
1853 | var generatedID = responseState.nextSuspenseID++;
|
1854 | return stringToPrecomputedChunk(responseState.boundaryPrefix + generatedID.toString(16));
|
1855 | }
|
1856 | function makeId(responseState, treeId, localId) {
|
1857 | var idPrefix = responseState.idPrefix;
|
1858 | var id = ':' + idPrefix + 'R' + treeId;
|
1859 |
|
1860 |
|
1861 |
|
1862 | if (localId > 0) {
|
1863 | id += 'H' + localId.toString(32);
|
1864 | }
|
1865 |
|
1866 | return id + ':';
|
1867 | }
|
1868 |
|
1869 | function encodeHTMLTextNode(text) {
|
1870 | return escapeTextForBrowser(text);
|
1871 | }
|
1872 |
|
1873 | var textSeparator = stringToPrecomputedChunk('<!-- -->');
|
1874 | function pushTextInstance(target, text, responseState, textEmbedded) {
|
1875 | if (text === '') {
|
1876 |
|
1877 | return textEmbedded;
|
1878 | }
|
1879 |
|
1880 | if (textEmbedded) {
|
1881 | target.push(textSeparator);
|
1882 | }
|
1883 |
|
1884 | target.push(stringToChunk(encodeHTMLTextNode(text)));
|
1885 | return true;
|
1886 | }
|
1887 |
|
1888 |
|
1889 | function pushSegmentFinale(target, responseState, lastPushedText, textEmbedded) {
|
1890 | if (lastPushedText && textEmbedded) {
|
1891 | target.push(textSeparator);
|
1892 | }
|
1893 | }
|
1894 | var styleNameCache = new Map();
|
1895 |
|
1896 | function processStyleName(styleName) {
|
1897 | var chunk = styleNameCache.get(styleName);
|
1898 |
|
1899 | if (chunk !== undefined) {
|
1900 | return chunk;
|
1901 | }
|
1902 |
|
1903 | var result = stringToPrecomputedChunk(escapeTextForBrowser(hyphenateStyleName(styleName)));
|
1904 | styleNameCache.set(styleName, result);
|
1905 | return result;
|
1906 | }
|
1907 |
|
1908 | var styleAttributeStart = stringToPrecomputedChunk(' style="');
|
1909 | var styleAssign = stringToPrecomputedChunk(':');
|
1910 | var styleSeparator = stringToPrecomputedChunk(';');
|
1911 |
|
1912 | function pushStyle(target, responseState, style) {
|
1913 | if (typeof style !== 'object') {
|
1914 | throw new Error('The `style` prop expects a mapping from style properties to values, ' + "not a string. For example, style={{marginRight: spacing + 'em'}} when " + 'using JSX.');
|
1915 | }
|
1916 |
|
1917 | var isFirst = true;
|
1918 |
|
1919 | for (var styleName in style) {
|
1920 | if (!hasOwnProperty.call(style, styleName)) {
|
1921 | continue;
|
1922 | }
|
1923 |
|
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 | var styleValue = style[styleName];
|
1932 |
|
1933 | if (styleValue == null || typeof styleValue === 'boolean' || styleValue === '') {
|
1934 |
|
1935 | continue;
|
1936 | }
|
1937 |
|
1938 | var nameChunk = void 0;
|
1939 | var valueChunk = void 0;
|
1940 | var isCustomProperty = styleName.indexOf('--') === 0;
|
1941 |
|
1942 | if (isCustomProperty) {
|
1943 | nameChunk = stringToChunk(escapeTextForBrowser(styleName));
|
1944 |
|
1945 | {
|
1946 | checkCSSPropertyStringCoercion(styleValue, styleName);
|
1947 | }
|
1948 |
|
1949 | valueChunk = stringToChunk(escapeTextForBrowser(('' + styleValue).trim()));
|
1950 | } else {
|
1951 | {
|
1952 | warnValidStyle$1(styleName, styleValue);
|
1953 | }
|
1954 |
|
1955 | nameChunk = processStyleName(styleName);
|
1956 |
|
1957 | if (typeof styleValue === 'number') {
|
1958 | if (styleValue !== 0 && !hasOwnProperty.call(isUnitlessNumber, styleName)) {
|
1959 | valueChunk = stringToChunk(styleValue + 'px');
|
1960 | } else {
|
1961 | valueChunk = stringToChunk('' + styleValue);
|
1962 | }
|
1963 | } else {
|
1964 | {
|
1965 | checkCSSPropertyStringCoercion(styleValue, styleName);
|
1966 | }
|
1967 |
|
1968 | valueChunk = stringToChunk(escapeTextForBrowser(('' + styleValue).trim()));
|
1969 | }
|
1970 | }
|
1971 |
|
1972 | if (isFirst) {
|
1973 | isFirst = false;
|
1974 |
|
1975 | target.push(styleAttributeStart, nameChunk, styleAssign, valueChunk);
|
1976 | } else {
|
1977 | target.push(styleSeparator, nameChunk, styleAssign, valueChunk);
|
1978 | }
|
1979 | }
|
1980 |
|
1981 | if (!isFirst) {
|
1982 | target.push(attributeEnd);
|
1983 | }
|
1984 | }
|
1985 |
|
1986 | var attributeSeparator = stringToPrecomputedChunk(' ');
|
1987 | var attributeAssign = stringToPrecomputedChunk('="');
|
1988 | var attributeEnd = stringToPrecomputedChunk('"');
|
1989 | var attributeEmptyString = stringToPrecomputedChunk('=""');
|
1990 |
|
1991 | function pushAttribute(target, responseState, name, value) {
|
1992 | switch (name) {
|
1993 | case 'style':
|
1994 | {
|
1995 | pushStyle(target, responseState, value);
|
1996 | return;
|
1997 | }
|
1998 |
|
1999 | case 'defaultValue':
|
2000 | case 'defaultChecked':
|
2001 |
|
2002 | case 'innerHTML':
|
2003 |
|
2004 | case 'suppressContentEditableWarning':
|
2005 | case 'suppressHydrationWarning':
|
2006 |
|
2007 | return;
|
2008 | }
|
2009 |
|
2010 | if (
|
2011 |
|
2012 | name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
|
2013 | return;
|
2014 | }
|
2015 |
|
2016 | var propertyInfo = getPropertyInfo(name);
|
2017 |
|
2018 | if (propertyInfo !== null) {
|
2019 |
|
2020 | switch (typeof value) {
|
2021 | case 'function':
|
2022 |
|
2023 | case 'symbol':
|
2024 |
|
2025 | return;
|
2026 |
|
2027 | case 'boolean':
|
2028 | {
|
2029 | if (!propertyInfo.acceptsBooleans) {
|
2030 | return;
|
2031 | }
|
2032 | }
|
2033 | }
|
2034 |
|
2035 | var attributeName = propertyInfo.attributeName;
|
2036 | var attributeNameChunk = stringToChunk(attributeName);
|
2037 |
|
2038 | switch (propertyInfo.type) {
|
2039 | case BOOLEAN:
|
2040 | if (value) {
|
2041 | target.push(attributeSeparator, attributeNameChunk, attributeEmptyString);
|
2042 | }
|
2043 |
|
2044 | return;
|
2045 |
|
2046 | case OVERLOADED_BOOLEAN:
|
2047 | if (value === true) {
|
2048 | target.push(attributeSeparator, attributeNameChunk, attributeEmptyString);
|
2049 | } else if (value === false) ; else {
|
2050 | target.push(attributeSeparator, attributeNameChunk, attributeAssign, stringToChunk(escapeTextForBrowser(value)), attributeEnd);
|
2051 | }
|
2052 |
|
2053 | return;
|
2054 |
|
2055 | case NUMERIC:
|
2056 | if (!isNaN(value)) {
|
2057 | target.push(attributeSeparator, attributeNameChunk, attributeAssign, stringToChunk(escapeTextForBrowser(value)), attributeEnd);
|
2058 | }
|
2059 |
|
2060 | break;
|
2061 |
|
2062 | case POSITIVE_NUMERIC:
|
2063 | if (!isNaN(value) && value >= 1) {
|
2064 | target.push(attributeSeparator, attributeNameChunk, attributeAssign, stringToChunk(escapeTextForBrowser(value)), attributeEnd);
|
2065 | }
|
2066 |
|
2067 | break;
|
2068 |
|
2069 | default:
|
2070 | if (propertyInfo.sanitizeURL) {
|
2071 | {
|
2072 | checkAttributeStringCoercion(value, attributeName);
|
2073 | }
|
2074 |
|
2075 | value = '' + value;
|
2076 | sanitizeURL(value);
|
2077 | }
|
2078 |
|
2079 | target.push(attributeSeparator, attributeNameChunk, attributeAssign, stringToChunk(escapeTextForBrowser(value)), attributeEnd);
|
2080 | }
|
2081 | } else if (isAttributeNameSafe(name)) {
|
2082 |
|
2083 | switch (typeof value) {
|
2084 | case 'function':
|
2085 |
|
2086 | case 'symbol':
|
2087 |
|
2088 | return;
|
2089 |
|
2090 | case 'boolean':
|
2091 | {
|
2092 | var prefix = name.toLowerCase().slice(0, 5);
|
2093 |
|
2094 | if (prefix !== 'data-' && prefix !== 'aria-') {
|
2095 | return;
|
2096 | }
|
2097 | }
|
2098 | }
|
2099 |
|
2100 | target.push(attributeSeparator, stringToChunk(name), attributeAssign, stringToChunk(escapeTextForBrowser(value)), attributeEnd);
|
2101 | }
|
2102 | }
|
2103 |
|
2104 | var endOfStartTag = stringToPrecomputedChunk('>');
|
2105 | var endOfStartTagSelfClosing = stringToPrecomputedChunk('/>');
|
2106 |
|
2107 | function pushInnerHTML(target, innerHTML, children) {
|
2108 | if (innerHTML != null) {
|
2109 | if (children != null) {
|
2110 | throw new Error('Can only set one of `children` or `props.dangerouslySetInnerHTML`.');
|
2111 | }
|
2112 |
|
2113 | if (typeof innerHTML !== 'object' || !('__html' in innerHTML)) {
|
2114 | throw new Error('`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://reactjs.org/link/dangerously-set-inner-html ' + 'for more information.');
|
2115 | }
|
2116 |
|
2117 | var html = innerHTML.__html;
|
2118 |
|
2119 | if (html !== null && html !== undefined) {
|
2120 | {
|
2121 | checkHtmlStringCoercion(html);
|
2122 | }
|
2123 |
|
2124 | target.push(stringToChunk('' + html));
|
2125 | }
|
2126 | }
|
2127 | }
|
2128 |
|
2129 |
|
2130 |
|
2131 | var didWarnDefaultInputValue = false;
|
2132 | var didWarnDefaultChecked = false;
|
2133 | var didWarnDefaultSelectValue = false;
|
2134 | var didWarnDefaultTextareaValue = false;
|
2135 | var didWarnInvalidOptionChildren = false;
|
2136 | var didWarnInvalidOptionInnerHTML = false;
|
2137 | var didWarnSelectedSetOnOption = false;
|
2138 |
|
2139 | function checkSelectProp(props, propName) {
|
2140 | {
|
2141 | var value = props[propName];
|
2142 |
|
2143 | if (value != null) {
|
2144 | var array = isArray(value);
|
2145 |
|
2146 | if (props.multiple && !array) {
|
2147 | error('The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.', propName);
|
2148 | } else if (!props.multiple && array) {
|
2149 | error('The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.', propName);
|
2150 | }
|
2151 | }
|
2152 | }
|
2153 | }
|
2154 |
|
2155 | function pushStartSelect(target, props, responseState) {
|
2156 | {
|
2157 | checkControlledValueProps('select', props);
|
2158 | checkSelectProp(props, 'value');
|
2159 | checkSelectProp(props, 'defaultValue');
|
2160 |
|
2161 | if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultSelectValue) {
|
2162 | error('Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components');
|
2163 |
|
2164 | didWarnDefaultSelectValue = true;
|
2165 | }
|
2166 | }
|
2167 |
|
2168 | target.push(startChunkForTag('select'));
|
2169 | var children = null;
|
2170 | var innerHTML = null;
|
2171 |
|
2172 | for (var propKey in props) {
|
2173 | if (hasOwnProperty.call(props, propKey)) {
|
2174 | var propValue = props[propKey];
|
2175 |
|
2176 | if (propValue == null) {
|
2177 | continue;
|
2178 | }
|
2179 |
|
2180 | switch (propKey) {
|
2181 | case 'children':
|
2182 | children = propValue;
|
2183 | break;
|
2184 |
|
2185 | case 'dangerouslySetInnerHTML':
|
2186 |
|
2187 |
|
2188 | innerHTML = propValue;
|
2189 | break;
|
2190 |
|
2191 | case 'defaultValue':
|
2192 | case 'value':
|
2193 |
|
2194 | break;
|
2195 |
|
2196 | default:
|
2197 | pushAttribute(target, responseState, propKey, propValue);
|
2198 | break;
|
2199 | }
|
2200 | }
|
2201 | }
|
2202 |
|
2203 | target.push(endOfStartTag);
|
2204 | pushInnerHTML(target, innerHTML, children);
|
2205 | return children;
|
2206 | }
|
2207 |
|
2208 | function flattenOptionChildren(children) {
|
2209 | var content = '';
|
2210 |
|
2211 |
|
2212 | React.Children.forEach(children, function (child) {
|
2213 | if (child == null) {
|
2214 | return;
|
2215 | }
|
2216 |
|
2217 | content += child;
|
2218 |
|
2219 | {
|
2220 | if (!didWarnInvalidOptionChildren && typeof child !== 'string' && typeof child !== 'number') {
|
2221 | didWarnInvalidOptionChildren = true;
|
2222 |
|
2223 | error('Cannot infer the option value of complex children. ' + 'Pass a `value` prop or use a plain string as children to <option>.');
|
2224 | }
|
2225 | }
|
2226 | });
|
2227 | return content;
|
2228 | }
|
2229 |
|
2230 | var selectedMarkerAttribute = stringToPrecomputedChunk(' selected=""');
|
2231 |
|
2232 | function pushStartOption(target, props, responseState, formatContext) {
|
2233 | var selectedValue = formatContext.selectedValue;
|
2234 | target.push(startChunkForTag('option'));
|
2235 | var children = null;
|
2236 | var value = null;
|
2237 | var selected = null;
|
2238 | var innerHTML = null;
|
2239 |
|
2240 | for (var propKey in props) {
|
2241 | if (hasOwnProperty.call(props, propKey)) {
|
2242 | var propValue = props[propKey];
|
2243 |
|
2244 | if (propValue == null) {
|
2245 | continue;
|
2246 | }
|
2247 |
|
2248 | switch (propKey) {
|
2249 | case 'children':
|
2250 | children = propValue;
|
2251 | break;
|
2252 |
|
2253 | case 'selected':
|
2254 |
|
2255 | selected = propValue;
|
2256 |
|
2257 | {
|
2258 |
|
2259 | if (!didWarnSelectedSetOnOption) {
|
2260 | error('Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.');
|
2261 |
|
2262 | didWarnSelectedSetOnOption = true;
|
2263 | }
|
2264 | }
|
2265 |
|
2266 | break;
|
2267 |
|
2268 | case 'dangerouslySetInnerHTML':
|
2269 | innerHTML = propValue;
|
2270 | break;
|
2271 |
|
2272 |
|
2273 | case 'value':
|
2274 | value = propValue;
|
2275 |
|
2276 |
|
2277 |
|
2278 | default:
|
2279 | pushAttribute(target, responseState, propKey, propValue);
|
2280 | break;
|
2281 | }
|
2282 | }
|
2283 | }
|
2284 |
|
2285 | if (selectedValue != null) {
|
2286 | var stringValue;
|
2287 |
|
2288 | if (value !== null) {
|
2289 | {
|
2290 | checkAttributeStringCoercion(value, 'value');
|
2291 | }
|
2292 |
|
2293 | stringValue = '' + value;
|
2294 | } else {
|
2295 | {
|
2296 | if (innerHTML !== null) {
|
2297 | if (!didWarnInvalidOptionInnerHTML) {
|
2298 | didWarnInvalidOptionInnerHTML = true;
|
2299 |
|
2300 | error('Pass a `value` prop if you set dangerouslyInnerHTML so React knows ' + 'which value should be selected.');
|
2301 | }
|
2302 | }
|
2303 | }
|
2304 |
|
2305 | stringValue = flattenOptionChildren(children);
|
2306 | }
|
2307 |
|
2308 | if (isArray(selectedValue)) {
|
2309 |
|
2310 | for (var i = 0; i < selectedValue.length; i++) {
|
2311 | {
|
2312 | checkAttributeStringCoercion(selectedValue[i], 'value');
|
2313 | }
|
2314 |
|
2315 | var v = '' + selectedValue[i];
|
2316 |
|
2317 | if (v === stringValue) {
|
2318 | target.push(selectedMarkerAttribute);
|
2319 | break;
|
2320 | }
|
2321 | }
|
2322 | } else {
|
2323 | {
|
2324 | checkAttributeStringCoercion(selectedValue, 'select.value');
|
2325 | }
|
2326 |
|
2327 | if ('' + selectedValue === stringValue) {
|
2328 | target.push(selectedMarkerAttribute);
|
2329 | }
|
2330 | }
|
2331 | } else if (selected) {
|
2332 | target.push(selectedMarkerAttribute);
|
2333 | }
|
2334 |
|
2335 | target.push(endOfStartTag);
|
2336 | pushInnerHTML(target, innerHTML, children);
|
2337 | return children;
|
2338 | }
|
2339 |
|
2340 | function pushInput(target, props, responseState) {
|
2341 | {
|
2342 | checkControlledValueProps('input', props);
|
2343 |
|
2344 | if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnDefaultChecked) {
|
2345 | error('%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components', 'A component', props.type);
|
2346 |
|
2347 | didWarnDefaultChecked = true;
|
2348 | }
|
2349 |
|
2350 | if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultInputValue) {
|
2351 | error('%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components', 'A component', props.type);
|
2352 |
|
2353 | didWarnDefaultInputValue = true;
|
2354 | }
|
2355 | }
|
2356 |
|
2357 | target.push(startChunkForTag('input'));
|
2358 | var value = null;
|
2359 | var defaultValue = null;
|
2360 | var checked = null;
|
2361 | var defaultChecked = null;
|
2362 |
|
2363 | for (var propKey in props) {
|
2364 | if (hasOwnProperty.call(props, propKey)) {
|
2365 | var propValue = props[propKey];
|
2366 |
|
2367 | if (propValue == null) {
|
2368 | continue;
|
2369 | }
|
2370 |
|
2371 | switch (propKey) {
|
2372 | case 'children':
|
2373 | case 'dangerouslySetInnerHTML':
|
2374 | throw new Error('input' + " is a self-closing tag and must neither have `children` nor " + 'use `dangerouslySetInnerHTML`.');
|
2375 |
|
2376 |
|
2377 | case 'defaultChecked':
|
2378 | defaultChecked = propValue;
|
2379 | break;
|
2380 |
|
2381 | case 'defaultValue':
|
2382 | defaultValue = propValue;
|
2383 | break;
|
2384 |
|
2385 | case 'checked':
|
2386 | checked = propValue;
|
2387 | break;
|
2388 |
|
2389 | case 'value':
|
2390 | value = propValue;
|
2391 | break;
|
2392 |
|
2393 | default:
|
2394 | pushAttribute(target, responseState, propKey, propValue);
|
2395 | break;
|
2396 | }
|
2397 | }
|
2398 | }
|
2399 |
|
2400 | if (checked !== null) {
|
2401 | pushAttribute(target, responseState, 'checked', checked);
|
2402 | } else if (defaultChecked !== null) {
|
2403 | pushAttribute(target, responseState, 'checked', defaultChecked);
|
2404 | }
|
2405 |
|
2406 | if (value !== null) {
|
2407 | pushAttribute(target, responseState, 'value', value);
|
2408 | } else if (defaultValue !== null) {
|
2409 | pushAttribute(target, responseState, 'value', defaultValue);
|
2410 | }
|
2411 |
|
2412 | target.push(endOfStartTagSelfClosing);
|
2413 | return null;
|
2414 | }
|
2415 |
|
2416 | function pushStartTextArea(target, props, responseState) {
|
2417 | {
|
2418 | checkControlledValueProps('textarea', props);
|
2419 |
|
2420 | if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultTextareaValue) {
|
2421 | error('Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components');
|
2422 |
|
2423 | didWarnDefaultTextareaValue = true;
|
2424 | }
|
2425 | }
|
2426 |
|
2427 | target.push(startChunkForTag('textarea'));
|
2428 | var value = null;
|
2429 | var defaultValue = null;
|
2430 | var children = null;
|
2431 |
|
2432 | for (var propKey in props) {
|
2433 | if (hasOwnProperty.call(props, propKey)) {
|
2434 | var propValue = props[propKey];
|
2435 |
|
2436 | if (propValue == null) {
|
2437 | continue;
|
2438 | }
|
2439 |
|
2440 | switch (propKey) {
|
2441 | case 'children':
|
2442 | children = propValue;
|
2443 | break;
|
2444 |
|
2445 | case 'value':
|
2446 | value = propValue;
|
2447 | break;
|
2448 |
|
2449 | case 'defaultValue':
|
2450 | defaultValue = propValue;
|
2451 | break;
|
2452 |
|
2453 | case 'dangerouslySetInnerHTML':
|
2454 | throw new Error('`dangerouslySetInnerHTML` does not make sense on <textarea>.');
|
2455 |
|
2456 |
|
2457 | default:
|
2458 | pushAttribute(target, responseState, propKey, propValue);
|
2459 | break;
|
2460 | }
|
2461 | }
|
2462 | }
|
2463 |
|
2464 | if (value === null && defaultValue !== null) {
|
2465 | value = defaultValue;
|
2466 | }
|
2467 |
|
2468 | target.push(endOfStartTag);
|
2469 |
|
2470 | if (children != null) {
|
2471 | {
|
2472 | error('Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
|
2473 | }
|
2474 |
|
2475 | if (value != null) {
|
2476 | throw new Error('If you supply `defaultValue` on a <textarea>, do not pass children.');
|
2477 | }
|
2478 |
|
2479 | if (isArray(children)) {
|
2480 | if (children.length > 1) {
|
2481 | throw new Error('<textarea> can only have at most one child.');
|
2482 | }
|
2483 |
|
2484 |
|
2485 |
|
2486 | {
|
2487 | checkHtmlStringCoercion(children[0]);
|
2488 | }
|
2489 |
|
2490 | value = '' + children[0];
|
2491 | }
|
2492 |
|
2493 | {
|
2494 | checkHtmlStringCoercion(children);
|
2495 | }
|
2496 |
|
2497 | value = '' + children;
|
2498 | }
|
2499 |
|
2500 | if (typeof value === 'string' && value[0] === '\n') {
|
2501 |
|
2502 |
|
2503 |
|
2504 |
|
2505 |
|
2506 |
|
2507 |
|
2508 |
|
2509 |
|
2510 |
|
2511 | target.push(leadingNewline);
|
2512 | }
|
2513 |
|
2514 |
|
2515 |
|
2516 |
|
2517 | if (value !== null) {
|
2518 | {
|
2519 | checkAttributeStringCoercion(value, 'value');
|
2520 | }
|
2521 |
|
2522 | target.push(stringToChunk(encodeHTMLTextNode('' + value)));
|
2523 | }
|
2524 |
|
2525 | return null;
|
2526 | }
|
2527 |
|
2528 | function pushSelfClosing(target, props, tag, responseState) {
|
2529 | target.push(startChunkForTag(tag));
|
2530 |
|
2531 | for (var propKey in props) {
|
2532 | if (hasOwnProperty.call(props, propKey)) {
|
2533 | var propValue = props[propKey];
|
2534 |
|
2535 | if (propValue == null) {
|
2536 | continue;
|
2537 | }
|
2538 |
|
2539 | switch (propKey) {
|
2540 | case 'children':
|
2541 | case 'dangerouslySetInnerHTML':
|
2542 | throw new Error(tag + " is a self-closing tag and must neither have `children` nor " + 'use `dangerouslySetInnerHTML`.');
|
2543 |
|
2544 |
|
2545 | default:
|
2546 | pushAttribute(target, responseState, propKey, propValue);
|
2547 | break;
|
2548 | }
|
2549 | }
|
2550 | }
|
2551 |
|
2552 | target.push(endOfStartTagSelfClosing);
|
2553 | return null;
|
2554 | }
|
2555 |
|
2556 | function pushStartMenuItem(target, props, responseState) {
|
2557 | target.push(startChunkForTag('menuitem'));
|
2558 |
|
2559 | for (var propKey in props) {
|
2560 | if (hasOwnProperty.call(props, propKey)) {
|
2561 | var propValue = props[propKey];
|
2562 |
|
2563 | if (propValue == null) {
|
2564 | continue;
|
2565 | }
|
2566 |
|
2567 | switch (propKey) {
|
2568 | case 'children':
|
2569 | case 'dangerouslySetInnerHTML':
|
2570 | throw new Error('menuitems cannot have `children` nor `dangerouslySetInnerHTML`.');
|
2571 |
|
2572 |
|
2573 | default:
|
2574 | pushAttribute(target, responseState, propKey, propValue);
|
2575 | break;
|
2576 | }
|
2577 | }
|
2578 | }
|
2579 |
|
2580 | target.push(endOfStartTag);
|
2581 | return null;
|
2582 | }
|
2583 |
|
2584 | function pushStartTitle(target, props, responseState) {
|
2585 | target.push(startChunkForTag('title'));
|
2586 | var children = null;
|
2587 |
|
2588 | for (var propKey in props) {
|
2589 | if (hasOwnProperty.call(props, propKey)) {
|
2590 | var propValue = props[propKey];
|
2591 |
|
2592 | if (propValue == null) {
|
2593 | continue;
|
2594 | }
|
2595 |
|
2596 | switch (propKey) {
|
2597 | case 'children':
|
2598 | children = propValue;
|
2599 | break;
|
2600 |
|
2601 | case 'dangerouslySetInnerHTML':
|
2602 | throw new Error('`dangerouslySetInnerHTML` does not make sense on <title>.');
|
2603 |
|
2604 |
|
2605 | default:
|
2606 | pushAttribute(target, responseState, propKey, propValue);
|
2607 | break;
|
2608 | }
|
2609 | }
|
2610 | }
|
2611 |
|
2612 | target.push(endOfStartTag);
|
2613 |
|
2614 | {
|
2615 | var child = Array.isArray(children) && children.length < 2 ? children[0] || null : children;
|
2616 |
|
2617 | if (Array.isArray(children) && children.length > 1) {
|
2618 | error('A title element received an array with more than 1 element as children. ' + 'In browsers title Elements can only have Text Nodes as children. If ' + 'the children being rendered output more than a single text node in aggregate the browser ' + 'will display markup and comments as text in the title and hydration will likely fail and ' + 'fall back to client rendering');
|
2619 | } else if (child != null && child.$$typeof != null) {
|
2620 | error('A title element received a React element for children. ' + 'In the browser title Elements can only have Text Nodes as children. If ' + 'the children being rendered output more than a single text node in aggregate the browser ' + 'will display markup and comments as text in the title and hydration will likely fail and ' + 'fall back to client rendering');
|
2621 | } else if (child != null && typeof child !== 'string' && typeof child !== 'number') {
|
2622 | error('A title element received a value that was not a string or number for children. ' + 'In the browser title Elements can only have Text Nodes as children. If ' + 'the children being rendered output more than a single text node in aggregate the browser ' + 'will display markup and comments as text in the title and hydration will likely fail and ' + 'fall back to client rendering');
|
2623 | }
|
2624 | }
|
2625 |
|
2626 | return children;
|
2627 | }
|
2628 |
|
2629 | function pushStartGenericElement(target, props, tag, responseState) {
|
2630 | target.push(startChunkForTag(tag));
|
2631 | var children = null;
|
2632 | var innerHTML = null;
|
2633 |
|
2634 | for (var propKey in props) {
|
2635 | if (hasOwnProperty.call(props, propKey)) {
|
2636 | var propValue = props[propKey];
|
2637 |
|
2638 | if (propValue == null) {
|
2639 | continue;
|
2640 | }
|
2641 |
|
2642 | switch (propKey) {
|
2643 | case 'children':
|
2644 | children = propValue;
|
2645 | break;
|
2646 |
|
2647 | case 'dangerouslySetInnerHTML':
|
2648 | innerHTML = propValue;
|
2649 | break;
|
2650 |
|
2651 | default:
|
2652 | pushAttribute(target, responseState, propKey, propValue);
|
2653 | break;
|
2654 | }
|
2655 | }
|
2656 | }
|
2657 |
|
2658 | target.push(endOfStartTag);
|
2659 | pushInnerHTML(target, innerHTML, children);
|
2660 |
|
2661 | if (typeof children === 'string') {
|
2662 |
|
2663 |
|
2664 | target.push(stringToChunk(encodeHTMLTextNode(children)));
|
2665 | return null;
|
2666 | }
|
2667 |
|
2668 | return children;
|
2669 | }
|
2670 |
|
2671 | function pushStartCustomElement(target, props, tag, responseState) {
|
2672 | target.push(startChunkForTag(tag));
|
2673 | var children = null;
|
2674 | var innerHTML = null;
|
2675 |
|
2676 | for (var propKey in props) {
|
2677 | if (hasOwnProperty.call(props, propKey)) {
|
2678 | var propValue = props[propKey];
|
2679 |
|
2680 | if (propValue == null) {
|
2681 | continue;
|
2682 | }
|
2683 |
|
2684 | switch (propKey) {
|
2685 | case 'children':
|
2686 | children = propValue;
|
2687 | break;
|
2688 |
|
2689 | case 'dangerouslySetInnerHTML':
|
2690 | innerHTML = propValue;
|
2691 | break;
|
2692 |
|
2693 | case 'style':
|
2694 | pushStyle(target, responseState, propValue);
|
2695 | break;
|
2696 |
|
2697 | case 'suppressContentEditableWarning':
|
2698 | case 'suppressHydrationWarning':
|
2699 |
|
2700 | break;
|
2701 |
|
2702 | default:
|
2703 | if (isAttributeNameSafe(propKey) && typeof propValue !== 'function' && typeof propValue !== 'symbol') {
|
2704 | target.push(attributeSeparator, stringToChunk(propKey), attributeAssign, stringToChunk(escapeTextForBrowser(propValue)), attributeEnd);
|
2705 | }
|
2706 |
|
2707 | break;
|
2708 | }
|
2709 | }
|
2710 | }
|
2711 |
|
2712 | target.push(endOfStartTag);
|
2713 | pushInnerHTML(target, innerHTML, children);
|
2714 | return children;
|
2715 | }
|
2716 |
|
2717 | var leadingNewline = stringToPrecomputedChunk('\n');
|
2718 |
|
2719 | function pushStartPreformattedElement(target, props, tag, responseState) {
|
2720 | target.push(startChunkForTag(tag));
|
2721 | var children = null;
|
2722 | var innerHTML = null;
|
2723 |
|
2724 | for (var propKey in props) {
|
2725 | if (hasOwnProperty.call(props, propKey)) {
|
2726 | var propValue = props[propKey];
|
2727 |
|
2728 | if (propValue == null) {
|
2729 | continue;
|
2730 | }
|
2731 |
|
2732 | switch (propKey) {
|
2733 | case 'children':
|
2734 | children = propValue;
|
2735 | break;
|
2736 |
|
2737 | case 'dangerouslySetInnerHTML':
|
2738 | innerHTML = propValue;
|
2739 | break;
|
2740 |
|
2741 | default:
|
2742 | pushAttribute(target, responseState, propKey, propValue);
|
2743 | break;
|
2744 | }
|
2745 | }
|
2746 | }
|
2747 |
|
2748 | target.push(endOfStartTag);
|
2749 |
|
2750 |
|
2751 |
|
2752 |
|
2753 |
|
2754 |
|
2755 |
|
2756 |
|
2757 |
|
2758 |
|
2759 |
|
2760 |
|
2761 | if (innerHTML != null) {
|
2762 | if (children != null) {
|
2763 | throw new Error('Can only set one of `children` or `props.dangerouslySetInnerHTML`.');
|
2764 | }
|
2765 |
|
2766 | if (typeof innerHTML !== 'object' || !('__html' in innerHTML)) {
|
2767 | throw new Error('`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://reactjs.org/link/dangerously-set-inner-html ' + 'for more information.');
|
2768 | }
|
2769 |
|
2770 | var html = innerHTML.__html;
|
2771 |
|
2772 | if (html !== null && html !== undefined) {
|
2773 | if (typeof html === 'string' && html.length > 0 && html[0] === '\n') {
|
2774 | target.push(leadingNewline, stringToChunk(html));
|
2775 | } else {
|
2776 | {
|
2777 | checkHtmlStringCoercion(html);
|
2778 | }
|
2779 |
|
2780 | target.push(stringToChunk('' + html));
|
2781 | }
|
2782 | }
|
2783 | }
|
2784 |
|
2785 | if (typeof children === 'string' && children[0] === '\n') {
|
2786 | target.push(leadingNewline);
|
2787 | }
|
2788 |
|
2789 | return children;
|
2790 | }
|
2791 |
|
2792 |
|
2793 |
|
2794 |
|
2795 | var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/;
|
2796 |
|
2797 | var validatedTagCache = new Map();
|
2798 |
|
2799 | function startChunkForTag(tag) {
|
2800 | var tagStartChunk = validatedTagCache.get(tag);
|
2801 |
|
2802 | if (tagStartChunk === undefined) {
|
2803 | if (!VALID_TAG_REGEX.test(tag)) {
|
2804 | throw new Error("Invalid tag: " + tag);
|
2805 | }
|
2806 |
|
2807 | tagStartChunk = stringToPrecomputedChunk('<' + tag);
|
2808 | validatedTagCache.set(tag, tagStartChunk);
|
2809 | }
|
2810 |
|
2811 | return tagStartChunk;
|
2812 | }
|
2813 |
|
2814 | var DOCTYPE = stringToPrecomputedChunk('<!DOCTYPE html>');
|
2815 | function pushStartInstance(target, type, props, responseState, formatContext) {
|
2816 | {
|
2817 | validateProperties(type, props);
|
2818 | validateProperties$1(type, props);
|
2819 | validateProperties$2(type, props, null);
|
2820 |
|
2821 | if (!props.suppressContentEditableWarning && props.contentEditable && props.children != null) {
|
2822 | error('A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.');
|
2823 | }
|
2824 |
|
2825 | if (formatContext.insertionMode !== SVG_MODE && formatContext.insertionMode !== MATHML_MODE) {
|
2826 | if (type.indexOf('-') === -1 && typeof props.is !== 'string' && type.toLowerCase() !== type) {
|
2827 | error('<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', type);
|
2828 | }
|
2829 | }
|
2830 | }
|
2831 |
|
2832 | switch (type) {
|
2833 |
|
2834 | case 'select':
|
2835 | return pushStartSelect(target, props, responseState);
|
2836 |
|
2837 | case 'option':
|
2838 | return pushStartOption(target, props, responseState, formatContext);
|
2839 |
|
2840 | case 'textarea':
|
2841 | return pushStartTextArea(target, props, responseState);
|
2842 |
|
2843 | case 'input':
|
2844 | return pushInput(target, props, responseState);
|
2845 |
|
2846 | case 'menuitem':
|
2847 | return pushStartMenuItem(target, props, responseState);
|
2848 |
|
2849 | case 'title':
|
2850 | return pushStartTitle(target, props, responseState);
|
2851 |
|
2852 |
|
2853 | case 'listing':
|
2854 | case 'pre':
|
2855 | {
|
2856 | return pushStartPreformattedElement(target, props, type, responseState);
|
2857 | }
|
2858 |
|
2859 |
|
2860 | case 'area':
|
2861 | case 'base':
|
2862 | case 'br':
|
2863 | case 'col':
|
2864 | case 'embed':
|
2865 | case 'hr':
|
2866 | case 'img':
|
2867 | case 'keygen':
|
2868 | case 'link':
|
2869 | case 'meta':
|
2870 | case 'param':
|
2871 | case 'source':
|
2872 | case 'track':
|
2873 | case 'wbr':
|
2874 | {
|
2875 | return pushSelfClosing(target, props, type, responseState);
|
2876 | }
|
2877 |
|
2878 |
|
2879 |
|
2880 | case 'annotation-xml':
|
2881 | case 'color-profile':
|
2882 | case 'font-face':
|
2883 | case 'font-face-src':
|
2884 | case 'font-face-uri':
|
2885 | case 'font-face-format':
|
2886 | case 'font-face-name':
|
2887 | case 'missing-glyph':
|
2888 | {
|
2889 | return pushStartGenericElement(target, props, type, responseState);
|
2890 | }
|
2891 |
|
2892 | case 'html':
|
2893 | {
|
2894 | if (formatContext.insertionMode === ROOT_HTML_MODE) {
|
2895 |
|
2896 |
|
2897 |
|
2898 | target.push(DOCTYPE);
|
2899 | }
|
2900 |
|
2901 | return pushStartGenericElement(target, props, type, responseState);
|
2902 | }
|
2903 |
|
2904 | default:
|
2905 | {
|
2906 | if (type.indexOf('-') === -1 && typeof props.is !== 'string') {
|
2907 |
|
2908 | return pushStartGenericElement(target, props, type, responseState);
|
2909 | } else {
|
2910 |
|
2911 | return pushStartCustomElement(target, props, type, responseState);
|
2912 | }
|
2913 | }
|
2914 | }
|
2915 | }
|
2916 | var endTag1 = stringToPrecomputedChunk('</');
|
2917 | var endTag2 = stringToPrecomputedChunk('>');
|
2918 | function pushEndInstance(target, type, props) {
|
2919 | switch (type) {
|
2920 |
|
2921 |
|
2922 |
|
2923 | case 'area':
|
2924 | case 'base':
|
2925 | case 'br':
|
2926 | case 'col':
|
2927 | case 'embed':
|
2928 | case 'hr':
|
2929 | case 'img':
|
2930 | case 'input':
|
2931 | case 'keygen':
|
2932 | case 'link':
|
2933 | case 'meta':
|
2934 | case 'param':
|
2935 | case 'source':
|
2936 | case 'track':
|
2937 | case 'wbr':
|
2938 | {
|
2939 |
|
2940 | break;
|
2941 | }
|
2942 |
|
2943 | default:
|
2944 | {
|
2945 | target.push(endTag1, stringToChunk(type), endTag2);
|
2946 | }
|
2947 | }
|
2948 | }
|
2949 | function writeCompletedRoot(destination, responseState) {
|
2950 | var bootstrapChunks = responseState.bootstrapChunks;
|
2951 | var i = 0;
|
2952 |
|
2953 | for (; i < bootstrapChunks.length - 1; i++) {
|
2954 | writeChunk(destination, bootstrapChunks[i]);
|
2955 | }
|
2956 |
|
2957 | if (i < bootstrapChunks.length) {
|
2958 | return writeChunkAndReturn(destination, bootstrapChunks[i]);
|
2959 | }
|
2960 |
|
2961 | return true;
|
2962 | }
|
2963 |
|
2964 |
|
2965 |
|
2966 |
|
2967 | var placeholder1 = stringToPrecomputedChunk('<template id="');
|
2968 | var placeholder2 = stringToPrecomputedChunk('"></template>');
|
2969 | function writePlaceholder(destination, responseState, id) {
|
2970 | writeChunk(destination, placeholder1);
|
2971 | writeChunk(destination, responseState.placeholderPrefix);
|
2972 | var formattedID = stringToChunk(id.toString(16));
|
2973 | writeChunk(destination, formattedID);
|
2974 | return writeChunkAndReturn(destination, placeholder2);
|
2975 | }
|
2976 |
|
2977 | var startCompletedSuspenseBoundary = stringToPrecomputedChunk('<!--$-->');
|
2978 | var startPendingSuspenseBoundary1 = stringToPrecomputedChunk('<!--$?--><template id="');
|
2979 | var startPendingSuspenseBoundary2 = stringToPrecomputedChunk('"></template>');
|
2980 | var startClientRenderedSuspenseBoundary = stringToPrecomputedChunk('<!--$!-->');
|
2981 | var endSuspenseBoundary = stringToPrecomputedChunk('<!--/$-->');
|
2982 | var clientRenderedSuspenseBoundaryError1 = stringToPrecomputedChunk('<template');
|
2983 | var clientRenderedSuspenseBoundaryErrorAttrInterstitial = stringToPrecomputedChunk('"');
|
2984 | var clientRenderedSuspenseBoundaryError1A = stringToPrecomputedChunk(' data-dgst="');
|
2985 | var clientRenderedSuspenseBoundaryError1B = stringToPrecomputedChunk(' data-msg="');
|
2986 | var clientRenderedSuspenseBoundaryError1C = stringToPrecomputedChunk(' data-stck="');
|
2987 | var clientRenderedSuspenseBoundaryError2 = stringToPrecomputedChunk('></template>');
|
2988 | function writeStartCompletedSuspenseBoundary(destination, responseState) {
|
2989 | return writeChunkAndReturn(destination, startCompletedSuspenseBoundary);
|
2990 | }
|
2991 | function writeStartPendingSuspenseBoundary(destination, responseState, id) {
|
2992 | writeChunk(destination, startPendingSuspenseBoundary1);
|
2993 |
|
2994 | if (id === null) {
|
2995 | throw new Error('An ID must have been assigned before we can complete the boundary.');
|
2996 | }
|
2997 |
|
2998 | writeChunk(destination, id);
|
2999 | return writeChunkAndReturn(destination, startPendingSuspenseBoundary2);
|
3000 | }
|
3001 | function writeStartClientRenderedSuspenseBoundary(destination, responseState, errorDigest, errorMesssage, errorComponentStack) {
|
3002 | var result;
|
3003 | result = writeChunkAndReturn(destination, startClientRenderedSuspenseBoundary);
|
3004 | writeChunk(destination, clientRenderedSuspenseBoundaryError1);
|
3005 |
|
3006 | if (errorDigest) {
|
3007 | writeChunk(destination, clientRenderedSuspenseBoundaryError1A);
|
3008 | writeChunk(destination, stringToChunk(escapeTextForBrowser(errorDigest)));
|
3009 | writeChunk(destination, clientRenderedSuspenseBoundaryErrorAttrInterstitial);
|
3010 | }
|
3011 |
|
3012 | {
|
3013 | if (errorMesssage) {
|
3014 | writeChunk(destination, clientRenderedSuspenseBoundaryError1B);
|
3015 | writeChunk(destination, stringToChunk(escapeTextForBrowser(errorMesssage)));
|
3016 | writeChunk(destination, clientRenderedSuspenseBoundaryErrorAttrInterstitial);
|
3017 | }
|
3018 |
|
3019 | if (errorComponentStack) {
|
3020 | writeChunk(destination, clientRenderedSuspenseBoundaryError1C);
|
3021 | writeChunk(destination, stringToChunk(escapeTextForBrowser(errorComponentStack)));
|
3022 | writeChunk(destination, clientRenderedSuspenseBoundaryErrorAttrInterstitial);
|
3023 | }
|
3024 | }
|
3025 |
|
3026 | result = writeChunkAndReturn(destination, clientRenderedSuspenseBoundaryError2);
|
3027 | return result;
|
3028 | }
|
3029 | function writeEndCompletedSuspenseBoundary(destination, responseState) {
|
3030 | return writeChunkAndReturn(destination, endSuspenseBoundary);
|
3031 | }
|
3032 | function writeEndPendingSuspenseBoundary(destination, responseState) {
|
3033 | return writeChunkAndReturn(destination, endSuspenseBoundary);
|
3034 | }
|
3035 | function writeEndClientRenderedSuspenseBoundary(destination, responseState) {
|
3036 | return writeChunkAndReturn(destination, endSuspenseBoundary);
|
3037 | }
|
3038 | var startSegmentHTML = stringToPrecomputedChunk('<div hidden id="');
|
3039 | var startSegmentHTML2 = stringToPrecomputedChunk('">');
|
3040 | var endSegmentHTML = stringToPrecomputedChunk('</div>');
|
3041 | var startSegmentSVG = stringToPrecomputedChunk('<svg aria-hidden="true" style="display:none" id="');
|
3042 | var startSegmentSVG2 = stringToPrecomputedChunk('">');
|
3043 | var endSegmentSVG = stringToPrecomputedChunk('</svg>');
|
3044 | var startSegmentMathML = stringToPrecomputedChunk('<math aria-hidden="true" style="display:none" id="');
|
3045 | var startSegmentMathML2 = stringToPrecomputedChunk('">');
|
3046 | var endSegmentMathML = stringToPrecomputedChunk('</math>');
|
3047 | var startSegmentTable = stringToPrecomputedChunk('<table hidden id="');
|
3048 | var startSegmentTable2 = stringToPrecomputedChunk('">');
|
3049 | var endSegmentTable = stringToPrecomputedChunk('</table>');
|
3050 | var startSegmentTableBody = stringToPrecomputedChunk('<table hidden><tbody id="');
|
3051 | var startSegmentTableBody2 = stringToPrecomputedChunk('">');
|
3052 | var endSegmentTableBody = stringToPrecomputedChunk('</tbody></table>');
|
3053 | var startSegmentTableRow = stringToPrecomputedChunk('<table hidden><tr id="');
|
3054 | var startSegmentTableRow2 = stringToPrecomputedChunk('">');
|
3055 | var endSegmentTableRow = stringToPrecomputedChunk('</tr></table>');
|
3056 | var startSegmentColGroup = stringToPrecomputedChunk('<table hidden><colgroup id="');
|
3057 | var startSegmentColGroup2 = stringToPrecomputedChunk('">');
|
3058 | var endSegmentColGroup = stringToPrecomputedChunk('</colgroup></table>');
|
3059 | function writeStartSegment(destination, responseState, formatContext, id) {
|
3060 | switch (formatContext.insertionMode) {
|
3061 | case ROOT_HTML_MODE:
|
3062 | case HTML_MODE:
|
3063 | {
|
3064 | writeChunk(destination, startSegmentHTML);
|
3065 | writeChunk(destination, responseState.segmentPrefix);
|
3066 | writeChunk(destination, stringToChunk(id.toString(16)));
|
3067 | return writeChunkAndReturn(destination, startSegmentHTML2);
|
3068 | }
|
3069 |
|
3070 | case SVG_MODE:
|
3071 | {
|
3072 | writeChunk(destination, startSegmentSVG);
|
3073 | writeChunk(destination, responseState.segmentPrefix);
|
3074 | writeChunk(destination, stringToChunk(id.toString(16)));
|
3075 | return writeChunkAndReturn(destination, startSegmentSVG2);
|
3076 | }
|
3077 |
|
3078 | case MATHML_MODE:
|
3079 | {
|
3080 | writeChunk(destination, startSegmentMathML);
|
3081 | writeChunk(destination, responseState.segmentPrefix);
|
3082 | writeChunk(destination, stringToChunk(id.toString(16)));
|
3083 | return writeChunkAndReturn(destination, startSegmentMathML2);
|
3084 | }
|
3085 |
|
3086 | case HTML_TABLE_MODE:
|
3087 | {
|
3088 | writeChunk(destination, startSegmentTable);
|
3089 | writeChunk(destination, responseState.segmentPrefix);
|
3090 | writeChunk(destination, stringToChunk(id.toString(16)));
|
3091 | return writeChunkAndReturn(destination, startSegmentTable2);
|
3092 | }
|
3093 |
|
3094 |
|
3095 |
|
3096 |
|
3097 |
|
3098 | case HTML_TABLE_BODY_MODE:
|
3099 | {
|
3100 | writeChunk(destination, startSegmentTableBody);
|
3101 | writeChunk(destination, responseState.segmentPrefix);
|
3102 | writeChunk(destination, stringToChunk(id.toString(16)));
|
3103 | return writeChunkAndReturn(destination, startSegmentTableBody2);
|
3104 | }
|
3105 |
|
3106 | case HTML_TABLE_ROW_MODE:
|
3107 | {
|
3108 | writeChunk(destination, startSegmentTableRow);
|
3109 | writeChunk(destination, responseState.segmentPrefix);
|
3110 | writeChunk(destination, stringToChunk(id.toString(16)));
|
3111 | return writeChunkAndReturn(destination, startSegmentTableRow2);
|
3112 | }
|
3113 |
|
3114 | case HTML_COLGROUP_MODE:
|
3115 | {
|
3116 | writeChunk(destination, startSegmentColGroup);
|
3117 | writeChunk(destination, responseState.segmentPrefix);
|
3118 | writeChunk(destination, stringToChunk(id.toString(16)));
|
3119 | return writeChunkAndReturn(destination, startSegmentColGroup2);
|
3120 | }
|
3121 |
|
3122 | default:
|
3123 | {
|
3124 | throw new Error('Unknown insertion mode. This is a bug in React.');
|
3125 | }
|
3126 | }
|
3127 | }
|
3128 | function writeEndSegment(destination, formatContext) {
|
3129 | switch (formatContext.insertionMode) {
|
3130 | case ROOT_HTML_MODE:
|
3131 | case HTML_MODE:
|
3132 | {
|
3133 | return writeChunkAndReturn(destination, endSegmentHTML);
|
3134 | }
|
3135 |
|
3136 | case SVG_MODE:
|
3137 | {
|
3138 | return writeChunkAndReturn(destination, endSegmentSVG);
|
3139 | }
|
3140 |
|
3141 | case MATHML_MODE:
|
3142 | {
|
3143 | return writeChunkAndReturn(destination, endSegmentMathML);
|
3144 | }
|
3145 |
|
3146 | case HTML_TABLE_MODE:
|
3147 | {
|
3148 | return writeChunkAndReturn(destination, endSegmentTable);
|
3149 | }
|
3150 |
|
3151 | case HTML_TABLE_BODY_MODE:
|
3152 | {
|
3153 | return writeChunkAndReturn(destination, endSegmentTableBody);
|
3154 | }
|
3155 |
|
3156 | case HTML_TABLE_ROW_MODE:
|
3157 | {
|
3158 | return writeChunkAndReturn(destination, endSegmentTableRow);
|
3159 | }
|
3160 |
|
3161 | case HTML_COLGROUP_MODE:
|
3162 | {
|
3163 | return writeChunkAndReturn(destination, endSegmentColGroup);
|
3164 | }
|
3165 |
|
3166 | default:
|
3167 | {
|
3168 | throw new Error('Unknown insertion mode. This is a bug in React.');
|
3169 | }
|
3170 | }
|
3171 | }
|
3172 |
|
3173 |
|
3174 |
|
3175 |
|
3176 |
|
3177 |
|
3178 |
|
3179 |
|
3180 |
|
3181 |
|
3182 |
|
3183 |
|
3184 |
|
3185 |
|
3186 |
|
3187 |
|
3188 |
|
3189 |
|
3190 |
|
3191 |
|
3192 |
|
3193 |
|
3194 |
|
3195 |
|
3196 |
|
3197 |
|
3198 |
|
3199 |
|
3200 |
|
3201 |
|
3202 |
|
3203 |
|
3204 |
|
3205 |
|
3206 |
|
3207 |
|
3208 |
|
3209 |
|
3210 |
|
3211 |
|
3212 |
|
3213 |
|
3214 |
|
3215 |
|
3216 |
|
3217 |
|
3218 |
|
3219 |
|
3220 |
|
3221 |
|
3222 |
|
3223 |
|
3224 |
|
3225 |
|
3226 |
|
3227 |
|
3228 |
|
3229 |
|
3230 |
|
3231 |
|
3232 |
|
3233 |
|
3234 |
|
3235 |
|
3236 |
|
3237 |
|
3238 |
|
3239 |
|
3240 |
|
3241 |
|
3242 |
|
3243 |
|
3244 |
|
3245 |
|
3246 |
|
3247 |
|
3248 |
|
3249 |
|
3250 |
|
3251 |
|
3252 |
|
3253 |
|
3254 |
|
3255 |
|
3256 |
|
3257 |
|
3258 |
|
3259 |
|
3260 |
|
3261 |
|
3262 |
|
3263 |
|
3264 |
|
3265 |
|
3266 |
|
3267 |
|
3268 |
|
3269 |
|
3270 |
|
3271 |
|
3272 |
|
3273 |
|
3274 |
|
3275 |
|
3276 |
|
3277 |
|
3278 | var completeSegmentFunction = 'function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)}';
|
3279 | var completeBoundaryFunction = 'function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}}';
|
3280 | var clientRenderFunction = 'function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())}';
|
3281 | var completeSegmentScript1Full = stringToPrecomputedChunk(completeSegmentFunction + ';$RS("');
|
3282 | var completeSegmentScript1Partial = stringToPrecomputedChunk('$RS("');
|
3283 | var completeSegmentScript2 = stringToPrecomputedChunk('","');
|
3284 | var completeSegmentScript3 = stringToPrecomputedChunk('")</script>');
|
3285 | function writeCompletedSegmentInstruction(destination, responseState, contentSegmentID) {
|
3286 | writeChunk(destination, responseState.startInlineScript);
|
3287 |
|
3288 | if (!responseState.sentCompleteSegmentFunction) {
|
3289 |
|
3290 | responseState.sentCompleteSegmentFunction = true;
|
3291 | writeChunk(destination, completeSegmentScript1Full);
|
3292 | } else {
|
3293 |
|
3294 | writeChunk(destination, completeSegmentScript1Partial);
|
3295 | }
|
3296 |
|
3297 | writeChunk(destination, responseState.segmentPrefix);
|
3298 | var formattedID = stringToChunk(contentSegmentID.toString(16));
|
3299 | writeChunk(destination, formattedID);
|
3300 | writeChunk(destination, completeSegmentScript2);
|
3301 | writeChunk(destination, responseState.placeholderPrefix);
|
3302 | writeChunk(destination, formattedID);
|
3303 | return writeChunkAndReturn(destination, completeSegmentScript3);
|
3304 | }
|
3305 | var completeBoundaryScript1Full = stringToPrecomputedChunk(completeBoundaryFunction + ';$RC("');
|
3306 | var completeBoundaryScript1Partial = stringToPrecomputedChunk('$RC("');
|
3307 | var completeBoundaryScript2 = stringToPrecomputedChunk('","');
|
3308 | var completeBoundaryScript3 = stringToPrecomputedChunk('")</script>');
|
3309 | function writeCompletedBoundaryInstruction(destination, responseState, boundaryID, contentSegmentID) {
|
3310 | writeChunk(destination, responseState.startInlineScript);
|
3311 |
|
3312 | if (!responseState.sentCompleteBoundaryFunction) {
|
3313 |
|
3314 | responseState.sentCompleteBoundaryFunction = true;
|
3315 | writeChunk(destination, completeBoundaryScript1Full);
|
3316 | } else {
|
3317 |
|
3318 | writeChunk(destination, completeBoundaryScript1Partial);
|
3319 | }
|
3320 |
|
3321 | if (boundaryID === null) {
|
3322 | throw new Error('An ID must have been assigned before we can complete the boundary.');
|
3323 | }
|
3324 |
|
3325 | var formattedContentID = stringToChunk(contentSegmentID.toString(16));
|
3326 | writeChunk(destination, boundaryID);
|
3327 | writeChunk(destination, completeBoundaryScript2);
|
3328 | writeChunk(destination, responseState.segmentPrefix);
|
3329 | writeChunk(destination, formattedContentID);
|
3330 | return writeChunkAndReturn(destination, completeBoundaryScript3);
|
3331 | }
|
3332 | var clientRenderScript1Full = stringToPrecomputedChunk(clientRenderFunction + ';$RX("');
|
3333 | var clientRenderScript1Partial = stringToPrecomputedChunk('$RX("');
|
3334 | var clientRenderScript1A = stringToPrecomputedChunk('"');
|
3335 | var clientRenderScript2 = stringToPrecomputedChunk(')</script>');
|
3336 | var clientRenderErrorScriptArgInterstitial = stringToPrecomputedChunk(',');
|
3337 | function writeClientRenderBoundaryInstruction(destination, responseState, boundaryID, errorDigest, errorMessage, errorComponentStack) {
|
3338 | writeChunk(destination, responseState.startInlineScript);
|
3339 |
|
3340 | if (!responseState.sentClientRenderFunction) {
|
3341 |
|
3342 | responseState.sentClientRenderFunction = true;
|
3343 | writeChunk(destination, clientRenderScript1Full);
|
3344 | } else {
|
3345 |
|
3346 | writeChunk(destination, clientRenderScript1Partial);
|
3347 | }
|
3348 |
|
3349 | if (boundaryID === null) {
|
3350 | throw new Error('An ID must have been assigned before we can complete the boundary.');
|
3351 | }
|
3352 |
|
3353 | writeChunk(destination, boundaryID);
|
3354 | writeChunk(destination, clientRenderScript1A);
|
3355 |
|
3356 | if (errorDigest || errorMessage || errorComponentStack) {
|
3357 | writeChunk(destination, clientRenderErrorScriptArgInterstitial);
|
3358 | writeChunk(destination, stringToChunk(escapeJSStringsForInstructionScripts(errorDigest || '')));
|
3359 | }
|
3360 |
|
3361 | if (errorMessage || errorComponentStack) {
|
3362 | writeChunk(destination, clientRenderErrorScriptArgInterstitial);
|
3363 | writeChunk(destination, stringToChunk(escapeJSStringsForInstructionScripts(errorMessage || '')));
|
3364 | }
|
3365 |
|
3366 | if (errorComponentStack) {
|
3367 | writeChunk(destination, clientRenderErrorScriptArgInterstitial);
|
3368 | writeChunk(destination, stringToChunk(escapeJSStringsForInstructionScripts(errorComponentStack)));
|
3369 | }
|
3370 |
|
3371 | return writeChunkAndReturn(destination, clientRenderScript2);
|
3372 | }
|
3373 | var regexForJSStringsInScripts = /[<\u2028\u2029]/g;
|
3374 |
|
3375 | function escapeJSStringsForInstructionScripts(input) {
|
3376 | var escaped = JSON.stringify(input);
|
3377 | return escaped.replace(regexForJSStringsInScripts, function (match) {
|
3378 | switch (match) {
|
3379 |
|
3380 | case '<':
|
3381 | return "\\u003c";
|
3382 |
|
3383 | case "\u2028":
|
3384 | return "\\u2028";
|
3385 |
|
3386 | case "\u2029":
|
3387 | return "\\u2029";
|
3388 |
|
3389 | default:
|
3390 | {
|
3391 |
|
3392 | throw new Error('escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no longer in sync. This is a bug in React');
|
3393 | }
|
3394 | }
|
3395 | });
|
3396 | }
|
3397 |
|
3398 | var assign = Object.assign;
|
3399 |
|
3400 |
|
3401 |
|
3402 |
|
3403 |
|
3404 | var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
3405 | var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
3406 | var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
3407 | var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
3408 | var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
3409 | var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
3410 | var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
3411 | var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
3412 | var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
3413 | var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
3414 | var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
3415 | var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
3416 | var REACT_SCOPE_TYPE = Symbol.for('react.scope');
|
3417 | var REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for('react.debug_trace_mode');
|
3418 | var REACT_LEGACY_HIDDEN_TYPE = Symbol.for('react.legacy_hidden');
|
3419 | var REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for('react.default_value');
|
3420 | var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
3421 | var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
3422 | function getIteratorFn(maybeIterable) {
|
3423 | if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
3424 | return null;
|
3425 | }
|
3426 |
|
3427 | var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
3428 |
|
3429 | if (typeof maybeIterator === 'function') {
|
3430 | return maybeIterator;
|
3431 | }
|
3432 |
|
3433 | return null;
|
3434 | }
|
3435 |
|
3436 | function getWrappedName(outerType, innerType, wrapperName) {
|
3437 | var displayName = outerType.displayName;
|
3438 |
|
3439 | if (displayName) {
|
3440 | return displayName;
|
3441 | }
|
3442 |
|
3443 | var functionName = innerType.displayName || innerType.name || '';
|
3444 | return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
3445 | }
|
3446 |
|
3447 |
|
3448 | function getContextName(type) {
|
3449 | return type.displayName || 'Context';
|
3450 | }
|
3451 |
|
3452 |
|
3453 | function getComponentNameFromType(type) {
|
3454 | if (type == null) {
|
3455 |
|
3456 | return null;
|
3457 | }
|
3458 |
|
3459 | {
|
3460 | if (typeof type.tag === 'number') {
|
3461 | error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
3462 | }
|
3463 | }
|
3464 |
|
3465 | if (typeof type === 'function') {
|
3466 | return type.displayName || type.name || null;
|
3467 | }
|
3468 |
|
3469 | if (typeof type === 'string') {
|
3470 | return type;
|
3471 | }
|
3472 |
|
3473 | switch (type) {
|
3474 | case REACT_FRAGMENT_TYPE:
|
3475 | return 'Fragment';
|
3476 |
|
3477 | case REACT_PORTAL_TYPE:
|
3478 | return 'Portal';
|
3479 |
|
3480 | case REACT_PROFILER_TYPE:
|
3481 | return 'Profiler';
|
3482 |
|
3483 | case REACT_STRICT_MODE_TYPE:
|
3484 | return 'StrictMode';
|
3485 |
|
3486 | case REACT_SUSPENSE_TYPE:
|
3487 | return 'Suspense';
|
3488 |
|
3489 | case REACT_SUSPENSE_LIST_TYPE:
|
3490 | return 'SuspenseList';
|
3491 |
|
3492 | }
|
3493 |
|
3494 | if (typeof type === 'object') {
|
3495 | switch (type.$$typeof) {
|
3496 | case REACT_CONTEXT_TYPE:
|
3497 | var context = type;
|
3498 | return getContextName(context) + '.Consumer';
|
3499 |
|
3500 | case REACT_PROVIDER_TYPE:
|
3501 | var provider = type;
|
3502 | return getContextName(provider._context) + '.Provider';
|
3503 |
|
3504 | case REACT_FORWARD_REF_TYPE:
|
3505 | return getWrappedName(type, type.render, 'ForwardRef');
|
3506 |
|
3507 | case REACT_MEMO_TYPE:
|
3508 | var outerName = type.displayName || null;
|
3509 |
|
3510 | if (outerName !== null) {
|
3511 | return outerName;
|
3512 | }
|
3513 |
|
3514 | return getComponentNameFromType(type.type) || 'Memo';
|
3515 |
|
3516 | case REACT_LAZY_TYPE:
|
3517 | {
|
3518 | var lazyComponent = type;
|
3519 | var payload = lazyComponent._payload;
|
3520 | var init = lazyComponent._init;
|
3521 |
|
3522 | try {
|
3523 | return getComponentNameFromType(init(payload));
|
3524 | } catch (x) {
|
3525 | return null;
|
3526 | }
|
3527 | }
|
3528 |
|
3529 |
|
3530 | }
|
3531 | }
|
3532 |
|
3533 | return null;
|
3534 | }
|
3535 |
|
3536 |
|
3537 |
|
3538 |
|
3539 |
|
3540 | var disabledDepth = 0;
|
3541 | var prevLog;
|
3542 | var prevInfo;
|
3543 | var prevWarn;
|
3544 | var prevError;
|
3545 | var prevGroup;
|
3546 | var prevGroupCollapsed;
|
3547 | var prevGroupEnd;
|
3548 |
|
3549 | function disabledLog() {}
|
3550 |
|
3551 | disabledLog.__reactDisabledLog = true;
|
3552 | function disableLogs() {
|
3553 | {
|
3554 | if (disabledDepth === 0) {
|
3555 |
|
3556 | prevLog = console.log;
|
3557 | prevInfo = console.info;
|
3558 | prevWarn = console.warn;
|
3559 | prevError = console.error;
|
3560 | prevGroup = console.group;
|
3561 | prevGroupCollapsed = console.groupCollapsed;
|
3562 | prevGroupEnd = console.groupEnd;
|
3563 |
|
3564 | var props = {
|
3565 | configurable: true,
|
3566 | enumerable: true,
|
3567 | value: disabledLog,
|
3568 | writable: true
|
3569 | };
|
3570 |
|
3571 | Object.defineProperties(console, {
|
3572 | info: props,
|
3573 | log: props,
|
3574 | warn: props,
|
3575 | error: props,
|
3576 | group: props,
|
3577 | groupCollapsed: props,
|
3578 | groupEnd: props
|
3579 | });
|
3580 |
|
3581 | }
|
3582 |
|
3583 | disabledDepth++;
|
3584 | }
|
3585 | }
|
3586 | function reenableLogs() {
|
3587 | {
|
3588 | disabledDepth--;
|
3589 |
|
3590 | if (disabledDepth === 0) {
|
3591 |
|
3592 | var props = {
|
3593 | configurable: true,
|
3594 | enumerable: true,
|
3595 | writable: true
|
3596 | };
|
3597 |
|
3598 | Object.defineProperties(console, {
|
3599 | log: assign({}, props, {
|
3600 | value: prevLog
|
3601 | }),
|
3602 | info: assign({}, props, {
|
3603 | value: prevInfo
|
3604 | }),
|
3605 | warn: assign({}, props, {
|
3606 | value: prevWarn
|
3607 | }),
|
3608 | error: assign({}, props, {
|
3609 | value: prevError
|
3610 | }),
|
3611 | group: assign({}, props, {
|
3612 | value: prevGroup
|
3613 | }),
|
3614 | groupCollapsed: assign({}, props, {
|
3615 | value: prevGroupCollapsed
|
3616 | }),
|
3617 | groupEnd: assign({}, props, {
|
3618 | value: prevGroupEnd
|
3619 | })
|
3620 | });
|
3621 |
|
3622 | }
|
3623 |
|
3624 | if (disabledDepth < 0) {
|
3625 | error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
3626 | }
|
3627 | }
|
3628 | }
|
3629 |
|
3630 | var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
3631 | var prefix;
|
3632 | function describeBuiltInComponentFrame(name, source, ownerFn) {
|
3633 | {
|
3634 | if (prefix === undefined) {
|
3635 |
|
3636 | try {
|
3637 | throw Error();
|
3638 | } catch (x) {
|
3639 | var match = x.stack.trim().match(/\n( *(at )?)/);
|
3640 | prefix = match && match[1] || '';
|
3641 | }
|
3642 | }
|
3643 |
|
3644 |
|
3645 | return '\n' + prefix + name;
|
3646 | }
|
3647 | }
|
3648 | var reentry = false;
|
3649 | var componentFrameCache;
|
3650 |
|
3651 | {
|
3652 | var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
3653 | componentFrameCache = new PossiblyWeakMap();
|
3654 | }
|
3655 |
|
3656 | function describeNativeComponentFrame(fn, construct) {
|
3657 |
|
3658 | if ( !fn || reentry) {
|
3659 | return '';
|
3660 | }
|
3661 |
|
3662 | {
|
3663 | var frame = componentFrameCache.get(fn);
|
3664 |
|
3665 | if (frame !== undefined) {
|
3666 | return frame;
|
3667 | }
|
3668 | }
|
3669 |
|
3670 | var control;
|
3671 | reentry = true;
|
3672 | var previousPrepareStackTrace = Error.prepareStackTrace;
|
3673 |
|
3674 | Error.prepareStackTrace = undefined;
|
3675 | var previousDispatcher;
|
3676 |
|
3677 | {
|
3678 | previousDispatcher = ReactCurrentDispatcher.current;
|
3679 |
|
3680 |
|
3681 | ReactCurrentDispatcher.current = null;
|
3682 | disableLogs();
|
3683 | }
|
3684 |
|
3685 | try {
|
3686 |
|
3687 | if (construct) {
|
3688 |
|
3689 | var Fake = function () {
|
3690 | throw Error();
|
3691 | };
|
3692 |
|
3693 |
|
3694 | Object.defineProperty(Fake.prototype, 'props', {
|
3695 | set: function () {
|
3696 |
|
3697 |
|
3698 | throw Error();
|
3699 | }
|
3700 | });
|
3701 |
|
3702 | if (typeof Reflect === 'object' && Reflect.construct) {
|
3703 |
|
3704 |
|
3705 | try {
|
3706 | Reflect.construct(Fake, []);
|
3707 | } catch (x) {
|
3708 | control = x;
|
3709 | }
|
3710 |
|
3711 | Reflect.construct(fn, [], Fake);
|
3712 | } else {
|
3713 | try {
|
3714 | Fake.call();
|
3715 | } catch (x) {
|
3716 | control = x;
|
3717 | }
|
3718 |
|
3719 | fn.call(Fake.prototype);
|
3720 | }
|
3721 | } else {
|
3722 | try {
|
3723 | throw Error();
|
3724 | } catch (x) {
|
3725 | control = x;
|
3726 | }
|
3727 |
|
3728 | fn();
|
3729 | }
|
3730 | } catch (sample) {
|
3731 |
|
3732 | if (sample && control && typeof sample.stack === 'string') {
|
3733 |
|
3734 |
|
3735 | var sampleLines = sample.stack.split('\n');
|
3736 | var controlLines = control.stack.split('\n');
|
3737 | var s = sampleLines.length - 1;
|
3738 | var c = controlLines.length - 1;
|
3739 |
|
3740 | while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
3741 |
|
3742 |
|
3743 |
|
3744 |
|
3745 |
|
3746 |
|
3747 | c--;
|
3748 | }
|
3749 |
|
3750 | for (; s >= 1 && c >= 0; s--, c--) {
|
3751 |
|
3752 |
|
3753 | if (sampleLines[s] !== controlLines[c]) {
|
3754 |
|
3755 |
|
3756 |
|
3757 |
|
3758 |
|
3759 | if (s !== 1 || c !== 1) {
|
3760 | do {
|
3761 | s--;
|
3762 | c--;
|
3763 |
|
3764 |
|
3765 | if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
3766 |
|
3767 | var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
|
3768 |
|
3769 |
|
3770 |
|
3771 |
|
3772 | if (fn.displayName && _frame.includes('<anonymous>')) {
|
3773 | _frame = _frame.replace('<anonymous>', fn.displayName);
|
3774 | }
|
3775 |
|
3776 | {
|
3777 | if (typeof fn === 'function') {
|
3778 | componentFrameCache.set(fn, _frame);
|
3779 | }
|
3780 | }
|
3781 |
|
3782 |
|
3783 | return _frame;
|
3784 | }
|
3785 | } while (s >= 1 && c >= 0);
|
3786 | }
|
3787 |
|
3788 | break;
|
3789 | }
|
3790 | }
|
3791 | }
|
3792 | } finally {
|
3793 | reentry = false;
|
3794 |
|
3795 | {
|
3796 | ReactCurrentDispatcher.current = previousDispatcher;
|
3797 | reenableLogs();
|
3798 | }
|
3799 |
|
3800 | Error.prepareStackTrace = previousPrepareStackTrace;
|
3801 | }
|
3802 |
|
3803 |
|
3804 | var name = fn ? fn.displayName || fn.name : '';
|
3805 | var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
3806 |
|
3807 | {
|
3808 | if (typeof fn === 'function') {
|
3809 | componentFrameCache.set(fn, syntheticFrame);
|
3810 | }
|
3811 | }
|
3812 |
|
3813 | return syntheticFrame;
|
3814 | }
|
3815 |
|
3816 | function describeClassComponentFrame(ctor, source, ownerFn) {
|
3817 | {
|
3818 | return describeNativeComponentFrame(ctor, true);
|
3819 | }
|
3820 | }
|
3821 | function describeFunctionComponentFrame(fn, source, ownerFn) {
|
3822 | {
|
3823 | return describeNativeComponentFrame(fn, false);
|
3824 | }
|
3825 | }
|
3826 |
|
3827 | function shouldConstruct(Component) {
|
3828 | var prototype = Component.prototype;
|
3829 | return !!(prototype && prototype.isReactComponent);
|
3830 | }
|
3831 |
|
3832 | function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
3833 |
|
3834 | if (type == null) {
|
3835 | return '';
|
3836 | }
|
3837 |
|
3838 | if (typeof type === 'function') {
|
3839 | {
|
3840 | return describeNativeComponentFrame(type, shouldConstruct(type));
|
3841 | }
|
3842 | }
|
3843 |
|
3844 | if (typeof type === 'string') {
|
3845 | return describeBuiltInComponentFrame(type);
|
3846 | }
|
3847 |
|
3848 | switch (type) {
|
3849 | case REACT_SUSPENSE_TYPE:
|
3850 | return describeBuiltInComponentFrame('Suspense');
|
3851 |
|
3852 | case REACT_SUSPENSE_LIST_TYPE:
|
3853 | return describeBuiltInComponentFrame('SuspenseList');
|
3854 | }
|
3855 |
|
3856 | if (typeof type === 'object') {
|
3857 | switch (type.$$typeof) {
|
3858 | case REACT_FORWARD_REF_TYPE:
|
3859 | return describeFunctionComponentFrame(type.render);
|
3860 |
|
3861 | case REACT_MEMO_TYPE:
|
3862 |
|
3863 | return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
3864 |
|
3865 | case REACT_LAZY_TYPE:
|
3866 | {
|
3867 | var lazyComponent = type;
|
3868 | var payload = lazyComponent._payload;
|
3869 | var init = lazyComponent._init;
|
3870 |
|
3871 | try {
|
3872 |
|
3873 | return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
3874 | } catch (x) {}
|
3875 | }
|
3876 | }
|
3877 | }
|
3878 |
|
3879 | return '';
|
3880 | }
|
3881 |
|
3882 | var loggedTypeFailures = {};
|
3883 | var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
3884 |
|
3885 | function setCurrentlyValidatingElement(element) {
|
3886 | {
|
3887 | if (element) {
|
3888 | var owner = element._owner;
|
3889 | var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
3890 | ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
3891 | } else {
|
3892 | ReactDebugCurrentFrame.setExtraStackFrame(null);
|
3893 | }
|
3894 | }
|
3895 | }
|
3896 |
|
3897 | function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
3898 | {
|
3899 |
|
3900 | var has = Function.call.bind(hasOwnProperty);
|
3901 |
|
3902 | for (var typeSpecName in typeSpecs) {
|
3903 | if (has(typeSpecs, typeSpecName)) {
|
3904 | var error$1 = void 0;
|
3905 |
|
3906 |
|
3907 |
|
3908 | try {
|
3909 |
|
3910 |
|
3911 | if (typeof typeSpecs[typeSpecName] !== 'function') {
|
3912 |
|
3913 | var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
|
3914 | err.name = 'Invariant Violation';
|
3915 | throw err;
|
3916 | }
|
3917 |
|
3918 | error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
3919 | } catch (ex) {
|
3920 | error$1 = ex;
|
3921 | }
|
3922 |
|
3923 | if (error$1 && !(error$1 instanceof Error)) {
|
3924 | setCurrentlyValidatingElement(element);
|
3925 |
|
3926 | error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
|
3927 |
|
3928 | setCurrentlyValidatingElement(null);
|
3929 | }
|
3930 |
|
3931 | if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
3932 |
|
3933 |
|
3934 | loggedTypeFailures[error$1.message] = true;
|
3935 | setCurrentlyValidatingElement(element);
|
3936 |
|
3937 | error('Failed %s type: %s', location, error$1.message);
|
3938 |
|
3939 | setCurrentlyValidatingElement(null);
|
3940 | }
|
3941 | }
|
3942 | }
|
3943 | }
|
3944 | }
|
3945 |
|
3946 | var warnedAboutMissingGetChildContext;
|
3947 |
|
3948 | {
|
3949 | warnedAboutMissingGetChildContext = {};
|
3950 | }
|
3951 |
|
3952 | var emptyContextObject = {};
|
3953 |
|
3954 | {
|
3955 | Object.freeze(emptyContextObject);
|
3956 | }
|
3957 |
|
3958 | function getMaskedContext(type, unmaskedContext) {
|
3959 | {
|
3960 | var contextTypes = type.contextTypes;
|
3961 |
|
3962 | if (!contextTypes) {
|
3963 | return emptyContextObject;
|
3964 | }
|
3965 |
|
3966 | var context = {};
|
3967 |
|
3968 | for (var key in contextTypes) {
|
3969 | context[key] = unmaskedContext[key];
|
3970 | }
|
3971 |
|
3972 | {
|
3973 | var name = getComponentNameFromType(type) || 'Unknown';
|
3974 | checkPropTypes(contextTypes, context, 'context', name);
|
3975 | }
|
3976 |
|
3977 | return context;
|
3978 | }
|
3979 | }
|
3980 | function processChildContext(instance, type, parentContext, childContextTypes) {
|
3981 | {
|
3982 |
|
3983 |
|
3984 | if (typeof instance.getChildContext !== 'function') {
|
3985 | {
|
3986 | var componentName = getComponentNameFromType(type) || 'Unknown';
|
3987 |
|
3988 | if (!warnedAboutMissingGetChildContext[componentName]) {
|
3989 | warnedAboutMissingGetChildContext[componentName] = true;
|
3990 |
|
3991 | error('%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName);
|
3992 | }
|
3993 | }
|
3994 |
|
3995 | return parentContext;
|
3996 | }
|
3997 |
|
3998 | var childContext = instance.getChildContext();
|
3999 |
|
4000 | for (var contextKey in childContext) {
|
4001 | if (!(contextKey in childContextTypes)) {
|
4002 | throw new Error((getComponentNameFromType(type) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes.");
|
4003 | }
|
4004 | }
|
4005 |
|
4006 | {
|
4007 | var name = getComponentNameFromType(type) || 'Unknown';
|
4008 | checkPropTypes(childContextTypes, childContext, 'child context', name);
|
4009 | }
|
4010 |
|
4011 | return assign({}, parentContext, childContext);
|
4012 | }
|
4013 | }
|
4014 |
|
4015 | var rendererSigil;
|
4016 |
|
4017 | {
|
4018 |
|
4019 | rendererSigil = {};
|
4020 | }
|
4021 |
|
4022 |
|
4023 |
|
4024 | var rootContextSnapshot = null;
|
4025 |
|
4026 |
|
4027 |
|
4028 | var currentActiveSnapshot = null;
|
4029 |
|
4030 | function popNode(prev) {
|
4031 | {
|
4032 | prev.context._currentValue = prev.parentValue;
|
4033 | }
|
4034 | }
|
4035 |
|
4036 | function pushNode(next) {
|
4037 | {
|
4038 | next.context._currentValue = next.value;
|
4039 | }
|
4040 | }
|
4041 |
|
4042 | function popToNearestCommonAncestor(prev, next) {
|
4043 | if (prev === next) ; else {
|
4044 | popNode(prev);
|
4045 | var parentPrev = prev.parent;
|
4046 | var parentNext = next.parent;
|
4047 |
|
4048 | if (parentPrev === null) {
|
4049 | if (parentNext !== null) {
|
4050 | throw new Error('The stacks must reach the root at the same time. This is a bug in React.');
|
4051 | }
|
4052 | } else {
|
4053 | if (parentNext === null) {
|
4054 | throw new Error('The stacks must reach the root at the same time. This is a bug in React.');
|
4055 | }
|
4056 |
|
4057 | popToNearestCommonAncestor(parentPrev, parentNext);
|
4058 | }
|
4059 |
|
4060 |
|
4061 | pushNode(next);
|
4062 | }
|
4063 | }
|
4064 |
|
4065 | function popAllPrevious(prev) {
|
4066 | popNode(prev);
|
4067 | var parentPrev = prev.parent;
|
4068 |
|
4069 | if (parentPrev !== null) {
|
4070 | popAllPrevious(parentPrev);
|
4071 | }
|
4072 | }
|
4073 |
|
4074 | function pushAllNext(next) {
|
4075 | var parentNext = next.parent;
|
4076 |
|
4077 | if (parentNext !== null) {
|
4078 | pushAllNext(parentNext);
|
4079 | }
|
4080 |
|
4081 | pushNode(next);
|
4082 | }
|
4083 |
|
4084 | function popPreviousToCommonLevel(prev, next) {
|
4085 | popNode(prev);
|
4086 | var parentPrev = prev.parent;
|
4087 |
|
4088 | if (parentPrev === null) {
|
4089 | throw new Error('The depth must equal at least at zero before reaching the root. This is a bug in React.');
|
4090 | }
|
4091 |
|
4092 | if (parentPrev.depth === next.depth) {
|
4093 |
|
4094 | popToNearestCommonAncestor(parentPrev, next);
|
4095 | } else {
|
4096 |
|
4097 | popPreviousToCommonLevel(parentPrev, next);
|
4098 | }
|
4099 | }
|
4100 |
|
4101 | function popNextToCommonLevel(prev, next) {
|
4102 | var parentNext = next.parent;
|
4103 |
|
4104 | if (parentNext === null) {
|
4105 | throw new Error('The depth must equal at least at zero before reaching the root. This is a bug in React.');
|
4106 | }
|
4107 |
|
4108 | if (prev.depth === parentNext.depth) {
|
4109 |
|
4110 | popToNearestCommonAncestor(prev, parentNext);
|
4111 | } else {
|
4112 |
|
4113 | popNextToCommonLevel(prev, parentNext);
|
4114 | }
|
4115 |
|
4116 | pushNode(next);
|
4117 | }
|
4118 |
|
4119 |
|
4120 |
|
4121 |
|
4122 |
|
4123 | function switchContext(newSnapshot) {
|
4124 |
|
4125 |
|
4126 |
|
4127 |
|
4128 |
|
4129 |
|
4130 |
|
4131 |
|
4132 | var prev = currentActiveSnapshot;
|
4133 | var next = newSnapshot;
|
4134 |
|
4135 | if (prev !== next) {
|
4136 | if (prev === null) {
|
4137 |
|
4138 | pushAllNext(next);
|
4139 | } else if (next === null) {
|
4140 | popAllPrevious(prev);
|
4141 | } else if (prev.depth === next.depth) {
|
4142 | popToNearestCommonAncestor(prev, next);
|
4143 | } else if (prev.depth > next.depth) {
|
4144 | popPreviousToCommonLevel(prev, next);
|
4145 | } else {
|
4146 | popNextToCommonLevel(prev, next);
|
4147 | }
|
4148 |
|
4149 | currentActiveSnapshot = next;
|
4150 | }
|
4151 | }
|
4152 | function pushProvider(context, nextValue) {
|
4153 | var prevValue;
|
4154 |
|
4155 | {
|
4156 | prevValue = context._currentValue;
|
4157 | context._currentValue = nextValue;
|
4158 |
|
4159 | {
|
4160 | if (context._currentRenderer !== undefined && context._currentRenderer !== null && context._currentRenderer !== rendererSigil) {
|
4161 | error('Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.');
|
4162 | }
|
4163 |
|
4164 | context._currentRenderer = rendererSigil;
|
4165 | }
|
4166 | }
|
4167 |
|
4168 | var prevNode = currentActiveSnapshot;
|
4169 | var newNode = {
|
4170 | parent: prevNode,
|
4171 | depth: prevNode === null ? 0 : prevNode.depth + 1,
|
4172 | context: context,
|
4173 | parentValue: prevValue,
|
4174 | value: nextValue
|
4175 | };
|
4176 | currentActiveSnapshot = newNode;
|
4177 | return newNode;
|
4178 | }
|
4179 | function popProvider(context) {
|
4180 | var prevSnapshot = currentActiveSnapshot;
|
4181 |
|
4182 | if (prevSnapshot === null) {
|
4183 | throw new Error('Tried to pop a Context at the root of the app. This is a bug in React.');
|
4184 | }
|
4185 |
|
4186 | {
|
4187 | if (prevSnapshot.context !== context) {
|
4188 | error('The parent context is not the expected context. This is probably a bug in React.');
|
4189 | }
|
4190 | }
|
4191 |
|
4192 | {
|
4193 | var value = prevSnapshot.parentValue;
|
4194 |
|
4195 | if (value === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) {
|
4196 | prevSnapshot.context._currentValue = prevSnapshot.context._defaultValue;
|
4197 | } else {
|
4198 | prevSnapshot.context._currentValue = value;
|
4199 | }
|
4200 |
|
4201 | {
|
4202 | if (context._currentRenderer !== undefined && context._currentRenderer !== null && context._currentRenderer !== rendererSigil) {
|
4203 | error('Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.');
|
4204 | }
|
4205 |
|
4206 | context._currentRenderer = rendererSigil;
|
4207 | }
|
4208 | }
|
4209 |
|
4210 | return currentActiveSnapshot = prevSnapshot.parent;
|
4211 | }
|
4212 | function getActiveContext() {
|
4213 | return currentActiveSnapshot;
|
4214 | }
|
4215 | function readContext(context) {
|
4216 | var value = context._currentValue ;
|
4217 | return value;
|
4218 | }
|
4219 |
|
4220 |
|
4221 |
|
4222 |
|
4223 |
|
4224 |
|
4225 |
|
4226 |
|
4227 |
|
4228 |
|
4229 | function get(key) {
|
4230 | return key._reactInternals;
|
4231 | }
|
4232 | function set(key, value) {
|
4233 | key._reactInternals = value;
|
4234 | }
|
4235 |
|
4236 | var didWarnAboutNoopUpdateForComponent = {};
|
4237 | var didWarnAboutDeprecatedWillMount = {};
|
4238 | var didWarnAboutUninitializedState;
|
4239 | var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate;
|
4240 | var didWarnAboutLegacyLifecyclesAndDerivedState;
|
4241 | var didWarnAboutUndefinedDerivedState;
|
4242 | var warnOnUndefinedDerivedState;
|
4243 | var warnOnInvalidCallback;
|
4244 | var didWarnAboutDirectlyAssigningPropsToState;
|
4245 | var didWarnAboutContextTypeAndContextTypes;
|
4246 | var didWarnAboutInvalidateContextType;
|
4247 |
|
4248 | {
|
4249 | didWarnAboutUninitializedState = new Set();
|
4250 | didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set();
|
4251 | didWarnAboutLegacyLifecyclesAndDerivedState = new Set();
|
4252 | didWarnAboutDirectlyAssigningPropsToState = new Set();
|
4253 | didWarnAboutUndefinedDerivedState = new Set();
|
4254 | didWarnAboutContextTypeAndContextTypes = new Set();
|
4255 | didWarnAboutInvalidateContextType = new Set();
|
4256 | var didWarnOnInvalidCallback = new Set();
|
4257 |
|
4258 | warnOnInvalidCallback = function (callback, callerName) {
|
4259 | if (callback === null || typeof callback === 'function') {
|
4260 | return;
|
4261 | }
|
4262 |
|
4263 | var key = callerName + '_' + callback;
|
4264 |
|
4265 | if (!didWarnOnInvalidCallback.has(key)) {
|
4266 | didWarnOnInvalidCallback.add(key);
|
4267 |
|
4268 | error('%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback);
|
4269 | }
|
4270 | };
|
4271 |
|
4272 | warnOnUndefinedDerivedState = function (type, partialState) {
|
4273 | if (partialState === undefined) {
|
4274 | var componentName = getComponentNameFromType(type) || 'Component';
|
4275 |
|
4276 | if (!didWarnAboutUndefinedDerivedState.has(componentName)) {
|
4277 | didWarnAboutUndefinedDerivedState.add(componentName);
|
4278 |
|
4279 | error('%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName);
|
4280 | }
|
4281 | }
|
4282 | };
|
4283 | }
|
4284 |
|
4285 | function warnNoop(publicInstance, callerName) {
|
4286 | {
|
4287 | var _constructor = publicInstance.constructor;
|
4288 | var componentName = _constructor && getComponentNameFromType(_constructor) || 'ReactClass';
|
4289 | var warningKey = componentName + '.' + callerName;
|
4290 |
|
4291 | if (didWarnAboutNoopUpdateForComponent[warningKey]) {
|
4292 | return;
|
4293 | }
|
4294 |
|
4295 | error('%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, componentName);
|
4296 |
|
4297 | didWarnAboutNoopUpdateForComponent[warningKey] = true;
|
4298 | }
|
4299 | }
|
4300 |
|
4301 | var classComponentUpdater = {
|
4302 | isMounted: function (inst) {
|
4303 | return false;
|
4304 | },
|
4305 | enqueueSetState: function (inst, payload, callback) {
|
4306 | var internals = get(inst);
|
4307 |
|
4308 | if (internals.queue === null) {
|
4309 | warnNoop(inst, 'setState');
|
4310 | } else {
|
4311 | internals.queue.push(payload);
|
4312 |
|
4313 | {
|
4314 | if (callback !== undefined && callback !== null) {
|
4315 | warnOnInvalidCallback(callback, 'setState');
|
4316 | }
|
4317 | }
|
4318 | }
|
4319 | },
|
4320 | enqueueReplaceState: function (inst, payload, callback) {
|
4321 | var internals = get(inst);
|
4322 | internals.replace = true;
|
4323 | internals.queue = [payload];
|
4324 |
|
4325 | {
|
4326 | if (callback !== undefined && callback !== null) {
|
4327 | warnOnInvalidCallback(callback, 'setState');
|
4328 | }
|
4329 | }
|
4330 | },
|
4331 | enqueueForceUpdate: function (inst, callback) {
|
4332 | var internals = get(inst);
|
4333 |
|
4334 | if (internals.queue === null) {
|
4335 | warnNoop(inst, 'forceUpdate');
|
4336 | } else {
|
4337 | {
|
4338 | if (callback !== undefined && callback !== null) {
|
4339 | warnOnInvalidCallback(callback, 'setState');
|
4340 | }
|
4341 | }
|
4342 | }
|
4343 | }
|
4344 | };
|
4345 |
|
4346 | function applyDerivedStateFromProps(instance, ctor, getDerivedStateFromProps, prevState, nextProps) {
|
4347 | var partialState = getDerivedStateFromProps(nextProps, prevState);
|
4348 |
|
4349 | {
|
4350 | warnOnUndefinedDerivedState(ctor, partialState);
|
4351 | }
|
4352 |
|
4353 |
|
4354 | var newState = partialState === null || partialState === undefined ? prevState : assign({}, prevState, partialState);
|
4355 | return newState;
|
4356 | }
|
4357 |
|
4358 | function constructClassInstance(ctor, props, maskedLegacyContext) {
|
4359 | var context = emptyContextObject;
|
4360 | var contextType = ctor.contextType;
|
4361 |
|
4362 | {
|
4363 | if ('contextType' in ctor) {
|
4364 | var isValid =
|
4365 | contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined;
|
4366 |
|
4367 | if (!isValid && !didWarnAboutInvalidateContextType.has(ctor)) {
|
4368 | didWarnAboutInvalidateContextType.add(ctor);
|
4369 | var addendum = '';
|
4370 |
|
4371 | if (contextType === undefined) {
|
4372 | addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.';
|
4373 | } else if (typeof contextType !== 'object') {
|
4374 | addendum = ' However, it is set to a ' + typeof contextType + '.';
|
4375 | } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) {
|
4376 | addendum = ' Did you accidentally pass the Context.Provider instead?';
|
4377 | } else if (contextType._context !== undefined) {
|
4378 |
|
4379 | addendum = ' Did you accidentally pass the Context.Consumer instead?';
|
4380 | } else {
|
4381 | addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.';
|
4382 | }
|
4383 |
|
4384 | error('%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentNameFromType(ctor) || 'Component', addendum);
|
4385 | }
|
4386 | }
|
4387 | }
|
4388 |
|
4389 | if (typeof contextType === 'object' && contextType !== null) {
|
4390 | context = readContext(contextType);
|
4391 | } else {
|
4392 | context = maskedLegacyContext;
|
4393 | }
|
4394 |
|
4395 | var instance = new ctor(props, context);
|
4396 |
|
4397 | {
|
4398 | if (typeof ctor.getDerivedStateFromProps === 'function' && (instance.state === null || instance.state === undefined)) {
|
4399 | var componentName = getComponentNameFromType(ctor) || 'Component';
|
4400 |
|
4401 | if (!didWarnAboutUninitializedState.has(componentName)) {
|
4402 | didWarnAboutUninitializedState.add(componentName);
|
4403 |
|
4404 | error('`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, instance.state === null ? 'null' : 'undefined', componentName);
|
4405 | }
|
4406 | }
|
4407 |
|
4408 |
|
4409 |
|
4410 |
|
4411 | if (typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function') {
|
4412 | var foundWillMountName = null;
|
4413 | var foundWillReceivePropsName = null;
|
4414 | var foundWillUpdateName = null;
|
4415 |
|
4416 | if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) {
|
4417 | foundWillMountName = 'componentWillMount';
|
4418 | } else if (typeof instance.UNSAFE_componentWillMount === 'function') {
|
4419 | foundWillMountName = 'UNSAFE_componentWillMount';
|
4420 | }
|
4421 |
|
4422 | if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
|
4423 | foundWillReceivePropsName = 'componentWillReceiveProps';
|
4424 | } else if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
|
4425 | foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
|
4426 | }
|
4427 |
|
4428 | if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
|
4429 | foundWillUpdateName = 'componentWillUpdate';
|
4430 | } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
|
4431 | foundWillUpdateName = 'UNSAFE_componentWillUpdate';
|
4432 | }
|
4433 |
|
4434 | if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
|
4435 | var _componentName = getComponentNameFromType(ctor) || 'Component';
|
4436 |
|
4437 | var newApiName = typeof ctor.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()';
|
4438 |
|
4439 | if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) {
|
4440 | didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName);
|
4441 |
|
4442 | error('Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + '%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n' + 'The above lifecycles should be removed. Learn more about this warning here:\n' + 'https://reactjs.org/link/unsafe-component-lifecycles', _componentName, newApiName, foundWillMountName !== null ? "\n " + foundWillMountName : '', foundWillReceivePropsName !== null ? "\n " + foundWillReceivePropsName : '', foundWillUpdateName !== null ? "\n " + foundWillUpdateName : '');
|
4443 | }
|
4444 | }
|
4445 | }
|
4446 | }
|
4447 |
|
4448 | return instance;
|
4449 | }
|
4450 |
|
4451 | function checkClassInstance(instance, ctor, newProps) {
|
4452 | {
|
4453 | var name = getComponentNameFromType(ctor) || 'Component';
|
4454 | var renderPresent = instance.render;
|
4455 |
|
4456 | if (!renderPresent) {
|
4457 | if (ctor.prototype && typeof ctor.prototype.render === 'function') {
|
4458 | error('%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name);
|
4459 | } else {
|
4460 | error('%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name);
|
4461 | }
|
4462 | }
|
4463 |
|
4464 | if (instance.getInitialState && !instance.getInitialState.isReactClassApproved && !instance.state) {
|
4465 | error('getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', name);
|
4466 | }
|
4467 |
|
4468 | if (instance.getDefaultProps && !instance.getDefaultProps.isReactClassApproved) {
|
4469 | error('getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', name);
|
4470 | }
|
4471 |
|
4472 | if (instance.propTypes) {
|
4473 | error('propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name);
|
4474 | }
|
4475 |
|
4476 | if (instance.contextType) {
|
4477 | error('contextType was defined as an instance property on %s. Use a static ' + 'property to define contextType instead.', name);
|
4478 | }
|
4479 |
|
4480 | {
|
4481 | if (instance.contextTypes) {
|
4482 | error('contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name);
|
4483 | }
|
4484 |
|
4485 | if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) {
|
4486 | didWarnAboutContextTypeAndContextTypes.add(ctor);
|
4487 |
|
4488 | error('%s declares both contextTypes and contextType static properties. ' + 'The legacy contextTypes property will be ignored.', name);
|
4489 | }
|
4490 | }
|
4491 |
|
4492 | if (typeof instance.componentShouldUpdate === 'function') {
|
4493 | error('%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', name);
|
4494 | }
|
4495 |
|
4496 | if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') {
|
4497 | error('%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentNameFromType(ctor) || 'A pure component');
|
4498 | }
|
4499 |
|
4500 | if (typeof instance.componentDidUnmount === 'function') {
|
4501 | error('%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name);
|
4502 | }
|
4503 |
|
4504 | if (typeof instance.componentDidReceiveProps === 'function') {
|
4505 | error('%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name);
|
4506 | }
|
4507 |
|
4508 | if (typeof instance.componentWillRecieveProps === 'function') {
|
4509 | error('%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name);
|
4510 | }
|
4511 |
|
4512 | if (typeof instance.UNSAFE_componentWillRecieveProps === 'function') {
|
4513 | error('%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name);
|
4514 | }
|
4515 |
|
4516 | var hasMutatedProps = instance.props !== newProps;
|
4517 |
|
4518 | if (instance.props !== undefined && hasMutatedProps) {
|
4519 | error('%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name);
|
4520 | }
|
4521 |
|
4522 | if (instance.defaultProps) {
|
4523 | error('Setting defaultProps as an instance property on %s is not supported and will be ignored.' + ' Instead, define defaultProps as a static property on %s.', name, name);
|
4524 | }
|
4525 |
|
4526 | if (typeof instance.getSnapshotBeforeUpdate === 'function' && typeof instance.componentDidUpdate !== 'function' && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor)) {
|
4527 | didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor);
|
4528 |
|
4529 | error('%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' + 'This component defines getSnapshotBeforeUpdate() only.', getComponentNameFromType(ctor));
|
4530 | }
|
4531 |
|
4532 | if (typeof instance.getDerivedStateFromProps === 'function') {
|
4533 | error('%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name);
|
4534 | }
|
4535 |
|
4536 | if (typeof instance.getDerivedStateFromError === 'function') {
|
4537 | error('%s: getDerivedStateFromError() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name);
|
4538 | }
|
4539 |
|
4540 | if (typeof ctor.getSnapshotBeforeUpdate === 'function') {
|
4541 | error('%s: getSnapshotBeforeUpdate() is defined as a static method ' + 'and will be ignored. Instead, declare it as an instance method.', name);
|
4542 | }
|
4543 |
|
4544 | var _state = instance.state;
|
4545 |
|
4546 | if (_state && (typeof _state !== 'object' || isArray(_state))) {
|
4547 | error('%s.state: must be set to an object or null', name);
|
4548 | }
|
4549 |
|
4550 | if (typeof instance.getChildContext === 'function' && typeof ctor.childContextTypes !== 'object') {
|
4551 | error('%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name);
|
4552 | }
|
4553 | }
|
4554 | }
|
4555 |
|
4556 | function callComponentWillMount(type, instance) {
|
4557 | var oldState = instance.state;
|
4558 |
|
4559 | if (typeof instance.componentWillMount === 'function') {
|
4560 | {
|
4561 | if ( instance.componentWillMount.__suppressDeprecationWarning !== true) {
|
4562 | var componentName = getComponentNameFromType(type) || 'Unknown';
|
4563 |
|
4564 | if (!didWarnAboutDeprecatedWillMount[componentName]) {
|
4565 | warn(
|
4566 | 'componentWillMount has been renamed, and is not recommended for use. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move code from componentWillMount to componentDidMount (preferred in most cases) ' + 'or the constructor.\n' + '\nPlease update the following components: %s', componentName);
|
4567 |
|
4568 | didWarnAboutDeprecatedWillMount[componentName] = true;
|
4569 | }
|
4570 | }
|
4571 | }
|
4572 |
|
4573 | instance.componentWillMount();
|
4574 | }
|
4575 |
|
4576 | if (typeof instance.UNSAFE_componentWillMount === 'function') {
|
4577 | instance.UNSAFE_componentWillMount();
|
4578 | }
|
4579 |
|
4580 | if (oldState !== instance.state) {
|
4581 | {
|
4582 | error('%s.componentWillMount(): Assigning directly to this.state is ' + "deprecated (except inside a component's " + 'constructor). Use setState instead.', getComponentNameFromType(type) || 'Component');
|
4583 | }
|
4584 |
|
4585 | classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
|
4586 | }
|
4587 | }
|
4588 |
|
4589 | function processUpdateQueue(internalInstance, inst, props, maskedLegacyContext) {
|
4590 | if (internalInstance.queue !== null && internalInstance.queue.length > 0) {
|
4591 | var oldQueue = internalInstance.queue;
|
4592 | var oldReplace = internalInstance.replace;
|
4593 | internalInstance.queue = null;
|
4594 | internalInstance.replace = false;
|
4595 |
|
4596 | if (oldReplace && oldQueue.length === 1) {
|
4597 | inst.state = oldQueue[0];
|
4598 | } else {
|
4599 | var nextState = oldReplace ? oldQueue[0] : inst.state;
|
4600 | var dontMutate = true;
|
4601 |
|
4602 | for (var i = oldReplace ? 1 : 0; i < oldQueue.length; i++) {
|
4603 | var partial = oldQueue[i];
|
4604 | var partialState = typeof partial === 'function' ? partial.call(inst, nextState, props, maskedLegacyContext) : partial;
|
4605 |
|
4606 | if (partialState != null) {
|
4607 | if (dontMutate) {
|
4608 | dontMutate = false;
|
4609 | nextState = assign({}, nextState, partialState);
|
4610 | } else {
|
4611 | assign(nextState, partialState);
|
4612 | }
|
4613 | }
|
4614 | }
|
4615 |
|
4616 | inst.state = nextState;
|
4617 | }
|
4618 | } else {
|
4619 | internalInstance.queue = null;
|
4620 | }
|
4621 | }
|
4622 |
|
4623 |
|
4624 | function mountClassInstance(instance, ctor, newProps, maskedLegacyContext) {
|
4625 | {
|
4626 | checkClassInstance(instance, ctor, newProps);
|
4627 | }
|
4628 |
|
4629 | var initialState = instance.state !== undefined ? instance.state : null;
|
4630 | instance.updater = classComponentUpdater;
|
4631 | instance.props = newProps;
|
4632 | instance.state = initialState;
|
4633 |
|
4634 |
|
4635 | var internalInstance = {
|
4636 | queue: [],
|
4637 | replace: false
|
4638 | };
|
4639 | set(instance, internalInstance);
|
4640 | var contextType = ctor.contextType;
|
4641 |
|
4642 | if (typeof contextType === 'object' && contextType !== null) {
|
4643 | instance.context = readContext(contextType);
|
4644 | } else {
|
4645 | instance.context = maskedLegacyContext;
|
4646 | }
|
4647 |
|
4648 | {
|
4649 | if (instance.state === newProps) {
|
4650 | var componentName = getComponentNameFromType(ctor) || 'Component';
|
4651 |
|
4652 | if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) {
|
4653 | didWarnAboutDirectlyAssigningPropsToState.add(componentName);
|
4654 |
|
4655 | error('%s: It is not recommended to assign props directly to state ' + "because updates to props won't be reflected in state. " + 'In most cases, it is better to use props directly.', componentName);
|
4656 | }
|
4657 | }
|
4658 | }
|
4659 |
|
4660 | var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
|
4661 |
|
4662 | if (typeof getDerivedStateFromProps === 'function') {
|
4663 | instance.state = applyDerivedStateFromProps(instance, ctor, getDerivedStateFromProps, initialState, newProps);
|
4664 | }
|
4665 |
|
4666 |
|
4667 |
|
4668 | if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
|
4669 | callComponentWillMount(ctor, instance);
|
4670 |
|
4671 |
|
4672 | processUpdateQueue(internalInstance, instance, newProps, maskedLegacyContext);
|
4673 | }
|
4674 | }
|
4675 |
|
4676 |
|
4677 |
|
4678 |
|
4679 |
|
4680 |
|
4681 |
|
4682 |
|
4683 |
|
4684 |
|
4685 |
|
4686 |
|
4687 |
|
4688 |
|
4689 |
|
4690 |
|
4691 |
|
4692 |
|
4693 |
|
4694 |
|
4695 |
|
4696 |
|
4697 |
|
4698 |
|
4699 |
|
4700 |
|
4701 |
|
4702 |
|
4703 |
|
4704 |
|
4705 |
|
4706 |
|
4707 |
|
4708 |
|
4709 |
|
4710 |
|
4711 |
|
4712 |
|
4713 |
|
4714 |
|
4715 |
|
4716 |
|
4717 |
|
4718 |
|
4719 |
|
4720 |
|
4721 |
|
4722 |
|
4723 |
|
4724 |
|
4725 |
|
4726 |
|
4727 | var emptyTreeContext = {
|
4728 | id: 1,
|
4729 | overflow: ''
|
4730 | };
|
4731 | function getTreeId(context) {
|
4732 | var overflow = context.overflow;
|
4733 | var idWithLeadingBit = context.id;
|
4734 | var id = idWithLeadingBit & ~getLeadingBit(idWithLeadingBit);
|
4735 | return id.toString(32) + overflow;
|
4736 | }
|
4737 | function pushTreeContext(baseContext, totalChildren, index) {
|
4738 | var baseIdWithLeadingBit = baseContext.id;
|
4739 | var baseOverflow = baseContext.overflow;
|
4740 |
|
4741 |
|
4742 | var baseLength = getBitLength(baseIdWithLeadingBit) - 1;
|
4743 | var baseId = baseIdWithLeadingBit & ~(1 << baseLength);
|
4744 | var slot = index + 1;
|
4745 | var length = getBitLength(totalChildren) + baseLength;
|
4746 |
|
4747 |
|
4748 | if (length > 30) {
|
4749 |
|
4750 |
|
4751 |
|
4752 |
|
4753 |
|
4754 |
|
4755 |
|
4756 |
|
4757 |
|
4758 |
|
4759 |
|
4760 |
|
4761 |
|
4762 | var numberOfOverflowBits = baseLength - baseLength % 5;
|
4763 |
|
4764 | var newOverflowBits = (1 << numberOfOverflowBits) - 1;
|
4765 |
|
4766 | var newOverflow = (baseId & newOverflowBits).toString(32);
|
4767 |
|
4768 | var restOfBaseId = baseId >> numberOfOverflowBits;
|
4769 | var restOfBaseLength = baseLength - numberOfOverflowBits;
|
4770 |
|
4771 |
|
4772 | var restOfLength = getBitLength(totalChildren) + restOfBaseLength;
|
4773 | var restOfNewBits = slot << restOfBaseLength;
|
4774 | var id = restOfNewBits | restOfBaseId;
|
4775 | var overflow = newOverflow + baseOverflow;
|
4776 | return {
|
4777 | id: 1 << restOfLength | id,
|
4778 | overflow: overflow
|
4779 | };
|
4780 | } else {
|
4781 |
|
4782 | var newBits = slot << baseLength;
|
4783 |
|
4784 | var _id = newBits | baseId;
|
4785 |
|
4786 | var _overflow = baseOverflow;
|
4787 | return {
|
4788 | id: 1 << length | _id,
|
4789 | overflow: _overflow
|
4790 | };
|
4791 | }
|
4792 | }
|
4793 |
|
4794 | function getBitLength(number) {
|
4795 | return 32 - clz32(number);
|
4796 | }
|
4797 |
|
4798 | function getLeadingBit(id) {
|
4799 | return 1 << getBitLength(id) - 1;
|
4800 | }
|
4801 |
|
4802 |
|
4803 | var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback;
|
4804 |
|
4805 |
|
4806 |
|
4807 | var log = Math.log;
|
4808 | var LN2 = Math.LN2;
|
4809 |
|
4810 | function clz32Fallback(x) {
|
4811 | var asUint = x >>> 0;
|
4812 |
|
4813 | if (asUint === 0) {
|
4814 | return 32;
|
4815 | }
|
4816 |
|
4817 | return 31 - (log(asUint) / LN2 | 0) | 0;
|
4818 | }
|
4819 |
|
4820 |
|
4821 |
|
4822 |
|
4823 |
|
4824 | function is(x, y) {
|
4825 | return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y
|
4826 | ;
|
4827 | }
|
4828 |
|
4829 | var objectIs = typeof Object.is === 'function' ? Object.is : is;
|
4830 |
|
4831 | var currentlyRenderingComponent = null;
|
4832 | var currentlyRenderingTask = null;
|
4833 | var firstWorkInProgressHook = null;
|
4834 | var workInProgressHook = null;
|
4835 |
|
4836 | var isReRender = false;
|
4837 |
|
4838 | var didScheduleRenderPhaseUpdate = false;
|
4839 |
|
4840 | var localIdCounter = 0;
|
4841 |
|
4842 | var renderPhaseUpdates = null;
|
4843 |
|
4844 | var numberOfReRenders = 0;
|
4845 | var RE_RENDER_LIMIT = 25;
|
4846 | var isInHookUserCodeInDev = false;
|
4847 |
|
4848 | var currentHookNameInDev;
|
4849 |
|
4850 | function resolveCurrentlyRenderingComponent() {
|
4851 | if (currentlyRenderingComponent === null) {
|
4852 | throw new 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:\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\n' + '2. You might be breaking the Rules of Hooks\n' + '3. You might have more than one copy of React in the same app\n' + 'See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.');
|
4853 | }
|
4854 |
|
4855 | {
|
4856 | if (isInHookUserCodeInDev) {
|
4857 | error('Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://reactjs.org/link/rules-of-hooks');
|
4858 | }
|
4859 | }
|
4860 |
|
4861 | return currentlyRenderingComponent;
|
4862 | }
|
4863 |
|
4864 | function areHookInputsEqual(nextDeps, prevDeps) {
|
4865 | if (prevDeps === null) {
|
4866 | {
|
4867 | error('%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev);
|
4868 | }
|
4869 |
|
4870 | return false;
|
4871 | }
|
4872 |
|
4873 | {
|
4874 |
|
4875 |
|
4876 | if (nextDeps.length !== prevDeps.length) {
|
4877 | error('The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, "[" + nextDeps.join(', ') + "]", "[" + prevDeps.join(', ') + "]");
|
4878 | }
|
4879 | }
|
4880 |
|
4881 | for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
|
4882 | if (objectIs(nextDeps[i], prevDeps[i])) {
|
4883 | continue;
|
4884 | }
|
4885 |
|
4886 | return false;
|
4887 | }
|
4888 |
|
4889 | return true;
|
4890 | }
|
4891 |
|
4892 | function createHook() {
|
4893 | if (numberOfReRenders > 0) {
|
4894 | throw new Error('Rendered more hooks than during the previous render');
|
4895 | }
|
4896 |
|
4897 | return {
|
4898 | memoizedState: null,
|
4899 | queue: null,
|
4900 | next: null
|
4901 | };
|
4902 | }
|
4903 |
|
4904 | function createWorkInProgressHook() {
|
4905 | if (workInProgressHook === null) {
|
4906 |
|
4907 | if (firstWorkInProgressHook === null) {
|
4908 | isReRender = false;
|
4909 | firstWorkInProgressHook = workInProgressHook = createHook();
|
4910 | } else {
|
4911 |
|
4912 | isReRender = true;
|
4913 | workInProgressHook = firstWorkInProgressHook;
|
4914 | }
|
4915 | } else {
|
4916 | if (workInProgressHook.next === null) {
|
4917 | isReRender = false;
|
4918 |
|
4919 | workInProgressHook = workInProgressHook.next = createHook();
|
4920 | } else {
|
4921 |
|
4922 | isReRender = true;
|
4923 | workInProgressHook = workInProgressHook.next;
|
4924 | }
|
4925 | }
|
4926 |
|
4927 | return workInProgressHook;
|
4928 | }
|
4929 |
|
4930 | function prepareToUseHooks(task, componentIdentity) {
|
4931 | currentlyRenderingComponent = componentIdentity;
|
4932 | currentlyRenderingTask = task;
|
4933 |
|
4934 | {
|
4935 | isInHookUserCodeInDev = false;
|
4936 | }
|
4937 |
|
4938 |
|
4939 |
|
4940 |
|
4941 |
|
4942 |
|
4943 |
|
4944 |
|
4945 | localIdCounter = 0;
|
4946 | }
|
4947 | function finishHooks(Component, props, children, refOrContext) {
|
4948 |
|
4949 |
|
4950 | while (didScheduleRenderPhaseUpdate) {
|
4951 |
|
4952 |
|
4953 |
|
4954 |
|
4955 | didScheduleRenderPhaseUpdate = false;
|
4956 | localIdCounter = 0;
|
4957 | numberOfReRenders += 1;
|
4958 |
|
4959 | workInProgressHook = null;
|
4960 | children = Component(props, refOrContext);
|
4961 | }
|
4962 |
|
4963 | resetHooksState();
|
4964 | return children;
|
4965 | }
|
4966 | function checkDidRenderIdHook() {
|
4967 |
|
4968 |
|
4969 |
|
4970 | var didRenderIdHook = localIdCounter !== 0;
|
4971 | return didRenderIdHook;
|
4972 | }
|
4973 |
|
4974 | function resetHooksState() {
|
4975 | {
|
4976 | isInHookUserCodeInDev = false;
|
4977 | }
|
4978 |
|
4979 | currentlyRenderingComponent = null;
|
4980 | currentlyRenderingTask = null;
|
4981 | didScheduleRenderPhaseUpdate = false;
|
4982 | firstWorkInProgressHook = null;
|
4983 | numberOfReRenders = 0;
|
4984 | renderPhaseUpdates = null;
|
4985 | workInProgressHook = null;
|
4986 | }
|
4987 |
|
4988 | function readContext$1(context) {
|
4989 | {
|
4990 | if (isInHookUserCodeInDev) {
|
4991 | error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().');
|
4992 | }
|
4993 | }
|
4994 |
|
4995 | return readContext(context);
|
4996 | }
|
4997 |
|
4998 | function useContext(context) {
|
4999 | {
|
5000 | currentHookNameInDev = 'useContext';
|
5001 | }
|
5002 |
|
5003 | resolveCurrentlyRenderingComponent();
|
5004 | return readContext(context);
|
5005 | }
|
5006 |
|
5007 | function basicStateReducer(state, action) {
|
5008 |
|
5009 | return typeof action === 'function' ? action(state) : action;
|
5010 | }
|
5011 |
|
5012 | function useState(initialState) {
|
5013 | {
|
5014 | currentHookNameInDev = 'useState';
|
5015 | }
|
5016 |
|
5017 | return useReducer(basicStateReducer,
|
5018 | initialState);
|
5019 | }
|
5020 | function useReducer(reducer, initialArg, init) {
|
5021 | {
|
5022 | if (reducer !== basicStateReducer) {
|
5023 | currentHookNameInDev = 'useReducer';
|
5024 | }
|
5025 | }
|
5026 |
|
5027 | currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
|
5028 | workInProgressHook = createWorkInProgressHook();
|
5029 |
|
5030 | if (isReRender) {
|
5031 |
|
5032 |
|
5033 | var queue = workInProgressHook.queue;
|
5034 | var dispatch = queue.dispatch;
|
5035 |
|
5036 | if (renderPhaseUpdates !== null) {
|
5037 |
|
5038 | var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
|
5039 |
|
5040 | if (firstRenderPhaseUpdate !== undefined) {
|
5041 | renderPhaseUpdates.delete(queue);
|
5042 | var newState = workInProgressHook.memoizedState;
|
5043 | var update = firstRenderPhaseUpdate;
|
5044 |
|
5045 | do {
|
5046 |
|
5047 |
|
5048 |
|
5049 | var action = update.action;
|
5050 |
|
5051 | {
|
5052 | isInHookUserCodeInDev = true;
|
5053 | }
|
5054 |
|
5055 | newState = reducer(newState, action);
|
5056 |
|
5057 | {
|
5058 | isInHookUserCodeInDev = false;
|
5059 | }
|
5060 |
|
5061 | update = update.next;
|
5062 | } while (update !== null);
|
5063 |
|
5064 | workInProgressHook.memoizedState = newState;
|
5065 | return [newState, dispatch];
|
5066 | }
|
5067 | }
|
5068 |
|
5069 | return [workInProgressHook.memoizedState, dispatch];
|
5070 | } else {
|
5071 | {
|
5072 | isInHookUserCodeInDev = true;
|
5073 | }
|
5074 |
|
5075 | var initialState;
|
5076 |
|
5077 | if (reducer === basicStateReducer) {
|
5078 |
|
5079 | initialState = typeof initialArg === 'function' ? initialArg() : initialArg;
|
5080 | } else {
|
5081 | initialState = init !== undefined ? init(initialArg) : initialArg;
|
5082 | }
|
5083 |
|
5084 | {
|
5085 | isInHookUserCodeInDev = false;
|
5086 | }
|
5087 |
|
5088 | workInProgressHook.memoizedState = initialState;
|
5089 |
|
5090 | var _queue = workInProgressHook.queue = {
|
5091 | last: null,
|
5092 | dispatch: null
|
5093 | };
|
5094 |
|
5095 | var _dispatch = _queue.dispatch = dispatchAction.bind(null, currentlyRenderingComponent, _queue);
|
5096 |
|
5097 | return [workInProgressHook.memoizedState, _dispatch];
|
5098 | }
|
5099 | }
|
5100 |
|
5101 | function useMemo(nextCreate, deps) {
|
5102 | currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
|
5103 | workInProgressHook = createWorkInProgressHook();
|
5104 | var nextDeps = deps === undefined ? null : deps;
|
5105 |
|
5106 | if (workInProgressHook !== null) {
|
5107 | var prevState = workInProgressHook.memoizedState;
|
5108 |
|
5109 | if (prevState !== null) {
|
5110 | if (nextDeps !== null) {
|
5111 | var prevDeps = prevState[1];
|
5112 |
|
5113 | if (areHookInputsEqual(nextDeps, prevDeps)) {
|
5114 | return prevState[0];
|
5115 | }
|
5116 | }
|
5117 | }
|
5118 | }
|
5119 |
|
5120 | {
|
5121 | isInHookUserCodeInDev = true;
|
5122 | }
|
5123 |
|
5124 | var nextValue = nextCreate();
|
5125 |
|
5126 | {
|
5127 | isInHookUserCodeInDev = false;
|
5128 | }
|
5129 |
|
5130 | workInProgressHook.memoizedState = [nextValue, nextDeps];
|
5131 | return nextValue;
|
5132 | }
|
5133 |
|
5134 | function useRef(initialValue) {
|
5135 | currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
|
5136 | workInProgressHook = createWorkInProgressHook();
|
5137 | var previousRef = workInProgressHook.memoizedState;
|
5138 |
|
5139 | if (previousRef === null) {
|
5140 | var ref = {
|
5141 | current: initialValue
|
5142 | };
|
5143 |
|
5144 | {
|
5145 | Object.seal(ref);
|
5146 | }
|
5147 |
|
5148 | workInProgressHook.memoizedState = ref;
|
5149 | return ref;
|
5150 | } else {
|
5151 | return previousRef;
|
5152 | }
|
5153 | }
|
5154 |
|
5155 | function useLayoutEffect(create, inputs) {
|
5156 | {
|
5157 | currentHookNameInDev = 'useLayoutEffect';
|
5158 |
|
5159 | error('useLayoutEffect does nothing on the server, because its effect cannot ' + "be encoded into the server renderer's output format. This will lead " + 'to a mismatch between the initial, non-hydrated UI and the intended ' + 'UI. To avoid this, useLayoutEffect should only be used in ' + 'components that render exclusively on the client. ' + 'See https://reactjs.org/link/uselayouteffect-ssr for common fixes.');
|
5160 | }
|
5161 | }
|
5162 |
|
5163 | function dispatchAction(componentIdentity, queue, action) {
|
5164 | if (numberOfReRenders >= RE_RENDER_LIMIT) {
|
5165 | throw new Error('Too many re-renders. React limits the number of renders to prevent ' + 'an infinite loop.');
|
5166 | }
|
5167 |
|
5168 | if (componentIdentity === currentlyRenderingComponent) {
|
5169 |
|
5170 |
|
5171 |
|
5172 | didScheduleRenderPhaseUpdate = true;
|
5173 | var update = {
|
5174 | action: action,
|
5175 | next: null
|
5176 | };
|
5177 |
|
5178 | if (renderPhaseUpdates === null) {
|
5179 | renderPhaseUpdates = new Map();
|
5180 | }
|
5181 |
|
5182 | var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
|
5183 |
|
5184 | if (firstRenderPhaseUpdate === undefined) {
|
5185 | renderPhaseUpdates.set(queue, update);
|
5186 | } else {
|
5187 |
|
5188 | var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
|
5189 |
|
5190 | while (lastRenderPhaseUpdate.next !== null) {
|
5191 | lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
|
5192 | }
|
5193 |
|
5194 | lastRenderPhaseUpdate.next = update;
|
5195 | }
|
5196 | }
|
5197 | }
|
5198 |
|
5199 | function useCallback(callback, deps) {
|
5200 | return useMemo(function () {
|
5201 | return callback;
|
5202 | }, deps);
|
5203 | }
|
5204 |
|
5205 |
|
5206 |
|
5207 | function useMutableSource(source, getSnapshot, subscribe) {
|
5208 | resolveCurrentlyRenderingComponent();
|
5209 | return getSnapshot(source._source);
|
5210 | }
|
5211 |
|
5212 | function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
5213 | if (getServerSnapshot === undefined) {
|
5214 | throw new Error('Missing getServerSnapshot, which is required for ' + 'server-rendered content. Will revert to client rendering.');
|
5215 | }
|
5216 |
|
5217 | return getServerSnapshot();
|
5218 | }
|
5219 |
|
5220 | function useDeferredValue(value) {
|
5221 | resolveCurrentlyRenderingComponent();
|
5222 | return value;
|
5223 | }
|
5224 |
|
5225 | function unsupportedStartTransition() {
|
5226 | throw new Error('startTransition cannot be called during server rendering.');
|
5227 | }
|
5228 |
|
5229 | function useTransition() {
|
5230 | resolveCurrentlyRenderingComponent();
|
5231 | return [false, unsupportedStartTransition];
|
5232 | }
|
5233 |
|
5234 | function useId() {
|
5235 | var task = currentlyRenderingTask;
|
5236 | var treeId = getTreeId(task.treeContext);
|
5237 | var responseState = currentResponseState;
|
5238 |
|
5239 | if (responseState === null) {
|
5240 | throw new Error('Invalid hook call. Hooks can only be called inside of the body of a function component.');
|
5241 | }
|
5242 |
|
5243 | var localId = localIdCounter++;
|
5244 | return makeId(responseState, treeId, localId);
|
5245 | }
|
5246 |
|
5247 | function noop() {}
|
5248 |
|
5249 | var Dispatcher = {
|
5250 | readContext: readContext$1,
|
5251 | useContext: useContext,
|
5252 | useMemo: useMemo,
|
5253 | useReducer: useReducer,
|
5254 | useRef: useRef,
|
5255 | useState: useState,
|
5256 | useInsertionEffect: noop,
|
5257 | useLayoutEffect: useLayoutEffect,
|
5258 | useCallback: useCallback,
|
5259 |
|
5260 | useImperativeHandle: noop,
|
5261 |
|
5262 | useEffect: noop,
|
5263 |
|
5264 | useDebugValue: noop,
|
5265 | useDeferredValue: useDeferredValue,
|
5266 | useTransition: useTransition,
|
5267 | useId: useId,
|
5268 |
|
5269 | useMutableSource: useMutableSource,
|
5270 | useSyncExternalStore: useSyncExternalStore
|
5271 | };
|
5272 |
|
5273 | var currentResponseState = null;
|
5274 | function setCurrentResponseState(responseState) {
|
5275 | currentResponseState = responseState;
|
5276 | }
|
5277 |
|
5278 | function getStackByComponentStackNode(componentStack) {
|
5279 | try {
|
5280 | var info = '';
|
5281 | var node = componentStack;
|
5282 |
|
5283 | do {
|
5284 | switch (node.tag) {
|
5285 | case 0:
|
5286 | info += describeBuiltInComponentFrame(node.type, null, null);
|
5287 | break;
|
5288 |
|
5289 | case 1:
|
5290 | info += describeFunctionComponentFrame(node.type, null, null);
|
5291 | break;
|
5292 |
|
5293 | case 2:
|
5294 | info += describeClassComponentFrame(node.type, null, null);
|
5295 | break;
|
5296 | }
|
5297 |
|
5298 | node = node.parent;
|
5299 | } while (node);
|
5300 |
|
5301 | return info;
|
5302 | } catch (x) {
|
5303 | return '\nError generating stack: ' + x.message + '\n' + x.stack;
|
5304 | }
|
5305 | }
|
5306 |
|
5307 | var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
5308 | var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
5309 | var PENDING = 0;
|
5310 | var COMPLETED = 1;
|
5311 | var FLUSHED = 2;
|
5312 | var ABORTED = 3;
|
5313 | var ERRORED = 4;
|
5314 | var OPEN = 0;
|
5315 | var CLOSING = 1;
|
5316 | var CLOSED = 2;
|
5317 |
|
5318 |
|
5319 |
|
5320 |
|
5321 |
|
5322 |
|
5323 |
|
5324 |
|
5325 |
|
5326 |
|
5327 |
|
5328 |
|
5329 |
|
5330 |
|
5331 |
|
5332 | var DEFAULT_PROGRESSIVE_CHUNK_SIZE = 12800;
|
5333 |
|
5334 | function defaultErrorHandler(error) {
|
5335 | console['error'](error);
|
5336 |
|
5337 | return null;
|
5338 | }
|
5339 |
|
5340 | function noop$1() {}
|
5341 |
|
5342 | function createRequest(children, responseState, rootFormatContext, progressiveChunkSize, onError, onAllReady, onShellReady, onShellError, onFatalError) {
|
5343 | var pingedTasks = [];
|
5344 | var abortSet = new Set();
|
5345 | var request = {
|
5346 | destination: null,
|
5347 | responseState: responseState,
|
5348 | progressiveChunkSize: progressiveChunkSize === undefined ? DEFAULT_PROGRESSIVE_CHUNK_SIZE : progressiveChunkSize,
|
5349 | status: OPEN,
|
5350 | fatalError: null,
|
5351 | nextSegmentId: 0,
|
5352 | allPendingTasks: 0,
|
5353 | pendingRootTasks: 0,
|
5354 | completedRootSegment: null,
|
5355 | abortableTasks: abortSet,
|
5356 | pingedTasks: pingedTasks,
|
5357 | clientRenderedBoundaries: [],
|
5358 | completedBoundaries: [],
|
5359 | partialBoundaries: [],
|
5360 | onError: onError === undefined ? defaultErrorHandler : onError,
|
5361 | onAllReady: onAllReady === undefined ? noop$1 : onAllReady,
|
5362 | onShellReady: onShellReady === undefined ? noop$1 : onShellReady,
|
5363 | onShellError: onShellError === undefined ? noop$1 : onShellError,
|
5364 | onFatalError: onFatalError === undefined ? noop$1 : onFatalError
|
5365 | };
|
5366 |
|
5367 | var rootSegment = createPendingSegment(request, 0, null, rootFormatContext,
|
5368 | false, false);
|
5369 |
|
5370 | rootSegment.parentFlushed = true;
|
5371 | var rootTask = createTask(request, children, null, rootSegment, abortSet, emptyContextObject, rootContextSnapshot, emptyTreeContext);
|
5372 | pingedTasks.push(rootTask);
|
5373 | return request;
|
5374 | }
|
5375 |
|
5376 | function pingTask(request, task) {
|
5377 | var pingedTasks = request.pingedTasks;
|
5378 | pingedTasks.push(task);
|
5379 |
|
5380 | if (pingedTasks.length === 1) {
|
5381 | scheduleWork(function () {
|
5382 | return performWork(request);
|
5383 | });
|
5384 | }
|
5385 | }
|
5386 |
|
5387 | function createSuspenseBoundary(request, fallbackAbortableTasks) {
|
5388 | return {
|
5389 | id: UNINITIALIZED_SUSPENSE_BOUNDARY_ID,
|
5390 | rootSegmentID: -1,
|
5391 | parentFlushed: false,
|
5392 | pendingTasks: 0,
|
5393 | forceClientRender: false,
|
5394 | completedSegments: [],
|
5395 | byteSize: 0,
|
5396 | fallbackAbortableTasks: fallbackAbortableTasks,
|
5397 | errorDigest: null
|
5398 | };
|
5399 | }
|
5400 |
|
5401 | function createTask(request, node, blockedBoundary, blockedSegment, abortSet, legacyContext, context, treeContext) {
|
5402 | request.allPendingTasks++;
|
5403 |
|
5404 | if (blockedBoundary === null) {
|
5405 | request.pendingRootTasks++;
|
5406 | } else {
|
5407 | blockedBoundary.pendingTasks++;
|
5408 | }
|
5409 |
|
5410 | var task = {
|
5411 | node: node,
|
5412 | ping: function () {
|
5413 | return pingTask(request, task);
|
5414 | },
|
5415 | blockedBoundary: blockedBoundary,
|
5416 | blockedSegment: blockedSegment,
|
5417 | abortSet: abortSet,
|
5418 | legacyContext: legacyContext,
|
5419 | context: context,
|
5420 | treeContext: treeContext
|
5421 | };
|
5422 |
|
5423 | {
|
5424 | task.componentStack = null;
|
5425 | }
|
5426 |
|
5427 | abortSet.add(task);
|
5428 | return task;
|
5429 | }
|
5430 |
|
5431 | function createPendingSegment(request, index, boundary, formatContext, lastPushedText, textEmbedded) {
|
5432 | return {
|
5433 | status: PENDING,
|
5434 | id: -1,
|
5435 |
|
5436 | index: index,
|
5437 | parentFlushed: false,
|
5438 | chunks: [],
|
5439 | children: [],
|
5440 | formatContext: formatContext,
|
5441 | boundary: boundary,
|
5442 | lastPushedText: lastPushedText,
|
5443 | textEmbedded: textEmbedded
|
5444 | };
|
5445 | }
|
5446 |
|
5447 |
|
5448 | var currentTaskInDEV = null;
|
5449 |
|
5450 | function getCurrentStackInDEV() {
|
5451 | {
|
5452 | if (currentTaskInDEV === null || currentTaskInDEV.componentStack === null) {
|
5453 | return '';
|
5454 | }
|
5455 |
|
5456 | return getStackByComponentStackNode(currentTaskInDEV.componentStack);
|
5457 | }
|
5458 | }
|
5459 |
|
5460 | function pushBuiltInComponentStackInDEV(task, type) {
|
5461 | {
|
5462 | task.componentStack = {
|
5463 | tag: 0,
|
5464 | parent: task.componentStack,
|
5465 | type: type
|
5466 | };
|
5467 | }
|
5468 | }
|
5469 |
|
5470 | function pushFunctionComponentStackInDEV(task, type) {
|
5471 | {
|
5472 | task.componentStack = {
|
5473 | tag: 1,
|
5474 | parent: task.componentStack,
|
5475 | type: type
|
5476 | };
|
5477 | }
|
5478 | }
|
5479 |
|
5480 | function pushClassComponentStackInDEV(task, type) {
|
5481 | {
|
5482 | task.componentStack = {
|
5483 | tag: 2,
|
5484 | parent: task.componentStack,
|
5485 | type: type
|
5486 | };
|
5487 | }
|
5488 | }
|
5489 |
|
5490 | function popComponentStackInDEV(task) {
|
5491 | {
|
5492 | if (task.componentStack === null) {
|
5493 | error('Unexpectedly popped too many stack frames. This is a bug in React.');
|
5494 | } else {
|
5495 | task.componentStack = task.componentStack.parent;
|
5496 | }
|
5497 | }
|
5498 | }
|
5499 |
|
5500 |
|
5501 | var lastBoundaryErrorComponentStackDev = null;
|
5502 |
|
5503 | function captureBoundaryErrorDetailsDev(boundary, error) {
|
5504 | {
|
5505 | var errorMessage;
|
5506 |
|
5507 | if (typeof error === 'string') {
|
5508 | errorMessage = error;
|
5509 | } else if (error && typeof error.message === 'string') {
|
5510 | errorMessage = error.message;
|
5511 | } else {
|
5512 |
|
5513 | errorMessage = String(error);
|
5514 | }
|
5515 |
|
5516 | var errorComponentStack = lastBoundaryErrorComponentStackDev || getCurrentStackInDEV();
|
5517 | lastBoundaryErrorComponentStackDev = null;
|
5518 | boundary.errorMessage = errorMessage;
|
5519 | boundary.errorComponentStack = errorComponentStack;
|
5520 | }
|
5521 | }
|
5522 |
|
5523 | function logRecoverableError(request, error) {
|
5524 |
|
5525 |
|
5526 | var errorDigest = request.onError(error);
|
5527 |
|
5528 | if (errorDigest != null && typeof errorDigest !== 'string') {
|
5529 |
|
5530 | throw new Error("onError returned something with a type other than \"string\". onError should return a string and may return null or undefined but must not return anything else. It received something of type \"" + typeof errorDigest + "\" instead");
|
5531 | }
|
5532 |
|
5533 | return errorDigest;
|
5534 | }
|
5535 |
|
5536 | function fatalError(request, error) {
|
5537 |
|
5538 |
|
5539 |
|
5540 | var onShellError = request.onShellError;
|
5541 | onShellError(error);
|
5542 | var onFatalError = request.onFatalError;
|
5543 | onFatalError(error);
|
5544 |
|
5545 | if (request.destination !== null) {
|
5546 | request.status = CLOSED;
|
5547 | closeWithError(request.destination, error);
|
5548 | } else {
|
5549 | request.status = CLOSING;
|
5550 | request.fatalError = error;
|
5551 | }
|
5552 | }
|
5553 |
|
5554 | function renderSuspenseBoundary(request, task, props) {
|
5555 | pushBuiltInComponentStackInDEV(task, 'Suspense');
|
5556 | var parentBoundary = task.blockedBoundary;
|
5557 | var parentSegment = task.blockedSegment;
|
5558 |
|
5559 |
|
5560 |
|
5561 |
|
5562 | var fallback = props.fallback;
|
5563 | var content = props.children;
|
5564 | var fallbackAbortSet = new Set();
|
5565 | var newBoundary = createSuspenseBoundary(request, fallbackAbortSet);
|
5566 | var insertionIndex = parentSegment.chunks.length;
|
5567 |
|
5568 | var boundarySegment = createPendingSegment(request, insertionIndex, newBoundary, parentSegment.formatContext,
|
5569 | false, false);
|
5570 | parentSegment.children.push(boundarySegment);
|
5571 |
|
5572 | parentSegment.lastPushedText = false;
|
5573 |
|
5574 | var contentRootSegment = createPendingSegment(request, 0, null, parentSegment.formatContext,
|
5575 | false, false);
|
5576 |
|
5577 |
|
5578 | contentRootSegment.parentFlushed = true;
|
5579 |
|
5580 |
|
5581 |
|
5582 |
|
5583 |
|
5584 |
|
5585 |
|
5586 | task.blockedBoundary = newBoundary;
|
5587 | task.blockedSegment = contentRootSegment;
|
5588 |
|
5589 | try {
|
5590 |
|
5591 | renderNode(request, task, content);
|
5592 | pushSegmentFinale(contentRootSegment.chunks, request.responseState, contentRootSegment.lastPushedText, contentRootSegment.textEmbedded);
|
5593 | contentRootSegment.status = COMPLETED;
|
5594 | queueCompletedSegment(newBoundary, contentRootSegment);
|
5595 |
|
5596 | if (newBoundary.pendingTasks === 0) {
|
5597 |
|
5598 |
|
5599 |
|
5600 | popComponentStackInDEV(task);
|
5601 | return;
|
5602 | }
|
5603 | } catch (error) {
|
5604 | contentRootSegment.status = ERRORED;
|
5605 | newBoundary.forceClientRender = true;
|
5606 | newBoundary.errorDigest = logRecoverableError(request, error);
|
5607 |
|
5608 | {
|
5609 | captureBoundaryErrorDetailsDev(newBoundary, error);
|
5610 | }
|
5611 |
|
5612 |
|
5613 |
|
5614 | } finally {
|
5615 | task.blockedBoundary = parentBoundary;
|
5616 | task.blockedSegment = parentSegment;
|
5617 | }
|
5618 |
|
5619 |
|
5620 |
|
5621 | var suspendedFallbackTask = createTask(request, fallback, parentBoundary, boundarySegment, fallbackAbortSet, task.legacyContext, task.context, task.treeContext);
|
5622 |
|
5623 | {
|
5624 | suspendedFallbackTask.componentStack = task.componentStack;
|
5625 | }
|
5626 |
|
5627 |
|
5628 |
|
5629 | request.pingedTasks.push(suspendedFallbackTask);
|
5630 | popComponentStackInDEV(task);
|
5631 | }
|
5632 |
|
5633 | function renderHostElement(request, task, type, props) {
|
5634 | pushBuiltInComponentStackInDEV(task, type);
|
5635 | var segment = task.blockedSegment;
|
5636 | var children = pushStartInstance(segment.chunks, type, props, request.responseState, segment.formatContext);
|
5637 | segment.lastPushedText = false;
|
5638 | var prevContext = segment.formatContext;
|
5639 | segment.formatContext = getChildFormatContext(prevContext, type, props);
|
5640 |
|
5641 |
|
5642 | renderNode(request, task, children);
|
5643 |
|
5644 |
|
5645 | segment.formatContext = prevContext;
|
5646 | pushEndInstance(segment.chunks, type);
|
5647 | segment.lastPushedText = false;
|
5648 | popComponentStackInDEV(task);
|
5649 | }
|
5650 |
|
5651 | function shouldConstruct$1(Component) {
|
5652 | return Component.prototype && Component.prototype.isReactComponent;
|
5653 | }
|
5654 |
|
5655 | function renderWithHooks(request, task, Component, props, secondArg) {
|
5656 | var componentIdentity = {};
|
5657 | prepareToUseHooks(task, componentIdentity);
|
5658 | var result = Component(props, secondArg);
|
5659 | return finishHooks(Component, props, result, secondArg);
|
5660 | }
|
5661 |
|
5662 | function finishClassComponent(request, task, instance, Component, props) {
|
5663 | var nextChildren = instance.render();
|
5664 |
|
5665 | {
|
5666 | if (instance.props !== props) {
|
5667 | if (!didWarnAboutReassigningProps) {
|
5668 | error('It looks like %s is reassigning its own `this.props` while rendering. ' + 'This is not supported and can lead to confusing bugs.', getComponentNameFromType(Component) || 'a component');
|
5669 | }
|
5670 |
|
5671 | didWarnAboutReassigningProps = true;
|
5672 | }
|
5673 | }
|
5674 |
|
5675 | {
|
5676 | var childContextTypes = Component.childContextTypes;
|
5677 |
|
5678 | if (childContextTypes !== null && childContextTypes !== undefined) {
|
5679 | var previousContext = task.legacyContext;
|
5680 | var mergedContext = processChildContext(instance, Component, previousContext, childContextTypes);
|
5681 | task.legacyContext = mergedContext;
|
5682 | renderNodeDestructive(request, task, nextChildren);
|
5683 | task.legacyContext = previousContext;
|
5684 | return;
|
5685 | }
|
5686 | }
|
5687 |
|
5688 | renderNodeDestructive(request, task, nextChildren);
|
5689 | }
|
5690 |
|
5691 | function renderClassComponent(request, task, Component, props) {
|
5692 | pushClassComponentStackInDEV(task, Component);
|
5693 | var maskedContext = getMaskedContext(Component, task.legacyContext) ;
|
5694 | var instance = constructClassInstance(Component, props, maskedContext);
|
5695 | mountClassInstance(instance, Component, props, maskedContext);
|
5696 | finishClassComponent(request, task, instance, Component, props);
|
5697 | popComponentStackInDEV(task);
|
5698 | }
|
5699 |
|
5700 | var didWarnAboutBadClass = {};
|
5701 | var didWarnAboutModulePatternComponent = {};
|
5702 | var didWarnAboutContextTypeOnFunctionComponent = {};
|
5703 | var didWarnAboutGetDerivedStateOnFunctionComponent = {};
|
5704 | var didWarnAboutReassigningProps = false;
|
5705 | var didWarnAboutGenerators = false;
|
5706 | var didWarnAboutMaps = false;
|
5707 | var hasWarnedAboutUsingContextAsConsumer = false;
|
5708 |
|
5709 |
|
5710 | function renderIndeterminateComponent(request, task, Component, props) {
|
5711 | var legacyContext;
|
5712 |
|
5713 | {
|
5714 | legacyContext = getMaskedContext(Component, task.legacyContext);
|
5715 | }
|
5716 |
|
5717 | pushFunctionComponentStackInDEV(task, Component);
|
5718 |
|
5719 | {
|
5720 | if (Component.prototype && typeof Component.prototype.render === 'function') {
|
5721 | var componentName = getComponentNameFromType(Component) || 'Unknown';
|
5722 |
|
5723 | if (!didWarnAboutBadClass[componentName]) {
|
5724 | error("The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName);
|
5725 |
|
5726 | didWarnAboutBadClass[componentName] = true;
|
5727 | }
|
5728 | }
|
5729 | }
|
5730 |
|
5731 | var value = renderWithHooks(request, task, Component, props, legacyContext);
|
5732 | var hasId = checkDidRenderIdHook();
|
5733 |
|
5734 | {
|
5735 |
|
5736 |
|
5737 | if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
|
5738 | var _componentName = getComponentNameFromType(Component) || 'Unknown';
|
5739 |
|
5740 | if (!didWarnAboutModulePatternComponent[_componentName]) {
|
5741 | error('The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName, _componentName, _componentName);
|
5742 |
|
5743 | didWarnAboutModulePatternComponent[_componentName] = true;
|
5744 | }
|
5745 | }
|
5746 | }
|
5747 |
|
5748 | if (
|
5749 |
|
5750 | typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
|
5751 | {
|
5752 | var _componentName2 = getComponentNameFromType(Component) || 'Unknown';
|
5753 |
|
5754 | if (!didWarnAboutModulePatternComponent[_componentName2]) {
|
5755 | error('The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName2, _componentName2, _componentName2);
|
5756 |
|
5757 | didWarnAboutModulePatternComponent[_componentName2] = true;
|
5758 | }
|
5759 | }
|
5760 |
|
5761 | mountClassInstance(value, Component, props, legacyContext);
|
5762 | finishClassComponent(request, task, value, Component, props);
|
5763 | } else {
|
5764 |
|
5765 | {
|
5766 | validateFunctionComponentInDev(Component);
|
5767 | }
|
5768 |
|
5769 |
|
5770 |
|
5771 | if (hasId) {
|
5772 |
|
5773 |
|
5774 | var prevTreeContext = task.treeContext;
|
5775 | var totalChildren = 1;
|
5776 | var index = 0;
|
5777 | task.treeContext = pushTreeContext(prevTreeContext, totalChildren, index);
|
5778 |
|
5779 | try {
|
5780 | renderNodeDestructive(request, task, value);
|
5781 | } finally {
|
5782 | task.treeContext = prevTreeContext;
|
5783 | }
|
5784 | } else {
|
5785 | renderNodeDestructive(request, task, value);
|
5786 | }
|
5787 | }
|
5788 |
|
5789 | popComponentStackInDEV(task);
|
5790 | }
|
5791 |
|
5792 | function validateFunctionComponentInDev(Component) {
|
5793 | {
|
5794 | if (Component) {
|
5795 | if (Component.childContextTypes) {
|
5796 | error('%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component');
|
5797 | }
|
5798 | }
|
5799 |
|
5800 | if (typeof Component.getDerivedStateFromProps === 'function') {
|
5801 | var _componentName3 = getComponentNameFromType(Component) || 'Unknown';
|
5802 |
|
5803 | if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3]) {
|
5804 | error('%s: Function components do not support getDerivedStateFromProps.', _componentName3);
|
5805 |
|
5806 | didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3] = true;
|
5807 | }
|
5808 | }
|
5809 |
|
5810 | if (typeof Component.contextType === 'object' && Component.contextType !== null) {
|
5811 | var _componentName4 = getComponentNameFromType(Component) || 'Unknown';
|
5812 |
|
5813 | if (!didWarnAboutContextTypeOnFunctionComponent[_componentName4]) {
|
5814 | error('%s: Function components do not support contextType.', _componentName4);
|
5815 |
|
5816 | didWarnAboutContextTypeOnFunctionComponent[_componentName4] = true;
|
5817 | }
|
5818 | }
|
5819 | }
|
5820 | }
|
5821 |
|
5822 | function resolveDefaultProps(Component, baseProps) {
|
5823 | if (Component && Component.defaultProps) {
|
5824 |
|
5825 | var props = assign({}, baseProps);
|
5826 | var defaultProps = Component.defaultProps;
|
5827 |
|
5828 | for (var propName in defaultProps) {
|
5829 | if (props[propName] === undefined) {
|
5830 | props[propName] = defaultProps[propName];
|
5831 | }
|
5832 | }
|
5833 |
|
5834 | return props;
|
5835 | }
|
5836 |
|
5837 | return baseProps;
|
5838 | }
|
5839 |
|
5840 | function renderForwardRef(request, task, type, props, ref) {
|
5841 | pushFunctionComponentStackInDEV(task, type.render);
|
5842 | var children = renderWithHooks(request, task, type.render, props, ref);
|
5843 | var hasId = checkDidRenderIdHook();
|
5844 |
|
5845 | if (hasId) {
|
5846 |
|
5847 |
|
5848 | var prevTreeContext = task.treeContext;
|
5849 | var totalChildren = 1;
|
5850 | var index = 0;
|
5851 | task.treeContext = pushTreeContext(prevTreeContext, totalChildren, index);
|
5852 |
|
5853 | try {
|
5854 | renderNodeDestructive(request, task, children);
|
5855 | } finally {
|
5856 | task.treeContext = prevTreeContext;
|
5857 | }
|
5858 | } else {
|
5859 | renderNodeDestructive(request, task, children);
|
5860 | }
|
5861 |
|
5862 | popComponentStackInDEV(task);
|
5863 | }
|
5864 |
|
5865 | function renderMemo(request, task, type, props, ref) {
|
5866 | var innerType = type.type;
|
5867 | var resolvedProps = resolveDefaultProps(innerType, props);
|
5868 | renderElement(request, task, innerType, resolvedProps, ref);
|
5869 | }
|
5870 |
|
5871 | function renderContextConsumer(request, task, context, props) {
|
5872 |
|
5873 |
|
5874 |
|
5875 |
|
5876 |
|
5877 |
|
5878 |
|
5879 | {
|
5880 | if (context._context === undefined) {
|
5881 |
|
5882 |
|
5883 |
|
5884 | if (context !== context.Consumer) {
|
5885 | if (!hasWarnedAboutUsingContextAsConsumer) {
|
5886 | hasWarnedAboutUsingContextAsConsumer = true;
|
5887 |
|
5888 | error('Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
|
5889 | }
|
5890 | }
|
5891 | } else {
|
5892 | context = context._context;
|
5893 | }
|
5894 | }
|
5895 |
|
5896 | var render = props.children;
|
5897 |
|
5898 | {
|
5899 | if (typeof render !== 'function') {
|
5900 | error('A context consumer was rendered with multiple children, or a child ' + "that isn't a function. A context consumer expects a single child " + 'that is a function. If you did pass a function, make sure there ' + 'is no trailing or leading whitespace around it.');
|
5901 | }
|
5902 | }
|
5903 |
|
5904 | var newValue = readContext(context);
|
5905 | var newChildren = render(newValue);
|
5906 | renderNodeDestructive(request, task, newChildren);
|
5907 | }
|
5908 |
|
5909 | function renderContextProvider(request, task, type, props) {
|
5910 | var context = type._context;
|
5911 | var value = props.value;
|
5912 | var children = props.children;
|
5913 | var prevSnapshot;
|
5914 |
|
5915 | {
|
5916 | prevSnapshot = task.context;
|
5917 | }
|
5918 |
|
5919 | task.context = pushProvider(context, value);
|
5920 | renderNodeDestructive(request, task, children);
|
5921 | task.context = popProvider(context);
|
5922 |
|
5923 | {
|
5924 | if (prevSnapshot !== task.context) {
|
5925 | error('Popping the context provider did not return back to the original snapshot. This is a bug in React.');
|
5926 | }
|
5927 | }
|
5928 | }
|
5929 |
|
5930 | function renderLazyComponent(request, task, lazyComponent, props, ref) {
|
5931 | pushBuiltInComponentStackInDEV(task, 'Lazy');
|
5932 | var payload = lazyComponent._payload;
|
5933 | var init = lazyComponent._init;
|
5934 | var Component = init(payload);
|
5935 | var resolvedProps = resolveDefaultProps(Component, props);
|
5936 | renderElement(request, task, Component, resolvedProps, ref);
|
5937 | popComponentStackInDEV(task);
|
5938 | }
|
5939 |
|
5940 | function renderElement(request, task, type, props, ref) {
|
5941 | if (typeof type === 'function') {
|
5942 | if (shouldConstruct$1(type)) {
|
5943 | renderClassComponent(request, task, type, props);
|
5944 | return;
|
5945 | } else {
|
5946 | renderIndeterminateComponent(request, task, type, props);
|
5947 | return;
|
5948 | }
|
5949 | }
|
5950 |
|
5951 | if (typeof type === 'string') {
|
5952 | renderHostElement(request, task, type, props);
|
5953 | return;
|
5954 | }
|
5955 |
|
5956 | switch (type) {
|
5957 |
|
5958 |
|
5959 |
|
5960 |
|
5961 |
|
5962 |
|
5963 |
|
5964 |
|
5965 | case REACT_LEGACY_HIDDEN_TYPE:
|
5966 | case REACT_DEBUG_TRACING_MODE_TYPE:
|
5967 | case REACT_STRICT_MODE_TYPE:
|
5968 | case REACT_PROFILER_TYPE:
|
5969 | case REACT_FRAGMENT_TYPE:
|
5970 | {
|
5971 | renderNodeDestructive(request, task, props.children);
|
5972 | return;
|
5973 | }
|
5974 |
|
5975 | case REACT_SUSPENSE_LIST_TYPE:
|
5976 | {
|
5977 | pushBuiltInComponentStackInDEV(task, 'SuspenseList');
|
5978 |
|
5979 | renderNodeDestructive(request, task, props.children);
|
5980 | popComponentStackInDEV(task);
|
5981 | return;
|
5982 | }
|
5983 |
|
5984 | case REACT_SCOPE_TYPE:
|
5985 | {
|
5986 |
|
5987 | throw new Error('ReactDOMServer does not yet support scope components.');
|
5988 | }
|
5989 |
|
5990 |
|
5991 | case REACT_SUSPENSE_TYPE:
|
5992 | {
|
5993 | {
|
5994 | renderSuspenseBoundary(request, task, props);
|
5995 | }
|
5996 |
|
5997 | return;
|
5998 | }
|
5999 | }
|
6000 |
|
6001 | if (typeof type === 'object' && type !== null) {
|
6002 | switch (type.$$typeof) {
|
6003 | case REACT_FORWARD_REF_TYPE:
|
6004 | {
|
6005 | renderForwardRef(request, task, type, props, ref);
|
6006 | return;
|
6007 | }
|
6008 |
|
6009 | case REACT_MEMO_TYPE:
|
6010 | {
|
6011 | renderMemo(request, task, type, props, ref);
|
6012 | return;
|
6013 | }
|
6014 |
|
6015 | case REACT_PROVIDER_TYPE:
|
6016 | {
|
6017 | renderContextProvider(request, task, type, props);
|
6018 | return;
|
6019 | }
|
6020 |
|
6021 | case REACT_CONTEXT_TYPE:
|
6022 | {
|
6023 | renderContextConsumer(request, task, type, props);
|
6024 | return;
|
6025 | }
|
6026 |
|
6027 | case REACT_LAZY_TYPE:
|
6028 | {
|
6029 | renderLazyComponent(request, task, type, props);
|
6030 | return;
|
6031 | }
|
6032 | }
|
6033 | }
|
6034 |
|
6035 | var info = '';
|
6036 |
|
6037 | {
|
6038 | if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
6039 | 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.';
|
6040 | }
|
6041 | }
|
6042 |
|
6043 | throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + (type == null ? type : typeof type) + "." + info));
|
6044 | }
|
6045 |
|
6046 | function validateIterable(iterable, iteratorFn) {
|
6047 | {
|
6048 |
|
6049 |
|
6050 | if (typeof Symbol === 'function' &&
|
6051 | iterable[Symbol.toStringTag] === 'Generator') {
|
6052 | if (!didWarnAboutGenerators) {
|
6053 | error('Using Generators as children is unsupported and will likely yield ' + 'unexpected results because enumerating a generator mutates it. ' + 'You may convert it to an array with `Array.from()` or the ' + '`[...spread]` operator before rendering. Keep in mind ' + 'you might need to polyfill these features for older browsers.');
|
6054 | }
|
6055 |
|
6056 | didWarnAboutGenerators = true;
|
6057 | }
|
6058 |
|
6059 |
|
6060 | if (iterable.entries === iteratorFn) {
|
6061 | if (!didWarnAboutMaps) {
|
6062 | error('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
|
6063 | }
|
6064 |
|
6065 | didWarnAboutMaps = true;
|
6066 | }
|
6067 | }
|
6068 | }
|
6069 |
|
6070 | function renderNodeDestructive(request, task, node) {
|
6071 | {
|
6072 |
|
6073 |
|
6074 |
|
6075 | try {
|
6076 | return renderNodeDestructiveImpl(request, task, node);
|
6077 | } catch (x) {
|
6078 | if (typeof x === 'object' && x !== null && typeof x.then === 'function') ; else {
|
6079 |
|
6080 | lastBoundaryErrorComponentStackDev = lastBoundaryErrorComponentStackDev !== null ? lastBoundaryErrorComponentStackDev : getCurrentStackInDEV();
|
6081 | }
|
6082 |
|
6083 |
|
6084 | throw x;
|
6085 | }
|
6086 | }
|
6087 | }
|
6088 |
|
6089 |
|
6090 |
|
6091 | function renderNodeDestructiveImpl(request, task, node) {
|
6092 |
|
6093 |
|
6094 | task.node = node;
|
6095 |
|
6096 | if (typeof node === 'object' && node !== null) {
|
6097 | switch (node.$$typeof) {
|
6098 | case REACT_ELEMENT_TYPE:
|
6099 | {
|
6100 | var element = node;
|
6101 | var type = element.type;
|
6102 | var props = element.props;
|
6103 | var ref = element.ref;
|
6104 | renderElement(request, task, type, props, ref);
|
6105 | return;
|
6106 | }
|
6107 |
|
6108 | case REACT_PORTAL_TYPE:
|
6109 | throw new Error('Portals are not currently supported by the server renderer. ' + 'Render them conditionally so that they only appear on the client render.');
|
6110 |
|
6111 |
|
6112 | case REACT_LAZY_TYPE:
|
6113 | {
|
6114 | var lazyNode = node;
|
6115 | var payload = lazyNode._payload;
|
6116 | var init = lazyNode._init;
|
6117 | var resolvedNode;
|
6118 |
|
6119 | {
|
6120 | try {
|
6121 | resolvedNode = init(payload);
|
6122 | } catch (x) {
|
6123 | if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
|
6124 |
|
6125 |
|
6126 |
|
6127 |
|
6128 | pushBuiltInComponentStackInDEV(task, 'Lazy');
|
6129 | }
|
6130 |
|
6131 | throw x;
|
6132 | }
|
6133 | }
|
6134 |
|
6135 | renderNodeDestructive(request, task, resolvedNode);
|
6136 | return;
|
6137 | }
|
6138 | }
|
6139 |
|
6140 | if (isArray(node)) {
|
6141 | renderChildrenArray(request, task, node);
|
6142 | return;
|
6143 | }
|
6144 |
|
6145 | var iteratorFn = getIteratorFn(node);
|
6146 |
|
6147 | if (iteratorFn) {
|
6148 | {
|
6149 | validateIterable(node, iteratorFn);
|
6150 | }
|
6151 |
|
6152 | var iterator = iteratorFn.call(node);
|
6153 |
|
6154 | if (iterator) {
|
6155 |
|
6156 |
|
6157 |
|
6158 |
|
6159 |
|
6160 | var step = iterator.next();
|
6161 |
|
6162 | if (!step.done) {
|
6163 | var children = [];
|
6164 |
|
6165 | do {
|
6166 | children.push(step.value);
|
6167 | step = iterator.next();
|
6168 | } while (!step.done);
|
6169 |
|
6170 | renderChildrenArray(request, task, children);
|
6171 | return;
|
6172 | }
|
6173 |
|
6174 | return;
|
6175 | }
|
6176 | }
|
6177 |
|
6178 | var childString = Object.prototype.toString.call(node);
|
6179 | throw new Error("Objects are not valid as a React child (found: " + (childString === '[object Object]' ? 'object with keys {' + Object.keys(node).join(', ') + '}' : childString) + "). " + 'If you meant to render a collection of children, use an array ' + 'instead.');
|
6180 | }
|
6181 |
|
6182 | if (typeof node === 'string') {
|
6183 | var segment = task.blockedSegment;
|
6184 | segment.lastPushedText = pushTextInstance(task.blockedSegment.chunks, node, request.responseState, segment.lastPushedText);
|
6185 | return;
|
6186 | }
|
6187 |
|
6188 | if (typeof node === 'number') {
|
6189 | var _segment = task.blockedSegment;
|
6190 | _segment.lastPushedText = pushTextInstance(task.blockedSegment.chunks, '' + node, request.responseState, _segment.lastPushedText);
|
6191 | return;
|
6192 | }
|
6193 |
|
6194 | {
|
6195 | if (typeof node === 'function') {
|
6196 | error('Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.');
|
6197 | }
|
6198 | }
|
6199 | }
|
6200 |
|
6201 | function renderChildrenArray(request, task, children) {
|
6202 | var totalChildren = children.length;
|
6203 |
|
6204 | for (var i = 0; i < totalChildren; i++) {
|
6205 | var prevTreeContext = task.treeContext;
|
6206 | task.treeContext = pushTreeContext(prevTreeContext, totalChildren, i);
|
6207 |
|
6208 | try {
|
6209 |
|
6210 |
|
6211 | renderNode(request, task, children[i]);
|
6212 | } finally {
|
6213 | task.treeContext = prevTreeContext;
|
6214 | }
|
6215 | }
|
6216 | }
|
6217 |
|
6218 | function spawnNewSuspendedTask(request, task, x) {
|
6219 |
|
6220 | var segment = task.blockedSegment;
|
6221 | var insertionIndex = segment.chunks.length;
|
6222 | var newSegment = createPendingSegment(request, insertionIndex, null, segment.formatContext,
|
6223 | segment.lastPushedText,
|
6224 | true);
|
6225 | segment.children.push(newSegment);
|
6226 |
|
6227 | segment.lastPushedText = false;
|
6228 | var newTask = createTask(request, task.node, task.blockedBoundary, newSegment, task.abortSet, task.legacyContext, task.context, task.treeContext);
|
6229 |
|
6230 | {
|
6231 | if (task.componentStack !== null) {
|
6232 |
|
6233 |
|
6234 | newTask.componentStack = task.componentStack.parent;
|
6235 | }
|
6236 | }
|
6237 |
|
6238 | var ping = newTask.ping;
|
6239 | x.then(ping, ping);
|
6240 | }
|
6241 |
|
6242 |
|
6243 |
|
6244 | function renderNode(request, task, node) {
|
6245 |
|
6246 |
|
6247 |
|
6248 |
|
6249 | var previousFormatContext = task.blockedSegment.formatContext;
|
6250 | var previousLegacyContext = task.legacyContext;
|
6251 | var previousContext = task.context;
|
6252 | var previousComponentStack = null;
|
6253 |
|
6254 | {
|
6255 | previousComponentStack = task.componentStack;
|
6256 | }
|
6257 |
|
6258 | try {
|
6259 | return renderNodeDestructive(request, task, node);
|
6260 | } catch (x) {
|
6261 | resetHooksState();
|
6262 |
|
6263 | if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
|
6264 | spawnNewSuspendedTask(request, task, x);
|
6265 |
|
6266 |
|
6267 | task.blockedSegment.formatContext = previousFormatContext;
|
6268 | task.legacyContext = previousLegacyContext;
|
6269 | task.context = previousContext;
|
6270 |
|
6271 | switchContext(previousContext);
|
6272 |
|
6273 | {
|
6274 | task.componentStack = previousComponentStack;
|
6275 | }
|
6276 |
|
6277 | return;
|
6278 | } else {
|
6279 |
|
6280 |
|
6281 | task.blockedSegment.formatContext = previousFormatContext;
|
6282 | task.legacyContext = previousLegacyContext;
|
6283 | task.context = previousContext;
|
6284 |
|
6285 | switchContext(previousContext);
|
6286 |
|
6287 | {
|
6288 | task.componentStack = previousComponentStack;
|
6289 | }
|
6290 |
|
6291 |
|
6292 |
|
6293 | throw x;
|
6294 | }
|
6295 | }
|
6296 | }
|
6297 |
|
6298 | function erroredTask(request, boundary, segment, error) {
|
6299 |
|
6300 | var errorDigest = logRecoverableError(request, error);
|
6301 |
|
6302 | if (boundary === null) {
|
6303 | fatalError(request, error);
|
6304 | } else {
|
6305 | boundary.pendingTasks--;
|
6306 |
|
6307 | if (!boundary.forceClientRender) {
|
6308 | boundary.forceClientRender = true;
|
6309 | boundary.errorDigest = errorDigest;
|
6310 |
|
6311 | {
|
6312 | captureBoundaryErrorDetailsDev(boundary, error);
|
6313 | }
|
6314 |
|
6315 |
|
6316 |
|
6317 | if (boundary.parentFlushed) {
|
6318 |
|
6319 |
|
6320 |
|
6321 |
|
6322 | request.clientRenderedBoundaries.push(boundary);
|
6323 | }
|
6324 | }
|
6325 | }
|
6326 |
|
6327 | request.allPendingTasks--;
|
6328 |
|
6329 | if (request.allPendingTasks === 0) {
|
6330 | var onAllReady = request.onAllReady;
|
6331 | onAllReady();
|
6332 | }
|
6333 | }
|
6334 |
|
6335 | function abortTaskSoft(task) {
|
6336 |
|
6337 |
|
6338 |
|
6339 | var request = this;
|
6340 | var boundary = task.blockedBoundary;
|
6341 | var segment = task.blockedSegment;
|
6342 | segment.status = ABORTED;
|
6343 | finishedTask(request, boundary, segment);
|
6344 | }
|
6345 |
|
6346 | function abortTask(task, request, reason) {
|
6347 |
|
6348 |
|
6349 | var boundary = task.blockedBoundary;
|
6350 | var segment = task.blockedSegment;
|
6351 | segment.status = ABORTED;
|
6352 |
|
6353 | if (boundary === null) {
|
6354 | request.allPendingTasks--;
|
6355 |
|
6356 |
|
6357 | if (request.status !== CLOSED) {
|
6358 | request.status = CLOSED;
|
6359 |
|
6360 | if (request.destination !== null) {
|
6361 | close(request.destination);
|
6362 | }
|
6363 | }
|
6364 | } else {
|
6365 | boundary.pendingTasks--;
|
6366 |
|
6367 | if (!boundary.forceClientRender) {
|
6368 | boundary.forceClientRender = true;
|
6369 |
|
6370 | var _error = reason === undefined ? new Error('The render was aborted by the server without a reason.') : reason;
|
6371 |
|
6372 | boundary.errorDigest = request.onError(_error);
|
6373 |
|
6374 | {
|
6375 | var errorPrefix = 'The server did not finish this Suspense boundary: ';
|
6376 |
|
6377 | if (_error && typeof _error.message === 'string') {
|
6378 | _error = errorPrefix + _error.message;
|
6379 | } else {
|
6380 |
|
6381 | _error = errorPrefix + String(_error);
|
6382 | }
|
6383 |
|
6384 | var previousTaskInDev = currentTaskInDEV;
|
6385 | currentTaskInDEV = task;
|
6386 |
|
6387 | try {
|
6388 | captureBoundaryErrorDetailsDev(boundary, _error);
|
6389 | } finally {
|
6390 | currentTaskInDEV = previousTaskInDev;
|
6391 | }
|
6392 | }
|
6393 |
|
6394 | if (boundary.parentFlushed) {
|
6395 | request.clientRenderedBoundaries.push(boundary);
|
6396 | }
|
6397 | }
|
6398 |
|
6399 |
|
6400 |
|
6401 | boundary.fallbackAbortableTasks.forEach(function (fallbackTask) {
|
6402 | return abortTask(fallbackTask, request, reason);
|
6403 | });
|
6404 | boundary.fallbackAbortableTasks.clear();
|
6405 | request.allPendingTasks--;
|
6406 |
|
6407 | if (request.allPendingTasks === 0) {
|
6408 | var onAllReady = request.onAllReady;
|
6409 | onAllReady();
|
6410 | }
|
6411 | }
|
6412 | }
|
6413 |
|
6414 | function queueCompletedSegment(boundary, segment) {
|
6415 | if (segment.chunks.length === 0 && segment.children.length === 1 && segment.children[0].boundary === null) {
|
6416 |
|
6417 |
|
6418 | var childSegment = segment.children[0];
|
6419 | childSegment.id = segment.id;
|
6420 | childSegment.parentFlushed = true;
|
6421 |
|
6422 | if (childSegment.status === COMPLETED) {
|
6423 | queueCompletedSegment(boundary, childSegment);
|
6424 | }
|
6425 | } else {
|
6426 | var completedSegments = boundary.completedSegments;
|
6427 | completedSegments.push(segment);
|
6428 | }
|
6429 | }
|
6430 |
|
6431 | function finishedTask(request, boundary, segment) {
|
6432 | if (boundary === null) {
|
6433 | if (segment.parentFlushed) {
|
6434 | if (request.completedRootSegment !== null) {
|
6435 | throw new Error('There can only be one root segment. This is a bug in React.');
|
6436 | }
|
6437 |
|
6438 | request.completedRootSegment = segment;
|
6439 | }
|
6440 |
|
6441 | request.pendingRootTasks--;
|
6442 |
|
6443 | if (request.pendingRootTasks === 0) {
|
6444 |
|
6445 | request.onShellError = noop$1;
|
6446 | var onShellReady = request.onShellReady;
|
6447 | onShellReady();
|
6448 | }
|
6449 | } else {
|
6450 | boundary.pendingTasks--;
|
6451 |
|
6452 | if (boundary.forceClientRender) ; else if (boundary.pendingTasks === 0) {
|
6453 |
|
6454 | if (segment.parentFlushed) {
|
6455 |
|
6456 |
|
6457 |
|
6458 | if (segment.status === COMPLETED) {
|
6459 | queueCompletedSegment(boundary, segment);
|
6460 | }
|
6461 | }
|
6462 |
|
6463 | if (boundary.parentFlushed) {
|
6464 |
|
6465 |
|
6466 | request.completedBoundaries.push(boundary);
|
6467 | }
|
6468 |
|
6469 |
|
6470 |
|
6471 |
|
6472 | boundary.fallbackAbortableTasks.forEach(abortTaskSoft, request);
|
6473 | boundary.fallbackAbortableTasks.clear();
|
6474 | } else {
|
6475 | if (segment.parentFlushed) {
|
6476 |
|
6477 |
|
6478 |
|
6479 | if (segment.status === COMPLETED) {
|
6480 | queueCompletedSegment(boundary, segment);
|
6481 | var completedSegments = boundary.completedSegments;
|
6482 |
|
6483 | if (completedSegments.length === 1) {
|
6484 |
|
6485 |
|
6486 |
|
6487 | if (boundary.parentFlushed) {
|
6488 | request.partialBoundaries.push(boundary);
|
6489 | }
|
6490 | }
|
6491 | }
|
6492 | }
|
6493 | }
|
6494 | }
|
6495 |
|
6496 | request.allPendingTasks--;
|
6497 |
|
6498 | if (request.allPendingTasks === 0) {
|
6499 |
|
6500 |
|
6501 | var onAllReady = request.onAllReady;
|
6502 | onAllReady();
|
6503 | }
|
6504 | }
|
6505 |
|
6506 | function retryTask(request, task) {
|
6507 | var segment = task.blockedSegment;
|
6508 |
|
6509 | if (segment.status !== PENDING) {
|
6510 |
|
6511 | return;
|
6512 | }
|
6513 |
|
6514 |
|
6515 |
|
6516 |
|
6517 | switchContext(task.context);
|
6518 | var prevTaskInDEV = null;
|
6519 |
|
6520 | {
|
6521 | prevTaskInDEV = currentTaskInDEV;
|
6522 | currentTaskInDEV = task;
|
6523 | }
|
6524 |
|
6525 | try {
|
6526 |
|
6527 |
|
6528 | renderNodeDestructive(request, task, task.node);
|
6529 | pushSegmentFinale(segment.chunks, request.responseState, segment.lastPushedText, segment.textEmbedded);
|
6530 | task.abortSet.delete(task);
|
6531 | segment.status = COMPLETED;
|
6532 | finishedTask(request, task.blockedBoundary, segment);
|
6533 | } catch (x) {
|
6534 | resetHooksState();
|
6535 |
|
6536 | if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
|
6537 |
|
6538 | var ping = task.ping;
|
6539 | x.then(ping, ping);
|
6540 | } else {
|
6541 | task.abortSet.delete(task);
|
6542 | segment.status = ERRORED;
|
6543 | erroredTask(request, task.blockedBoundary, segment, x);
|
6544 | }
|
6545 | } finally {
|
6546 | {
|
6547 | currentTaskInDEV = prevTaskInDEV;
|
6548 | }
|
6549 | }
|
6550 | }
|
6551 |
|
6552 | function performWork(request) {
|
6553 | if (request.status === CLOSED) {
|
6554 | return;
|
6555 | }
|
6556 |
|
6557 | var prevContext = getActiveContext();
|
6558 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
6559 | ReactCurrentDispatcher$1.current = Dispatcher;
|
6560 | var prevGetCurrentStackImpl;
|
6561 |
|
6562 | {
|
6563 | prevGetCurrentStackImpl = ReactDebugCurrentFrame$1.getCurrentStack;
|
6564 | ReactDebugCurrentFrame$1.getCurrentStack = getCurrentStackInDEV;
|
6565 | }
|
6566 |
|
6567 | var prevResponseState = currentResponseState;
|
6568 | setCurrentResponseState(request.responseState);
|
6569 |
|
6570 | try {
|
6571 | var pingedTasks = request.pingedTasks;
|
6572 | var i;
|
6573 |
|
6574 | for (i = 0; i < pingedTasks.length; i++) {
|
6575 | var task = pingedTasks[i];
|
6576 | retryTask(request, task);
|
6577 | }
|
6578 |
|
6579 | pingedTasks.splice(0, i);
|
6580 |
|
6581 | if (request.destination !== null) {
|
6582 | flushCompletedQueues(request, request.destination);
|
6583 | }
|
6584 | } catch (error) {
|
6585 | logRecoverableError(request, error);
|
6586 | fatalError(request, error);
|
6587 | } finally {
|
6588 | setCurrentResponseState(prevResponseState);
|
6589 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
6590 |
|
6591 | {
|
6592 | ReactDebugCurrentFrame$1.getCurrentStack = prevGetCurrentStackImpl;
|
6593 | }
|
6594 |
|
6595 | if (prevDispatcher === Dispatcher) {
|
6596 |
|
6597 |
|
6598 |
|
6599 |
|
6600 |
|
6601 |
|
6602 |
|
6603 | switchContext(prevContext);
|
6604 | }
|
6605 | }
|
6606 | }
|
6607 |
|
6608 | function flushSubtree(request, destination, segment) {
|
6609 | segment.parentFlushed = true;
|
6610 |
|
6611 | switch (segment.status) {
|
6612 | case PENDING:
|
6613 | {
|
6614 |
|
6615 |
|
6616 | var segmentID = segment.id = request.nextSegmentId++;
|
6617 |
|
6618 | segment.lastPushedText = false;
|
6619 | segment.textEmbedded = false;
|
6620 | return writePlaceholder(destination, request.responseState, segmentID);
|
6621 | }
|
6622 |
|
6623 | case COMPLETED:
|
6624 | {
|
6625 | segment.status = FLUSHED;
|
6626 | var r = true;
|
6627 | var chunks = segment.chunks;
|
6628 | var chunkIdx = 0;
|
6629 | var children = segment.children;
|
6630 |
|
6631 | for (var childIdx = 0; childIdx < children.length; childIdx++) {
|
6632 | var nextChild = children[childIdx];
|
6633 |
|
6634 | for (; chunkIdx < nextChild.index; chunkIdx++) {
|
6635 | writeChunk(destination, chunks[chunkIdx]);
|
6636 | }
|
6637 |
|
6638 | r = flushSegment(request, destination, nextChild);
|
6639 | }
|
6640 |
|
6641 |
|
6642 | for (; chunkIdx < chunks.length - 1; chunkIdx++) {
|
6643 | writeChunk(destination, chunks[chunkIdx]);
|
6644 | }
|
6645 |
|
6646 | if (chunkIdx < chunks.length) {
|
6647 | r = writeChunkAndReturn(destination, chunks[chunkIdx]);
|
6648 | }
|
6649 |
|
6650 | return r;
|
6651 | }
|
6652 |
|
6653 | default:
|
6654 | {
|
6655 | throw new Error('Aborted, errored or already flushed boundaries should not be flushed again. This is a bug in React.');
|
6656 | }
|
6657 | }
|
6658 | }
|
6659 |
|
6660 | function flushSegment(request, destination, segment) {
|
6661 | var boundary = segment.boundary;
|
6662 |
|
6663 | if (boundary === null) {
|
6664 |
|
6665 | return flushSubtree(request, destination, segment);
|
6666 | }
|
6667 |
|
6668 | boundary.parentFlushed = true;
|
6669 |
|
6670 |
|
6671 | if (boundary.forceClientRender) {
|
6672 |
|
6673 |
|
6674 | writeStartClientRenderedSuspenseBoundary(destination, request.responseState, boundary.errorDigest, boundary.errorMessage, boundary.errorComponentStack);
|
6675 |
|
6676 | flushSubtree(request, destination, segment);
|
6677 | return writeEndClientRenderedSuspenseBoundary(destination, request.responseState);
|
6678 | } else if (boundary.pendingTasks > 0) {
|
6679 |
|
6680 |
|
6681 | boundary.rootSegmentID = request.nextSegmentId++;
|
6682 |
|
6683 | if (boundary.completedSegments.length > 0) {
|
6684 |
|
6685 | request.partialBoundaries.push(boundary);
|
6686 | }
|
6687 |
|
6688 |
|
6689 | var id = boundary.id = assignSuspenseBoundaryID(request.responseState);
|
6690 | writeStartPendingSuspenseBoundary(destination, request.responseState, id);
|
6691 |
|
6692 | flushSubtree(request, destination, segment);
|
6693 | return writeEndPendingSuspenseBoundary(destination, request.responseState);
|
6694 | } else if (boundary.byteSize > request.progressiveChunkSize) {
|
6695 |
|
6696 |
|
6697 |
|
6698 |
|
6699 |
|
6700 |
|
6701 | boundary.rootSegmentID = request.nextSegmentId++;
|
6702 | request.completedBoundaries.push(boundary);
|
6703 |
|
6704 | writeStartPendingSuspenseBoundary(destination, request.responseState, boundary.id);
|
6705 |
|
6706 | flushSubtree(request, destination, segment);
|
6707 | return writeEndPendingSuspenseBoundary(destination, request.responseState);
|
6708 | } else {
|
6709 |
|
6710 | writeStartCompletedSuspenseBoundary(destination, request.responseState);
|
6711 | var completedSegments = boundary.completedSegments;
|
6712 |
|
6713 | if (completedSegments.length !== 1) {
|
6714 | throw new Error('A previously unvisited boundary must have exactly one root segment. This is a bug in React.');
|
6715 | }
|
6716 |
|
6717 | var contentSegment = completedSegments[0];
|
6718 | flushSegment(request, destination, contentSegment);
|
6719 | return writeEndCompletedSuspenseBoundary(destination, request.responseState);
|
6720 | }
|
6721 | }
|
6722 |
|
6723 | function flushClientRenderedBoundary(request, destination, boundary) {
|
6724 | return writeClientRenderBoundaryInstruction(destination, request.responseState, boundary.id, boundary.errorDigest, boundary.errorMessage, boundary.errorComponentStack);
|
6725 | }
|
6726 |
|
6727 | function flushSegmentContainer(request, destination, segment) {
|
6728 | writeStartSegment(destination, request.responseState, segment.formatContext, segment.id);
|
6729 | flushSegment(request, destination, segment);
|
6730 | return writeEndSegment(destination, segment.formatContext);
|
6731 | }
|
6732 |
|
6733 | function flushCompletedBoundary(request, destination, boundary) {
|
6734 | var completedSegments = boundary.completedSegments;
|
6735 | var i = 0;
|
6736 |
|
6737 | for (; i < completedSegments.length; i++) {
|
6738 | var segment = completedSegments[i];
|
6739 | flushPartiallyCompletedSegment(request, destination, boundary, segment);
|
6740 | }
|
6741 |
|
6742 | completedSegments.length = 0;
|
6743 | return writeCompletedBoundaryInstruction(destination, request.responseState, boundary.id, boundary.rootSegmentID);
|
6744 | }
|
6745 |
|
6746 | function flushPartialBoundary(request, destination, boundary) {
|
6747 | var completedSegments = boundary.completedSegments;
|
6748 | var i = 0;
|
6749 |
|
6750 | for (; i < completedSegments.length; i++) {
|
6751 | var segment = completedSegments[i];
|
6752 |
|
6753 | if (!flushPartiallyCompletedSegment(request, destination, boundary, segment)) {
|
6754 | i++;
|
6755 | completedSegments.splice(0, i);
|
6756 |
|
6757 |
|
6758 | return false;
|
6759 | }
|
6760 | }
|
6761 |
|
6762 | completedSegments.splice(0, i);
|
6763 | return true;
|
6764 | }
|
6765 |
|
6766 | function flushPartiallyCompletedSegment(request, destination, boundary, segment) {
|
6767 | if (segment.status === FLUSHED) {
|
6768 |
|
6769 | return true;
|
6770 | }
|
6771 |
|
6772 | var segmentID = segment.id;
|
6773 |
|
6774 | if (segmentID === -1) {
|
6775 |
|
6776 |
|
6777 | var rootSegmentID = segment.id = boundary.rootSegmentID;
|
6778 |
|
6779 | if (rootSegmentID === -1) {
|
6780 | throw new Error('A root segment ID must have been assigned by now. This is a bug in React.');
|
6781 | }
|
6782 |
|
6783 | return flushSegmentContainer(request, destination, segment);
|
6784 | } else {
|
6785 | flushSegmentContainer(request, destination, segment);
|
6786 | return writeCompletedSegmentInstruction(destination, request.responseState, segmentID);
|
6787 | }
|
6788 | }
|
6789 |
|
6790 | function flushCompletedQueues(request, destination) {
|
6791 | beginWriting();
|
6792 |
|
6793 | try {
|
6794 |
|
6795 |
|
6796 |
|
6797 |
|
6798 |
|
6799 |
|
6800 |
|
6801 | var completedRootSegment = request.completedRootSegment;
|
6802 |
|
6803 | if (completedRootSegment !== null && request.pendingRootTasks === 0) {
|
6804 | flushSegment(request, destination, completedRootSegment);
|
6805 | request.completedRootSegment = null;
|
6806 | writeCompletedRoot(destination, request.responseState);
|
6807 | }
|
6808 |
|
6809 |
|
6810 |
|
6811 |
|
6812 | var clientRenderedBoundaries = request.clientRenderedBoundaries;
|
6813 | var i;
|
6814 |
|
6815 | for (i = 0; i < clientRenderedBoundaries.length; i++) {
|
6816 | var boundary = clientRenderedBoundaries[i];
|
6817 |
|
6818 | if (!flushClientRenderedBoundary(request, destination, boundary)) {
|
6819 | request.destination = null;
|
6820 | i++;
|
6821 | clientRenderedBoundaries.splice(0, i);
|
6822 | return;
|
6823 | }
|
6824 | }
|
6825 |
|
6826 | clientRenderedBoundaries.splice(0, i);
|
6827 |
|
6828 |
|
6829 |
|
6830 | var completedBoundaries = request.completedBoundaries;
|
6831 |
|
6832 | for (i = 0; i < completedBoundaries.length; i++) {
|
6833 | var _boundary = completedBoundaries[i];
|
6834 |
|
6835 | if (!flushCompletedBoundary(request, destination, _boundary)) {
|
6836 | request.destination = null;
|
6837 | i++;
|
6838 | completedBoundaries.splice(0, i);
|
6839 | return;
|
6840 | }
|
6841 | }
|
6842 |
|
6843 | completedBoundaries.splice(0, i);
|
6844 |
|
6845 |
|
6846 | completeWriting(destination);
|
6847 | beginWriting(destination);
|
6848 |
|
6849 |
|
6850 |
|
6851 | var partialBoundaries = request.partialBoundaries;
|
6852 |
|
6853 | for (i = 0; i < partialBoundaries.length; i++) {
|
6854 | var _boundary2 = partialBoundaries[i];
|
6855 |
|
6856 | if (!flushPartialBoundary(request, destination, _boundary2)) {
|
6857 | request.destination = null;
|
6858 | i++;
|
6859 | partialBoundaries.splice(0, i);
|
6860 | return;
|
6861 | }
|
6862 | }
|
6863 |
|
6864 | partialBoundaries.splice(0, i);
|
6865 |
|
6866 |
|
6867 |
|
6868 | var largeBoundaries = request.completedBoundaries;
|
6869 |
|
6870 | for (i = 0; i < largeBoundaries.length; i++) {
|
6871 | var _boundary3 = largeBoundaries[i];
|
6872 |
|
6873 | if (!flushCompletedBoundary(request, destination, _boundary3)) {
|
6874 | request.destination = null;
|
6875 | i++;
|
6876 | largeBoundaries.splice(0, i);
|
6877 | return;
|
6878 | }
|
6879 | }
|
6880 |
|
6881 | largeBoundaries.splice(0, i);
|
6882 | } finally {
|
6883 | completeWriting(destination);
|
6884 |
|
6885 | if (request.allPendingTasks === 0 && request.pingedTasks.length === 0 && request.clientRenderedBoundaries.length === 0 && request.completedBoundaries.length === 0
|
6886 |
|
6887 | ) {
|
6888 | {
|
6889 | if (request.abortableTasks.size !== 0) {
|
6890 | error('There was still abortable task at the root when we closed. This is a bug in React.');
|
6891 | }
|
6892 | }
|
6893 |
|
6894 |
|
6895 | close(destination);
|
6896 | }
|
6897 | }
|
6898 | }
|
6899 |
|
6900 | function startWork(request) {
|
6901 | scheduleWork(function () {
|
6902 | return performWork(request);
|
6903 | });
|
6904 | }
|
6905 | function startFlowing(request, destination) {
|
6906 | if (request.status === CLOSING) {
|
6907 | request.status = CLOSED;
|
6908 | closeWithError(destination, request.fatalError);
|
6909 | return;
|
6910 | }
|
6911 |
|
6912 | if (request.status === CLOSED) {
|
6913 | return;
|
6914 | }
|
6915 |
|
6916 | if (request.destination !== null) {
|
6917 |
|
6918 | return;
|
6919 | }
|
6920 |
|
6921 | request.destination = destination;
|
6922 |
|
6923 | try {
|
6924 | flushCompletedQueues(request, destination);
|
6925 | } catch (error) {
|
6926 | logRecoverableError(request, error);
|
6927 | fatalError(request, error);
|
6928 | }
|
6929 | }
|
6930 |
|
6931 | function abort(request, reason) {
|
6932 | try {
|
6933 | var abortableTasks = request.abortableTasks;
|
6934 | abortableTasks.forEach(function (task) {
|
6935 | return abortTask(task, request, reason);
|
6936 | });
|
6937 | abortableTasks.clear();
|
6938 |
|
6939 | if (request.destination !== null) {
|
6940 | flushCompletedQueues(request, request.destination);
|
6941 | }
|
6942 | } catch (error) {
|
6943 | logRecoverableError(request, error);
|
6944 | fatalError(request, error);
|
6945 | }
|
6946 | }
|
6947 |
|
6948 | function renderToReadableStream(children, options) {
|
6949 | return new Promise(function (resolve, reject) {
|
6950 | var onFatalError;
|
6951 | var onAllReady;
|
6952 | var allReady = new Promise(function (res, rej) {
|
6953 | onAllReady = res;
|
6954 | onFatalError = rej;
|
6955 | });
|
6956 |
|
6957 | function onShellReady() {
|
6958 | var stream = new ReadableStream({
|
6959 | type: 'bytes',
|
6960 | pull: function (controller) {
|
6961 | startFlowing(request, controller);
|
6962 | },
|
6963 | cancel: function (reason) {
|
6964 | abort(request);
|
6965 | }
|
6966 | },
|
6967 | {
|
6968 | highWaterMark: 0
|
6969 | });
|
6970 |
|
6971 | stream.allReady = allReady;
|
6972 | resolve(stream);
|
6973 | }
|
6974 |
|
6975 | function onShellError(error) {
|
6976 |
|
6977 |
|
6978 |
|
6979 | allReady.catch(function () {});
|
6980 | reject(error);
|
6981 | }
|
6982 |
|
6983 | var request = createRequest(children, createResponseState(options ? options.identifierPrefix : undefined, options ? options.nonce : undefined, options ? options.bootstrapScriptContent : undefined, options ? options.bootstrapScripts : undefined, options ? options.bootstrapModules : undefined), createRootFormatContext(options ? options.namespaceURI : undefined), options ? options.progressiveChunkSize : undefined, options ? options.onError : undefined, onAllReady, onShellReady, onShellError, onFatalError);
|
6984 |
|
6985 | if (options && options.signal) {
|
6986 | var signal = options.signal;
|
6987 |
|
6988 | var listener = function () {
|
6989 | abort(request, signal.reason);
|
6990 | signal.removeEventListener('abort', listener);
|
6991 | };
|
6992 |
|
6993 | signal.addEventListener('abort', listener);
|
6994 | }
|
6995 |
|
6996 | startWork(request);
|
6997 | });
|
6998 | }
|
6999 |
|
7000 | exports.renderToReadableStream = renderToReadableStream;
|
7001 | exports.version = ReactVersion;
|
7002 | })();
|
7003 | }
|