"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[4277],{34277:(e,t,s)=>{s.r(t),s.d(t,{ActionItem:()=>G.A,ComplementaryArea:()=>Q,ComplementaryAreaMoreMenuItem:()=>U,FullscreenMode:()=>W,InterfaceSkeleton:()=>X.A,NavigableRegion:()=>Z.A,PinnedItems:()=>J.A,store:()=>B});var r={};s.r(r),s.d(r,{closeModal:()=>k,disableComplementaryArea:()=>M,enableComplementaryArea:()=>L,openModal:()=>S,pinItem:()=>E,setDefaultComplementaryArea:()=>C,setFeatureDefaults:()=>N,setFeatureValue:()=>I,toggleFeature:()=>P,unpinItem:()=>j});var n={};s.r(n),s.d(n,{getActiveComplementaryArea:()=>R,isComplementaryAreaLoading:()=>V,isFeatureActive:()=>F,isItemPinned:()=>D,isModalActive:()=>O});var a=s(4921),i=s(56427),c=s(47143),o=s(27723),l=s(5573),u=s(39793);const m=(0,u.jsx)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,u.jsx)(l.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})}),d=(0,u.jsx)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,u.jsx)(l.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"})}),p=(0,u.jsx)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,u.jsx)(l.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"})});var h=s(86087),A=s(26873),f=s(41233),g=s(29491),v=s(92279);const y=(0,u.jsx)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,u.jsx)(l.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})});var b=s(64040),x=s.n(b);function _(e){return["core/edit-post","core/edit-site"].includes(e)?(x()(`${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?(x()("edit-site/template sidebar",{alternative:"edit-post/document",version:"6.6"}),"edit-post/document"):"core"===e&&"edit-site/block-inspector"===t?(x()("edit-site/block-inspector sidebar",{alternative:"edit-post/block",version:"6.6"}),"edit-post/block"):t}const C=(e,t)=>({type:"SET_DEFAULT_COMPLEMENTARY_AREA",scope:e=_(e),area:t=w(e,t)}),L=(e,t)=>({registry:s,dispatch:r})=>{t&&(e=_(e),t=w(e,t),s.select(f.store).get(e,"isComplementaryAreaVisible")||s.dispatch(f.store).set(e,"isComplementaryAreaVisible",!0),r({type:"ENABLE_COMPLEMENTARY_AREA",scope:e,area:t}))},M=e=>({registry:t})=>{e=_(e),t.select(f.store).get(e,"isComplementaryAreaVisible")&&t.dispatch(f.store).set(e,"isComplementaryAreaVisible",!1)},E=(e,t)=>({registry:s})=>{if(!t)return;e=_(e),t=w(e,t);const r=s.select(f.store).get(e,"pinnedItems");!0!==r?.[t]&&s.dispatch(f.store).set(e,"pinnedItems",{...r,[t]:!0})},j=(e,t)=>({registry:s})=>{if(!t)return;e=_(e),t=w(e,t);const r=s.select(f.store).get(e,"pinnedItems");s.dispatch(f.store).set(e,"pinnedItems",{...r,[t]:!1})};function P(e,t){return function({registry:s}){x()("dispatch( 'core/interface' ).toggleFeature",{since:"6.0",alternative:"dispatch( 'core/preferences' ).toggle"}),s.dispatch(f.store).toggle(e,t)}}function I(e,t,s){return function({registry:r}){x()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),r.dispatch(f.store).set(e,t,!!s)}}function N(e,t){return function({registry:s}){x()("dispatch( 'core/interface' ).setFeatureDefaults",{since:"6.0",alternative:"dispatch( 'core/preferences' ).setDefaults"}),s.dispatch(f.store).setDefaults(e,t)}}function S(e){return{type:"OPEN_MODAL",name:e}}function k(){return{type:"CLOSE_MODAL"}}const R=(0,c.createRegistrySelector)(e=>(t,s)=>{s=_(s);const r=e(f.store).get(s,"isComplementaryAreaVisible");if(void 0!==r)return!1===r?null:t?.complementaryAreas?.[s]}),V=(0,c.createRegistrySelector)(e=>(t,s)=>{s=_(s);const r=e(f.store).get(s,"isComplementaryAreaVisible"),n=t?.complementaryAreas?.[s];return r&&void 0===n}),D=(0,c.createRegistrySelector)(e=>(t,s,r)=>{var n;r=w(s=_(s),r);const a=e(f.store).get(s,"pinnedItems");return null===(n=a?.[r])||void 0===n||n}),F=(0,c.createRegistrySelector)(e=>(t,s,r)=>(x()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(f.store).get(s,r)));function O(e,t){return e.activeModal===t}const T=(0,c.combineReducers)({complementaryAreas:function(e={},t){switch(t.type){case"SET_DEFAULT_COMPLEMENTARY_AREA":{const{scope:s,area:r}=t;return e[s]?e:{...e,[s]:r}}case"ENABLE_COMPLEMENTARY_AREA":{const{scope:s,area:r}=t;return{...e,[s]:r}}}return e},activeModal:function(e=null,t){switch(t.type){case"OPEN_MODAL":return t.name;case"CLOSE_MODAL":return null}return e}}),B=(0,c.createReduxStore)("core/interface",{reducer:T,actions:r,selectors:n});function $({as:e=i.Button,scope:t,identifier:s,icon:r,selectedIcon:n,name:a,shortcut:o,...l}){const m=e,d=(0,v.usePluginContext)(),p=r||d.icon,h=s||`${d.name}/${a}`,A=(0,c.useSelect)(e=>e(B).getActiveComplementaryArea(t)===h,[h,t]),{enableComplementaryArea:f,disableComplementaryArea:g}=(0,c.useDispatch)(B);return(0,u.jsx)(m,{icon:n&&A?n:p,"aria-controls":h.replace("/",":"),"aria-checked":(y=l.role,["checkbox","option","radio","switch","menuitemcheckbox","menuitemradio","treeitem"].includes(y)?A:void 0),onClick:()=>{A?g(t):f(t,h)},shortcut:o,...l});var y}(0,c.register)(B);const z=({children:e,className:t,toggleButtonProps:s})=>{const r=(0,u.jsx)($,{icon:y,...s});return(0,u.jsxs)("div",{className:(0,a.A)("components-panel__header","interface-complementary-area-header",t),tabIndex:-1,children:[e,r]})};var G=s(59932);const Y=({__unstableExplicitMenuItem:e,__unstableTarget:t,...s})=>(0,u.jsx)(i.MenuItem,{...s});function U({scope:e,target:t,__unstableExplicitMenuItem:s,...r}){return(0,u.jsx)($,{as:r=>(0,u.jsx)(G.A,{__unstableExplicitMenuItem:s,__unstableTarget:`${e}/${t}`,as:Y,name:`${e}/plugin-more-menu`,...r}),role:"menuitemcheckbox",selectedIcon:m,name:t,scope:e,...r})}var J=s(11753);const q={open:{width:280},closed:{width:0},mobileOpen:{width:"100vw"}};function H({activeArea:e,isActive:t,scope:s,children:r,className:n,id:a}){const c=(0,g.useReducedMotion)(),o=(0,g.useViewportMatch)("medium","<"),l=(0,g.usePrevious)(e),m=(0,g.usePrevious)(t),[,d]=(0,h.useState)({});(0,h.useEffect)(()=>{d({})},[t]);const p={type:"tween",duration:c||o||l&&e&&e!==l?0:.3,ease:[.6,0,.4,1]};return(0,u.jsx)(i.Fill,{name:`ComplementaryArea/${s}`,children:(0,u.jsx)(i.__unstableAnimatePresence,{initial:!1,children:(m||t)&&(0,u.jsx)(i.__unstableMotion.div,{variants:q,initial:"closed",animate:o?"mobileOpen":"open",exit:"closed",transition:p,className:"interface-complementary-area__fill",children:(0,u.jsx)("div",{id:a,className:n,style:{width:o?"100vw":280},children:r})})})})}function K({children:e,className:t,closeLabel:s=(0,o.__)("Close plugin"),identifier:r,header:n,headerClassName:l,icon:y,isPinnable:b=!0,panelClassName:x,scope:_,name:w,title:C,toggleShortcut:L,isActiveByDefault:M}){const E=(0,v.usePluginContext)(),j=y||E.icon,P=r||`${E.name}/${w}`,[I,N]=(0,h.useState)(!1),{isLoading:S,isActive:k,isPinned:R,activeArea:V,isSmall:D,isLarge:F,showIconLabels:O}=(0,c.useSelect)(e=>{const{getActiveComplementaryArea:t,isComplementaryAreaLoading:s,isItemPinned:r}=e(B),{get:n}=e(f.store),a=t(_);return{isLoading:s(_),isActive:a===P,isPinned:r(_,P),activeArea:a,isSmall:e(A.store).isViewportMatch("< medium"),isLarge:e(A.store).isViewportMatch("large"),showIconLabels:n("core","showIconLabels")}},[P,_]),T=(0,g.useViewportMatch)("medium","<");!function(e,t,s,r,n){const a=(0,h.useRef)(!1),i=(0,h.useRef)(!1),{enableComplementaryArea:o,disableComplementaryArea:l}=(0,c.useDispatch)(B);(0,h.useEffect)(()=>{r&&n&&!a.current?(l(e),i.current=!0):i.current&&!n&&a.current?(i.current=!1,o(e,t)):i.current&&s&&s!==t&&(i.current=!1),n!==a.current&&(a.current=n)},[r,n,e,t,s,l,o])}(_,P,V,k,D);const{enableComplementaryArea:G,disableComplementaryArea:Y,pinItem:q,unpinItem:K}=(0,c.useDispatch)(B);if((0,h.useEffect)(()=>{M&&void 0===V&&!D?G(_,P):void 0===V&&D&&Y(_,P),N(!0)},[V,M,_,P,D,G,Y]),I)return(0,u.jsxs)(u.Fragment,{children:[b&&(0,u.jsx)(J.A,{scope:_,children:R&&(0,u.jsx)($,{scope:_,identifier:P,isPressed:k&&(!O||F),"aria-expanded":k,"aria-disabled":S,label:C,icon:O?m:j,showTooltip:!O,variant:O?"tertiary":void 0,size:"compact",shortcut:L})}),w&&b&&(0,u.jsx)(U,{target:w,scope:_,icon:j,children:C}),(0,u.jsxs)(H,{activeArea:V,isActive:k,className:(0,a.A)("interface-complementary-area",t),scope:_,id:P.replace("/",":"),children:[(0,u.jsx)(z,{className:l,closeLabel:s,onClose:()=>Y(_),toggleButtonProps:{label:s,size:"compact",shortcut:L,scope:_,identifier:P},children:n||(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("h2",{className:"interface-complementary-area-header__title",children:C}),b&&!T&&(0,u.jsx)(i.Button,{className:"interface-complementary-area__pin-unpin-item",icon:R?d:p,label:R?(0,o.__)("Unpin from toolbar"):(0,o.__)("Pin to toolbar"),onClick:()=>(R?K:q)(_,P),isPressed:R,"aria-expanded":R,size:"compact"})]})}),(0,u.jsx)(i.Panel,{className:x,children:e})]})]})}K.Slot=function({scope:e,...t}){return(0,u.jsx)(i.Slot,{name:`ComplementaryArea/${e}`,...t})};const Q=K,W=({isActive:e})=>((0,h.useEffect)(()=>{let e=!1;return document.body.classList.contains("sticky-menu")&&(e=!0,document.body.classList.remove("sticky-menu")),()=>{e&&document.body.classList.add("sticky-menu")}},[]),(0,h.useEffect)(()=>(e?document.body.classList.add("is-fullscreen-mode"):document.body.classList.remove("is-fullscreen-mode"),()=>{e&&document.body.classList.remove("is-fullscreen-mode")}),[e]),null);var X=s(76995),Z=s(13474)}}]);