!function(e,t){const{ajaxUrl:i,custom_callback:n,_wpnonce:o,custom:s}=customizerExtrasObject;t.each(s,(function(t,i){"single_section_panel"==t?e.panel(t,(function(t){t.expanded.bind((function(t){t&&e.previewer.previewUrl.set(i)}))})):e.section(t,(function(t){t.expanded.bind((function(n){const{id:o}=t;"archive_general_section"===o&&e.previewer.previewUrl()===i||n&&e.previewer.previewUrl.set(i)}))}))}));t.each(n,(function(i,n){wp.customize(i,(function(i){i.bind((function(i){t.each(n,(function(n,o){JSON.stringify(i)==n?t.each(o,(function(t,i){e.control(i).activate()})):t.each(o,(function(t,i){e.control(i).deactivate()}))})),i in n&&t.each(n[i],(function(t,i){e.control(i).activate()}))}))}))})),t(document).on("click",".customize-info-box-action-control .info-box-button",(function(){var e=t(this),n=e.data("action"),s=e.html();t.ajax({method:"post",url:i,data:{action:n,_wpnonce:o},beforeSend:function(){e.html("Processing"),e.attr("disabled",!0)},success:function(){e.html(s)},complete:function(){window.location.reload()}})}));const c={init:function(){this.headerBuilder(),this.footerBuilder(),this.addActiveClasses()},widgetSections:{},headerBuilderId:"",footerBuilderId:"",headerBuilder:function(){this.headerBuilderId="header_builder",this.widgetSections.header=this.builderBehaviour(this.headerBuilderId)},footerBuilder:function(){this.footerBuilderId="footer_builder",this.widgetSections.footer=this.builderBehaviour(this.footerBuilderId)},builderBehaviour:function(t){let i=e.control(t);const{widgets:n,builder_settings_section:o}=i.params;return[...this.getWidgetSections(n),o]},getWidgetSections:function(e){return Object.values(e).reduce(((e,t)=>{const{section:i}=t;return e=[...e,i]}),[])},addActiveClasses:function(){const i=this.widgetSections,{header:n,footer:o}=i,s=this.headerBuilderId,c=this.footerBuilderId;e.section.each(((i,r)=>{i.expanded.bind((function(d){if(d)if(i.contentContainer.hasClass("blog-postx-builder-related")){let t="";if(n.includes(r)&&(t=s),o.includes(r)&&(t=c),""!==t){let i=e.control(t);const{builder_settings_section:n}=i.params,{container:o}=i,s=e.section(n).contentContainer;o.parent().addClass("is-active").siblings().removeClass("is-active"),s.addClass("active-builder-setting").siblings().removeClass("active-builder-setting"),s.parents("#customize-controls").siblings("#customize-preview").addClass("blog-postx-builder--on")}}else t(".blog-postx-builder.is-active")&&t(".blog-postx-builder.is-active").removeClass("is-active"),t(".blog-postx-builder-related.active-builder-setting")&&t(".blog-postx-builder-related.active-builder-setting").removeClass("active-builder-setting"),t("#customize-preview").removeClass("blog-postx-builder--on")}))}))}};t(document).ready((function(){c.init()}))}(wp.customize,jQuery);