summaryrefslogtreecommitdiffstats
path: root/wp-includes/js/dist/edit-widgets.min.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:57:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:57:30 +0000
commitfa9a33d818470a5796f0ff8797f98b510ed8de18 (patch)
treebde6a1eede376f9b5df5898ce812330152984d8e /wp-includes/js/dist/edit-widgets.min.js
parentReleasing progress-linux version 6.4.3+dfsg1-1~progress7.99u1. (diff)
downloadwordpress-fa9a33d818470a5796f0ff8797f98b510ed8de18.tar.xz
wordpress-fa9a33d818470a5796f0ff8797f98b510ed8de18.zip
Merging upstream version 6.5+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wp-includes/js/dist/edit-widgets.min.js')
-rw-r--r--wp-includes/js/dist/edit-widgets.min.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/wp-includes/js/dist/edit-widgets.min.js b/wp-includes/js/dist/edit-widgets.min.js
index 4fa1517..12c636c 100644
--- a/wp-includes/js/dist/edit-widgets.min.js
+++ b/wp-includes/js/dist/edit-widgets.min.js
@@ -1,7 +1,7 @@
/*! This file is auto-generated */
-!function(){var e={4403:function(e,t){var r;
+(()=>{var e={5755:(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 a(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var o=a.apply(null,r);o&&e.push(o)}}else if("object"===i){if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]")){e.push(r.toString());continue}for(var s in r)n.call(r,s)&&r[s]&&e.push(s)}}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(r=function(){return a}.apply(t,[]))||(e.exports=r)}()}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.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 fr},initializeEditor:function(){return wr},reinitializeEditor:function(){return Er},store:function(){return Je}});var e={};r.r(e),r.d(e,{closeModal:function(){return F},disableComplementaryArea:function(){return L},enableComplementaryArea:function(){return W},openModal:function(){return D},pinItem:function(){return P},setDefaultComplementaryArea:function(){return T},setFeatureDefaults:function(){return V},setFeatureValue:function(){return M},toggleFeature:function(){return R},unpinItem:function(){return O}});var t={};r.r(t),r.d(t,{getActiveComplementaryArea:function(){return G},isComplementaryAreaLoading:function(){return z},isFeatureActive:function(){return U},isItemPinned:function(){return H},isModalActive:function(){return $}});var a={};r.r(a),r.d(a,{closeGeneralSidebar:function(){return Le},moveBlockToWidgetArea:function(){return Pe},persistStubPost:function(){return ke},saveEditedWidgetAreas:function(){return Se},saveWidgetArea:function(){return Ie},saveWidgetAreas:function(){return Ae},setIsInserterOpened:function(){return Te},setIsListViewOpened:function(){return We},setIsWidgetAreaOpen:function(){return xe},setWidgetAreasOpenState:function(){return Be},setWidgetIdForClientId:function(){return Ne}});var i={};r.r(i),r.d(i,{getWidgetAreas:function(){return Oe},getWidgets:function(){return Re}});var o={};r.r(o),r.d(o,{__experimentalGetInsertionPoint:function(){return Ke},canInsertBlockInWidgetArea:function(){return Ze},getEditedWidgetAreas:function(){return He},getIsWidgetAreaOpen:function(){return je},getParentWidgetAreaBlock:function(){return ze},getReferenceWidgetBlocks:function(){return Ue},getWidget:function(){return De},getWidgetAreaForWidgetId:function(){return Ge},getWidgetAreas:function(){return Fe},getWidgets:function(){return Ve},isInserterOpened:function(){return Ye},isListViewOpened:function(){return qe},isSavingWidgetAreas:function(){return $e}});var s={};r.r(s),r.d(s,{metadata:function(){return it},name:function(){return ot},settings:function(){return st}});var c=window.wp.element,l=window.wp.blocks,d=window.wp.data,u=window.wp.deprecated,m=r.n(u),g=window.wp.blockLibrary,p=window.wp.coreData,h=window.wp.widgets,_=window.wp.preferences,w=window.wp.apiFetch,f=r.n(w);var E=(0,d.combineReducers)({blockInserterPanel:function(e=!1,t){switch(t.type){case"SET_IS_LIST_VIEW_OPENED":return!t.isOpen&&e;case"SET_IS_INSERTER_OPENED":return t.value}return e},listViewPanel:function(e=!1,t){switch(t.type){case"SET_IS_INSERTER_OPENED":return!t.value&&e;case"SET_IS_LIST_VIEW_OPENED":return t.isOpen}return e},widgetAreasOpenState:function(e={},t){const{type:r}=t;switch(r){case"SET_WIDGET_AREAS_OPEN_STATE":return t.widgetAreasOpenState;case"SET_IS_WIDGET_AREA_OPEN":{const{clientId:r,isOpen:n}=t;return{...e,[r]:n}}default:return e}}}),b=window.wp.i18n,v=window.wp.notices,y=r(4403),k=r.n(y),S=window.wp.components,A=window.wp.primitives;var I=(0,c.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"}));var C=(0,c.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.Path,{d:"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"}));var N=(0,c.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.Path,{fillRule:"evenodd",d:"M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",clipRule:"evenodd"})),B=window.wp.viewport;var x=(0,c.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.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"}));const T=(e,t)=>({type:"SET_DEFAULT_COMPLEMENTARY_AREA",scope:e,area:t}),W=(e,t)=>({registry:r,dispatch:n})=>{if(!t)return;r.select(_.store).get(e,"isComplementaryAreaVisible")||r.dispatch(_.store).set(e,"isComplementaryAreaVisible",!0),n({type:"ENABLE_COMPLEMENTARY_AREA",scope:e,area:t})},L=e=>({registry:t})=>{t.select(_.store).get(e,"isComplementaryAreaVisible")&&t.dispatch(_.store).set(e,"isComplementaryAreaVisible",!1)},P=(e,t)=>({registry:r})=>{if(!t)return;const n=r.select(_.store).get(e,"pinnedItems");!0!==n?.[t]&&r.dispatch(_.store).set(e,"pinnedItems",{...n,[t]:!0})},O=(e,t)=>({registry:r})=>{if(!t)return;const n=r.select(_.store).get(e,"pinnedItems");r.dispatch(_.store).set(e,"pinnedItems",{...n,[t]:!1})};function R(e,t){return function({registry:r}){m()("dispatch( 'core/interface' ).toggleFeature",{since:"6.0",alternative:"dispatch( 'core/preferences' ).toggle"}),r.dispatch(_.store).toggle(e,t)}}function M(e,t,r){return function({registry:n}){m()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),n.dispatch(_.store).set(e,t,!!r)}}function V(e,t){return function({registry:r}){m()("dispatch( 'core/interface' ).setFeatureDefaults",{since:"6.0",alternative:"dispatch( 'core/preferences' ).setDefaults"}),r.dispatch(_.store).setDefaults(e,t)}}function D(e){return{type:"OPEN_MODAL",name:e}}function F(){return{type:"CLOSE_MODAL"}}const G=(0,d.createRegistrySelector)((e=>(t,r)=>{const n=e(_.store).get(r,"isComplementaryAreaVisible");if(void 0!==n)return!1===n?null:t?.complementaryAreas?.[r]})),z=(0,d.createRegistrySelector)((e=>(t,r)=>{const n=e(_.store).get(r,"isComplementaryAreaVisible"),a=t?.complementaryAreas?.[r];return n&&void 0===a})),H=(0,d.createRegistrySelector)((e=>(t,r,n)=>{var a;const i=e(_.store).get(r,"pinnedItems");return null===(a=i?.[n])||void 0===a||a})),U=(0,d.createRegistrySelector)((e=>(t,r,n)=>(m()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(_.store).get(r,n))));function $(e,t){return e.activeModal===t}var j=(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 Y=(0,d.createReduxStore)("core/interface",{reducer:j,actions:e,selectors:t});(0,d.register)(Y);var K=window.wp.plugins,Z=(0,K.withPluginContext)(((e,t)=>({icon:t.icon||e.icon,identifier:t.identifier||`${e.name}/${t.name}`})));var q=Z((function({as:e=S.Button,scope:t,identifier:r,icon:n,selectedIcon:a,name:i,...o}){const s=e,l=(0,d.useSelect)((e=>e(Y).getActiveComplementaryArea(t)===r),[r,t]),{enableComplementaryArea:u,disableComplementaryArea:m}=(0,d.useDispatch)(Y);return(0,c.createElement)(s,{icon:a&&l?a:n,"aria-controls":r.replace("/",":"),onClick:()=>{l?m(t):u(t,r)},...o})}));var Q=({smallScreenTitle:e,children:t,className:r,toggleButtonProps:n})=>{const a=(0,c.createElement)(q,{icon:x,...n});return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"components-panel__header interface-complementary-area-header__small"},e&&(0,c.createElement)("span",{className:"interface-complementary-area-header__small-title"},e),a),(0,c.createElement)("div",{className:k()("components-panel__header","interface-complementary-area-header",r),tabIndex:-1},t,a))};const J=()=>{};function X({name:e,as:t=S.Button,onClick:r,...n}){return(0,c.createElement)(S.Fill,{name:e},(({onClick:e})=>(0,c.createElement)(t,{onClick:r||e?(...t)=>{(r||J)(...t),(e||J)(...t)}:void 0,...n})))}X.Slot=function({name:e,as:t=S.ButtonGroup,fillProps:r={},bubblesVirtually:n,...a}){return(0,c.createElement)(S.Slot,{name:e,bubblesVirtually:n,fillProps:r},(e=>{if(!c.Children.toArray(e).length)return null;const r=[];c.Children.forEach(e,(({props:{__unstableExplicitMenuItem:e,__unstableTarget:t}})=>{t&&e&&r.push(t)}));const n=c.Children.map(e,(e=>!e.props.__unstableExplicitMenuItem&&r.includes(e.props.__unstableTarget)?null:e));return(0,c.createElement)(t,{...a},n)}))};var ee=X;const te=({__unstableExplicitMenuItem:e,__unstableTarget:t,...r})=>(0,c.createElement)(S.MenuItem,{...r});function re({scope:e,target:t,__unstableExplicitMenuItem:r,...n}){return(0,c.createElement)(q,{as:n=>(0,c.createElement)(ee,{__unstableExplicitMenuItem:r,__unstableTarget:`${e}/${t}`,as:te,name:`${e}/plugin-more-menu`,...n}),role:"menuitemcheckbox",selectedIcon:I,name:t,scope:e,...n})}function ne({scope:e,...t}){return(0,c.createElement)(S.Fill,{name:`PinnedItems/${e}`,...t})}ne.Slot=function({scope:e,className:t,...r}){return(0,c.createElement)(S.Slot,{name:`PinnedItems/${e}`,...r},(e=>e?.length>0&&(0,c.createElement)("div",{className:k()(t,"interface-pinned-items")},e)))};var ae=ne;function ie({scope:e,children:t,className:r,id:n}){return(0,c.createElement)(S.Fill,{name:`ComplementaryArea/${e}`},(0,c.createElement)("div",{id:n,className:r},t))}const oe=Z((function({children:e,className:t,closeLabel:r=(0,b.__)("Close plugin"),identifier:n,header:a,headerClassName:i,icon:o,isPinnable:s=!0,panelClassName:l,scope:u,name:m,smallScreenTitle:g,title:p,toggleShortcut:h,isActiveByDefault:_,showIconLabels:w=!1}){const{isLoading:f,isActive:E,isPinned:v,activeArea:y,isSmall:A,isLarge:x}=(0,d.useSelect)((e=>{const{getActiveComplementaryArea:t,isComplementaryAreaLoading:r,isItemPinned:a}=e(Y),i=t(u);return{isLoading:r(u),isActive:i===n,isPinned:a(u,n),activeArea:i,isSmall:e(B.store).isViewportMatch("< medium"),isLarge:e(B.store).isViewportMatch("large")}}),[n,u]);!function(e,t,r,n,a){const i=(0,c.useRef)(!1),o=(0,c.useRef)(!1),{enableComplementaryArea:s,disableComplementaryArea:l}=(0,d.useDispatch)(Y);(0,c.useEffect)((()=>{n&&a&&!i.current?(l(e),o.current=!0):o.current&&!a&&i.current?(o.current=!1,s(e,t)):o.current&&r&&r!==t&&(o.current=!1),a!==i.current&&(i.current=a)}),[n,a,e,t,r,l,s])}(u,n,y,E,A);const{enableComplementaryArea:T,disableComplementaryArea:W,pinItem:L,unpinItem:P}=(0,d.useDispatch)(Y);return(0,c.useEffect)((()=>{_&&void 0===y&&!A?T(u,n):void 0===y&&A&&W(u,n)}),[y,_,u,n,A,T,W]),(0,c.createElement)(c.Fragment,null,s&&(0,c.createElement)(ae,{scope:u},v&&(0,c.createElement)(q,{scope:u,identifier:n,isPressed:E&&(!w||x),"aria-expanded":E,"aria-disabled":f,label:p,icon:w?I:o,showTooltip:!w,variant:w?"tertiary":void 0})),m&&s&&(0,c.createElement)(re,{target:m,scope:u,icon:o},p),E&&(0,c.createElement)(ie,{className:k()("interface-complementary-area",t),scope:u,id:n.replace("/",":")},(0,c.createElement)(Q,{className:i,closeLabel:r,onClose:()=>W(u),smallScreenTitle:g,toggleButtonProps:{label:r,shortcut:h,scope:u,identifier:n}},a||(0,c.createElement)(c.Fragment,null,(0,c.createElement)("strong",null,p),s&&(0,c.createElement)(S.Button,{className:"interface-complementary-area__pin-unpin-item",icon:v?C:N,label:v?(0,b.__)("Unpin from toolbar"):(0,b.__)("Pin to toolbar"),onClick:()=>(v?P:L)(u,n),isPressed:v,"aria-expanded":v}))),(0,c.createElement)(S.Panel,{className:l},e)))}));oe.Slot=function({scope:e,...t}){return(0,c.createElement)(S.Slot,{name:`ComplementaryArea/${e}`,...t})};var se=oe,ce=window.wp.compose;function le({children:e,className:t,ariaLabel:r,as:n="div",...a}){return(0,c.createElement)(n,{className:k()("interface-navigable-region",t),"aria-label":r,role:"region",tabIndex:"-1",...a},e)}const de={hidden:{opacity:0},hover:{opacity:1,transition:{type:"tween",delay:.2,delayChildren:.2}},distractionFreeInactive:{opacity:1,transition:{delay:0}}};var ue=(0,c.forwardRef)((function({isDistractionFree:e,footer:t,header:r,editorNotices:n,sidebar:a,secondarySidebar:i,notices:o,content:s,contentProps:l,actions:d,labels:u,className:m,enableRegionNavigation:g=!0,shortcuts:p},h){const _=(0,S.__unstableUseNavigateRegions)(p);!function(e){(0,c.useEffect)((()=>{const t=document&&document.querySelector(`html:not(.${e})`);if(t)return t.classList.toggle(e),()=>{t.classList.toggle(e)}}),[e])}("interface-interface-skeleton__html-container");const w={...{header:(0,b.__)("Header"),body:(0,b.__)("Content"),secondarySidebar:(0,b.__)("Block Library"),sidebar:(0,b.__)("Settings"),actions:(0,b.__)("Publish"),footer:(0,b.__)("Footer")},...u};return(0,c.createElement)("div",{...g?_:{},ref:(0,ce.useMergeRefs)([h,g?_.ref:void 0]),className:k()(m,"interface-interface-skeleton",_.className,!!t&&"has-footer")},(0,c.createElement)("div",{className:"interface-interface-skeleton__editor"},!!r&&(0,c.createElement)(le,{as:S.__unstableMotion.div,className:"interface-interface-skeleton__header","aria-label":w.header,initial:e?"hidden":"distractionFreeInactive",whileHover:e?"hover":"distractionFreeInactive",animate:e?"hidden":"distractionFreeInactive",variants:de,transition:e?{type:"tween",delay:.8}:void 0},r),e&&(0,c.createElement)("div",{className:"interface-interface-skeleton__header"},n),(0,c.createElement)("div",{className:"interface-interface-skeleton__body"},!!i&&(0,c.createElement)(le,{className:"interface-interface-skeleton__secondary-sidebar",ariaLabel:w.secondarySidebar},i),!!o&&(0,c.createElement)("div",{className:"interface-interface-skeleton__notices"},o),(0,c.createElement)(le,{className:"interface-interface-skeleton__content",ariaLabel:w.body,...l},s),!!a&&(0,c.createElement)(le,{className:"interface-interface-skeleton__sidebar",ariaLabel:w.sidebar},a),!!d&&(0,c.createElement)(le,{className:"interface-interface-skeleton__actions",ariaLabel:w.actions},d))),!!t&&(0,c.createElement)(le,{className:"interface-interface-skeleton__footer",ariaLabel:w.footer},t))}));var me=(0,c.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"}));function ge({as:e=S.DropdownMenu,className:t,label:r=(0,b.__)("Options"),popoverProps:n,toggleProps:a,children:i}){return(0,c.createElement)(e,{className:k()("interface-more-menu-dropdown",t),icon:me,label:r,popoverProps:{placement:"bottom-end",...n,className:k()("interface-more-menu-dropdown__content",n?.className)},toggleProps:{tooltipPosition:"bottom",...a}},(e=>i(e)))}var pe=window.wp.blockEditor;function he(e){if("block"===e.id_base){const t=(0,l.parse)(e.instance.raw.content,{__unstableSkipAutop:!0});return t.length?(0,h.addWidgetIdToBlock)(t[0],e.id):(0,h.addWidgetIdToBlock)((0,l.createBlock)("core/paragraph",{},[]),e.id)}let t;return t=e._embedded.about[0].is_multi?{idBase:e.id_base,instance:e.instance}:{id:e.id},(0,h.addWidgetIdToBlock)((0,l.createBlock)("core/legacy-widget",t,[]),e.id)}function _e(e,t={}){let r;var n,a,i;"core/legacy-widget"===e.name&&(e.attributes.id||e.attributes.instance)?r={...t,id:null!==(n=e.attributes.id)&&void 0!==n?n:t.id,id_base:null!==(a=e.attributes.idBase)&&void 0!==a?a:t.id_base,instance:null!==(i=e.attributes.instance)&&void 0!==i?i:t.instance}:r={...t,id_base:"block",instance:{raw:{content:(0,l.serialize)(e)}}};return delete r.rendered,delete r.rendered_form,r}const we="root",fe="sidebar",Ee="postType",be=e=>`widget-area-${e}`,ve=()=>"widget-areas";const ye="core/edit-widgets",ke=(e,t)=>({registry:r})=>{const n=((e,t)=>({id:e,slug:e,status:"draft",type:"page",blocks:t,meta:{widgetAreaId:e}}))(e,t);return r.dispatch(p.store).receiveEntityRecords(we,Ee,n,{id:n.id},!1),n},Se=()=>async({select:e,dispatch:t,registry:r})=>{const n=e.getEditedWidgetAreas();if(n?.length)try{await t.saveWidgetAreas(n),r.dispatch(v.store).createSuccessNotice((0,b.__)("Widgets saved."),{type:"snackbar"})}catch(e){r.dispatch(v.store).createErrorNotice((0,b.sprintf)((0,b.__)("There was an error. %s"),e.message),{type:"snackbar"})}},Ae=e=>async({dispatch:t,registry:r})=>{try{for(const r of e)await t.saveWidgetArea(r.id)}finally{await r.dispatch(p.store).finishResolution("getEntityRecord",we,fe,{per_page:-1})}},Ie=e=>async({dispatch:t,select:r,registry:n})=>{const a=r.getWidgets(),i=n.select(p.store).getEditedEntityRecord(we,Ee,be(e)),o=Object.values(a).filter((({sidebar:t})=>t===e)),s=[],c=i.blocks.filter((e=>{const{id:t}=e.attributes;if("core/legacy-widget"===e.name&&t){if(s.includes(t))return!1;s.push(t)}return!0})),l=[];for(const e of o){r.getWidgetAreaForWidgetId(e.id)||l.push(e)}const d=[],u=[],m=[];for(let t=0;t<c.length;t++){const r=c[t],i=(0,h.getWidgetIdFromBlock)(r),o=a[i],s=_e(r,o);if(m.push(i),o){n.dispatch(p.store).editEntityRecord("root","widget",i,{...s,sidebar:e},{undoIgnore:!0});if(!n.select(p.store).hasEditsForEntityRecord("root","widget",i))continue;u.push((({saveEditedEntityRecord:e})=>e("root","widget",i)))}else u.push((({saveEntityRecord:t})=>t("root","widget",{...s,sidebar:e})));d.push({block:r,position:t,clientId:r.clientId})}for(const e of l)u.push((({deleteEntityRecord:t})=>t("root","widget",e.id,{force:!0})));const g=(await n.dispatch(p.store).__experimentalBatch(u)).filter((e=>!e.hasOwnProperty("deleted"))),_=[];for(let e=0;e<g.length;e++){const t=g[e],{block:r,position:a}=d[e];i.blocks[a].attributes.__internalWidgetId=t.id;n.select(p.store).getLastEntitySaveError("root","widget",t.id)&&_.push(r.attributes?.name||r?.name),m[a]||(m[a]=t.id)}if(_.length)throw new Error((0,b.sprintf)((0,b.__)("Could not save the following widgets: %s."),_.join(", ")));n.dispatch(p.store).editEntityRecord(we,fe,e,{widgets:m},{undoIgnore:!0}),t(Ce(e)),n.dispatch(p.store).receiveEntityRecords(we,Ee,i,void 0)},Ce=e=>({registry:t})=>{t.dispatch(p.store).saveEditedEntityRecord(we,fe,e,{throwOnError:!0})};function Ne(e,t){return{type:"SET_WIDGET_ID_FOR_CLIENT_ID",clientId:e,widgetId:t}}function Be(e){return{type:"SET_WIDGET_AREAS_OPEN_STATE",widgetAreasOpenState:e}}function xe(e,t){return{type:"SET_IS_WIDGET_AREA_OPEN",clientId:e,isOpen:t}}function Te(e){return{type:"SET_IS_INSERTER_OPENED",value:e}}function We(e){return{type:"SET_IS_LIST_VIEW_OPENED",isOpen:e}}const Le=()=>({registry:e})=>{e.dispatch(Y).disableComplementaryArea(ye)},Pe=(e,t)=>async({dispatch:r,select:n,registry:a})=>{const i=a.select(pe.store).getBlockRootClientId(e),o=a.select(pe.store).getBlocks().find((({attributes:e})=>e.id===t)).clientId,s=a.select(pe.store).getBlockOrder(o).length;n.getIsWidgetAreaOpen(o)||r.setIsWidgetAreaOpen(o,!0),a.dispatch(pe.store).moveBlocksToPosition([e],i,o,s)},Oe=()=>async({dispatch:e,registry:t})=>{const r={per_page:-1},n=[],a=(await t.resolveSelect(p.store).getEntityRecords(we,fe,r)).sort(((e,t)=>"wp_inactive_widgets"===e.id?1:"wp_inactive_widgets"===t.id?-1:0));for(const t of a)n.push((0,l.createBlock)("core/widget-area",{id:t.id,name:t.name})),t.widgets.length||e(ke(be(t.id),[]));const i={};n.forEach(((e,t)=>{i[e.clientId]=0===t})),e(Be(i)),e(ke(ve(),n))},Re=()=>async({dispatch:e,registry:t})=>{const r={per_page:-1,_embed:"about"},n=await t.resolveSelect(p.store).getEntityRecords("root","widget",r),a={};for(const e of n){const t=he(e);a[e.sidebar]=a[e.sidebar]||[],a[e.sidebar].push(t)}for(const t in a)a.hasOwnProperty(t)&&e(ke(be(t),a[t]))},Me={rootClientId:void 0,insertionIndex:void 0},Ve=(0,d.createRegistrySelector)((e=>()=>{const t=e(p.store).getEntityRecords("root","widget",{per_page:-1,_embed:"about"});return t?.reduce(((e,t)=>({...e,[t.id]:t})),{})||{}})),De=(0,d.createRegistrySelector)((e=>(t,r)=>e(ye).getWidgets()[r])),Fe=(0,d.createRegistrySelector)((e=>()=>{const t={per_page:-1};return e(p.store).getEntityRecords(we,fe,t)})),Ge=(0,d.createRegistrySelector)((e=>(t,r)=>e(ye).getWidgetAreas().find((t=>e(p.store).getEditedEntityRecord(we,Ee,be(t.id)).blocks.map((e=>(0,h.getWidgetIdFromBlock)(e))).includes(r))))),ze=(0,d.createRegistrySelector)((e=>(t,r)=>{const{getBlock:n,getBlockName:a,getBlockParents:i}=e(pe.store);return n(i(r).find((e=>"core/widget-area"===a(e))))})),He=(0,d.createRegistrySelector)((e=>(t,r)=>{let n=e(ye).getWidgetAreas();return n?(r&&(n=n.filter((({id:e})=>r.includes(e)))),n.filter((({id:t})=>e(p.store).hasEditsForEntityRecord(we,Ee,be(t)))).map((({id:t})=>e(p.store).getEditedEntityRecord(we,fe,t)))):[]})),Ue=(0,d.createRegistrySelector)((e=>(t,r=null)=>{const n=[],a=e(ye).getWidgetAreas();for(const t of a){const a=e(p.store).getEditedEntityRecord(we,Ee,be(t.id));for(const e of a.blocks)"core/legacy-widget"!==e.name||r&&e.attributes?.referenceWidgetName!==r||n.push(e)}return n})),$e=(0,d.createRegistrySelector)((e=>()=>{const t=e(ye).getWidgetAreas()?.map((({id:e})=>e));if(!t)return!1;for(const r of t){if(e(p.store).isSavingEntityRecord(we,fe,r))return!0}const r=[...Object.keys(e(ye).getWidgets()),void 0];for(const t of r){if(e(p.store).isSavingEntityRecord("root","widget",t))return!0}return!1})),je=(e,t)=>{const{widgetAreasOpenState:r}=e;return!!r[t]};function Ye(e){return!!e.blockInserterPanel}function Ke(e){return"boolean"==typeof e.blockInserterPanel?Me:e.blockInserterPanel}const Ze=(0,d.createRegistrySelector)((e=>(t,r)=>{const n=e(pe.store).getBlocks(),[a]=n;return e(pe.store).canInsertBlockType(r,a.clientId)}));function qe(e){return e.listViewPanel}const Qe={reducer:E,selectors:o,resolvers:i,actions:a},Je=(0,d.createReduxStore)(ye,Qe);(0,d.register)(Je),f().use((function(e,t){return 0===e.path?.indexOf("/wp/v2/types/widget-area")?Promise.resolve({}):t(e)}));var Xe=window.wp.hooks;const et=(0,ce.createHigherOrderComponent)((e=>t=>{const{clientId:r,name:n}=t,{widgetAreas:a,currentWidgetAreaId:i,canInsertBlockInWidgetArea:o}=(0,d.useSelect)((e=>{if("core/widget-area"===n)return{};const t=e(Je),a=t.getParentWidgetAreaBlock(r);return{widgetAreas:t.getWidgetAreas(),currentWidgetAreaId:a?.attributes?.id,canInsertBlockInWidgetArea:t.canInsertBlockInWidgetArea(n)}}),[r,n]),{moveBlockToWidgetArea:s}=(0,d.useDispatch)(Je),l="core/widget-area"!==n&&a?.length>1&&o;return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(e,{...t}),l&&(0,c.createElement)(pe.BlockControls,null,(0,c.createElement)(h.MoveToWidgetArea,{widgetAreas:a,currentWidgetAreaId:i,onSelect:e=>{s(t.clientId,e)}})))}),"withMoveToWidgetAreaToolbarItem");(0,Xe.addFilter)("editor.BlockEdit","core/edit-widgets/block-edit",et);var tt=window.wp.mediaUtils;(0,Xe.addFilter)("editor.MediaUpload","core/edit-widgets/replace-media-upload",(()=>tt.MediaUpload));var rt=e=>{const[t,r]=(0,c.useState)(!1);return(0,c.useEffect)((()=>{const{ownerDocument:t}=e.current;function n(e){i(e)}function a(){r(!1)}function i(t){e.current.contains(t.target)?r(!0):r(!1)}return t.addEventListener("dragstart",n),t.addEventListener("dragend",a),t.addEventListener("dragenter",i),()=>{t.removeEventListener("dragstart",n),t.removeEventListener("dragend",a),t.removeEventListener("dragenter",i)}}),[]),t};function nt({id:e}){const[t,r,n]=(0,p.useEntityBlockEditor)("root","postType"),a=(0,c.useRef)(),i=rt(a),o=(0,pe.useInnerBlocksProps)({ref:a},{value:t,onInput:r,onChange:n,templateLock:!1,renderAppender:pe.InnerBlocks.ButtonBlockAppender});return(0,c.createElement)("div",{"data-widget-area-id":e,className:k()("wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper",{"wp-block-widget-area__highlight-drop-zone":i})},(0,c.createElement)("div",{...o}))}const at=e=>{const[t,r]=(0,c.useState)(!1);return(0,c.useEffect)((()=>{const{ownerDocument:t}=e.current;function n(){r(!0)}function a(){r(!1)}return t.addEventListener("dragstart",n),t.addEventListener("dragend",a),()=>{t.removeEventListener("dragstart",n),t.removeEventListener("dragend",a)}}),[]),t},it={name:"core/widget-area",category:"widgets",attributes:{id:{type:"string"},name:{type:"string"}},supports:{html:!1,inserter:!1,customClassName:!1,reusable:!1,__experimentalToolbar:!1,__experimentalParentSelector:!1,__experimentalDisableBlockOverlay:!0},editorStyle:"wp-block-widget-area-editor",style:"wp-block-widget-area"},{name:ot}=it,st={title:(0,b.__)("Widget Area"),description:(0,b.__)("A widget area container."),__experimentalLabel:({name:e})=>e,edit:function({clientId:e,className:t,attributes:{id:r,name:n}}){const a=(0,d.useSelect)((t=>t(Je).getIsWidgetAreaOpen(e)),[e]),{setIsWidgetAreaOpen:i}=(0,d.useDispatch)(Je),o=(0,c.useRef)(),s=(0,c.useCallback)((t=>i(e,t)),[e]),l=at(o),u=rt(o),[m,g]=(0,c.useState)(!1);return(0,c.useEffect)((()=>{l?u&&!a?(s(!0),g(!0)):!u&&a&&m&&s(!1):g(!1)}),[a,l,u,m]),(0,c.createElement)(S.Panel,{className:t,ref:o},(0,c.createElement)(S.PanelBody,{title:n,opened:a,onToggle:()=>{i(e,!a)},scrollAfterOpen:!l},(({opened:e})=>(0,c.createElement)(S.__unstableDisclosureContent,{className:"wp-block-widget-area__panel-body-content",visible:e},(0,c.createElement)(p.EntityProvider,{kind:"root",type:"postType",id:`widget-area-${r}`},(0,c.createElement)(nt,{id:r}))))))}};function ct({text:e,children:t}){const r=(0,ce.useCopyToClipboard)(e);return(0,c.createElement)(S.Button,{variant:"secondary",ref:r},t)}function lt({message:e,error:t}){const r=[(0,c.createElement)(ct,{key:"copy-error",text:t.stack},(0,b.__)("Copy Error"))];return(0,c.createElement)(pe.Warning,{className:"edit-widgets-error-boundary",actions:r},e)}class dt extends c.Component{constructor(){super(...arguments),this.state={error:null}}componentDidCatch(e){(0,Xe.doAction)("editor.ErrorBoundary.errorLogged",e)}static getDerivedStateFromError(e){return{error:e}}render(){return this.state.error?(0,c.createElement)(lt,{message:(0,b.__)("The editor has encountered an unexpected error."),error:this.state.error}):this.props.children}}var ut=window.wp.patterns,mt=window.wp.keyboardShortcuts,gt=window.wp.keycodes;function pt(){const{redo:e,undo:t}=(0,d.useDispatch)(p.store),{saveEditedWidgetAreas:r}=(0,d.useDispatch)(Je),{replaceBlocks:n}=(0,d.useDispatch)(pe.store),{getBlockName:a,getSelectedBlockClientId:i,getBlockAttributes:o}=(0,d.useSelect)(pe.store),s=(e,t)=>{e.preventDefault();const r=0===t?"core/paragraph":"core/heading",s=i();if(null===s)return;const c=a(s);if("core/paragraph"!==c&&"core/heading"!==c)return;const d=o(s),u="core/paragraph"===c?"align":"textAlign",m="core/paragraph"===r?"align":"textAlign";n(s,(0,l.createBlock)(r,{level:t,content:d.content,[m]:d[u]}))};return(0,mt.useShortcut)("core/edit-widgets/undo",(e=>{t(),e.preventDefault()})),(0,mt.useShortcut)("core/edit-widgets/redo",(t=>{e(),t.preventDefault()})),(0,mt.useShortcut)("core/edit-widgets/save",(e=>{e.preventDefault(),r()})),(0,mt.useShortcut)("core/edit-widgets/transform-heading-to-paragraph",(e=>s(e,0))),[1,2,3,4,5,6].forEach((e=>{(0,mt.useShortcut)(`core/edit-widgets/transform-paragraph-to-heading-${e}`,(t=>s(t,e)))})),null}pt.Register=function(){const{registerShortcut:e}=(0,d.useDispatch)(mt.store);return(0,c.useEffect)((()=>{e({name:"core/edit-widgets/undo",category:"global",description:(0,b.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/edit-widgets/redo",category:"global",description:(0,b.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"},aliases:(0,gt.isAppleOS)()?[]:[{modifier:"primary",character:"y"}]}),e({name:"core/edit-widgets/save",category:"global",description:(0,b.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),e({name:"core/edit-widgets/keyboard-shortcuts",category:"main",description:(0,b.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}}),e({name:"core/edit-widgets/next-region",category:"global",description:(0,b.__)("Navigate to the next part of the editor."),keyCombination:{modifier:"ctrl",character:"`"},aliases:[{modifier:"access",character:"n"}]}),e({name:"core/edit-widgets/previous-region",category:"global",description:(0,b.__)("Navigate to the previous part of the editor."),keyCombination:{modifier:"ctrlShift",character:"`"},aliases:[{modifier:"access",character:"p"},{modifier:"ctrlShift",character:"~"}]}),e({name:"core/edit-widgets/transform-heading-to-paragraph",category:"block-library",description:(0,b.__)("Transform heading to paragraph."),keyCombination:{modifier:"access",character:"0"}}),[1,2,3,4,5,6].forEach((t=>{e({name:`core/edit-widgets/transform-paragraph-to-heading-${t}`,category:"block-library",description:(0,b.__)("Transform paragraph to heading."),keyCombination:{modifier:"access",character:`${t}`}})}))}),[e]),null};var ht=pt;var _t=()=>(0,d.useSelect)((e=>{const{getBlockSelectionEnd:t,getBlockName:r}=e(pe.store),n=t();if("core/widget-area"===r(n))return n;const{getParentWidgetAreaBlock:a}=e(Je),i=a(n),o=i?.clientId;if(o)return o;const{getEntityRecord:s}=e(p.store),c=s(we,Ee,ve());return c?.blocks[0]?.clientId}),[]);const wt=!1;var ft=window.wp.privateApis;const{lock:Et,unlock:bt}=(0,ft.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.","@wordpress/edit-widgets"),{ExperimentalBlockEditorProvider:vt}=bt(pe.privateApis),{PatternsMenuItems:yt}=bt(ut.privateApis);function kt({blockEditorSettings:e,children:t,...r}){const n=(0,p.useResourcePermissions)("media"),{reusableBlocks:a,isFixedToolbarActive:i,keepCaretInsideBlock:o}=(0,d.useSelect)((e=>({widgetAreas:e(Je).getWidgetAreas(),widgets:e(Je).getWidgets(),reusableBlocks:wt?e(p.store).getEntityRecords("postType","wp_block"):[],isFixedToolbarActive:!!e(_.store).get("core/edit-widgets","fixedToolbar"),keepCaretInsideBlock:!!e(_.store).get("core/edit-widgets","keepCaretInsideBlock")})),[]),{setIsInserterOpened:s}=(0,d.useDispatch)(Je),l=(0,c.useMemo)((()=>{let t;return n.canCreate&&(t=({onError:t,...r})=>{(0,tt.uploadMedia)({wpAllowedMimeTypes:e.allowedMimeTypes,onError:({message:e})=>t(e),...r})}),{...e,__experimentalReusableBlocks:a,hasFixedToolbar:i,keepCaretInsideBlock:o,mediaUpload:t,templateLock:"all",__experimentalSetIsInserterOpened:s}}),[e,i,o,n.canCreate,a,s]),u=_t(),[m,g,h]=(0,p.useEntityBlockEditor)(we,Ee,{id:ve()});return(0,c.createElement)(S.SlotFillProvider,null,(0,c.createElement)(ht.Register,null),(0,c.createElement)(vt,{value:m,onInput:g,onChange:h,settings:l,useSubRegistry:!1,...r},(0,c.createElement)(pe.CopyHandler,null,t),(0,c.createElement)(yt,{rootClientId:u})))}var St=(0,c.createElement)(A.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z"}));var At=(0,c.createElement)(A.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z"}));var It=(0,c.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.Path,{d:"M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"})),Ct=window.wp.url,Nt=window.wp.dom;function Bt({selectedWidgetAreaId:e}){const t=(0,d.useSelect)((e=>e(Je).getWidgetAreas()),[]),r=(0,c.useMemo)((()=>e&&t?.find((t=>t.id===e))),[e,t]);let n;return n=r?"wp_inactive_widgets"===e?(0,b.__)("Blocks in this Widget Area will not be displayed in your site."):r.description:(0,b.__)("Widget Areas are global parts in your site’s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer."),(0,c.createElement)("div",{className:"edit-widgets-widget-areas"},(0,c.createElement)("div",{className:"edit-widgets-widget-areas__top-container"},(0,c.createElement)(pe.BlockIcon,{icon:It}),(0,c.createElement)("div",null,(0,c.createElement)("p",{dangerouslySetInnerHTML:{__html:(0,Nt.safeHTML)(n)}}),0===t?.length&&(0,c.createElement)("p",null,(0,b.__)("Your theme does not contain any Widget Areas.")),!r&&(0,c.createElement)(S.Button,{href:(0,Ct.addQueryArgs)("customize.php",{"autofocus[panel]":"widgets",return:window.location.pathname}),variant:"tertiary"},(0,b.__)("Manage with live preview")))))}const xt=c.Platform.select({web:!0,native:!1}),Tt="edit-widgets/block-inspector",Wt="edit-widgets/block-areas";function Lt({identifier:e,label:t,isActive:r}){const{enableComplementaryArea:n}=(0,d.useDispatch)(Y);return(0,c.createElement)(S.Button,{onClick:()=>n(Je.name,e),className:k()("edit-widgets-sidebar__panel-tab",{"is-active":r}),"aria-label":r?(0,b.sprintf)((0,b.__)("%s (selected)"),t):t,"data-label":t},t)}function Pt(){const{enableComplementaryArea:e}=(0,d.useDispatch)(Y),{currentArea:t,hasSelectedNonAreaBlock:r,isGeneralSidebarOpen:n,selectedWidgetAreaBlock:a}=(0,d.useSelect)((e=>{const{getSelectedBlock:t,getBlock:r,getBlockParentsByBlockName:n}=e(pe.store),{getActiveComplementaryArea:a}=e(Y),i=t(),o=a(Je.name);let s,c=o;return c||(c=i?Tt:Wt),i&&(s="core/widget-area"===i.name?i:r(n(i.clientId,"core/widget-area")[0])),{currentArea:c,hasSelectedNonAreaBlock:!(!i||"core/widget-area"===i.name),isGeneralSidebarOpen:!!o,selectedWidgetAreaBlock:s}}),[]);return(0,c.useEffect)((()=>{r&&t===Wt&&n&&e("core/edit-widgets",Tt),!r&&t===Tt&&n&&e("core/edit-widgets",Wt)}),[r,e]),(0,c.createElement)(se,{className:"edit-widgets-sidebar",header:(0,c.createElement)("ul",null,(0,c.createElement)("li",null,(0,c.createElement)(Lt,{identifier:Wt,label:a?a.attributes.name:(0,b.__)("Widget Areas"),isActive:t===Wt})),(0,c.createElement)("li",null,(0,c.createElement)(Lt,{identifier:Tt,label:(0,b.__)("Block"),isActive:t===Tt}))),headerClassName:"edit-widgets-sidebar__panel-tabs",title:(0,b.__)("Settings"),closeLabel:(0,b.__)("Close Settings"),scope:"core/edit-widgets",identifier:t,icon:(0,b.isRTL)()?St:At,isActiveByDefault:xt},t===Wt&&(0,c.createElement)(Bt,{selectedWidgetAreaId:a?.attributes.id}),t===Tt&&(r?(0,c.createElement)(pe.BlockInspector,null):(0,c.createElement)("span",{className:"block-editor-block-inspector__no-blocks"},(0,b.__)("No block selected."))))}var Ot=(0,c.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.Path,{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"}));var Rt=(0,c.createElement)(A.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,c.createElement)(A.Path,{d:"M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z"}));var Mt=function(){const{hasEditedWidgetAreaIds:e,isSaving:t}=(0,d.useSelect)((e=>{const{getEditedWidgetAreas:t,isSavingWidgetAreas:r}=e(Je);return{hasEditedWidgetAreaIds:t()?.length>0,isSaving:r()}}),[]),{saveEditedWidgetAreas:r}=(0,d.useDispatch)(Je);return(0,c.createElement)(S.Button,{variant:"primary",isBusy:t,"aria-disabled":t,onClick:t?void 0:r,disabled:!e},t?(0,b.__)("Saving…"):(0,b.__)("Update"))};var Vt=(0,c.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.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 Dt=(0,c.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.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"}));function Ft(){const e=(0,d.useSelect)((e=>e(p.store).hasUndo()),[]),{undo:t}=(0,d.useDispatch)(p.store);return(0,c.createElement)(S.ToolbarButton,{icon:(0,b.isRTL)()?Dt:Vt,label:(0,b.__)("Undo"),shortcut:gt.displayShortcut.primary("z"),"aria-disabled":!e,onClick:e?t:void 0})}function Gt(){const e=(0,gt.isAppleOS)()?gt.displayShortcut.primaryShift("z"):gt.displayShortcut.primary("y"),t=(0,d.useSelect)((e=>e(p.store).hasRedo()),[]),{redo:r}=(0,d.useDispatch)(p.store);return(0,c.createElement)(S.ToolbarButton,{icon:(0,b.isRTL)()?Vt:Dt,label:(0,b.__)("Redo"),shortcut:e,"aria-disabled":!t,onClick:t?r:void 0})}var zt=(0,c.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.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"}));const Ht=[{keyCombination:{modifier:"primary",character:"b"},description:(0,b.__)("Make the selected text bold.")},{keyCombination:{modifier:"primary",character:"i"},description:(0,b.__)("Make the selected text italic.")},{keyCombination:{modifier:"primary",character:"k"},description:(0,b.__)("Convert the selected text into a link.")},{keyCombination:{modifier:"primaryShift",character:"k"},description:(0,b.__)("Remove a link.")},{keyCombination:{character:"[["},description:(0,b.__)("Insert a link to a post or page.")},{keyCombination:{modifier:"primary",character:"u"},description:(0,b.__)("Underline the selected text.")},{keyCombination:{modifier:"access",character:"d"},description:(0,b.__)("Strikethrough the selected text.")},{keyCombination:{modifier:"access",character:"x"},description:(0,b.__)("Make the selected text inline code.")},{keyCombination:{modifier:"access",character:"0"},description:(0,b.__)("Convert the current heading to a paragraph.")},{keyCombination:{modifier:"access",character:"1-6"},description:(0,b.__)("Convert the current paragraph or heading to a heading of level 1 to 6.")}];function Ut({keyCombination:e,forceAriaLabel:t}){const r=e.modifier?gt.displayShortcutList[e.modifier](e.character):e.character,n=e.modifier?gt.shortcutAriaLabel[e.modifier](e.character):e.character,a=Array.isArray(r)?r:[r];return(0,c.createElement)("kbd",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":t||n},a.map(((e,t)=>"+"===e?(0,c.createElement)(c.Fragment,{key:t},e):(0,c.createElement)("kbd",{key:t,className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-key"},e))))}var $t=function({description:e,keyCombination:t,aliases:r=[],ariaLabel:n}){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-description"},e),(0,c.createElement)("div",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-term"},(0,c.createElement)(Ut,{keyCombination:t,forceAriaLabel:n}),r.map(((e,t)=>(0,c.createElement)(Ut,{keyCombination:e,forceAriaLabel:n,key:t})))))};var jt=function({name:e}){const{keyCombination:t,description:r,aliases:n}=(0,d.useSelect)((t=>{const{getShortcutKeyCombination:r,getShortcutDescription:n,getShortcutAliases:a}=t(mt.store);return{keyCombination:r(e),aliases:a(e),description:n(e)}}),[e]);return t?(0,c.createElement)($t,{keyCombination:t,description:r,aliases:n}):null};const Yt=({shortcuts:e})=>(0,c.createElement)("ul",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-list",role:"list"},e.map(((e,t)=>(0,c.createElement)("li",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut",key:t},"string"==typeof e?(0,c.createElement)(jt,{name:e}):(0,c.createElement)($t,{...e}))))),Kt=({title:e,shortcuts:t,className:r})=>(0,c.createElement)("section",{className:k()("edit-widgets-keyboard-shortcut-help-modal__section",r)},!!e&&(0,c.createElement)("h2",{className:"edit-widgets-keyboard-shortcut-help-modal__section-title"},e),(0,c.createElement)(Yt,{shortcuts:t})),Zt=({title:e,categoryName:t,additionalShortcuts:r=[]})=>{const n=(0,d.useSelect)((e=>e(mt.store).getCategoryShortcuts(t)),[t]);return(0,c.createElement)(Kt,{title:e,shortcuts:n.concat(r)})};function qt({isModalActive:e,toggleModal:t}){return(0,mt.useShortcut)("core/edit-widgets/keyboard-shortcuts",t,{bindGlobal:!0}),e?(0,c.createElement)(S.Modal,{className:"edit-widgets-keyboard-shortcut-help-modal",title:(0,b.__)("Keyboard shortcuts"),onRequestClose:t},(0,c.createElement)(Kt,{className:"edit-widgets-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/edit-widgets/keyboard-shortcuts"]}),(0,c.createElement)(Zt,{title:(0,b.__)("Global shortcuts"),categoryName:"global"}),(0,c.createElement)(Zt,{title:(0,b.__)("Selection shortcuts"),categoryName:"selection"}),(0,c.createElement)(Zt,{title:(0,b.__)("Block shortcuts"),categoryName:"block",additionalShortcuts:[{keyCombination:{character:"/"},description:(0,b.__)("Change the block type after adding a new paragraph."),ariaLabel:(0,b.__)("Forward-slash")}]}),(0,c.createElement)(Kt,{title:(0,b.__)("Text formatting"),shortcuts:Ht})):null}const{Fill:Qt,Slot:Jt}=(0,S.createSlotFill)("EditWidgetsToolsMoreMenuGroup");Qt.Slot=({fillProps:e})=>(0,c.createElement)(Jt,{fillProps:e},(e=>e.length>0&&e));var Xt=Qt;function er(){const[e,t]=(0,c.useState)(!1),r=()=>t(!e);(0,mt.useShortcut)("core/edit-widgets/keyboard-shortcuts",r);const n=(0,ce.useViewportMatch)("medium");return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(ge,null,(e=>(0,c.createElement)(c.Fragment,null,n&&(0,c.createElement)(S.MenuGroup,{label:(0,b._x)("View","noun")},(0,c.createElement)(_.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"fixedToolbar",label:(0,b.__)("Top toolbar"),info:(0,b.__)("Access all block and document tools in a single place"),messageActivated:(0,b.__)("Top toolbar activated"),messageDeactivated:(0,b.__)("Top toolbar deactivated")})),(0,c.createElement)(S.MenuGroup,{label:(0,b.__)("Tools")},(0,c.createElement)(S.MenuItem,{onClick:()=>{t(!0)},shortcut:gt.displayShortcut.access("h")},(0,b.__)("Keyboard shortcuts")),(0,c.createElement)(_.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"welcomeGuide",label:(0,b.__)("Welcome Guide")}),(0,c.createElement)(S.MenuItem,{role:"menuitem",icon:zt,href:(0,b.__)("https://wordpress.org/documentation/article/block-based-widgets-editor/"),target:"_blank",rel:"noopener noreferrer"},(0,b.__)("Help"),(0,c.createElement)(S.VisuallyHidden,{as:"span"},(0,b.__)("(opens in a new tab)"))),(0,c.createElement)(Xt.Slot,{fillProps:{onClose:e}})),(0,c.createElement)(S.MenuGroup,{label:(0,b.__)("Preferences")},(0,c.createElement)(_.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"keepCaretInsideBlock",label:(0,b.__)("Contain text cursor inside block"),info:(0,b.__)("Aids screen readers by stopping text caret from leaving blocks."),messageActivated:(0,b.__)("Contain text cursor inside block activated"),messageDeactivated:(0,b.__)("Contain text cursor inside block deactivated")}),(0,c.createElement)(_.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"themeStyles",info:(0,b.__)("Make the editor look like your theme."),label:(0,b.__)("Use theme styles")}),n&&(0,c.createElement)(_.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"showBlockBreadcrumbs",label:(0,b.__)("Display block breadcrumbs"),info:(0,b.__)("Shows block breadcrumbs at the bottom of the editor."),messageActivated:(0,b.__)("Display block breadcrumbs activated"),messageDeactivated:(0,b.__)("Display block breadcrumbs deactivated")}))))),(0,c.createElement)(qt,{isModalActive:e,toggleModal:r}))}const{useShouldContextualToolbarShow:tr}=bt(pe.privateApis);var rr=function({setListViewToggleElement:e}){const t=(0,ce.useViewportMatch)("medium"),r=(0,c.useRef)(),n=_t(),a=(0,d.useSelect)((e=>e(Je).getIsWidgetAreaOpen(n)),[n]),{isInserterOpen:i,isListViewOpen:o}=(0,d.useSelect)((e=>{const{isInserterOpened:t,isListViewOpened:r}=e(Je);return{isInserterOpen:t(),isListViewOpen:r()}}),[]),{setIsWidgetAreaOpen:s,setIsInserterOpened:l,setIsListViewOpened:u}=(0,d.useDispatch)(Je),{selectBlock:m}=(0,d.useDispatch)(pe.store),g=(0,c.useCallback)((()=>u(!o)),[u,o]),{shouldShowContextualToolbar:p,canFocusHiddenToolbar:h,fixedToolbarCanBeFocused:_}=tr(),w=p||h||_;return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"edit-widgets-header"},(0,c.createElement)("div",{className:"edit-widgets-header__navigable-toolbar-wrapper"},t&&(0,c.createElement)("h1",{className:"edit-widgets-header__title"},(0,b.__)("Widgets")),!t&&(0,c.createElement)(S.VisuallyHidden,{as:"h1",className:"edit-widgets-header__title"},(0,b.__)("Widgets")),(0,c.createElement)(pe.NavigableToolbar,{className:"edit-widgets-header-toolbar","aria-label":(0,b.__)("Document tools"),shouldUseKeyboardFocusShortcut:!w},(0,c.createElement)(S.ToolbarItem,{ref:r,as:S.Button,className:"edit-widgets-header-toolbar__inserter-toggle",variant:"primary",isPressed:i,onMouseDown:e=>{e.preventDefault()},onClick:()=>{i?l(!1):(a||(m(n),s(n,!0)),window.requestAnimationFrame((()=>l(!0))))},icon:Ot,label:(0,b._x)("Toggle block inserter","Generic label for block inserter button")}),t&&(0,c.createElement)(c.Fragment,null,(0,c.createElement)(Ft,null),(0,c.createElement)(Gt,null),(0,c.createElement)(S.ToolbarItem,{as:S.Button,className:"edit-widgets-header-toolbar__list-view-toggle",icon:Rt,isPressed:o,label:(0,b.__)("List View"),onClick:g,ref:e})))),(0,c.createElement)("div",{className:"edit-widgets-header__actions"},(0,c.createElement)(Mt,null),(0,c.createElement)(ae.Slot,{scope:"core/edit-widgets"}),(0,c.createElement)(er,null))))};var nr=function(){const{removeNotice:e}=(0,d.useDispatch)(v.store),{notices:t}=(0,d.useSelect)((e=>({notices:e(v.store).getNotices()})),[]),r=t.filter((({isDismissible:e,type:t})=>e&&"default"===t)),n=t.filter((({isDismissible:e,type:t})=>!e&&"default"===t)),a=t.filter((({type:e})=>"snackbar"===e));return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(S.NoticeList,{notices:n,className:"edit-widgets-notices__pinned"}),(0,c.createElement)(S.NoticeList,{notices:r,className:"edit-widgets-notices__dismissible",onRemove:e}),(0,c.createElement)(S.SnackbarList,{notices:a,className:"edit-widgets-notices__snackbar",onRemove:e}))};function ar({blockEditorSettings:e}){const t=(0,d.useSelect)((e=>!!e(_.store).get("core/edit-widgets","themeStyles")),[]),r=(0,c.useMemo)((()=>t?e.styles:[]),[e,t]);return(0,c.createElement)("div",{className:"edit-widgets-block-editor"},(0,c.createElement)(nr,null),(0,c.createElement)(pe.BlockTools,null,(0,c.createElement)(ht,null),(0,c.createElement)(pe.__unstableEditorStyles,{styles:r,scope:".editor-styles-wrapper"}),(0,c.createElement)(pe.BlockSelectionClearer,null,(0,c.createElement)(pe.WritingFlow,null,(0,c.createElement)(pe.BlockList,{className:"edit-widgets-main-block-list"})))))}var ir=(0,c.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)(A.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));var or=()=>{const e=(0,d.useSelect)((e=>{const{getEntityRecord:t}=e(p.store),r=t(we,Ee,ve());return r?.blocks[0]?.clientId}),[]);return(0,d.useSelect)((t=>{const{getBlockRootClientId:r,getBlockSelectionEnd:n,getBlockOrder:a,getBlockIndex:i}=t(pe.store),o=t(Je).__experimentalGetInsertionPoint();if(o.rootClientId)return o;const s=n()||e,c=r(s);return s&&""===c?{rootClientId:s,insertionIndex:a(s).length}:{rootClientId:c,insertionIndex:i(s)+1}}),[e])};function sr(){const e=(0,ce.useViewportMatch)("medium","<"),{rootClientId:t,insertionIndex:r}=or(),{setIsInserterOpened:n}=(0,d.useDispatch)(Je),a=(0,c.useCallback)((()=>n(!1)),[n]),i=e?"div":S.VisuallyHidden,[o,s]=(0,ce.__experimentalUseDialog)({onClose:a,focusOnMount:null}),l=(0,c.useRef)();return(0,c.useEffect)((()=>{l.current.focusSearch()}),[]),(0,c.createElement)("div",{ref:o,...s,className:"edit-widgets-layout__inserter-panel"},(0,c.createElement)(i,{className:"edit-widgets-layout__inserter-panel-header"},(0,c.createElement)(S.Button,{icon:ir,onClick:a,label:(0,b.__)("Close block inserter")})),(0,c.createElement)("div",{className:"edit-widgets-layout__inserter-panel-content"},(0,c.createElement)(pe.__experimentalLibrary,{showInserterHelpPanel:!0,shouldFocusBlock:e,rootClientId:t,__experimentalInsertionIndex:r,ref:l})))}function cr({listViewToggleElement:e}){const{setIsListViewOpened:t}=(0,d.useDispatch)(Je),[r,n]=(0,c.useState)(null),a=(0,ce.useFocusOnMount)("firstElement"),i=(0,c.useCallback)((()=>{t(!1),e?.focus()}),[e,t]),o=(0,c.useCallback)((e=>{e.keyCode!==gt.ESCAPE||e.defaultPrevented||(e.preventDefault(),i())}),[i]);return(0,c.createElement)("div",{className:"edit-widgets-editor__list-view-panel",onKeyDown:o},(0,c.createElement)("div",{className:"edit-widgets-editor__list-view-panel-header"},(0,c.createElement)("strong",null,(0,b.__)("List View")),(0,c.createElement)(S.Button,{icon:x,label:(0,b.__)("Close"),onClick:i})),(0,c.createElement)("div",{className:"edit-widgets-editor__list-view-panel-content",ref:(0,ce.useMergeRefs)([a,n])},(0,c.createElement)(pe.__experimentalListView,{dropZoneElement:r})))}function lr({listViewToggleElement:e}){const{isInserterOpen:t,isListViewOpen:r}=(0,d.useSelect)((e=>{const{isInserterOpened:t,isListViewOpened:r}=e(Je);return{isInserterOpen:t(),isListViewOpen:r()}}),[]);return t?(0,c.createElement)(sr,null):r?(0,c.createElement)(cr,{listViewToggleElement:e}):null}const dr={header:(0,b.__)("Widgets top bar"),body:(0,b.__)("Widgets and blocks"),sidebar:(0,b.__)("Widgets settings"),footer:(0,b.__)("Widgets footer")};var ur=function({blockEditorSettings:e}){const t=(0,ce.useViewportMatch)("medium","<"),r=(0,ce.useViewportMatch)("huge",">="),{setIsInserterOpened:n,setIsListViewOpened:a,closeGeneralSidebar:i}=(0,d.useDispatch)(Je),{hasBlockBreadCrumbsEnabled:o,hasSidebarEnabled:s,isInserterOpened:l,isListViewOpened:u,previousShortcut:m,nextShortcut:g}=(0,d.useSelect)((e=>({hasSidebarEnabled:!!e(Y).getActiveComplementaryArea(Je.name),isInserterOpened:!!e(Je).isInserterOpened(),isListViewOpened:!!e(Je).isListViewOpened(),hasBlockBreadCrumbsEnabled:!!e(_.store).get("core/edit-widgets","showBlockBreadcrumbs"),previousShortcut:e(mt.store).getAllShortcutKeyCombinations("core/edit-widgets/previous-region"),nextShortcut:e(mt.store).getAllShortcutKeyCombinations("core/edit-widgets/next-region")})),[]),[p,h]=(0,c.useState)(null);(0,c.useEffect)((()=>{s&&!r&&(n(!1),a(!1))}),[s,r]),(0,c.useEffect)((()=>{!l&&!u||r||i()}),[l,u,r]);const w=u?(0,b.__)("List View"):(0,b.__)("Block Library"),f=u||l;return(0,c.createElement)(ue,{labels:{...dr,secondarySidebar:w},header:(0,c.createElement)(rr,{setListViewToggleElement:h}),secondarySidebar:f&&(0,c.createElement)(lr,{listViewToggleElement:p}),sidebar:s&&(0,c.createElement)(se.Slot,{scope:"core/edit-widgets"}),content:(0,c.createElement)(c.Fragment,null,(0,c.createElement)(ar,{blockEditorSettings:e})),footer:o&&!t&&(0,c.createElement)("div",{className:"edit-widgets-layout__footer"},(0,c.createElement)(pe.BlockBreadcrumb,{rootLabelText:(0,b.__)("Widgets")})),shortcuts:{previous:m,next:g}})};function mr(){const e=(0,d.useSelect)((e=>{const{getEditedWidgetAreas:t}=e(Je),r=t();return r?.length>0}),[]);return(0,c.useEffect)((()=>{const t=t=>{if(e)return t.returnValue=(0,b.__)("You have unsaved changes. If you proceed, they will be lost."),t.returnValue};return window.addEventListener("beforeunload",t),()=>{window.removeEventListener("beforeunload",t)}}),[e]),null}function gr(){var e;const t=(0,d.useSelect)((e=>!!e(_.store).get("core/edit-widgets","welcomeGuide")),[]),{toggle:r}=(0,d.useDispatch)(_.store),n=(0,d.useSelect)((e=>e(Je).getWidgetAreas({per_page:-1})),[]);if(!t)return null;const a=n?.every((e=>"wp_inactive_widgets"===e.id||e.widgets.every((e=>e.startsWith("block-"))))),i=null!==(e=n?.filter((e=>"wp_inactive_widgets"!==e.id)).length)&&void 0!==e?e:0;return(0,c.createElement)(S.Guide,{className:"edit-widgets-welcome-guide",contentLabel:(0,b.__)("Welcome to block Widgets"),finishButtonText:(0,b.__)("Get started"),onFinish:()=>r("core/edit-widgets","welcomeGuide"),pages:[{image:(0,c.createElement)(pr,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-canvas.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-canvas.gif"}),content:(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h1",{className:"edit-widgets-welcome-guide__heading"},(0,b.__)("Welcome to block Widgets")),a?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,b.sprintf)((0,b._n)("Your theme provides %s “block” area for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.","Your theme provides %s 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 they’ll look on your site.",i),i))):(0,c.createElement)(c.Fragment,null,(0,c.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,b.__)("You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.")),(0,c.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,c.createElement)("strong",null,(0,b.__)("Want to stick with the old widgets?"))," ",(0,c.createElement)(S.ExternalLink,{href:(0,b.__)("https://wordpress.org/plugins/classic-widgets/")},(0,b.__)("Get the Classic Widgets plugin.")))))},{image:(0,c.createElement)(pr,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-editor.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-editor.gif"}),content:(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h1",{className:"edit-widgets-welcome-guide__heading"},(0,b.__)("Make each block your own")),(0,c.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,b.__)("Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.")))},{image:(0,c.createElement)(pr,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-library.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-library.gif"}),content:(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h1",{className:"edit-widgets-welcome-guide__heading"},(0,b.__)("Get to know the block library")),(0,c.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,c.createInterpolateElement)((0,b.__)("All of the blocks available to you live in the block library. You’ll find it wherever you see the <InserterIconImage /> icon."),{InserterIconImage:(0,c.createElement)("img",{className:"edit-widgets-welcome-guide__inserter-icon",alt:(0,b.__)("inserter"),src:"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A"})})))},{image:(0,c.createElement)(pr,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.gif"}),content:(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h1",{className:"edit-widgets-welcome-guide__heading"},(0,b.__)("Learn how to use the block editor")),(0,c.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,b.__)("New to the block editor? Want to learn more about using it? "),(0,c.createElement)(S.ExternalLink,{href:(0,b.__)("https://wordpress.org/documentation/article/wordpress-block-editor/")},(0,b.__)("Here's a detailed guide."))))}]})}function pr({nonAnimatedSrc:e,animatedSrc:t}){return(0,c.createElement)("picture",{className:"edit-widgets-welcome-guide__image"},(0,c.createElement)("source",{srcSet:e,media:"(prefers-reduced-motion: reduce)"}),(0,c.createElement)("img",{src:t,width:"312",height:"240",alt:""}))}var hr=function({blockEditorSettings:e}){const{createErrorNotice:t}=(0,d.useDispatch)(v.store);return(0,c.createElement)(dt,null,(0,c.createElement)(kt,{blockEditorSettings:e},(0,c.createElement)(ur,{blockEditorSettings:e}),(0,c.createElement)(Pt,null),(0,c.createElement)(K.PluginArea,{onError:function(e){t((0,b.sprintf)((0,b.__)('The "%s" plugin has encountered an error and cannot be rendered.'),e))}}),(0,c.createElement)(mr,null),(0,c.createElement)(gr,null)))};const _r=["core/more","core/freeform","core/template-part",...wt?[]:["core/block"]];function wr(e,t){const r=document.getElementById(e),n=(0,c.createRoot)(r),a=(0,g.__experimentalGetCoreBlocks)().filter((e=>!(_r.includes(e.name)||e.name.startsWith("core/post")||e.name.startsWith("core/query")||e.name.startsWith("core/site")||e.name.startsWith("core/navigation"))));return(0,d.dispatch)(_.store).setDefaults("core/edit-widgets",{fixedToolbar:!1,welcomeGuide:!0,showBlockBreadcrumbs:!0,themeStyles:!0}),(0,d.dispatch)(l.store).reapplyBlockTypeFilters(),(0,g.registerCoreBlocks)(a),(0,h.registerLegacyWidgetBlock)(),(0,h.registerLegacyWidgetVariations)(t),br(s),(0,h.registerWidgetGroupBlock)(),t.__experimentalFetchLinkSuggestions=(e,r)=>(0,p.__experimentalFetchLinkSuggestions)(e,r,t),(0,l.setFreeformContentHandlerName)("core/html"),n.render((0,c.createElement)(hr,{blockEditorSettings:t})),n}const fr=wr;function Er(){m()("wp.editWidgets.reinitializeEditor",{since:"6.2",version:"6.3"})}const br=e=>{if(!e)return;const{metadata:t,settings:r,name:n}=e;t&&(0,l.unstable__bootstrapServerSideBlockDefinitions)({[n]:t}),(0,l.registerBlockType)(n,r)}}(),(window.wp=window.wp||{}).editWidgets=n}(); \ No newline at end of file
+*/!function(){"use strict";var a={}.hasOwnProperty;function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var o=n.apply(null,r);o&&e.push(o)}}else if("object"===i){if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]")){e.push(r.toString());continue}for(var s in r)a.call(r,s)&&r[s]&&e.push(s)}}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):void 0===(r=function(){return n}.apply(t,[]))||(e.exports=r)}()}},t={};function r(a){var n=t[a];if(void 0!==n)return n.exports;var i=t[a]={exports:{}};return e[a](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};(()=>{"use strict";r.r(a),r.d(a,{initialize:()=>Sr,initializeEditor:()=>kr,reinitializeEditor:()=>Ar,store:()=>nt});var e={};r.r(e),r.d(e,{closeModal:()=>H,disableComplementaryArea:()=>R,enableComplementaryArea:()=>P,openModal:()=>G,pinItem:()=>O,setDefaultComplementaryArea:()=>L,setFeatureDefaults:()=>F,setFeatureValue:()=>D,toggleFeature:()=>V,unpinItem:()=>M});var t={};r.r(t),r.d(t,{getActiveComplementaryArea:()=>z,isComplementaryAreaLoading:()=>U,isFeatureActive:()=>j,isItemPinned:()=>$,isModalActive:()=>Y});var n={};r.r(n),r.d(n,{closeGeneralSidebar:()=>Re,moveBlockToWidgetArea:()=>Oe,persistStubPost:()=>Ae,saveEditedWidgetAreas:()=>Ie,saveWidgetArea:()=>Be,saveWidgetAreas:()=>Ce,setIsInserterOpened:()=>Le,setIsListViewOpened:()=>Pe,setIsWidgetAreaOpen:()=>We,setWidgetAreasOpenState:()=>Te,setWidgetIdForClientId:()=>xe});var i={};r.r(i),r.d(i,{getWidgetAreas:()=>Me,getWidgets:()=>Ve});var o={};r.r(o),r.d(o,{__experimentalGetInsertionPoint:()=>qe,canInsertBlockInWidgetArea:()=>Qe,getEditedWidgetAreas:()=>$e,getIsWidgetAreaOpen:()=>Ke,getParentWidgetAreaBlock:()=>Ue,getReferenceWidgetBlocks:()=>je,getWidget:()=>Ge,getWidgetAreaForWidgetId:()=>ze,getWidgetAreas:()=>He,getWidgets:()=>Fe,isInserterOpened:()=>Ze,isListViewOpened:()=>Je,isSavingWidgetAreas:()=>Ye});var s={};r.r(s),r.d(s,{getListViewToggleRef:()=>Xe});var c={};r.r(c),r.d(c,{metadata:()=>mt,name:()=>ut,settings:()=>gt});const l=window.React,d=window.wp.blocks,m=window.wp.data,u=window.wp.deprecated;var g=r.n(u);const p=window.wp.element,h=window.wp.blockLibrary,w=window.wp.coreData,_=window.wp.widgets,b=window.wp.preferences,E=window.wp.apiFetch;var f=r.n(E);const y=(0,m.combineReducers)({blockInserterPanel:function(e=!1,t){switch(t.type){case"SET_IS_LIST_VIEW_OPENED":return!t.isOpen&&e;case"SET_IS_INSERTER_OPENED":return t.value}return e},listViewPanel:function(e=!1,t){switch(t.type){case"SET_IS_INSERTER_OPENED":return!t.value&&e;case"SET_IS_LIST_VIEW_OPENED":return t.isOpen}return e},widgetAreasOpenState:function(e={},t){const{type:r}=t;switch(r){case"SET_WIDGET_AREAS_OPEN_STATE":return t.widgetAreasOpenState;case"SET_IS_WIDGET_AREA_OPEN":{const{clientId:r,isOpen:a}=t;return{...e,[r]:a}}default:return e}}}),v=window.wp.i18n,k=window.wp.notices;var S=r(5755),A=r.n(S);const I=window.wp.components,C=window.wp.primitives,B=(0,l.createElement)(C.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(C.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),N=(0,l.createElement)(C.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(C.Path,{d:"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"})),x=(0,l.createElement)(C.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(C.Path,{fillRule:"evenodd",d:"M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",clipRule:"evenodd"})),T=window.wp.viewport,W=(0,l.createElement)(C.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(C.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"})),L=(e,t)=>({type:"SET_DEFAULT_COMPLEMENTARY_AREA",scope:e,area:t}),P=(e,t)=>({registry:r,dispatch:a})=>{if(!t)return;r.select(b.store).get(e,"isComplementaryAreaVisible")||r.dispatch(b.store).set(e,"isComplementaryAreaVisible",!0),a({type:"ENABLE_COMPLEMENTARY_AREA",scope:e,area:t})},R=e=>({registry:t})=>{t.select(b.store).get(e,"isComplementaryAreaVisible")&&t.dispatch(b.store).set(e,"isComplementaryAreaVisible",!1)},O=(e,t)=>({registry:r})=>{if(!t)return;const a=r.select(b.store).get(e,"pinnedItems");!0!==a?.[t]&&r.dispatch(b.store).set(e,"pinnedItems",{...a,[t]:!0})},M=(e,t)=>({registry:r})=>{if(!t)return;const a=r.select(b.store).get(e,"pinnedItems");r.dispatch(b.store).set(e,"pinnedItems",{...a,[t]:!1})};function V(e,t){return function({registry:r}){g()("dispatch( 'core/interface' ).toggleFeature",{since:"6.0",alternative:"dispatch( 'core/preferences' ).toggle"}),r.dispatch(b.store).toggle(e,t)}}function D(e,t,r){return function({registry:a}){g()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),a.dispatch(b.store).set(e,t,!!r)}}function F(e,t){return function({registry:r}){g()("dispatch( 'core/interface' ).setFeatureDefaults",{since:"6.0",alternative:"dispatch( 'core/preferences' ).setDefaults"}),r.dispatch(b.store).setDefaults(e,t)}}function G(e){return{type:"OPEN_MODAL",name:e}}function H(){return{type:"CLOSE_MODAL"}}const z=(0,m.createRegistrySelector)((e=>(t,r)=>{const a=e(b.store).get(r,"isComplementaryAreaVisible");if(void 0!==a)return!1===a?null:t?.complementaryAreas?.[r]})),U=(0,m.createRegistrySelector)((e=>(t,r)=>{const a=e(b.store).get(r,"isComplementaryAreaVisible"),n=t?.complementaryAreas?.[r];return a&&void 0===n})),$=(0,m.createRegistrySelector)((e=>(t,r,a)=>{var n;const i=e(b.store).get(r,"pinnedItems");return null===(n=i?.[a])||void 0===n||n})),j=(0,m.createRegistrySelector)((e=>(t,r,a)=>(g()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(b.store).get(r,a))));function Y(e,t){return e.activeModal===t}const K=(0,m.combineReducers)({complementaryAreas:function(e={},t){switch(t.type){case"SET_DEFAULT_COMPLEMENTARY_AREA":{const{scope:r,area:a}=t;return e[r]?e:{...e,[r]:a}}case"ENABLE_COMPLEMENTARY_AREA":{const{scope:r,area:a}=t;return{...e,[r]:a}}}return e},activeModal:function(e=null,t){switch(t.type){case"OPEN_MODAL":return t.name;case"CLOSE_MODAL":return null}return e}}),Z=(0,m.createReduxStore)("core/interface",{reducer:K,actions:e,selectors:t});(0,m.register)(Z);const q=window.wp.plugins,Q=(0,q.withPluginContext)(((e,t)=>({icon:t.icon||e.icon,identifier:t.identifier||`${e.name}/${t.name}`})));const J=Q((function({as:e=I.Button,scope:t,identifier:r,icon:a,selectedIcon:n,name:i,...o}){const s=e,c=(0,m.useSelect)((e=>e(Z).getActiveComplementaryArea(t)===r),[r,t]),{enableComplementaryArea:d,disableComplementaryArea:u}=(0,m.useDispatch)(Z);return(0,l.createElement)(s,{icon:n&&c?n:a,"aria-controls":r.replace("/",":"),onClick:()=>{c?u(t):d(t,r)},...o})})),X=({smallScreenTitle:e,children:t,className:r,toggleButtonProps:a})=>{const n=(0,l.createElement)(J,{icon:W,...a});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"components-panel__header interface-complementary-area-header__small"},e&&(0,l.createElement)("span",{className:"interface-complementary-area-header__small-title"},e),n),(0,l.createElement)("div",{className:A()("components-panel__header","interface-complementary-area-header",r),tabIndex:-1},t,n))},ee=()=>{};function te({name:e,as:t=I.Button,onClick:r,...a}){return(0,l.createElement)(I.Fill,{name:e},(({onClick:e})=>(0,l.createElement)(t,{onClick:r||e?(...t)=>{(r||ee)(...t),(e||ee)(...t)}:void 0,...a})))}te.Slot=function({name:e,as:t=I.ButtonGroup,fillProps:r={},bubblesVirtually:a,...n}){return(0,l.createElement)(I.Slot,{name:e,bubblesVirtually:a,fillProps:r},(e=>{if(!p.Children.toArray(e).length)return null;const r=[];p.Children.forEach(e,(({props:{__unstableExplicitMenuItem:e,__unstableTarget:t}})=>{t&&e&&r.push(t)}));const a=p.Children.map(e,(e=>!e.props.__unstableExplicitMenuItem&&r.includes(e.props.__unstableTarget)?null:e));return(0,l.createElement)(t,{...n},a)}))};const re=te,ae=({__unstableExplicitMenuItem:e,__unstableTarget:t,...r})=>(0,l.createElement)(I.MenuItem,{...r});function ne({scope:e,target:t,__unstableExplicitMenuItem:r,...a}){return(0,l.createElement)(J,{as:a=>(0,l.createElement)(re,{__unstableExplicitMenuItem:r,__unstableTarget:`${e}/${t}`,as:ae,name:`${e}/plugin-more-menu`,...a}),role:"menuitemcheckbox",selectedIcon:B,name:t,scope:e,...a})}function ie({scope:e,...t}){return(0,l.createElement)(I.Fill,{name:`PinnedItems/${e}`,...t})}ie.Slot=function({scope:e,className:t,...r}){return(0,l.createElement)(I.Slot,{name:`PinnedItems/${e}`,...r},(e=>e?.length>0&&(0,l.createElement)("div",{className:A()(t,"interface-pinned-items")},e)))};const oe=ie;function se({scope:e,children:t,className:r,id:a}){return(0,l.createElement)(I.Fill,{name:`ComplementaryArea/${e}`},(0,l.createElement)("div",{id:a,className:r},t))}const ce=Q((function({children:e,className:t,closeLabel:r=(0,v.__)("Close plugin"),identifier:a,header:n,headerClassName:i,icon:o,isPinnable:s=!0,panelClassName:c,scope:d,name:u,smallScreenTitle:g,title:h,toggleShortcut:w,isActiveByDefault:_}){const{isLoading:E,isActive:f,isPinned:y,activeArea:k,isSmall:S,isLarge:C,showIconLabels:W}=(0,m.useSelect)((e=>{const{getActiveComplementaryArea:t,isComplementaryAreaLoading:r,isItemPinned:n}=e(Z),{get:i}=e(b.store),o=t(d);return{isLoading:r(d),isActive:o===a,isPinned:n(d,a),activeArea:o,isSmall:e(T.store).isViewportMatch("< medium"),isLarge:e(T.store).isViewportMatch("large"),showIconLabels:i("core","showIconLabels")}}),[a,d]);!function(e,t,r,a,n){const i=(0,p.useRef)(!1),o=(0,p.useRef)(!1),{enableComplementaryArea:s,disableComplementaryArea:c}=(0,m.useDispatch)(Z);(0,p.useEffect)((()=>{a&&n&&!i.current?(c(e),o.current=!0):o.current&&!n&&i.current?(o.current=!1,s(e,t)):o.current&&r&&r!==t&&(o.current=!1),n!==i.current&&(i.current=n)}),[a,n,e,t,r,c,s])}(d,a,k,f,S);const{enableComplementaryArea:L,disableComplementaryArea:P,pinItem:R,unpinItem:O}=(0,m.useDispatch)(Z);return(0,p.useEffect)((()=>{_&&void 0===k&&!S?L(d,a):void 0===k&&S&&P(d,a)}),[k,_,d,a,S,L,P]),(0,l.createElement)(l.Fragment,null,s&&(0,l.createElement)(oe,{scope:d},y&&(0,l.createElement)(J,{scope:d,identifier:a,isPressed:f&&(!W||C),"aria-expanded":f,"aria-disabled":E,label:h,icon:W?B:o,showTooltip:!W,variant:W?"tertiary":void 0,size:"compact"})),u&&s&&(0,l.createElement)(ne,{target:u,scope:d,icon:o},h),f&&(0,l.createElement)(se,{className:A()("interface-complementary-area",t),scope:d,id:a.replace("/",":")},(0,l.createElement)(X,{className:i,closeLabel:r,onClose:()=>P(d),smallScreenTitle:g,toggleButtonProps:{label:r,shortcut:w,scope:d,identifier:a}},n||(0,l.createElement)(l.Fragment,null,(0,l.createElement)("strong",null,h),s&&(0,l.createElement)(I.Button,{className:"interface-complementary-area__pin-unpin-item",icon:y?N:x,label:y?(0,v.__)("Unpin from toolbar"):(0,v.__)("Pin to toolbar"),onClick:()=>(y?O:R)(d,a),isPressed:y,"aria-expanded":y}))),(0,l.createElement)(I.Panel,{className:c},e)))}));ce.Slot=function({scope:e,...t}){return(0,l.createElement)(I.Slot,{name:`ComplementaryArea/${e}`,...t})};const le=ce,de=window.wp.compose;function me({children:e,className:t,ariaLabel:r,as:a="div",...n}){return(0,l.createElement)(a,{className:A()("interface-navigable-region",t),"aria-label":r,role:"region",tabIndex:"-1",...n},e)}const ue={hidden:{opacity:0},hover:{opacity:1,transition:{type:"tween",delay:.2,delayChildren:.2}},distractionFreeInactive:{opacity:1,transition:{delay:0}}};const ge=(0,p.forwardRef)((function({isDistractionFree:e,footer:t,header:r,editorNotices:a,sidebar:n,secondarySidebar:i,notices:o,content:s,actions:c,labels:d,className:m,enableRegionNavigation:u=!0,shortcuts:g},h){const w=(0,I.__unstableUseNavigateRegions)(g);!function(e){(0,p.useEffect)((()=>{const t=document&&document.querySelector(`html:not(.${e})`);if(t)return t.classList.toggle(e),()=>{t.classList.toggle(e)}}),[e])}("interface-interface-skeleton__html-container");const _={...{header:(0,v._x)("Header","header landmark area"),body:(0,v.__)("Content"),secondarySidebar:(0,v.__)("Block Library"),sidebar:(0,v.__)("Settings"),actions:(0,v.__)("Publish"),footer:(0,v.__)("Footer")},...d};return(0,l.createElement)("div",{...u?w:{},ref:(0,de.useMergeRefs)([h,u?w.ref:void 0]),className:A()(m,"interface-interface-skeleton",w.className,!!t&&"has-footer")},(0,l.createElement)("div",{className:"interface-interface-skeleton__editor"},!!r&&(0,l.createElement)(me,{as:I.__unstableMotion.div,className:"interface-interface-skeleton__header","aria-label":_.header,initial:e?"hidden":"distractionFreeInactive",whileHover:e?"hover":"distractionFreeInactive",animate:e?"hidden":"distractionFreeInactive",variants:ue,transition:e?{type:"tween",delay:.8}:void 0},r),e&&(0,l.createElement)("div",{className:"interface-interface-skeleton__header"},a),(0,l.createElement)("div",{className:"interface-interface-skeleton__body"},!!i&&(0,l.createElement)(me,{className:"interface-interface-skeleton__secondary-sidebar",ariaLabel:_.secondarySidebar},i),!!o&&(0,l.createElement)("div",{className:"interface-interface-skeleton__notices"},o),(0,l.createElement)(me,{className:"interface-interface-skeleton__content",ariaLabel:_.body},s),!!n&&(0,l.createElement)(me,{className:"interface-interface-skeleton__sidebar",ariaLabel:_.sidebar},n),!!c&&(0,l.createElement)(me,{className:"interface-interface-skeleton__actions",ariaLabel:_.actions},c))),!!t&&(0,l.createElement)(me,{className:"interface-interface-skeleton__footer",ariaLabel:_.footer},t))})),pe=(0,l.createElement)(C.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(C.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"}));function he({as:e=I.DropdownMenu,className:t,label:r=(0,v.__)("Options"),popoverProps:a,toggleProps:n,children:i}){return(0,l.createElement)(e,{className:A()("interface-more-menu-dropdown",t),icon:pe,label:r,popoverProps:{placement:"bottom-end",...a,className:A()("interface-more-menu-dropdown__content",a?.className)},toggleProps:{tooltipPosition:"bottom",...n,size:"compact"}},(e=>i(e)))}const we=window.wp.blockEditor;function _e(e){if("block"===e.id_base){const t=(0,d.parse)(e.instance.raw.content,{__unstableSkipAutop:!0});return t.length?(0,_.addWidgetIdToBlock)(t[0],e.id):(0,_.addWidgetIdToBlock)((0,d.createBlock)("core/paragraph",{},[]),e.id)}let t;return t=e._embedded.about[0].is_multi?{idBase:e.id_base,instance:e.instance}:{id:e.id},(0,_.addWidgetIdToBlock)((0,d.createBlock)("core/legacy-widget",t,[]),e.id)}function be(e,t={}){let r;var a,n,i;"core/legacy-widget"===e.name&&(e.attributes.id||e.attributes.instance)?r={...t,id:null!==(a=e.attributes.id)&&void 0!==a?a:t.id,id_base:null!==(n=e.attributes.idBase)&&void 0!==n?n:t.id_base,instance:null!==(i=e.attributes.instance)&&void 0!==i?i:t.instance}:r={...t,id_base:"block",instance:{raw:{content:(0,d.serialize)(e)}}};return delete r.rendered,delete r.rendered_form,r}const Ee="root",fe="sidebar",ye="postType",ve=e=>`widget-area-${e}`,ke=()=>"widget-areas";const Se="core/edit-widgets",Ae=(e,t)=>({registry:r})=>{const a=((e,t)=>({id:e,slug:e,status:"draft",type:"page",blocks:t,meta:{widgetAreaId:e}}))(e,t);return r.dispatch(w.store).receiveEntityRecords(Ee,ye,a,{id:a.id},!1),a},Ie=()=>async({select:e,dispatch:t,registry:r})=>{const a=e.getEditedWidgetAreas();if(a?.length)try{await t.saveWidgetAreas(a),r.dispatch(k.store).createSuccessNotice((0,v.__)("Widgets saved."),{type:"snackbar"})}catch(e){r.dispatch(k.store).createErrorNotice((0,v.sprintf)((0,v.__)("There was an error. %s"),e.message),{type:"snackbar"})}},Ce=e=>async({dispatch:t,registry:r})=>{try{for(const r of e)await t.saveWidgetArea(r.id)}finally{await r.dispatch(w.store).finishResolution("getEntityRecord",Ee,fe,{per_page:-1})}},Be=e=>async({dispatch:t,select:r,registry:a})=>{const n=r.getWidgets(),i=a.select(w.store).getEditedEntityRecord(Ee,ye,ve(e)),o=Object.values(n).filter((({sidebar:t})=>t===e)),s=[],c=i.blocks.filter((e=>{const{id:t}=e.attributes;if("core/legacy-widget"===e.name&&t){if(s.includes(t))return!1;s.push(t)}return!0})),l=[];for(const e of o){r.getWidgetAreaForWidgetId(e.id)||l.push(e)}const d=[],m=[],u=[];for(let t=0;t<c.length;t++){const r=c[t],i=(0,_.getWidgetIdFromBlock)(r),o=n[i],s=be(r,o);if(u.push(i),o){a.dispatch(w.store).editEntityRecord("root","widget",i,{...s,sidebar:e},{undoIgnore:!0});if(!a.select(w.store).hasEditsForEntityRecord("root","widget",i))continue;m.push((({saveEditedEntityRecord:e})=>e("root","widget",i)))}else m.push((({saveEntityRecord:t})=>t("root","widget",{...s,sidebar:e})));d.push({block:r,position:t,clientId:r.clientId})}for(const e of l)m.push((({deleteEntityRecord:t})=>t("root","widget",e.id,{force:!0})));const g=(await a.dispatch(w.store).__experimentalBatch(m)).filter((e=>!e.hasOwnProperty("deleted"))),p=[];for(let e=0;e<g.length;e++){const t=g[e],{block:r,position:n}=d[e];i.blocks[n].attributes.__internalWidgetId=t.id;a.select(w.store).getLastEntitySaveError("root","widget",t.id)&&p.push(r.attributes?.name||r?.name),u[n]||(u[n]=t.id)}if(p.length)throw new Error((0,v.sprintf)((0,v.__)("Could not save the following widgets: %s."),p.join(", ")));a.dispatch(w.store).editEntityRecord(Ee,fe,e,{widgets:u},{undoIgnore:!0}),t(Ne(e)),a.dispatch(w.store).receiveEntityRecords(Ee,ye,i,void 0)},Ne=e=>({registry:t})=>{t.dispatch(w.store).saveEditedEntityRecord(Ee,fe,e,{throwOnError:!0})};function xe(e,t){return{type:"SET_WIDGET_ID_FOR_CLIENT_ID",clientId:e,widgetId:t}}function Te(e){return{type:"SET_WIDGET_AREAS_OPEN_STATE",widgetAreasOpenState:e}}function We(e,t){return{type:"SET_IS_WIDGET_AREA_OPEN",clientId:e,isOpen:t}}function Le(e){return{type:"SET_IS_INSERTER_OPENED",value:e}}function Pe(e){return{type:"SET_IS_LIST_VIEW_OPENED",isOpen:e}}const Re=()=>({registry:e})=>{e.dispatch(Z).disableComplementaryArea(Se)},Oe=(e,t)=>async({dispatch:r,select:a,registry:n})=>{const i=n.select(we.store).getBlockRootClientId(e),o=n.select(we.store).getBlocks().find((({attributes:e})=>e.id===t)).clientId,s=n.select(we.store).getBlockOrder(o).length;a.getIsWidgetAreaOpen(o)||r.setIsWidgetAreaOpen(o,!0),n.dispatch(we.store).moveBlocksToPosition([e],i,o,s)},Me=()=>async({dispatch:e,registry:t})=>{const r={per_page:-1},a=[],n=(await t.resolveSelect(w.store).getEntityRecords(Ee,fe,r)).sort(((e,t)=>"wp_inactive_widgets"===e.id?1:"wp_inactive_widgets"===t.id?-1:0));for(const t of n)a.push((0,d.createBlock)("core/widget-area",{id:t.id,name:t.name})),t.widgets.length||e(Ae(ve(t.id),[]));const i={};a.forEach(((e,t)=>{i[e.clientId]=0===t})),e(Te(i)),e(Ae(ke(),a))},Ve=()=>async({dispatch:e,registry:t})=>{const r={per_page:-1,_embed:"about"},a=await t.resolveSelect(w.store).getEntityRecords("root","widget",r),n={};for(const e of a){const t=_e(e);n[e.sidebar]=n[e.sidebar]||[],n[e.sidebar].push(t)}for(const t in n)n.hasOwnProperty(t)&&e(Ae(ve(t),n[t]))},De={rootClientId:void 0,insertionIndex:void 0},Fe=(0,m.createRegistrySelector)((e=>()=>{const t=e(w.store).getEntityRecords("root","widget",{per_page:-1,_embed:"about"});return t?.reduce(((e,t)=>({...e,[t.id]:t})),{})||{}})),Ge=(0,m.createRegistrySelector)((e=>(t,r)=>e(Se).getWidgets()[r])),He=(0,m.createRegistrySelector)((e=>()=>{const t={per_page:-1};return e(w.store).getEntityRecords(Ee,fe,t)})),ze=(0,m.createRegistrySelector)((e=>(t,r)=>e(Se).getWidgetAreas().find((t=>e(w.store).getEditedEntityRecord(Ee,ye,ve(t.id)).blocks.map((e=>(0,_.getWidgetIdFromBlock)(e))).includes(r))))),Ue=(0,m.createRegistrySelector)((e=>(t,r)=>{const{getBlock:a,getBlockName:n,getBlockParents:i}=e(we.store);return a(i(r).find((e=>"core/widget-area"===n(e))))})),$e=(0,m.createRegistrySelector)((e=>(t,r)=>{let a=e(Se).getWidgetAreas();return a?(r&&(a=a.filter((({id:e})=>r.includes(e)))),a.filter((({id:t})=>e(w.store).hasEditsForEntityRecord(Ee,ye,ve(t)))).map((({id:t})=>e(w.store).getEditedEntityRecord(Ee,fe,t)))):[]})),je=(0,m.createRegistrySelector)((e=>(t,r=null)=>{const a=[],n=e(Se).getWidgetAreas();for(const t of n){const n=e(w.store).getEditedEntityRecord(Ee,ye,ve(t.id));for(const e of n.blocks)"core/legacy-widget"!==e.name||r&&e.attributes?.referenceWidgetName!==r||a.push(e)}return a})),Ye=(0,m.createRegistrySelector)((e=>()=>{const t=e(Se).getWidgetAreas()?.map((({id:e})=>e));if(!t)return!1;for(const r of t){if(e(w.store).isSavingEntityRecord(Ee,fe,r))return!0}const r=[...Object.keys(e(Se).getWidgets()),void 0];for(const t of r){if(e(w.store).isSavingEntityRecord("root","widget",t))return!0}return!1})),Ke=(e,t)=>{const{widgetAreasOpenState:r}=e;return!!r[t]};function Ze(e){return!!e.blockInserterPanel}function qe(e){return"boolean"==typeof e.blockInserterPanel?De:e.blockInserterPanel}const Qe=(0,m.createRegistrySelector)((e=>(t,r)=>{const a=e(we.store).getBlocks(),[n]=a;return e(we.store).canInsertBlockType(r,n.clientId)}));function Je(e){return e.listViewPanel}function Xe(e){return e.listViewToggleRef}const et=window.wp.privateApis,{lock:tt,unlock:rt}=(0,et.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.","@wordpress/edit-widgets"),at={reducer:y,selectors:o,resolvers:i,actions:n},nt=(0,m.createReduxStore)(Se,at);(0,m.register)(nt),f().use((function(e,t){return 0===e.path?.indexOf("/wp/v2/types/widget-area")?Promise.resolve({}):t(e)})),rt(nt).registerPrivateSelectors(s);const it=window.wp.hooks,ot=(0,de.createHigherOrderComponent)((e=>t=>{const{clientId:r,name:a}=t,{widgetAreas:n,currentWidgetAreaId:i,canInsertBlockInWidgetArea:o}=(0,m.useSelect)((e=>{if("core/widget-area"===a)return{};const t=e(nt),n=t.getParentWidgetAreaBlock(r);return{widgetAreas:t.getWidgetAreas(),currentWidgetAreaId:n?.attributes?.id,canInsertBlockInWidgetArea:t.canInsertBlockInWidgetArea(a)}}),[r,a]),{moveBlockToWidgetArea:s}=(0,m.useDispatch)(nt),c="core/widget-area"!==a&&n?.length>1&&o;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(e,{...t}),c&&(0,l.createElement)(we.BlockControls,null,(0,l.createElement)(_.MoveToWidgetArea,{widgetAreas:n,currentWidgetAreaId:i,onSelect:e=>{s(t.clientId,e)}})))}),"withMoveToWidgetAreaToolbarItem");(0,it.addFilter)("editor.BlockEdit","core/edit-widgets/block-edit",ot);const st=window.wp.mediaUtils;(0,it.addFilter)("editor.MediaUpload","core/edit-widgets/replace-media-upload",(()=>st.MediaUpload));const ct=e=>{const[t,r]=(0,p.useState)(!1);return(0,p.useEffect)((()=>{const{ownerDocument:t}=e.current;function a(e){i(e)}function n(){r(!1)}function i(t){e.current.contains(t.target)?r(!0):r(!1)}return t.addEventListener("dragstart",a),t.addEventListener("dragend",n),t.addEventListener("dragenter",i),()=>{t.removeEventListener("dragstart",a),t.removeEventListener("dragend",n),t.removeEventListener("dragenter",i)}}),[]),t};function lt({id:e}){const[t,r,a]=(0,w.useEntityBlockEditor)("root","postType"),n=(0,p.useRef)(),i=ct(n),o=(0,we.useInnerBlocksProps)({ref:n},{value:t,onInput:r,onChange:a,templateLock:!1,renderAppender:we.InnerBlocks.ButtonBlockAppender});return(0,l.createElement)("div",{"data-widget-area-id":e,className:A()("wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper",{"wp-block-widget-area__highlight-drop-zone":i})},(0,l.createElement)("div",{...o}))}const dt=e=>{const[t,r]=(0,p.useState)(!1);return(0,p.useEffect)((()=>{const{ownerDocument:t}=e.current;function a(){r(!0)}function n(){r(!1)}return t.addEventListener("dragstart",a),t.addEventListener("dragend",n),()=>{t.removeEventListener("dragstart",a),t.removeEventListener("dragend",n)}}),[]),t},mt={$schema:"https://schemas.wp.org/trunk/block.json",name:"core/widget-area",category:"widgets",attributes:{id:{type:"string"},name:{type:"string"}},supports:{html:!1,inserter:!1,customClassName:!1,reusable:!1,__experimentalToolbar:!1,__experimentalParentSelector:!1,__experimentalDisableBlockOverlay:!0},editorStyle:"wp-block-widget-area-editor",style:"wp-block-widget-area"},{name:ut}=mt,gt={title:(0,v.__)("Widget Area"),description:(0,v.__)("A widget area container."),__experimentalLabel:({name:e})=>e,edit:function({clientId:e,className:t,attributes:{id:r,name:a}}){const n=(0,m.useSelect)((t=>t(nt).getIsWidgetAreaOpen(e)),[e]),{setIsWidgetAreaOpen:i}=(0,m.useDispatch)(nt),o=(0,p.useRef)(),s=(0,p.useCallback)((t=>i(e,t)),[e]),c=dt(o),d=ct(o),[u,g]=(0,p.useState)(!1);return(0,p.useEffect)((()=>{c?d&&!n?(s(!0),g(!0)):!d&&n&&u&&s(!1):g(!1)}),[n,c,d,u]),(0,l.createElement)(I.Panel,{className:t,ref:o},(0,l.createElement)(I.PanelBody,{title:a,opened:n,onToggle:()=>{i(e,!n)},scrollAfterOpen:!c},(({opened:e})=>(0,l.createElement)(I.__unstableDisclosureContent,{className:"wp-block-widget-area__panel-body-content",visible:e},(0,l.createElement)(w.EntityProvider,{kind:"root",type:"postType",id:`widget-area-${r}`},(0,l.createElement)(lt,{id:r}))))))}};function pt({text:e,children:t}){const r=(0,de.useCopyToClipboard)(e);return(0,l.createElement)(I.Button,{variant:"secondary",ref:r},t)}function ht({message:e,error:t}){const r=[(0,l.createElement)(pt,{key:"copy-error",text:t.stack},(0,v.__)("Copy Error"))];return(0,l.createElement)(we.Warning,{className:"edit-widgets-error-boundary",actions:r},e)}class wt extends p.Component{constructor(){super(...arguments),this.state={error:null}}componentDidCatch(e){(0,it.doAction)("editor.ErrorBoundary.errorLogged",e)}static getDerivedStateFromError(e){return{error:e}}render(){return this.state.error?(0,l.createElement)(ht,{message:(0,v.__)("The editor has encountered an unexpected error."),error:this.state.error}):this.props.children}}const _t=window.wp.patterns,bt=window.wp.keyboardShortcuts,Et=window.wp.keycodes;function ft(){const{redo:e,undo:t}=(0,m.useDispatch)(w.store),{saveEditedWidgetAreas:r}=(0,m.useDispatch)(nt),{replaceBlocks:a}=(0,m.useDispatch)(we.store),{getBlockName:n,getSelectedBlockClientId:i,getBlockAttributes:o}=(0,m.useSelect)(we.store),s=(e,t)=>{e.preventDefault();const r=0===t?"core/paragraph":"core/heading",s=i();if(null===s)return;const c=n(s);if("core/paragraph"!==c&&"core/heading"!==c)return;const l=o(s),m="core/paragraph"===c?"align":"textAlign",u="core/paragraph"===r?"align":"textAlign";a(s,(0,d.createBlock)(r,{level:t,content:l.content,[u]:l[m]}))};return(0,bt.useShortcut)("core/edit-widgets/undo",(e=>{t(),e.preventDefault()})),(0,bt.useShortcut)("core/edit-widgets/redo",(t=>{e(),t.preventDefault()})),(0,bt.useShortcut)("core/edit-widgets/save",(e=>{e.preventDefault(),r()})),(0,bt.useShortcut)("core/edit-widgets/transform-heading-to-paragraph",(e=>s(e,0))),[1,2,3,4,5,6].forEach((e=>{(0,bt.useShortcut)(`core/edit-widgets/transform-paragraph-to-heading-${e}`,(t=>s(t,e)))})),null}ft.Register=function(){const{registerShortcut:e}=(0,m.useDispatch)(bt.store);return(0,p.useEffect)((()=>{e({name:"core/edit-widgets/undo",category:"global",description:(0,v.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/edit-widgets/redo",category:"global",description:(0,v.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"},aliases:(0,Et.isAppleOS)()?[]:[{modifier:"primary",character:"y"}]}),e({name:"core/edit-widgets/save",category:"global",description:(0,v.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),e({name:"core/edit-widgets/keyboard-shortcuts",category:"main",description:(0,v.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}}),e({name:"core/edit-widgets/next-region",category:"global",description:(0,v.__)("Navigate to the next part of the editor."),keyCombination:{modifier:"ctrl",character:"`"},aliases:[{modifier:"access",character:"n"}]}),e({name:"core/edit-widgets/previous-region",category:"global",description:(0,v.__)("Navigate to the previous part of the editor."),keyCombination:{modifier:"ctrlShift",character:"`"},aliases:[{modifier:"access",character:"p"},{modifier:"ctrlShift",character:"~"}]}),e({name:"core/edit-widgets/transform-heading-to-paragraph",category:"block-library",description:(0,v.__)("Transform heading to paragraph."),keyCombination:{modifier:"access",character:"0"}}),[1,2,3,4,5,6].forEach((t=>{e({name:`core/edit-widgets/transform-paragraph-to-heading-${t}`,category:"block-library",description:(0,v.__)("Transform paragraph to heading."),keyCombination:{modifier:"access",character:`${t}`}})}))}),[e]),null};const yt=ft,vt=()=>(0,m.useSelect)((e=>{const{getBlockSelectionEnd:t,getBlockName:r}=e(we.store),a=t();if("core/widget-area"===r(a))return a;const{getParentWidgetAreaBlock:n}=e(nt),i=n(a),o=i?.clientId;if(o)return o;const{getEntityRecord:s}=e(w.store),c=s(Ee,ye,ke());return c?.blocks[0]?.clientId}),[]),kt=!1,{ExperimentalBlockEditorProvider:St}=rt(we.privateApis),{PatternsMenuItems:At}=rt(_t.privateApis);function It({blockEditorSettings:e,children:t,...r}){const a=(0,w.useResourcePermissions)("media"),n=(0,de.useViewportMatch)("medium"),{reusableBlocks:i,isFixedToolbarActive:o,keepCaretInsideBlock:s,pageOnFront:c,pageForPosts:d}=(0,m.useSelect)((e=>{const{canUser:t,getEntityRecord:r,getEntityRecords:a}=e(w.store),n=t("read","settings")?r("root","site"):void 0;return{widgetAreas:e(nt).getWidgetAreas(),widgets:e(nt).getWidgets(),reusableBlocks:kt?a("postType","wp_block"):[],isFixedToolbarActive:!!e(b.store).get("core/edit-widgets","fixedToolbar"),keepCaretInsideBlock:!!e(b.store).get("core/edit-widgets","keepCaretInsideBlock"),pageOnFront:n?.page_on_front,pageForPosts:n?.page_for_posts}}),[]),{setIsInserterOpened:u}=(0,m.useDispatch)(nt),g=(0,p.useMemo)((()=>{let t;return a.canCreate&&(t=({onError:t,...r})=>{(0,st.uploadMedia)({wpAllowedMimeTypes:e.allowedMimeTypes,onError:({message:e})=>t(e),...r})}),{...e,__experimentalReusableBlocks:i,hasFixedToolbar:o||!n,keepCaretInsideBlock:s,mediaUpload:t,templateLock:"all",__experimentalSetIsInserterOpened:u,pageOnFront:c,pageForPosts:d}}),[e,o,n,s,a.canCreate,i,u,c,d]),h=vt(),[_,E,f]=(0,w.useEntityBlockEditor)(Ee,ye,{id:ke()});return(0,l.createElement)(I.SlotFillProvider,null,(0,l.createElement)(yt.Register,null),(0,l.createElement)(St,{value:_,onInput:E,onChange:f,settings:g,useSubRegistry:!1,...r},t,(0,l.createElement)(At,{rootClientId:h})))}const Ct=(0,l.createElement)(C.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(C.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z"})),Bt=(0,l.createElement)(C.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(C.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z"})),Nt=(0,l.createElement)(C.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(C.Path,{d:"M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"})),xt=window.wp.url,Tt=window.wp.dom;function Wt({selectedWidgetAreaId:e}){const t=(0,m.useSelect)((e=>e(nt).getWidgetAreas()),[]),r=(0,p.useMemo)((()=>e&&t?.find((t=>t.id===e))),[e,t]);let a;return a=r?"wp_inactive_widgets"===e?(0,v.__)("Blocks in this Widget Area will not be displayed in your site."):r.description:(0,v.__)("Widget Areas are global parts in your site’s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer."),(0,l.createElement)("div",{className:"edit-widgets-widget-areas"},(0,l.createElement)("div",{className:"edit-widgets-widget-areas__top-container"},(0,l.createElement)(we.BlockIcon,{icon:Nt}),(0,l.createElement)("div",null,(0,l.createElement)("p",{dangerouslySetInnerHTML:{__html:(0,Tt.safeHTML)(a)}}),0===t?.length&&(0,l.createElement)("p",null,(0,v.__)("Your theme does not contain any Widget Areas.")),!r&&(0,l.createElement)(I.Button,{href:(0,xt.addQueryArgs)("customize.php",{"autofocus[panel]":"widgets",return:window.location.pathname}),variant:"tertiary"},(0,v.__)("Manage with live preview")))))}const Lt=p.Platform.select({web:!0,native:!1}),Pt="edit-widgets/block-inspector",Rt="edit-widgets/block-areas",{Tabs:Ot}=rt(I.privateApis);function Mt({selectedWidgetAreaBlock:e}){return(0,l.createElement)(Ot.TabList,null,(0,l.createElement)(Ot.Tab,{tabId:Rt},e?e.attributes.name:(0,v.__)("Widget Areas")),(0,l.createElement)(Ot.Tab,{tabId:Pt},(0,v.__)("Block")))}function Vt({hasSelectedNonAreaBlock:e,currentArea:t,isGeneralSidebarOpen:r,selectedWidgetAreaBlock:a}){const{enableComplementaryArea:n}=(0,m.useDispatch)(Z);(0,p.useEffect)((()=>{e&&t===Rt&&r&&n("core/edit-widgets",Pt),!e&&t===Pt&&r&&n("core/edit-widgets",Rt)}),[e,n]);const i=(0,p.useContext)(Ot.Context);return(0,l.createElement)(le,{className:"edit-widgets-sidebar",header:(0,l.createElement)(Ot.Context.Provider,{value:i},(0,l.createElement)(Mt,{selectedWidgetAreaBlock:a})),headerClassName:"edit-widgets-sidebar__panel-tabs",title:(0,v.__)("Settings"),closeLabel:(0,v.__)("Close Settings"),scope:"core/edit-widgets",identifier:t,icon:(0,v.isRTL)()?Ct:Bt,isActiveByDefault:Lt},(0,l.createElement)(Ot.Context.Provider,{value:i},(0,l.createElement)(Ot.TabPanel,{tabId:Rt,focusable:!1},(0,l.createElement)(Wt,{selectedWidgetAreaId:a?.attributes.id})),(0,l.createElement)(Ot.TabPanel,{tabId:Pt,focusable:!1},e?(0,l.createElement)(we.BlockInspector,null):(0,l.createElement)("span",{className:"block-editor-block-inspector__no-blocks"},(0,v.__)("No block selected.")))))}function Dt(){const{currentArea:e,hasSelectedNonAreaBlock:t,isGeneralSidebarOpen:r,selectedWidgetAreaBlock:a}=(0,m.useSelect)((e=>{const{getSelectedBlock:t,getBlock:r,getBlockParentsByBlockName:a}=e(we.store),{getActiveComplementaryArea:n}=e(Z),i=t(),o=n(nt.name);let s,c=o;return c||(c=i?Pt:Rt),i&&(s="core/widget-area"===i.name?i:r(a(i.clientId,"core/widget-area")[0])),{currentArea:c,hasSelectedNonAreaBlock:!(!i||"core/widget-area"===i.name),isGeneralSidebarOpen:!!o,selectedWidgetAreaBlock:s}}),[]),{enableComplementaryArea:n}=(0,m.useDispatch)(Z),i=(0,p.useCallback)((e=>{e&&n(nt.name,e)}),[n]);return(0,l.createElement)(Ot,{selectedTabId:r?e:null,onSelect:i,selectOnMove:!1},(0,l.createElement)(Vt,{hasSelectedNonAreaBlock:t,currentArea:e,isGeneralSidebarOpen:r,selectedWidgetAreaBlock:a}))}const Ft=(0,l.createElement)(C.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(C.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})),Gt=(0,l.createElement)(C.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(C.Path,{d:"M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z"})),Ht=(0,l.createElement)(C.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(C.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"})),zt=(0,l.createElement)(C.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(C.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"}));const Ut=(0,p.forwardRef)((function(e,t){const r=(0,m.useSelect)((e=>e(w.store).hasUndo()),[]),{undo:a}=(0,m.useDispatch)(w.store);return(0,l.createElement)(I.Button,{...e,ref:t,icon:(0,v.isRTL)()?zt:Ht,label:(0,v.__)("Undo"),shortcut:Et.displayShortcut.primary("z"),"aria-disabled":!r,onClick:r?a:void 0})}));const $t=(0,p.forwardRef)((function(e,t){const r=(0,Et.isAppleOS)()?Et.displayShortcut.primaryShift("z"):Et.displayShortcut.primary("y"),a=(0,m.useSelect)((e=>e(w.store).hasRedo()),[]),{redo:n}=(0,m.useDispatch)(w.store);return(0,l.createElement)(I.Button,{...e,ref:t,icon:(0,v.isRTL)()?Ht:zt,label:(0,v.__)("Redo"),shortcut:r,"aria-disabled":!a,onClick:a?n:void 0})})),{useCanBlockToolbarBeFocused:jt}=rt(we.privateApis);const Yt=function(){const e=(0,de.useViewportMatch)("medium"),t=(0,p.useRef)(),r=vt(),a=(0,m.useSelect)((e=>e(nt).getIsWidgetAreaOpen(r)),[r]),{isInserterOpen:n,isListViewOpen:i,listViewToggleRef:o}=(0,m.useSelect)((e=>{const{isInserterOpened:t,isListViewOpened:r,getListViewToggleRef:a}=rt(e(nt));return{isInserterOpen:t(),isListViewOpen:r(),listViewToggleRef:a()}}),[]),{setIsWidgetAreaOpen:s,setIsInserterOpened:c,setIsListViewOpened:d}=(0,m.useDispatch)(nt),{selectBlock:u}=(0,m.useDispatch)(we.store),g=(0,p.useCallback)((()=>d(!i)),[d,i]),h=jt();return(0,l.createElement)(we.NavigableToolbar,{className:"edit-widgets-header-toolbar","aria-label":(0,v.__)("Document tools"),shouldUseKeyboardFocusShortcut:!h,variant:"unstyled"},(0,l.createElement)(I.ToolbarItem,{ref:t,as:I.Button,className:"edit-widgets-header-toolbar__inserter-toggle",variant:"primary",isPressed:n,onMouseDown:e=>{e.preventDefault()},onClick:()=>{n?c(!1):(a||(u(r),s(r,!0)),window.requestAnimationFrame((()=>c(!0))))},icon:Ft,label:(0,v._x)("Toggle block inserter","Generic label for block inserter button")}),e&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(I.ToolbarItem,{as:Ut}),(0,l.createElement)(I.ToolbarItem,{as:$t}),(0,l.createElement)(I.ToolbarItem,{as:I.Button,className:"edit-widgets-header-toolbar__list-view-toggle",icon:Gt,isPressed:i,label:(0,v.__)("List View"),onClick:g,ref:o})))};const Kt=function(){const{hasEditedWidgetAreaIds:e,isSaving:t}=(0,m.useSelect)((e=>{const{getEditedWidgetAreas:t,isSavingWidgetAreas:r}=e(nt);return{hasEditedWidgetAreaIds:t()?.length>0,isSaving:r()}}),[]),{saveEditedWidgetAreas:r}=(0,m.useDispatch)(nt),a=t||!e;return(0,l.createElement)(I.Button,{variant:"primary",isBusy:t,"aria-disabled":a,onClick:a?void 0:r},t?(0,v.__)("Saving…"):(0,v.__)("Update"))},Zt=(0,l.createElement)(C.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(C.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"})),qt=[{keyCombination:{modifier:"primary",character:"b"},description:(0,v.__)("Make the selected text bold.")},{keyCombination:{modifier:"primary",character:"i"},description:(0,v.__)("Make the selected text italic.")},{keyCombination:{modifier:"primary",character:"k"},description:(0,v.__)("Convert the selected text into a link.")},{keyCombination:{modifier:"primaryShift",character:"k"},description:(0,v.__)("Remove a link.")},{keyCombination:{character:"[["},description:(0,v.__)("Insert a link to a post or page.")},{keyCombination:{modifier:"primary",character:"u"},description:(0,v.__)("Underline the selected text.")},{keyCombination:{modifier:"access",character:"d"},description:(0,v.__)("Strikethrough the selected text.")},{keyCombination:{modifier:"access",character:"x"},description:(0,v.__)("Make the selected text inline code.")},{keyCombination:{modifier:"access",character:"0"},description:(0,v.__)("Convert the current heading to a paragraph.")},{keyCombination:{modifier:"access",character:"1-6"},description:(0,v.__)("Convert the current paragraph or heading to a heading of level 1 to 6.")}];function Qt({keyCombination:e,forceAriaLabel:t}){const r=e.modifier?Et.displayShortcutList[e.modifier](e.character):e.character,a=e.modifier?Et.shortcutAriaLabel[e.modifier](e.character):e.character,n=Array.isArray(r)?r:[r];return(0,l.createElement)("kbd",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":t||a},n.map(((e,t)=>"+"===e?(0,l.createElement)(p.Fragment,{key:t},e):(0,l.createElement)("kbd",{key:t,className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-key"},e))))}const Jt=function({description:e,keyCombination:t,aliases:r=[],ariaLabel:a}){return(0,l.createElement)(p.Fragment,null,(0,l.createElement)("div",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-description"},e),(0,l.createElement)("div",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-term"},(0,l.createElement)(Qt,{keyCombination:t,forceAriaLabel:a}),r.map(((e,t)=>(0,l.createElement)(Qt,{keyCombination:e,forceAriaLabel:a,key:t})))))};const Xt=function({name:e}){const{keyCombination:t,description:r,aliases:a}=(0,m.useSelect)((t=>{const{getShortcutKeyCombination:r,getShortcutDescription:a,getShortcutAliases:n}=t(bt.store);return{keyCombination:r(e),aliases:n(e),description:a(e)}}),[e]);return t?(0,l.createElement)(Jt,{keyCombination:t,description:r,aliases:a}):null},er=({shortcuts:e})=>(0,l.createElement)("ul",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-list",role:"list"},e.map(((e,t)=>(0,l.createElement)("li",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut",key:t},"string"==typeof e?(0,l.createElement)(Xt,{name:e}):(0,l.createElement)(Jt,{...e}))))),tr=({title:e,shortcuts:t,className:r})=>(0,l.createElement)("section",{className:A()("edit-widgets-keyboard-shortcut-help-modal__section",r)},!!e&&(0,l.createElement)("h2",{className:"edit-widgets-keyboard-shortcut-help-modal__section-title"},e),(0,l.createElement)(er,{shortcuts:t})),rr=({title:e,categoryName:t,additionalShortcuts:r=[]})=>{const a=(0,m.useSelect)((e=>e(bt.store).getCategoryShortcuts(t)),[t]);return(0,l.createElement)(tr,{title:e,shortcuts:a.concat(r)})};function ar({isModalActive:e,toggleModal:t}){return(0,bt.useShortcut)("core/edit-widgets/keyboard-shortcuts",t,{bindGlobal:!0}),e?(0,l.createElement)(I.Modal,{className:"edit-widgets-keyboard-shortcut-help-modal",title:(0,v.__)("Keyboard shortcuts"),onRequestClose:t},(0,l.createElement)(tr,{className:"edit-widgets-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/edit-widgets/keyboard-shortcuts"]}),(0,l.createElement)(rr,{title:(0,v.__)("Global shortcuts"),categoryName:"global"}),(0,l.createElement)(rr,{title:(0,v.__)("Selection shortcuts"),categoryName:"selection"}),(0,l.createElement)(rr,{title:(0,v.__)("Block shortcuts"),categoryName:"block",additionalShortcuts:[{keyCombination:{character:"/"},description:(0,v.__)("Change the block type after adding a new paragraph."),ariaLabel:(0,v.__)("Forward-slash")}]}),(0,l.createElement)(tr,{title:(0,v.__)("Text formatting"),shortcuts:qt})):null}const{Fill:nr,Slot:ir}=(0,I.createSlotFill)("EditWidgetsToolsMoreMenuGroup");nr.Slot=({fillProps:e})=>(0,l.createElement)(ir,{fillProps:e},(e=>e.length>0&&e));const or=nr;function sr(){const[e,t]=(0,p.useState)(!1),r=()=>t(!e);(0,bt.useShortcut)("core/edit-widgets/keyboard-shortcuts",r);const a=(0,de.useViewportMatch)("medium");return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(he,null,(e=>(0,l.createElement)(l.Fragment,null,a&&(0,l.createElement)(I.MenuGroup,{label:(0,v._x)("View","noun")},(0,l.createElement)(b.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"fixedToolbar",label:(0,v.__)("Top toolbar"),info:(0,v.__)("Access all block and document tools in a single place"),messageActivated:(0,v.__)("Top toolbar activated"),messageDeactivated:(0,v.__)("Top toolbar deactivated")})),(0,l.createElement)(I.MenuGroup,{label:(0,v.__)("Tools")},(0,l.createElement)(I.MenuItem,{onClick:()=>{t(!0)},shortcut:Et.displayShortcut.access("h")},(0,v.__)("Keyboard shortcuts")),(0,l.createElement)(b.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"welcomeGuide",label:(0,v.__)("Welcome Guide")}),(0,l.createElement)(I.MenuItem,{role:"menuitem",icon:Zt,href:(0,v.__)("https://wordpress.org/documentation/article/block-based-widgets-editor/"),target:"_blank",rel:"noopener noreferrer"},(0,v.__)("Help"),(0,l.createElement)(I.VisuallyHidden,{as:"span"},(0,v.__)("(opens in a new tab)"))),(0,l.createElement)(or.Slot,{fillProps:{onClose:e}})),(0,l.createElement)(I.MenuGroup,{label:(0,v.__)("Preferences")},(0,l.createElement)(b.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"keepCaretInsideBlock",label:(0,v.__)("Contain text cursor inside block"),info:(0,v.__)("Aids screen readers by stopping text caret from leaving blocks."),messageActivated:(0,v.__)("Contain text cursor inside block activated"),messageDeactivated:(0,v.__)("Contain text cursor inside block deactivated")}),(0,l.createElement)(b.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"themeStyles",info:(0,v.__)("Make the editor look like your theme."),label:(0,v.__)("Use theme styles")}),a&&(0,l.createElement)(b.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"showBlockBreadcrumbs",label:(0,v.__)("Display block breadcrumbs"),info:(0,v.__)("Shows block breadcrumbs at the bottom of the editor."),messageActivated:(0,v.__)("Display block breadcrumbs activated"),messageDeactivated:(0,v.__)("Display block breadcrumbs deactivated")}))))),(0,l.createElement)(ar,{isModalActive:e,toggleModal:r}))}const cr=function(){const e=(0,de.useViewportMatch)("medium"),t=(0,p.useRef)(),{hasFixedToolbar:r}=(0,m.useSelect)((e=>({hasFixedToolbar:!!e(b.store).get("core/edit-widgets","fixedToolbar")})),[]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"edit-widgets-header"},(0,l.createElement)("div",{className:"edit-widgets-header__navigable-toolbar-wrapper"},e&&(0,l.createElement)("h1",{className:"edit-widgets-header__title"},(0,v.__)("Widgets")),!e&&(0,l.createElement)(I.VisuallyHidden,{as:"h1",className:"edit-widgets-header__title"},(0,v.__)("Widgets")),(0,l.createElement)(Yt,null),r&&e&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"selected-block-tools-wrapper"},(0,l.createElement)(we.BlockToolbar,{hideDragHandle:!0})),(0,l.createElement)(I.Popover.Slot,{ref:t,name:"block-toolbar"}))),(0,l.createElement)("div",{className:"edit-widgets-header__actions"},(0,l.createElement)(Kt,null),(0,l.createElement)(oe.Slot,{scope:"core/edit-widgets"}),(0,l.createElement)(sr,null))))};const lr=function(){const{removeNotice:e}=(0,m.useDispatch)(k.store),{notices:t}=(0,m.useSelect)((e=>({notices:e(k.store).getNotices()})),[]),r=t.filter((({isDismissible:e,type:t})=>e&&"default"===t)),a=t.filter((({isDismissible:e,type:t})=>!e&&"default"===t)),n=t.filter((({type:e})=>"snackbar"===e)).slice(-3);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(I.NoticeList,{notices:a,className:"edit-widgets-notices__pinned"}),(0,l.createElement)(I.NoticeList,{notices:r,className:"edit-widgets-notices__dismissible",onRemove:e}),(0,l.createElement)(I.SnackbarList,{notices:n,className:"edit-widgets-notices__snackbar",onRemove:e}))};function dr({blockEditorSettings:e}){const t=(0,m.useSelect)((e=>!!e(b.store).get("core/edit-widgets","themeStyles")),[]),r=(0,de.useViewportMatch)("medium"),a=(0,p.useMemo)((()=>t?e.styles:[]),[e,t]);return(0,l.createElement)("div",{className:"edit-widgets-block-editor"},(0,l.createElement)(lr,null),!r&&(0,l.createElement)(we.BlockToolbar,{hideDragHandle:!0}),(0,l.createElement)(we.BlockTools,null,(0,l.createElement)(yt,null),(0,l.createElement)(we.__unstableEditorStyles,{styles:a,scope:".editor-styles-wrapper"}),(0,l.createElement)(we.BlockSelectionClearer,null,(0,l.createElement)(we.WritingFlow,null,(0,l.createElement)(we.BlockList,{className:"edit-widgets-main-block-list"})))))}const mr=(0,l.createElement)(C.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(C.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"})),ur=()=>{const e=(0,m.useSelect)((e=>{const{getEntityRecord:t}=e(w.store),r=t(Ee,ye,ke());return r?.blocks[0]?.clientId}),[]);return(0,m.useSelect)((t=>{const{getBlockRootClientId:r,getBlockSelectionEnd:a,getBlockOrder:n,getBlockIndex:i}=t(we.store),o=t(nt).__experimentalGetInsertionPoint();if(o.rootClientId)return o;const s=a()||e,c=r(s);return s&&""===c?{rootClientId:s,insertionIndex:n(s).length}:{rootClientId:c,insertionIndex:i(s)+1}}),[e])};function gr(){const e=(0,de.useViewportMatch)("medium","<"),{rootClientId:t,insertionIndex:r}=ur(),{setIsInserterOpened:a}=(0,m.useDispatch)(nt),n=(0,p.useCallback)((()=>a(!1)),[a]),i=e?"div":I.VisuallyHidden,[o,s]=(0,de.__experimentalUseDialog)({onClose:n,focusOnMount:null}),c=(0,p.useRef)();return(0,p.useEffect)((()=>{c.current.focusSearch()}),[]),(0,l.createElement)("div",{ref:o,...s,className:"edit-widgets-layout__inserter-panel"},(0,l.createElement)(i,{className:"edit-widgets-layout__inserter-panel-header"},(0,l.createElement)(I.Button,{icon:mr,onClick:n,label:(0,v.__)("Close block inserter")})),(0,l.createElement)("div",{className:"edit-widgets-layout__inserter-panel-content"},(0,l.createElement)(we.__experimentalLibrary,{showInserterHelpPanel:!0,shouldFocusBlock:e,rootClientId:t,__experimentalInsertionIndex:r,ref:c})))}function pr(){const{setIsListViewOpened:e}=(0,m.useDispatch)(nt),{getListViewToggleRef:t}=rt((0,m.useSelect)(nt)),[r,a]=(0,p.useState)(null),n=(0,de.useFocusOnMount)("firstElement"),i=(0,p.useCallback)((()=>{e(!1),t().current?.focus()}),[t,e]),o=(0,p.useCallback)((e=>{e.keyCode!==Et.ESCAPE||e.defaultPrevented||(e.preventDefault(),i())}),[i]);return(0,l.createElement)("div",{className:"edit-widgets-editor__list-view-panel",onKeyDown:o},(0,l.createElement)("div",{className:"edit-widgets-editor__list-view-panel-header"},(0,l.createElement)("strong",null,(0,v.__)("List View")),(0,l.createElement)(I.Button,{icon:W,label:(0,v.__)("Close"),onClick:i})),(0,l.createElement)("div",{className:"edit-widgets-editor__list-view-panel-content",ref:(0,de.useMergeRefs)([n,a])},(0,l.createElement)(we.__experimentalListView,{dropZoneElement:r})))}function hr(){const{isInserterOpen:e,isListViewOpen:t}=(0,m.useSelect)((e=>{const{isInserterOpened:t,isListViewOpened:r}=e(nt);return{isInserterOpen:t(),isListViewOpen:r()}}),[]);return e?(0,l.createElement)(gr,null):t?(0,l.createElement)(pr,null):null}const wr={header:(0,v.__)("Widgets top bar"),body:(0,v.__)("Widgets and blocks"),sidebar:(0,v.__)("Widgets settings"),footer:(0,v.__)("Widgets footer")};const _r=function({blockEditorSettings:e}){const t=(0,de.useViewportMatch)("medium","<"),r=(0,de.useViewportMatch)("huge",">="),{setIsInserterOpened:a,setIsListViewOpened:n,closeGeneralSidebar:i}=(0,m.useDispatch)(nt),{hasBlockBreadCrumbsEnabled:o,hasSidebarEnabled:s,isInserterOpened:c,isListViewOpened:d,previousShortcut:u,nextShortcut:g}=(0,m.useSelect)((e=>({hasSidebarEnabled:!!e(Z).getActiveComplementaryArea(nt.name),isInserterOpened:!!e(nt).isInserterOpened(),isListViewOpened:!!e(nt).isListViewOpened(),hasBlockBreadCrumbsEnabled:!!e(b.store).get("core/edit-widgets","showBlockBreadcrumbs"),previousShortcut:e(bt.store).getAllShortcutKeyCombinations("core/edit-widgets/previous-region"),nextShortcut:e(bt.store).getAllShortcutKeyCombinations("core/edit-widgets/next-region")})),[]);(0,p.useEffect)((()=>{s&&!r&&(a(!1),n(!1))}),[s,r]),(0,p.useEffect)((()=>{!c&&!d||r||i()}),[c,d,r]);const h=d?(0,v.__)("List View"):(0,v.__)("Block Library"),w=d||c;return(0,l.createElement)(ge,{labels:{...wr,secondarySidebar:h},header:(0,l.createElement)(cr,null),secondarySidebar:w&&(0,l.createElement)(hr,null),sidebar:s&&(0,l.createElement)(le.Slot,{scope:"core/edit-widgets"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(dr,{blockEditorSettings:e})),footer:o&&!t&&(0,l.createElement)("div",{className:"edit-widgets-layout__footer"},(0,l.createElement)(we.BlockBreadcrumb,{rootLabelText:(0,v.__)("Widgets")})),shortcuts:{previous:u,next:g}})};function br(){const e=(0,m.useSelect)((e=>{const{getEditedWidgetAreas:t}=e(nt),r=t();return r?.length>0}),[]);return(0,p.useEffect)((()=>{const t=t=>{if(e)return t.returnValue=(0,v.__)("You have unsaved changes. If you proceed, they will be lost."),t.returnValue};return window.addEventListener("beforeunload",t),()=>{window.removeEventListener("beforeunload",t)}}),[e]),null}function Er(){var e;const t=(0,m.useSelect)((e=>!!e(b.store).get("core/edit-widgets","welcomeGuide")),[]),{toggle:r}=(0,m.useDispatch)(b.store),a=(0,m.useSelect)((e=>e(nt).getWidgetAreas({per_page:-1})),[]);if(!t)return null;const n=a?.every((e=>"wp_inactive_widgets"===e.id||e.widgets.every((e=>e.startsWith("block-"))))),i=null!==(e=a?.filter((e=>"wp_inactive_widgets"!==e.id)).length)&&void 0!==e?e:0;return(0,l.createElement)(I.Guide,{className:"edit-widgets-welcome-guide",contentLabel:(0,v.__)("Welcome to block Widgets"),finishButtonText:(0,v.__)("Get started"),onFinish:()=>r("core/edit-widgets","welcomeGuide"),pages:[{image:(0,l.createElement)(fr,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-canvas.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-canvas.gif"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-widgets-welcome-guide__heading"},(0,v.__)("Welcome to block Widgets")),n?(0,l.createElement)(l.Fragment,null,(0,l.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,v.sprintf)((0,v._n)("Your theme provides %s “block” area for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.","Your theme provides %s 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 they’ll look on your site.",i),i))):(0,l.createElement)(l.Fragment,null,(0,l.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,v.__)("You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.")),(0,l.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,l.createElement)("strong",null,(0,v.__)("Want to stick with the old widgets?"))," ",(0,l.createElement)(I.ExternalLink,{href:(0,v.__)("https://wordpress.org/plugins/classic-widgets/")},(0,v.__)("Get the Classic Widgets plugin.")))))},{image:(0,l.createElement)(fr,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-editor.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-editor.gif"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-widgets-welcome-guide__heading"},(0,v.__)("Make each block your own")),(0,l.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,v.__)("Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.")))},{image:(0,l.createElement)(fr,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-library.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-library.gif"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-widgets-welcome-guide__heading"},(0,v.__)("Get to know the block library")),(0,l.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,p.createInterpolateElement)((0,v.__)("All of the blocks available to you live in the block library. You’ll find it wherever you see the <InserterIconImage /> icon."),{InserterIconImage:(0,l.createElement)("img",{className:"edit-widgets-welcome-guide__inserter-icon",alt:(0,v.__)("inserter"),src:"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A"})})))},{image:(0,l.createElement)(fr,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.gif"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-widgets-welcome-guide__heading"},(0,v.__)("Learn how to use the block editor")),(0,l.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,v.__)("New to the block editor? Want to learn more about using it? "),(0,l.createElement)(I.ExternalLink,{href:(0,v.__)("https://wordpress.org/documentation/article/wordpress-block-editor/")},(0,v.__)("Here's a detailed guide."))))}]})}function fr({nonAnimatedSrc:e,animatedSrc:t}){return(0,l.createElement)("picture",{className:"edit-widgets-welcome-guide__image"},(0,l.createElement)("source",{srcSet:e,media:"(prefers-reduced-motion: reduce)"}),(0,l.createElement)("img",{src:t,width:"312",height:"240",alt:""}))}const yr=function({blockEditorSettings:e}){const{createErrorNotice:t}=(0,m.useDispatch)(k.store);return(0,l.createElement)(wt,null,(0,l.createElement)(It,{blockEditorSettings:e},(0,l.createElement)(_r,{blockEditorSettings:e}),(0,l.createElement)(Dt,null),(0,l.createElement)(q.PluginArea,{onError:function(e){t((0,v.sprintf)((0,v.__)('The "%s" plugin has encountered an error and cannot be rendered.'),e))}}),(0,l.createElement)(br,null),(0,l.createElement)(Er,null)))},vr=["core/more","core/freeform","core/template-part",...kt?[]:["core/block"]];function kr(e,t){const r=document.getElementById(e),a=(0,p.createRoot)(r),n=(0,h.__experimentalGetCoreBlocks)().filter((e=>!(vr.includes(e.name)||e.name.startsWith("core/post")||e.name.startsWith("core/query")||e.name.startsWith("core/site")||e.name.startsWith("core/navigation"))));return(0,m.dispatch)(b.store).setDefaults("core/edit-widgets",{fixedToolbar:!1,welcomeGuide:!0,showBlockBreadcrumbs:!0,themeStyles:!0}),(0,m.dispatch)(d.store).reapplyBlockTypeFilters(),(0,h.registerCoreBlocks)(n),(0,_.registerLegacyWidgetBlock)(),(0,_.registerLegacyWidgetVariations)(t),Ir(c),(0,_.registerWidgetGroupBlock)(),t.__experimentalFetchLinkSuggestions=(e,r)=>(0,w.__experimentalFetchLinkSuggestions)(e,r,t),(0,d.setFreeformContentHandlerName)("core/html"),a.render((0,l.createElement)(yr,{blockEditorSettings:t})),a}const Sr=kr;function Ar(){g()("wp.editWidgets.reinitializeEditor",{since:"6.2",version:"6.3"})}const Ir=e=>{if(!e)return;const{metadata:t,settings:r,name:a}=e;t&&(0,d.unstable__bootstrapServerSideBlockDefinitions)({[a]:t}),(0,d.registerBlockType)(a,r)}})(),(window.wp=window.wp||{}).editWidgets=a})(); \ No newline at end of file