;(function ($){
'use strict';
function matchingVariationInStock(attrName, value, chosen, variations){
if(!Array.isArray(variations)){
return true;
}
return variations.some(function (variation){
if(!(variation.is_in_stock&&variation.is_purchasable)){
return false;
}
var attrs=variation.attributes||{};
var ownValue=attrs[attrName];
if(typeof ownValue!=='undefined'&&ownValue!==''&&ownValue!==value){
return false;
}
for (var key in chosen){
if(key===attrName||!chosen.hasOwnProperty(key)){
continue;
}
var otherValue=attrs[key];
if(typeof otherValue!=='undefined'&&otherValue!==''&&otherValue!==chosen[key]){
return false;
}}
return true;
});
}
$.fn.tawcvs_variation_swatches_form=function (){
return this.each(function (){
var $form=$(this);
if(typeof $form.find(".tawcvs-available-product-variation").data("product_variations")!=="undefined"){
$form.data("product_variations", $form.find(".tawcvs-available-product-variation").data("product_variations"))
.trigger('reload_product_variations')
.trigger('update_variation_values');
}
$form
.addClass('swatches-support')
.on("found_variation", function (event, variation){
$form.change_variation_image_on_shop_page(variation);
})
.on("reset_image", function (event){
$form.change_variation_image_on_shop_page(false);
})
.on('click', '.swatch', function (e){
e.preventDefault();
e.stopImmediatePropagation();
var $el=$(this);
let $select=false, value=false;
if($el.data('clicking')) return;
$el.data('clicking', true);
setTimeout(()=> $el.removeData('clicking'), 50);
if(!$("body").hasClass("single-product") &&
$("body").find(".wc-product-table-wrapper").length){
let attribute_name=$el.closest('.tawcvs-swatches').data("attribute_name");
$select=$el.closest('.variations').find('select[data-attribute_name="' + attribute_name + '"]');
value=$el.attr('data-value');
}else{
$select=$el.closest('.value').find('select');
value=$el.attr('data-value');
}
if($el.hasClass('disabled')){
return;
}
if(!$select.length){
if($form.closest(".woosb-product").length){
$select=$el.closest('.select').find('select');
}}
$el.parents('.tawcvs-swatches').find(".swatch.selected").each(function (){
$(this).not($el).removeClass("selected");
$select.val('');
})
$select.trigger('focusin');
if(!$select.find('option[value="' + value + '"]').length){
$el.siblings('.swatch').removeClass('selected');
$select.val('').change();
$form.trigger('tawcvs_no_matching_variations', [$el]);
return;
}
if($el.hasClass('selected')){
$select.val('');
$el.removeClass('selected');
if($el.attr('type')=='radio'){
setTimeout(function(){
$el.prop('checked', false);
}, 100);
}}else{
$el.addClass('selected').siblings('.selected').removeClass('selected');
$select.val(value);
if($el.attr('type')=='radio'){
setTimeout(function(){
$el.prop('checked', true);
}, 100);
}}
$select.change();
})
.on('click', '.reset_variations', function (){
$form.find('.swatch.selected').removeClass('selected');
if(!$form.find('.swatch.disabled').hasClass('blur-cross')){
$form.find('.swatch.disabled').removeClass('disabled');
}
if($form.find('input[type="radio"]').length > 1){
$form.find('input[type="radio"]').prop('checked', false);
}})
.on('woocommerce_update_variation_values', function (){
setTimeout(function (){
var variations=$form.data('product_variations');
var chosen={};
$form.find('.variation-selector select').each(function (){
var name=$(this).data('attribute_name')||$(this).attr('name'),
val=$(this).val();
if(name&&val){
chosen[name]=val;
}});
$form.find('.variation-selector').each(function (){
var $variationSelector=$(this),
$select=$variationSelector.find('select'),
$options=$select.find('option'),
$selected=$options.filter(':selected'),
attrName=$select.data('attribute_name')||$select.attr('name'),
values=[];
$options.each(function (index, option){
if(option.value!==''){
values.push(option.value);
}});
$variationSelector.closest('.value').find('.swatch').each(function (){
var $swatch=$(this),
value=$swatch.attr('data-value');
$swatch.closest('.swatch-item-wrapper').show();
if(values.indexOf(value) > -1){
if(!$swatch.hasClass('blur-cross')){
$swatch.removeClass('disabled');
}
if(!$swatch.hasClass('blur-cross') &&
!matchingVariationInStock(attrName, value, chosen, variations)){
$swatch.addClass('disabled');
if($swatch.closest('.tawcvs-swatches').hasClass('oss-hide')){
$swatch.closest('.swatch-item-wrapper').hide();
}
if($selected.length&&value===$selected.val()){
$swatch.removeClass('selected');
}}
}else{
$swatch.addClass('disabled');
if($swatch.closest('.tawcvs-swatches').hasClass('oss-hide')){
$swatch.closest('.swatch-item-wrapper').hide();
}
if($selected.length&&value===$selected.val()){
$swatch.removeClass('selected');
}}
});
});
}, 50);
})
.on('tawcvs_no_matching_variations', function (){
window.alert(wc_add_to_cart_variation_params.i18n_no_matching_variations_text);
});
});
};
$.fn.change_variation_image_on_shop_page=function (variation){
var $product=$(this).closest('.product'),
$product_img=$product.find('.woocommerce-LoopProduct-link img');
if($product_img.length!==1){
return false;
}
if(variation&&variation.image&&variation.image.src&&variation.image.src.length > 1){
$product_img.wc_set_variation_attr('src', variation.image.src);
$product_img.wc_set_variation_attr('height', variation.image.src_h);
$product_img.wc_set_variation_attr('width', variation.image.src_w);
$product_img.wc_set_variation_attr('srcset', variation.image.srcset);
$product_img.wc_set_variation_attr('sizes', variation.image.sizes);
$product_img.wc_set_variation_attr('title', variation.image.title);
$product_img.wc_set_variation_attr('data-caption', variation.image.caption);
$product_img.wc_set_variation_attr('alt', variation.image.alt);
$product_img.wc_set_variation_attr('data-src', variation.image.full_src);
$product_img.wc_set_variation_attr('data-large_image', variation.image.full_src);
$product_img.wc_set_variation_attr('data-large_image_width', variation.image.full_src_w);
$product_img.wc_set_variation_attr('data-large_image_height', variation.image.full_src_h);
}else{
$product_img.wc_reset_variation_attr('src');
$product_img.wc_reset_variation_attr('width');
$product_img.wc_reset_variation_attr('height');
$product_img.wc_reset_variation_attr('srcset');
$product_img.wc_reset_variation_attr('sizes');
$product_img.wc_reset_variation_attr('title');
$product_img.wc_reset_variation_attr('data-caption');
$product_img.wc_reset_variation_attr('alt');
$product_img.wc_reset_variation_attr('data-src');
$product_img.wc_reset_variation_attr('data-large_image');
$product_img.wc_reset_variation_attr('data-large_image_width');
$product_img.wc_reset_variation_attr('data-large_image_height');
}}
function toggle_hidden_variation_btn(){
const resetVariationNodes=document.getElementsByClassName('reset_variations');
if(resetVariationNodes.length){
Array.prototype.forEach.call(resetVariationNodes, function (resetVariationEle){
let observer=new MutationObserver(function (){
if(resetVariationEle.style.visibility!=='hidden'){
resetVariationEle.style.display='block';
}else{
resetVariationEle.style.display='none';
}});
observer.observe(resetVariationEle, {attributes: true, childList: true});
})
}}
function logPerformanceInfo(){
if(typeof tawcvs_config!=='undefined'&&console&&console.log){
const $forms=$('.variations_form');
const $largeProductForms=$forms.filter(function(){
const variationData=$(this).find('.tawcvs-available-product-variation').data('product_variations');
return variationData&&variationData.length > tawcvs_config.large_product_threshold;
});
if($largeProductForms.length > 0){
console.log('TAWCVS: PHP-optimized handling for', $largeProductForms.length, 'large product(s)');
$largeProductForms.each(function(){
const variationData=$(this).find('.tawcvs-available-product-variation').data('product_variations');
if(variationData){
console.log('TAWCVS: Loaded', variationData.length, 'variations instantly for product');
}});
}}
}
function initializeSwatches(){
$('.variations_form').tawcvs_variation_swatches_form().trigger('woocommerce_update_variation_values');
$(document.body).trigger('tawcvs_initialized');
toggle_hidden_variation_btn();
logPerformanceInfo();
}
let reinitTimeout;
function throttledReinit(){
clearTimeout(reinitTimeout);
reinitTimeout=setTimeout(()=> {
var $variations_form=$('.variations_form:not(.swatches-support)');
if($variations_form.length > 0){
$variations_form.each(function (){
$(this).wc_variation_form();
});
$variations_form.tawcvs_variation_swatches_form();
}}, 50);
}
$(function (){
initializeSwatches();
});
$(document).ajaxComplete(function (){
throttledReinit();
});
$(document).on('updated_wc_div wc_fragments_refreshed', function(){
throttledReinit();
});
})(jQuery);
(()=>{"use strict";function e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function t(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r(){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 n(e,t){if(e){if("string"==typeof e)return i(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,t):void 0}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function o(e){if(Array.isArray(e))return e}const l="email",a="phone",u="name",c={[l]:["email","e-mail","mail","email address"],[a]:["phone","tel","mobile","cell","telephone","phone number"],[u]:["name","full-name","full name","full_name","fullname","first-name","first name","first_name","firstname","last-name","last name","last_name","lastname","given-name","given name","given_name","givenname","family-name","family name","family_name","familyname","fname","lname","first","last","your-name","your name"]};function f(e){return e&&"string"==typeof e?e.trim().toLowerCase():""}function s(e){const t=f(e),r=t.lastIndexOf("@");if(-1===r)return t;const n=t.slice(r+1);if(["gmail.com","googlemail.com"].includes(n)){const e=t.slice(0,r).replace(/\./g,"");return"".concat(e,"@").concat(n)}return t}function m(e){const t=f(e),r=t.replace(/\D/g,"");return t.startsWith("+")?"+".concat(r):r}function y(l){const a=l.filter(e=>e.type===u).map(e=>f(e.value)).filter(Boolean);if(!a.length)return;const c=o(y=1===a.length?a[0].split(" "):a)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(y)||n(y)||r(),s=c[0],m=i(c).slice(1);var y;return function(r){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?e(Object(i),!0).forEach(function(e){t(r,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))})}return r}({first_name:s},(null==m?void 0:m.length)>0?{last_name:m.join(" ")}:{})}function p(e){var t;return null===(t=e.find(e=>e.type===l))||void 0===t?void 0:t.value}function v(e){var t;return null===(t=e.find(e=>e.type===a))||void 0===t?void 0:t.value}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function g(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}globalThis.document.addEventListener("wpcf7mailsent",e=>{var t,i,h;const O=(null===(t=globalThis._googlesitekit)||void 0===t?void 0:t.gtagUserData)?function(e){if(!(e&&e instanceof HTMLFormElement))return;const t=new FormData(e);return function(e){const t=[["address",y(e)],["email",p(e)],["phone_number",v(e)]].filter(e=>{return(t=e,i=2,o(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,l,a=[],u=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(a.push(n.value),a.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(c)throw i}}return a}}(t,i)||n(t,i)||r())[1];var t,i});if(0!==t.length)return Object.fromEntries(t)}(Array.from(t.entries()).map(t=>{var r;let n=(p=2,function(e){if(Array.isArray(e))return e}(y=t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,l,a=[],u=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(a.push(n.value),a.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(c)throw i}}return a}}(y,p)||function(e,t){if(e){if("string"==typeof e)return b(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(e,t):void 0}}(y,p)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=n[0],o=n[1];var y,p;const v=e.querySelector("[name='".concat(i,"']")),d=null==v?void 0:v.type;return"hidden"===d||"submit"===d?null:function(e){let t=e||{},r=t.type,n=t.name,i=t.value,o=t.label;switch(r=f(r),n=f(n),i=f(i),o=function(e){return e&&"string"==typeof e?e.trim().toLowerCase().replace(/\s*\*+\s*$/,"").replace(/\s*\(required\)\s*$/i,"").replace(/\s*:\s*$/,"").trim():""}(o),r){case"email":return{type:l,value:s(i)};case"tel":return{type:a,value:m(i)}}return function(e){if(!e)return!1;const t=s(e);return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}(i)||c[l].includes(n)||c[l].includes(o)?{type:l,value:s(i)}:c[a].includes(n)||c[a].includes(o)?{type:a,value:m(i)}:c[u].includes(n)||c[u].includes(o)?{type:u,value:f(i)}:function(e){if(!e)return!1;if(!function(e){const t=e.replace(/\D/g,"");return!(t.length<7||t.length<e.length/2)&&/^[\s\-()+.\d]*$/.test(e)}(e))return!1;const t=m(e);if(!/^\+?\d{7,}$/.test(t))return!1;const r=/[\s\-()+.]/.test(e),n=e.trim().startsWith("+");return!(!r&&!n)}(i)?{type:a,value:m(i)}:null}({type:d,label:null!=v&&v.id?null===(r=e.querySelector("label[for='".concat(null==v?void 0:v.id,"']")))||void 0===r?void 0:r.textContent:void 0,name:i,value:o})}).filter(Boolean))}(e.target):null,j=e.detail.contactFormId;null===(i=globalThis._googlesitekit)||void 0===i||null===(h=i.gtagEvent)||void 0===h||h.call(i,"contact",function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach(function(t){g(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({event_category:j,event_label:e.detail.unitTag,googlesitekit_event_provider:"contact-form-7",googlesitekit_form_id:String(j)},O?{user_data:O}:{}))})})();