!function(S){"use strict";etTheme.autoinit.XStoreWishlist=etTheme.XStoreWishlist=function(){if("undefined"==typeof Cookies)return;etTheme.xstore_wishlist={};var h="xstore-wishlist",u=xstore_wishlist_params.wishlist_id,i=null,_=0,n=0,l=0,d=etTheme.et_global.w_width `,w=(xstore_wishlist_params.ajax_fragments&&(S(document).on("xstore_wishlist_initialized",function(t,e){S(document).trigger("xstore_wishlist_fragment_refresh",[e])}),S(window).on("pageshow",function(t){t.originalEvent.persisted&&(S(".et_b_wishlist-dropdown").empty(),S(document).trigger("xstore_wishlist_fragment_refresh",[y()]))}),S(document).on("xstore_wishlist_force_fragment_refresh",function(){S(".et_b_wishlist-dropdown").empty(),S(document).trigger("xstore_wishlist_fragment_refresh",[y()])})),S(document).on("click","."+h,function(t,e){t.preventDefault();var i=S(this).attr("data-action"),s=S(this).attr("data-id"),o=S(this).data("settings")||{},a=S(this).hasClass(h+"-redirect"),t=e&&!!e.is_multiple,r={},n=(t&&(r={is_multiple:!0,i:e.i,max:e.max,buttons:e.buttons}),S(this).parents("td"));switch((t||n)&&(r.table_row=S(this).parents("tr")),i){case"add":S(this).addClass("processing"),xstore_wishlist_params.animated_hearts&&(clearTimeout(f),S(this).prepend(''+g+g+g+g+g+"")),w(S(this),o,i);var l,[d,c={}]=[s,r];d=parseInt(d),-1===T().indexOf(d)&&((l=y()).push(JSON.stringify({id:d,time:Math.floor((new Date).getTime()/1e3)})),etTheme.setCookie(u,l.join("|"),xstore_wishlist_params.days_cache),c.table_row&&!m&&(c.table_row.css({position:"relative",zoom:1}),c.table_row.find("td:last-child").block({message:null,overlayCSS:{opacity:.6}}).attr("style",null),c.table_row.find("td:last-child").unblock(),setTimeout(function(){c.table_row.attr("style",null)},500)),xstore_wishlist_params.is_loggedin&&(clearTimeout(_),_=setTimeout(function(){C(l.join("|"))},1500)),S(document).find("."+h+"[data-id="+d+"]").each(function(){S(this).addClass("processing"),w(S(this),JSON.parse(S(this).attr("data-settings")))}),c.is_multiple?(c.i++,S(document).trigger("xstore_wishlist/adding_product",[l,d,c.is_multiple,c.i,c.max,c.buttons])):S(document).trigger("xstore_wishlist/adding_product",[l,d])),a&&S(this).addClass(h+"-redirect-ready");break;case"remove":a&&S(this).hasClass(h+"-redirect-ready")?window.location.href=xstore_wishlist_params.wishlist_page_url:(m||n||S(this).addClass("processing"),w(S(this),o,i),k(s,r))}}),function(t,e,i="add"){"add"==i?(e.removeText&&(t.find(".button-text").text(e.removeText),t.find(".mt-mes").text(e.removeText)),e.iconRemove&&t.find(".et-icon").addClass(e.iconRemove).removeClass(e.iconAdd),t.attr("data-action","remove"),t.attr("href",t.attr("href").replace("add_to_wishlist","remove_wishlist"))):(e.addText&&(t.find(".button-text").text(e.addText),t.find(".mt-mes").text(e.addText)),e.iconAdd&&t.find(".et-icon").addClass(e.iconAdd).removeClass(e.iconRemove),t.attr("data-action","add"),t.attr("href",t.attr("href").replace("remove_wishlist","add_to_wishlist"))),t.removeClass(h+"-redirect-ready"),"add"!=i?setTimeout(function(){t.removeClass("processing in-process"),xstore_wishlist_params.animated_hearts&&t.addClass("xstore-wishlist-has-animation")},300):xstore_wishlist_params.animated_hearts?(clearTimeout(f),f=setTimeout(function(){"add"==i?t.removeClass("xstore-wishlist-has-animation"):t.addClass("xstore-wishlist-has-animation"),t.find(".xstore-wishlist-animated-hearts").remove(),t.removeClass("processing in-process")},1e3)):setTimeout(function(){t.removeClass("processing in-process")},300)});function x(o,a,r){oJSON.stringify(t))},error:function(){},complete:function(){}}),(t=etTheme.getCookie(u))?t.split("|"):[])}function T(){var t;return i?i.map(t=>JSON.parse(t).id):(S.ajax({url:xstore_wishlist_params.ajaxurl,dataType:"json",method:"POST",data:{cookie_key:u,action:"xstore_get_user_wishlist"},success:function(t){var e=t.products.products;return i=t.products.products.map(t=>JSON.stringify(t)),e},error:function(){},complete:function(){}}),(t=etTheme.getCookie(u))&&S.isArray(t)?t.split("|").map(t=>JSON.parse(t).id):[])}S(document).on("click",".xstore-miniwishlist-remove",function(t){t.preventDefault(),k(S(this).data("id"),{miniwishlist:!0,liItem:S(this).parents("li")})}),S(".xstore-wishlist-table :checkbox").on("click",function(){var t;"product-bulk-select"==S(this).attr("name")?S(this).closest("table").children("tbody").find(":checkbox").prop("checked",S(this).prop("checked")):(t=S(this).closest("tbody").find(":checkbox").filter(":visible:enabled").not(":checked"),S(this).closest("table").children("thead, tfoot").find(":checkbox").prop("checked",function(){return 0===t.length}))}),S(document).on("click",".xstore-wishlist-form .add-all-products",function(t){t.preventDefault(),confirm(xstore_wishlist_params.confirmQuestion)&&(etConfig.ajaxProductAddedNotify.type="alert",(t=S(this).closest(".xstore-wishlist-form").find("table").children("tbody").find(":checkbox").parents("tr").find(".ajax_add_to_cart")).length<1?alert(xstore_wishlist_params.no_products_available):x(0,t.length,t))}),S(document).on("click",p+" .add-all-products",function(t){var e;t.preventDefault(),confirm(xstore_wishlist_params.confirmQuestion)&&(etConfig.ajaxProductAddedNotify.type="alert",(e=(t=S(this).parents(p)).find(".keeper-all-products-buttons .ajax_add_to_cart")).length?(t.find("li").block({message:null,overlayCSS:{opacity:.6}}),x(0,e.length,e)):e.length<1&&alert(xstore_wishlist_params.no_products_available))}),S(".xstore-wishlist-actions").on("click",function(t){t.preventDefault(),etConfig.ajaxProductAddedNotify.type="alert";var e=S(this).closest(".xstore-wishlist-form").find("table").children("tbody").find(":checkbox:checked").parents("tr");if(e.length<1)alert(xstore_wishlist_params.no_active_checkbox);else if(confirm(xstore_wishlist_params.confirmQuestion))switch(S(this).parent().find("select").val()){case"add":(s=e.find(".ajax_add_to_cart")).length<1?alert(xstore_wishlist_params.no_products_available):x(0,s.length,s);break;case"add_wishlist":(s=e.find("."+h+'[data-action="add"]')).addClass("in-process"),v(0,s.length,s);break;case"remove":var i,s=e.find("."+h+'[data-action="remove"]');m?(i=S(this).closest(".xstore-wishlist-form").find("table").children("tbody").find("tr"),s.length==i.find("."+h).length?(S.each(i,function(){S(this).css({position:"relative",zoom:1}),S(this).find("td:last-child").block({message:null,overlayCSS:{opacity:.6}}).attr("style",null)}),etTheme.setCookie(u,"",0),xstore_wishlist_params.is_loggedin&&C([]),S(document).trigger("xstore_wishlist_fragment_refresh",[[]])):b(0,s.length,s)):(s.addClass("in-process"),b(0,s.length,s))}});etTheme.xstore_wishlist.force_init_active_wishlist=function(){S.ajax({url:xstore_wishlist_params.ajaxurl,dataType:"json",method:"POST",data:{cookie_key:u,action:"xstore_get_user_wishlist"},success:function(t){i=t.products.products.map(t=>JSON.stringify(t)),S(document).trigger("xstore_wishlist_initialized",[i])},error:function(){},complete:function(){}})};function k(t,e={}){t=parseInt(t);var i=y(),s=i.map(t=>JSON.parse(t).id).indexOf(t);-1",{class:"et-notify-image",href:t.product_link,target:"_self"}).html(t.product_image),t=S("
",{class:"et-notify-info"}).html(t.product_title),i=S("",{class:"et-notify-button",href:xstore_wishlist_params.wishlist_page_url}).html(xstore_wishlist_params.view_wishlist);t.append(i[0].outerHTML),etTheme.notify(e[0].outerHTML+t[0].outerHTML,"info",5e3,!0)}});break;case"mini_wishlist":let t=S(d).find(p+".et_element-top-level"),e=S(d).find(p+".et_element-top-level.et-off-canvas .et-mini-content"),i=S(d).find(p+".et_element-top-level.et-off-canvas");i.length&&(etTheme.closeQuickView(),etTheme.showHideElementsOnCanvasActions(!0),etTheme.et_global.deny_link_click=!0,S(".et-mobile-panel-wrapper").addClass("outside")),t.addClass("active"),e.addClass("active"),i.addClass("et-content-shown"),n=setTimeout(function(){t.removeClass("active")},1e3)}}),S(document).on("found_variation","form.variations_form",function(t,e){var i=S(t.target).closest(".product").find(".xstore-wishlist-single");i.length&&(xstore_wishlist_params.is_multilingual?(i.block({message:null,overlayCSS:{opacity:.6}}),S.ajax({url:xstore_wishlist_params.ajaxurl,data:{variation_id:e.variation_id,action:"xstore_get_origin_wishlist_product_variation_id"},method:"POST",success:function(t){s(i,t.variation_id),i.unblock()}})):s(i,e.variation_id))}),S(document).on("reset_data","form.variations_form",function(t){t=S(t.target).closest(".product").find(".xstore-wishlist-single");t.length&&o(t)}),S(document).on("found_variation","div.st-swatch-in-loop",function(t,e){var i=S(t.target).closest(".product").find(".xstore-wishlist");i.length&&(xstore_wishlist_params.is_multilingual?(i.block({message:null,overlayCSS:{opacity:.6}}),S.ajax({url:xstore_wishlist_params.ajaxurl,data:{variation_id:e.variation_id,action:"xstore_get_origin_wishlist_product_variation_id"},method:"POST",success:function(t){s(i,t.variation_id),i.unblock()}})):s(i,e.variation_id))}),S(document).on("reset_data","div.st-swatch-in-loop",function(t){t=S(t.target).closest(".product").find(".xstore-wishlist");t.length&&o(t)}),S(document).on("change",".xstore-wishlist-form .xstore-wishlist-quantity .qty",function(){if(clearTimeout(e),0==S(this).val()){let t=S(this).parents("tr").find("."+h+'[data-action="remove"]');e=setTimeout(function(){t.trigger("click")},1500)}});var a=etTheme.xstore_wishlist.switch_variation_button=function(t,e){-1===T().indexOf(e)?w(t,JSON.parse(t.attr("data-settings")),"remove"):w(t,JSON.parse(t.attr("data-settings")))};const r=()=>{etTheme.xstore_wishlist.force_init_active_wishlist(),t.forEach(t=>window.removeEventListener(t,r,{passive:!0}))},t=["mousemove","mousedown","keydown","touchstart","wheel"];t.forEach(t=>window.addEventListener(t,r,{passive:!0})),S(document).on("xstore_wishlist_fragment_refresh",function(t,e){var i;i=e,S.ajax({url:xstore_wishlist_params.ajaxurl,data:{products:i,products_count:i.length,action:"xstore_wishlist_fragments"},method:"POST",success:function(t){t&&t.fragments&&S.each(t.fragments,function(t,e){S(t).replaceWith(e)}),i.length<1?(S(p).find(".product_list-popup-footer-wrapper").hide(),m&&c&&S.ajax({url:xstore_wishlist_params.ajaxurl,data:{action:"xstore_empty_wishlist_page"},method:"POST",success:function(t){t&&t.page_content&&(S(document).find("form.xstore-wishlist-form").replaceWith(t.page_content),S(document).find(".xstore-wishlist-share").remove())}})):S(p).find(".product_list-popup-footer-wrapper").attr("style",null),S(document).trigger("xstore_wishlist_fragment_refreshed",[i])}})})}}(jQuery);