: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
const shouldUseDescriptionLabel = ['wp_template', 'wp_template_part', 'wp_block'].includes(postType);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, {
title: shouldUseDescriptionLabel ? (0,external_wp_i18n_namespaceObject.__)('Description') : (0,external_wp_i18n_namespaceObject.__)('Excerpt'),
onToggle: toggleExcerptPanel,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_plugin.Slot, {
children: fills => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostExcerpt, {}), fills]
* Is rendered if the post type supports excerpts and allows editing the excerpt.
* @return {JSX.Element} The rendered PostExcerptPanel component.
function PostExcerptPanel() {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExcerptPanel, {})
function PrivatePostExcerptPanel() {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateExcerpt, {})
function PrivateExcerpt() {
shouldBeUsedAsDescription,
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const postType = getCurrentPostType();
const isTemplateOrTemplatePart = ['wp_template', 'wp_template_part'].includes(postType);
const isPattern = postType === 'wp_block';
// These post types use the `excerpt` field as a description semantically, so we need to
// handle proper labeling and some flows where we should always render them as text.
const _shouldBeUsedAsDescription = isTemplateOrTemplatePart || isPattern;
const _usedAttribute = isTemplateOrTemplatePart ? 'description' : 'excerpt';
// We need to fetch the entity in this case to check if we'll allow editing.
const template = isTemplateOrTemplatePart && select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', postType, getCurrentPostId());
// For post types that use excerpt as description, we do not abide
// by the `isEnabled` panel flag in order to render them as text.
const _shouldRender = isEditorPanelEnabled(post_excerpt_panel_PANEL_NAME) || _shouldBeUsedAsDescription;
excerpt: getEditedPostAttribute(_usedAttribute),
shouldRender: _shouldRender,
shouldBeUsedAsDescription: _shouldBeUsedAsDescription,
// If we should render, allow editing for all post types that are not used as description.
// For the rest allow editing only for user generated entities.
allowEditing: _shouldRender && (!_shouldBeUsedAsDescription || isPattern || template && template.source === TEMPLATE_ORIGINS.custom && !template.has_theme_file)
const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
const label = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)('Description') : (0,external_wp_i18n_namespaceObject.__)('Excerpt');
// Memoize popoverProps to avoid returning a new object every time.
const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
// Anchor the popover to the middle of the entire row so that it doesn't
// move around when the label changes.
}), [popoverAnchor, label]);
const excerptText = !!excerpt && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(excerpt)
const excerptPlaceholder = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)('Add a description…') : (0,external_wp_i18n_namespaceObject.__)('Add an excerpt…');
const triggerEditLabel = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)('Edit description') : (0,external_wp_i18n_namespaceObject.__)('Edit excerpt');
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
children: [excerptText, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
className: "editor-post-excerpt__dropdown",
contentClassName: "editor-post-excerpt__dropdown__content",
popoverProps: popoverProps,
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
className: "editor-post-excerpt__dropdown__trigger",
children: excerptText ? triggerEditLabel : excerptPlaceholder
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_plugin.Slot, {
children: fills => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostExcerpt, {
hideLabelFromVision: true,
;// CONCATENATED MODULE: external ["wp","blob"]
const external_wp_blob_namespaceObject = window["wp"]["blob"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/theme-support-check/index.js
function ThemeSupportCheck({
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
postType: select(store_store).getEditedPostAttribute('type'),
themeSupports: select(external_wp_coreData_namespaceObject.store).getThemeSupports()
const isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some(key => {
const supported = (_themeSupports$key = themeSupports?.[key]) !== null && _themeSupports$key !== void 0 ? _themeSupports$key : false;
// 'post-thumbnails' can be boolean or an array of post types.
// In the latter case, we need to verify `postType` exists
// within `supported`. If `postType` isn't passed, then the check
if ('post-thumbnails' === key && Array.isArray(supported)) {
return supported.includes(postType);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/check.js
* Wrapper component that renders its children only if the post type supports a featured image
* and the theme supports post thumbnails.
* @param {Object} props Props.
* @param {Element} props.children Children to be rendered.
* @return {Component} The component to be rendered.
function PostFeaturedImageCheck({
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ThemeSupportCheck, {
supportKeys: "post-thumbnails",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
supportKeys: "thumbnail",
/* harmony default export */ const post_featured_image_check = (PostFeaturedImageCheck);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/index.js
const ALLOWED_MEDIA_TYPES = ['image'];
// Used when labels from post type were not yet loaded or when they are not present.
const DEFAULT_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Featured image');
const DEFAULT_SET_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Add a featured image');
const instructions = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
children: (0,external_wp_i18n_namespaceObject.__)('To edit the featured image, you need permission to upload media.')
function getMediaDetails(media, postId) {
var _media$media_details$, _media$media_details$2;
const defaultSize = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostFeaturedImage.imageSize', 'large', media.id, postId);
if (defaultSize in ((_media$media_details$ = media?.media_details?.sizes) !== null && _media$media_details$ !== void 0 ? _media$media_details$ : {})) {
mediaWidth: media.media_details.sizes[defaultSize].width,
mediaHeight: media.media_details.sizes[defaultSize].height,
mediaSourceUrl: media.media_details.sizes[defaultSize].source_url
// Use fallbackSize when defaultSize is not available.
const fallbackSize = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostFeaturedImage.imageSize', 'thumbnail', media.id, postId);
if (fallbackSize in ((_media$media_details$2 = media?.media_details?.sizes) !== null && _media$media_details$2 !== void 0 ? _media$media_details$2 : {})) {
mediaWidth: media.media_details.sizes[fallbackSize].width,
mediaHeight: media.media_details.sizes[fallbackSize].height,
mediaSourceUrl: media.media_details.sizes[fallbackSize].source_url
// Use full image size when fallbackSize and defaultSize are not available.
mediaWidth: media.media_details.width,
mediaHeight: media.media_details.height,
mediaSourceUrl: media.source_url
function PostFeaturedImage({
const toggleRef = (0,external_wp_element_namespaceObject.useRef)();
const [isLoading, setIsLoading] = (0,external_wp_element_namespaceObject.useState)(false);
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
} = getMediaDetails(media, currentPostId);
function onDropFiles(filesList) {
getSettings().mediaUpload({
allowedTypes: ALLOWED_MEDIA_TYPES,
if ((0,external_wp_blob_namespaceObject.isBlobURL)(image?.url)) {
noticeOperations.removeAllNotices();
noticeOperations.createErrorNotice(message);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(post_featured_image_check, {
children: [noticeUI, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "editor-post-featured-image",
children: [media && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
id: `editor-post-featured-image-${featuredImageId}-describedby`,
children: [media.alt_text && (0,external_wp_i18n_namespaceObject.sprintf)(
// Translators: %s: The selected image alt text.
(0,external_wp_i18n_namespaceObject.__)('Current image: %s'), media.alt_text), !media.alt_text && (0,external_wp_i18n_namespaceObject.sprintf)(
// Translators: %s: The selected image filename.
(0,external_wp_i18n_namespaceObject.__)('The current image has no alternative text. The file name is: %s'), media.media_details.sizes?.full?.file || media.slug)]
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaUpload, {
title: postType?.labels?.featured_image || DEFAULT_FEATURE_IMAGE_LABEL,
unstableFeaturedImageFlow: true,
allowedTypes: ALLOWED_MEDIA_TYPES,
modalClass: "editor-post-featured-image__media-modal",
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "editor-post-featured-image__container",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, {
className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview',
"aria-label": !featuredImageId ? null : (0,external_wp_i18n_namespaceObject.__)('Edit or replace the image'),
"aria-describedby": !featuredImageId ? null : `editor-post-featured-image-${featuredImageId}-describedby`,
children: [!!featuredImageId && media && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", {
className: "editor-post-featured-image__preview-image",
}), isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}), !featuredImageId && !isLoading && (postType?.labels?.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)]
}), !!featuredImageId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
className: "editor-post-featured-image__actions",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
className: "editor-post-featured-image__action",
children: (0,external_wp_i18n_namespaceObject.__)('Replace')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
className: "editor-post-featured-image__action",
toggleRef.current.focus();
children: (0,external_wp_i18n_namespaceObject.__)('Remove')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropZone, {
const applyWithSelect = (0,external_wp_data_namespaceObject.withSelect)(select => {
} = select(external_wp_coreData_namespaceObject.store);
const featuredImageId = getEditedPostAttribute('featured_media');
media: featuredImageId ? getMedia(featuredImageId, {
currentPostId: getCurrentPostId(),
postType: getPostType(getEditedPostAttribute('type')),
const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dispatch, {
} = dispatch(store_store);
select(external_wp_blockEditor_namespaceObject.store).getSettings().mediaUpload({
noticeOperations.removeAllNotices();
noticeOperations.createErrorNotice(message);
* Renders the component for managing the featured image of a post.
* @param {Object} props Props.
* @param {number} props.currentPostId ID of the current post.
* @param {number} props.featuredImageId ID of the featured image.
* @param {Function} props.onUpdateImage Function to call when the image is updated.
* @param {Function} props.onRemoveImage Function to call when the image is removed.
* @param {Object} props.media The media object representing the featured image.
* @param {string} props.postType Post type.
* @param {Element} props.noticeUI UI for displaying notices.
* @param {Object} props.noticeOperations Operations for managing notices.
* @return {Element} Component to be rendered .
/* harmony default export */ const post_featured_image = ((0,external_wp_compose_namespaceObject.compose)(external_wp_components_namespaceObject.withNotices, applyWithSelect, applyWithDispatch, (0,external_wp_components_namespaceObject.withFilters)('editor.PostFeaturedImage'))(PostFeaturedImage));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/panel.js
const post_featured_image_panel_PANEL_NAME = 'featured-image';
* Renders the panel for the post featured image.
* @param {Object} props Props.
* @param {boolean} props.withPanelBody Whether to include the panel body. Default true.
* @return {Component|null} The component to be rendered.
* Return Null if the editor panel is disabled for featured image.
function PostFeaturedImagePanel({
var _postType$labels$feat;
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
} = select(external_wp_coreData_namespaceObject.store);
postType: getPostType(getEditedPostAttribute('type')),
isEnabled: isEditorPanelEnabled(post_featured_image_panel_PANEL_NAME),
isOpened: isEditorPanelOpened(post_featured_image_panel_PANEL_NAME)
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_check, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image, {})
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_check, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, {
title: (_postType$labels$feat = postType?.labels?.featured_image) !== null && _postType$labels$feat !== void 0 ? _postType$labels$feat : (0,external_wp_i18n_namespaceObject.__)('Featured image'),
onToggle: () => toggleEditorPanelOpened(post_featured_image_panel_PANEL_NAME),
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image, {})