geno/wp-content/plugins/ti-woocommerce-wishlist/assets/js/public.min.js
2024-02-01 11:54:18 +00:00

6 lines
No EOL
27 KiB
JavaScript

/**
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
* @version 2.8.0
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
*/
"use strict";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 showTooltip(t,i){t.setAttribute("class","social social-clipboard tooltipped tooltipped-s"),t.setAttribute("aria-label",i)}function clearTooltip(t){t.currentTarget.setAttribute("class","social social-clipboard "),t.currentTarget.removeAttribute("aria-label")}!function(w){w.fn.tinvwl_to_wishlist=function(t){var i={api_url:window.location.href.split("?")[0],text_create:window.tinvwl_add_to_wishlist.text_create,text_already_in:window.tinvwl_add_to_wishlist.text_already_in,class:{dialogbox:".tinvwl_add_to_select_wishlist",select:".tinvwl_wishlist",newtitle:".tinvwl_new_input",dialogbutton:".tinvwl_button_add"},redirectTimer:null,onPrepareList:function(){},onGetDialogBox:function(){},onPrepareDialogBox:function(){w("body > .tinv-wishlist").length||w("body").append(w("<div>").addClass("tinv-wishlist")),w(this).appendTo("body > .tinv-wishlist")},onCreateWishList:function(t){w(this).append(w("<option>").html(t.title).val(t.ID).toggleClass("tinv_in_wishlist",t.in))},onSelectWishList:function(){},onDialogShow:function(t){w(t).addClass("tinv-modal-open"),w(t).removeClass("ftinvwl-pulse")},onDialogHide:function(t){w(this).removeClass("tinv-modal-open"),w(t).removeClass("ftinvwl-pulse")},onInited:function(){},onClick:function(){if(w(this).is(".disabled-add-wishlist"))return!1;w(this).is(".ftinvwl-animated")&&w(this).addClass("ftinvwl-pulse"),(this.tinvwl_dialog?this.tinvwl_dialog.show_list:s.onActionProduct).call(this)},onPrepareDataAction:function(t,i){w("body").trigger("tinvwl_wishlist_button_clicked",[t,i])},filterProductAlreadyIn:function(t){var t=t||[],n={};return w("form.cart[method=post], .woocommerce-variation-add-to-cart, form.vtajaxform[method=post]").find("input, select").each(function(){var t=w(this).attr("name"),i=w(this).attr("type"),e=w(this).val();("checkbox"!==i&&"radio"!==i||w(this).is(":checked"))&&(n["form"+t]=e)}),n=n.formvariation_id,t.filter(function(t){var i;return"object"===_typeof(t.in)&&"string"==typeof n?(i=parseInt(n),0<=t.in.indexOf(i)):t.in})},onMultiProductAlreadyIn:function(t){var t=t||[],e=(t=s.onPrepareList.call(t)||t,t=s.filterProductAlreadyIn.call(this,t)||t,w(this).parent().parent().find(".already-in").remove(),"");0===t.length||(e=w("<ul>"),w.each(t,function(t,i){e.append(w("<li>").html(w("<a>").html(i.title).attr({href:i.url})).val(i.ID))})),e.length&&w(this).closest(".tinv-modal-inner").find("img").after(w("<div>").addClass("already-in").html(s.text_already_in+" ").append(e))},onAction:{redirect:function(t){s.redirectTimer&&clearTimeout(s.redirectTimer),s.redirectTimer=window.setTimeout(function(){window.location.href=t},4e3)},force_redirect:function(t){window.location.href=t},wishlists:function(t){},msg:function(t){if(!t)return!1;var i=w(t).eq(0);w("body > .tinv-wishlist").length||w("body").append(w("<div>").addClass("tinv-wishlist")),w("body > .tinv-wishlist").append(i),r("body > .tinv-wishlist"),s.redirectTimer||(s.removeTimer=window.setTimeout(function(){i.remove(),s.redirectTimer&&clearTimeout(s.redirectTimer)},tinvwl_add_to_wishlist.popup_timer)),i.on("click",".tinv-close-modal, .tinvwl_button_close, .tinv-overlay",function(t){t.preventDefault(),i.remove(),s.redirectTimer&&clearTimeout(s.redirectTimer),s.removeTimer&&clearTimeout(s.removeTimer)})},status:function(t){w("body").trigger("tinvwl_wishlist_added_status",[this,t])},removed:function(t){},make_remove:function(t){},wishlists_data:function(t){d(JSON.stringify(t))}}},s=(i.onActionProduct=function(t,i){var d={form:{},tinv_wishlist_id:t||"",tinv_wishlist_name:i||"",product_type:w(this).attr("data-tinv-wl-producttype"),product_id:w(this).attr("data-tinv-wl-product")||0,product_variation:w(this).attr("data-tinv-wl-productvariation")||0,product_action:w(this).attr("data-tinv-wl-action")||"addto",redirect:window.location.href},e=this,n=[],r=[],c=new FormData;tinvwl_add_to_wishlist.wpml&&(d.lang=tinvwl_add_to_wishlist.wpml),tinvwl_add_to_wishlist.wpml_default&&(d.lang_default=tinvwl_add_to_wishlist.wpml_default),tinvwl_add_to_wishlist.stats&&(d.stats=tinvwl_add_to_wishlist.stats),w('form.cart[method=post][data-product_id="'+w(this).attr("data-tinv-wl-product")+'"], form.vtajaxform[method=post][data-product_id="'+w(this).attr("data-tinv-wl-product")+'"]').each(function(){n.push(w(this))}),n.length||(w(e).closest("form.cart[method=post], form.vtajaxform[method=post]").each(function(){n.push(w(this))}),n.length||n.push(w("form.cart[method=post]"))),w('.tinv-wraper[data-tinvwl_product_id="'+w(this).attr("data-tinv-wl-product")+'"]').each(function(){n.push(w(this))}),w.each(n,function(t,i){w(i).find("input:not(:disabled), select:not(:disabled), textarea:not(:disabled)").each(function(){function s(t,i){if("object"!==_typeof(i))return i;for(var e in void 0===t&&(t={}),i)if(""===e){var n=-1;for(n in t);t[n=parseInt(n)+1]=s(t[e],i[e])}else t[e]=s(t[e],i[e]);return t}var t,i=w(this).attr("name"),e=w(this).attr("type"),n=w(this).val(),o=10;if("button"!==e&&void 0!==i){for(;/^(.+)\[([^\[\]]*?)\]$/.test(i)&&0<o;){var a,l=i.match(/^(.+)\[([^\[\]]*?)\]$/);3===l.length&&((a={})[l[2]]=n,n=a),i=l[1],o--}"file"!==e||(t=w(this)[0].files)&&c.append(i,t[0]),"checkbox"===e||"radio"===e?w(this).is(":checked")&&(n.length||"object"===_typeof(n)||(n=!0),d.form[i]=s(d.form[i],n)):d.form[i]=s(d.form[i],n),"hidden"===e&&r.push(i)}})}),d.form["tinvwl-hidden-fields"]=r,d=s.onPrepareDataAction.call(e,e,d)||d,w.each(d,function(e,t){"form"===e?w.each(t,function(t,i){"object"===_typeof(i)&&(i=JSON.stringify(i)),c.append(e+"["+t+"]",i)}):c.append(e,t)}),w.ajax({url:s.api_url,method:"POST",contentType:!1,processData:!1,data:c}).done(function(t){if(w("body").trigger("tinvwl_wishlist_ajax_response",[this,t]),s.onDialogHide.call(e.tinvwl_dialog,e),"object"===_typeof(t))for(var i in t)"function"==typeof s.onAction[i]&&s.onAction[i].call(e,t[i]);else"function"==typeof s.onAction.msg&&s.onAction.msg.call(e,t)})},w.extend(!0,{},i,t));return w(this).each(function(){if(!w(this).attr("data-tinv-wl-list"))return!1;var t,n;s.dialogbox&&s.dialogbox.length&&(this.tinvwl_dialog=s.dialogbox),this.tinvwl_dialog||(this.tinvwl_dialog=s.onGetDialogBox.call(this)),this.tinvwl_dialog||(t=w(this).nextAll(s.class.dialogbox).eq(0)).length&&(this.tinvwl_dialog=t),this.tinvwl_dialog&&(s.onPrepareDialogBox.call(this.tinvwl_dialog),"function"!=typeof this.tinvwl_dialog.update_list&&(this.tinvwl_dialog.update_list=function(t){var e=w(this).find(s.class.select).eq(0);w(this).find(s.class.newtitle).hide().val(""),e.html(""),w.each(t,function(t,i){s.onCreateWishList.call(e,i)}),s.text_create&&s.onCreateWishList.call(e,{ID:"",title:s.text_create,in:!1}),s.onMultiProductAlreadyIn.call(e,t),s.onSelectWishList.call(e,t),w(this).find(s.class.newtitle).toggle(""===e.val())}),"function"!=typeof this.tinvwl_dialog.show_list&&(this.tinvwl_dialog.show_list=function(){var t=JSON.parse(w(this).attr("data-tinv-wl-list"))||[];t.length?(t=s.onPrepareList.call(t)||t,this.tinvwl_dialog.update_list(t),s.onDialogShow.call(this.tinvwl_dialog,this)):s.onActionProduct.call(this)}),w((n=this).tinvwl_dialog).find(s.class.dialogbutton).off("click").on("click",function(){var t,i=w(n.tinvwl_dialog).find(s.class.select),e=w(n.tinvwl_dialog).find(s.class.newtitle);i.val()||e.val()?s.onActionProduct.call(n,i.val(),e.val()):((t=e.is(":visible")?e:i).addClass("empty-name-wishlist"),window.setTimeout(function(){t.removeClass("empty-name-wishlist")},1e3))})),w(this).off("click").on("click",s.onClick),s.onInited.call(this,s)})},w(document).ready(function(){w("body").on("click keydown",".tinvwl_add_to_wishlist_button",function(t){if("keydown"===t.type){var i=void 0!==t.key?t.key:t.keyCode;if(!("Enter"===i||13===i||0<=["Spacebar"," "].indexOf(i)||32===i))return;t.preventDefault()}if(w("body").trigger("tinvwl_add_to_wishlist_button_click",[this]),w(this).is(".disabled-add-wishlist"))return t.preventDefault(),void window.alert(tinvwl_add_to_wishlist.i18n_make_a_selection_text);w(this).is(".inited-add-wishlist")||w(this).tinvwl_to_wishlist({onInited:function(t){w(this).addClass("inited-add-wishlist"),t.onClick.call(this)}})}),w("body").on("click keydown",'button[name="tinvwl-remove"]',function(t){if("keydown"===t.type){var i=void 0!==t.key?t.key:t.keyCode;if(!("Enter"===i||13===i||0<=["Spacebar"," "].indexOf(i)||32===i))return}t.preventDefault();var n=w(this);n.is(".inited-wishlist-action")||(n.addClass("inited-wishlist-action"),w("div.tinv-wishlist.woocommerce.tinv-wishlist-clear").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),i={"tinvwl-product_id":n.val(),"tinvwl-action":"remove","tinvwl-security":tinvwl_add_to_wishlist.nonce,"tinvwl-paged":n.data("tinvwl_paged")||n.closest("form").data("tinvwl_paged"),"tinvwl-per-page":n.data("tinvwl_per_page")||n.closest("form").data("tinvwl_per_page"),"tinvwl-sharekey":n.data("tinvwl_sharekey")||n.closest("form").data("tinvwl_sharekey")},tinvwl_add_to_wishlist.wpml&&(i.lang=tinvwl_add_to_wishlist.wpml),tinvwl_add_to_wishlist.wpml_default&&(i.lang_default=tinvwl_add_to_wishlist.wpml_default),tinvwl_add_to_wishlist.stats&&(i.stats=tinvwl_add_to_wishlist.stats),w.ajax({url:tinvwl_add_to_wishlist.wc_ajax_url,method:"POST",cache:!1,data:i,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",tinvwl_add_to_wishlist.nonce)}}).done(function(t){var i,e;n.removeClass("inited-wishlist-action"),w("div.tinv-wishlist.woocommerce.tinv-wishlist-clear").unblock(),t.msg&&(i=w(t.msg).eq(0),w("body > .tinv-wishlist").length||w("body").append(w("<div>").addClass("tinv-wishlist")),w("body > .tinv-wishlist").append(i),r("body > .tinv-wishlist"),i.on("click",".tinv-close-modal, .tinvwl_button_close, .tinv-overlay",function(t){t.preventDefault(),i.remove()}),e=e||window.setTimeout(function(){i.remove(),e&&clearTimeout(e)},tinvwl_add_to_wishlist.popup_timer)),t.status&&(w("div.tinv-wishlist.woocommerce.tinv-wishlist-clear").replaceWith(t.content),w(".tinvwl-break-input").tinvwl_break_submit({selector:".tinvwl-break-input-filed"}),w(".tinvwl-break-checkbox").tinvwl_break_submit({selector:"table td input[type=checkbox]",validate:function(){return w(this).is(":checked")}}),jQuery.fn.tinvwl_get_wishlist_data()),t.wishlists_data&&d(JSON.stringify(t.wishlists_data)),w("body").trigger("tinvwl_wishlist_ajax_response",[this,t])}))}),w("body").on("click keydown",'button[name="tinvwl-add-to-cart"]',function(t){if("keydown"===t.type){var i=void 0!==t.key?t.key:t.keyCode;if(!("Enter"===i||13===i||0<=["Spacebar"," "].indexOf(i)||32===i))return}t.preventDefault();var n=w(this);n.is(".inited-wishlist-action")||(n.addClass("inited-wishlist-action"),w("div.tinv-wishlist.woocommerce.tinv-wishlist-clear").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),i={"tinvwl-product_id":n.val(),"tinvwl-action":"add_to_cart_single","tinvwl-security":tinvwl_add_to_wishlist.nonce,"tinvwl-paged":n.data("tinvwl_paged")||n.closest("form").data("tinvwl_paged"),"tinvwl-per-page":n.data("tinvwl_per_page")||n.closest("form").data("tinvwl_per_page"),"tinvwl-sharekey":n.data("tinvwl_sharekey")||n.closest("form").data("tinvwl_sharekey")},tinvwl_add_to_wishlist.wpml&&(i.lang=tinvwl_add_to_wishlist.wpml),tinvwl_add_to_wishlist.wpml_default&&(i.lang_default=tinvwl_add_to_wishlist.wpml_default),tinvwl_add_to_wishlist.stats&&(i.stats=tinvwl_add_to_wishlist.stats),w.ajax({url:tinvwl_add_to_wishlist.wc_ajax_url,method:"POST",cache:!1,data:i,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",tinvwl_add_to_wishlist.nonce)}}).done(function(t){var i,e;n.removeClass("inited-wishlist-action"),w("div.tinv-wishlist.woocommerce.tinv-wishlist-clear").unblock(),t.msg&&(i=w(t.msg).eq(0),w("body > .tinv-wishlist").length||w("body").append(w("<div>").addClass("tinv-wishlist")),w("body > .tinv-wishlist").append(i),r("body > .tinv-wishlist"),i.on("click",".tinv-close-modal, .tinvwl_button_close, .tinv-overlay",function(t){t.preventDefault(),i.remove()}),e=e||window.setTimeout(function(){i.remove(),e&&clearTimeout(e)},tinvwl_add_to_wishlist.popup_timer)),w(document.body).trigger("wc_fragment_refresh"),w("div.tinv-wishlist.woocommerce.tinv-wishlist-clear").replaceWith(t.content),jQuery.fn.tinvwl_get_wishlist_data(),t.wishlists_data&&d(JSON.stringify(t.wishlists_data)),w("body").trigger("tinvwl_wishlist_ajax_response",[this,t]),t.redirect&&(window.location.href=t.redirect)}))}),w("body").on("click keydown",'button[name="tinvwl-action-product_all"]',function(t){if("keydown"===t.type){var i=void 0!==t.key?t.key:t.keyCode;if(!("Enter"===i||13===i||0<=["Spacebar"," "].indexOf(i)||32===i))return}t.preventDefault();var n=w(this);n.is(".inited-wishlist-action")||(n.addClass("inited-wishlist-action"),w("div.tinv-wishlist.woocommerce.tinv-wishlist-clear").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),i={"tinvwl-action":"add_to_cart_all","tinvwl-security":tinvwl_add_to_wishlist.nonce,"tinvwl-paged":n.closest("form").data("tinvwl_paged"),"tinvwl-per-page":n.closest("form").data("tinvwl_per_page"),"tinvwl-sharekey":n.closest("form").data("tinvwl_sharekey")},tinvwl_add_to_wishlist.wpml&&(i.lang=tinvwl_add_to_wishlist.wpml),tinvwl_add_to_wishlist.wpml_default&&(i.lang_default=tinvwl_add_to_wishlist.wpml_default),tinvwl_add_to_wishlist.stats&&(i.stats=tinvwl_add_to_wishlist.stats),w.ajax({url:tinvwl_add_to_wishlist.wc_ajax_url,method:"POST",cache:!1,data:i,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",tinvwl_add_to_wishlist.nonce)}}).done(function(t){var i,e;n.removeClass("inited-wishlist-action"),w("div.tinv-wishlist.woocommerce.tinv-wishlist-clear").unblock(),t.msg&&(i=w(t.msg).eq(0),w("body > .tinv-wishlist").length||w("body").append(w("<div>").addClass("tinv-wishlist")),w("body > .tinv-wishlist").append(i),r("body > .tinv-wishlist"),i.on("click",".tinv-close-modal, .tinvwl_button_close, .tinv-overlay",function(t){t.preventDefault(),i.remove()}),e=e||window.setTimeout(function(){i.remove(),e&&clearTimeout(e)},tinvwl_add_to_wishlist.popup_timer)),w(document.body).trigger("wc_fragment_refresh"),w("div.tinv-wishlist.woocommerce.tinv-wishlist-clear").replaceWith(t.content),jQuery.fn.tinvwl_get_wishlist_data(),t.wishlists_data&&d(JSON.stringify(t.wishlists_data)),w("body").trigger("tinvwl_wishlist_ajax_response",[this,t]),t.redirect&&(window.location.href=t.redirect)}))}),w("body").on("click keydown",'button[name="tinvwl-action-product_apply"], button[name="tinvwl-action-product_selected"]',function(t){if("keydown"===t.type){var i=void 0!==t.key?t.key:t.keyCode;if(!("Enter"===i||13===i||0<=["Spacebar"," "].indexOf(i)||32===i))return}t.preventDefault();var n,e=[],s=(w('input[name="wishlist_pr[]"]:checked').each(function(){e.push(this.value)}),w(this));e.length&&("tinvwl-action-product_selected"===s.attr("name")||w("select#tinvwl_product_actions option").filter(":selected").val())?s.is(".inited-wishlist-action")||(s.addClass("inited-wishlist-action"),w("div.tinv-wishlist.woocommerce.tinv-wishlist-clear").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),n="",n="tinvwl-action-product_selected"===s.attr("name")?"add_to_cart_selected":w("select#tinvwl_product_actions option").filter(":selected").val(),i={"tinvwl-products":e,"tinvwl-action":n,"tinvwl-security":tinvwl_add_to_wishlist.nonce,"tinvwl-paged":s.closest("form").data("tinvwl_paged"),"tinvwl-per-page":s.closest("form").data("tinvwl_per_page"),"tinvwl-sharekey":s.closest("form").data("tinvwl_sharekey")},tinvwl_add_to_wishlist.wpml&&(i.lang=tinvwl_add_to_wishlist.wpml),tinvwl_add_to_wishlist.wpml_default&&(i.lang_default=tinvwl_add_to_wishlist.wpml_default),tinvwl_add_to_wishlist.stats&&(i.stats=tinvwl_add_to_wishlist.stats),w.ajax({url:tinvwl_add_to_wishlist.wc_ajax_url,method:"POST",cache:!1,data:i,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",tinvwl_add_to_wishlist.nonce)}}).done(function(t){var i,e;s.removeClass("inited-wishlist-action"),w("div.tinv-wishlist.woocommerce.tinv-wishlist-clear").unblock(),t.msg&&(i=w(t.msg).eq(0),w("body > .tinv-wishlist").length||w("body").append(w("<div>").addClass("tinv-wishlist")),w("body > .tinv-wishlist").append(i),r("body > .tinv-wishlist"),i.on("click",".tinv-close-modal, .tinvwl_button_close, .tinv-overlay",function(t){t.preventDefault(),i.remove()}),e=e||window.setTimeout(function(){i.remove(),e&&clearTimeout(e)},tinvwl_add_to_wishlist.popup_timer)),"add_to_cart_selected"===n&&w(document.body).trigger("wc_fragment_refresh"),w("div.tinv-wishlist.woocommerce.tinv-wishlist-clear").replaceWith(t.content),jQuery.fn.tinvwl_get_wishlist_data(),t.wishlists_data&&d(JSON.stringify(t.wishlists_data)),w("body").trigger("tinvwl_wishlist_ajax_response",[this,t]),t.redirect&&(window.location.href=t.redirect)})):alert(window.tinvwl_add_to_wishlist.tinvwl_break_submit)}),w(document).on("hide_variation",".variations_form",function(t){var i=w('.tinvwl_add_to_wishlist_button:not(.tinvwl-loop)[data-tinv-wl-product="'+w(this).data("product_id")+'"]'),e=(i.attr("data-tinv-wl-productvariation",0),tinvwl_add_to_wishlist.block_ajax_wishlists_data);tinvwl_add_to_wishlist.block_ajax_wishlists_data=!0,w.fn.tinvwl_get_wishlist_data(),tinvwl_add_to_wishlist.block_ajax_wishlists_data=e,i.length&&!tinvwl_add_to_wishlist.allow_parent_variable&&(t.preventDefault(),i.addClass("disabled-add-wishlist"))}),w(document).on("show_variation",".variations_form",function(t,i,e){var n=w('.tinvwl_add_to_wishlist_button:not(.tinvwl-loop)[data-tinv-wl-product="'+w(this).data("product_id")+'"]'),i=(n.attr("data-tinv-wl-productvariation",i.variation_id),tinvwl_add_to_wishlist.block_ajax_wishlists_data);tinvwl_add_to_wishlist.block_ajax_wishlists_data=!0,w.fn.tinvwl_get_wishlist_data(),tinvwl_add_to_wishlist.block_ajax_wishlists_data=i,t.preventDefault(),n.removeClass("disabled-add-wishlist")}),w(window).on("storage onstorage",function(t){a===t.originalEvent.key&&localStorage.getItem(a)!==sessionStorage.getItem(a)&&(!localStorage.getItem(a)||"object"===_typeof(t=JSON.parse(localStorage.getItem(a)))&&null!==t&&(t.hasOwnProperty("products")||t.hasOwnProperty("counter"))&&d(localStorage.getItem(a)))});function e(i){var t,e;(n.length||s)&&tinvwl_add_to_wishlist.user_interacted&&(t={"tinvwl-action":"get_data","tinvwl-security":tinvwl_add_to_wishlist.nonce},"refresh"!==i||(e=w("div.tinv-wishlist.woocommerce.tinv-wishlist-clear form[data-tinvwl_sharekey]")).length&&(w("div.tinv-wishlist.woocommerce.tinv-wishlist-clear").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),t["tinvwl-paged"]=e.data("tinvwl_paged"),t["tinvwl-per-page"]=e.data("tinvwl_per_page"),t["tinvwl-sharekey"]=e.data("tinvwl_sharekey")),tinvwl_add_to_wishlist.wpml&&(t.lang=tinvwl_add_to_wishlist.wpml),tinvwl_add_to_wishlist.wpml_default&&(t.lang_default=tinvwl_add_to_wishlist.wpml_default),tinvwl_add_to_wishlist.stats&&(t.stats=tinvwl_add_to_wishlist.stats),w.ajax({url:tinvwl_add_to_wishlist.wc_ajax_url,method:"POST",cache:!1,data:t,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",tinvwl_add_to_wishlist.nonce)}}).done(function(t){"refresh"===i&&(w("div.tinv-wishlist.woocommerce.tinv-wishlist-clear").unblock(),w(document.body).trigger("wc_fragment_refresh"),w("div.tinv-wishlist.woocommerce.tinv-wishlist-clear").replaceWith(t.content),localStorage.setItem(a+"_refresh","")),t.wishlists_data&&d(JSON.stringify(t.wishlists_data)),w("body").trigger("tinvwl_wishlist_ajax_response",[this,t])}))}var n=[],s=!1,t=(w("a.tinvwl_add_to_wishlist_button").each(function(){"undefined"!==w(this).data("tinv-wl-product")&&w(this).data("tinv-wl-product")&&n.push(w(this).data("tinv-wl-product"))}),w(".wishlist_products_counter_number").each(function(){s=!0}),w.fn.tinvwl_get_wishlist_data=function(t){if("refresh"!==t){if(o&&("undefined"!=typeof Cookies&&void 0!==Cookies.get("tinvwl_update_data")&&(Cookies.set("tinvwl_update_data",0,{expires:-1}),localStorage.setItem(a,"")),localStorage.getItem(a))){var i=JSON.parse(localStorage.getItem(a));if("object"===_typeof(i)&&null!==i&&(i.hasOwnProperty("products")||i.hasOwnProperty("counter"))&&(!i.hasOwnProperty("lang")&&!tinvwl_add_to_wishlist.wpml||tinvwl_add_to_wishlist.wpml&&i.lang===tinvwl_add_to_wishlist.wpml)){if("undefined"!=typeof Cookies&&void 0===Cookies.get("tinvwl_wishlists_data_counter"))return void l(i);if("undefined"!=typeof Cookies&&Cookies.get("tinvwl_wishlists_data_counter")==i.counter&&(!i.hasOwnProperty("stats_count")||Cookies.get("tinvwl_wishlists_data_stats")==i.stats_count))return void l(i)}}tinvwl_add_to_wishlist.block_ajax_wishlists_data?setTimeout(function(){l(i)},500):e()}else e(t)},tinvwl_add_to_wishlist.user_interacted=!1,w.fn.tinvwl_get_wishlist_data(),w(document).one("click keydown scroll",function(){tinvwl_add_to_wishlist.user_interacted=!0,w.fn.tinvwl_get_wishlist_data()}),new MutationObserver(function(t){var i=[];t.forEach(function(t){t=t.addedNodes;null!==t&&w(t).each(function(){var t=w(this).find(".tinvwl_add_to_wishlist_button");t.length&&t.each(function(){var t=w(this).data("tinv-wl-product");void 0!==t&&t&&i.push(t)})})}),i.length&&w.fn.tinvwl_get_wishlist_data()})),i=document.body;t.observe(i,{childList:!0,subtree:!0})});var o=!0,a=tinvwl_add_to_wishlist.hash_key;try{o="sessionStorage"in window&&null!==window.sessionStorage,window.sessionStorage.setItem("ti","test"),window.sessionStorage.removeItem("ti"),window.localStorage.setItem("ti","test"),window.localStorage.removeItem("ti")}catch(t){o=!1}function l(t){var a="1"==window.tinvwl_add_to_wishlist.simple_flow,i=(w("a.tinvwl_add_to_wishlist_button").each(function(){w(this).removeClass("tinvwl-product-make-remove").removeClass("tinvwl-product-in-list").attr("data-tinv-wl-action","addto").attr("data-tinv-wl-list","[]"),t&&t.stats&&w(this).find("span.tinvwl-product-stats").remove()}),w("body").trigger("tinvwl_wishlist_mark_products",[t]),w.each(t.products,function(t,s){var o=t;w('a.tinvwl_add_to_wishlist_button[data-tinv-wl-product="'+o+'"]').each(function(){var i,t=parseInt(w(this).attr("data-tinv-wl-productvariation")),e=w(this).data("tinv-wl-productvariations")||[],n=!1;for(i in s)s[i].hasOwnProperty("in")&&Array.isArray(s[i].in)&&(-1<(s[i].in||[]).indexOf(o)||-1<(s[i].in||[]).indexOf(t)||e.some(function(t){return 0<=(s[i].in||[]).indexOf(t)}))&&(n=!0);w(this).attr("data-tinv-wl-list",JSON.stringify(s)).toggleClass("tinvwl-product-in-list",n).toggleClass("tinvwl-product-make-remove",n&&a).attr("data-tinv-wl-action",n&&a?"remove":"addto"),w("body").trigger("tinvwl_wishlist_product_marked",[this,n])})}),t&&t.stats&&tinvwl_add_to_wishlist.stats&&w.each(t.stats,function(t,e){w('a.tinvwl_add_to_wishlist_button[data-tinv-wl-product="'+t+'"]').each(function(){w(this).attr("data-tinv-wl-product-stats",JSON.stringify(e));var t,i=parseInt(w(this).attr("data-tinv-wl-productvariation"));for(t in e)-1<t.indexOf(i)&&(w("body").trigger("tinvwl_wishlist_product_stats",[this,!0]),w(this).append('<span class="tinvwl-product-stats">'+e[t]+"</span>"))})}),t.counter);"1"==window.tinvwl_add_to_wishlist.hide_zero_counter&&0===i&&(i="false"),jQuery("i.wishlist-icon").addClass("added"),"false"!==i?(jQuery(".wishlist_products_counter_number, .theme-item-count.wishlist-item-count").html(i),jQuery("i.wishlist-icon").attr("data-icon-label",i)):(jQuery(".wishlist_products_counter_number, .theme-item-count.wishlist-item-count").html("").closest("span.wishlist-counter-with-products").removeClass("wishlist-counter-with-products"),jQuery("i.wishlist-icon").removeAttr("data-icon-label")),i=!("0"==i||"false"==i),jQuery(".wishlist_products_counter").toggleClass("wishlist-counter-with-products",i),setTimeout(function(){jQuery("i.wishlist-icon").removeClass("added")},500)}function d(t){o&&(localStorage.setItem(a,t),sessionStorage.setItem(a,t),l(JSON.parse(t)))}function r(t){var t=w(t).find("select, input, textarea, button, a").filter(":visible"),i=t.first(),e=t.last();i.focus().blur(),e.on("keydown",function(t){9!==t.which||t.shiftKey||(t.preventDefault(),i.focus())}),i.on("keydown",function(t){9===t.which&&t.shiftKey&&(t.preventDefault(),e.focus())})}}(jQuery),function(n){n(document).ready(function(){if(n(".tinv-lists-nav").each(function(){n(this).html().trim().length||n(this).remove()}),n("body").on("click",".social-buttons .social:not(.social-email,.social-whatsapp,.social-clipboard)",function(t){var i=window.open(n(this).attr("href"),n(this).attr("title"),"width=420,height=320,resizable=yes,scrollbars=yes,status=yes");i&&(i.focus(),t.preventDefault())}),"undefined"!=typeof ClipboardJS){new ClipboardJS(".social-buttons .social.social-clipboard",{text:function(t){return t.getAttribute("href")}}).on("success",function(t){showTooltip(t.trigger,tinvwl_add_to_wishlist.tinvwl_clipboard)});for(var t=document.querySelectorAll(".social-buttons .social.social-clipboard"),i=0;i<t.length;i++)t[i].addEventListener("mouseleave",clearTooltip),t[i].addEventListener("blur",clearTooltip)}n("body").on("click",".social-buttons .social.social-clipboard",function(t){t.preventDefault()}),n("body").on("click",".tinv-wishlist .tinv-overlay, .tinv-wishlist .tinv-close-modal, .tinv-wishlist .tinvwl_button_close",function(t){t.preventDefault(),n(this).parents(".tinv-modal:first").removeClass("tinv-modal-open"),n("body").trigger("tinvwl_modal_closed",[this])}),n("body").on("click",".tinv-wishlist .tinvwl-btn-onclick",function(t){n(this).data("url")&&(t.preventDefault(),window.location=n(this).data("url"))});var e=n(".tinv-wishlist .navigation-button");e.length&&e.each(function(){var t=n(this).find("> li");t.length<5&&t.parent().addClass("tinvwl-btns-count-"+t.length)}),n(".tinv-login .showlogin").off("click").on("click",function(t){t.preventDefault(),n(this).closest(".tinv-login").find(".login").toggle()}),n(".tinv-wishlist table.tinvwl-table-manage-list tfoot td").each(function(){n(this).toggle(!!n(this).children().not(".look_in").length||!!n(this).children(".look_in").children().length)})})}(jQuery),function(s){s.fn.tinvwl_break_submit=function(t){var e=s.extend(!0,{},{selector:"input, select, textarea",ifempty:!0,invert:!1,validate:function(){return s(this).val()},rule:function(){var t=s(this).parents("form").eq(0).find(e.selector),i=e.invert;return 0===t.length?e.ifempty:(t.each(function(){i&&!e.invert||!i&&e.invert||(i=Boolean(e.validate.call(s(this))))}),i)}},t);return s(this).each(function(){s(this).on("click",function(t){var i=[];void 0!==s(this).attr("tinvwl_break_submit")&&(i=s(this).attr("tinvwl_break_submit").split(",")),-1!==jQuery.inArray(e.selector,i)&&(i=[]),e.rule.call(s(this))||0!==i.length||(alert(window.tinvwl_add_to_wishlist.tinvwl_break_submit),t.preventDefault()),i.push(e.selector),s(this).attr("tinvwl_break_submit",i),e.rule.call(s(this))&&s(this).removeAttr("tinvwl_break_submit")})})},s(document).ready(function(){s("body").on("click",".global-cb",function(){s(this).closest("table").eq(0).find(".product-cb input[type=checkbox], .wishlist-cb input[type=checkbox]").prop("checked",s(this).is(":checked"))});var n=tinvwl_add_to_wishlist.hash_key+"_refresh";s(document.body).on("tinvwl_wishlist_ajax_response",function(t,i,e){(e.status||e.removed)&&["add_to_wishlist"].includes(e.action)&&e.wishlist&&e.wishlist.share_key&&(localStorage.setItem(n,""),localStorage.setItem(n,e.wishlist.share_key))})})}(jQuery);