UNPKG

react-dom

Version:

React package for working with the DOM.

1,356 lines (1,355 loc) • 359 kB
/** * @license React * react-dom-server.node.development.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ "use strict"; "production" !== process.env.NODE_ENV && (function () { function styleReplacer(match, prefix, s, suffix) { return "" + prefix + ("s" === s ? "\\73 " : "\\53 ") + suffix; } function scriptReplacer(match, prefix, s, suffix) { return "" + prefix + ("s" === s ? "\\u0073" : "\\u0053") + suffix; } function objectName(object) { return Object.prototype.toString .call(object) .replace(/^\[object (.*)\]$/, function (m, p0) { return p0; }); } function describeKeyForErrorMessage(key) { var encodedKey = JSON.stringify(key); return '"' + key + '"' === encodedKey ? key : encodedKey; } function describeValueForErrorMessage(value) { switch (typeof value) { case "string": return JSON.stringify( 10 >= value.length ? value : value.slice(0, 10) + "..." ); case "object": if (isArrayImpl(value)) return "[...]"; if (null !== value && value.$$typeof === CLIENT_REFERENCE_TAG) return "client"; value = objectName(value); return "Object" === value ? "{...}" : value; case "function": return value.$$typeof === CLIENT_REFERENCE_TAG ? "client" : (value = value.displayName || value.name) ? "function " + value : "function"; default: return String(value); } } function describeElementType(type) { if ("string" === typeof type) return type; switch (type) { case REACT_SUSPENSE_TYPE: return "Suspense"; case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList"; } if ("object" === typeof type) switch (type.$$typeof) { case REACT_FORWARD_REF_TYPE: return describeElementType(type.render); case REACT_MEMO_TYPE: return describeElementType(type.type); case REACT_LAZY_TYPE: var payload = type._payload; type = type._init; try { return describeElementType(type(payload)); } catch (x) {} } return ""; } function describeObjectForErrorMessage(objectOrArray, expandedName) { var objKind = objectName(objectOrArray); if ("Object" !== objKind && "Array" !== objKind) return objKind; var start = -1, length = 0; if (isArrayImpl(objectOrArray)) if (jsxChildrenParents.has(objectOrArray)) { var type = jsxChildrenParents.get(objectOrArray); objKind = "<" + describeElementType(type) + ">"; for (var i = 0; i < objectOrArray.length; i++) { var value = objectOrArray[i]; value = "string" === typeof value ? value : "object" === typeof value && null !== value ? "{" + describeObjectForErrorMessage(value) + "}" : "{" + describeValueForErrorMessage(value) + "}"; "" + i === expandedName ? ((start = objKind.length), (length = value.length), (objKind += value)) : (objKind = 15 > value.length && 40 > objKind.length + value.length ? objKind + value : objKind + "{...}"); } objKind += "</" + describeElementType(type) + ">"; } else { objKind = "["; for (type = 0; type < objectOrArray.length; type++) 0 < type && (objKind += ", "), (i = objectOrArray[type]), (i = "object" === typeof i && null !== i ? describeObjectForErrorMessage(i) : describeValueForErrorMessage(i)), "" + type === expandedName ? ((start = objKind.length), (length = i.length), (objKind += i)) : (objKind = 10 > i.length && 40 > objKind.length + i.length ? objKind + i : objKind + "..."); objKind += "]"; } else if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE) objKind = "<" + describeElementType(objectOrArray.type) + "/>"; else { if (objectOrArray.$$typeof === CLIENT_REFERENCE_TAG) return "client"; if (jsxPropsParents.has(objectOrArray)) { objKind = jsxPropsParents.get(objectOrArray); objKind = "<" + (describeElementType(objKind) || "..."); type = Object.keys(objectOrArray); for (i = 0; i < type.length; i++) { objKind += " "; value = type[i]; objKind += describeKeyForErrorMessage(value) + "="; var _value2 = objectOrArray[value]; var _substr2 = value === expandedName && "object" === typeof _value2 && null !== _value2 ? describeObjectForErrorMessage(_value2) : describeValueForErrorMessage(_value2); "string" !== typeof _value2 && (_substr2 = "{" + _substr2 + "}"); value === expandedName ? ((start = objKind.length), (length = _substr2.length), (objKind += _substr2)) : (objKind = 10 > _substr2.length && 40 > objKind.length + _substr2.length ? objKind + _substr2 : objKind + "..."); } objKind += ">"; } else { objKind = "{"; type = Object.keys(objectOrArray); for (i = 0; i < type.length; i++) 0 < i && (objKind += ", "), (value = type[i]), (objKind += describeKeyForErrorMessage(value) + ": "), (_value2 = objectOrArray[value]), (_value2 = "object" === typeof _value2 && null !== _value2 ? describeObjectForErrorMessage(_value2) : describeValueForErrorMessage(_value2)), value === expandedName ? ((start = objKind.length), (length = _value2.length), (objKind += _value2)) : (objKind = 10 > _value2.length && 40 > objKind.length + _value2.length ? objKind + _value2 : objKind + "..."); objKind += "}"; } } return void 0 === expandedName ? objKind : -1 < start && 0 < length ? ((objectOrArray = " ".repeat(start) + "^".repeat(length)), "\n " + objKind + "\n " + objectOrArray) : "\n " + objKind; } function flushBuffered(destination) { "function" === typeof destination.flush && destination.flush(); } function writeChunk(destination, chunk) { if ("string" === typeof chunk) { if (0 !== chunk.length) if (2048 < 3 * chunk.length) 0 < writtenBytes && (writeToDestination( destination, currentView.subarray(0, writtenBytes) ), (currentView = new Uint8Array(2048)), (writtenBytes = 0)), writeToDestination(destination, chunk); else { var target = currentView; 0 < writtenBytes && (target = currentView.subarray(writtenBytes)); target = textEncoder.encodeInto(chunk, target); var read = target.read; writtenBytes += target.written; read < chunk.length && (writeToDestination( destination, currentView.subarray(0, writtenBytes) ), (currentView = new Uint8Array(2048)), (writtenBytes = textEncoder.encodeInto( chunk.slice(read), currentView ).written)); 2048 === writtenBytes && (writeToDestination(destination, currentView), (currentView = new Uint8Array(2048)), (writtenBytes = 0)); } } else 0 !== chunk.byteLength && (2048 < chunk.byteLength ? (0 < writtenBytes && (writeToDestination( destination, currentView.subarray(0, writtenBytes) ), (currentView = new Uint8Array(2048)), (writtenBytes = 0)), writeToDestination(destination, chunk)) : ((target = currentView.length - writtenBytes), target < chunk.byteLength && (0 === target ? writeToDestination(destination, currentView) : (currentView.set(chunk.subarray(0, target), writtenBytes), (writtenBytes += target), writeToDestination(destination, currentView), (chunk = chunk.subarray(target))), (currentView = new Uint8Array(2048)), (writtenBytes = 0)), currentView.set(chunk, writtenBytes), (writtenBytes += chunk.byteLength), 2048 === writtenBytes && (writeToDestination(destination, currentView), (currentView = new Uint8Array(2048)), (writtenBytes = 0)))); } function writeToDestination(destination, view) { destination = destination.write(view); destinationHasCapacity$1 = destinationHasCapacity$1 && destination; } function writeChunkAndReturn(destination, chunk) { writeChunk(destination, chunk); return destinationHasCapacity$1; } function completeWriting(destination) { currentView && 0 < writtenBytes && destination.write(currentView.subarray(0, writtenBytes)); currentView = null; writtenBytes = 0; destinationHasCapacity$1 = !0; } function stringToPrecomputedChunk(content) { content = textEncoder.encode(content); 2048 < content.byteLength && console.error( "precomputed chunks must be smaller than the view size configured for this host. This is a bug in React." ); return content; } function typeName(value) { return ( ("function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag]) || value.constructor.name || "Object" ); } function willCoercionThrow(value) { try { return testStringCoercion(value), !1; } catch (e) { return !0; } } function testStringCoercion(value) { return "" + value; } function checkAttributeStringCoercion(value, attributeName) { if (willCoercionThrow(value)) return ( console.error( "The provided `%s` attribute is an unsupported type %s. This value must be coerced to a string before using it here.", attributeName, typeName(value) ), testStringCoercion(value) ); } function checkCSSPropertyStringCoercion(value, propName) { if (willCoercionThrow(value)) return ( console.error( "The provided `%s` CSS property is an unsupported type %s. This value must be coerced to a string before using it here.", propName, typeName(value) ), testStringCoercion(value) ); } function checkHtmlStringCoercion(value) { if (willCoercionThrow(value)) return ( console.error( "The provided HTML markup uses a value of unsupported type %s. This value must be coerced to a string before using it here.", typeName(value) ), testStringCoercion(value) ); } function isAttributeNameSafe(attributeName) { if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) return !0; if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) return !1; if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) return (validatedAttributeNameCache[attributeName] = !0); illegalAttributeNameCache[attributeName] = !0; console.error("Invalid attribute name: `%s`", attributeName); return !1; } function checkControlledValueProps(tagName, props) { hasReadOnlyValue[props.type] || props.onChange || props.onInput || props.readOnly || props.disabled || null == props.value || ("select" === tagName ? console.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 `onChange`." ) : console.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`." )); props.onChange || props.readOnly || props.disabled || null == props.checked || console.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`." ); } function validateProperty$1(tagName, name) { if ( hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name] ) return !0; if (rARIACamel$1.test(name)) { tagName = "aria-" + name.slice(4).toLowerCase(); tagName = ariaProperties.hasOwnProperty(tagName) ? tagName : null; if (null == tagName) return ( console.error( "Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.", name ), (warnedProperties$1[name] = !0) ); if (name !== tagName) return ( console.error( "Invalid ARIA attribute `%s`. Did you mean `%s`?", name, tagName ), (warnedProperties$1[name] = !0) ); } if (rARIA$1.test(name)) { tagName = name.toLowerCase(); tagName = ariaProperties.hasOwnProperty(tagName) ? tagName : null; if (null == tagName) return (warnedProperties$1[name] = !0), !1; name !== tagName && (console.error( "Unknown ARIA attribute `%s`. Did you mean `%s`?", name, tagName ), (warnedProperties$1[name] = !0)); } return !0; } function validateProperties$2(type, props) { var invalidProps = [], key; for (key in props) validateProperty$1(type, key) || invalidProps.push(key); props = invalidProps .map(function (prop) { return "`" + prop + "`"; }) .join(", "); 1 === invalidProps.length ? console.error( "Invalid aria prop %s on <%s> tag. For details, see https://react.dev/link/invalid-aria-props", props, type ) : 1 < invalidProps.length && console.error( "Invalid aria props %s on <%s> tag. For details, see https://react.dev/link/invalid-aria-props", props, type ); } function validateProperty(tagName, name, value, eventRegistry) { if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) return !0; var lowerCasedName = name.toLowerCase(); if ("onfocusin" === lowerCasedName || "onfocusout" === lowerCasedName) return ( console.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." ), (warnedProperties[name] = !0) ); if ( "function" === typeof value && (("form" === tagName && "action" === name) || ("input" === tagName && "formAction" === name) || ("button" === tagName && "formAction" === name)) ) return !0; if (null != eventRegistry) { tagName = eventRegistry.possibleRegistrationNames; if (eventRegistry.registrationNameDependencies.hasOwnProperty(name)) return !0; eventRegistry = tagName.hasOwnProperty(lowerCasedName) ? tagName[lowerCasedName] : null; if (null != eventRegistry) return ( console.error( "Invalid event handler property `%s`. Did you mean `%s`?", name, eventRegistry ), (warnedProperties[name] = !0) ); if (EVENT_NAME_REGEX.test(name)) return ( console.error( "Unknown event handler property `%s`. It will be ignored.", name ), (warnedProperties[name] = !0) ); } else if (EVENT_NAME_REGEX.test(name)) return ( INVALID_EVENT_NAME_REGEX.test(name) && console.error( "Invalid event handler property `%s`. React events use the camelCase naming convention, for example `onClick`.", name ), (warnedProperties[name] = !0) ); if (rARIA.test(name) || rARIACamel.test(name)) return !0; if ("innerhtml" === lowerCasedName) return ( console.error( "Directly setting property `innerHTML` is not permitted. For more information, lookup documentation on `dangerouslySetInnerHTML`." ), (warnedProperties[name] = !0) ); if ("aria" === lowerCasedName) return ( console.error( "The `aria` attribute is reserved for future use in React. Pass individual `aria-` attributes instead." ), (warnedProperties[name] = !0) ); if ( "is" === lowerCasedName && null !== value && void 0 !== value && "string" !== typeof value ) return ( console.error( "Received a `%s` for a string attribute `is`. If this is expected, cast the value to a string.", typeof value ), (warnedProperties[name] = !0) ); if ("number" === typeof value && isNaN(value)) return ( console.error( "Received NaN for the `%s` attribute. If this is expected, cast the value to a string.", name ), (warnedProperties[name] = !0) ); if (possibleStandardNames.hasOwnProperty(lowerCasedName)) { if ( ((lowerCasedName = possibleStandardNames[lowerCasedName]), lowerCasedName !== name) ) return ( console.error( "Invalid DOM property `%s`. Did you mean `%s`?", name, lowerCasedName ), (warnedProperties[name] = !0) ); } else if (name !== lowerCasedName) return ( console.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 ), (warnedProperties[name] = !0) ); switch (name) { case "dangerouslySetInnerHTML": case "children": case "style": case "suppressContentEditableWarning": case "suppressHydrationWarning": case "defaultValue": case "defaultChecked": case "innerHTML": case "ref": return !0; case "innerText": case "textContent": return !0; } switch (typeof value) { case "boolean": switch (name) { case "autoFocus": case "checked": case "multiple": case "muted": case "selected": case "contentEditable": case "spellCheck": case "draggable": case "value": case "autoReverse": case "externalResourcesRequired": case "focusable": case "preserveAlpha": case "allowFullScreen": case "async": case "autoPlay": case "controls": case "default": case "defer": case "disabled": case "disablePictureInPicture": case "disableRemotePlayback": case "formNoValidate": case "hidden": case "loop": case "noModule": case "noValidate": case "open": case "playsInline": case "readOnly": case "required": case "reversed": case "scoped": case "seamless": case "itemScope": case "capture": case "download": case "inert": return !0; default: lowerCasedName = name.toLowerCase().slice(0, 5); if ("data-" === lowerCasedName || "aria-" === lowerCasedName) return !0; value ? console.error( 'Received `%s` for a non-boolean attribute `%s`.\n\nIf you want to write it to the DOM, pass a string instead: %s="%s" or %s={value.toString()}.', value, name, name, value, name ) : console.error( 'Received `%s` for a non-boolean attribute `%s`.\n\nIf you want to write it to the DOM, pass a string instead: %s="%s" or %s={value.toString()}.\n\nIf you used to conditionally omit it with %s={condition && value}, pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name ); return (warnedProperties[name] = !0); } case "function": case "symbol": return (warnedProperties[name] = !0), !1; case "string": if ("false" === value || "true" === value) { switch (name) { case "checked": case "selected": case "multiple": case "muted": case "allowFullScreen": case "async": case "autoPlay": case "controls": case "default": case "defer": case "disabled": case "disablePictureInPicture": case "disableRemotePlayback": case "formNoValidate": case "hidden": case "loop": case "noModule": case "noValidate": case "open": case "playsInline": case "readOnly": case "required": case "reversed": case "scoped": case "seamless": case "itemScope": case "inert": break; default: return !0; } console.error( "Received the string `%s` for the boolean attribute `%s`. %s Did you mean %s={%s}?", value, name, "false" === value ? "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 ); warnedProperties[name] = !0; } } return !0; } function warnUnknownProperties(type, props, eventRegistry) { var unknownProps = [], key; for (key in props) validateProperty(type, key, props[key], eventRegistry) || unknownProps.push(key); props = unknownProps .map(function (prop) { return "`" + prop + "`"; }) .join(", "); 1 === unknownProps.length ? console.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://react.dev/link/attribute-behavior ", props, type ) : 1 < unknownProps.length && console.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://react.dev/link/attribute-behavior ", props, type ); } function camelize(string) { return string.replace(hyphenPattern, function (_, character) { return character.toUpperCase(); }); } function escapeTextForBrowser(text) { if ( "boolean" === typeof text || "number" === typeof text || "bigint" === typeof text ) return "" + text; checkHtmlStringCoercion(text); text = "" + text; var match = matchHtmlRegExp.exec(text); if (match) { var html = "", index, lastIndex = 0; for (index = match.index; index < text.length; index++) { switch (text.charCodeAt(index)) { case 34: match = "&quot;"; break; case 38: match = "&amp;"; break; case 39: match = "&#x27;"; break; case 60: match = "&lt;"; break; case 62: match = "&gt;"; break; default: continue; } lastIndex !== index && (html += text.slice(lastIndex, index)); lastIndex = index + 1; html += match; } text = lastIndex !== index ? html + text.slice(lastIndex, index) : html; } return text; } function sanitizeURL(url) { return isJavaScriptProtocol.test("" + url) ? "javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')" : url; } function escapeEntireInlineScriptContent(scriptText) { checkHtmlStringCoercion(scriptText); return ("" + scriptText).replace(scriptRegex, scriptReplacer); } function createRenderState( resumableState, nonce, externalRuntimeConfig, importMap, onHeaders, maxHeadersLength ) { var inlineScriptWithNonce = void 0 === nonce ? startInlineScript : stringToPrecomputedChunk( '<script nonce="' + escapeTextForBrowser(nonce) + '">' ), idPrefix = resumableState.idPrefix; externalRuntimeConfig = []; var bootstrapScriptContent = resumableState.bootstrapScriptContent, bootstrapScripts = resumableState.bootstrapScripts, bootstrapModules = resumableState.bootstrapModules; void 0 !== bootstrapScriptContent && externalRuntimeConfig.push( inlineScriptWithNonce, escapeEntireInlineScriptContent(bootstrapScriptContent), endInlineScript ); bootstrapScriptContent = []; void 0 !== importMap && (bootstrapScriptContent.push(importMapScriptStart), bootstrapScriptContent.push( escapeEntireInlineScriptContent(JSON.stringify(importMap)) ), bootstrapScriptContent.push(importMapScriptEnd)); onHeaders && "number" === typeof maxHeadersLength && 0 >= maxHeadersLength && console.error( "React expected a positive non-zero `maxHeadersLength` option but found %s instead. When using the `onHeaders` option you may supply an optional `maxHeadersLength` option as well however, when setting this value to zero or less no headers will be captured.", 0 === maxHeadersLength ? "zero" : maxHeadersLength ); importMap = onHeaders ? { preconnects: "", fontPreloads: "", highImagePreloads: "", remainingCapacity: 2 + ("number" === typeof maxHeadersLength ? maxHeadersLength : 2e3) } : null; onHeaders = { placeholderPrefix: stringToPrecomputedChunk(idPrefix + "P:"), segmentPrefix: stringToPrecomputedChunk(idPrefix + "S:"), boundaryPrefix: stringToPrecomputedChunk(idPrefix + "B:"), startInlineScript: inlineScriptWithNonce, htmlChunks: null, headChunks: null, externalRuntimeScript: null, bootstrapChunks: externalRuntimeConfig, importMapChunks: bootstrapScriptContent, onHeaders: onHeaders, headers: importMap, resets: { font: {}, dns: {}, connect: { default: {}, anonymous: {}, credentials: {} }, image: {}, style: {} }, charsetChunks: [], viewportChunks: [], hoistableChunks: [], preconnects: new Set(), fontPreloads: new Set(), highImagePreloads: new Set(), styles: new Map(), bootstrapScripts: new Set(), scripts: new Set(), bulkPreloads: new Set(), preloads: { images: new Map(), stylesheets: new Map(), scripts: new Map(), moduleScripts: new Map() }, nonce: nonce, hoistableState: null, stylesToHoist: !1 }; if (void 0 !== bootstrapScripts) for (importMap = 0; importMap < bootstrapScripts.length; importMap++) { maxHeadersLength = bootstrapScripts[importMap]; bootstrapScriptContent = idPrefix = void 0; var props = { rel: "preload", as: "script", fetchPriority: "low", nonce: nonce }; "string" === typeof maxHeadersLength ? (props.href = inlineScriptWithNonce = maxHeadersLength) : ((props.href = inlineScriptWithNonce = maxHeadersLength.src), (props.integrity = bootstrapScriptContent = "string" === typeof maxHeadersLength.integrity ? maxHeadersLength.integrity : void 0), (props.crossOrigin = idPrefix = "string" === typeof maxHeadersLength || null == maxHeadersLength.crossOrigin ? void 0 : "use-credentials" === maxHeadersLength.crossOrigin ? "use-credentials" : "")); preloadBootstrapScriptOrModule( resumableState, onHeaders, inlineScriptWithNonce, props ); externalRuntimeConfig.push( startScriptSrc, escapeTextForBrowser(inlineScriptWithNonce) ); nonce && externalRuntimeConfig.push( scriptNonce, escapeTextForBrowser(nonce) ); "string" === typeof bootstrapScriptContent && externalRuntimeConfig.push( scriptIntegirty, escapeTextForBrowser(bootstrapScriptContent) ); "string" === typeof idPrefix && externalRuntimeConfig.push( scriptCrossOrigin, escapeTextForBrowser(idPrefix) ); externalRuntimeConfig.push(endAsyncScript); } if (void 0 !== bootstrapModules) for ( bootstrapScripts = 0; bootstrapScripts < bootstrapModules.length; bootstrapScripts++ ) (importMap = bootstrapModules[bootstrapScripts]), (idPrefix = inlineScriptWithNonce = void 0), (bootstrapScriptContent = { rel: "modulepreload", fetchPriority: "low", nonce: nonce }), "string" === typeof importMap ? (bootstrapScriptContent.href = maxHeadersLength = importMap) : ((bootstrapScriptContent.href = maxHeadersLength = importMap.src), (bootstrapScriptContent.integrity = idPrefix = "string" === typeof importMap.integrity ? importMap.integrity : void 0), (bootstrapScriptContent.crossOrigin = inlineScriptWithNonce = "string" === typeof importMap || null == importMap.crossOrigin ? void 0 : "use-credentials" === importMap.crossOrigin ? "use-credentials" : "")), preloadBootstrapScriptOrModule( resumableState, onHeaders, maxHeadersLength, bootstrapScriptContent ), externalRuntimeConfig.push( startModuleSrc, escapeTextForBrowser(maxHeadersLength) ), nonce && externalRuntimeConfig.push( scriptNonce, escapeTextForBrowser(nonce) ), "string" === typeof idPrefix && externalRuntimeConfig.push( scriptIntegirty, escapeTextForBrowser(idPrefix) ), "string" === typeof inlineScriptWithNonce && externalRuntimeConfig.push( scriptCrossOrigin, escapeTextForBrowser(inlineScriptWithNonce) ), externalRuntimeConfig.push(endAsyncScript); return onHeaders; } function createResumableState( identifierPrefix, externalRuntimeConfig, bootstrapScriptContent, bootstrapScripts, bootstrapModules ) { return { idPrefix: void 0 === identifierPrefix ? "" : identifierPrefix, nextFormID: 0, streamingFormat: 0, bootstrapScriptContent: bootstrapScriptContent, bootstrapScripts: bootstrapScripts, bootstrapModules: bootstrapModules, instructions: NothingSent, hasBody: !1, hasHtml: !1, unknownResources: {}, dnsResources: {}, connectResources: { default: {}, anonymous: {}, credentials: {} }, imageResources: {}, styleResources: {}, scriptResources: {}, moduleUnknownResources: {}, moduleScriptResources: {} }; } function createFormatContext(insertionMode, selectedValue, tagScope) { return { insertionMode: insertionMode, selectedValue: selectedValue, tagScope: tagScope }; } function createRootFormatContext(namespaceURI) { return createFormatContext( "http://www.w3.org/2000/svg" === namespaceURI ? SVG_MODE : "http://www.w3.org/1998/Math/MathML" === namespaceURI ? MATHML_MODE : ROOT_HTML_MODE, null, 0 ); } function getChildFormatContext(parentContext, type, props) { switch (type) { case "noscript": return createFormatContext( HTML_MODE, null, parentContext.tagScope | 1 ); case "select": return createFormatContext( HTML_MODE, null != props.value ? props.value : props.defaultValue, parentContext.tagScope ); case "svg": return createFormatContext(SVG_MODE, null, parentContext.tagScope); case "picture": return createFormatContext( HTML_MODE, null, parentContext.tagScope | 2 ); case "math": return createFormatContext(MATHML_MODE, null, parentContext.tagScope); case "foreignObject": return createFormatContext(HTML_MODE, null, parentContext.tagScope); case "table": return createFormatContext( HTML_TABLE_MODE, null, parentContext.tagScope ); case "thead": case "tbody": case "tfoot": return createFormatContext( HTML_TABLE_BODY_MODE, null, parentContext.tagScope ); case "colgroup": return createFormatContext( HTML_COLGROUP_MODE, null, parentContext.tagScope ); case "tr": return createFormatContext( HTML_TABLE_ROW_MODE, null, parentContext.tagScope ); } return parentContext.insertionMode >= HTML_TABLE_MODE ? createFormatContext(HTML_MODE, null, parentContext.tagScope) : parentContext.insertionMode === ROOT_HTML_MODE ? "html" === type ? createFormatContext(HTML_HTML_MODE, null, parentContext.tagScope) : createFormatContext(HTML_MODE, null, parentContext.tagScope) : parentContext.insertionMode === HTML_HTML_MODE ? createFormatContext(HTML_MODE, null, parentContext.tagScope) : parentContext; } function pushTextInstance(target, text, renderState, textEmbedded) { if ("" === text) return textEmbedded; textEmbedded && target.push(textSeparator); target.push(escapeTextForBrowser(text)); return !0; } function pushStyleAttribute(target, style) { if ("object" !== typeof style) throw Error( "The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX." ); var isFirst = !0, styleName; for (styleName in style) if (hasOwnProperty.call(style, styleName)) { var styleValue = style[styleName]; if ( null != styleValue && "boolean" !== typeof styleValue && "" !== styleValue ) { if (0 === styleName.indexOf("--")) { var nameChunk = escapeTextForBrowser(styleName); checkCSSPropertyStringCoercion(styleValue, styleName); styleValue = escapeTextForBrowser(("" + styleValue).trim()); } else { nameChunk = styleName; var value = styleValue; if (-1 < nameChunk.indexOf("-")) { var name = nameChunk; (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) || ((warnedStyleNames[name] = !0), console.error( "Unsupported style property %s. Did you mean %s?", name, camelize(name.replace(msPattern$1, "ms-")) )); } else if (badVendoredStyleNamePattern.test(nameChunk)) (name = nameChunk), (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) || ((warnedStyleNames[name] = !0), console.error( "Unsupported vendor-prefixed style property %s. Did you mean %s?", name, name.charAt(0).toUpperCase() + name.slice(1) )); else if (badStyleValueWithSemicolonPattern.test(value)) { name = nameChunk; var value$jscomp$0 = value; (warnedStyleValues.hasOwnProperty(value$jscomp$0) && warnedStyleValues[value$jscomp$0]) || ((warnedStyleValues[value$jscomp$0] = !0), console.error( 'Style property values shouldn\'t contain a semicolon. Try "%s: %s" instead.', name, value$jscomp$0.replace( badStyleValueWithSemicolonPattern, "" ) )); } "number" === typeof value && (isNaN(value) ? warnedForNaNValue || ((warnedForNaNValue = !0), console.error( "`NaN` is an invalid value for the `%s` css style property.", nameChunk )) : isFinite(value) || warnedForInfinityValue || ((warnedForInfinityValue = !0), console.error( "`Infinity` is an invalid value for the `%s` css style property.", nameChunk ))); nameChunk = styleName; value = styleNameCache.get(nameChunk); void 0 !== value ? (nameChunk = value) : ((value = stringToPrecomputedChunk( escapeTextForBrowser( nameChunk .replace(uppercasePattern, "-$1") .toLowerCase() .replace(msPattern, "-ms-") ) )), styleNameCache.set(nameChunk, value), (nameChunk = value)); "number" === typeof styleValue ? (styleValue = 0 === styleValue || unitlessNumbers.has(styleName) ? "" + styleValue : styleValue + "px") : (checkCSSPropertyStringCoercion(styleValue, styleName), (styleValue = escapeTextForBrowser( ("" + styleValue).trim() ))); } isFirst ? ((isFirst = !1), target.push( styleAttributeStart, nameChunk, styleAssign, styleValue )) : target.push(styleSeparator, nameChunk, styleAssign, styleValue); } } isFirst || target.push(attributeEnd); } function pushBooleanAttribute(target, name, value) { value && "function" !== typeof value && "symbol" !== typeof value && target.push(attributeSeparator, name, attributeEmptyString); } function pushStringAttribute(target, name, value) { "function" !== typeof value && "symbol" !== typeof value && "boolean" !== typeof value && target.push( attributeSeparator, name, attributeAssign, escapeTextForBrowser(value), attributeEnd ); } function pushAdditionalFormField(value, key) { this.push(startHiddenInputChunk); validateAdditionalFormField(value); pushStringAttribute(this, "name", key); pushStringAttribute(this, "value", value); this.push(endOfStartTagSelfClosing); } function validateAdditionalFormField(value) { if ("string" !== typeof value) throw Error( "File/Blob fields are not yet supported in progressive forms. Will fallback to client hydration." ); } function getCustomFormFields(resumableState, formAction) { if ("function" === typeof formAction.$$FORM_ACTION) { var id = resumableState.nextFormID++; resumableState = resumableState.idPrefix + id; try { var customFields = formAction.$$FORM_ACTION(resumableState); if (customFields) { var formData = customFields.data; null != formData && formData.forEach(validateAdditionalFormField); } return customFields; } catch (x) { if ( "object" === typeof x && null !== x && "function" === typeof x.then ) throw x; console.error( "Failed to serialize an action for progressive enhancement:\n%s", x ); } } return null; } function pushFormActionAttribute( target, resumableState, renderState, formAction, formEncType, formMethod, formTarget, name ) { var formData = null; if ("function" === typeof formAction) { null === name || didWarnFormActionName || ((didWarnFormActionName = !0), console.error( 'Cannot specify a "name" prop for a button that specifies a function as a formAction. React needs it to encode which action should be invoked. It will get overridden.' )); (null === formEncType && null === formMethod) || didWarnFormActionMethod || ((didWarnFormActionMethod = !0), console.error( "Cannot specify a formEncType or formMethod for a button that specifies a function as a formAction. React provides those automatically. They will get overridden." )); null === formTarget || didWarnFormActionTarget || ((didWarnFormActionTarget = !0), console.error( "Cannot specify a formTarget for a button that specifies a function as a formAction. The function will always be executed in the same window." )); var customFields = getCustomFormFields(resumableState, formAction); null !== customFields ? ((name = customFields.name), (formAction = customFields.action || ""), (formEncType = customFields.encType), (formMethod = customFields.method), (formTarget = customFields.target), (formData = customFields.data)) : (target.push( attributeSeparator, "formAction", attributeAssign, actionJavaScriptURL, attributeEnd ), (formTarget = formMethod = formEncType = formAction = name = null), injectFormReplayingRuntime(resumableState, renderState)); } null != name && pushAttribute(target, "name", name); null != formAction && pushAttribute(target, "formAction", formAction); null != formEncType && pushAttribute(target, "formEncType", formEncType); null != formMethod && pushAttribute(target, "formMethod", formMethod); null != formTarget && pushAttribute(target, "formTarget", formTarget); return formData; } function pushAttribute(target, name, value) { switch (name) { case "className": pushStringAttribute(target, "class", value); break; case "tabIndex": pushStringAttribute(target, "tabindex", value); break; case "dir": case "role": case "viewBox": case "width": case "height": pushStringAttribute(target, name, value); break; case "style": pushStyleAttribute(target, value); break; case "src": case "href": if ("" === value) { "src" === name ? console.error( 'An empty string ("") was passed to the %s attribute. This may cause the browser to download the whole page again over the network. To fix this, either do not render the element at all or pass null to %s instead of an empty string.', name, name ) : console.error( 'An empty string ("") was passed to the %s attribute. To fix this, either do not render the element at all or pass null to %s instead of an empty string.', name, name ); break; } case "action": case "formAction": if ( null == value || "function" === typeof value || "symbol" === typeof value || "boolean" === typeof value ) break; checkAttributeStringCoercion(value, name); value = sanitizeURL("" + value); target.push( attributeSeparator, name, attributeAssign, escapeTextForBrowser(value), attributeEnd ); break; case "defaultValue": case "defaultChecked": case "innerHTML": case "suppressContentEditableWarning": case "suppressHydrationWarning": case "ref": break; case "autoFocus": case "multiple": case "muted": pushBooleanAttribute(target, name.toLowerCase(), value); break; case "xlinkHref": if ( "function" === typeof value || "symbol" === typeof value || "boolean" === typeof value ) break; checkAttributeStringCoercion(value, name); value = sanitizeURL("" + value); target.push( attributeSeparator, "xlink:href", attributeAssign, escapeTextForBrowser(value), attributeEnd ); break; case "contentEditable": case "spellCheck": case "draggable": case "value": case "autoReve