WordPress/wp-includes/js/dist/edit-widgets.min.js

2 lines
59 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

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

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

/*! This file is auto-generated */
(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{initialize:()=>Br,initializeEditor:()=>Nr,reinitializeEditor:()=>Tr,store:()=>ct});var r={};e.r(r),e.d(r,{closeModal:()=>$,disableComplementaryArea:()=>V,enableComplementaryArea:()=>O,openModal:()=>U,pinItem:()=>D,setDefaultComplementaryArea:()=>M,setFeatureDefaults:()=>H,setFeatureValue:()=>z,toggleFeature:()=>G,unpinItem:()=>F});var n={};e.r(n),e.d(n,{getActiveComplementaryArea:()=>Y,isComplementaryAreaLoading:()=>j,isFeatureActive:()=>Z,isItemPinned:()=>K,isModalActive:()=>q});var i={};e.r(i),e.d(i,{closeGeneralSidebar:()=>Ve,moveBlockToWidgetArea:()=>De,persistStubPost:()=>Ne,saveEditedWidgetAreas:()=>Be,saveWidgetArea:()=>xe,saveWidgetAreas:()=>Te,setIsInserterOpened:()=>Me,setIsListViewOpened:()=>Oe,setIsWidgetAreaOpen:()=>Pe,setWidgetAreasOpenState:()=>Re,setWidgetIdForClientId:()=>We});var a={};e.r(a),e.d(a,{getWidgetAreas:()=>Fe,getWidgets:()=>Ge});var o={};e.r(o),e.d(o,{__experimentalGetInsertionPoint:()=>Xe,canInsertBlockInWidgetArea:()=>et,getEditedWidgetAreas:()=>Ke,getIsWidgetAreaOpen:()=>Qe,getParentWidgetAreaBlock:()=>je,getReferenceWidgetBlocks:()=>Ze,getWidget:()=>Ue,getWidgetAreaForWidgetId:()=>Ye,getWidgetAreas:()=>$e,getWidgets:()=>He,isInserterOpened:()=>Je,isListViewOpened:()=>tt,isSavingWidgetAreas:()=>qe});var s={};e.r(s),e.d(s,{getInserterSidebarToggleRef:()=>nt,getListViewToggleRef:()=>rt});var c={};e.r(c),e.d(c,{metadata:()=>ht,name:()=>wt,settings:()=>_t});const l=window.React,d=window.wp.blocks,m=window.wp.data,u=window.wp.deprecated;var g=e.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=e.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},inserterSidebarToggleRef:function(e={current:null}){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},listViewToggleRef:function(e={current:null}){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}}}),v=window.wp.i18n,k=window.wp.notices;function S(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=S(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}const A=function(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=S(e))&&(n&&(n+=" "),n+=t);return n},I=window.wp.components,C=window.wp.primitives,N=(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"})),B=(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"})),T=(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"})),x=window.wp.viewport,L=window.wp.compose,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"}));function R(e){return["core/edit-post","core/edit-site"].includes(e)?(g()(`${e} interface scope`,{alternative:"core interface scope",hint:"core/edit-post and core/edit-site are merging.",version:"6.6"}),"core"):e}function P(e,t){return"core"===e&&"edit-site/template"===t?(g()("edit-site/template sidebar",{alternative:"edit-post/document",version:"6.6"}),"edit-post/document"):"core"===e&&"edit-site/block-inspector"===t?(g()("edit-site/block-inspector sidebar",{alternative:"edit-post/block",version:"6.6"}),"edit-post/block"):t}const M=(e,t)=>({type:"SET_DEFAULT_COMPLEMENTARY_AREA",scope:e=R(e),area:t=P(e,t)}),O=(e,t)=>({registry:r,dispatch:n})=>{if(!t)return;e=R(e),t=P(e,t);r.select(b.store).get(e,"isComplementaryAreaVisible")||r.dispatch(b.store).set(e,"isComplementaryAreaVisible",!0),n({type:"ENABLE_COMPLEMENTARY_AREA",scope:e,area:t})},V=e=>({registry:t})=>{e=R(e);t.select(b.store).get(e,"isComplementaryAreaVisible")&&t.dispatch(b.store).set(e,"isComplementaryAreaVisible",!1)},D=(e,t)=>({registry:r})=>{if(!t)return;e=R(e),t=P(e,t);const n=r.select(b.store).get(e,"pinnedItems");!0!==n?.[t]&&r.dispatch(b.store).set(e,"pinnedItems",{...n,[t]:!0})},F=(e,t)=>({registry:r})=>{if(!t)return;e=R(e),t=P(e,t);const n=r.select(b.store).get(e,"pinnedItems");r.dispatch(b.store).set(e,"pinnedItems",{...n,[t]:!1})};function G(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 z(e,t,r){return function({registry:n}){g()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),n.dispatch(b.store).set(e,t,!!r)}}function H(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 U(e){return{type:"OPEN_MODAL",name:e}}function $(){return{type:"CLOSE_MODAL"}}const Y=(0,m.createRegistrySelector)((e=>(t,r)=>{r=R(r);const n=e(b.store).get(r,"isComplementaryAreaVisible");if(void 0!==n)return!1===n?null:t?.complementaryAreas?.[r]})),j=(0,m.createRegistrySelector)((e=>(t,r)=>{r=R(r);const n=e(b.store).get(r,"isComplementaryAreaVisible"),i=t?.complementaryAreas?.[r];return n&&void 0===i})),K=(0,m.createRegistrySelector)((e=>(t,r,n)=>{var i;n=P(r=R(r),n);const a=e(b.store).get(r,"pinnedItems");return null===(i=a?.[n])||void 0===i||i})),Z=(0,m.createRegistrySelector)((e=>(t,r,n)=>(g()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(b.store).get(r,n))));function q(e,t){return e.activeModal===t}const Q=(0,m.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}}),J=(0,m.createReduxStore)("core/interface",{reducer:Q,actions:r,selectors:n});(0,m.register)(J);const X=window.wp.plugins,ee=(0,X.withPluginContext)(((e,t)=>({icon:t.icon||e.icon,identifier:t.identifier||`${e.name}/${t.name}`})));const te=ee((function({as:e=I.Button,scope:t,identifier:r,icon:n,selectedIcon:i,name:a,...o}){const s=e,c=(0,m.useSelect)((e=>e(J).getActiveComplementaryArea(t)===r),[r,t]),{enableComplementaryArea:d,disableComplementaryArea:u}=(0,m.useDispatch)(J);return(0,l.createElement)(s,{icon:i&&c?i:n,"aria-controls":r.replace("/",":"),onClick:()=>{c?u(t):d(t,r)},...o})})),re=({smallScreenTitle:e,children:t,className:r,toggleButtonProps:n})=>{const i=(0,l.createElement)(te,{icon:W,...n});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"components-panel__header interface-complementary-area-header__small"},e&&(0,l.createElement)("h2",{className:"interface-complementary-area-header__small-title"},e),i),(0,l.createElement)("div",{className:A("components-panel__header","interface-complementary-area-header",r),tabIndex:-1},t,i))},ne=()=>{};function ie({name:e,as:t=I.Button,onClick:r,...n}){return(0,l.createElement)(I.Fill,{name:e},(({onClick:e})=>(0,l.createElement)(t,{onClick:r||e?(...t)=>{(r||ne)(...t),(e||ne)(...t)}:void 0,...n})))}ie.Slot=function({name:e,as:t=I.ButtonGroup,fillProps:r={},bubblesVirtually:n,...i}){return(0,l.createElement)(I.Slot,{name:e,bubblesVirtually:n,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 n=p.Children.map(e,(e=>!e.props.__unstableExplicitMenuItem&&r.includes(e.props.__unstableTarget)?null:e));return(0,l.createElement)(t,{...i},n)}))};const ae=ie,oe=({__unstableExplicitMenuItem:e,__unstableTarget:t,...r})=>(0,l.createElement)(I.MenuItem,{...r});function se({scope:e,target:t,__unstableExplicitMenuItem:r,...n}){return(0,l.createElement)(te,{as:n=>(0,l.createElement)(ae,{__unstableExplicitMenuItem:r,__unstableTarget:`${e}/${t}`,as:oe,name:`${e}/plugin-more-menu`,...n}),role:"menuitemcheckbox",selectedIcon:N,name:t,scope:e,...n})}function ce({scope:e,...t}){return(0,l.createElement)(I.Fill,{name:`PinnedItems/${e}`,...t})}ce.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 le=ce,de=.3;const me=280,ue={open:{width:me},closed:{width:0},mobileOpen:{width:"100vw"}};function ge({activeArea:e,isActive:t,scope:r,children:n,className:i,id:a}){const o=(0,L.useReducedMotion)(),s=(0,L.useViewportMatch)("medium","<"),c=(0,L.usePrevious)(e),d=(0,L.usePrevious)(t),[,m]=(0,p.useState)({});(0,p.useEffect)((()=>{m({})}),[t]);const u={type:"tween",duration:o||s||c&&e&&e!==c?0:de,ease:[.6,0,.4,1]};return(0,l.createElement)(I.Fill,{name:`ComplementaryArea/${r}`},(0,l.createElement)(I.__unstableAnimatePresence,{initial:!1},(d||t)&&(0,l.createElement)(I.__unstableMotion.div,{variants:ue,initial:"closed",animate:s?"mobileOpen":"open",exit:"closed",transition:u,className:"interface-complementary-area__fill"},(0,l.createElement)("div",{id:a,className:i,style:{width:s?"100vw":me}},n))))}const pe=ee((function({children:e,className:t,closeLabel:r=(0,v.__)("Close plugin"),identifier:n,header:i,headerClassName:a,icon:o,isPinnable:s=!0,panelClassName:c,scope:d,name:u,smallScreenTitle:g,title:h,toggleShortcut:w,isActiveByDefault:_}){const[E,f]=(0,p.useState)(!1),{isLoading:y,isActive:k,isPinned:S,activeArea:C,isSmall:L,isLarge:W,showIconLabels:R}=(0,m.useSelect)((e=>{const{getActiveComplementaryArea:t,isComplementaryAreaLoading:r,isItemPinned:i}=e(J),{get:a}=e(b.store),o=t(d);return{isLoading:r(d),isActive:o===n,isPinned:i(d,n),activeArea:o,isSmall:e(x.store).isViewportMatch("< medium"),isLarge:e(x.store).isViewportMatch("large"),showIconLabels:a("core","showIconLabels")}}),[n,d]);!function(e,t,r,n,i){const a=(0,p.useRef)(!1),o=(0,p.useRef)(!1),{enableComplementaryArea:s,disableComplementaryArea:c}=(0,m.useDispatch)(J);(0,p.useEffect)((()=>{n&&i&&!a.current?(c(e),o.current=!0):o.current&&!i&&a.current?(o.current=!1,s(e,t)):o.current&&r&&r!==t&&(o.current=!1),i!==a.current&&(a.current=i)}),[n,i,e,t,r,c,s])}(d,n,C,k,L);const{enableComplementaryArea:P,disableComplementaryArea:M,pinItem:O,unpinItem:V}=(0,m.useDispatch)(J);if((0,p.useEffect)((()=>{_&&void 0===C&&!L?P(d,n):void 0===C&&L&&M(d,n),f(!0)}),[C,_,d,n,L,P,M]),E)return(0,l.createElement)(l.Fragment,null,s&&(0,l.createElement)(le,{scope:d},S&&(0,l.createElement)(te,{scope:d,identifier:n,isPressed:k&&(!R||W),"aria-expanded":k,"aria-disabled":y,label:h,icon:R?N:o,showTooltip:!R,variant:R?"tertiary":void 0,size:"compact"})),u&&s&&(0,l.createElement)(se,{target:u,scope:d,icon:o},h),(0,l.createElement)(ge,{activeArea:C,isActive:k,className:A("interface-complementary-area",t),scope:d,id:n.replace("/",":")},(0,l.createElement)(re,{className:a,closeLabel:r,onClose:()=>M(d),smallScreenTitle:g,toggleButtonProps:{label:r,size:"small",shortcut:w,scope:d,identifier:n}},i||(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h2",{className:"interface-complementary-area-header__title"},h),s&&(0,l.createElement)(I.Button,{className:"interface-complementary-area__pin-unpin-item",icon:S?B:T,label:S?(0,v.__)("Unpin from toolbar"):(0,v.__)("Pin to toolbar"),onClick:()=>(S?V:O)(d,n),isPressed:S,"aria-expanded":S,size:"compact"}))),(0,l.createElement)(I.Panel,{className:c},e)))}));pe.Slot=function({scope:e,...t}){return(0,l.createElement)(I.Slot,{name:`ComplementaryArea/${e}`,...t})};const he=pe;function we({children:e,className:t,ariaLabel:r,as:n="div",...i}){return(0,l.createElement)(n,{className:A("interface-navigable-region",t),"aria-label":r,role:"region",tabIndex:"-1",...i},e)}const _e={hidden:{opacity:0},hover:{opacity:1,transition:{type:"tween",delay:.2,delayChildren:.2}},distractionFreeInactive:{opacity:1,transition:{delay:0}}};const be=(0,p.forwardRef)((function({isDistractionFree:e,footer:t,header:r,editorNotices:n,sidebar:i,secondarySidebar:a,notices:o,content:s,actions:c,labels:d,className:m,enableRegionNavigation:u=!0,shortcuts:g},h){const[w,_]=(0,L.useResizeObserver)(),b=(0,L.useViewportMatch)("medium","<"),E={type:"tween",duration:(0,L.useReducedMotion)()?0:.25,ease:[.6,0,.4,1]},f=(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 y={...{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?f:{},ref:(0,L.useMergeRefs)([h,u?f.ref:void 0]),className:A(m,"interface-interface-skeleton",f.className,!!t&&"has-footer")},(0,l.createElement)("div",{className:"interface-interface-skeleton__editor"},!!r&&(0,l.createElement)(we,{as:I.__unstableMotion.div,className:"interface-interface-skeleton__header","aria-label":y.header,initial:e?"hidden":"distractionFreeInactive",whileHover:e?"hover":"distractionFreeInactive",animate:e?"hidden":"distractionFreeInactive",variants:_e,transition:e?{type:"tween",delay:.8}:void 0},r),e&&(0,l.createElement)("div",{className:"interface-interface-skeleton__header"},n),(0,l.createElement)("div",{className:"interface-interface-skeleton__body"},(0,l.createElement)(I.__unstableAnimatePresence,{initial:!1},!!a&&(0,l.createElement)(we,{className:"interface-interface-skeleton__secondary-sidebar",ariaLabel:y.secondarySidebar,as:I.__unstableMotion.div,initial:"closed",animate:b?"mobileOpen":"open",exit:"closed",variants:{open:{width:_.width},closed:{width:0},mobileOpen:{width:"100vw"}},transition:E},(0,l.createElement)("div",{style:{position:"absolute",width:b?"100vw":"fit-content",height:"100%",right:0}},w,a))),!!o&&(0,l.createElement)("div",{className:"interface-interface-skeleton__notices"},o),(0,l.createElement)(we,{className:"interface-interface-skeleton__content",ariaLabel:y.body},s),!!i&&(0,l.createElement)(we,{className:"interface-interface-skeleton__sidebar",ariaLabel:y.sidebar},i),!!c&&(0,l.createElement)(we,{className:"interface-interface-skeleton__actions",ariaLabel:y.actions},c))),!!t&&(0,l.createElement)(we,{className:"interface-interface-skeleton__footer",ariaLabel:y.footer},t))})),Ee=window.wp.blockEditor;function fe(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 ye(e,t={}){let r;var n,i,a;"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!==(i=e.attributes.idBase)&&void 0!==i?i:t.id_base,instance:null!==(a=e.attributes.instance)&&void 0!==a?a:t.instance}:r={...t,id_base:"block",instance:{raw:{content:(0,d.serialize)(e)}}};return delete r.rendered,delete r.rendered_form,r}const ve="root",ke="sidebar",Se="postType",Ae=e=>`widget-area-${e}`,Ie=()=>"widget-areas";const Ce="core/edit-widgets",Ne=(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(w.store).receiveEntityRecords(ve,Se,n,{id:n.id},!1),n},Be=()=>async({select:e,dispatch:t,registry:r})=>{const n=e.getEditedWidgetAreas();if(n?.length)try{await t.saveWidgetAreas(n),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"})}},Te=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",ve,ke,{per_page:-1})}},xe=e=>async({dispatch:t,select:r,registry:n})=>{const i=r.getWidgets(),a=n.select(w.store).getEditedEntityRecord(ve,Se,Ae(e)),o=Object.values(i).filter((({sidebar:t})=>t===e)),s=[],c=a.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],a=(0,_.getWidgetIdFromBlock)(r),o=i[a],s=ye(r,o);if(u.push(a),o){n.dispatch(w.store).editEntityRecord("root","widget",a,{...s,sidebar:e},{undoIgnore:!0});if(!n.select(w.store).hasEditsForEntityRecord("root","widget",a))continue;m.push((({saveEditedEntityRecord:e})=>e("root","widget",a)))}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 n.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:i}=d[e];a.blocks[i].attributes.__internalWidgetId=t.id;n.select(w.store).getLastEntitySaveError("root","widget",t.id)&&p.push(r.attributes?.name||r?.name),u[i]||(u[i]=t.id)}if(p.length)throw new Error((0,v.sprintf)((0,v.__)("Could not save the following widgets: %s."),p.join(", ")));n.dispatch(w.store).editEntityRecord(ve,ke,e,{widgets:u},{undoIgnore:!0}),t(Le(e)),n.dispatch(w.store).receiveEntityRecords(ve,Se,a,void 0)},Le=e=>({registry:t})=>{t.dispatch(w.store).saveEditedEntityRecord(ve,ke,e,{throwOnError:!0})};function We(e,t){return{type:"SET_WIDGET_ID_FOR_CLIENT_ID",clientId:e,widgetId:t}}function Re(e){return{type:"SET_WIDGET_AREAS_OPEN_STATE",widgetAreasOpenState:e}}function Pe(e,t){return{type:"SET_IS_WIDGET_AREA_OPEN",clientId:e,isOpen:t}}function Me(e){return{type:"SET_IS_INSERTER_OPENED",value:e}}function Oe(e){return{type:"SET_IS_LIST_VIEW_OPENED",isOpen:e}}const Ve=()=>({registry:e})=>{e.dispatch(J).disableComplementaryArea(Ce)},De=(e,t)=>async({dispatch:r,select:n,registry:i})=>{const a=i.select(Ee.store).getBlockRootClientId(e),o=i.select(Ee.store).getBlocks().find((({attributes:e})=>e.id===t)).clientId,s=i.select(Ee.store).getBlockOrder(o).length;n.getIsWidgetAreaOpen(o)||r.setIsWidgetAreaOpen(o,!0),i.dispatch(Ee.store).moveBlocksToPosition([e],a,o,s)},Fe=()=>async({dispatch:e,registry:t})=>{const r={per_page:-1},n=[],i=(await t.resolveSelect(w.store).getEntityRecords(ve,ke,r)).sort(((e,t)=>"wp_inactive_widgets"===e.id?1:"wp_inactive_widgets"===t.id?-1:0));for(const t of i)n.push((0,d.createBlock)("core/widget-area",{id:t.id,name:t.name})),t.widgets.length||e(Ne(Ae(t.id),[]));const a={};n.forEach(((e,t)=>{a[e.clientId]=0===t})),e(Re(a)),e(Ne(Ie(),n))},Ge=()=>async({dispatch:e,registry:t})=>{const r={per_page:-1,_embed:"about"},n=await t.resolveSelect(w.store).getEntityRecords("root","widget",r),i={};for(const e of n){const t=fe(e);i[e.sidebar]=i[e.sidebar]||[],i[e.sidebar].push(t)}for(const t in i)i.hasOwnProperty(t)&&e(Ne(Ae(t),i[t]))},ze={rootClientId:void 0,insertionIndex:void 0},He=(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})),{})||{}})),Ue=(0,m.createRegistrySelector)((e=>(t,r)=>e(Ce).getWidgets()[r])),$e=(0,m.createRegistrySelector)((e=>()=>{const t={per_page:-1};return e(w.store).getEntityRecords(ve,ke,t)})),Ye=(0,m.createRegistrySelector)((e=>(t,r)=>e(Ce).getWidgetAreas().find((t=>e(w.store).getEditedEntityRecord(ve,Se,Ae(t.id)).blocks.map((e=>(0,_.getWidgetIdFromBlock)(e))).includes(r))))),je=(0,m.createRegistrySelector)((e=>(t,r)=>{const{getBlock:n,getBlockName:i,getBlockParents:a}=e(Ee.store);return n(a(r).find((e=>"core/widget-area"===i(e))))})),Ke=(0,m.createRegistrySelector)((e=>(t,r)=>{let n=e(Ce).getWidgetAreas();return n?(r&&(n=n.filter((({id:e})=>r.includes(e)))),n.filter((({id:t})=>e(w.store).hasEditsForEntityRecord(ve,Se,Ae(t)))).map((({id:t})=>e(w.store).getEditedEntityRecord(ve,ke,t)))):[]})),Ze=(0,m.createRegistrySelector)((e=>(t,r=null)=>{const n=[],i=e(Ce).getWidgetAreas();for(const t of i){const i=e(w.store).getEditedEntityRecord(ve,Se,Ae(t.id));for(const e of i.blocks)"core/legacy-widget"!==e.name||r&&e.attributes?.referenceWidgetName!==r||n.push(e)}return n})),qe=(0,m.createRegistrySelector)((e=>()=>{const t=e(Ce).getWidgetAreas()?.map((({id:e})=>e));if(!t)return!1;for(const r of t){if(e(w.store).isSavingEntityRecord(ve,ke,r))return!0}const r=[...Object.keys(e(Ce).getWidgets()),void 0];for(const t of r){if(e(w.store).isSavingEntityRecord("root","widget",t))return!0}return!1})),Qe=(e,t)=>{const{widgetAreasOpenState:r}=e;return!!r[t]};function Je(e){return!!e.blockInserterPanel}function Xe(e){return"boolean"==typeof e.blockInserterPanel?ze:e.blockInserterPanel}const et=(0,m.createRegistrySelector)((e=>(t,r)=>{const n=e(Ee.store).getBlocks(),[i]=n;return e(Ee.store).canInsertBlockType(r,i.clientId)}));function tt(e){return e.listViewPanel}function rt(e){return e.listViewToggleRef}function nt(e){return e.inserterSidebarToggleRef}const it=window.wp.privateApis,{lock:at,unlock:ot}=(0,it.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.","@wordpress/edit-widgets"),st={reducer:y,selectors:o,resolvers:a,actions:i},ct=(0,m.createReduxStore)(Ce,st);(0,m.register)(ct),f().use((function(e,t){return 0===e.path?.indexOf("/wp/v2/types/widget-area")?Promise.resolve({}):t(e)})),ot(ct).registerPrivateSelectors(s);const lt=window.wp.hooks,dt=(0,L.createHigherOrderComponent)((e=>t=>{const{clientId:r,name:n}=t,{widgetAreas:i,currentWidgetAreaId:a,canInsertBlockInWidgetArea:o}=(0,m.useSelect)((e=>{if("core/widget-area"===n)return{};const t=e(ct),i=t.getParentWidgetAreaBlock(r);return{widgetAreas:t.getWidgetAreas(),currentWidgetAreaId:i?.attributes?.id,canInsertBlockInWidgetArea:t.canInsertBlockInWidgetArea(n)}}),[r,n]),{moveBlockToWidgetArea:s}=(0,m.useDispatch)(ct),c="core/widget-area"!==n&&i?.length>1&&o;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(e,{...t}),c&&(0,l.createElement)(Ee.BlockControls,null,(0,l.createElement)(_.MoveToWidgetArea,{widgetAreas:i,currentWidgetAreaId:a,onSelect:e=>{s(t.clientId,e)}})))}),"withMoveToWidgetAreaToolbarItem");(0,lt.addFilter)("editor.BlockEdit","core/edit-widgets/block-edit",dt);const mt=window.wp.mediaUtils;(0,lt.addFilter)("editor.MediaUpload","core/edit-widgets/replace-media-upload",(()=>mt.MediaUpload));const ut=e=>{const[t,r]=(0,p.useState)(!1);return(0,p.useEffect)((()=>{const{ownerDocument:t}=e.current;function n(e){a(e)}function i(){r(!1)}function a(t){e.current.contains(t.target)?r(!0):r(!1)}return t.addEventListener("dragstart",n),t.addEventListener("dragend",i),t.addEventListener("dragenter",a),()=>{t.removeEventListener("dragstart",n),t.removeEventListener("dragend",i),t.removeEventListener("dragenter",a)}}),[]),t};function gt({id:e}){const[t,r,n]=(0,w.useEntityBlockEditor)("root","postType"),i=(0,p.useRef)(),a=ut(i),o=(0,Ee.useInnerBlocksProps)({ref:i},{value:t,onInput:r,onChange:n,templateLock:!1,renderAppender:Ee.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":a})},(0,l.createElement)("div",{...o}))}const pt=e=>{const[t,r]=(0,p.useState)(!1);return(0,p.useEffect)((()=>{const{ownerDocument:t}=e.current;function n(){r(!0)}function i(){r(!1)}return t.addEventListener("dragstart",n),t.addEventListener("dragend",i),()=>{t.removeEventListener("dragstart",n),t.removeEventListener("dragend",i)}}),[]),t},ht={$schema:"https://schemas.wp.org/trunk/block.json",name:"core/widget-area",title:"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:wt}=ht,_t={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:n}}){const i=(0,m.useSelect)((t=>t(ct).getIsWidgetAreaOpen(e)),[e]),{setIsWidgetAreaOpen:a}=(0,m.useDispatch)(ct),o=(0,p.useRef)(),s=(0,p.useCallback)((t=>a(e,t)),[e]),c=pt(o),d=ut(o),[u,g]=(0,p.useState)(!1);return(0,p.useEffect)((()=>{c?d&&!i?(s(!0),g(!0)):!d&&i&&u&&s(!1):g(!1)}),[i,c,d,u]),(0,l.createElement)(I.Panel,{className:t,ref:o},(0,l.createElement)(I.PanelBody,{title:n,opened:i,onToggle:()=>{a(e,!i)},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)(gt,{id:r}))))))}};function bt({text:e,children:t}){const r=(0,L.useCopyToClipboard)(e);return(0,l.createElement)(I.Button,{variant:"secondary",ref:r},t)}function Et({message:e,error:t}){const r=[(0,l.createElement)(bt,{key:"copy-error",text:t.stack},(0,v.__)("Copy Error"))];return(0,l.createElement)(Ee.Warning,{className:"edit-widgets-error-boundary",actions:r},e)}class ft extends p.Component{constructor(){super(...arguments),this.state={error:null}}componentDidCatch(e){(0,lt.doAction)("editor.ErrorBoundary.errorLogged",e)}static getDerivedStateFromError(e){return{error:e}}render(){return this.state.error?(0,l.createElement)(Et,{message:(0,v.__)("The editor has encountered an unexpected error."),error:this.state.error}):this.props.children}}const yt=window.wp.patterns,vt=window.wp.keyboardShortcuts,kt=window.wp.keycodes;function St(){const{redo:e,undo:t}=(0,m.useDispatch)(w.store),{saveEditedWidgetAreas:r}=(0,m.useDispatch)(ct);return(0,vt.useShortcut)("core/edit-widgets/undo",(e=>{t(),e.preventDefault()})),(0,vt.useShortcut)("core/edit-widgets/redo",(t=>{e(),t.preventDefault()})),(0,vt.useShortcut)("core/edit-widgets/save",(e=>{e.preventDefault(),r()})),null}St.Register=function(){const{registerShortcut:e}=(0,m.useDispatch)(vt.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,kt.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]),null};const At=St,It=()=>(0,m.useSelect)((e=>{const{getBlockSelectionEnd:t,getBlockName:r}=e(Ee.store),n=t();if("core/widget-area"===r(n))return n;const{getParentWidgetAreaBlock:i}=e(ct),a=i(n),o=a?.clientId;if(o)return o;const{getEntityRecord:s}=e(w.store),c=s(ve,Se,Ie());return c?.blocks[0]?.clientId}),[]),Ct=!1,{ExperimentalBlockEditorProvider:Nt}=ot(Ee.privateApis),{PatternsMenuItems:Bt}=ot(yt.privateApis),{BlockKeyboardShortcuts:Tt}=ot(h.privateApis);function xt({blockEditorSettings:e,children:t,...r}){const n=(0,w.useResourcePermissions)("media"),i=(0,L.useViewportMatch)("medium"),{reusableBlocks:a,isFixedToolbarActive:o,keepCaretInsideBlock:s,pageOnFront:c,pageForPosts:d}=(0,m.useSelect)((e=>{const{canUser:t,getEntityRecord:r,getEntityRecords:n}=e(w.store),i=t("read","settings")?r("root","site"):void 0;return{widgetAreas:e(ct).getWidgetAreas(),widgets:e(ct).getWidgets(),reusableBlocks:Ct?n("postType","wp_block"):[],isFixedToolbarActive:!!e(b.store).get("core/edit-widgets","fixedToolbar"),keepCaretInsideBlock:!!e(b.store).get("core/edit-widgets","keepCaretInsideBlock"),pageOnFront:i?.page_on_front,pageForPosts:i?.page_for_posts}}),[]),{setIsInserterOpened:u}=(0,m.useDispatch)(ct),g=(0,p.useMemo)((()=>{let t;return n.canCreate&&(t=({onError:t,...r})=>{(0,mt.uploadMedia)({wpAllowedMimeTypes:e.allowedMimeTypes,onError:({message:e})=>t(e),...r})}),{...e,__experimentalReusableBlocks:a,hasFixedToolbar:o||!i,keepCaretInsideBlock:s,mediaUpload:t,templateLock:"all",__experimentalSetIsInserterOpened:u,pageOnFront:c,pageForPosts:d}}),[e,o,i,s,n.canCreate,a,u,c,d]),h=It(),[_,E,f]=(0,w.useEntityBlockEditor)(ve,Se,{id:Ie()});return(0,l.createElement)(I.SlotFillProvider,null,(0,l.createElement)(At.Register,null),(0,l.createElement)(Tt,null),(0,l.createElement)(Nt,{value:_,onInput:E,onChange:f,settings:g,useSubRegistry:!1,...r},t,(0,l.createElement)(Bt,{rootClientId:h})))}const Lt=(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"})),Wt=(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"})),Rt=(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"})),Pt=window.wp.url,Mt=window.wp.dom;function Ot({selectedWidgetAreaId:e}){const t=(0,m.useSelect)((e=>e(ct).getWidgetAreas()),[]),r=(0,p.useMemo)((()=>e&&t?.find((t=>t.id===e))),[e,t]);let n;return n=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 sites 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)(Ee.BlockIcon,{icon:Rt}),(0,l.createElement)("div",null,(0,l.createElement)("p",{dangerouslySetInnerHTML:{__html:(0,Mt.safeHTML)(n)}}),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,Pt.addQueryArgs)("customize.php",{"autofocus[panel]":"widgets",return:window.location.pathname}),variant:"tertiary"},(0,v.__)("Manage with live preview")))))}const Vt=p.Platform.select({web:!0,native:!1}),Dt="edit-widgets/block-inspector",Ft="edit-widgets/block-areas",{Tabs:Gt}=ot(I.privateApis);function zt({selectedWidgetAreaBlock:e}){return(0,l.createElement)(Gt.TabList,null,(0,l.createElement)(Gt.Tab,{tabId:Ft},e?e.attributes.name:(0,v.__)("Widget Areas")),(0,l.createElement)(Gt.Tab,{tabId:Dt},(0,v.__)("Block")))}function Ht({hasSelectedNonAreaBlock:e,currentArea:t,isGeneralSidebarOpen:r,selectedWidgetAreaBlock:n}){const{enableComplementaryArea:i}=(0,m.useDispatch)(J);(0,p.useEffect)((()=>{e&&t===Ft&&r&&i("core/edit-widgets",Dt),!e&&t===Dt&&r&&i("core/edit-widgets",Ft)}),[e,i]);const a=(0,p.useContext)(Gt.Context);return(0,l.createElement)(he,{className:"edit-widgets-sidebar",header:(0,l.createElement)(Gt.Context.Provider,{value:a},(0,l.createElement)(zt,{selectedWidgetAreaBlock:n})),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)()?Lt:Wt,isActiveByDefault:Vt},(0,l.createElement)(Gt.Context.Provider,{value:a},(0,l.createElement)(Gt.TabPanel,{tabId:Ft,focusable:!1},(0,l.createElement)(Ot,{selectedWidgetAreaId:n?.attributes.id})),(0,l.createElement)(Gt.TabPanel,{tabId:Dt,focusable:!1},e?(0,l.createElement)(Ee.BlockInspector,null):(0,l.createElement)("span",{className:"block-editor-block-inspector__no-blocks"},(0,v.__)("No block selected.")))))}function Ut(){const{currentArea:e,hasSelectedNonAreaBlock:t,isGeneralSidebarOpen:r,selectedWidgetAreaBlock:n}=(0,m.useSelect)((e=>{const{getSelectedBlock:t,getBlock:r,getBlockParentsByBlockName:n}=e(Ee.store),{getActiveComplementaryArea:i}=e(J),a=t(),o=i(ct.name);let s,c=o;return c||(c=a?Dt:Ft),a&&(s="core/widget-area"===a.name?a:r(n(a.clientId,"core/widget-area")[0])),{currentArea:c,hasSelectedNonAreaBlock:!(!a||"core/widget-area"===a.name),isGeneralSidebarOpen:!!o,selectedWidgetAreaBlock:s}}),[]),{enableComplementaryArea:i}=(0,m.useDispatch)(J),a=(0,p.useCallback)((e=>{e&&i(ct.name,e)}),[i]);return(0,l.createElement)(Gt,{selectedTabId:r?e:null,onSelect:a,selectOnMove:!1},(0,l.createElement)(Ht,{hasSelectedNonAreaBlock:t,currentArea:e,isGeneralSidebarOpen:r,selectedWidgetAreaBlock:n}))}const $t=(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"})),Yt=(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"})),jt=(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"})),Kt=(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 Zt=(0,p.forwardRef)((function(e,t){const r=(0,m.useSelect)((e=>e(w.store).hasUndo()),[]),{undo:n}=(0,m.useDispatch)(w.store);return(0,l.createElement)(I.Button,{...e,ref:t,icon:(0,v.isRTL)()?Kt:jt,label:(0,v.__)("Undo"),shortcut:kt.displayShortcut.primary("z"),"aria-disabled":!r,onClick:r?n:void 0,size:"compact"})}));const qt=(0,p.forwardRef)((function(e,t){const r=(0,kt.isAppleOS)()?kt.displayShortcut.primaryShift("z"):kt.displayShortcut.primary("y"),n=(0,m.useSelect)((e=>e(w.store).hasRedo()),[]),{redo:i}=(0,m.useDispatch)(w.store);return(0,l.createElement)(I.Button,{...e,ref:t,icon:(0,v.isRTL)()?jt:Kt,label:(0,v.__)("Redo"),shortcut:r,"aria-disabled":!n,onClick:n?i:void 0,size:"compact"})}));const Qt=function(){const e=(0,L.useViewportMatch)("medium"),{isInserterOpen:t,isListViewOpen:r,inserterSidebarToggleRef:n,listViewToggleRef:i}=(0,m.useSelect)((e=>{const{isInserterOpened:t,getInserterSidebarToggleRef:r,isListViewOpened:n,getListViewToggleRef:i}=ot(e(ct));return{isInserterOpen:t(),isListViewOpen:n(),inserterSidebarToggleRef:r(),listViewToggleRef:i()}}),[]),{setIsInserterOpened:a,setIsListViewOpened:o}=(0,m.useDispatch)(ct),s=(0,p.useCallback)((()=>o(!r)),[o,r]),c=(0,p.useCallback)((()=>a(!t)),[a,t]);return(0,l.createElement)(Ee.NavigableToolbar,{className:"edit-widgets-header-toolbar","aria-label":(0,v.__)("Document tools"),variant:"unstyled"},(0,l.createElement)(I.ToolbarItem,{ref:n,as:I.Button,className:"edit-widgets-header-toolbar__inserter-toggle",variant:"primary",isPressed:t,onMouseDown:e=>{e.preventDefault()},onClick:c,icon:$t,label:(0,v._x)("Toggle block inserter","Generic label for block inserter button"),size:"compact"}),e&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(I.ToolbarItem,{as:Zt}),(0,l.createElement)(I.ToolbarItem,{as:qt}),(0,l.createElement)(I.ToolbarItem,{as:I.Button,className:"edit-widgets-header-toolbar__list-view-toggle",icon:Yt,isPressed:r,label:(0,v.__)("List View"),onClick:s,ref:i,size:"compact"})))};const Jt=function(){const{hasEditedWidgetAreaIds:e,isSaving:t}=(0,m.useSelect)((e=>{const{getEditedWidgetAreas:t,isSavingWidgetAreas:r}=e(ct);return{hasEditedWidgetAreaIds:t()?.length>0,isSaving:r()}}),[]),{saveEditedWidgetAreas:r}=(0,m.useDispatch)(ct),n=t||!e;return(0,l.createElement)(I.Button,{variant:"primary",isBusy:t,"aria-disabled":n,onClick:n?void 0:r,size:"compact"},t?(0,v.__)("Saving…"):(0,v.__)("Update"))},Xt=(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"})),er=(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"})),tr=[{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"},aliases:[{modifier:"access",character:"7"}],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.")},{keyCombination:{modifier:"primaryShift",character:"SPACE"},description:(0,v.__)("Add non breaking space.")}];function rr({keyCombination:e,forceAriaLabel:t}){const r=e.modifier?kt.displayShortcutList[e.modifier](e.character):e.character,n=e.modifier?kt.shortcutAriaLabel[e.modifier](e.character):e.character,i=Array.isArray(r)?r:[r];return(0,l.createElement)("kbd",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":t||n},i.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 nr=function({description:e,keyCombination:t,aliases:r=[],ariaLabel:n}){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)(rr,{keyCombination:t,forceAriaLabel:n}),r.map(((e,t)=>(0,l.createElement)(rr,{keyCombination:e,forceAriaLabel:n,key:t})))))};const ir=function({name:e}){const{keyCombination:t,description:r,aliases:n}=(0,m.useSelect)((t=>{const{getShortcutKeyCombination:r,getShortcutDescription:n,getShortcutAliases:i}=t(vt.store);return{keyCombination:r(e),aliases:i(e),description:n(e)}}),[e]);return t?(0,l.createElement)(nr,{keyCombination:t,description:r,aliases:n}):null},ar=({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)(ir,{name:e}):(0,l.createElement)(nr,{...e}))))),or=({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)(ar,{shortcuts:t})),sr=({title:e,categoryName:t,additionalShortcuts:r=[]})=>{const n=(0,m.useSelect)((e=>e(vt.store).getCategoryShortcuts(t)),[t]);return(0,l.createElement)(or,{title:e,shortcuts:n.concat(r)})};function cr({isModalActive:e,toggleModal:t}){return(0,vt.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)(or,{className:"edit-widgets-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/edit-widgets/keyboard-shortcuts"]}),(0,l.createElement)(sr,{title:(0,v.__)("Global shortcuts"),categoryName:"global"}),(0,l.createElement)(sr,{title:(0,v.__)("Selection shortcuts"),categoryName:"selection"}),(0,l.createElement)(sr,{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)(or,{title:(0,v.__)("Text formatting"),shortcuts:tr}),(0,l.createElement)(sr,{title:(0,v.__)("List View shortcuts"),categoryName:"list-view"})):null}const{Fill:lr,Slot:dr}=(0,I.createSlotFill)("EditWidgetsToolsMoreMenuGroup");lr.Slot=({fillProps:e})=>(0,l.createElement)(dr,{fillProps:e},(e=>e.length>0&&e));const mr=lr;function ur(){const[e,t]=(0,p.useState)(!1),r=()=>t(!e);(0,vt.useShortcut)("core/edit-widgets/keyboard-shortcuts",r);const n=(0,L.useViewportMatch)("medium");return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(I.DropdownMenu,{icon:Xt,label:(0,v.__)("Options"),popoverProps:{placement:"bottom-end",className:"more-menu-dropdown__content"},toggleProps:{tooltipPosition:"bottom",size:"compact"}},(e=>(0,l.createElement)(l.Fragment,null,n&&(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:kt.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:er,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)(mr.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")}),n&&(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)(cr,{isModalActive:e,toggleModal:r}))}const gr=function(){const e=(0,L.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)(Qt,null),r&&e&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"selected-block-tools-wrapper"},(0,l.createElement)(Ee.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)(Jt,null),(0,l.createElement)(le.Slot,{scope:"core/edit-widgets"}),(0,l.createElement)(ur,null))))};const pr=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)),n=t.filter((({isDismissible:e,type:t})=>!e&&"default"===t)),i=t.filter((({type:e})=>"snackbar"===e)).slice(-3);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(I.NoticeList,{notices:n,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:i,className:"edit-widgets-notices__snackbar",onRemove:e}))};function hr({blockEditorSettings:e}){const t=(0,m.useSelect)((e=>!!e(b.store).get("core/edit-widgets","themeStyles")),[]),r=(0,L.useViewportMatch)("medium"),n=(0,p.useMemo)((()=>t?e.styles:[]),[e,t]);return(0,l.createElement)("div",{className:"edit-widgets-block-editor"},(0,l.createElement)(pr,null),!r&&(0,l.createElement)(Ee.BlockToolbar,{hideDragHandle:!0}),(0,l.createElement)(Ee.BlockTools,null,(0,l.createElement)(At,null),(0,l.createElement)(Ee.__unstableEditorStyles,{styles:n,scope:".editor-styles-wrapper"}),(0,l.createElement)(Ee.BlockSelectionClearer,null,(0,l.createElement)(Ee.WritingFlow,null,(0,l.createElement)(Ee.BlockList,{className:"edit-widgets-main-block-list"})))))}const wr=(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"})),_r=()=>{const e=(0,m.useSelect)((e=>{const{getEntityRecord:t}=e(w.store),r=t(ve,Se,Ie());return r?.blocks[0]?.clientId}),[]);return(0,m.useSelect)((t=>{const{getBlockRootClientId:r,getBlockSelectionEnd:n,getBlockOrder:i,getBlockIndex:a}=t(Ee.store),o=t(ct).__experimentalGetInsertionPoint();if(o.rootClientId)return o;const s=n()||e,c=r(s);return s&&""===c?{rootClientId:s,insertionIndex:i(s).length}:{rootClientId:c,insertionIndex:a(s)+1}}),[e])};function br(){const e=(0,L.useViewportMatch)("medium","<"),{rootClientId:t,insertionIndex:r}=_r(),{setIsInserterOpened:n}=(0,m.useDispatch)(ct),i=(0,p.useCallback)((()=>n(!1)),[n]),a=e?"div":I.VisuallyHidden,[o,s]=(0,L.__experimentalUseDialog)({onClose:i,focusOnMount:!0}),c=(0,p.useRef)();return(0,l.createElement)("div",{ref:o,...s,className:"edit-widgets-layout__inserter-panel"},(0,l.createElement)(a,{className:"edit-widgets-layout__inserter-panel-header"},(0,l.createElement)(I.Button,{icon:wr,onClick:i,label:(0,v.__)("Close block inserter")})),(0,l.createElement)("div",{className:"edit-widgets-layout__inserter-panel-content"},(0,l.createElement)(Ee.__experimentalLibrary,{showInserterHelpPanel:!0,shouldFocusBlock:e,rootClientId:t,__experimentalInsertionIndex:r,ref:c})))}function Er(){const{setIsListViewOpened:e}=(0,m.useDispatch)(ct),{getListViewToggleRef:t}=ot((0,m.useSelect)(ct)),[r,n]=(0,p.useState)(null),i=(0,L.useFocusOnMount)("firstElement"),a=(0,p.useCallback)((()=>{e(!1),t().current?.focus()}),[t,e]),o=(0,p.useCallback)((e=>{e.keyCode!==kt.ESCAPE||e.defaultPrevented||(e.preventDefault(),a())}),[a]);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:a})),(0,l.createElement)("div",{className:"edit-widgets-editor__list-view-panel-content",ref:(0,L.useMergeRefs)([i,n])},(0,l.createElement)(Ee.__experimentalListView,{dropZoneElement:r})))}function fr(){const{isInserterOpen:e,isListViewOpen:t}=(0,m.useSelect)((e=>{const{isInserterOpened:t,isListViewOpened:r}=e(ct);return{isInserterOpen:t(),isListViewOpen:r()}}),[]);return e?(0,l.createElement)(br,null):t?(0,l.createElement)(Er,null):null}const yr={header:(0,v.__)("Widgets top bar"),body:(0,v.__)("Widgets and blocks"),sidebar:(0,v.__)("Widgets settings"),footer:(0,v.__)("Widgets footer")};const vr=function({blockEditorSettings:e}){const t=(0,L.useViewportMatch)("medium","<"),r=(0,L.useViewportMatch)("huge",">="),{setIsInserterOpened:n,setIsListViewOpened:i,closeGeneralSidebar:a}=(0,m.useDispatch)(ct),{hasBlockBreadCrumbsEnabled:o,hasSidebarEnabled:s,isInserterOpened:c,isListViewOpened:d,previousShortcut:u,nextShortcut:g}=(0,m.useSelect)((e=>({hasSidebarEnabled:!!e(J).getActiveComplementaryArea(ct.name),isInserterOpened:!!e(ct).isInserterOpened(),isListViewOpened:!!e(ct).isListViewOpened(),hasBlockBreadCrumbsEnabled:!!e(b.store).get("core/edit-widgets","showBlockBreadcrumbs"),previousShortcut:e(vt.store).getAllShortcutKeyCombinations("core/edit-widgets/previous-region"),nextShortcut:e(vt.store).getAllShortcutKeyCombinations("core/edit-widgets/next-region")})),[]);(0,p.useEffect)((()=>{s&&!r&&(n(!1),i(!1))}),[s,r]),(0,p.useEffect)((()=>{!c&&!d||r||a()}),[c,d,r]);const h=d?(0,v.__)("List View"):(0,v.__)("Block Library"),w=d||c;return(0,l.createElement)(be,{labels:{...yr,secondarySidebar:h},header:(0,l.createElement)(gr,null),secondarySidebar:w&&(0,l.createElement)(fr,null),sidebar:(0,l.createElement)(he.Slot,{scope:"core/edit-widgets"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(hr,{blockEditorSettings:e})),footer:o&&!t&&(0,l.createElement)("div",{className:"edit-widgets-layout__footer"},(0,l.createElement)(Ee.BlockBreadcrumb,{rootLabelText:(0,v.__)("Widgets")})),shortcuts:{previous:u,next:g}})};function kr(){const e=(0,m.useSelect)((e=>{const{getEditedWidgetAreas:t}=e(ct),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 Sr(){var e;const t=(0,m.useSelect)((e=>!!e(b.store).get("core/edit-widgets","welcomeGuide")),[]),{toggle:r}=(0,m.useDispatch)(b.store),n=(0,m.useSelect)((e=>e(ct).getWidgetAreas({per_page:-1})),[]);if(!t)return null;const i=n?.every((e=>"wp_inactive_widgets"===e.id||e.widgets.every((e=>e.startsWith("block-"))))),a=null!==(e=n?.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)(Ar,{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")),i?(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 theyll 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 theyll look on your site.",a),a))):(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 sites widget areas. Dont 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)(Ar,{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)(Ar,{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. Youll 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)(Ar,{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 Ar({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 Ir=function({blockEditorSettings:e}){const{createErrorNotice:t}=(0,m.useDispatch)(k.store);return(0,l.createElement)(ft,null,(0,l.createElement)(xt,{blockEditorSettings:e},(0,l.createElement)(vr,{blockEditorSettings:e}),(0,l.createElement)(Ut,null),(0,l.createElement)(X.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)(kr,null),(0,l.createElement)(Sr,null)))},Cr=["core/more","core/freeform","core/template-part",...Ct?[]:["core/block"]];function Nr(e,t){const r=document.getElementById(e),n=(0,p.createRoot)(r),i=(0,h.__experimentalGetCoreBlocks)().filter((e=>!(Cr.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)(i),(0,_.registerLegacyWidgetBlock)(),(0,_.registerLegacyWidgetVariations)(t),xr(c),(0,_.registerWidgetGroupBlock)(),t.__experimentalFetchLinkSuggestions=(e,r)=>(0,w.__experimentalFetchLinkSuggestions)(e,r,t),(0,d.setFreeformContentHandlerName)("core/html"),n.render((0,l.createElement)(Ir,{blockEditorSettings:t})),n}const Br=Nr;function Tr(){g()("wp.editWidgets.reinitializeEditor",{since:"6.2",version:"6.3"})}const xr=e=>{if(!e)return;const{metadata:t,settings:r,name:n}=e;t&&(0,d.unstable__bootstrapServerSideBlockDefinitions)({[n]:t}),(0,d.registerBlockType)(n,r)};(window.wp=window.wp||{}).editWidgets=t})();