: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* property is included in this set or value is zero.
* Object.entries( document.createElement( 'div' ).style )
* .filter( ( [ key ] ) => (
* ! /^(webkit|ms|moz)/.test( key ) &&
* ( e.style[ key ] = 10 ) &&
* e.style[ key ] === '10'
* .map( ( [ key ] ) => key )
const CSS_PROPERTIES_SUPPORTS_UNITLESS = new Set(['animation', 'animationIterationCount', 'baselineShift', 'borderImageOutset', 'borderImageSlice', 'borderImageWidth', 'columnCount', 'cx', 'cy', 'fillOpacity', 'flexGrow', 'flexShrink', 'floodOpacity', 'fontWeight', 'gridColumnEnd', 'gridColumnStart', 'gridRowEnd', 'gridRowStart', 'lineHeight', 'opacity', 'order', 'orphans', 'r', 'rx', 'ry', 'shapeImageThreshold', 'stopOpacity', 'strokeDasharray', 'strokeDashoffset', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth', 'tabSize', 'widows', 'x', 'y', 'zIndex', 'zoom']);
* Returns true if the specified string is prefixed by one of an array of
* @param {string} string String to check.
* @param {string[]} prefixes Possible prefixes.
* @return {boolean} Whether string has prefix.
function hasPrefix(string, prefixes) {
return prefixes.some(prefix => string.indexOf(prefix) === 0);
* Returns true if the given prop name should be ignored in attributes
* serialization, or false otherwise.
* @param {string} attribute Attribute to check.
* @return {boolean} Whether attribute should be ignored.
function isInternalAttribute(attribute) {
return 'key' === attribute || 'children' === attribute;
* Returns the normal form of the element's attribute value for HTML.
* @param {string} attribute Attribute name.
* @param {*} value Non-normalized attribute value.
* @return {*} Normalized attribute value.
function getNormalAttributeValue(attribute, value) {
return renderStyle(value);
* This is a map of all SVG attributes that have dashes. Map(lower case prop => dashed lower case attribute).
* We need this to render e.g strokeWidth as stroke-width.
* List from: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute.
const SVG_ATTRIBUTE_WITH_DASHES_LIST = ['accentHeight', 'alignmentBaseline', 'arabicForm', 'baselineShift', 'capHeight', 'clipPath', 'clipRule', 'colorInterpolation', 'colorInterpolationFilters', 'colorProfile', 'colorRendering', 'dominantBaseline', 'enableBackground', 'fillOpacity', 'fillRule', 'floodColor', 'floodOpacity', 'fontFamily', 'fontSize', 'fontSizeAdjust', 'fontStretch', 'fontStyle', 'fontVariant', 'fontWeight', 'glyphName', 'glyphOrientationHorizontal', 'glyphOrientationVertical', 'horizAdvX', 'horizOriginX', 'imageRendering', 'letterSpacing', 'lightingColor', 'markerEnd', 'markerMid', 'markerStart', 'overlinePosition', 'overlineThickness', 'paintOrder', 'panose1', 'pointerEvents', 'renderingIntent', 'shapeRendering', 'stopColor', 'stopOpacity', 'strikethroughPosition', 'strikethroughThickness', 'strokeDasharray', 'strokeDashoffset', 'strokeLinecap', 'strokeLinejoin', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth', 'textAnchor', 'textDecoration', 'textRendering', 'underlinePosition', 'underlineThickness', 'unicodeBidi', 'unicodeRange', 'unitsPerEm', 'vAlphabetic', 'vHanging', 'vIdeographic', 'vMathematical', 'vectorEffect', 'vertAdvY', 'vertOriginX', 'vertOriginY', 'wordSpacing', 'writingMode', 'xmlnsXlink', 'xHeight'].reduce((map, attribute) => {
// The keys are lower-cased for more robust lookup.
map[attribute.toLowerCase()] = attribute;
* This is a map of all case-sensitive SVG attributes. Map(lowercase key => proper case attribute).
* The keys are lower-cased for more robust lookup.
* Note that this list only contains attributes that contain at least one capital letter.
* Lowercase attributes don't need mapping, since we lowercase all attributes by default.
const CASE_SENSITIVE_SVG_ATTRIBUTES = ['allowReorder', 'attributeName', 'attributeType', 'autoReverse', 'baseFrequency', 'baseProfile', 'calcMode', 'clipPathUnits', 'contentScriptType', 'contentStyleType', 'diffuseConstant', 'edgeMode', 'externalResourcesRequired', 'filterRes', 'filterUnits', 'glyphRef', 'gradientTransform', 'gradientUnits', 'kernelMatrix', 'kernelUnitLength', 'keyPoints', 'keySplines', 'keyTimes', 'lengthAdjust', 'limitingConeAngle', 'markerHeight', 'markerUnits', 'markerWidth', 'maskContentUnits', 'maskUnits', 'numOctaves', 'pathLength', 'patternContentUnits', 'patternTransform', 'patternUnits', 'pointsAtX', 'pointsAtY', 'pointsAtZ', 'preserveAlpha', 'preserveAspectRatio', 'primitiveUnits', 'refX', 'refY', 'repeatCount', 'repeatDur', 'requiredExtensions', 'requiredFeatures', 'specularConstant', 'specularExponent', 'spreadMethod', 'startOffset', 'stdDeviation', 'stitchTiles', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'surfaceScale', 'systemLanguage', 'tableValues', 'targetX', 'targetY', 'textLength', 'viewBox', 'viewTarget', 'xChannelSelector', 'yChannelSelector'].reduce((map, attribute) => {
// The keys are lower-cased for more robust lookup.
map[attribute.toLowerCase()] = attribute;
* This is a map of all SVG attributes that have colons.
* Keys are lower-cased and stripped of their colons for more robust lookup.
const SVG_ATTRIBUTES_WITH_COLONS = ['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space', 'xmlns:xlink'].reduce((map, attribute) => {
map[attribute.replace(':', '').toLowerCase()] = attribute;
* Returns the normal form of the element's attribute name for HTML.
* @param {string} attribute Non-normalized attribute name.
* @return {string} Normalized attribute name.
function getNormalAttributeName(attribute) {
const attributeLowerCase = attribute.toLowerCase();
if (CASE_SENSITIVE_SVG_ATTRIBUTES[attributeLowerCase]) {
return CASE_SENSITIVE_SVG_ATTRIBUTES[attributeLowerCase];
} else if (SVG_ATTRIBUTE_WITH_DASHES_LIST[attributeLowerCase]) {
return paramCase(SVG_ATTRIBUTE_WITH_DASHES_LIST[attributeLowerCase]);
} else if (SVG_ATTRIBUTES_WITH_COLONS[attributeLowerCase]) {
return SVG_ATTRIBUTES_WITH_COLONS[attributeLowerCase];
return attributeLowerCase;
* Returns the normal form of the style property name for HTML.
* - Converts property names to kebab-case, e.g. 'backgroundColor' → 'background-color'
* - Leaves custom attributes alone, e.g. '--myBackgroundColor' → '--myBackgroundColor'
* - Converts vendor-prefixed property names to -kebab-case, e.g. 'MozTransform' → '-moz-transform'
* @param {string} property Property name.
* @return {string} Normalized property name.
function getNormalStylePropertyName(property) {
if (property.startsWith('--')) {
if (hasPrefix(property, ['ms', 'O', 'Moz', 'Webkit'])) {
return '-' + paramCase(property);
return paramCase(property);
* Returns the normal form of the style property value for HTML. Appends a
* default pixel unit if numeric, not a unitless property, and not zero.
* @param {string} property Property name.
* @param {*} value Non-normalized property value.
* @return {*} Normalized property value.
function getNormalStylePropertyValue(property, value) {
if (typeof value === 'number' && 0 !== value && !CSS_PROPERTIES_SUPPORTS_UNITLESS.has(property)) {
* Serializes a React element to string.
* @param {import('react').ReactNode} element Element to serialize.
* @param {Object} [context] Context object.
* @param {Object} [legacyContext] Legacy context object.
* @return {string} Serialized element.
function renderElement(element, context, legacyContext = {}) {
if (null === element || undefined === element || false === element) {
if (Array.isArray(element)) {
return renderChildren(element, context, legacyContext);
switch (typeof element) {
return (0,external_wp_escapeHtml_namespaceObject.escapeHTML)(element);
return element.toString();
} = /** @type {{type?: any, props?: any}} */
case external_React_namespaceObject.StrictMode:
case external_React_namespaceObject.Fragment:
return renderChildren(props.children, context, legacyContext);
return renderNativeComponent(!Object.keys(wrapperProps).length ? null : 'div', {
dangerouslySetInnerHTML: {
}, context, legacyContext);
return renderNativeComponent(type, props, context, legacyContext);
if (type.prototype && typeof type.prototype.render === 'function') {
return renderComponent(type, props, context, legacyContext);
return renderElement(type(props, legacyContext), context, legacyContext);
switch (type && type.$$typeof) {
return renderChildren(props.children, props.value, legacyContext);
return renderElement(props.children(context || type._currentValue), context, legacyContext);
case ForwardRef.$$typeof:
return renderElement(type.render(props), context, legacyContext);
* Serializes a native component type to string.
* @param {?string} type Native component type to serialize, or null if
* rendering as fragment of children content.
* @param {Object} props Props object.
* @param {Object} [context] Context object.
* @param {Object} [legacyContext] Legacy context object.
* @return {string} Serialized element.
function renderNativeComponent(type, props, context, legacyContext = {}) {
if (type === 'textarea' && props.hasOwnProperty('value')) {
// Textarea children can be assigned as value prop. If it is, render in
// place of children. Ensure to omit so it is not assigned as attribute
content = renderChildren(props.value, context, legacyContext);
} else if (props.dangerouslySetInnerHTML && typeof props.dangerouslySetInnerHTML.__html === 'string') {
// Dangerous content is left unescaped.
content = props.dangerouslySetInnerHTML.__html;
} else if (typeof props.children !== 'undefined') {
content = renderChildren(props.children, context, legacyContext);
const attributes = renderAttributes(props);
if (SELF_CLOSING_TAGS.has(type)) {
return '<' + type + attributes + '/>';
return '<' + type + attributes + '>' + content + '</' + type + '>';
/** @typedef {import('react').ComponentType} ComponentType */
* Serializes a non-native component type to string.
* @param {ComponentType} Component Component type to serialize.
* @param {Object} props Props object.
* @param {Object} [context] Context object.
* @param {Object} [legacyContext] Legacy context object.
* @return {string} Serialized element
function renderComponent(Component, props, context, legacyContext = {}) {
const instance = new ( /** @type {import('react').ComponentClass} */
Component)(props, legacyContext);
// Ignore reason: Current prettier reformats parens and mangles type assertion
/** @type {{getChildContext?: () => unknown}} */
instance.getChildContext === 'function') {
Object.assign(legacyContext, /** @type {{getChildContext?: () => unknown}} */instance.getChildContext());
const html = renderElement(instance.render(), context, legacyContext);
* Serializes an array of children to string.
* @param {import('react').ReactNodeArray} children Children to serialize.
* @param {Object} [context] Context object.
* @param {Object} [legacyContext] Legacy context object.
* @return {string} Serialized children.
function renderChildren(children, context, legacyContext = {}) {
children = Array.isArray(children) ? children : [children];
for (let i = 0; i < children.length; i++) {
const child = children[i];
result += renderElement(child, context, legacyContext);
* Renders a props object as a string of HTML attributes.
* @param {Object} props Props object.
* @return {string} Attributes string.
function renderAttributes(props) {
for (const key in props) {
const attribute = getNormalAttributeName(key);
if (!(0,external_wp_escapeHtml_namespaceObject.isValidAttributeName)(attribute)) {
let value = getNormalAttributeValue(key, props[key]);
// If value is not of serializable type, skip.
if (!ATTRIBUTES_TYPES.has(typeof value)) {
// Don't render internal attribute names.
if (isInternalAttribute(key)) {
const isBooleanAttribute = BOOLEAN_ATTRIBUTES.has(attribute);
// Boolean attribute should be omitted outright if its value is false.
if (isBooleanAttribute && value === false) {
const isMeaningfulAttribute = isBooleanAttribute || hasPrefix(key, ['data-', 'aria-']) || ENUMERATED_ATTRIBUTES.has(attribute);
// Only write boolean value as attribute if meaningful.
if (typeof value === 'boolean' && !isMeaningfulAttribute) {
result += ' ' + attribute;
// Boolean attributes should write attribute name, but without value.
// Mere presence of attribute name is effective truthiness.
if (isBooleanAttribute) {
if (typeof value === 'string') {
value = (0,external_wp_escapeHtml_namespaceObject.escapeAttribute)(value);
result += '="' + value + '"';
* Renders a style object as a string attribute value.
* @param {Object} style Style object.
* @return {string} Style attribute value.
function renderStyle(style) {
// Only generate from object, e.g. tolerate string value.
if (!isPlainObject(style)) {
for (const property in style) {
const value = style[property];
if (null === value || undefined === value) {
const normalName = getNormalStylePropertyName(property);
const normalValue = getNormalStylePropertyValue(property, value);
result += normalName + ':' + normalValue;
/* harmony default export */ const serialize = (renderElement);
;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/index.js
(window.wp = window.wp || {}).element = __webpack_exports__;