Current File : /home/resuelf/www/wp-content/plugins/gutenberg/build/preferences-persistence/index.min.js
!function(){"use strict";var e={n:function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,{a:r}),r},d:function(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:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(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,{__unstableCreatePersistenceLayer:function(){return p},create:function(){return s}});var r=window.wp.apiFetch,n=e.n(r);const o={},c=window.localStorage;function s({preloadedData:e,localStorageRestoreKey:t="WP_PREFERENCES_RESTORE_DATA",requestDebounceMS:r=2500}={}){let s=e;const i=function(e,t){let r,n;return async function(...o){return n||r?(n&&await n,r&&(clearTimeout(r),r=null),new Promise(((c,s)=>{r=setTimeout((()=>{n=e(...o).then(((...e)=>{c(...e)})).catch((e=>{s(e)})).finally((()=>{n=null,r=null}))}),t)}))):new Promise(((t,r)=>{n=e(...o).then(((...e)=>{t(...e)})).catch((e=>{r(e)})).finally((()=>{n=null}))}))}}(n(),r);return{get:async function(){if(s)return s;const e=await n()({path:"/wp/v2/users/me?context=edit"}),r=e?.meta?.persisted_preferences,i=JSON.parse(c.getItem(t)),a=Date.parse(r?._modified)||0,f=Date.parse(i?._modified)||0;return s=r&&a>=f?r:i||o,s},set:function(e){const r={...e,_modified:(new Date).toISOString()};s=r,c.setItem(t,JSON.stringify(r)),i({path:"/wp/v2/users/me",method:"PUT",keepalive:!0,data:{meta:{persisted_preferences:r}}}).catch((()=>{}))}}}function i(e,t){const r="core/preferences",n="core/interface",o=e?.[n]?.preferences?.features?.[t],c=e?.[t]?.preferences?.features,s=o||c;if(!s)return e;const i=e?.[r]?.preferences;if(i?.[t])return e;let a,f;if(o){const r=e?.[n],o=e?.[n]?.preferences?.features;a={[n]:{...r,preferences:{features:{...o,[t]:void 0}}}}}if(c){const r=e?.[t],n=e?.[t]?.preferences;f={[t]:{...r,preferences:{...n,features:void 0}}}}return{...e,[r]:{preferences:{...i,[t]:s}},...a,...f}}const a=e=>e;function f(e,{from:t,to:r},n,o=a){const c="core/preferences",s=e?.[t]?.preferences?.[n];if(void 0===s)return e;const i=e?.[c]?.preferences?.[r]?.[n];if(i)return e;const f=e?.[c]?.preferences,u=e?.[c]?.preferences?.[r],d=e?.[t],l=e?.[t]?.preferences,p=o({[n]:s});return{...e,[c]:{preferences:{...f,[r]:{...u,...p}}},[t]:{...d,preferences:{...l,[n]:void 0}}}}function u(e){var t;const r=null!==(t=e?.panels)&&void 0!==t?t:{};return Object.keys(r).reduce(((e,t)=>{const n=r[t];return!1===n?.enabled&&e.inactivePanels.push(t),!0===n?.opened&&e.openPanels.push(t),e}),{inactivePanels:[],openPanels:[]})}function d(e){const t=function(e){const t=`WP_DATA_USER_${e}`,r=window.localStorage.getItem(t);return JSON.parse(r)}(e);return function(e){if(e)return e=i(e,"core/edit-widgets"),e=i(e,"core/customize-widgets"),e=i(e,"core/edit-post"),e=f(e=function(e){var t,r,n;const o="core/interface",c="core/preferences",s=e?.[o]?.enableItems;if(!s)return e;const i=null!==(t=e?.[c]?.preferences)&&void 0!==t?t:{},a=null!==(r=s?.singleEnableItems?.complementaryArea)&&void 0!==r?r:{},f=Object.keys(a).reduce(((e,t)=>{const r=a[t];return e?.[t]?.complementaryArea?e:{...e,[t]:{...e[t],complementaryArea:r}}}),i),u=null!==(n=s?.multipleEnableItems?.pinnedItems)&&void 0!==n?n:{},d=Object.keys(u).reduce(((e,t)=>{const r=u[t];return e?.[t]?.pinnedItems?e:{...e,[t]:{...e[t],pinnedItems:r}}}),f),l=e[o];return{...e,[c]:{preferences:d},[o]:{...l,enableItems:void 0}}}(e=function(e){const t="core/interface",r="core/preferences",n=e?.[t]?.preferences?.features,o=n?Object.keys(n):[];return o?.length?o.reduce((function(e,o){if(o.startsWith("core"))return e;const c=n?.[o];if(!c)return e;const s=e?.[r]?.preferences?.[o];if(s)return e;const i=e?.[r]?.preferences,a=e?.[t],f=e?.[t]?.preferences?.features;return{...e,[r]:{preferences:{...i,[o]:c}},[t]:{...a,preferences:{features:{...f,[o]:void 0}}}}}),e):e}(e=i(e,"core/edit-site"))),{from:"core/edit-post",to:"core/edit-post"},"hiddenBlockTypes"),e=f(e,{from:"core/edit-post",to:"core/edit-post"},"editorMode"),e=f(e,{from:"core/edit-post",to:"core/edit-post"},"preferredStyleVariations"),e=f(e,{from:"core/edit-post",to:"core/edit-post"},"panels",u),e=f(e,{from:"core/editor",to:"core/edit-post"},"isPublishSidebarEnabled"),e=f(e,{from:"core/edit-site",to:"core/edit-site"},"editorMode"),e?.["core/preferences"]?.preferences}(t)}function l(e){let t=(r=e,Object.keys(r).reduce(((e,t)=>{const n=r[t];if(n?.complementaryArea){const r={...n};return delete r.complementaryArea,r.isComplementaryAreaVisible=!0,e[t]=r,e}return e}),r));var r;return t=function(e){var t,r;let n=e;return["allowRightClickOverrides","distractionFree","fixedToolbar","focusMode","inactivePanels","keepCaretInsideBlock","mostUsedBlocks","openPanels","showBlockBreadcrumbs","showIconLabels","showListViewByDefault"].forEach((t=>{void 0!==e?.["core/edit-post"]?.[t]&&(n={...n,core:{...n?.core,[t]:e["core/edit-post"][t]}},delete n["core/edit-post"][t]),void 0!==e?.["core/edit-site"]?.[t]&&delete n["core/edit-site"][t]})),0===Object.keys(null!==(t=n?.["core/edit-post"])&&void 0!==t?t:{})?.length&&delete n["core/edit-post"],0===Object.keys(null!==(r=n?.["core/edit-site"])&&void 0!==r?r:{})?.length&&delete n["core/edit-site"],n}(t),t}function p(e,t){const r=`WP_PREFERENCES_USER_${t}`,n=JSON.parse(window.localStorage.getItem(r)),o=Date.parse(e&&e._modified)||0,c=Date.parse(n&&n._modified)||0;let i;return i=e&&o>=c?l(e):n?l(n):d(t),s({preloadedData:i,localStorageRestoreKey:r})}(window.wp=window.wp||{}).preferencesPersistence=t}();
//# sourceMappingURL=index.min.js.map