File: /var/www/kevin-demo/wp-content/themes/fitmencook/js/custom.min.js
"use strict";function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){var r;if(t)return"string"==typeof t?_arrayLikeToArray(t,e):"Map"===(r="Object"===(r=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(t,e):void 0}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function _iterableToArrayLimit(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,c=[],u=!0,l=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(l)throw o}}return c}}function _arrayWithHoles(t){if(Array.isArray(t))return t}jQuery(document).ready(function(r){r(".carousel-main").flickity({prevNextButtons:!0,pageDots:!1,adaptiveHeight:!0}),r(".carousel-nav").flickity({asNavFor:".carousel-main",contain:!0,pageDots:!1,prevNextButtons:!1}),r(".fmc_toggle_trigger").click(function(){r(".fmc_toggle_content").slideToggle(),r(this).toggleClass("fmc_toggle_open")}),r(".search_icon").click(function(){r(".nav_search").animate({width:"toggle"}),r(".fmc_header_right a[aria-label='Cart']").animate({width:"toggle"}),r(this).toggleClass("fmc_search_open"),r(".fmc_header_right input.orig").focus()}),r(".search_icon2, .fmc_full_screen_close").click(function(){r(".fmc_full_screen_search").fadeToggle()}),r(".fmc_mm_trigger").click(function(){r(".fmc_header").slideToggle(),r(".fmc_mobile_header").toggleClass("fmc_nav_open")}),r(".fmc_header ul li.menu-item-has-children > a").after("<span class='fmc_submenu_acitvator'></span>"),r(".fmc_submenu_acitvator").click(function(){r(this).toggleClass("sub-open").siblings(".sub-menu").slideToggle()}),r(".carousel-home").flickity({pageDots:!1,cellAlign:"left",watchCSS:!0,wrapAround:!0,prevNextButtons:!1}),r(".carousel-logos").flickity({pageDots:!1,cellAlign:"left",watchCSS:!0,wrapAround:!0,prevNextButtons:!1}),t=jQuery,n=t(window),o=t(".video-wrap"),a=t(".fmc_video"),o.length&&a.length&&(e=a.outerHeight(),n.on("scroll",function(){var t=n.scrollTop();e+o.offset().top<t?(o.height(e),a.addClass("stuck")):(o.height("auto"),a.removeClass("stuck"))}));var e,n,o,a,i,t=r(".quantity .qty"),c=r(".fmc_product_unit_price"),u=r(".fmc_product_unit_total-js"),t=(t.on("change",function(t){var t=r(t.currentTarget).val(),e=c.data("unit-price"),t=parseFloat(t*e).toFixed(2);u.html(t)}),void 0!==r.validator&&(t=r("#commentform"),r.validator.addMethod("valueNotEquals",function(t,e,r){return console.log(t),r!==t},"Value must not equal arg."),t.validate({rules:{author:"required",email:{required:!0,email:!0},comment:"required",rateRecipe:{valueNotEquals:"0"}},messages:{rateRecipe:{valueNotEquals:"Please select a rating."}},errorPlacement:function(t,e){"rateRecipe"==e.attr("name")||"rateRecipe"==e.attr("name")?t.insertAfter(".recipe_rate-wrapper"):t.insertAfter(e)},ignore:[]})),r("#use-rating")),l=r(".recipe_rate-wrapper"),s=r("#recipe-rate"),f=s.attr("name"),t=(0===r("[name=postType]").length&&s.attr("name",""),t.on("change",function(){var t;!0===r(this).prop("checked")?(l.removeClass("disabled"),s.attr("name",f)):(l.addClass("disabled"),s.attr("name",""),(t=r("#recipe-rate-error")).length&&t.remove())}),window.location.hash),d=r("a[href=#tab-reviews]");""!=t&&r(".product").length&&(d.parent().addClass("active"),setTimeout(function(){d.next().attr("style","")},500)),i=jQuery,(t=i("body")).on("click",".minus",function(){var t=parseInt(i(this).next("input").val());1<t&&i(this).next("input").val(t-1).trigger("change")}),t.on("click",".plus",function(){var t=parseInt(i(this).prev("input").val()),e=parseInt(i(this).prev("input").attr("max"));(t<e||!e)&&i(this).prev("input").val(t+1).trigger("change")}),r(".reply").on("click",function(){r(this).parent().next().find("#recipe-rate").remove(),r(this).parent().next().find(".recipe-rate-label").remove(),r(this).parent().next().find(".rateit").remove()}),r(".fmc_recipe_grid_macros .rg_m_amount").text(function(){return r(this).text().replace("cal","")}),r(".rg_macro.calories .rg_m_title").text(function(){return r(this).text().replace("Calories","Cal")}),r(".video-hide").click(function(){r(".fmc_video").addClass("removed")}),r(".recipe_mobile_trigger").click(function(){r(".recipe_mobile_hidden").slideToggle(),r(this).toggleClass("open").text("Show Full Recipe"),r(".recipe_mobile_trigger.open").text("Hide Full Recipe")})});var observer=new IntersectionObserver(function(t){t=_slicedToArray(t,1)[0];return t.target.toggleAttribute("stuck",t.intersectionRatio<1)},{threshold:[1]});function _typeof(t){return(_typeof="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})(t)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return i};var u,i={},t=Object.prototype,l=t.hasOwnProperty,s=Object.defineProperty||function(t,e,r){t[e]=r.value},e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function a(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(u){a=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o,a,i,c,e=e&&e.prototype instanceof g?e:g,e=Object.create(e.prototype),n=new L(n||[]);return s(e,"_invoke",{value:(o=t,a=r,i=n,c=d,function(t,e){if(c===p)throw new Error("Generator is already running");if(c===m){if("throw"===t)throw e;return{value:u,done:!0}}for(i.method=t,i.arg=e;;){var r=i.delegate;if(r){r=function t(e,r){var n=r.method,o=e.iterator[n];if(o===u)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=u,t(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;n=f(o,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,y;o=n.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=u),r.delegate=null,y):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}(r,i);if(r){if(r===y)continue;return r}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(c===d)throw c=m,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);c=p;r=f(o,a,i);if("normal"===r.type){if(c=i.done?m:h,r.arg===y)continue;return{value:r.arg,done:i.done}}"throw"===r.type&&(c=m,i.method="throw",i.arg=r.arg)}})}),e}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}i.wrap=c;var d="suspendedStart",h="suspendedYield",p="executing",m="completed",y={};function g(){}function v(){}function _(){}var e={},w=(a(e,n,function(){return this}),Object.getPrototypeOf),w=w&&w(w(S([]))),b=(w&&w!==t&&l.call(w,n)&&(e=w),_.prototype=g.prototype=Object.create(e));function x(t){["next","throw","return"].forEach(function(e){a(t,e,function(t){return this._invoke(e,t)})})}function j(i,c){var e;s(this,"_invoke",{value:function(r,n){function t(){return new c(function(t,e){!function e(t,r,n,o){var a,t=f(i[t],i,r);if("throw"!==t.type)return(r=(a=t.arg).value)&&"object"==_typeof(r)&&l.call(r,"__await")?c.resolve(r.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):c.resolve(r).then(function(t){a.value=t,n(a)},function(t){return e("throw",t,n,o)});o(t.arg)}(r,n,t,e)})}return e=e?e.then(t,t):t()}})}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function S(e){if(e||""===e){var r,t=e[n];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return r=-1,(t=function t(){for(;++r<e.length;)if(l.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=u,t.done=!0,t}).next=t}throw new TypeError(_typeof(e)+" is not iterable")}return s(b,"constructor",{value:v.prototype=_,configurable:!0}),s(_,"constructor",{value:v,configurable:!0}),v.displayName=a(_,o,"GeneratorFunction"),i.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},i.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,a(t,o,"GeneratorFunction")),t.prototype=Object.create(b),t},i.awrap=function(t){return{__await:t}},x(j.prototype),a(j.prototype,r,function(){return this}),i.AsyncIterator=j,i.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var a=new j(c(t,e,r,n),o);return i.isGeneratorFunction(e)?a:a.next().then(function(t){return t.done?t.value:a.next()})},x(b),a(b,o,"Generator"),a(b,n,function(){return this}),a(b,"toString",function(){return"[object Generator]"}),i.keys=function(t){var e,r=Object(t),n=[];for(e in r)n.push(e);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},i.values=S,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=u)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function t(t,e){return a.type="throw",a.arg=r,n.next=t,e&&(n.method="next",n.arg=u),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=l.call(o,"catchLoc"),c=l.call(o,"finallyLoc");if(i&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&l.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}var a=(o=o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc?null:o)?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r,n,o=this.tryEntries[e];if(o.tryLoc===t)return"throw"===(r=o.completion).type&&(n=r.arg,k(o)),n}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=u),y}},i}function asyncGeneratorStep(t,e,r,n,o,a,i){try{var c=t[a](i),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(c){return function(){var t=this,i=arguments;return new Promise(function(e,r){var n=c.apply(t,i);function o(t){asyncGeneratorStep(n,e,r,o,a,"next",t)}function a(t){asyncGeneratorStep(n,e,r,o,a,"throw",t)}o(void 0)})}}jQuery(document).ready(function(r){r(".ingredient-add-to-cart").click(function(t){t.preventDefault();var e=r(t.currentTarget),t={product_id:e.data("product-id"),quantity:e.data("quantity")};r.ajax({type:"POST",url:wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart"),data:t,dataType:"json",beforeSend:function(t){},complete:function(t){},success:function(t){r(document.body).trigger("added_to_cart",[t.fragments,t.cart_hash]);t=r("<a> </a>");t.attr("href",theme.cartUrl),t.addClass("ingredient-add-to-cart-view-cart"),t.text("View Cart"),e.replaceWith(t)}})});var t=r(".jtr_wrap"),e=r(".fmc_recipe_card");function n(){e.offset().top<=r(window).scrollTop()+r(window).height()?t.addClass("passed"):t.removeClass("passed")}r(window).on("scroll resize",n),n()}),jQuery(document).ready(function(r){r(".ingredient-add-to-cart").click(function(t){t.preventDefault();var e=r(t.currentTarget),t={product_id:e.data("product-id"),quantity:e.data("quantity")};r.ajax({type:"POST",url:wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart"),data:t,dataType:"json",beforeSend:function(t){},complete:function(t){},success:function(t){r(document.body).trigger("added_to_cart",[t.fragments,t.cart_hash]);t=r("<a> </a>");t.attr("href",theme.cartUrl),t.addClass("ingredient-add-to-cart-view-cart"),t.text("View Cart"),e.replaceWith(t)}})})});var sendPostUrlKlaviyo=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark(function t(e){var r,n;return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=new FormData,r=location.href,n.append("userEmail",e),n.append("postUrl",r),n.append("action","klaviyo_email_send"),n.append("recipeID",theme.recipeID),t.prev=6,t.next=9,fetch(theme.ajaxUrl,{method:"POST",body:n});case 9:return r=t.sent,t.next=12,r.json();case 12:(n=t.sent)&&n.success&&console.log("Mail from the newsletter form has been successfully sent!"),t.next=19;break;case 16:t.prev=16,t.t0=t.catch(6),console.log(t.t0);case 19:case"end":return t.stop()}},t,null,[[6,16]])}));return function(t){return e.apply(this,arguments)}}();window.addEventListener("klaviyoForms",function(t){"submit"==t.detail.type&&theme.formID==t.detail.formId&&(t=t.detail.metaData.$email,sendPostUrlKlaviyo(t))}),jQuery(document).ready(function(t){function e(){r.find(".loader").show(),t.ajax({type:"GET",url:n,data:{action:"woo_minicart_update",nonce:theme.nonce},success:function(t){t.success&&(void 0!==t.data.content&&t.data.content&&r.find(".woo-mini-cart__content").html(t.data.content),void 0!==t.data.count)&&r.find(".woo-mini-cart__count").html(t.data.count)},complete:function(){r.find(".loader").hide()}})}var r=t(".woo-mini-cart"),n=theme.ajaxUrl;e(),t(document.body).on("added_to_cart",function(){e()}),t(document.body).on("removed_from_cart",function(){e()}),t(document.body).on("updated_cart_totals",function(){e()}),t(document.body).on("wc_cart_emptied",function(){e()}),ini});