: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
<script>document.currentScript.parentElement.remove()</script>
const [src, cleanup] = (0,external_wp_element_namespaceObject.useMemo)(() => {
const _src = URL.createObjectURL(new window.Blob([html], {
return [_src, () => URL.revokeObjectURL(_src)];
(0,external_wp_element_namespaceObject.useEffect)(() => cleanup, [cleanup]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!iframeDocument || !isZoomedOut) {
iframeDocument.documentElement.classList.add('is-zoomed-out');
iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-scale', scale === 'default' ? Math.min(containerWidth, maxWidth) / prevContainerWidth.current : scale);
iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-frame-size', typeof frameSize === 'number' ? `${frameSize}px` : frameSize);
iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-content-height', `${contentHeight}px`);
iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-inner-height', `${iframeWindowInnerHeight}px`);
iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-container-width', `${containerWidth}px`);
iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-prev-container-width', `${prevContainerWidth.current}px`);
iframeDocument.documentElement.classList.remove('is-zoomed-out');
iframeDocument.documentElement.style.removeProperty('--wp-block-editor-iframe-zoom-out-scale');
iframeDocument.documentElement.style.removeProperty('--wp-block-editor-iframe-zoom-out-frame-size');
iframeDocument.documentElement.style.removeProperty('--wp-block-editor-iframe-zoom-out-content-height');
iframeDocument.documentElement.style.removeProperty('--wp-block-editor-iframe-zoom-out-inner-height');
iframeDocument.documentElement.style.removeProperty('--wp-block-editor-iframe-zoom-out-container-width');
iframeDocument.documentElement.style.removeProperty('--wp-block-editor-iframe-zoom-out-prev-container-width');
}, [scale, frameSize, iframeDocument, iframeWindowInnerHeight, contentHeight, containerWidth, windowInnerWidth, isZoomedOut]);
// Make sure to not render the before and after focusable div elements in view
// mode. They're only needed to capture focus in edit mode.
const shouldRenderFocusCaptureElements = tabIndex >= 0 && !isPreviewMode;
const iframe = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [shouldRenderFocusCaptureElements && before, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("iframe", {
height: props.style?.height,
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, setRef]),
// Correct doctype is required to enable rendering in standards
// mode. Also preload the styles to avoid a flash of unstyled
// If the event originates from inside the iframe, it means
// it bubbled through the portal, but only with React
// events. We need to to bubble native events as well,
// though by doing so we also trigger another React event,
// so we need to stop the propagation of this event to avoid
if (event.currentTarget.ownerDocument !== event.target.ownerDocument) {
// We should only stop propagation of the React event,
// the native event should further bubble inside the
// iframe to the document and window.
// Alternatively, we could consider redispatching the
// native event in the iframe.
event.nativeEvent.stopPropagation = () => {};
event.nativeEvent.stopPropagation = stopPropagation;
bubbleEvent(event, window.KeyboardEvent, event.currentTarget);
children: iframeDocument && (0,external_wp_element_namespaceObject.createPortal)(
// We want to prevent React events from bubbling throught the iframe
// we bubble these manually.
/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */
(0,external_ReactJSXRuntime_namespaceObject.jsxs)("body", {
className: dist_clsx('block-editor-iframe__body', 'editor-styles-wrapper', ...bodyClasses),
children: [contentResizeListener, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, {
document: iframeDocument,
}), iframeDocument.documentElement)
}), shouldRenderFocusCaptureElements && after]
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "block-editor-iframe__container",
children: [containerResizeListener, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
className: dist_clsx('block-editor-iframe__scale-container', isZoomedOut && 'is-zoomed-out'),
'--wp-block-editor-iframe-zoom-out-container-width': isZoomedOut && `${containerWidth}px`,
'--wp-block-editor-iframe-zoom-out-prev-container-width': isZoomedOut && `${prevContainerWidth.current}px`
function IframeIfReady(props, ref) {
const isInitialised = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().__internalIsInitialized, []);
// We shouldn't render the iframe until the editor settings are initialised.
// The initial settings are needed to get the styles for the srcDoc, which
// cannot be changed after the iframe is mounted. srcDoc is used to to set
// the initial iframe HTML, which is required to avoid a flash of unstyled
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Iframe, {
/* harmony default export */ const iframe = ((0,external_wp_element_namespaceObject.forwardRef)(IframeIfReady));
// EXTERNAL MODULE: ./node_modules/postcss/lib/postcss.js
var postcss = __webpack_require__(4529);
;// CONCATENATED MODULE: ./node_modules/postcss/lib/postcss.mjs
/* harmony default export */ const lib_postcss = (postcss);
const stringify = postcss.stringify
const fromJSON = postcss.fromJSON
const postcss_plugin = postcss.plugin
const parse = postcss.parse
const list = postcss.list
const postcss_document = postcss.document
const comment = postcss.comment
const atRule = postcss.atRule
const rule = postcss.rule
const decl = postcss.decl
const root = postcss.root
const CssSyntaxError = postcss.CssSyntaxError
const Declaration = postcss.Declaration
const Container = postcss.Container
const Processor = postcss.Processor
const Document = postcss.Document
const Comment = postcss.Comment
const postcss_Warning = postcss.Warning
const AtRule = postcss.AtRule
const Result = postcss.Result
const Input = postcss.Input
const Rule = postcss.Rule
const Root = postcss.Root
const Node = postcss.Node
// EXTERNAL MODULE: ./node_modules/postcss-prefixwrap/build/index.js
var build = __webpack_require__(8036);
var build_default = /*#__PURE__*/__webpack_require__.n(build);
// EXTERNAL MODULE: ./node_modules/postcss-urlrebase/index.js
var postcss_urlrebase = __webpack_require__(5404);
var postcss_urlrebase_default = /*#__PURE__*/__webpack_require__.n(postcss_urlrebase);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/index.js
const cacheByWrapperSelector = new Map();
function transformStyle({
}, wrapperSelector = '') {
// When there is no wrapper selector or base URL, there is no need
// to transform the CSS. This is most cases because in the default
// iframed editor, no wrapping is needed, and not many styles
if (!wrapperSelector && !baseURL) {
const postcssFriendlyCSS = css.replace(/:root :where\(body\)/g, 'body').replace(/:where\(body\)/g, 'body');
return lib_postcss([wrapperSelector && build_default()(wrapperSelector, {
ignoredSelectors: [...ignoredSelectors, wrapperSelector]
}), baseURL && postcss_urlrebase_default()({
})].filter(Boolean)).process(postcssFriendlyCSS, {}).css; // use sync PostCSS API
if (error instanceof CssSyntaxError) {
// eslint-disable-next-line no-console
console.warn('wp.blockEditor.transformStyles Failed to transform CSS.', error.message + '\n' + error.showSourceCode(false));
// eslint-disable-next-line no-console
console.warn('wp.blockEditor.transformStyles Failed to transform CSS.', error);
* Applies a series of CSS rule transforms to wrap selectors inside a given class and/or rewrite URLs depending on the parameters passed.
* @typedef {Object} EditorStyle
* @property {string} css the CSS block(s), as a single string.
* @property {?string} baseURL the base URL to be used as the reference when rewritting urls.
* @property {?string[]} ignoredSelectors the selectors not to wrap.
* @param {EditorStyle[]} styles CSS rules.
* @param {string} wrapperSelector Wrapper selector.
* @return {Array} converted rules.
const transform_styles_transformStyles = (styles, wrapperSelector = '') => {
let cache = cacheByWrapperSelector.get(wrapperSelector);
cacheByWrapperSelector.set(wrapperSelector, cache);
return styles.map(style => {
let css = cache.get(style);
css = transformStyle(style, wrapperSelector);
/* harmony default export */ const transform_styles = (transform_styles_transformStyles);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/editor-styles/index.js
function useDarkThemeBodyClassName(styles, scope) {
return (0,external_wp_element_namespaceObject.useCallback)(node => {
const canvas = scope ? ownerDocument.querySelector(scope) : body;
// The real .editor-styles-wrapper element might not exist in the
// DOM, so calculate the background color by creating a fake
const tempCanvas = ownerDocument.createElement('div');
tempCanvas.classList.add('editor-styles-wrapper');
body.appendChild(tempCanvas);
backgroundColor = defaultView?.getComputedStyle(tempCanvas, null).getPropertyValue('background-color');
body.removeChild(tempCanvas);
backgroundColor = defaultView?.getComputedStyle(canvas, null).getPropertyValue('background-color');
const colordBackgroundColor = w(backgroundColor);
// If background is transparent, it should be treated as light color.
if (colordBackgroundColor.luminance() > 0.5 || colordBackgroundColor.alpha() === 0) {
body.classList.remove('is-dark-theme');
body.classList.add('is-dark-theme');
const overrides = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getStyleOverrides(), []);
const [transformedStyles, transformedSvgs] = (0,external_wp_element_namespaceObject.useMemo)(() => {
const _styles = Object.values(styles !== null && styles !== void 0 ? styles : []);
for (const [id, override] of overrides) {
const index = _styles.findIndex(({
_styles.push(overrideWithId);
_styles[index] = overrideWithId;
return [transform_styles(_styles.filter(style => style?.css), scope), _styles.filter(style => style.__unstableType === 'svgs').map(style => style.assets).join('')];
}, [styles, overrides, scope]);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("style", {
ref: useDarkThemeBodyClassName(transformedStyles, scope)
}), transformedStyles.map((css, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("style", {
}, index)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
dangerouslySetInnerHTML: {
/* harmony default export */ const editor_styles = ((0,external_wp_element_namespaceObject.memo)(EditorStyles));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-preview/auto.js
// This is used to avoid rendering the block list if the sizes change.
const EMPTY_ADDITIONAL_STYLES = [];
function ScaledBlockPreview({
additionalStyles = EMPTY_ADDITIONAL_STYLES
viewportWidth = containerWidth;
const [contentResizeListener, {
}] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const settings = select(store).getSettings();
// Avoid scrollbars for pattern previews.
const editorStyles = (0,external_wp_element_namespaceObject.useMemo)(() => {
css: 'body{height:auto;overflow:hidden;border:none;padding:0;}',
__unstableType: 'presets'
}, [styles, additionalStyles]);
// Initialize on render instead of module top level, to avoid circular dependency issues.
MemoizedBlockList = MemoizedBlockList || (0,external_wp_element_namespaceObject.memo)(BlockList);
const scale = containerWidth / viewportWidth;
const aspectRatio = contentHeight ? containerWidth / (contentHeight * scale) : 0;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, {
className: "block-editor-block-preview__content",
transform: `scale(${scale})`,
// Using width + aspect-ratio instead of height here triggers browsers' native
// handling of scrollbar's visibility. It prevents the flickering issue seen
// in https://github.com/WordPress/gutenberg/issues/52027.
// See https://github.com/WordPress/gutenberg/pull/52921 for more info.
maxHeight: contentHeight > MAX_HEIGHT ? MAX_HEIGHT * scale : undefined,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(iframe, {
contentRef: (0,external_wp_compose_namespaceObject.useRefEffect)(bodyElement => {
documentElement.classList.add('block-editor-block-preview__content-iframe');
documentElement.style.position = 'absolute';
documentElement.style.width = '100%';
// Necessary for contentResizeListener to work.
bodyElement.style.boxSizing = 'border-box';
bodyElement.style.position = 'absolute';
bodyElement.style.width = '100%';
// This is a catch-all max-height for patterns.
// See: https://github.com/WordPress/gutenberg/pull/38175.
minHeight: scale !== 0 && scale < 1 && minHeight ? minHeight / scale : minHeight
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_styles, {
}), contentResizeListener, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MemoizedBlockList, {
function AutoBlockPreview(props) {
const [containerResizeListener, {
}] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
children: containerResizeListener
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
className: "block-editor-block-preview__container",
children: !!containerWidth && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScaledBlockPreview, {
containerWidth: containerWidth
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-preview/index.js