: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
const [subRegistries] = (0,external_wp_element_namespaceObject.useState)(() => new WeakMap());
const subRegistry = getSubRegistry(subRegistries, registry, useSubRegistry);
if (subRegistry === registry) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_data_namespaceObject.RegistryProvider, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, {
}, 'withRegistryProvider');
/* harmony default export */ const with_registry_provider = (withRegistryProvider);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/media-categories/index.js
* The `editor` settings here need to be in sync with the corresponding ones in `editor` package.
* See `packages/editor/src/components/media-categories/index.js`.
* In the future we could consider creating an Openvese package that can be used in both `editor` and `site-editor`.
* The rest of the settings would still need to be in sync though.
/** @typedef {import('@wordpress/block-editor').InserterMediaRequest} InserterMediaRequest */
/** @typedef {import('@wordpress/block-editor').InserterMediaItem} InserterMediaItem */
/** @typedef {import('@wordpress/block-editor').InserterMediaCategory} InserterMediaCategory */
const getExternalLink = (url, text) => `<a ${getExternalLinkAttributes(url)}>${text}</a>`;
const getExternalLinkAttributes = url => `href="${url}" target="_blank" rel="noreferrer noopener"`;
const getOpenverseLicense = (license, licenseVersion) => {
let licenseName = license.trim();
// PDM has no abbreviation
licenseName = license.toUpperCase().replace('SAMPLING', 'Sampling');
// If version is known, append version to the name.
// The license has to have a version to be valid. Only
// PDM (public domain mark) doesn't have a version.
licenseName += ` ${licenseVersion}`;
// For licenses other than public-domain marks, prepend 'CC' to the name.
if (!['pdm', 'cc0'].includes(license)) {
licenseName = `CC ${licenseName}`;
const getOpenverseCaption = item => {
foreign_landing_url: foreignLandingUrl,
license_version: licenseVersion,
const fullLicense = getOpenverseLicense(license, licenseVersion);
const _creator = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(creator);
_caption = title ? (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %1s: Title of a media work from Openverse; %2s: Name of the work's creator; %3s: Work's licence e.g: "CC0 1.0".
(0,external_wp_i18n_namespaceObject._x)('"%1$s" by %2$s/ %3$s', 'caption'), getExternalLink(foreignLandingUrl, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)), creatorUrl ? getExternalLink(creatorUrl, _creator) : _creator, licenseUrl ? getExternalLink(`${licenseUrl}?ref=openverse`, fullLicense) : fullLicense) : (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %1s: Link attributes for a given Openverse media work; %2s: Name of the work's creator; %3s: Works's licence e.g: "CC0 1.0".
(0,external_wp_i18n_namespaceObject._x)('<a %1$s>Work</a> by %2$s/ %3$s', 'caption'), getExternalLinkAttributes(foreignLandingUrl), creatorUrl ? getExternalLink(creatorUrl, _creator) : _creator, licenseUrl ? getExternalLink(`${licenseUrl}?ref=openverse`, fullLicense) : fullLicense);
_caption = title ? (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %1s: Title of a media work from Openverse; %2s: Work's licence e.g: "CC0 1.0".
(0,external_wp_i18n_namespaceObject._x)('"%1$s"/ %2$s', 'caption'), getExternalLink(foreignLandingUrl, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)), licenseUrl ? getExternalLink(`${licenseUrl}?ref=openverse`, fullLicense) : fullLicense) : (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: "CC0 1.0".
(0,external_wp_i18n_namespaceObject._x)('<a %1$s>Work</a>/ %2$s', 'caption'), getExternalLinkAttributes(foreignLandingUrl), licenseUrl ? getExternalLink(`${licenseUrl}?ref=openverse`, fullLicense) : fullLicense);
return _caption.replace(/\s{2}/g, ' ');
const coreMediaFetch = async (query = {}) => {
const mediaItems = await (0,external_wp_data_namespaceObject.resolveSelect)(external_wp_coreData_namespaceObject.store).getMediaItems({
orderBy: !!query?.search ? 'relevance' : 'date'
return mediaItems.map(mediaItem => ({
url: mediaItem.source_url,
previewUrl: mediaItem.media_details?.sizes?.medium?.source_url,
caption: mediaItem.caption?.raw
/** @type {InserterMediaCategory[]} */
const inserterMediaCategories = [{
name: (0,external_wp_i18n_namespaceObject.__)('Images'),
search_items: (0,external_wp_i18n_namespaceObject.__)('Search images')
async fetch(query = {}) {
name: (0,external_wp_i18n_namespaceObject.__)('Videos'),
search_items: (0,external_wp_i18n_namespaceObject.__)('Search videos')
async fetch(query = {}) {
name: (0,external_wp_i18n_namespaceObject.__)('Audio'),
search_items: (0,external_wp_i18n_namespaceObject.__)('Search audio')
async fetch(query = {}) {
name: (0,external_wp_i18n_namespaceObject.__)('Openverse'),
search_items: (0,external_wp_i18n_namespaceObject.__)('Search Openverse')
async fetch(query = {}) {
excluded_source: 'flickr,inaturalist,wikimedia',
const mapFromInserterMediaRequest = {
const url = new URL('https://api.openverse.org/v1/images/');
Object.entries(finalQuery).forEach(([key, value]) => {
const queryKey = mapFromInserterMediaRequest[key] || key;
url.searchParams.set(queryKey, value);
const response = await window.fetch(url, {
'User-Agent': 'WordPress/inserter-media-fetch'
const jsonResponse = await response.json();
const results = jsonResponse.results;
return results.map(result => ({
// This is a temp solution for better titles, until Openverse API
// completes the cleaning up of some titles of their upstream data.
title: result.title?.toLowerCase().startsWith('file:') ? result.title.slice(5) : result.title,
caption: getOpenverseCaption(result),
previewUrl: result.thumbnail
}) => `https://wordpress.org/openverse/image/${sourceId}/report/`,
/* harmony default export */ const media_categories = (inserterMediaCategories);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/media-upload/index.js
const media_upload_noop = () => {};
* Upload a media file when the file upload button is activated.
* Wrapper around mediaUpload() that injects the current post ID.
* @param {Object} $0 Parameters object passed to the function.
* @param {?Object} $0.additionalData Additional data to include in the request.
* @param {string} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed.
* @param {Array} $0.filesList List of files.
* @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site.
* @param {Function} $0.onError Function called when an error happens.
* @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available.
onError = media_upload_noop,
} = (0,external_wp_data_namespaceObject.select)(store_store);
const wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes;
maxUploadFileSize = maxUploadFileSize || getEditorSettings().maxUploadFileSize;
const currentPost = getCurrentPost();
// Templates and template parts' numerical ID is stored in `wp_id`.
const currentPostId = typeof currentPost?.id === 'number' ? currentPost.id : currentPost?.wp_id;
const postData = currentPostId ? {
(0,external_wp_mediaUtils_namespaceObject.uploadMedia)({
// EXTERNAL MODULE: ./node_modules/deepmerge/dist/cjs.js
var cjs = __webpack_require__(66);
var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs);
;// CONCATENATED MODULE: ./node_modules/is-plain-object/dist/is-plain-object.mjs
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
return Object.prototype.toString.call(o) === '[object Object]';
function isPlainObject(o) {
if (isObject(o) === false) return false;
// If has modified constructor
if (ctor === undefined) return true;
// If has modified prototype
if (isObject(prot) === false) return false;
// If constructor does not have an Object-specific method
if (prot.hasOwnProperty('isPrototypeOf') === false) {
// Most likely a plain Object
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-styles-provider/index.js
GlobalStylesContext: global_styles_provider_GlobalStylesContext,
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function mergeBaseAndUserConfigs(base, user) {
return cjs_default()(base, user, {
// We only pass as arrays the presets,
// in which case we want the new array of values
// to override the old array (no merging).
isMergeableObject: isPlainObject
function useGlobalStylesUserConfig() {
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
} = select(external_wp_coreData_namespaceObject.store);
const _globalStylesId = select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentGlobalStylesId();
const record = _globalStylesId ? getEditedEntityRecord('root', 'globalStyles', _globalStylesId) : undefined;
if (hasFinishedResolution('__experimentalGetCurrentGlobalStylesId')) {
hasResolved = _globalStylesId ? hasFinishedResolution('getEditedEntityRecord', ['root', 'globalStyles', _globalStylesId]) : true;
globalStylesId: _globalStylesId,
settings: record?.settings,
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store);
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
const config = (0,external_wp_element_namespaceObject.useMemo)(() => {
settings: settings !== null && settings !== void 0 ? settings : {},
styles: styles !== null && styles !== void 0 ? styles : {},
_links: _links !== null && _links !== void 0 ? _links : {}
}, [settings, styles, _links]);
const setConfig = (0,external_wp_element_namespaceObject.useCallback)(
* Set the global styles config.
* @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values.
* Otherwise, overwrite the current config with the incoming object.
* @param {Object} options Options for editEntityRecord Core selector.
(callbackOrObject, options = {}) => {
var _record$styles, _record$settings, _record$_links;
const record = getEditedEntityRecord('root', 'globalStyles', globalStylesId);
styles: (_record$styles = record?.styles) !== null && _record$styles !== void 0 ? _record$styles : {},
settings: (_record$settings = record?.settings) !== null && _record$settings !== void 0 ? _record$settings : {},
_links: (_record$_links = record?._links) !== null && _record$_links !== void 0 ? _record$_links : {}
const updatedConfig = typeof callbackOrObject === 'function' ? callbackOrObject(currentConfig) : callbackOrObject;
editEntityRecord('root', 'globalStyles', globalStylesId, {
styles: cleanEmptyObject(updatedConfig.styles) || {},
settings: cleanEmptyObject(updatedConfig.settings) || {},
_links: cleanEmptyObject(updatedConfig._links) || {}
}, [globalStylesId, editEntityRecord, getEditedEntityRecord]);
return [isReady, config, setConfig];
function useGlobalStylesBaseConfig() {
const baseConfig = (0,external_wp_data_namespaceObject.useSelect)(select => {
return select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeBaseGlobalStyles();
return [!!baseConfig, baseConfig];
function useGlobalStylesContext() {
const [isUserConfigReady, userConfig, setUserConfig] = useGlobalStylesUserConfig();
const [isBaseConfigReady, baseConfig] = useGlobalStylesBaseConfig();
const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!baseConfig || !userConfig) {
return mergeBaseAndUserConfigs(baseConfig, userConfig);
}, [userConfig, baseConfig]);
const context = (0,external_wp_element_namespaceObject.useMemo)(() => {
isReady: isUserConfigReady && isBaseConfigReady,
}, [mergedConfig, userConfig, baseConfig, setUserConfig, isUserConfigReady, isBaseConfigReady]);
function GlobalStylesProvider({
const context = useGlobalStylesContext();
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(global_styles_provider_GlobalStylesContext.Provider, {
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/use-block-editor-settings.js
const EMPTY_BLOCKS_LIST = [];
const DEFAULT_STYLES = {};
function __experimentalReusableBlocksSelect(select) {
var _select$getEntityReco;
return (_select$getEntityReco = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_block', {
})) !== null && _select$getEntityReco !== void 0 ? _select$getEntityReco : EMPTY_BLOCKS_LIST;
const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', '__unstableGalleryWithImageBlocks', 'alignWide', 'blockInspectorTabs', 'allowedMimeTypes', 'bodyPlaceholder', 'canLockBlocks', 'capabilities', 'clearBlockSelection', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'enableOpenverseMediaCategory', 'fontSizes', 'gradients', 'generateAnchors', 'onNavigateToEntityRecord', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'locale', 'maxWidth', 'postContentAttributes', 'postsPerPage', 'readOnly', 'sectionRootClientId', 'styles', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableHasCustomAppender', '__unstableIsPreviewMode', '__unstableResolvedAssets', '__unstableIsBlockBasedTheme', '__experimentalArchiveTitleTypeLabel', '__experimentalArchiveTitleNameLabel'];
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
* React hook used to compute the block editor settings to use for the post editor.
* @param {Object} settings EditorProvider settings prop.
* @param {string} postType Editor root level post type.
* @param {string} postId Editor root level post ID.
* @param {string} renderingMode Editor rendering mode.
* @return {Object} Block Editor Settings.
function useBlockEditorSettings(settings, postType, postId, renderingMode) {
var _mergedGlobalStyles$s, _settings$__experimen, _settings$__experimen2;
const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
allowRightClickOverrides,
restBlockPatternCategories,
} = (0,external_wp_data_namespaceObject.useSelect)(select => {