!function(t){"use strict";window.awb_oc_timeouts={},window.awbOffCanvas={timeouts:{},capitalize:function(t){return t.charAt(0).toUpperCase()+t.slice(1)},set:function(t,n,e){t=t?"_"+t:"_data";let a=localStorage.getItem("off_canvas"+t);a=a?JSON.parse(a):{},a[n]=e,localStorage.setItem("off_canvas"+t,JSON.stringify(a))},get:function(t,n){t=t?"_"+t:"_data";let e=localStorage.getItem("off_canvas"+t);return e=e?JSON.parse(e):{},e[n]||""},animationsWithoutDirection:["flash","rubberBand","shake","flipinx","flipiny","lightspeedin","flipOutX","flipOutY","lightSpeedOut"],open_off_canvas:function(n,e=!0,a=!1){const o=t('.awb-off-canvas-wrap[data-id="'+n+'"]'),i=o.find(".awb-off-canvas"),s=window["off_canvas_"+n],c=this;if(!o.length)return;if(o.hasClass("awb-show")&&a)return void this.close_off_canvas(n);if(this.set(n,"last_open_date",new Date),o.hasClass("awb-show")&&!a)return;let f=s.enter_animation;const r=s.enter_animation_direction&&"static"!==s.enter_animation_direction?this.capitalize(s.enter_animation_direction):"",d=s.enter_animation_speed||1,l=s.enter_animation_timing||"ease";if(("off"===s.status_css_animations||"desktop"===s.status_css_animations&&window.cssua.ua.mobile)&&(f=!1),f){if(this.animationsWithoutDirection.includes(f)||(f=f+"In"+r),i.addClass("fusion-animated "+f),i.attr("data-animation-type",f),i.css({visibility:"visible","animation-duration":d+"s","animation-timing-function":l}),"sliding-bar"===s.type&&"push"===s.transition&&"top"===s.position){const n={transition:"margin-top "+s.enter_animation_speed+"s"};n.marginTop=i.outerHeight()+"px";let e="#wrapper";o.hasClass("init-for-studio")&&(e=".post-preview"),t(e).css(n);const a=t(".fusion-tb-header").find(".fusion-sticky-container.fusion-container-stuck");a.length&&a.each(function(){t(this).attr("data-top",t(this).css("top")),t(this).css({top:"calc("+n.marginTop+" + "+t(this).attr("data-top")+")",transition:"top "+s.enter_animation_speed+"s"})})}if("sliding-bar"===s.type&&"push"===s.transition&&("left"===s.position||"right"===s.position)){const n={transition:"margin-inline-start "+s.enter_animation_speed+"s"};t("body").hasClass("rtl")?(n.marginInlineStart="-"+i.outerWidth()+"px","right"===s.position&&(n.marginInlineStart=i.outerWidth()+"px")):(n.marginInlineStart=i.outerWidth()+"px","right"===s.position&&(n.marginInlineStart="-"+i.outerWidth()+"px"));let e="#wrapper";o.hasClass("init-for-studio")&&(e=".post-preview"),t(e).css(n),t('#sliders-container .tfs-slider[data-parallax="1"]').length&&t('#sliders-container .tfs-slider[data-parallax="1"]').css(n)}}else this.enableTrapFocus(o);if("yes"===s.overlay&&"no"===s.overlay_page_scrollbar&&t("html").css("overflow","hidden"),o.addClass("awb-show"),t('a[href^="#awb-oc__'+n+'"]').addClass("awb-oc-active"),e){const t=this.get(n,"open_count")||0;this.set(n,"open_count",t+1)}const w=parseInt(s.auto_close_after_time);w&&(window.awb_oc_timeouts["close_after_time_"+n]=setTimeout(()=>{c.close_off_canvas(n)},1e3*w));const _=parseInt(s.show_close_button_after_time);_&&(window.awb_oc_timeouts["show_close_button_"+n]=setTimeout(()=>{i.children(".off-canvas-close").removeClass("hidden")},1e3*_)),o.trigger(t.Event("awb-oc-opened"),[n])},close_off_canvas:function(n,e=!0){const a=t('.awb-off-canvas-wrap[data-id="'+n+'"]'),o=a.find(".awb-off-canvas"),i=window["off_canvas_"+n];if(0===a.length||void 0===i)return;let s=i.exit_animation;const c=i.exit_animation_direction&&"static"!==i.exit_animation_direction?this.capitalize(i.exit_animation_direction):"",f=i.exit_animation_speed||1,r=i.exit_animation_timing||"ease";if(("off"===i.status_css_animations||"desktop"===i.status_css_animations&&window.cssua.ua.mobile)&&(s=!1),s){if(this.animationsWithoutDirection.includes(s)||(s=s+"Out"+c),o.addClass("fusion-animated "+s),o.attr("data-animation-type",s),o.addClass("is-closing"),o.css({"animation-duration":f+"s","animation-timing-function":r}),"sliding-bar"===i.type&&"push"===i.transition&&"top"===i.position){const n={transition:"margin-top "+i.enter_animation_speed+"s",marginTop:0};let e="#wrapper";a.hasClass("init-for-studio")&&(e=".post-preview"),t(e).css(n);const o=t(".fusion-tb-header").find(".fusion-sticky-container");o.length&&o.each(function(){const n=this;void 0!==t(this).attr("data-top")&&(t(this).css("top",t(this).attr("data-top")),t(this).removeAttr("data-top"),setTimeout(function(){t(n).css("transition","")},1e3*i.enter_animation_speed))})}if("sliding-bar"===i.type&&"push"===i.transition&&("left"===i.position||"right"===i.position)){const n={transition:"margin-inline-start "+i.exit_animation_speed+"s",marginInlineStart:0};let e="#wrapper";a.hasClass("init-for-studio")&&(e=".post-preview"),t(e).css(n),t('#sliders-container .tfs-slider[data-parallax="1"]').length&&t('#sliders-container .tfs-slider[data-parallax="1"]').css(n)}}else"yes"===i.overlay&&a.hasClass("init-for-studio")&&o.addClass("is-closing"),"no"===i.overlay&&a.hasClass("init-for-studio")&&t("#icon-bar .go-back").click(),a.removeClass("awb-show");if(t('a[href^="#awb-oc__'+n+'"]').removeClass("awb-oc-active"),"yes"===i.overlay&&"no"===i.overlay_page_scrollbar&&t("html").css("overflow",""),setTimeout(()=>{this.removeHash()},10),e){const t=this.get(n,"close_count")||0;this.set(n,"close_count",t+1)}this.set(n,"closed",!0),clearTimeout(window.awb_oc_timeouts["close_after_time_"+n]),clearTimeout(window.awb_oc_timeouts["show_close_button_"+n]);parseInt(i.show_close_button_after_time)&&o.children(".off-canvas-close").addClass("hidden"),a.trigger(t.Event("awb-oc-closed"),[n]),this.moveOCContentToPostCard(a)},removeHash(){const t=window.location.href.split("#")[0];history.replaceState({},"",t)},enableTrapFocus(t){if(!t.hasClass("type-popup"))return;const n=t.find(".awb-off-canvas"),e=n.find('a[href]:not([disabled]):visible, button:not([disabled]):visible, textarea:not([disabled]):visible, input[type="text"]:not([disabled]):visible, input[type="radio"]:not([disabled]):visible, input[type="checkbox"]:not([disabled]):visible, select:not([disabled]):visible'),a=e[0],o=e[e.length-1];setTimeout(()=>{n[0].focus()},100),n[0].addEventListener("keydown",function(t){("Tab"===t.key||9===t.keyCode)&&(t.shiftKey?document.activeElement===a&&(o.focus(),t.preventDefault()):document.activeElement===o&&(a.focus(),t.preventDefault()))})},movePostCardOCContentToOC(n,e){const a=e.closest(".post-card:not(.fusion_builder_column_inner)");if(a.length&&a.children(".awb-post-card-off-canvas-content").length){const e=t('.awb-off-canvas-wrap[data-id="'+n+'"]');if(e.length){const o=e.find(".off-canvas-content"),i=a.children(".awb-post-card-off-canvas-content");o.data("post-card",i).empty(),i.children().appendTo(o),o.children().find(".fusion-lottie").each(function(){if(!t(this).find("lottie-player").length){const n=t(this).find(".fusion-lottie-animation"),e=parseInt(n.data("speed")),a=parseInt(n.data("loop"));let o=parseInt(n.data("reverse"));o=1===o?-1:0,n.append('<lottie-player loop="'+a+'" speed="'+e+'" direction="'+o+'"></lottie-player>')}}),setTimeout(function(){t(window).trigger("fusion-dynamic-content-render",o)},10),o.find(".full-video, .video-shortcode, .wooslider .slide-content").fitVids(),o.find(".fusion-flexslider, .flexslider").each(function(){1<t(this).find(".slides li").length&&t(this).flexslider(0)}),o.find(".awb-openstreet-map").trigger("awb_openstreetmap/updateMap"),window.awbOffCanvas.handlePagination(n,e,a)}}},handlePagination(t,n,e){const a=n.find(".off-canvas-content").find(".fusion-pagination-tb");if(a.length){const o=e.next().length?e.next():e.parent().children().first(),i=e.prev().length?e.prev():e.parent().children().last(),s=a.find(".fusion-tb-next"),c=a.find(".fusion-tb-previous");a.hasClass("layout-preview")&&(s.find(".fusion-item-media").html(o.children(".awb-post-card-off-canvas-add-content").find(".awb-thumbnail").html()),s.find(".fusion-item-title").html(o.children(".awb-post-card-off-canvas-add-content").find(".awb-title").html()),c.find(".fusion-item-media").html(i.children(".awb-post-card-off-canvas-add-content").find(".awb-thumbnail").html()),c.find(".fusion-item-title").html(i.children(".awb-post-card-off-canvas-add-content").find(".awb-title").html())),s.off(),c.off(),s.one("click",function(e){e.preventDefault(),window.awbOffCanvas.moveOCContentToPostCard(n),setTimeout(function(){window.awbOffCanvas.movePostCardOCContentToOC(t,o.children(".awb-post-card-off-canvas-content"))},10)}),c.one("click",function(e){e.preventDefault(),window.awbOffCanvas.moveOCContentToPostCard(n),setTimeout(function(){window.awbOffCanvas.movePostCardOCContentToOC(t,i.children(".awb-post-card-off-canvas-content"))},10)})}},moveOCContentToPostCard(t){const n=t.find(".off-canvas-content"),e=void 0!==n.data("post-card")?n.data("post-card"):{};e.length&&(n.removeData("post-card"),n.children().appendTo(e))}},t(".awb-off-canvas").on("animationend",function(n){if(n.target!==this)return;const e=t(this),a=e.parent();e.attr("data-animation-type")&&e.removeClass("fusion-animated").removeClass(e.attr("data-animation-type")).removeAttr("data-animation-type"),e.hasClass("is-closing")?(e.removeClass("is-closing"),e.addClass("oc-waiting-for-close"),a.removeClass("awb-show"),a.hasClass("init-for-studio")&&t("#icon-bar .go-back").click()):window.awbOffCanvas.enableTrapFocus(a)}),t(".awb-off-canvas-wrap").on("transitionend",function(n){const e=t(this).find(".awb-off-canvas");e.hasClass("is-closing")&&t(this).hasClass("init-for-studio")&&(t("#icon-bar .go-back").click(),e.removeClass("is-closing")),e.removeClass("oc-waiting-for-close")}),t(window).on("load",function(){if(location.hash&&location.hash.startsWith("#awb-oc__")||location.hash&&location.hash.startsWith("#awb-open-oc__")){const t=location.hash.split("__")[1];window.awbOffCanvas.open_off_canvas(t,!1,!1)}t(".awb-off-canvas-wrap.init-for-studio").each(function(n,e){const a=t(e).data("id");window.awbOffCanvas.open_off_canvas(a,!1,!1)}),t(".awb-off-canvas-wrap").each(function(){t(this).on("awb-oc-closed",function(){t(this).find(".fusion-youtube iframe").each(function(){this.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*")}),t(this).find(".fusion-vimeo iframe").each(function(){new Vimeo.Player(this).pause()}),t(this).find("video").each(function(){t(this).get(0).pause()}),t(this).find(".mejs-audio").each(function(){t(this).find(".mejs-playpause-button.mejs-pause button").trigger("click")})})})}),t("body").on("click",'a[href^="#awb-oc__"]',function(n){n.preventDefault();const e=(t(this).attr("href")||"").split("__")[1];window.awbOffCanvas.movePostCardOCContentToOC(e,t(this)),window.awbOffCanvas.open_off_canvas(e,!1,!0)}),t("body").on("click",'a[href^="#awb-open-oc__"]',function(n){n.preventDefault();const e=(t(this).attr("href")||"").split("__")[1];window.awbOffCanvas.movePostCardOCContentToOC(e,t(this)),window.awbOffCanvas.open_off_canvas(e,!1,!1)}),t("body").on("click",'a[href^="#awb-close-oc__"]',function(n){n.preventDefault();const e=(t(this).attr("href")||"").split("__")[1];e?window.awbOffCanvas.close_off_canvas(e):t(".awb-off-canvas-wrap.awb-show").each(function(){const n=t(this).data("id");window.awbOffCanvas.close_off_canvas(n)}),window.awbOffCanvas.removeHash()}),t(".awb-off-canvas-wrap:not(.overlay-disable-close)").on("click",function(n){if(n.target===this){const n=t(this).data("id");window.awbOffCanvas.close_off_canvas(n)}}),t(".close-on-anchor a").on("click",function(){if((t(this).attr("href")||"").includes("#")){const n=t(this).closest(".awb-off-canvas-wrap").data("id");window.awbOffCanvas.close_off_canvas(n)}}),t(".off-canvas-close").on("click",function(n){n.preventDefault();const e=t(this).closest(".awb-off-canvas-wrap").data("id");window.awbOffCanvas.close_off_canvas(e)}),t(document).on("keydown",function(n){if(27!==n.keyCode)return;t(".awb-off-canvas-wrap.awb-show:not(.disable-close-on-esc)").each(function(n,e){const a=t(e).data("id");window.awbOffCanvas.close_off_canvas(a)})}),t(".awb-off-canvas").on("mouseover",function(){const n=t(this).closest(".awb-off-canvas-wrap").data("id"),e=window["off_canvas_"+n];parseInt(e.auto_close_after_time)&&window.awb_oc_timeouts["close_after_time_"+n]&&clearTimeout(window.awb_oc_timeouts["close_after_time_"+n])}),t(".awb-off-canvas").on("mouseleave",function(){const n=t(this).closest(".awb-off-canvas-wrap").data("id"),e=window["off_canvas_"+n],a=parseInt(e.auto_close_after_time);a&&window.awb_oc_timeouts["close_after_time_"+n]&&(window.awb_oc_timeouts["close_after_time_"+n]=setTimeout(()=>{window.awbOffCanvas.close_off_canvas(n)},1e3*a))}),t("body").on("goback",function(n){t(".post-preview").css({"margin-right":0,"margin-left":0})}),t(".awb-off-canvas-wrap").each(function(n,e){const a=t(e).data("id"),o=window["off_canvas_"+a],i=t("#wpadminbar"),s=i.outerHeight();if("full"===o.height&&i.length&&t(e).find(".awb-off-canvas").css("height",`calc(100vh - ${s}px)`),"sliding-bar"===o.type&&"top"===o.position&&i.length&&t(e).find(".awb-off-canvas").css("margin-top",`${s}px`),"yes"===o.on_click){const n=o.on_click_element?t(o.on_click_element):null;n&&n.length&&(n.attr("data-off-canvas",o.on_click_element),t(document).on("click",o.on_click_element,function(t){t.preventDefault(),window.awbOffCanvas.open_off_canvas(a,!1)}))}"yes"===o.on_add_to_cart&&t(document).on("added_to_cart",function(){window.awbOffCanvas.open_off_canvas(a)});let c=!1;if(o.frequency){if("close"===o.frequency){!0===window.awbOffCanvas.get(a,"closed")&&(c=!0)}if("once"===o.frequency){0<window.awbOffCanvas.get(a,"open_count")&&(c=!0)}if("xtimes"===o.frequency&&o.frequency_xtimes){const t=window.awbOffCanvas.get(a,"open_count");parseInt(o.frequency_xtimes)<=t&&(c=!0)}if("session"===o.frequency){sessionStorage.getItem("off_canvas_"+a+"_opened")?c=!0:sessionStorage.setItem("off_canvas_"+a+"_opened",!0)}let t=window.awbOffCanvas.get(a,"last_open_date");const n=new Date;if("day"===o.frequency&&t){t=new Date(t);n<t.getTime()+864e5&&(c=!0)}if("week"===o.frequency&&t){t=new Date(t);n<t.getTime()+6048e5&&(c=!0)}if("month"===o.frequency&&t){t=new Date(t);n<new Date(t).setMonth(t.getMonth()+1)&&(c=!0)}if("xdays"===o.frequency&&o.frequency_xdays&&t){t=new Date(t);const e=parseInt(o.frequency_xdays);n<t.getTime()+24*e*60*60*1e3&&(c=!0)}}if("yes"===o.after_x_page_views){const t=window.awbOffCanvas.get(a,"page_views")||0;t<parseInt(o.number_of_page_views)&&(c=!0),window.awbOffCanvas.set(a,"page_views",t+1)}if("yes"===o.after_x_sessions){let t;sessionStorage.getItem("off_canvas_"+a)||(sessionStorage.setItem("off_canvas_"+a,!0),t=window.awbOffCanvas.get(a,"sessions")||0,window.awbOffCanvas.set(a,"sessions",t+1)),t=window.awbOffCanvas.get(a,"sessions"),t<=parseInt(o.number_of_sessions)&&(c=!0)}if(o.when_arriving_from){const t=document.referrer,n=window.location.host,e=o.when_arriving_from;let a;!t||t.includes(n)?a="internal":(a="external",/\.?(google|bing|yahoo|duckduckbot|yandex|baidu|msn|teoma|slurp)\./.test(t)&&(a="search")),c=!e.includes(a)}if("opened"===o.off_canvas_state&&"sliding-bar"===o.type&&o.has_js_rules&&!c&&(t(window).on("load",function(){window.awbOffCanvas.open_off_canvas(a)}),c=!0),!0===o.isOpened&&(c=!0),!c){if("yes"===o.on_page_load&&setTimeout(()=>{window.awbOffCanvas.open_off_canvas(a),o.isOpened=!0},100),"yes"===o.time_on_page&&o.time_on_page_duration&&setTimeout(()=>{window.awbOffCanvas.open_off_canvas(a),o.isOpened=!0},1e3*o.time_on_page_duration),"yes"===o.on_scroll){const n=o.scroll_direction,e=o.scroll_to,i=document.documentElement.scrollHeight;let s=o.scroll_position;if(s&&isNaN(s)&&(s=s.includes("%")?i/100*parseInt(s):parseInt(s)),"down"===n&&"element"===e){const t=o.scroll_element?document.querySelector(o.scroll_element):null;if(t){const n=new IntersectionObserver(t=>{t.forEach(t=>{t.isIntersecting&&(window.awbOffCanvas.open_off_canvas(a),o.isOpened=!0,n.unobserve(t.target))})});n.observe(t)}}else t(window).on("scroll",function(t){"up"===o.scroll_direction&&this.oldScroll>this.scrollY&&(o.isOpened||window.awbOffCanvas.open_off_canvas(a),o.isOpened=!0),"down"===o.scroll_direction&&this.oldScroll<this.scrollY&&this.scrollY>=s&&(o.isOpened||window.awbOffCanvas.open_off_canvas(a),o.isOpened=!0),this.oldScroll=this.scrollY})}if("yes"===o.exit_intent){const t=function(n){null==n.relatedTarget&&"select"!==n.target.nodeName.toLowerCase()&&(window.awbOffCanvas.open_off_canvas(a),document.removeEventListener("mouseout",t),o.isOpened=!0)};document.addEventListener("mouseout",t)}if("yes"===o.after_inactivity&&o.inactivity_duration){const t=o.inactivity_duration;let n;const e=function(){n=window.setTimeout(i,1e3*t)},i=function(){o.isOpened||window.awbOffCanvas.open_off_canvas(a),o.isOpened=!0},s=function(){document.addEventListener("mousemove",c,!1),document.addEventListener("mousedown",c,!1),document.addEventListener("keypress",c,!1),document.addEventListener("touchmove",c,!1),document.addEventListener("scroll",c,!1),e()},c=function(){window.clearTimeout(n),e()};s()}}})}(jQuery);