(()=>{"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 s in r)e.o(r,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:r[s]})},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,{store:()=>C});var r={};e.r(r),e.d(r,{closeModal:()=>g,disableComplementaryArea:()=>u,enableComplementaryArea:()=>l,openModal:()=>A,pinItem:()=>p,setDefaultComplementaryArea:()=>c,setFeatureDefaults:()=>f,setFeatureValue:()=>y,toggleFeature:()=>m,unpinItem:()=>d});var s={};e.r(s),e.d(s,{getActiveComplementaryArea:()=>v,isComplementaryAreaLoading:()=>E,isFeatureActive:()=>b,isItemPinned:()=>M,isModalActive:()=>_});const n=window.wp.data,a=window.wp.deprecated;var o=e.n(a);const i=window.wp.preferences,c=(e,t)=>({type:"SET_DEFAULT_COMPLEMENTARY_AREA",scope:e,area:t}),l=(e,t)=>({registry:r,dispatch:s})=>{t&&(r.select(i.store).get(e,"isComplementaryAreaVisible")||r.dispatch(i.store).set(e,"isComplementaryAreaVisible",!0),s({type:"ENABLE_COMPLEMENTARY_AREA",scope:e,area:t}))},u=e=>({registry:t})=>{t.select(i.store).get(e,"isComplementaryAreaVisible")&&t.dispatch(i.store).set(e,"isComplementaryAreaVisible",!1)},p=(e,t)=>({registry:r})=>{if(!t)return;const s=r.select(i.store).get(e,"pinnedItems");!0!==(null==s?void 0:s[t])&&r.dispatch(i.store).set(e,"pinnedItems",{...s,[t]:!0})},d=(e,t)=>({registry:r})=>{if(!t)return;const s=r.select(i.store).get(e,"pinnedItems");r.dispatch(i.store).set(e,"pinnedItems",{...s,[t]:!1})};function m(e,t){return function({registry:r}){o()("dispatch( 'core/interface' ).toggleFeature",{since:"6.0",alternative:"dispatch( 'core/preferences' ).toggle"}),r.dispatch(i.store).toggle(e,t)}}function y(e,t,r){return function({registry:s}){o()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),s.dispatch(i.store).set(e,t,!!r)}}function f(e,t){return function({registry:r}){o()("dispatch( 'core/interface' ).setFeatureDefaults",{since:"6.0",alternative:"dispatch( 'core/preferences' ).setDefaults"}),r.dispatch(i.store).setDefaults(e,t)}}function A(e){return{type:"OPEN_MODAL",name:e}}function g(){return{type:"CLOSE_MODAL"}}const v=(0,n.createRegistrySelector)((e=>(t,r)=>{var s;const n=e(i.store).get(r,"isComplementaryAreaVisible");if(void 0!==n)return!1===n?null:null==t||null===(s=t.complementaryAreas)||void 0===s?void 0:s[r]})),E=(0,n.createRegistrySelector)((e=>(t,r)=>{var s;const n=e(i.store).get(r,"isComplementaryAreaVisible"),a=null==t||null===(s=t.complementaryAreas)||void 0===s?void 0:s[r];return n&&void 0===a})),M=(0,n.createRegistrySelector)((e=>(t,r,s)=>{const n=e(i.store).get(r,"pinnedItems");return(null==n?void 0:n[s])??!0})),b=(0,n.createRegistrySelector)((e=>(t,r,s)=>(o()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(i.store).get(r,s))));function _(e,t){return e.activeModal===t}const h=(0,n.combineReducers)({complementaryAreas:function(e={},t){switch(t.type){case"SET_DEFAULT_COMPLEMENTARY_AREA":{const{scope:r,area:s}=t;return e[r]?e:{...e,[r]:s}}case"ENABLE_COMPLEMENTARY_AREA":{const{scope:r,area:s}=t;return{...e,[r]:s}}}return e},activeModal:function(e=null,t){switch(t.type){case"OPEN_MODAL":return t.name;case"CLOSE_MODAL":return null}return e}}),C=(0,n.createReduxStore)("core/interface",{reducer:h,actions:r,selectors:s});(0,n.register)(C),(window.kubio=window.kubio||{}).interfaceStore=t})();
