!function(){"use strict";var t=window.ctFrontend;window.jQuery;const e=function({el:t,form:e,container:o,favoritesButton:r,productId:a,type:i,eventData:s}){"found_variation"===i&&function({container:t,favoritesButton:e,eventData:n}){const{variation_id:o,attributes:r}=n,a=ct_localizations.blc_ext_wish_list.list.items,i={...r};Object.keys(r).forEach(function(e){""===r[e]&&(i[e.trim()]=t.querySelector(`select[name="${e}"]`).value.trim())});const s=a.find(function(t){return t.id===o&&Object.keys(t?.attributes||{}).every(function(e){return i?.[`attribute_${e}`]&&t.attributes[`${e}`]&&t.attributes[`${e}`]===i[`attribute_${e}`]})});e.dataset.buttonState=s?"active":""}({container:o,favoritesButton:r,eventData:s}),"reset_data"===i&&function({el:t,favoritesButton:e,productId:o}){const r=n(t);setTimeout(function(){r?e.dataset.buttonState="disabled":(e.dataset.id=o,e.dataset.buttonState="",ct_localizations.blc_ext_wish_list.list.items.find(function(t){return t.id===o&&!t.attributes})&&(e.dataset.buttonState="active"))})}({el:t,favoritesButton:r,productId:a})},n=function(t){return[...t.querySelectorAll("select")].some(function(t){return!!t&&!!t.value})};(0,t.registerDynamicChunk)("blocksy_ext_woo_extra_variations_wish_list",{mount:function(t,{event:n,eventData:o}){const r={el:t,type:n.type,eventData:o};!function({el:t,type:n,eventData:o}){if(!t.closest(".entry-summary"))return;const r=t.closest(".entry-summary"),a=r.querySelector(".variations_form"),i=document.querySelector(".ct-wishlist-button-single");if(!i)return;const s=parseFloat(a.dataset.product_id);e({el:t,form:a,container:r,favoritesButton:i,productId:s,type:n,eventData:o})}(r),function({el:t,type:n,eventData:o}){if(!t.closest(".product"))return;const r=t.closest(".product"),a=r.querySelector(".ct-card-variation-swatches"),i=r.querySelector(".ct-wishlist-button-archive");if(!i)return;const s=parseFloat(Array.from(t.closest(".product").classList).find(function(t){return 0===t.indexOf("post-")}).split("-")[1]);e({el:t,form:a,container:r,favoritesButton:i,productId:s,type:n,eventData:o})}(r)}})}();