!function(d){"use strict";window.bhfb={init:function(){this.builderGridContentFlag=!1,this.updateGridDelay=200,this.currentDevice="desktop",this.currentArea="header",this.currentRowInput="",this.currentRow="",this.currentColumn="",this.currentColumnPos="",this.currentComponent="",this.currentBuilder="",this.currentBuilderType="",this.componentsOrder="",this.preventEmptyRowValues(),this.customizeNavigation(),this.elementsPopup(),this.elementsButton(),this.storeGlobals(),this.devicesSwitcher(),this.elementsPopupContent(),this.builderGridContent(),this.elementsSortable(),this.builderCustomColumns(),this.builderColumnsLayout(),this.footerCustomizerOptions(),this.headerPresets(),this.showHideBuilder(),this.showHideBuilderTop()},jsonDecode:function(e){return JSON.parse(e.replace(/'/g,'"').replace(";",""))},preventEmptyRowValues:function(){var e=["above","main","below"];for(const o of["header","footer"])for(const t of e)""==d("#_customize-input-botiga_"+o+"_row__"+t+"_"+o+"_row").val()&&d("#_customize-input-botiga_"+o+"_row__"+t+"_"+o+"_row").val(botiga_hfb.rows.defaults[t+"_"+o+"_row"]);""==d("#_customize-input-botiga_header_row__mobile_offcanvas").val()&&d("#_customize-input-botiga_header_row__mobile_offcanvas").val(botiga_hfb.rows.defaults.mobile_offcanvas)},customizeNavigation:function(){const o=["sub-accordion-section-botiga_section_hb_presets","sub-accordion-section-botiga_section_hb_above_header_row","sub-accordion-section-botiga_section_hb_main_header_row","sub-accordion-section-botiga_section_hb_below_header_row","sub-accordion-section-botiga_section_hb_mobile_offcanvas","sub-accordion-section-botiga_section_hb_component__logo","sub-accordion-section-botiga_section_hb_component__search","sub-accordion-section-botiga_section_hb_component__social","sub-accordion-section-botiga_section_hb_component__menu","sub-accordion-section-botiga_section_hb_component__secondary_menu","sub-accordion-section-botiga_section_hb_component__contact_info","sub-accordion-section-botiga_section_hb_component__button","sub-accordion-section-botiga_section_hb_component__button2","sub-accordion-section-botiga_section_hb_component__html","sub-accordion-section-botiga_section_hb_component__html2","sub-accordion-section-botiga_section_hb_component__shortcode","sub-accordion-section-botiga_section_hb_component__login_register","sub-accordion-section-botiga_section_hb_component__woo_icons","sub-accordion-section-botiga_section_hb_component__pll_switcher","sub-accordion-section-botiga_section_hb_component__wpml_switcher","sub-accordion-section-botiga_section_hb_component__mobile_offcanvas_menu","sub-accordion-section-botiga_section_hb_component__mobile_hamburger","sub-accordion-section-botiga_section_fb_above_footer_row","sub-accordion-section-botiga_section_fb_main_footer_row","sub-accordion-section-botiga_section_fb_below_footer_row","sub-accordion-section-botiga_section_fb_component__footer_menu","sub-accordion-section-botiga_section_fb_component__copyright","sub-accordion-section-botiga_section_fb_component__social","sub-accordion-section-botiga_section_fb_component__button","sub-accordion-section-botiga_section_fb_component__button2","sub-accordion-section-botiga_section_fb_component__html","sub-accordion-section-botiga_section_fb_component__html2","sub-accordion-section-botiga_section_fb_component__shortcode","sub-accordion-section-botiga_section_fb_component__widget1","sub-accordion-section-botiga_section_fb_component__widget2","sub-accordion-section-botiga_section_fb_component__widget3","sub-accordion-section-botiga_section_fb_component__widget4"];for(const i of["above","main","below"])for(let e=1;e<=6;e++)o.push("sub-accordion-section-botiga_header_row__"+i+"_header_row_column"+e),o.push("sub-accordion-section-botiga_footer_row__"+i+"_footer_row_column"+e);let t="";d(document).on("mouseover focus",".customize-section-back",function(e){t=d(".control-section.open").attr("id")}),d(document).on("click keydown",".customize-section-back",function(e){if(o.includes(t))return-1!==t.indexOf("above_header_row_column")?(wp.customize.section("botiga_section_hb_above_header_row").focus(),!1):-1!==t.indexOf("main_header_row_column")?(wp.customize.section("botiga_section_hb_main_header_row").focus(),!1):-1!==t.indexOf("below_header_row_column")?(wp.customize.section("botiga_section_hb_below_header_row").focus(),!1):-1!==t.indexOf("above_footer_row_column")?(wp.customize.section("botiga_section_fb_above_footer_row").focus(),!1):-1!==t.indexOf("main_footer_row_column")?(wp.customize.section("botiga_section_fb_main_footer_row").focus(),!1):-1!==t.indexOf("below_footer_row_column")?(wp.customize.section("botiga_section_fb_below_footer_row").focus(),!1):void(-1!==t.indexOf("_hb_")||-1!==t.indexOf("_header_")?wp.customize.section("botiga_section_hb_wrapper"):wp.customize.section("botiga_section_fb_wrapper")).focus()})},storeGlobals:function(){const o=this;d(" .wp-full-overlay-footer .devices button, .botiga-devices-preview button").on("click",function(){let e=d(this).attr("data-device");"tablet"===e&&(e="mobile"),"footer"===o.currentBuilderType&&(e="desktop"),o.currentDevice=e,o.builderGridContent()}),d(document).on("click mouseover",".botiga-bhfb-area:not(.bhfb-available-components)",function(e){return!d("#botiga-bhfb-elements").hasClass("show")&&(o.currentRowInput=d("#_customize-input-botiga_"+o.currentBuilderType+"_row__"+d(this).data("bhfb-row")),o.currentRow=d(this).closest(".botiga-bhfb-row"),o.currentColumnPos=d(this).index()-1,o.currentColumn=d(this),void(!o.currentRow.length&&d(this).hasClass("botiga-bhfb-area-offcanvas")&&(o.currentRowInput=d("#_customize-input-botiga_header_row__mobile_offcanvas"),o.currentRow=d(".botiga-bhfb-area-offcanvas"),o.currentColumnPos=d(this).index())))}),d(document).on("click mouseover",".bhfb-button",function(e){o.currentComponent=d(this).data("bhfb-id")})},devicesSwitcher:function(){d(" .wp-full-overlay-footer .devices button, .botiga-devices-preview button").on("click",function(){var e=d(this).attr("data-device");"mobile"===e&&(e="tablet"),d(".botiga-bhfb-devices .botiga-bhfb-device-link").removeClass("active"),d('.botiga-bhfb-devices .botiga-bhfb-device-link[data-device="'+e+'"]').addClass("active")}),d(".botiga-bhfb-devices .botiga-bhfb-device-link").on("click",function(e){e.preventDefault();e=d(this).attr("data-device");d(' .wp-full-overlay-footer .devices button[data-device="'+e+'"]').trigger("click")})},getElementsUnused:function(){var e;let o=botiga_hfb.components.desktop,t=botiga_hfb.components.mobile,i=["#_customize-input-botiga_header_row__above_header_row","#_customize-input-botiga_header_row__main_header_row","#_customize-input-botiga_header_row__below_header_row","#_customize-input-botiga_header_row__mobile_offcanvas"];"footer"===this.currentBuilderType&&(o=botiga_hfb.components.footer,i=["#_customize-input-botiga_footer_row__above_footer_row","#_customize-input-botiga_footer_row__main_footer_row","#_customize-input-botiga_footer_row__below_footer_row"]);for(e of i){for(var n of o){var _=this.jsonDecode(d(e).val());if(_.desktop.length)for(const r of _.desktop)o=o.filter(e=>!r.includes(e.id))}for(var n of t){var a=this.jsonDecode(d(e).val());if(a.mobile.length)for(const s of a.mobile)t=t.filter(e=>!s.includes(e.id));if(-1!==e.indexOf("row__mobile_offcanvas")&&a.mobile_offcanvas.length)for(const c of a.mobile_offcanvas)t=t.filter(e=>!c.includes(e.id))}}return{desktop:o,mobile:t}},elementsPopup:function(){const n=this;d(document).on("click",".botiga-bhfb-area:not(.bhfb-available-components)",function(e){const o=n.currentBuilder.find("#botiga-bhfb-elements"),t=d(this)[0].getBoundingClientRect(),i=d(this).data("bhfb-row");setTimeout(function(){return o.css("top",0),o.css("left",t.left),o.css("top",t.top-(o.height()+50)),n.isElementInViewport(o)?(o.css("left",t.left),o.css("right","auto")):(o.css("left","auto"),o.css("right",25)),!e.target.classList.contains("bhfb-remove-element")&&!e.target.classList.contains("bhfb-button")&&void o.addClass("show")},200),n.elementsPopupContent(i),n.builderGridContent()}),d("#customize-preview iframe").on("mouseup",function(e){n.closeElementsPopup(e)}),d(document).on("mouseup",function(e){return!!n.currentBuilder&&void n.closeElementsPopup(e)})},closeElementsPopup:function(e){const o=this.currentBuilder.find("#botiga-bhfb-elements");null===e.target.closest("#botiga-bhfb-elements")&&o.removeClass("show")},isElementInViewport:function(e){e=(e="function"==typeof jQuery&&e instanceof jQuery?e[0]:e).getBoundingClientRect();return 0<=e.top&&0<=e.left&&e.bottom<=(window.innerHeight||d(window).height())&&e.right<=(window.innerWidth||d(window).width())},elementsPopupContent:function(e=""){const o=this.getElementsUnused(),t=d(".botiga-bhfb-elements-desktop"),i=d(".botiga-bhfb-elements-mobile");t.html(""),i.html("");let n="hb";if(this.currentBuilderType&&"footer"===this.currentBuilderType&&(n="fb"),o.desktop.length)for(const _ of o.desktop)t.append('
");if(o.mobile="mobile_offcanvas"!==e?o.mobile.filter(e=>"mobile_offcanvas_menu"!==e.id):o.mobile.filter(e=>"secondary_menu"!==e.id&&"mobile_hamburger"!==e.id),o.mobile.length)for(const a of o.mobile)i.append('
");this.addUpsellComponents()},updateAvailableComponents:function(){"header"===this.currentBuilderType&&(d(".botiga-header-builder-available-components").html(""),d(".botiga-header-builder-available-components").html(d(".botiga-bhfb-header .botiga-bhfb-elements-desktop").html()),d(".botiga-header-builder-available-mobile-components").html(""),d(".botiga-header-builder-available-mobile-components").html(d(".botiga-bhfb-header .botiga-bhfb-elements-mobile").html())),"footer"===this.currentBuilderType&&(d(".botiga-footer-builder-available-footer-components").html(""),d(".botiga-footer-builder-available-footer-components").html(d(".botiga-bhfb-footer .botiga-bhfb-elements-desktop").html()))},addUpsellComponents:function(){if(!botiga_hfb.upsell_components.enable)return!1;let e="",o="header"===this.currentBuilderType?botiga_hfb.upsell_components.header:botiga_hfb.upsell_components.footer;for(const i of o)e+=`
');e++}if(-1!==t.indexOf("mobile_offcanvas"))if(d(".botiga-bhfb-area-offcanvas").html(""),n.mobile_offcanvas.length)for(i of n.mobile_offcanvas[0])i=l.getElementData(i),d(".botiga-bhfb-area-offcanvas").append('