!function(){"use strict";var t={};function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function r(t){var r=function(t){if("object"!=e(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(r)?r:r+""}function n(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,r(o.key),o)}}function o(t){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},o(t)}function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,{a:r}),r},t.d=function(e,r){for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},t.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var u=window.wp.i18n,c=window.wp.element,a=window.wp.compose,s=window.wp.data,l=window.wp.plugins,f=window.wp.components,p=window.wp.apiFetch,y=t.n(p);function b(t,e,n){return(e=r(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function d(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function w(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?d(Object(r),!0).forEach((function(e){b(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var h=window.ReactJSXRuntime;function v(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(v=function(){return!!t})()}var g=function(t){function r(t){var n,i,u,c;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),i=this,c=[t],u=o(u=r),(n=function(t,r){if(r&&("object"==e(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(i,v()?Reflect.construct(u,c||[],o(i).constructor):u.apply(i,c))).state={layouts:[]},n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&i(t,e)}(r,t),a=r,(s=[{key:"componentDidMount",value:function(){var t=this,e="/genesis/v1/layouts/singular,".concat(this.props.currentPostType,",").concat(this.props.currentPostID);y()({path:e}).then((function(e){for(var r=[{label:(0,u.__)("Default Layout","genesis"),value:""}],n=0,o=Object.keys(e);n<o.length;n++){var i=o[n];r.push({label:e[i].label,value:i})}t.setState({layouts:r})}))}},{key:"render",value:function(){var t=this;return(0,h.jsx)(c.Fragment,{children:(0,h.jsx)(f.Fill,{name:"GenesisSidebar",children:(0,h.jsx)(f.Panel,{children:(0,h.jsx)(f.PanelBody,{initialOpen:!0,title:(0,u.__)("Layout","genesis"),children:this.state.layouts.length?(0,h.jsx)(f.SelectControl,{label:(0,u.__)("Select Layout","genesis"),value:this.props.layout,options:this.state.layouts,onChange:function(e){return t.props.onChange(e)}}):(0,h.jsx)(f.Spinner,{})})})})})}}])&&n(a.prototype,s),Object.defineProperty(a,"prototype",{writable:!1}),a;var a,s}(c.Component),O=(0,a.compose)([(0,s.withSelect)((function(){return{layout:(0,s.select)("core/editor").getEditedPostAttribute("meta")._genesis_layout,currentPostID:(0,s.select)("core/editor").getCurrentPostId(),currentPostType:(0,s.select)("core/editor").getCurrentPostType()}})),(0,s.withDispatch)((function(t){return{onChange:function(e){var r,n;t("core/editor").editPost({meta:(r=e,n=(0,s.select)("core/editor").getEditedPostAttribute("meta"),w(w({},Object.keys(n).filter((function(t){return t.startsWith("_genesis")})).reduce((function(t,e){return t[e]=n[e],null===t[e]&&(t[e]=!1),t}),{})),{},b({},"_genesis_layout",r)))})}}}))])(g);(0,l.registerPlugin)("genesis-layout-toggle",{render:O})}();