WordPress/wp-includes/js/dist/customize-widgets.min.js
hellofromTonya 5ac76255a9 Editor: Update npm packages ahead of 6.4 RC1.
Updates the npm packages and code for:

* [https://github.com/WordPress/gutenberg/pull/55121 List: fix forward merging of nested list]

* [https://github.com/WordPress/gutenberg/pull/55182 Update consent string for using private APIs.]

* [https://github.com/WordPress/gutenberg/pull/55204 useBlockSettings: add missing useMemo dependencies]

* [https://github.com/WordPress/gutenberg/pull/55120 Remove the lightbox filter and view file when the lightbox setting is disabled.]

* [https://github.com/WordPress/gutenberg/pull/55245 Patterns: Remove the version enforcement for npm in engines field]

* [https://github.com/WordPress/gutenberg/pull/55237 Remove `@return void` from PHP function docs]

* [https://github.com/WordPress/gutenberg/pull/55141 Image: Disable lightbox editor UI for linked images]

* [https://github.com/WordPress/gutenberg/pull/55269 Image: Stop crashing with Lightbox on image blocks without an image]

* [https://github.com/WordPress/gutenberg/pull/55021 Update fullscreen icon]

* [https://github.com/WordPress/gutenberg/pull/55217 Template Part block: Fall back to current theme if no theme attribute is given.] This change is part of fix for a performance regression re-introduced by [56818].

References:
* [https://github.com/WordPress/gutenberg/pull/55298 Gutenberg PR 55298] Cherry-pick commits

Follow-up to [56818], [56816].

Props ellatrix, peterwilsoncc, jsnajdr, afercia, gziolo, isabel_brison, artemiosans, richtabor, bernhard-reiter, flixos90, mikachan, spacedmonkey, hellofromTonya.
See #59583, #59411.
Built from https://develop.svn.wordpress.org/trunk@56849


git-svn-id: http://core.svn.wordpress.org/trunk@56361 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-12 13:58:15 +00:00

7 lines
40 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*! This file is auto-generated */
!function(){var e={4403:function(e,t){var r;
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/!function(){"use strict";var n={}.hasOwnProperty;function i(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var s=typeof r;if("string"===s||"number"===s)e.push(r);else if(Array.isArray(r)){if(r.length){var o=i.apply(null,r);o&&e.push(o)}}else if("object"===s){if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]")){e.push(r.toString());continue}for(var a in r)n.call(r,a)&&r[a]&&e.push(a)}}}return e.join(" ")}e.exports?(i.default=i,e.exports=i):void 0===(r=function(){return i}.apply(t,[]))||(e.exports=r)}()},5619:function(e){"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,i,s;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(i=n;0!=i--;)if(!e(t[i],r[i]))return!1;return!0}if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(i of t.entries())if(!r.has(i[0]))return!1;for(i of t.entries())if(!e(i[1],r.get(i[0])))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(i of t.entries())if(!r.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(r)){if((n=t.length)!=r.length)return!1;for(i=n;0!=i--;)if(t[i]!==r[i])return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(s=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,s[i]))return!1;for(i=n;0!=i--;){var o=s[i];if(!e(t[o],r[o]))return!1}return!0}return t!=t&&r!=r}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};!function(){"use strict";r.r(n),r.d(n,{initialize:function(){return rt},store:function(){return P}});var e={};r.r(e),r.d(e,{__experimentalGetInsertionPoint:function(){return O},isInserterOpened:function(){return M}});var t={};r.r(t),r.d(t,{setIsInserterOpened:function(){return T}});var i={};r.r(i),r.d(i,{closeModal:function(){return X},disableComplementaryArea:function(){return j},enableComplementaryArea:function(){return $},openModal:function(){return Q},pinItem:function(){return Y},setDefaultComplementaryArea:function(){return U},setFeatureDefaults:function(){return J},setFeatureValue:function(){return Z},toggleFeature:function(){return K},unpinItem:function(){return q}});var s={};r.r(s),r.d(s,{getActiveComplementaryArea:function(){return ee},isComplementaryAreaLoading:function(){return te},isFeatureActive:function(){return ne},isItemPinned:function(){return re},isModalActive:function(){return ie}});var o=window.wp.element,a=window.wp.blockLibrary,c=window.wp.widgets,l=window.wp.blocks,d=window.wp.data,u=window.wp.preferences,m=window.wp.components,h=window.wp.i18n,p=window.wp.blockEditor,g=window.wp.compose,f=window.wp.hooks;function b({text:e,children:t}){const r=(0,g.useCopyToClipboard)(e);return(0,o.createElement)(m.Button,{variant:"secondary",ref:r},t)}class w extends o.Component{constructor(){super(...arguments),this.state={error:null}}componentDidCatch(e){this.setState({error:e}),(0,f.doAction)("editor.ErrorBoundary.errorLogged",e)}render(){const{error:e}=this.state;return e?(0,o.createElement)(p.Warning,{className:"customize-widgets-error-boundary",actions:[(0,o.createElement)(b,{key:"copy-error",text:e.stack},(0,h.__)("Copy Error"))]},(0,h.__)("The editor has encountered an unexpected error.")):this.props.children}}var _=window.wp.coreData,y=window.wp.mediaUtils;var v=function({inspector:e,closeMenu:t,...r}){const n=(0,d.useSelect)((e=>e(p.store).getSelectedBlockClientId()),[]),i=(0,o.useMemo)((()=>document.getElementById(`block-${n}`)),[n]);return(0,o.createElement)(m.MenuItem,{onClick:()=>{e.open({returnFocusWhenClose:i}),t()},...r},(0,h.__)("Show more settings"))},E=r(4403),k=r.n(E),C=window.wp.keycodes,S=window.wp.primitives;var x=(0,o.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(S.Path,{d:"M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"}));var I=(0,o.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(S.Path,{d:"M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"}));var z=(0,o.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(S.Path,{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"}));var A=(0,o.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(S.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));var B=(0,d.combineReducers)({blockInserterPanel:function(e=!1,t){return"SET_IS_INSERTER_OPENED"===t.type?t.value:e}});const W={rootClientId:void 0,insertionIndex:void 0};function M(e){return!!e.blockInserterPanel}function O(e){return"boolean"==typeof e.blockInserterPanel?W:e.blockInserterPanel}function T(e){return{type:"SET_IS_INSERTER_OPENED",value:e}}const N={reducer:B,selectors:e,actions:t},P=(0,d.createReduxStore)("core/customize-widgets",N);(0,d.register)(P);var F=function e({setIsOpened:t}){const r=(0,g.useInstanceId)(e,"customize-widget-layout__inserter-panel-title"),n=(0,d.useSelect)((e=>e(P).__experimentalGetInsertionPoint()),[]);return(0,o.createElement)("div",{className:"customize-widgets-layout__inserter-panel","aria-labelledby":r},(0,o.createElement)("div",{className:"customize-widgets-layout__inserter-panel-header"},(0,o.createElement)("h2",{id:r,className:"customize-widgets-layout__inserter-panel-header-title"},(0,h.__)("Add a block")),(0,o.createElement)(m.Button,{className:"customize-widgets-layout__inserter-panel-header-close-button",icon:A,onClick:()=>t(!1),"aria-label":(0,h.__)("Close inserter")})),(0,o.createElement)("div",{className:"customize-widgets-layout__inserter-panel-content"},(0,o.createElement)(p.__experimentalLibrary,{rootClientId:n.rootClientId,__experimentalInsertionIndex:n.insertionIndex,showInserterHelpPanel:!0,onSelect:()=>t(!1)})))};var L=(0,o.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(S.Path,{d:"M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"})),D=window.wp.keyboardShortcuts;var R=(0,o.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(S.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"}));function V({as:e=m.DropdownMenu,className:t,label:r=(0,h.__)("Options"),popoverProps:n,toggleProps:i,children:s}){return(0,o.createElement)(e,{className:k()("interface-more-menu-dropdown",t),icon:R,label:r,popoverProps:{placement:"bottom-end",...n,className:k()("interface-more-menu-dropdown__content",n?.className)},toggleProps:{tooltipPosition:"bottom",...i}},(e=>s(e)))}var H=window.wp.deprecated,G=r.n(H);const U=(e,t)=>({type:"SET_DEFAULT_COMPLEMENTARY_AREA",scope:e,area:t}),$=(e,t)=>({registry:r,dispatch:n})=>{if(!t)return;r.select(u.store).get(e,"isComplementaryAreaVisible")||r.dispatch(u.store).set(e,"isComplementaryAreaVisible",!0),n({type:"ENABLE_COMPLEMENTARY_AREA",scope:e,area:t})},j=e=>({registry:t})=>{t.select(u.store).get(e,"isComplementaryAreaVisible")&&t.dispatch(u.store).set(e,"isComplementaryAreaVisible",!1)},Y=(e,t)=>({registry:r})=>{if(!t)return;const n=r.select(u.store).get(e,"pinnedItems");!0!==n?.[t]&&r.dispatch(u.store).set(e,"pinnedItems",{...n,[t]:!0})},q=(e,t)=>({registry:r})=>{if(!t)return;const n=r.select(u.store).get(e,"pinnedItems");r.dispatch(u.store).set(e,"pinnedItems",{...n,[t]:!1})};function K(e,t){return function({registry:r}){G()("dispatch( 'core/interface' ).toggleFeature",{since:"6.0",alternative:"dispatch( 'core/preferences' ).toggle"}),r.dispatch(u.store).toggle(e,t)}}function Z(e,t,r){return function({registry:n}){G()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),n.dispatch(u.store).set(e,t,!!r)}}function J(e,t){return function({registry:r}){G()("dispatch( 'core/interface' ).setFeatureDefaults",{since:"6.0",alternative:"dispatch( 'core/preferences' ).setDefaults"}),r.dispatch(u.store).setDefaults(e,t)}}function Q(e){return{type:"OPEN_MODAL",name:e}}function X(){return{type:"CLOSE_MODAL"}}const ee=(0,d.createRegistrySelector)((e=>(t,r)=>{const n=e(u.store).get(r,"isComplementaryAreaVisible");if(void 0!==n)return!1===n?null:t?.complementaryAreas?.[r]})),te=(0,d.createRegistrySelector)((e=>(t,r)=>{const n=e(u.store).get(r,"isComplementaryAreaVisible"),i=t?.complementaryAreas?.[r];return n&&void 0===i})),re=(0,d.createRegistrySelector)((e=>(t,r,n)=>{var i;const s=e(u.store).get(r,"pinnedItems");return null===(i=s?.[n])||void 0===i||i})),ne=(0,d.createRegistrySelector)((e=>(t,r,n)=>(G()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(u.store).get(r,n))));function ie(e,t){return e.activeModal===t}var se=(0,d.combineReducers)({complementaryAreas:function(e={},t){switch(t.type){case"SET_DEFAULT_COMPLEMENTARY_AREA":{const{scope:r,area:n}=t;return e[r]?e:{...e,[r]:n}}case"ENABLE_COMPLEMENTARY_AREA":{const{scope:r,area:n}=t;return{...e,[r]:n}}}return e},activeModal:function(e=null,t){switch(t.type){case"OPEN_MODAL":return t.name;case"CLOSE_MODAL":return null}return e}});const oe=(0,d.createReduxStore)("core/interface",{reducer:se,actions:i,selectors:s});(0,d.register)(oe);const ae=[{keyCombination:{modifier:"primary",character:"b"},description:(0,h.__)("Make the selected text bold.")},{keyCombination:{modifier:"primary",character:"i"},description:(0,h.__)("Make the selected text italic.")},{keyCombination:{modifier:"primary",character:"k"},description:(0,h.__)("Convert the selected text into a link.")},{keyCombination:{modifier:"primaryShift",character:"k"},description:(0,h.__)("Remove a link.")},{keyCombination:{character:"[["},description:(0,h.__)("Insert a link to a post or page.")},{keyCombination:{modifier:"primary",character:"u"},description:(0,h.__)("Underline the selected text.")},{keyCombination:{modifier:"access",character:"d"},description:(0,h.__)("Strikethrough the selected text.")},{keyCombination:{modifier:"access",character:"x"},description:(0,h.__)("Make the selected text inline code.")},{keyCombination:{modifier:"access",character:"0"},description:(0,h.__)("Convert the current heading to a paragraph.")},{keyCombination:{modifier:"access",character:"1-6"},description:(0,h.__)("Convert the current paragraph or heading to a heading of level 1 to 6.")}];function ce({keyCombination:e,forceAriaLabel:t}){const r=e.modifier?C.displayShortcutList[e.modifier](e.character):e.character,n=e.modifier?C.shortcutAriaLabel[e.modifier](e.character):e.character;return(0,o.createElement)("kbd",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":t||n},(Array.isArray(r)?r:[r]).map(((e,t)=>"+"===e?(0,o.createElement)(o.Fragment,{key:t},e):(0,o.createElement)("kbd",{key:t,className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-key"},e))))}var le=function({description:e,keyCombination:t,aliases:r=[],ariaLabel:n}){return(0,o.createElement)(o.Fragment,null,(0,o.createElement)("div",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-description"},e),(0,o.createElement)("div",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-term"},(0,o.createElement)(ce,{keyCombination:t,forceAriaLabel:n}),r.map(((e,t)=>(0,o.createElement)(ce,{keyCombination:e,forceAriaLabel:n,key:t})))))};var de=function({name:e}){const{keyCombination:t,description:r,aliases:n}=(0,d.useSelect)((t=>{const{getShortcutKeyCombination:r,getShortcutDescription:n,getShortcutAliases:i}=t(D.store);return{keyCombination:r(e),aliases:i(e),description:n(e)}}),[e]);return t?(0,o.createElement)(le,{keyCombination:t,description:r,aliases:n}):null};const ue=({shortcuts:e})=>(0,o.createElement)("ul",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-list",role:"list"},e.map(((e,t)=>(0,o.createElement)("li",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut",key:t},"string"==typeof e?(0,o.createElement)(de,{name:e}):(0,o.createElement)(le,{...e}))))),me=({title:e,shortcuts:t,className:r})=>(0,o.createElement)("section",{className:k()("customize-widgets-keyboard-shortcut-help-modal__section",r)},!!e&&(0,o.createElement)("h2",{className:"customize-widgets-keyboard-shortcut-help-modal__section-title"},e),(0,o.createElement)(ue,{shortcuts:t})),he=({title:e,categoryName:t,additionalShortcuts:r=[]})=>{const n=(0,d.useSelect)((e=>e(D.store).getCategoryShortcuts(t)),[t]);return(0,o.createElement)(me,{title:e,shortcuts:n.concat(r)})};function pe({isModalActive:e,toggleModal:t}){const{registerShortcut:r}=(0,d.useDispatch)(D.store);return r({name:"core/customize-widgets/keyboard-shortcuts",category:"main",description:(0,h.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}}),(0,D.useShortcut)("core/customize-widgets/keyboard-shortcuts",t),e?(0,o.createElement)(m.Modal,{className:"customize-widgets-keyboard-shortcut-help-modal",title:(0,h.__)("Keyboard shortcuts"),onRequestClose:t},(0,o.createElement)(me,{className:"customize-widgets-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/customize-widgets/keyboard-shortcuts"]}),(0,o.createElement)(he,{title:(0,h.__)("Global shortcuts"),categoryName:"global"}),(0,o.createElement)(he,{title:(0,h.__)("Selection shortcuts"),categoryName:"selection"}),(0,o.createElement)(he,{title:(0,h.__)("Block shortcuts"),categoryName:"block",additionalShortcuts:[{keyCombination:{character:"/"},description:(0,h.__)("Change the block type after adding a new paragraph."),ariaLabel:(0,h.__)("Forward-slash")}]}),(0,o.createElement)(me,{title:(0,h.__)("Text formatting"),shortcuts:ae})):null}function ge(){const[e,t]=(0,o.useState)(!1),r=()=>t(!e);return(0,D.useShortcut)("core/customize-widgets/keyboard-shortcuts",r),(0,o.createElement)(o.Fragment,null,(0,o.createElement)(V,{as:m.ToolbarDropdownMenu},(()=>(0,o.createElement)(o.Fragment,null,(0,o.createElement)(m.MenuGroup,{label:(0,h._x)("View","noun")},(0,o.createElement)(u.PreferenceToggleMenuItem,{scope:"core/customize-widgets",name:"fixedToolbar",label:(0,h.__)("Top toolbar"),info:(0,h.__)("Access all block and document tools in a single place"),messageActivated:(0,h.__)("Top toolbar activated"),messageDeactivated:(0,h.__)("Top toolbar deactivated")})),(0,o.createElement)(m.MenuGroup,{label:(0,h.__)("Tools")},(0,o.createElement)(m.MenuItem,{onClick:()=>{t(!0)},shortcut:C.displayShortcut.access("h")},(0,h.__)("Keyboard shortcuts")),(0,o.createElement)(u.PreferenceToggleMenuItem,{scope:"core/customize-widgets",name:"welcomeGuide",label:(0,h.__)("Welcome Guide")}),(0,o.createElement)(m.MenuItem,{role:"menuitem",icon:L,href:(0,h.__)("https://wordpress.org/documentation/article/block-based-widgets-editor/"),target:"_blank",rel:"noopener noreferrer"},(0,h.__)("Help"),(0,o.createElement)(m.VisuallyHidden,{as:"span"},(0,h.__)("(opens in a new tab)")))),(0,o.createElement)(m.MenuGroup,{label:(0,h.__)("Preferences")},(0,o.createElement)(u.PreferenceToggleMenuItem,{scope:"core/customize-widgets",name:"keepCaretInsideBlock",label:(0,h.__)("Contain text cursor inside block"),info:(0,h.__)("Aids screen readers by stopping text caret from leaving blocks."),messageActivated:(0,h.__)("Contain text cursor inside block activated"),messageDeactivated:(0,h.__)("Contain text cursor inside block deactivated")}))))),(0,o.createElement)(pe,{isModalActive:e,toggleModal:r}))}var fe=function({sidebar:e,inserter:t,isInserterOpened:r,setIsInserterOpened:n,isFixedToolbarActive:i}){const[[s,a],c]=(0,o.useState)([e.hasUndo(),e.hasRedo()]),l=(0,C.isAppleOS)()?C.displayShortcut.primaryShift("z"):C.displayShortcut.primary("y");return(0,o.useEffect)((()=>e.subscribeHistory((()=>{c([e.hasUndo(),e.hasRedo()])}))),[e]),(0,o.createElement)(o.Fragment,null,(0,o.createElement)("div",{className:k()("customize-widgets-header",{"is-fixed-toolbar-active":i})},(0,o.createElement)(p.NavigableToolbar,{className:"customize-widgets-header-toolbar","aria-label":(0,h.__)("Document tools")},(0,o.createElement)(m.ToolbarButton,{icon:(0,h.isRTL)()?I:x,label:(0,h.__)("Undo"),shortcut:C.displayShortcut.primary("z"),"aria-disabled":!s,onClick:e.undo,className:"customize-widgets-editor-history-button undo-button"}),(0,o.createElement)(m.ToolbarButton,{icon:(0,h.isRTL)()?x:I,label:(0,h.__)("Redo"),shortcut:l,"aria-disabled":!a,onClick:e.redo,className:"customize-widgets-editor-history-button redo-button"}),(0,o.createElement)(m.ToolbarButton,{className:"customize-widgets-header-toolbar__inserter-toggle",isPressed:r,variant:"primary",icon:z,label:(0,h._x)("Add block","Generic label for block inserter button"),onClick:()=>{n((e=>!e))}}),(0,o.createElement)(ge,null))),(0,o.createPortal)((0,o.createElement)(F,{setIsOpened:n}),t.contentContainer[0]))};var be=r(5619),we=r.n(be),_e=window.wp.isShallowEqual,ye=r.n(_e);function ve(e){const t=e.match(/^widget_(.+)(?:\[(\d+)\])$/);if(t){return`${t[1]}-${parseInt(t[2],10)}`}return e}function Ee(e,t=null){let r;if("core/legacy-widget"===e.name&&(e.attributes.id||e.attributes.instance))if(e.attributes.id)r={id:e.attributes.id};else{const{encoded:n,hash:i,raw:s,...o}=e.attributes.instance;r={idBase:e.attributes.idBase,instance:{...t?.instance,is_widget_customizer_js_value:!0,encoded_serialized_instance:n,instance_hash_key:i,raw_instance:s,...o}}}else{r={idBase:"block",widgetClass:"WP_Widget_Block",instance:{raw_instance:{content:(0,l.serialize)(e)}}}}const{form:n,rendered:i,...s}=t||{};return{...s,...r}}function ke({id:e,idBase:t,number:r,instance:n}){let i;const{encoded_serialized_instance:s,instance_hash_key:o,raw_instance:a,...d}=n;if("block"===t){var u;const e=(0,l.parse)(null!==(u=a.content)&&void 0!==u?u:"",{__unstableSkipAutop:!0});i=e.length?e[0]:(0,l.createBlock)("core/paragraph",{})}else i=r?(0,l.createBlock)("core/legacy-widget",{idBase:t,instance:{encoded:s,hash:o,raw:a,...d}}):(0,l.createBlock)("core/legacy-widget",{id:e});return(0,c.addWidgetIdToBlock)(i,e)}function Ce(e){const[t,r]=(0,o.useState)((()=>e.getWidgets().map((e=>ke(e)))));(0,o.useEffect)((()=>e.subscribe(((e,t)=>{r((r=>{const n=new Map(e.map((e=>[e.id,e]))),i=new Map(r.map((e=>[(0,c.getWidgetIdFromBlock)(e),e]))),s=t.map((e=>{const t=n.get(e.id);return t&&t===e?i.get(e.id):ke(e)}));return ye()(r,s)?r:s}))}))),[e]);const n=(0,o.useCallback)((t=>{r((r=>{if(ye()(r,t))return r;const n=new Map(r.map((e=>[(0,c.getWidgetIdFromBlock)(e),e]))),i=t.map((t=>{const r=(0,c.getWidgetIdFromBlock)(t);if(r&&n.has(r)){const i=n.get(r),s=e.getWidget(r);return we()(t,i)&&s?s:Ee(t,s)}return Ee(t)}));if(ye()(e.getWidgets(),i))return r;const s=e.setWidgets(i);return t.reduce(((e,r,n)=>{const i=s[n];return null!==i&&(e===t&&(e=t.slice()),e[n]=(0,c.addWidgetIdToBlock)(r,i)),e}),t)}))}),[e]);return[t,n,n]}const Se=(0,o.createContext)();function xe({api:e,sidebarControls:t,children:r}){const[n,i]=(0,o.useState)({current:null}),s=(0,o.useCallback)((e=>{for(const r of t){if(r.setting.get().includes(e)){r.sectionInstance.expand({completeCallback(){i({current:e})}});break}}}),[t]);(0,o.useEffect)((()=>{function t(e){const t=ve(e);s(t)}let r=!1;function n(){e.previewer.preview.bind("focus-control-for-setting",t),r=!0}return e.previewer.bind("ready",n),()=>{e.previewer.unbind("ready",n),r&&e.previewer.preview.unbind("focus-control-for-setting",t)}}),[e,s]);const a=(0,o.useMemo)((()=>[n,s]),[n,s]);return(0,o.createElement)(Se.Provider,{value:a},r)}const Ie=()=>(0,o.useContext)(Se);var ze=window.wp.privateApis;const{lock:Ae,unlock:Be}=(0,ze.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.","@wordpress/customize-widgets"),{ExperimentalBlockEditorProvider:We}=Be(p.privateApis);function Me({sidebar:e,settings:t,children:r}){const[n,i,s]=Ce(e);return function(e){const{selectBlock:t}=(0,d.useDispatch)(p.store),[r]=Ie(),n=(0,o.useRef)(e);(0,o.useEffect)((()=>{n.current=e}),[e]),(0,o.useEffect)((()=>{if(r.current){const e=n.current.find((e=>(0,c.getWidgetIdFromBlock)(e)===r.current));if(e){t(e.clientId);const r=document.querySelector(`[data-block="${e.clientId}"]`);r?.focus()}}}),[r,t])}(n),(0,o.createElement)(We,{value:n,onInput:i,onChange:s,settings:t,useSubRegistry:!1},r)}function Oe({sidebar:e}){const{toggle:t}=(0,d.useDispatch)(u.store),r=e.getWidgets().every((e=>e.id.startsWith("block-")));return(0,o.createElement)("div",{className:"customize-widgets-welcome-guide"},(0,o.createElement)("div",{className:"customize-widgets-welcome-guide__image__wrapper"},(0,o.createElement)("picture",null,(0,o.createElement)("source",{srcSet:"https://s.w.org/images/block-editor/welcome-editor.svg",media:"(prefers-reduced-motion: reduce)"}),(0,o.createElement)("img",{className:"customize-widgets-welcome-guide__image",src:"https://s.w.org/images/block-editor/welcome-editor.gif",width:"312",height:"240",alt:""}))),(0,o.createElement)("h1",{className:"customize-widgets-welcome-guide__heading"},(0,h.__)("Welcome to block Widgets")),(0,o.createElement)("p",{className:"customize-widgets-welcome-guide__text"},r?(0,h.__)("Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how theyll look on your site."):(0,h.__)("You can now add any block to your sites widget areas. Dont worry, all of your favorite widgets still work flawlessly.")),(0,o.createElement)(m.Button,{className:"customize-widgets-welcome-guide__button",variant:"primary",onClick:()=>t("core/customize-widgets","welcomeGuide")},(0,h.__)("Got it")),(0,o.createElement)("hr",{className:"customize-widgets-welcome-guide__separator"}),!r&&(0,o.createElement)("p",{className:"customize-widgets-welcome-guide__more-info"},(0,h.__)("Want to stick with the old widgets?"),(0,o.createElement)("br",null),(0,o.createElement)(m.ExternalLink,{href:(0,h.__)("https://wordpress.org/plugins/classic-widgets/")},(0,h.__)("Get the Classic Widgets plugin."))),(0,o.createElement)("p",{className:"customize-widgets-welcome-guide__more-info"},(0,h.__)("New to the block editor?"),(0,o.createElement)("br",null),(0,o.createElement)(m.ExternalLink,{href:(0,h.__)("https://wordpress.org/documentation/article/wordpress-block-editor/")},(0,h.__)("Here's a detailed guide."))))}function Te({undo:e,redo:t,save:r}){const{replaceBlocks:n}=(0,d.useDispatch)(p.store),{getBlockName:i,getSelectedBlockClientId:s,getBlockAttributes:o}=(0,d.useSelect)(p.store),a=(e,t)=>{e.preventDefault();const r=0===t?"core/paragraph":"core/heading",a=s();if(null===a)return;const c=i(a);if("core/paragraph"!==c&&"core/heading"!==c)return;const d=o(a),u="core/paragraph"===c?"align":"textAlign",m="core/paragraph"===r?"align":"textAlign";n(a,(0,l.createBlock)(r,{level:t,content:d.content,[m]:d[u]}))};return(0,D.useShortcut)("core/customize-widgets/undo",(t=>{e(),t.preventDefault()})),(0,D.useShortcut)("core/customize-widgets/redo",(e=>{t(),e.preventDefault()})),(0,D.useShortcut)("core/customize-widgets/save",(e=>{e.preventDefault(),r()})),(0,D.useShortcut)("core/customize-widgets/transform-heading-to-paragraph",(e=>a(e,0))),[1,2,3,4,5,6].forEach((e=>{(0,D.useShortcut)(`core/customize-widgets/transform-paragraph-to-heading-${e}`,(t=>a(t,e)))})),null}Te.Register=function(){const{registerShortcut:e,unregisterShortcut:t}=(0,d.useDispatch)(D.store);return(0,o.useEffect)((()=>(e({name:"core/customize-widgets/undo",category:"global",description:(0,h.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/customize-widgets/redo",category:"global",description:(0,h.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"},aliases:(0,C.isAppleOS)()?[]:[{modifier:"primary",character:"y"}]}),e({name:"core/customize-widgets/save",category:"global",description:(0,h.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),e({name:"core/customize-widgets/transform-heading-to-paragraph",category:"block-library",description:(0,h.__)("Transform heading to paragraph."),keyCombination:{modifier:"access",character:"0"}}),[1,2,3,4,5,6].forEach((t=>{e({name:`core/customize-widgets/transform-paragraph-to-heading-${t}`,category:"block-library",description:(0,h.__)("Transform paragraph to heading."),keyCombination:{modifier:"access",character:`${t}`}})})),()=>{t("core/customize-widgets/undo"),t("core/customize-widgets/redo"),t("core/customize-widgets/save")})),[e]),null};var Ne=Te;function Pe(e){const t=(0,o.useRef)(),r=(0,d.useSelect)((e=>0===e(p.store).getBlockCount()));return(0,o.useEffect)((()=>{if(r&&t.current){const{ownerDocument:e}=t.current;e.activeElement&&e.activeElement!==e.body||t.current.focus()}}),[r]),(0,o.createElement)(p.ButtonBlockAppender,{...e,ref:t})}const{ExperimentalBlockCanvas:Fe}=Be(p.privateApis);function Le({blockEditorSettings:e,sidebar:t,inserter:r,inspector:n}){const[i,s]=function(e){const t=(0,d.useSelect)((e=>e(P).isInserterOpened()),[]),{setIsInserterOpened:r}=(0,d.useDispatch)(P);return(0,o.useEffect)((()=>{t?e.open():e.close()}),[e,t]),[t,(0,o.useCallback)((e=>{let t=e;"function"==typeof e&&(t=e((0,d.select)(P).isInserterOpened())),r(t)}),[r])]}(r),{hasUploadPermissions:a,isFixedToolbarActive:c,keepCaretInsideBlock:l,isWelcomeGuideActive:m}=(0,d.useSelect)((e=>{var t;const{get:r}=e(u.store);return{hasUploadPermissions:null===(t=e(_.store).canUser("create","media"))||void 0===t||t,isFixedToolbarActive:!!r("core/customize-widgets","fixedToolbar"),keepCaretInsideBlock:!!r("core/customize-widgets","keepCaretInsideBlock"),isWelcomeGuideActive:!!r("core/customize-widgets","welcomeGuide")}}),[]),h=(0,o.useMemo)((()=>{let t;return a&&(t=({onError:t,...r})=>{(0,y.uploadMedia)({wpAllowedMimeTypes:e.allowedMimeTypes,onError:({message:e})=>t(e),...r})}),{...e,__experimentalSetIsInserterOpened:s,mediaUpload:t,hasFixedToolbar:c,keepCaretInsideBlock:l,__unstableHasCustomAppender:!0}}),[a,e,c,l,s]);return m?(0,o.createElement)(Oe,{sidebar:t}):(0,o.createElement)(o.Fragment,null,(0,o.createElement)(Ne.Register,null),(0,o.createElement)(Me,{sidebar:t,settings:h},(0,o.createElement)(Ne,{undo:t.undo,redo:t.redo,save:t.save}),(0,o.createElement)(fe,{sidebar:t,inserter:r,isInserterOpened:i,setIsInserterOpened:s,isFixedToolbarActive:c}),(0,o.createElement)(p.BlockTools,null,(0,o.createElement)(Fe,{shouldIframe:!1,styles:h.defaultEditorStyles,height:"100%"},(0,o.createElement)(p.BlockList,{renderAppender:Pe}))),(0,o.createPortal)((0,o.createElement)("form",{onSubmit:e=>e.preventDefault()},(0,o.createElement)(p.BlockInspector,null)),n.contentContainer[0])),(0,o.createElement)(p.__unstableBlockSettingsMenuFirstItem,null,(({onClose:e})=>(0,o.createElement)(v,{inspector:n,closeMenu:e}))))}const De=(0,o.createContext)();function Re({sidebarControls:e,activeSidebarControl:t,children:r}){const n=(0,o.useMemo)((()=>({sidebarControls:e,activeSidebarControl:t})),[e,t]);return(0,o.createElement)(De.Provider,{value:n},r)}function Ve({api:e,sidebarControls:t,blockEditorSettings:r}){const[n,i]=(0,o.useState)(null),s=document.getElementById("customize-theme-controls"),a=(0,o.useRef)();!function(e,t){const{hasSelectedBlock:r,hasMultiSelection:n}=(0,d.useSelect)(p.store),{clearSelectedBlock:i}=(0,d.useDispatch)(p.store);(0,o.useEffect)((()=>{if(t.current&&e){const s=e.inspector,o=e.container[0],a=o.ownerDocument,c=a.defaultView;function l(e){!r()&&!n()||!e||!a.contains(e)||o.contains(e)||t.current.contains(e)||e.closest('[role="dialog"]')||s.expanded()||i()}function d(e){l(e.target)}function u(){l(a.activeElement)}return a.addEventListener("mousedown",d),c.addEventListener("blur",u),()=>{a.removeEventListener("mousedown",d),c.removeEventListener("blur",u)}}}),[t,e,r,n,i])}(n,a),(0,o.useEffect)((()=>{const e=t.map((e=>e.subscribe((t=>{t&&i(e)}))));return()=>{e.forEach((e=>e()))}}),[t]);const c=n&&(0,o.createPortal)((0,o.createElement)(w,null,(0,o.createElement)(Le,{key:n.id,blockEditorSettings:r,sidebar:n.sidebarAdapter,inserter:n.inserter,inspector:n.inspector})),n.container[0]),l=s&&(0,o.createPortal)((0,o.createElement)("div",{className:"customize-widgets-popover",ref:a},(0,o.createElement)(m.Popover.Slot,null)),s);return(0,o.createElement)(m.SlotFillProvider,null,(0,o.createElement)(Re,{sidebarControls:t,activeSidebarControl:n},(0,o.createElement)(xe,{api:e,sidebarControls:t},c,l)))}const He=e=>`widgets-inspector-${e}`;function Ge(){const{wp:{customize:e}}=window,t=window.matchMedia("(prefers-reduced-motion: reduce)");let r=t.matches;return t.addEventListener("change",(e=>{r=e.matches})),class extends e.Section{ready(){const t=function(){const{wp:{customize:e}}=window;return class extends e.Section{constructor(e,t){super(e,t),this.parentSection=t.parentSection,this.returnFocusWhenClose=null,this._isOpen=!1}get isOpen(){return this._isOpen}set isOpen(e){this._isOpen=e,this.triggerActiveCallbacks()}ready(){this.contentContainer[0].classList.add("customize-widgets-layout__inspector")}isContextuallyActive(){return this.isOpen}onChangeExpanded(e,t){super.onChangeExpanded(e,t),this.parentSection&&!t.unchanged&&(e?this.parentSection.collapse({manualTransition:!0}):this.parentSection.expand({manualTransition:!0,completeCallback:()=>{this.returnFocusWhenClose&&!this.contentContainer[0].contains(this.returnFocusWhenClose)&&this.returnFocusWhenClose.focus()}}))}open({returnFocusWhenClose:e}={}){this.isOpen=!0,this.returnFocusWhenClose=e,this.expand({allowMultiple:!0})}close(){this.collapse({allowMultiple:!0})}collapse(e){this.isOpen=!1,super.collapse(e)}triggerActiveCallbacks(){this.active.callbacks.fireWith(this.active,[!1,!0])}}}();this.inspector=new t(He(this.id),{title:(0,h.__)("Block Settings"),parentSection:this,customizeAction:[(0,h.__)("Customizing"),(0,h.__)("Widgets"),this.params.title].join(" ▸ ")}),e.section.add(this.inspector),this.contentContainer[0].classList.add("customize-widgets__sidebar-section")}hasSubSectionOpened(){return this.inspector.expanded()}onChangeExpanded(e,t){const n=this.controls(),i={...t,completeCallback(){n.forEach((t=>{t.onChangeSectionExpanded?.(e,i)})),t.completeCallback?.()}};if(i.manualTransition){e?(this.contentContainer.addClass(["busy","open"]),this.contentContainer.removeClass("is-sub-section-open"),this.contentContainer.closest(".wp-full-overlay").addClass("section-open")):(this.contentContainer.addClass(["busy","is-sub-section-open"]),this.contentContainer.closest(".wp-full-overlay").addClass("section-open"),this.contentContainer.removeClass("open"));const t=()=>{this.contentContainer.removeClass("busy"),i.completeCallback()};r?t():this.contentContainer.one("transitionend",t)}else super.onChangeExpanded(e,i)}}}const{wp:Ue}=window;function $e(e){const t=e.match(/^(.+)-(\d+)$/);return t?{idBase:t[1],number:parseInt(t[2],10)}:{idBase:e}}function je(e){const{idBase:t,number:r}=$e(e);return r?`widget_${t}[${r}]`:`widget_${t}`}class Ye{constructor(e,t){this.setting=e,this.api=t,this.locked=!1,this.widgetsCache=new WeakMap,this.subscribers=new Set,this.history=[this._getWidgetIds().map((e=>this.getWidget(e)))],this.historyIndex=0,this.historySubscribers=new Set,this._debounceSetHistory=function(e,t,r){let n,i=!1;function s(...s){const o=(i?t:e).apply(this,s);return i=!0,clearTimeout(n),n=setTimeout((()=>{i=!1}),r),o}return s.cancel=()=>{i=!1,clearTimeout(n)},s}(this._pushHistory,this._replaceHistory,1e3),this.setting.bind(this._handleSettingChange.bind(this)),this.api.bind("change",this._handleAllSettingsChange.bind(this)),this.undo=this.undo.bind(this),this.redo=this.redo.bind(this),this.save=this.save.bind(this)}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}getWidgets(){return this.history[this.historyIndex]}_emit(...e){for(const t of this.subscribers)t(...e)}_getWidgetIds(){return this.setting.get()}_pushHistory(){this.history=[...this.history.slice(0,this.historyIndex+1),this._getWidgetIds().map((e=>this.getWidget(e)))],this.historyIndex+=1,this.historySubscribers.forEach((e=>e()))}_replaceHistory(){this.history[this.historyIndex]=this._getWidgetIds().map((e=>this.getWidget(e)))}_handleSettingChange(){if(this.locked)return;const e=this.getWidgets();this._pushHistory(),this._emit(e,this.getWidgets())}_handleAllSettingsChange(e){if(this.locked)return;if(!e.id.startsWith("widget_"))return;const t=ve(e.id);if(!this.setting.get().includes(t))return;const r=this.getWidgets();this._pushHistory(),this._emit(r,this.getWidgets())}_createWidget(e){const t=Ue.customize.Widgets.availableWidgets.findWhere({id_base:e.idBase});let r=e.number;t.get("is_multi")&&!r&&(t.set("multi_number",t.get("multi_number")+1),r=t.get("multi_number"));const n=r?`widget_${e.idBase}[${r}]`:`widget_${e.idBase}`,i={transport:Ue.customize.Widgets.data.selectiveRefreshableWidgets[t.get("id_base")]?"postMessage":"refresh",previewer:this.setting.previewer};this.api.create(n,n,"",i).set(e.instance);return ve(n)}_removeWidget(e){const t=je(e.id),r=this.api(t);if(r){const e=r.get();this.widgetsCache.delete(e)}this.api.remove(t)}_updateWidget(e){const t=this.getWidget(e.id);if(t===e)return e.id;if(t.idBase&&e.idBase&&t.idBase===e.idBase){const t=je(e.id);return this.api(t).set(e.instance),e.id}return this._removeWidget(e),this._createWidget(e)}getWidget(e){if(!e)return null;const{idBase:t,number:r}=$e(e),n=je(e),i=this.api(n);if(!i)return null;const s=i.get();if(this.widgetsCache.has(s))return this.widgetsCache.get(s);const o={id:e,idBase:t,number:r,instance:s};return this.widgetsCache.set(s,o),o}_updateWidgets(e){this.locked=!0;const t=[],r=e.map((e=>{if(e.id&&this.getWidget(e.id))return t.push(null),this._updateWidget(e);const r=this._createWidget(e);return t.push(r),r}));return this.getWidgets().filter((e=>!r.includes(e.id))).forEach((e=>this._removeWidget(e))),this.setting.set(r),this.locked=!1,t}setWidgets(e){const t=this._updateWidgets(e);return this._debounceSetHistory(),t}hasUndo(){return this.historyIndex>0}hasRedo(){return this.historyIndex<this.history.length-1}_seek(e){const t=this.getWidgets();this.historyIndex=e;const r=this.history[this.historyIndex];this._updateWidgets(r),this._emit(t,this.getWidgets()),this.historySubscribers.forEach((e=>e())),this._debounceSetHistory.cancel()}undo(){this.hasUndo()&&this._seek(this.historyIndex-1)}redo(){this.hasRedo()&&this._seek(this.historyIndex+1)}subscribeHistory(e){return this.historySubscribers.add(e),()=>{this.historySubscribers.delete(e)}}save(){this.api.previewer.save()}}var qe=window.wp.dom;const Ke=e=>`widgets-inserter-${e}`;function Ze(){const{wp:{customize:e}}=window;return class extends e.Control{constructor(...e){super(...e),this.subscribers=new Set}ready(){const t=function(){const{wp:{customize:e}}=window,t=e.OuterSection;return e.OuterSection=class extends t{onChangeExpanded(t,r){return t&&e.section.each((e=>{"outer"===e.params.type&&e.id!==this.id&&e.expanded()&&e.collapse()})),super.onChangeExpanded(t,r)}},e.sectionConstructor.outer=e.OuterSection,class extends e.OuterSection{constructor(...e){super(...e),this.params.type="outer",this.activeElementBeforeExpanded=null,this.contentContainer[0].ownerDocument.defaultView.addEventListener("keydown",(e=>{!this.expanded()||e.keyCode!==C.ESCAPE&&"Escape"!==e.code||e.defaultPrevented||(e.preventDefault(),e.stopPropagation(),(0,d.dispatch)(P).setIsInserterOpened(!1))}),!0),this.contentContainer.addClass("widgets-inserter"),this.isFromInternalAction=!1,this.expanded.bind((()=>{this.isFromInternalAction||(0,d.dispatch)(P).setIsInserterOpened(this.expanded()),this.isFromInternalAction=!1}))}open(){if(!this.expanded()){const e=this.contentContainer[0];this.activeElementBeforeExpanded=e.ownerDocument.activeElement,this.isFromInternalAction=!0,this.expand({completeCallback(){const t=qe.focus.tabbable.find(e)[1];t&&t.focus()}})}}close(){if(this.expanded()){const e=this.contentContainer[0],t=e.ownerDocument.activeElement;this.isFromInternalAction=!0,this.collapse({completeCallback(){e.contains(t)&&this.activeElementBeforeExpanded&&this.activeElementBeforeExpanded.focus()}})}}}}();this.inserter=new t(Ke(this.id),{}),e.section.add(this.inserter),this.sectionInstance=e.section(this.section()),this.inspector=this.sectionInstance.inspector,this.sidebarAdapter=new Ye(this.setting,e)}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}onChangeSectionExpanded(e,t){t.unchanged||(e||(0,d.dispatch)(P).setIsInserterOpened(!1),this.subscribers.forEach((r=>r(e,t))))}}}const Je=(0,g.createHigherOrderComponent)((e=>t=>{let r=(0,c.getWidgetIdFromBlock)(t);const n=function(){const{sidebarControls:e}=(0,o.useContext)(De);return e}(),i=function(){const{activeSidebarControl:e}=(0,o.useContext)(De);return e}(),s=n?.length>1,a=t.name,l=t.clientId,u=(0,d.useSelect)((e=>e(p.store).canInsertBlockType(a,"")),[a]),m=(0,d.useSelect)((e=>e(p.store).getBlock(l)),[l]),{removeBlock:h}=(0,d.useDispatch)(p.store),[,g]=Ie();return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(e,{...t}),s&&u&&(0,o.createElement)(p.BlockControls,null,(0,o.createElement)(c.MoveToWidgetArea,{widgetAreas:n.map((e=>({id:e.id,name:e.params.label,description:e.params.description}))),currentWidgetAreaId:i?.id,onSelect:function(e){const t=n.find((t=>t.id===e));if(r){const e=i.setting,n=t.setting;e(e().filter((e=>e!==r))),n([...n(),r])}else{const e=t.sidebarAdapter;h(l);const n=e.setWidgets([...e.getWidgets(),Ee(m)]);r=n.reverse().find((e=>!!e))}g(r)}})))}),"withMoveToSidebarToolbarItem");(0,f.addFilter)("editor.BlockEdit","core/customize-widgets/block-edit",Je);(0,f.addFilter)("editor.MediaUpload","core/edit-widgets/replace-media-upload",(()=>y.MediaUpload));const{wp:Qe}=window,Xe=(0,g.createHigherOrderComponent)((e=>t=>{var r;const{idBase:n}=t.attributes,i=null!==(r=Qe.customize.Widgets.data.availableWidgets.find((e=>e.id_base===n))?.is_wide)&&void 0!==r&&r;return(0,o.createElement)(e,{...t,isWide:i})}),"withWideWidgetDisplay");(0,f.addFilter)("editor.BlockEdit","core/customize-widgets/wide-widget-display",Xe);const{wp:et}=window,tt=["core/more","core/block","core/freeform","core/template-part"];function rt(e,t){(0,d.dispatch)(u.store).setDefaults("core/customize-widgets",{fixedToolbar:!1,welcomeGuide:!0}),(0,d.dispatch)(l.store).reapplyBlockTypeFilters();const r=(0,a.__experimentalGetCoreBlocks)().filter((e=>!(tt.includes(e.name)||e.name.startsWith("core/post")||e.name.startsWith("core/query")||e.name.startsWith("core/site")||e.name.startsWith("core/navigation"))));(0,a.registerCoreBlocks)(r),(0,c.registerLegacyWidgetBlock)(),(0,c.registerLegacyWidgetVariations)(t),(0,c.registerWidgetGroupBlock)(),(0,l.setFreeformContentHandlerName)("core/html");const n=Ze();et.customize.sectionConstructor.sidebar=Ge(),et.customize.controlConstructor.sidebar_block_editor=n;const i=document.createElement("div");document.body.appendChild(i),et.customize.bind("ready",(()=>{const e=[];et.customize.control.each((t=>{t instanceof n&&e.push(t)})),(0,o.createRoot)(i).render((0,o.createElement)(Ve,{api:et.customize,sidebarControls:e,blockEditorSettings:t}))}))}}(),(window.wp=window.wp||{}).customizeWidgets=n}();