function wpo_parse_json(e){if("object"==typeof e)return e;try{var o=JSON.parse(e);return o}catch(t){console.log("WPO: Exception when trying to parse JSON (1) - will attempt to fix/re-parse"),console.log(e)}var r=e.indexOf("{"),i=e.lastIndexOf("}");if(r>-1&&i>-1){var n=e.slice(r,i+1);try{var s=JSON.parse(n);return s}catch(t){console.log("WPO: Exception when trying to parse JSON (2) - will attempt to fix/re-parse based upon bracket counting");for(var c=r,a=0,p="",d=!1;(a>0||c==r)&&c<=i;){var u=e.charAt(c);d||"{"!=u?d||"}"!=u?'"'==u&&"\\"!=p&&(d=!d):a--:a++,p=u,c++}console.log("Started at cursor="+r+", ended at cursor="+c+" with result following:"),console.log(e.substring(r,c));try{var s=JSON.parse(e.substring(r,c));return s}catch(t){throw t}}}throw"WPO: could not parse the JSON"}var wp_optimize=window.wp_optimize||{};wp_optimize.send_command=function(e,o,t,r,i){r="undefined"==typeof r||r,o||(o={}),o.hasOwnProperty("include_ui_elements")||(o.include_ui_elements=!0);var n={action:"wp_optimize_ajax",subaction:e,nonce:wp_optimize_send_command_data.nonce,data:o},s={type:"post",data:n,success:function(e){if(r){try{var o=wpo_parse_json(e)}catch(i){return console.log(i),console.log(e),void alert(wpoptimize.error_unexpected_response)}if(!o.result&&o.hasOwnProperty("error_code")&&o.error_code)return void wp_optimize.notices.show_notice(o.error_code,o.error_message);"function"==typeof t&&t(o)}else{if(!e.result&&e.hasOwnProperty("error_code")&&e.error_code)return void wp_optimize.notices.show_notice(e.error_code,e.error_message);"function"==typeof t&&t(e)}}};return"object"==typeof i&&(i.hasOwnProperty("timeout")&&(s.timeout=i.timeout),i.hasOwnProperty("error")&&"function"==typeof i.error&&(s.error=i.error)),jQuery.ajax(ajaxurl,s)},wp_optimize.notices={errors:[],show_notice:function(e,o){jQuery("#wp-optimize-wrap").length?(this.notice||this.add_notice(),this.notice.show(),this.errors[e]||(this.errors[e]=jQuery("<p/>").html(o).appendTo(this.notice).data("error_code",e))):window.wp&&wp.hasOwnProperty("data")?wp.data.dispatch("core/notices").createNotice("error","WP-Optimize: "+o,{isDismissible:!0}):alert("WP-Optimize: "+o)},add_notice:function(){this.notice_container=jQuery('<div class="wpo-main-error-notice"></div>').prependTo("#wp-optimize-wrap"),this.notice=jQuery('<div class="notice notice-error wpo-notice is-dismissible"><button type="button" class="notice-dismiss"><span class="screen-reader-text">'+commonL10n.dismiss+"</span></button></div>"),this.notice.appendTo(this.notice_container),this.notice.on("click",".notice-dismiss",function(e){this.notice.hide().find("p").remove(),this.errors=[]}.bind(this))}};
function add_params_to_url(e,t,r){if(0===e.length)return e;try{var n=new URL(e),a=new URLSearchParams(n.search);return a.set(t,r),n.search=a.toString(),n.toString()}catch(o){return console.log("Error modifying url",o),e}}document.addEventListener("DOMContentLoaded",function(){var e="undefined"!=typeof MutationObserver;if(WPO_LazyLoad.update(),e){var t=new MutationObserver(function(e){e.forEach(function(e){WPO_LazyLoad.update(e.addedNodes)})}),r={childList:!0,subtree:!0},n=document.getElementsByTagName("body")[0];t.observe(n,r)}else window.addEventListener("load",function(){WPO_LazyLoad.deferred_call("update",WPO_LazyLoad.update)}),window.addEventListener("scroll",function(){WPO_LazyLoad.deferred_call("update",WPO_LazyLoad.update)}),window.addEventListener("resize",function(){WPO_LazyLoad.deferred_call("update",WPO_LazyLoad.update)}),document.getElementsByTagName("body")[0].addEventListener("post-load",function(){WPO_LazyLoad.deferred_call("update",WPO_LazyLoad.update)})});var WPO_Intersection_Observer=function(e,t){function r(e){d.push(e)}function n(e){var t;for(t in d)if(d.hasOwnProperty(t)&&e==d[t])return void delete d[t]}function a(){var t;for(t in d)d.hasOwnProperty(t)&&o(d[t])&&(e(d[t]),n(d[t]))}function o(e){var r=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;return r.top-t.offset<n&&r.bottom+t.offset>0}var d=[];return t=t||{offset:100},window.addEventListener("load",function(){WPO_LazyLoad.deferred_call("check",a)}),window.addEventListener("scroll",function(){WPO_LazyLoad.deferred_call("check",a)}),window.addEventListener("resize",function(){WPO_LazyLoad.deferred_call("check",a)}),{observe:r,unobserve:n}},WPO_LazyLoad=function(){function e(e){if(!l(e,_.loaded_class)){c(e,_.loaded_class),f.unobserve(e),u(e,_.observe_class);var r,n=e.tagName;if("picture"==n.toLowerCase())for(r in e.childNodes)e.childNodes.hasOwnProperty(r)&&t(e.childNodes[r]);else t(e)}}function t(e){if("undefined"!=typeof e.getAttribute){var t=e.getAttribute("data-src"),n=e.getAttribute("data-srcset"),a=e.getAttribute("data-background"),o=e.getAttribute("data-background-image");t&&(e.setAttribute("src",t),e.removeAttribute("data-src")),n&&(e.setAttribute("srcset",n),e.removeAttribute("data-srcset")),a&&(e.style.background=r(e.style.background,a.split(";")),e.removeAttribute("data-background")),o&&(e.style.backgroundImage=r(e.style.backgroundImage,o.split(";")),e.removeAttribute("data-background-image"))}}function r(e,t){var r=0;return e.replaceAll(/url\([^\)]*\)/gi,function(){return["url('",t[r++],"')"].join("")})}function n(t){var r;for(r in t)t.hasOwnProperty(r)&&t[r].isIntersecting&&e(t[r].target)}function a(e){return u(e,_.select_class),o(e)?(e=d(e),e.dataset.hasOwnProperty("src")&&(e.src=e.dataset.src),void(e.dataset.hasOwnProperty("srcset")&&(e.srcset=e.dataset.srcset))):void(l(e,_.observe_class)||(c(e,_.observe_class),f.observe(e)))}function o(e){e=d(e);const t=e.getBoundingClientRect(),r=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;return t.top>0&&t.top<r}function d(e){return"picture"===e.tagName.toLowerCase()?e.lastElementChild:e}function s(e){var t,r=e||Array.prototype.slice.call(_.container.getElementsByClassName(_.select_class));for(t in r)r.hasOwnProperty(t)&&(l(r[t],_.select_class)?a(r[t]):r[t].childNodes&&r[t].childNodes.length&&s(r[t].childNodes))}function i(e,t,r){r=r||200,p[e]=p[e]?p[e]+1:1,setTimeout(function(){var n=(new Date).getTime(),a=m[e]||0;p[e]--,(0===p[e]||a+r<n)&&(m[e]=n,t())},r)}function c(e,t){l(e,t)||(e.className?e.className+=" "+t:e.className=t)}function u(e,t){var r=new RegExp(["(^|\\s)",t,"(\\s|$)"].join(""));e.className=e.className.replace(r," ")}function l(e,t){var r=new RegExp(["(^|\\s)",t,"(\\s|$)"].join(""));return r.test(e.className)}var f,v="undefined"!=typeof IntersectionObserver,_={container:window.document,select_class:"lazyload",observe_class:"lazyload-observe",loaded_class:"lazyload-loaded"};f=v?new IntersectionObserver(n,{root:null,rootMargin:"0px",threshold:[.1]}):new WPO_Intersection_Observer(e);var p={},m={};return{update:s,deferred_call:i}}();document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll(".wpo_youtube_preview_container");e.forEach(function(e){e.parentElement.classList.add("wpo_youtube_preview_override_parent"),e.addEventListener("click",function(){var t=e.querySelector(".wpo_youtube_preview"),r=t.getAttribute("data-video-url"),n=wpo_parse_json(t.getAttribute("data-iframe-attr")),a=["data-video-url","src"],o=document.createElement("iframe");o.setAttribute("src",add_params_to_url(r,"autoplay","1")),Object.keys(n).forEach(function(e){a.indexOf(e)===-1&&o.setAttribute(e,n[e])}),e.parentElement.classList.remove("wpo_youtube_preview_override_parent"),e.parentElement.replaceChild(o,e)})})});
jQuery(function(t){if("undefined"==typeof wc_add_to_cart_params)return!1;var a=function(){this.requests=[],this.addRequest=this.addRequest.bind(this),this.run=this.run.bind(this),this.$liveRegion=this.createLiveRegion(),t(document.body).on("click",".add_to_cart_button:not(.wc-interactive)",{addToCartHandler:this},this.onAddToCart).on("keydown",".add_to_cart_button:not(.wc-interactive)",{addToCartHandler:this},t=>{" "===t.key&&(t.preventDefault(),t.target.click())}).on("click",".remove_from_cart_button",{addToCartHandler:this},this.onRemoveFromCart).on("keydown",".remove_from_cart_button",this.onKeydownRemoveFromCart).on("added_to_cart",{addToCartHandler:this},this.onAddedToCart).on("removed_from_cart",{addToCartHandler:this},this.onRemovedFromCart).on("ajax_request_not_sent.adding_to_cart",this.updateButton)};a.prototype.addRequest=function(t){this.requests.push(t),1===this.requests.length&&this.run()},a.prototype.run=function(){var a=this,e=a.requests[0].complete;a.requests[0].complete=function(){"function"==typeof e&&e(),a.requests.shift(),a.requests.length>0&&a.run()},t.ajax(this.requests[0])},a.prototype.onAddToCart=function(a){var e=t(this);if(e.is(".ajax_add_to_cart")){if(!e.attr("data-product_id"))return!0;if(a.data.addToCartHandler.$liveRegion.text("").removeAttr("aria-relevant"),a.preventDefault(),e.removeClass("added"),e.addClass("loading"),!1===t(document.body).triggerHandler("should_send_ajax_request.adding_to_cart",[e]))return t(document.body).trigger("ajax_request_not_sent.adding_to_cart",[!1,!1,e]),!0;var r={};t.each(e.data(),function(t,a){r[t]=a}),t.each(e[0].dataset,function(t,a){r[t]=a}),t(document.body).trigger("adding_to_cart",[e,r]),a.data.addToCartHandler.addRequest({type:"POST",url:wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart"),data:r,success:function(a){a&&(a.error&&a.product_url?window.location=a.product_url:"yes"!==wc_add_to_cart_params.cart_redirect_after_add?t(document.body).trigger("added_to_cart",[a.fragments,a.cart_hash,e]):window.location=wc_add_to_cart_params.cart_url)},dataType:"json"})}},a.prototype.onRemoveFromCart=function(a){var e=t(this),r=e.closest(".woocommerce-mini-cart-item");a.data.addToCartHandler.$liveRegion.text("").removeAttr("aria-relevant"),a.preventDefault(),r.block({message:null,overlayCSS:{opacity:.6}}),a.data.addToCartHandler.addRequest({type:"POST",url:wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","remove_from_cart"),data:{cart_item_key:e.data("cart_item_key")},success:function(a){a&&a.fragments?t(document.body).trigger("removed_from_cart",[a.fragments,a.cart_hash,e]):window.location=e.attr("href")},error:function(){window.location=e.attr("href")},dataType:"json"})},a.prototype.onKeydownRemoveFromCart=function(a){" "===a.key&&(a.preventDefault(),t(this).trigger("click"))},a.prototype.updateButton=function(a,e,r,o){if(o=void 0!==o&&o){if(o.removeClass("loading"),e&&o.addClass("added"),e&&!wc_add_to_cart_params.is_cart&&0===o.parent().find(".added_to_cart").length){var d=document.createElement("a");d.href=wc_add_to_cart_params.cart_url,d.className="added_to_cart wc-forward",d.title=wc_add_to_cart_params.i18n_view_cart,d.textContent=wc_add_to_cart_params.i18n_view_cart,o.after(d)}t(document.body).trigger("wc_cart_button_updated",[o])}},a.prototype.updateFragments=function(a,e){e&&(t.each(e,function(a){t(a).addClass("updating").fadeTo("400","0.6").block({message:null,overlayCSS:{opacity:.6}})}),t.each(e,function(a,e){t(a).replaceWith(e),t(a).stop(!0).css("opacity","1").unblock()}),t(document.body).trigger("wc_fragments_loaded"))},a.prototype.alertCartUpdated=function(t,a,e,r){if(r=void 0!==r&&r){var o=r.data("success_message");if(!o)return;t.data.addToCartHandler.$liveRegion.delay(1e3).text(o).attr("aria-relevant","all")}},a.prototype.createLiveRegion=function(){var a=t(".widget_shopping_cart_live_region");return a.length?a:t('<div class="widget_shopping_cart_live_region screen-reader-text" role="status"></div>').appendTo("body")},a.prototype.onAddedToCart=function(t,a,e,r){t.data.addToCartHandler.updateButton(t,a,e,r),t.data.addToCartHandler.updateFragments(t,a),t.data.addToCartHandler.alertCartUpdated(t,a,e,r)},a.prototype.onRemovedFromCart=function(t,a,e,r){t.data.addToCartHandler.updateFragments(t,a),t.data.addToCartHandler.alertCartUpdated(t,a,e,r)},new a});
(function($){'use strict';$(document).ready(function(){$('body').on('adding_to_cart',function(event,$button){if($button&&$button.hasClass('vc_gitem-link')){$button.addClass('vc-gitem-add-to-cart-loading-btn').parents('.vc_grid-item-mini').addClass('vc-woocommerce-add-to-cart-loading').append($('<div class="vc_wc-load-add-to-loader-wrapper"><div class="vc_wc-load-add-to-loader"></div></div>'))}}).on('added_to_cart',function(event,fragments,cart_hash,$button){if('undefined'===typeof($button)){$button=$('.vc-gitem-add-to-cart-loading-btn')}
if($button&&$button.hasClass('vc_gitem-link')){$button.removeClass('vc-gitem-add-to-cart-loading-btn').parents('.vc_grid-item-mini').removeClass('vc-woocommerce-add-to-cart-loading').find('.vc_wc-load-add-to-loader-wrapper').remove()}})})})(window.jQuery);