Server IP : 85.214.239.14 / Your IP : 3.145.63.45 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /var/www/wordpress/wp-includes/js/dist/ |
Upload File : |
/*! 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 i in r)e.o(r,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:r[i]})},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:()=>Cr,reinitializeEditor:()=>Nr,store:()=>dt});var r={};e.r(r),e.d(r,{closeModal:()=>U,disableComplementaryArea:()=>O,enableComplementaryArea:()=>M,openModal:()=>H,pinItem:()=>V,setDefaultComplementaryArea:()=>P,setFeatureDefaults:()=>z,setFeatureValue:()=>G,toggleFeature:()=>F,unpinItem:()=>D});var i={};e.r(i),e.d(i,{getActiveComplementaryArea:()=>$,isComplementaryAreaLoading:()=>Y,isFeatureActive:()=>Z,isItemPinned:()=>K,isModalActive:()=>q});var s={};e.r(s),e.d(s,{closeGeneralSidebar:()=>Ve,moveBlockToWidgetArea:()=>De,persistStubPost:()=>Ce,saveEditedWidgetAreas:()=>Be,saveWidgetArea:()=>Te,saveWidgetAreas:()=>Ne,setIsInserterOpened:()=>Me,setIsListViewOpened:()=>Oe,setIsWidgetAreaOpen:()=>Pe,setWidgetAreasOpenState:()=>We,setWidgetIdForClientId:()=>Re});var o={};e.r(o),e.d(o,{getWidgetAreas:()=>Fe,getWidgets:()=>Ge});var n={};e.r(n),e.d(n,{__experimentalGetInsertionPoint:()=>et,canInsertBlockInWidgetArea:()=>tt,getEditedWidgetAreas:()=>Ze,getIsWidgetAreaOpen:()=>Qe,getParentWidgetAreaBlock:()=>Ke,getReferenceWidgetBlocks:()=>qe,getWidget:()=>Ue,getWidgetAreaForWidgetId:()=>Ye,getWidgetAreas:()=>$e,getWidgets:()=>He,isInserterOpened:()=>Xe,isListViewOpened:()=>rt,isSavingWidgetAreas:()=>Je});var a={};e.r(a),e.d(a,{getInserterSidebarToggleRef:()=>st,getListViewToggleRef:()=>it});var c={};e.r(c),e.d(c,{metadata:()=>wt,name:()=>_t,settings:()=>bt});const d=window.wp.blocks,l=window.wp.data,u=window.wp.deprecated;var g=e.n(u);const p=window.wp.element,h=window.wp.blockLibrary,m=window.wp.coreData,w=window.wp.widgets,_=window.wp.preferences,b=window.wp.apiFetch;var f=e.n(b);const y=(0,l.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:i}=t;return{...e,[r]:i}}default:return e}}}),x=window.wp.i18n,v=window.wp.notices;function k(e){var t,r,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=k(e[t]))&&(i&&(i+=" "),i+=r)}else for(r in e)e[r]&&(i&&(i+=" "),i+=r);return i}const j=function(){for(var e,t,r=0,i="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=k(e))&&(i&&(i+=" "),i+=t);return i},S=window.wp.components,A=window.wp.primitives,E=window.ReactJSXRuntime,I=(0,E.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,E.jsx)(A.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})}),C=(0,E.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,E.jsx)(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"})}),B=(0,E.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,E.jsx)(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"})}),N=window.wp.viewport,T=window.wp.compose,L=(0,E.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,E.jsx)(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"})});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 W(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 P=(e,t)=>({type:"SET_DEFAULT_COMPLEMENTARY_AREA",scope:e=R(e),area:t=W(e,t)}),M=(e,t)=>({registry:r,dispatch:i})=>{if(!t)return;e=R(e),t=W(e,t);r.select(_.store).get(e,"isComplementaryAreaVisible")||r.dispatch(_.store).set(e,"isComplementaryAreaVisible",!0),i({type:"ENABLE_COMPLEMENTARY_AREA",scope:e,area:t})},O=e=>({registry:t})=>{e=R(e);t.select(_.store).get(e,"isComplementaryAreaVisible")&&t.dispatch(_.store).set(e,"isComplementaryAreaVisible",!1)},V=(e,t)=>({registry:r})=>{if(!t)return;e=R(e),t=W(e,t);const i=r.select(_.store).get(e,"pinnedItems");!0!==i?.[t]&&r.dispatch(_.store).set(e,"pinnedItems",{...i,[t]:!0})},D=(e,t)=>({registry:r})=>{if(!t)return;e=R(e),t=W(e,t);const i=r.select(_.store).get(e,"pinnedItems");r.dispatch(_.store).set(e,"pinnedItems",{...i,[t]:!1})};function F(e,t){return function({registry:r}){g()("dispatch( 'core/interface' ).toggleFeature",{since:"6.0",alternative:"dispatch( 'core/preferences' ).toggle"}),r.dispatch(_.store).toggle(e,t)}}function G(e,t,r){return function({registry:i}){g()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),i.dispatch(_.store).set(e,t,!!r)}}function z(e,t){return function({registry:r}){g()("dispatch( 'core/interface' ).setFeatureDefaults",{since:"6.0",alternative:"dispatch( 'core/preferences' ).setDefaults"}),r.dispatch(_.store).setDefaults(e,t)}}function H(e){return{type:"OPEN_MODAL",name:e}}function U(){return{type:"CLOSE_MODAL"}}const $=(0,l.createRegistrySelector)((e=>(t,r)=>{r=R(r);const i=e(_.store).get(r,"isComplementaryAreaVisible");if(void 0!==i)return!1===i?null:t?.complementaryAreas?.[r]})),Y=(0,l.createRegistrySelector)((e=>(t,r)=>{r=R(r);const i=e(_.store).get(r,"isComplementaryAreaVisible"),s=t?.complementaryAreas?.[r];return i&&void 0===s})),K=(0,l.createRegistrySelector)((e=>(t,r,i)=>{var s;i=W(r=R(r),i);const o=e(_.store).get(r,"pinnedItems");return null===(s=o?.[i])||void 0===s||s})),Z=(0,l.createRegistrySelector)((e=>(t,r,i)=>(g()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(_.store).get(r,i))));function q(e,t){return e.activeModal===t}const J=(0,l.combineReducers)({complementaryAreas:function(e={},t){switch(t.type){case"SET_DEFAULT_COMPLEMENTARY_AREA":{const{scope:r,area:i}=t;return e[r]?e:{...e,[r]:i}}case"ENABLE_COMPLEMENTARY_AREA":{const{scope:r,area:i}=t;return{...e,[r]:i}}}return e},activeModal:function(e=null,t){switch(t.type){case"OPEN_MODAL":return t.name;case"CLOSE_MODAL":return null}return e}}),Q=(0,l.createReduxStore)("core/interface",{reducer:J,actions:r,selectors:i});(0,l.register)(Q);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=S.Button,scope:t,identifier:r,icon:i,selectedIcon:s,name:o,...n}){const a=e,c=(0,l.useSelect)((e=>e(Q).getActiveComplementaryArea(t)===r),[r,t]),{enableComplementaryArea:d,disableComplementaryArea:u}=(0,l.useDispatch)(Q);return(0,E.jsx)(a,{icon:s&&c?s:i,"aria-controls":r.replace("/",":"),onClick:()=>{c?u(t):d(t,r)},...n})})),re=({smallScreenTitle:e,children:t,className:r,toggleButtonProps:i})=>{const s=(0,E.jsx)(te,{icon:L,...i});return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("div",{className:"components-panel__header interface-complementary-area-header__small",children:[e&&(0,E.jsx)("h2",{className:"interface-complementary-area-header__small-title",children:e}),s]}),(0,E.jsxs)("div",{className:j("components-panel__header","interface-complementary-area-header",r),tabIndex:-1,children:[t,s]})]})},ie=()=>{};function se({name:e,as:t=S.Button,onClick:r,...i}){return(0,E.jsx)(S.Fill,{name:e,children:({onClick:e})=>(0,E.jsx)(t,{onClick:r||e?(...t)=>{(r||ie)(...t),(e||ie)(...t)}:void 0,...i})})}se.Slot=function({name:e,as:t=S.ButtonGroup,fillProps:r={},bubblesVirtually:i,...s}){return(0,E.jsx)(S.Slot,{name:e,bubblesVirtually:i,fillProps:r,children: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 i=p.Children.map(e,(e=>!e.props.__unstableExplicitMenuItem&&r.includes(e.props.__unstableTarget)?null:e));return(0,E.jsx)(t,{...s,children:i})}})};const oe=se,ne=({__unstableExplicitMenuItem:e,__unstableTarget:t,...r})=>(0,E.jsx)(S.MenuItem,{...r});function ae({scope:e,target:t,__unstableExplicitMenuItem:r,...i}){return(0,E.jsx)(te,{as:i=>(0,E.jsx)(oe,{__unstableExplicitMenuItem:r,__unstableTarget:`${e}/${t}`,as:ne,name:`${e}/plugin-more-menu`,...i}),role:"menuitemcheckbox",selectedIcon:I,name:t,scope:e,...i})}function ce({scope:e,...t}){return(0,E.jsx)(S.Fill,{name:`PinnedItems/${e}`,...t})}ce.Slot=function({scope:e,className:t,...r}){return(0,E.jsx)(S.Slot,{name:`PinnedItems/${e}`,...r,children:e=>e?.length>0&&(0,E.jsx)("div",{className:j(t,"interface-pinned-items"),children:e})})};const de=ce,le=.3;const ue=280,ge={open:{width:ue},closed:{width:0},mobileOpen:{width:"100vw"}};function pe({activeArea:e,isActive:t,scope:r,children:i,className:s,id:o}){const n=(0,T.useReducedMotion)(),a=(0,T.useViewportMatch)("medium","<"),c=(0,T.usePrevious)(e),d=(0,T.usePrevious)(t),[,l]=(0,p.useState)({});(0,p.useEffect)((()=>{l({})}),[t]);const u={type:"tween",duration:n||a||c&&e&&e!==c?0:le,ease:[.6,0,.4,1]};return(0,E.jsx)(S.Fill,{name:`ComplementaryArea/${r}`,children:(0,E.jsx)(S.__unstableAnimatePresence,{initial:!1,children:(d||t)&&(0,E.jsx)(S.__unstableMotion.div,{variants:ge,initial:"closed",animate:a?"mobileOpen":"open",exit:"closed",transition:u,className:"interface-complementary-area__fill",children:(0,E.jsx)("div",{id:o,className:s,style:{width:a?"100vw":ue},children:i})})})})}const he=ee((function({children:e,className:t,closeLabel:r=(0,x.__)("Close plugin"),identifier:i,header:s,headerClassName:o,icon:n,isPinnable:a=!0,panelClassName:c,scope:d,name:u,smallScreenTitle:g,title:h,toggleShortcut:m,isActiveByDefault:w}){const[b,f]=(0,p.useState)(!1),{isLoading:y,isActive:v,isPinned:k,activeArea:A,isSmall:T,isLarge:L,showIconLabels:R}=(0,l.useSelect)((e=>{const{getActiveComplementaryArea:t,isComplementaryAreaLoading:r,isItemPinned:s}=e(Q),{get:o}=e(_.store),n=t(d);return{isLoading:r(d),isActive:n===i,isPinned:s(d,i),activeArea:n,isSmall:e(N.store).isViewportMatch("< medium"),isLarge:e(N.store).isViewportMatch("large"),showIconLabels:o("core","showIconLabels")}}),[i,d]);!function(e,t,r,i,s){const o=(0,p.useRef)(!1),n=(0,p.useRef)(!1),{enableComplementaryArea:a,disableComplementaryArea:c}=(0,l.useDispatch)(Q);(0,p.useEffect)((()=>{i&&s&&!o.current?(c(e),n.current=!0):n.current&&!s&&o.current?(n.current=!1,a(e,t)):n.current&&r&&r!==t&&(n.current=!1),s!==o.current&&(o.current=s)}),[i,s,e,t,r,c,a])}(d,i,A,v,T);const{enableComplementaryArea:W,disableComplementaryArea:P,pinItem:M,unpinItem:O}=(0,l.useDispatch)(Q);if((0,p.useEffect)((()=>{w&&void 0===A&&!T?W(d,i):void 0===A&&T&&P(d,i),f(!0)}),[A,w,d,i,T,W,P]),b)return(0,E.jsxs)(E.Fragment,{children:[a&&(0,E.jsx)(de,{scope:d,children:k&&(0,E.jsx)(te,{scope:d,identifier:i,isPressed:v&&(!R||L),"aria-expanded":v,"aria-disabled":y,label:h,icon:R?I:n,showTooltip:!R,variant:R?"tertiary":void 0,size:"compact"})}),u&&a&&(0,E.jsx)(ae,{target:u,scope:d,icon:n,children:h}),(0,E.jsxs)(pe,{activeArea:A,isActive:v,className:j("interface-complementary-area",t),scope:d,id:i.replace("/",":"),children:[(0,E.jsx)(re,{className:o,closeLabel:r,onClose:()=>P(d),smallScreenTitle:g,toggleButtonProps:{label:r,size:"small",shortcut:m,scope:d,identifier:i},children:s||(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("h2",{className:"interface-complementary-area-header__title",children:h}),a&&(0,E.jsx)(S.Button,{className:"interface-complementary-area__pin-unpin-item",icon:k?C:B,label:k?(0,x.__)("Unpin from toolbar"):(0,x.__)("Pin to toolbar"),onClick:()=>(k?O:M)(d,i),isPressed:k,"aria-expanded":k,size:"compact"})]})}),(0,E.jsx)(S.Panel,{className:c,children:e})]})]})}));he.Slot=function({scope:e,...t}){return(0,E.jsx)(S.Slot,{name:`ComplementaryArea/${e}`,...t})};const me=he;function we({children:e,className:t,ariaLabel:r,as:i="div",...s}){return(0,E.jsx)(i,{className:j("interface-navigable-region",t),"aria-label":r,role:"region",tabIndex:"-1",...s,children:e})}const _e={type:"tween",duration:.25,ease:[.6,0,.4,1]};const be={hidden:{opacity:1,marginTop:-60},visible:{opacity:1,marginTop:0},distractionFreeHover:{opacity:1,marginTop:0,transition:{..._e,delay:.2,delayChildren:.2}},distractionFreeHidden:{opacity:0,marginTop:-60},distractionFreeDisabled:{opacity:0,marginTop:0,transition:{..._e,delay:.8,delayChildren:.8}}};const fe=(0,p.forwardRef)((function({isDistractionFree:e,footer:t,header:r,editorNotices:i,sidebar:s,secondarySidebar:o,content:n,actions:a,labels:c,className:d,enableRegionNavigation:l=!0,shortcuts:u},g){const[h,m]=(0,T.useResizeObserver)(),w=(0,T.useViewportMatch)("medium","<"),_={type:"tween",duration:(0,T.useReducedMotion)()?0:.25,ease:[.6,0,.4,1]},b=(0,S.__unstableUseNavigateRegions)(u);!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 f={...{header:(0,x._x)("Header","header landmark area"),body:(0,x.__)("Content"),secondarySidebar:(0,x.__)("Block Library"),sidebar:(0,x.__)("Settings"),actions:(0,x.__)("Publish"),footer:(0,x.__)("Footer")},...c};return(0,E.jsxs)("div",{...l?b:{},ref:(0,T.useMergeRefs)([g,l?b.ref:void 0]),className:j(d,"interface-interface-skeleton",b.className,!!t&&"has-footer"),children:[(0,E.jsxs)("div",{className:"interface-interface-skeleton__editor",children:[(0,E.jsx)(S.__unstableAnimatePresence,{initial:!1,children:!!r&&(0,E.jsx)(we,{as:S.__unstableMotion.div,className:"interface-interface-skeleton__header","aria-label":f.header,initial:e?"distractionFreeHidden":"hidden",whileHover:e?"distractionFreeHover":"visible",animate:e?"distractionFreeDisabled":"visible",exit:e?"distractionFreeHidden":"hidden",variants:be,transition:_,children:r})}),e&&(0,E.jsx)("div",{className:"interface-interface-skeleton__header",children:i}),(0,E.jsxs)("div",{className:"interface-interface-skeleton__body",children:[(0,E.jsx)(S.__unstableAnimatePresence,{initial:!1,children:!!o&&(0,E.jsx)(we,{className:"interface-interface-skeleton__secondary-sidebar",ariaLabel:f.secondarySidebar,as:S.__unstableMotion.div,initial:"closed",animate:w?"mobileOpen":"open",exit:"closed",variants:{open:{width:m.width},closed:{width:0},mobileOpen:{width:"100vw"}},transition:_,children:(0,E.jsxs)("div",{style:{position:"absolute",width:w?"100vw":"fit-content",height:"100%",right:0},children:[h,o]})})}),(0,E.jsx)(we,{className:"interface-interface-skeleton__content",ariaLabel:f.body,children:n}),!!s&&(0,E.jsx)(we,{className:"interface-interface-skeleton__sidebar",ariaLabel:f.sidebar,children:s}),!!a&&(0,E.jsx)(we,{className:"interface-interface-skeleton__actions",ariaLabel:f.actions,children:a})]})]}),!!t&&(0,E.jsx)(we,{className:"interface-interface-skeleton__footer",ariaLabel:f.footer,children:t})]})})),ye=window.wp.blockEditor;function xe(e){if("block"===e.id_base){const t=(0,d.parse)(e.instance.raw.content,{__unstableSkipAutop:!0});return t.length?(0,w.addWidgetIdToBlock)(t[0],e.id):(0,w.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,w.addWidgetIdToBlock)((0,d.createBlock)("core/legacy-widget",t,[]),e.id)}function ve(e,t={}){let r;var i,s,o;"core/legacy-widget"===e.name&&(e.attributes.id||e.attributes.instance)?r={...t,id:null!==(i=e.attributes.id)&&void 0!==i?i:t.id,id_base:null!==(s=e.attributes.idBase)&&void 0!==s?s:t.id_base,instance:null!==(o=e.attributes.instance)&&void 0!==o?o:t.instance}:r={...t,id_base:"block",instance:{raw:{content:(0,d.serialize)(e)}}};return delete r.rendered,delete r.rendered_form,r}const ke="root",je="sidebar",Se="postType",Ae=e=>`widget-area-${e}`,Ee=()=>"widget-areas";const Ie="core/edit-widgets",Ce=(e,t)=>({registry:r})=>{const i=((e,t)=>({id:e,slug:e,status:"draft",type:"page",blocks:t,meta:{widgetAreaId:e}}))(e,t);return r.dispatch(m.store).receiveEntityRecords(ke,Se,i,{id:i.id},!1),i},Be=()=>async({select:e,dispatch:t,registry:r})=>{const i=e.getEditedWidgetAreas();if(i?.length)try{await t.saveWidgetAreas(i),r.dispatch(v.store).createSuccessNotice((0,x.__)("Widgets saved."),{type:"snackbar"})}catch(e){r.dispatch(v.store).createErrorNotice((0,x.sprintf)((0,x.__)("There was an error. %s"),e.message),{type:"snackbar"})}},Ne=e=>async({dispatch:t,registry:r})=>{try{for(const r of e)await t.saveWidgetArea(r.id)}finally{await r.dispatch(m.store).finishResolution("getEntityRecord",ke,je,{per_page:-1})}},Te=e=>async({dispatch:t,select:r,registry:i})=>{const s=r.getWidgets(),o=i.select(m.store).getEditedEntityRecord(ke,Se,Ae(e)),n=Object.values(s).filter((({sidebar:t})=>t===e)),a=[],c=o.blocks.filter((e=>{const{id:t}=e.attributes;if("core/legacy-widget"===e.name&&t){if(a.includes(t))return!1;a.push(t)}return!0})),d=[];for(const e of n){r.getWidgetAreaForWidgetId(e.id)||d.push(e)}const l=[],u=[],g=[];for(let t=0;t<c.length;t++){const r=c[t],o=(0,w.getWidgetIdFromBlock)(r),n=s[o],a=ve(r,n);if(g.push(o),n){i.dispatch(m.store).editEntityRecord("root","widget",o,{...a,sidebar:e},{undoIgnore:!0});if(!i.select(m.store).hasEditsForEntityRecord("root","widget",o))continue;u.push((({saveEditedEntityRecord:e})=>e("root","widget",o)))}else u.push((({saveEntityRecord:t})=>t("root","widget",{...a,sidebar:e})));l.push({block:r,position:t,clientId:r.clientId})}for(const e of d)u.push((({deleteEntityRecord:t})=>t("root","widget",e.id,{force:!0})));const p=(await i.dispatch(m.store).__experimentalBatch(u)).filter((e=>!e.hasOwnProperty("deleted"))),h=[];for(let e=0;e<p.length;e++){const t=p[e],{block:r,position:s}=l[e];o.blocks[s].attributes.__internalWidgetId=t.id;i.select(m.store).getLastEntitySaveError("root","widget",t.id)&&h.push(r.attributes?.name||r?.name),g[s]||(g[s]=t.id)}if(h.length)throw new Error((0,x.sprintf)((0,x.__)("Could not save the following widgets: %s."),h.join(", ")));i.dispatch(m.store).editEntityRecord(ke,je,e,{widgets:g},{undoIgnore:!0}),t(Le(e)),i.dispatch(m.store).receiveEntityRecords(ke,Se,o,void 0)},Le=e=>({registry:t})=>{t.dispatch(m.store).saveEditedEntityRecord(ke,je,e,{throwOnError:!0})};function Re(e,t){return{type:"SET_WIDGET_ID_FOR_CLIENT_ID",clientId:e,widgetId:t}}function We(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(Q).disableComplementaryArea(Ie)},De=(e,t)=>async({dispatch:r,select:i,registry:s})=>{const o=s.select(ye.store).getBlockRootClientId(e),n=s.select(ye.store).getBlocks().find((({attributes:e})=>e.id===t)).clientId,a=s.select(ye.store).getBlockOrder(n).length;i.getIsWidgetAreaOpen(n)||r.setIsWidgetAreaOpen(n,!0),s.dispatch(ye.store).moveBlocksToPosition([e],o,n,a)},Fe=()=>async({dispatch:e,registry:t})=>{const r={per_page:-1},i=[],s=(await t.resolveSelect(m.store).getEntityRecords(ke,je,r)).sort(((e,t)=>"wp_inactive_widgets"===e.id?1:"wp_inactive_widgets"===t.id?-1:0));for(const t of s)i.push((0,d.createBlock)("core/widget-area",{id:t.id,name:t.name})),t.widgets.length||e(Ce(Ae(t.id),[]));const o={};i.forEach(((e,t)=>{o[e.clientId]=0===t})),e(We(o)),e(Ce(Ee(),i))},Ge=()=>async({dispatch:e,registry:t})=>{const r={per_page:-1,_embed:"about"},i=await t.resolveSelect(m.store).getEntityRecords("root","widget",r),s={};for(const e of i){const t=xe(e);s[e.sidebar]=s[e.sidebar]||[],s[e.sidebar].push(t)}for(const t in s)s.hasOwnProperty(t)&&e(Ce(Ae(t),s[t]))},ze={rootClientId:void 0,insertionIndex:void 0},He=(0,l.createRegistrySelector)((e=>()=>{const t=e(m.store).getEntityRecords("root","widget",{per_page:-1,_embed:"about"});return t?.reduce(((e,t)=>({...e,[t.id]:t})),{})||{}})),Ue=(0,l.createRegistrySelector)((e=>(t,r)=>e(Ie).getWidgets()[r])),$e=(0,l.createRegistrySelector)((e=>()=>{const t={per_page:-1};return e(m.store).getEntityRecords(ke,je,t)})),Ye=(0,l.createRegistrySelector)((e=>(t,r)=>e(Ie).getWidgetAreas().find((t=>e(m.store).getEditedEntityRecord(ke,Se,Ae(t.id)).blocks.map((e=>(0,w.getWidgetIdFromBlock)(e))).includes(r))))),Ke=(0,l.createRegistrySelector)((e=>(t,r)=>{const{getBlock:i,getBlockName:s,getBlockParents:o}=e(ye.store);return i(o(r).find((e=>"core/widget-area"===s(e))))})),Ze=(0,l.createRegistrySelector)((e=>(t,r)=>{let i=e(Ie).getWidgetAreas();return i?(r&&(i=i.filter((({id:e})=>r.includes(e)))),i.filter((({id:t})=>e(m.store).hasEditsForEntityRecord(ke,Se,Ae(t)))).map((({id:t})=>e(m.store).getEditedEntityRecord(ke,je,t)))):[]})),qe=(0,l.createRegistrySelector)((e=>(t,r=null)=>{const i=[],s=e(Ie).getWidgetAreas();for(const t of s){const s=e(m.store).getEditedEntityRecord(ke,Se,Ae(t.id));for(const e of s.blocks)"core/legacy-widget"!==e.name||r&&e.attributes?.referenceWidgetName!==r||i.push(e)}return i})),Je=(0,l.createRegistrySelector)((e=>()=>{const t=e(Ie).getWidgetAreas()?.map((({id:e})=>e));if(!t)return!1;for(const r of t){if(e(m.store).isSavingEntityRecord(ke,je,r))return!0}const r=[...Object.keys(e(Ie).getWidgets()),void 0];for(const t of r){if(e(m.store).isSavingEntityRecord("root","widget",t))return!0}return!1})),Qe=(e,t)=>{const{widgetAreasOpenState:r}=e;return!!r[t]};function Xe(e){return!!e.blockInserterPanel}function et(e){return"boolean"==typeof e.blockInserterPanel?ze:e.blockInserterPanel}const tt=(0,l.createRegistrySelector)((e=>(t,r)=>{const i=e(ye.store).getBlocks(),[s]=i;return e(ye.store).canInsertBlockType(r,s.clientId)}));function rt(e){return e.listViewPanel}function it(e){return e.listViewToggleRef}function st(e){return e.inserterSidebarToggleRef}const ot=window.wp.privateApis,{lock:nt,unlock:at}=(0,ot.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/edit-widgets"),ct={reducer:y,selectors:n,resolvers:o,actions:s},dt=(0,l.createReduxStore)(Ie,ct);(0,l.register)(dt),f().use((function(e,t){return 0===e.path?.indexOf("/wp/v2/types/widget-area")?Promise.resolve({}):t(e)})),at(dt).registerPrivateSelectors(a);const lt=window.wp.hooks,ut=(0,T.createHigherOrderComponent)((e=>t=>{const{clientId:r,name:i}=t,{widgetAreas:s,currentWidgetAreaId:o,canInsertBlockInWidgetArea:n}=(0,l.useSelect)((e=>{if("core/widget-area"===i)return{};const t=e(dt),s=t.getParentWidgetAreaBlock(r);return{widgetAreas:t.getWidgetAreas(),currentWidgetAreaId:s?.attributes?.id,canInsertBlockInWidgetArea:t.canInsertBlockInWidgetArea(i)}}),[r,i]),{moveBlockToWidgetArea:a}=(0,l.useDispatch)(dt),c="core/widget-area"!==i&&s?.length>1&&n;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(e,{...t}),c&&(0,E.jsx)(ye.BlockControls,{children:(0,E.jsx)(w.MoveToWidgetArea,{widgetAreas:s,currentWidgetAreaId:o,onSelect:e=>{a(t.clientId,e)}})})]})}),"withMoveToWidgetAreaToolbarItem");(0,lt.addFilter)("editor.BlockEdit","core/edit-widgets/block-edit",ut);const gt=window.wp.mediaUtils;(0,lt.addFilter)("editor.MediaUpload","core/edit-widgets/replace-media-upload",(()=>gt.MediaUpload));const pt=e=>{const[t,r]=(0,p.useState)(!1);return(0,p.useEffect)((()=>{const{ownerDocument:t}=e.current;function i(e){o(e)}function s(){r(!1)}function o(t){e.current.contains(t.target)?r(!0):r(!1)}return t.addEventListener("dragstart",i),t.addEventListener("dragend",s),t.addEventListener("dragenter",o),()=>{t.removeEventListener("dragstart",i),t.removeEventListener("dragend",s),t.removeEventListener("dragenter",o)}}),[]),t};function ht({id:e}){const[t,r,i]=(0,m.useEntityBlockEditor)("root","postType"),s=(0,p.useRef)(),o=pt(s),n=(0,ye.useInnerBlocksProps)({ref:s},{value:t,onInput:r,onChange:i,templateLock:!1,renderAppender:ye.InnerBlocks.ButtonBlockAppender});return(0,E.jsx)("div",{"data-widget-area-id":e,className:j("wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper",{"wp-block-widget-area__highlight-drop-zone":o}),children:(0,E.jsx)("div",{...n})})}const mt=e=>{const[t,r]=(0,p.useState)(!1);return(0,p.useEffect)((()=>{const{ownerDocument:t}=e.current;function i(){r(!0)}function s(){r(!1)}return t.addEventListener("dragstart",i),t.addEventListener("dragend",s),()=>{t.removeEventListener("dragstart",i),t.removeEventListener("dragend",s)}}),[]),t},wt={$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:_t}=wt,bt={title:(0,x.__)("Widget Area"),description:(0,x.__)("A widget area container."),__experimentalLabel:({name:e})=>e,edit:function({clientId:e,className:t,attributes:{id:r,name:i}}){const s=(0,l.useSelect)((t=>t(dt).getIsWidgetAreaOpen(e)),[e]),{setIsWidgetAreaOpen:o}=(0,l.useDispatch)(dt),n=(0,p.useRef)(),a=(0,p.useCallback)((t=>o(e,t)),[e]),c=mt(n),d=pt(n),[u,g]=(0,p.useState)(!1);return(0,p.useEffect)((()=>{c?d&&!s?(a(!0),g(!0)):!d&&s&&u&&a(!1):g(!1)}),[s,c,d,u]),(0,E.jsx)(S.Panel,{className:t,ref:n,children:(0,E.jsx)(S.PanelBody,{title:i,opened:s,onToggle:()=>{o(e,!s)},scrollAfterOpen:!c,children:({opened:e})=>(0,E.jsx)(S.__unstableDisclosureContent,{className:"wp-block-widget-area__panel-body-content",visible:e,children:(0,E.jsx)(m.EntityProvider,{kind:"root",type:"postType",id:`widget-area-${r}`,children:(0,E.jsx)(ht,{id:r})})})})})}};function ft({text:e,children:t}){const r=(0,T.useCopyToClipboard)(e);return(0,E.jsx)(S.Button,{variant:"secondary",ref:r,children:t})}function yt({message:e,error:t}){const r=[(0,E.jsx)(ft,{text:t.stack,children:(0,x.__)("Copy Error")},"copy-error")];return(0,E.jsx)(ye.Warning,{className:"edit-widgets-error-boundary",actions:r,children:e})}class xt 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,E.jsx)(yt,{message:(0,x.__)("The editor has encountered an unexpected error."),error:this.state.error}):this.props.children}}const vt=window.wp.patterns,kt=window.wp.keyboardShortcuts,jt=window.wp.keycodes;function St(){const{redo:e,undo:t}=(0,l.useDispatch)(m.store),{saveEditedWidgetAreas:r}=(0,l.useDispatch)(dt);return(0,kt.useShortcut)("core/edit-widgets/undo",(e=>{t(),e.preventDefault()})),(0,kt.useShortcut)("core/edit-widgets/redo",(t=>{e(),t.preventDefault()})),(0,kt.useShortcut)("core/edit-widgets/save",(e=>{e.preventDefault(),r()})),null}St.Register=function(){const{registerShortcut:e}=(0,l.useDispatch)(kt.store);return(0,p.useEffect)((()=>{e({name:"core/edit-widgets/undo",category:"global",description:(0,x.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/edit-widgets/redo",category:"global",description:(0,x.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"},aliases:(0,jt.isAppleOS)()?[]:[{modifier:"primary",character:"y"}]}),e({name:"core/edit-widgets/save",category:"global",description:(0,x.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),e({name:"core/edit-widgets/keyboard-shortcuts",category:"main",description:(0,x.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}}),e({name:"core/edit-widgets/next-region",category:"global",description:(0,x.__)("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,x.__)("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,Et=()=>(0,l.useSelect)((e=>{const{getBlockSelectionEnd:t,getBlockName:r}=e(ye.store),i=t();if("core/widget-area"===r(i))return i;const{getParentWidgetAreaBlock:s}=e(dt),o=s(i),n=o?.clientId;if(n)return n;const{getEntityRecord:a}=e(m.store),c=a(ke,Se,Ee());return c?.blocks[0]?.clientId}),[]),It=!1,{ExperimentalBlockEditorProvider:Ct}=at(ye.privateApis),{PatternsMenuItems:Bt}=at(vt.privateApis),{BlockKeyboardShortcuts:Nt}=at(h.privateApis);function Tt({blockEditorSettings:e,children:t,...r}){const i=(0,m.useResourcePermissions)("media"),s=(0,T.useViewportMatch)("medium"),{reusableBlocks:o,isFixedToolbarActive:n,keepCaretInsideBlock:a,pageOnFront:c,pageForPosts:d}=(0,l.useSelect)((e=>{const{canUser:t,getEntityRecord:r,getEntityRecords:i}=e(m.store),s=t("read","settings")?r("root","site"):void 0;return{widgetAreas:e(dt).getWidgetAreas(),widgets:e(dt).getWidgets(),reusableBlocks:It?i("postType","wp_block"):[],isFixedToolbarActive:!!e(_.store).get("core/edit-widgets","fixedToolbar"),keepCaretInsideBlock:!!e(_.store).get("core/edit-widgets","keepCaretInsideBlock"),pageOnFront:s?.page_on_front,pageForPosts:s?.page_for_posts}}),[]),{setIsInserterOpened:u}=(0,l.useDispatch)(dt),g=(0,p.useMemo)((()=>{let t;return i.canCreate&&(t=({onError:t,...r})=>{(0,gt.uploadMedia)({wpAllowedMimeTypes:e.allowedMimeTypes,onError:({message:e})=>t(e),...r})}),{...e,__experimentalReusableBlocks:o,hasFixedToolbar:n||!s,keepCaretInsideBlock:a,mediaUpload:t,templateLock:"all",__experimentalSetIsInserterOpened:u,pageOnFront:c,pageForPosts:d}}),[e,n,s,a,i.canCreate,o,u,c,d]),h=Et(),[w,b,f]=(0,m.useEntityBlockEditor)(ke,Se,{id:Ee()});return(0,E.jsxs)(S.SlotFillProvider,{children:[(0,E.jsx)(At.Register,{}),(0,E.jsx)(Nt,{}),(0,E.jsxs)(Ct,{value:w,onInput:b,onChange:f,settings:g,useSubRegistry:!1,...r,children:[t,(0,E.jsx)(Bt,{rootClientId:h})]})]})}const Lt=(0,E.jsx)(A.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,E.jsx)(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"})}),Rt=(0,E.jsx)(A.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,E.jsx)(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"})}),Wt=(0,E.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,E.jsx)(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"})}),Pt=window.wp.url,Mt=window.wp.dom;function Ot({selectedWidgetAreaId:e}){const t=(0,l.useSelect)((e=>e(dt).getWidgetAreas()),[]),r=(0,p.useMemo)((()=>e&&t?.find((t=>t.id===e))),[e,t]);let i;return i=r?"wp_inactive_widgets"===e?(0,x.__)("Blocks in this Widget Area will not be displayed in your site."):r.description:(0,x.__)("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,E.jsx)("div",{className:"edit-widgets-widget-areas",children:(0,E.jsxs)("div",{className:"edit-widgets-widget-areas__top-container",children:[(0,E.jsx)(ye.BlockIcon,{icon:Wt}),(0,E.jsxs)("div",{children:[(0,E.jsx)("p",{dangerouslySetInnerHTML:{__html:(0,Mt.safeHTML)(i)}}),0===t?.length&&(0,E.jsx)("p",{children:(0,x.__)("Your theme does not contain any Widget Areas.")}),!r&&(0,E.jsx)(S.Button,{href:(0,Pt.addQueryArgs)("customize.php",{"autofocus[panel]":"widgets",return:window.location.pathname}),variant:"tertiary",children:(0,x.__)("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}=at(S.privateApis);function zt({selectedWidgetAreaBlock:e}){return(0,E.jsxs)(Gt.TabList,{children:[(0,E.jsx)(Gt.Tab,{tabId:Ft,children:e?e.attributes.name:(0,x.__)("Widget Areas")}),(0,E.jsx)(Gt.Tab,{tabId:Dt,children:(0,x.__)("Block")})]})}function Ht({hasSelectedNonAreaBlock:e,currentArea:t,isGeneralSidebarOpen:r,selectedWidgetAreaBlock:i}){const{enableComplementaryArea:s}=(0,l.useDispatch)(Q);(0,p.useEffect)((()=>{e&&t===Ft&&r&&s("core/edit-widgets",Dt),!e&&t===Dt&&r&&s("core/edit-widgets",Ft)}),[e,s]);const o=(0,p.useContext)(Gt.Context);return(0,E.jsx)(me,{className:"edit-widgets-sidebar",header:(0,E.jsx)(Gt.Context.Provider,{value:o,children:(0,E.jsx)(zt,{selectedWidgetAreaBlock:i})}),headerClassName:"edit-widgets-sidebar__panel-tabs",title:(0,x.__)("Settings"),closeLabel:(0,x.__)("Close Settings"),scope:"core/edit-widgets",identifier:t,icon:(0,x.isRTL)()?Lt:Rt,isActiveByDefault:Vt,children:(0,E.jsxs)(Gt.Context.Provider,{value:o,children:[(0,E.jsx)(Gt.TabPanel,{tabId:Ft,focusable:!1,children:(0,E.jsx)(Ot,{selectedWidgetAreaId:i?.attributes.id})}),(0,E.jsx)(Gt.TabPanel,{tabId:Dt,focusable:!1,children:e?(0,E.jsx)(ye.BlockInspector,{}):(0,E.jsx)("span",{className:"block-editor-block-inspector__no-blocks",children:(0,x.__)("No block selected.")})})]})})}function Ut(){const{currentArea:e,hasSelectedNonAreaBlock:t,isGeneralSidebarOpen:r,selectedWidgetAreaBlock:i}=(0,l.useSelect)((e=>{const{getSelectedBlock:t,getBlock:r,getBlockParentsByBlockName:i}=e(ye.store),{getActiveComplementaryArea:s}=e(Q),o=t(),n=s(dt.name);let a,c=n;return c||(c=o?Dt:Ft),o&&(a="core/widget-area"===o.name?o:r(i(o.clientId,"core/widget-area")[0])),{currentArea:c,hasSelectedNonAreaBlock:!(!o||"core/widget-area"===o.name),isGeneralSidebarOpen:!!n,selectedWidgetAreaBlock:a}}),[]),{enableComplementaryArea:s}=(0,l.useDispatch)(Q),o=(0,p.useCallback)((e=>{e&&s(dt.name,e)}),[s]);return(0,E.jsx)(Gt,{selectedTabId:r?e:null,onSelect:o,selectOnMove:!1,children:(0,E.jsx)(Ht,{hasSelectedNonAreaBlock:t,currentArea:e,isGeneralSidebarOpen:r,selectedWidgetAreaBlock:i})})}const $t=(0,E.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,E.jsx)(A.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})}),Yt=(0,E.jsx)(A.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,E.jsx)(A.Path,{d:"M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z"})}),Kt=(0,E.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,E.jsx)(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"})}),Zt=(0,E.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,E.jsx)(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"})});const qt=(0,p.forwardRef)((function(e,t){const r=(0,l.useSelect)((e=>e(m.store).hasUndo()),[]),{undo:i}=(0,l.useDispatch)(m.store);return(0,E.jsx)(S.Button,{...e,ref:t,icon:(0,x.isRTL)()?Zt:Kt,label:(0,x.__)("Undo"),shortcut:jt.displayShortcut.primary("z"),"aria-disabled":!r,onClick:r?i:void 0,size:"compact"})}));const Jt=(0,p.forwardRef)((function(e,t){const r=(0,jt.isAppleOS)()?jt.displayShortcut.primaryShift("z"):jt.displayShortcut.primary("y"),i=(0,l.useSelect)((e=>e(m.store).hasRedo()),[]),{redo:s}=(0,l.useDispatch)(m.store);return(0,E.jsx)(S.Button,{...e,ref:t,icon:(0,x.isRTL)()?Kt:Zt,label:(0,x.__)("Redo"),shortcut:r,"aria-disabled":!i,onClick:i?s:void 0,size:"compact"})}));const Qt=function(){const e=(0,T.useViewportMatch)("medium"),{isInserterOpen:t,isListViewOpen:r,inserterSidebarToggleRef:i,listViewToggleRef:s}=(0,l.useSelect)((e=>{const{isInserterOpened:t,getInserterSidebarToggleRef:r,isListViewOpened:i,getListViewToggleRef:s}=at(e(dt));return{isInserterOpen:t(),isListViewOpen:i(),inserterSidebarToggleRef:r(),listViewToggleRef:s()}}),[]),{setIsInserterOpened:o,setIsListViewOpened:n}=(0,l.useDispatch)(dt),a=(0,p.useCallback)((()=>n(!r)),[n,r]),c=(0,p.useCallback)((()=>o(!t)),[o,t]);return(0,E.jsxs)(ye.NavigableToolbar,{className:"edit-widgets-header-toolbar","aria-label":(0,x.__)("Document tools"),variant:"unstyled",children:[(0,E.jsx)(S.ToolbarItem,{ref:i,as:S.Button,className:"edit-widgets-header-toolbar__inserter-toggle",variant:"primary",isPressed:t,onMouseDown:e=>{e.preventDefault()},onClick:c,icon:$t,label:(0,x._x)("Toggle block inserter","Generic label for block inserter button"),size:"compact"}),e&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(S.ToolbarItem,{as:qt}),(0,E.jsx)(S.ToolbarItem,{as:Jt}),(0,E.jsx)(S.ToolbarItem,{as:S.Button,className:"edit-widgets-header-toolbar__list-view-toggle",icon:Yt,isPressed:r,label:(0,x.__)("List View"),onClick:a,ref:s,size:"compact"})]})]})};const Xt=function(){const{hasEditedWidgetAreaIds:e,isSaving:t}=(0,l.useSelect)((e=>{const{getEditedWidgetAreas:t,isSavingWidgetAreas:r}=e(dt);return{hasEditedWidgetAreaIds:t()?.length>0,isSaving:r()}}),[]),{saveEditedWidgetAreas:r}=(0,l.useDispatch)(dt),i=t||!e;return(0,E.jsx)(S.Button,{variant:"primary",isBusy:t,"aria-disabled":i,onClick:i?void 0:r,size:"compact",children:t?(0,x.__)("Saving…"):(0,x.__)("Update")})},er=(0,E.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,E.jsx)(A.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"})}),tr=(0,E.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,E.jsx)(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"})}),rr=[{keyCombination:{modifier:"primary",character:"b"},description:(0,x.__)("Make the selected text bold.")},{keyCombination:{modifier:"primary",character:"i"},description:(0,x.__)("Make the selected text italic.")},{keyCombination:{modifier:"primary",character:"k"},description:(0,x.__)("Convert the selected text into a link.")},{keyCombination:{modifier:"primaryShift",character:"k"},description:(0,x.__)("Remove a link.")},{keyCombination:{character:"[["},description:(0,x.__)("Insert a link to a post or page.")},{keyCombination:{modifier:"primary",character:"u"},description:(0,x.__)("Underline the selected text.")},{keyCombination:{modifier:"access",character:"d"},description:(0,x.__)("Strikethrough the selected text.")},{keyCombination:{modifier:"access",character:"x"},description:(0,x.__)("Make the selected text inline code.")},{keyCombination:{modifier:"access",character:"0"},aliases:[{modifier:"access",character:"7"}],description:(0,x.__)("Convert the current heading to a paragraph.")},{keyCombination:{modifier:"access",character:"1-6"},description:(0,x.__)("Convert the current paragraph or heading to a heading of level 1 to 6.")},{keyCombination:{modifier:"primaryShift",character:"SPACE"},description:(0,x.__)("Add non breaking space.")}];function ir({keyCombination:e,forceAriaLabel:t}){const r=e.modifier?jt.displayShortcutList[e.modifier](e.character):e.character,i=e.modifier?jt.shortcutAriaLabel[e.modifier](e.character):e.character,s=Array.isArray(r)?r:[r];return(0,E.jsx)("kbd",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":t||i,children:s.map(((e,t)=>"+"===e?(0,E.jsx)(p.Fragment,{children:e},t):(0,E.jsx)("kbd",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-key",children:e},t)))})}const sr=function({description:e,keyCombination:t,aliases:r=[],ariaLabel:i}){return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-description",children:e}),(0,E.jsxs)("div",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-term",children:[(0,E.jsx)(ir,{keyCombination:t,forceAriaLabel:i}),r.map(((e,t)=>(0,E.jsx)(ir,{keyCombination:e,forceAriaLabel:i},t)))]})]})};const or=function({name:e}){const{keyCombination:t,description:r,aliases:i}=(0,l.useSelect)((t=>{const{getShortcutKeyCombination:r,getShortcutDescription:i,getShortcutAliases:s}=t(kt.store);return{keyCombination:r(e),aliases:s(e),description:i(e)}}),[e]);return t?(0,E.jsx)(sr,{keyCombination:t,description:r,aliases:i}):null},nr=({shortcuts:e})=>(0,E.jsx)("ul",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-list",role:"list",children:e.map(((e,t)=>(0,E.jsx)("li",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut",children:"string"==typeof e?(0,E.jsx)(or,{name:e}):(0,E.jsx)(sr,{...e})},t)))}),ar=({title:e,shortcuts:t,className:r})=>(0,E.jsxs)("section",{className:j("edit-widgets-keyboard-shortcut-help-modal__section",r),children:[!!e&&(0,E.jsx)("h2",{className:"edit-widgets-keyboard-shortcut-help-modal__section-title",children:e}),(0,E.jsx)(nr,{shortcuts:t})]}),cr=({title:e,categoryName:t,additionalShortcuts:r=[]})=>{const i=(0,l.useSelect)((e=>e(kt.store).getCategoryShortcuts(t)),[t]);return(0,E.jsx)(ar,{title:e,shortcuts:i.concat(r)})};function dr({isModalActive:e,toggleModal:t}){return(0,kt.useShortcut)("core/edit-widgets/keyboard-shortcuts",t,{bindGlobal:!0}),e?(0,E.jsxs)(S.Modal,{className:"edit-widgets-keyboard-shortcut-help-modal",title:(0,x.__)("Keyboard shortcuts"),onRequestClose:t,children:[(0,E.jsx)(ar,{className:"edit-widgets-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/edit-widgets/keyboard-shortcuts"]}),(0,E.jsx)(cr,{title:(0,x.__)("Global shortcuts"),categoryName:"global"}),(0,E.jsx)(cr,{title:(0,x.__)("Selection shortcuts"),categoryName:"selection"}),(0,E.jsx)(cr,{title:(0,x.__)("Block shortcuts"),categoryName:"block",additionalShortcuts:[{keyCombination:{character:"/"},description:(0,x.__)("Change the block type after adding a new paragraph."),ariaLabel:(0,x.__)("Forward-slash")}]}),(0,E.jsx)(ar,{title:(0,x.__)("Text formatting"),shortcuts:rr}),(0,E.jsx)(cr,{title:(0,x.__)("List View shortcuts"),categoryName:"list-view"})]}):null}const{Fill:lr,Slot:ur}=(0,S.createSlotFill)("EditWidgetsToolsMoreMenuGroup");lr.Slot=({fillProps:e})=>(0,E.jsx)(ur,{fillProps:e,children:e=>e.length>0&&e});const gr=lr;function pr(){const[e,t]=(0,p.useState)(!1),r=()=>t(!e);(0,kt.useShortcut)("core/edit-widgets/keyboard-shortcuts",r);const i=(0,T.useViewportMatch)("medium");return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(S.DropdownMenu,{icon:er,label:(0,x.__)("Options"),popoverProps:{placement:"bottom-end",className:"more-menu-dropdown__content"},toggleProps:{tooltipPosition:"bottom",size:"compact"},children:e=>(0,E.jsxs)(E.Fragment,{children:[i&&(0,E.jsx)(S.MenuGroup,{label:(0,x._x)("View","noun"),children:(0,E.jsx)(_.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"fixedToolbar",label:(0,x.__)("Top toolbar"),info:(0,x.__)("Access all block and document tools in a single place"),messageActivated:(0,x.__)("Top toolbar activated"),messageDeactivated:(0,x.__)("Top toolbar deactivated")})}),(0,E.jsxs)(S.MenuGroup,{label:(0,x.__)("Tools"),children:[(0,E.jsx)(S.MenuItem,{onClick:()=>{t(!0)},shortcut:jt.displayShortcut.access("h"),children:(0,x.__)("Keyboard shortcuts")}),(0,E.jsx)(_.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"welcomeGuide",label:(0,x.__)("Welcome Guide")}),(0,E.jsxs)(S.MenuItem,{role:"menuitem",icon:tr,href:(0,x.__)("https://wordpress.org/documentation/article/block-based-widgets-editor/"),target:"_blank",rel:"noopener noreferrer",children:[(0,x.__)("Help"),(0,E.jsx)(S.VisuallyHidden,{as:"span",children:(0,x.__)("(opens in a new tab)")})]}),(0,E.jsx)(gr.Slot,{fillProps:{onClose:e}})]}),(0,E.jsxs)(S.MenuGroup,{label:(0,x.__)("Preferences"),children:[(0,E.jsx)(_.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"keepCaretInsideBlock",label:(0,x.__)("Contain text cursor inside block"),info:(0,x.__)("Aids screen readers by stopping text caret from leaving blocks."),messageActivated:(0,x.__)("Contain text cursor inside block activated"),messageDeactivated:(0,x.__)("Contain text cursor inside block deactivated")}),(0,E.jsx)(_.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"themeStyles",info:(0,x.__)("Make the editor look like your theme."),label:(0,x.__)("Use theme styles")}),i&&(0,E.jsx)(_.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"showBlockBreadcrumbs",label:(0,x.__)("Display block breadcrumbs"),info:(0,x.__)("Shows block breadcrumbs at the bottom of the editor."),messageActivated:(0,x.__)("Display block breadcrumbs activated"),messageDeactivated:(0,x.__)("Display block breadcrumbs deactivated")})]})]})}),(0,E.jsx)(dr,{isModalActive:e,toggleModal:r})]})}const hr=function(){const e=(0,T.useViewportMatch)("medium"),t=(0,p.useRef)(),{hasFixedToolbar:r}=(0,l.useSelect)((e=>({hasFixedToolbar:!!e(_.store).get("core/edit-widgets","fixedToolbar")})),[]);return(0,E.jsx)(E.Fragment,{children:(0,E.jsxs)("div",{className:"edit-widgets-header",children:[(0,E.jsxs)("div",{className:"edit-widgets-header__navigable-toolbar-wrapper",children:[e&&(0,E.jsx)("h1",{className:"edit-widgets-header__title",children:(0,x.__)("Widgets")}),!e&&(0,E.jsx)(S.VisuallyHidden,{as:"h1",className:"edit-widgets-header__title",children:(0,x.__)("Widgets")}),(0,E.jsx)(Qt,{}),r&&e&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"selected-block-tools-wrapper",children:(0,E.jsx)(ye.BlockToolbar,{hideDragHandle:!0})}),(0,E.jsx)(S.Popover.Slot,{ref:t,name:"block-toolbar"})]})]}),(0,E.jsxs)("div",{className:"edit-widgets-header__actions",children:[(0,E.jsx)(Xt,{}),(0,E.jsx)(de.Slot,{scope:"core/edit-widgets"}),(0,E.jsx)(pr,{})]})]})})};const mr=function(){const{removeNotice:e}=(0,l.useDispatch)(v.store),{notices:t}=(0,l.useSelect)((e=>({notices:e(v.store).getNotices()})),[]),r=t.filter((({isDismissible:e,type:t})=>e&&"default"===t)),i=t.filter((({isDismissible:e,type:t})=>!e&&"default"===t)),s=t.filter((({type:e})=>"snackbar"===e)).slice(-3);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(S.NoticeList,{notices:i,className:"edit-widgets-notices__pinned"}),(0,E.jsx)(S.NoticeList,{notices:r,className:"edit-widgets-notices__dismissible",onRemove:e}),(0,E.jsx)(S.SnackbarList,{notices:s,className:"edit-widgets-notices__snackbar",onRemove:e})]})};function wr({blockEditorSettings:e}){const t=(0,l.useSelect)((e=>!!e(_.store).get("core/edit-widgets","themeStyles")),[]),r=(0,T.useViewportMatch)("medium"),i=(0,p.useMemo)((()=>t?e.styles:[]),[e,t]);return(0,E.jsxs)("div",{className:"edit-widgets-block-editor",children:[(0,E.jsx)(mr,{}),!r&&(0,E.jsx)(ye.BlockToolbar,{hideDragHandle:!0}),(0,E.jsxs)(ye.BlockTools,{children:[(0,E.jsx)(At,{}),(0,E.jsx)(ye.__unstableEditorStyles,{styles:i,scope:".editor-styles-wrapper"}),(0,E.jsx)(ye.BlockSelectionClearer,{children:(0,E.jsx)(ye.WritingFlow,{children:(0,E.jsx)(ye.BlockList,{className:"edit-widgets-main-block-list"})})})]})]})}const _r=(0,E.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,E.jsx)(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"})}),br=()=>{const e=(0,l.useSelect)((e=>{const{getEntityRecord:t}=e(m.store),r=t(ke,Se,Ee());return r?.blocks[0]?.clientId}),[]);return(0,l.useSelect)((t=>{const{getBlockRootClientId:r,getBlockSelectionEnd:i,getBlockOrder:s,getBlockIndex:o}=t(ye.store),n=t(dt).__experimentalGetInsertionPoint();if(n.rootClientId)return n;const a=i()||e,c=r(a);return a&&""===c?{rootClientId:a,insertionIndex:s(a).length}:{rootClientId:c,insertionIndex:o(a)+1}}),[e])};function fr(){const e=(0,T.useViewportMatch)("medium","<"),{rootClientId:t,insertionIndex:r}=br(),{setIsInserterOpened:i}=(0,l.useDispatch)(dt),s=(0,p.useCallback)((()=>i(!1)),[i]),o=e?"div":S.VisuallyHidden,[n,a]=(0,T.__experimentalUseDialog)({onClose:s,focusOnMount:!0}),c=(0,p.useRef)();return(0,E.jsxs)("div",{ref:n,...a,className:"edit-widgets-layout__inserter-panel",children:[(0,E.jsx)(o,{className:"edit-widgets-layout__inserter-panel-header",children:(0,E.jsx)(S.Button,{icon:_r,onClick:s,label:(0,x.__)("Close block inserter")})}),(0,E.jsx)("div",{className:"edit-widgets-layout__inserter-panel-content",children:(0,E.jsx)(ye.__experimentalLibrary,{showInserterHelpPanel:!0,shouldFocusBlock:e,rootClientId:t,__experimentalInsertionIndex:r,ref:c})})]})}function yr(){const{setIsListViewOpened:e}=(0,l.useDispatch)(dt),{getListViewToggleRef:t}=at((0,l.useSelect)(dt)),[r,i]=(0,p.useState)(null),s=(0,T.useFocusOnMount)("firstElement"),o=(0,p.useCallback)((()=>{e(!1),t().current?.focus()}),[t,e]),n=(0,p.useCallback)((e=>{e.keyCode!==jt.ESCAPE||e.defaultPrevented||(e.preventDefault(),o())}),[o]);return(0,E.jsxs)("div",{className:"edit-widgets-editor__list-view-panel",onKeyDown:n,children:[(0,E.jsxs)("div",{className:"edit-widgets-editor__list-view-panel-header",children:[(0,E.jsx)("strong",{children:(0,x.__)("List View")}),(0,E.jsx)(S.Button,{icon:L,label:(0,x.__)("Close"),onClick:o})]}),(0,E.jsx)("div",{className:"edit-widgets-editor__list-view-panel-content",ref:(0,T.useMergeRefs)([s,i]),children:(0,E.jsx)(ye.__experimentalListView,{dropZoneElement:r})})]})}function xr(){const{isInserterOpen:e,isListViewOpen:t}=(0,l.useSelect)((e=>{const{isInserterOpened:t,isListViewOpened:r}=e(dt);return{isInserterOpen:t(),isListViewOpen:r()}}),[]);return e?(0,E.jsx)(fr,{}):t?(0,E.jsx)(yr,{}):null}const vr={header:(0,x.__)("Widgets top bar"),body:(0,x.__)("Widgets and blocks"),sidebar:(0,x.__)("Widgets settings"),footer:(0,x.__)("Widgets footer")};const kr=function({blockEditorSettings:e}){const t=(0,T.useViewportMatch)("medium","<"),r=(0,T.useViewportMatch)("huge",">="),{setIsInserterOpened:i,setIsListViewOpened:s,closeGeneralSidebar:o}=(0,l.useDispatch)(dt),{hasBlockBreadCrumbsEnabled:n,hasSidebarEnabled:a,isInserterOpened:c,isListViewOpened:d,previousShortcut:u,nextShortcut:g}=(0,l.useSelect)((e=>({hasSidebarEnabled:!!e(Q).getActiveComplementaryArea(dt.name),isInserterOpened:!!e(dt).isInserterOpened(),isListViewOpened:!!e(dt).isListViewOpened(),hasBlockBreadCrumbsEnabled:!!e(_.store).get("core/edit-widgets","showBlockBreadcrumbs"),previousShortcut:e(kt.store).getAllShortcutKeyCombinations("core/edit-widgets/previous-region"),nextShortcut:e(kt.store).getAllShortcutKeyCombinations("core/edit-widgets/next-region")})),[]);(0,p.useEffect)((()=>{a&&!r&&(i(!1),s(!1))}),[a,r]),(0,p.useEffect)((()=>{!c&&!d||r||o()}),[c,d,r]);const h=d?(0,x.__)("List View"):(0,x.__)("Block Library"),m=d||c;return(0,E.jsx)(fe,{labels:{...vr,secondarySidebar:h},header:(0,E.jsx)(hr,{}),secondarySidebar:m&&(0,E.jsx)(xr,{}),sidebar:(0,E.jsx)(me.Slot,{scope:"core/edit-widgets"}),content:(0,E.jsx)(E.Fragment,{children:(0,E.jsx)(wr,{blockEditorSettings:e})}),footer:n&&!t&&(0,E.jsx)("div",{className:"edit-widgets-layout__footer",children:(0,E.jsx)(ye.BlockBreadcrumb,{rootLabelText:(0,x.__)("Widgets")})}),shortcuts:{previous:u,next:g}})};function jr(){const e=(0,l.useSelect)((e=>{const{getEditedWidgetAreas:t}=e(dt),r=t();return r?.length>0}),[]);return(0,p.useEffect)((()=>{const t=t=>{if(e)return t.returnValue=(0,x.__)("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,l.useSelect)((e=>!!e(_.store).get("core/edit-widgets","welcomeGuide")),[]),{toggle:r}=(0,l.useDispatch)(_.store),i=(0,l.useSelect)((e=>e(dt).getWidgetAreas({per_page:-1})),[]);if(!t)return null;const s=i?.every((e=>"wp_inactive_widgets"===e.id||e.widgets.every((e=>e.startsWith("block-"))))),o=null!==(e=i?.filter((e=>"wp_inactive_widgets"!==e.id)).length)&&void 0!==e?e:0;return(0,E.jsx)(S.Guide,{className:"edit-widgets-welcome-guide",contentLabel:(0,x.__)("Welcome to block Widgets"),finishButtonText:(0,x.__)("Get started"),onFinish:()=>r("core/edit-widgets","welcomeGuide"),pages:[{image:(0,E.jsx)(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,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("h1",{className:"edit-widgets-welcome-guide__heading",children:(0,x.__)("Welcome to block Widgets")}),s?(0,E.jsx)(E.Fragment,{children:(0,E.jsx)("p",{className:"edit-widgets-welcome-guide__text",children:(0,x.sprintf)((0,x._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.",o),o)})}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("p",{className:"edit-widgets-welcome-guide__text",children:(0,x.__)("You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.")}),(0,E.jsxs)("p",{className:"edit-widgets-welcome-guide__text",children:[(0,E.jsx)("strong",{children:(0,x.__)("Want to stick with the old widgets?")})," ",(0,E.jsx)(S.ExternalLink,{href:(0,x.__)("https://wordpress.org/plugins/classic-widgets/"),children:(0,x.__)("Get the Classic Widgets plugin.")})]})]})]})},{image:(0,E.jsx)(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,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("h1",{className:"edit-widgets-welcome-guide__heading",children:(0,x.__)("Make each block your own")}),(0,E.jsx)("p",{className:"edit-widgets-welcome-guide__text",children:(0,x.__)("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,E.jsx)(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,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("h1",{className:"edit-widgets-welcome-guide__heading",children:(0,x.__)("Get to know the block library")}),(0,E.jsx)("p",{className:"edit-widgets-welcome-guide__text",children:(0,p.createInterpolateElement)((0,x.__)("All of the blocks available to you live in the block library. You’ll find it wherever you see the <InserterIconImage /> icon."),{InserterIconImage:(0,E.jsx)("img",{className:"edit-widgets-welcome-guide__inserter-icon",alt:(0,x.__)("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,E.jsx)(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,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("h1",{className:"edit-widgets-welcome-guide__heading",children:(0,x.__)("Learn how to use the block editor")}),(0,E.jsxs)("p",{className:"edit-widgets-welcome-guide__text",children:[(0,x.__)("New to the block editor? Want to learn more about using it? "),(0,E.jsx)(S.ExternalLink,{href:(0,x.__)("https://wordpress.org/documentation/article/wordpress-block-editor/"),children:(0,x.__)("Here's a detailed guide.")})]})]})}]})}function Ar({nonAnimatedSrc:e,animatedSrc:t}){return(0,E.jsxs)("picture",{className:"edit-widgets-welcome-guide__image",children:[(0,E.jsx)("source",{srcSet:e,media:"(prefers-reduced-motion: reduce)"}),(0,E.jsx)("img",{src:t,width:"312",height:"240",alt:""})]})}const Er=function({blockEditorSettings:e}){const{createErrorNotice:t}=(0,l.useDispatch)(v.store);return(0,E.jsx)(xt,{children:(0,E.jsxs)(Tt,{blockEditorSettings:e,children:[(0,E.jsx)(kr,{blockEditorSettings:e}),(0,E.jsx)(Ut,{}),(0,E.jsx)(X.PluginArea,{onError:function(e){t((0,x.sprintf)((0,x.__)('The "%s" plugin has encountered an error and cannot be rendered.'),e))}}),(0,E.jsx)(jr,{}),(0,E.jsx)(Sr,{})]})})},Ir=["core/more","core/freeform","core/template-part",...It?[]:["core/block"]];function Cr(e,t){const r=document.getElementById(e),i=(0,p.createRoot)(r),s=(0,h.__experimentalGetCoreBlocks)().filter((e=>!(Ir.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,l.dispatch)(_.store).setDefaults("core/edit-widgets",{fixedToolbar:!1,welcomeGuide:!0,showBlockBreadcrumbs:!0,themeStyles:!0}),(0,l.dispatch)(d.store).reapplyBlockTypeFilters(),(0,h.registerCoreBlocks)(s),(0,w.registerLegacyWidgetBlock)(),(0,w.registerLegacyWidgetVariations)(t),Tr(c),(0,w.registerWidgetGroupBlock)(),t.__experimentalFetchLinkSuggestions=(e,r)=>(0,m.__experimentalFetchLinkSuggestions)(e,r,t),(0,d.setFreeformContentHandlerName)("core/html"),i.render((0,E.jsx)(Er,{blockEditorSettings:t})),i}const Br=Cr;function Nr(){g()("wp.editWidgets.reinitializeEditor",{since:"6.2",version:"6.3"})}const Tr=e=>{if(!e)return;const{metadata:t,settings:r,name:i}=e;t&&(0,d.unstable__bootstrapServerSideBlockDefinitions)({[i]:t}),(0,d.registerBlockType)(i,r)};(window.wp=window.wp||{}).editWidgets=t})();