: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* @param {Object} action Dispatched action.
* @return {Object} Updated state.
function blockVariations(state = {}, action) {
var _state$action$blockNa2, _state$action$blockNa3;
...Object.fromEntries(Object.entries(keyBlockTypesByName(action.blockTypes)).map(([name, blockType]) => {
var _blockType$variations, _state$blockType$name2;
return [name, getUniqueItemsByName([...((_blockType$variations = blockType.variations) !== null && _blockType$variations !== void 0 ? _blockType$variations : []).map(variation => ({
})), ...((_state$blockType$name2 = state[blockType.name]) !== null && _state$blockType$name2 !== void 0 ? _state$blockType$name2 : []).filter(({
}) => 'block' !== source)])];
case 'ADD_BLOCK_VARIATIONS':
[action.blockName]: getUniqueItemsByName([...((_state$action$blockNa2 = state[action.blockName]) !== null && _state$action$blockNa2 !== void 0 ? _state$action$blockNa2 : []), ...action.variations])
case 'REMOVE_BLOCK_VARIATIONS':
[action.blockName]: ((_state$action$blockNa3 = state[action.blockName]) !== null && _state$action$blockNa3 !== void 0 ? _state$action$blockNa3 : []).filter(variation => action.variationNames.indexOf(variation.name) === -1)
* Higher-order Reducer creating a reducer keeping track of given block name.
* @param {string} setActionType Action type.
* @return {Function} Reducer.
function createBlockNameSetterReducer(setActionType) {
return (state = null, action) => {
case 'REMOVE_BLOCK_TYPES':
if (action.names.indexOf(state) !== -1) {
return action.name || null;
const defaultBlockName = createBlockNameSetterReducer('SET_DEFAULT_BLOCK_NAME');
const freeformFallbackBlockName = createBlockNameSetterReducer('SET_FREEFORM_FALLBACK_BLOCK_NAME');
const unregisteredFallbackBlockName = createBlockNameSetterReducer('SET_UNREGISTERED_FALLBACK_BLOCK_NAME');
const groupingBlockName = createBlockNameSetterReducer('SET_GROUPING_BLOCK_NAME');
* Reducer managing the categories
* @param {WPBlockCategory[]} state Current state.
* @param {Object} action Dispatched action.
* @return {WPBlockCategory[]} Updated state.
function categories(state = DEFAULT_CATEGORIES, action) {
return action.categories || [];
if (!action.category || !Object.keys(action.category).length) {
const categoryToChange = state.find(({
}) => slug === action.slug);
return state.map(category => {
if (category.slug === action.slug) {
function collections(state = {}, action) {
case 'ADD_BLOCK_COLLECTION':
case 'REMOVE_BLOCK_COLLECTION':
return omit(state, action.namespace);
function blockBindingsSources(state = {}, action) {
if (action.type === 'REGISTER_BLOCK_BINDINGS_SOURCE') {
label: action.sourceLabel,
getValue: action.getValue,
setValue: action.setValue,
setValues: action.setValues,
getPlaceholder: action.getPlaceholder,
canUserEditValue: action.canUserEditValue || (() => false)
/* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
freeformFallbackBlockName,
unregisteredFallbackBlockName,
// EXTERNAL MODULE: ./node_modules/remove-accents/index.js
var remove_accents = __webpack_require__(9681);
var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents);
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/utils.js
* Helper util to return a value from a certain path of the object.
* Path is specified as either:
* - a string of properties, separated by dots, for example: "x.y".
* - an array of properties, for example `[ 'x', 'y' ]`.
* You can also specify a default value in case the result is nullish.
* @param {Object} object Input object.
* @param {string|Array} path Path to the object property.
* @param {*} defaultValue Default value if the value at the specified path is nullish.
* @return {*} Value of the object property at the specified path.
const getValueFromObjectPath = (object, path, defaultValue) => {
const normalizedPath = Array.isArray(path) ? path : path.split('.');
normalizedPath.forEach(fieldName => {
value = value?.[fieldName];
return (_value = value) !== null && _value !== void 0 ? _value : defaultValue;
function utils_isObject(candidate) {
return typeof candidate === 'object' && candidate.constructor === Object && candidate !== null;
* Determine whether a set of object properties matches a given object.
* Given an object of block attributes and an object of variation attributes,
* this function checks recursively whether all the variation attributes are
* present in the block attributes object.
* @param {Object} blockAttributes The object to inspect.
* @param {Object} variationAttributes The object of property values to match.
* @return {boolean} Whether the block attributes match the variation attributes.
function matchesAttributes(blockAttributes, variationAttributes) {
if (utils_isObject(blockAttributes) && utils_isObject(variationAttributes)) {
return Object.entries(variationAttributes).every(([key, value]) => matchesAttributes(blockAttributes?.[key], value));
return blockAttributes === variationAttributes;
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/selectors.js
/** @typedef {import('../api/registration').WPBlockVariation} WPBlockVariation */
/** @typedef {import('../api/registration').WPBlockVariationScope} WPBlockVariationScope */
/** @typedef {import('./reducer').WPBlockCategory} WPBlockCategory */
* Given a block name or block type object, returns the corresponding
* normalized block type object.
* @param {Object} state Blocks state.
* @param {(string|Object)} nameOrType Block name or type object
* @return {Object} Block type object.
const getNormalizedBlockType = (state, nameOrType) => 'string' === typeof nameOrType ? selectors_getBlockType(state, nameOrType) : nameOrType;
* Returns all the available block types.
* @param {Object} state Data state.
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
* const ExampleComponent = () => {
* const blockTypes = useSelect(
* ( select ) => select( blocksStore ).getBlockTypes(),
* { blockTypes.map( ( block ) => (
* <li key={ block.name }>{ block.title }</li>
* @return {Array} Block Types.
const selectors_getBlockTypes = (0,external_wp_data_namespaceObject.createSelector)(state => Object.values(state.blockTypes), state => [state.blockTypes]);
* Returns a block type by name.
* @param {Object} state Data state.
* @param {string} name Block type name.
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
* const ExampleComponent = () => {
* const paragraphBlock = useSelect( ( select ) =>
* ( select ) => select( blocksStore ).getBlockType( 'core/paragraph' ),
* Object.entries( paragraphBlock.supports ).map(
* ( blockSupportsEntry ) => {
* const [ propertyName, value ] = blockSupportsEntry;
* >{ `${ propertyName } : ${ value }` }</li>
* @return {Object?} Block Type.
function selectors_getBlockType(state, name) {
return state.blockTypes[name];
* Returns block styles by block name.
* @param {Object} state Data state.
* @param {string} name Block type name.
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
* const ExampleComponent = () => {
* const buttonBlockStyles = useSelect( ( select ) =>
* select( blocksStore ).getBlockStyles( 'core/button' ),
* buttonBlockStyles.map( ( style ) => (
* <li key={ style.name }>{ style.label }</li>
* @return {Array?} Block Styles.
function getBlockStyles(state, name) {
return state.blockStyles[name];
* Returns block variations by block name.
* @param {Object} state Data state.
* @param {string} blockName Block type name.
* @param {WPBlockVariationScope} [scope] Block variation scope name.
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
* const ExampleComponent = () => {
* const socialLinkVariations = useSelect( ( select ) =>
* select( blocksStore ).getBlockVariations( 'core/social-link' ),
* { socialLinkVariations &&
* socialLinkVariations.map( ( variation ) => (
* <li key={ variation.name }>{ variation.title }</li>
* @return {(WPBlockVariation[]|void)} Block variations.
const selectors_getBlockVariations = (0,external_wp_data_namespaceObject.createSelector)((state, blockName, scope) => {
const variations = state.blockVariations[blockName];
if (!variations || !scope) {
return variations.filter(variation => {
// For backward compatibility reasons, variation's scope defaults to
// `block` and `inserter` when not set.
return (variation.scope || ['block', 'inserter']).includes(scope);
}, (state, blockName) => [state.blockVariations[blockName]]);
* Returns the active block variation for a given block based on its attributes.
* Variations are determined by their `isActive` property.
* Which is either an array of block attribute keys or a function.
* In case of an array of block attribute keys, the `attributes` are compared
* to the variation's attributes using strict equality check.
* In case of function type, the function should accept a block's attributes
* and the variation's attributes and determines if a variation is active.
* A function that accepts a block's attributes and the variation's attributes and determines if a variation is active.
* @param {Object} state Data state.
* @param {string} blockName Name of block (example: “core/columns”).
* @param {Object} attributes Block attributes used to determine active variation.
* @param {WPBlockVariationScope} [scope] Block variation scope name.
* import { __ } from '@wordpress/i18n';
* import { store as blocksStore } from '@wordpress/blocks';
* import { store as blockEditorStore } from '@wordpress/block-editor';
* import { useSelect } from '@wordpress/data';
* const ExampleComponent = () => {
* // This example assumes that a core/embed block is the first block in the Block Editor.
* const activeBlockVariation = useSelect( ( select ) => {
* // Retrieve the list of blocks.
* const [ firstBlock ] = select( blockEditorStore ).getBlocks()
* // Return the active block variation for the first block.
* return select( blocksStore ).getActiveBlockVariation(
* return activeBlockVariation && activeBlockVariation.name === 'spotify' ? (
* <p>{ __( 'Spotify variation' ) }</p>
* <p>{ __( 'Other variation' ) }</p>
* @return {(WPBlockVariation|undefined)} Active block variation.
function getActiveBlockVariation(state, blockName, attributes, scope) {
const variations = selectors_getBlockVariations(state, blockName, scope);
const blockType = selectors_getBlockType(state, blockName);
const attributeKeys = Object.keys(blockType?.attributes || {});
let maxMatchedAttributes = 0;
for (const variation of variations) {
if (Array.isArray(variation.isActive)) {
const definedAttributes = variation.isActive.filter(attribute => {
// We support nested attribute paths, e.g. `layout.type`.
// In this case, we need to check if the part before the
// first dot is a known attribute.
const topLevelAttribute = attribute.split('.')[0];
return attributeKeys.includes(topLevelAttribute);
const definedAttributesLength = definedAttributes.length;
if (definedAttributesLength === 0) {
const isMatch = definedAttributes.every(attribute => {
const variationAttributeValue = getValueFromObjectPath(variation.attributes, attribute);
if (variationAttributeValue === undefined) {
let blockAttributeValue = getValueFromObjectPath(attributes, attribute);
if (blockAttributeValue instanceof external_wp_richText_namespaceObject.RichTextData) {
blockAttributeValue = blockAttributeValue.toHTMLString();
return matchesAttributes(blockAttributeValue, variationAttributeValue);
if (isMatch && definedAttributesLength > maxMatchedAttributes) {
maxMatchedAttributes = definedAttributesLength;
} else if (variation.isActive?.(attributes, variation.attributes)) {
// If isActive is a function, we cannot know how many attributes it matches.
// This means that we cannot compare the specificity of our matches,
// and simply return the best match we have found.
return match || variation;
* Returns the default block variation for the given block type.
* When there are multiple variations annotated as the default one,
* the last added item is picked. This simplifies registering overrides.
* When there is no default variation set, it returns the first item.
* @param {Object} state Data state.
* @param {string} blockName Block type name.
* @param {WPBlockVariationScope} [scope] Block variation scope name.
* import { __, sprintf } from '@wordpress/i18n';
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
* const ExampleComponent = () => {
* const defaultEmbedBlockVariation = useSelect( ( select ) =>
* select( blocksStore ).getDefaultBlockVariation( 'core/embed' ),
* defaultEmbedBlockVariation && (
* __( 'core/embed default variation: %s' ),
* defaultEmbedBlockVariation.title
* @return {?WPBlockVariation} The default block variation.
function getDefaultBlockVariation(state, blockName, scope) {