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