CLI_ACCEPT_COOKIE_NAME=(typeof CLI_ACCEPT_COOKIE_NAME!=='undefined' ? CLI_ACCEPT_COOKIE_NAME:'viewed_cookie_policy');
CLI_PREFERNCE_COOKIE=(typeof CLI_PREFERNCE_COOKIE!=='undefined' ? CLI_PREFERNCE_COOKIE:'CookieLawInfoConsent');
CLI_ACCEPT_COOKIE_EXPIRE=(typeof CLI_ACCEPT_COOKIE_EXPIRE!=='undefined' ? CLI_ACCEPT_COOKIE_EXPIRE:365);
CLI_COOKIEBAR_AS_POPUP=(typeof CLI_COOKIEBAR_AS_POPUP!=='undefined' ? CLI_COOKIEBAR_AS_POPUP:false);
var CLI_Cookie={
set: function (name, value, days){
var secure="";
if(true===Boolean(Cli_Data.secure_cookies) ) secure=";secure";
var domain=(Cli_Data.cookieDomain!=='' ? ";domain=" + Cli_Data.cookieDomain:'');
var date=new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
var expires=";expires=" + date.toGMTString();
if(days < 1){
this.eraseCookie(name,expires);
}else{
document.cookie=name + "=" + value + secure + expires + domain + ";path=/";
}},
read: function (name){
var nameEQ=name + "=";
var ca=document.cookie.split(';');
for (var i=0; i < ca.length; i++){
var c=ca[i];
while (c.charAt(0)==' '){
c=c.substring(1, c.length);
}
if(c.indexOf(nameEQ)===0){
return c.substring(nameEQ.length, c.length);
}}
return null;
},
erase: function (name){
this.set(name, "", -10);
},
eraseCookie: function(name, expires, index){
if(this.cookieExist(name)===false){
return false;
}
var _hostname=window.location.hostname;
var value="";
if(typeof index==='undefined'){
index=0;
}
if(index===0){
_hostname=_hostname.substring(_hostname.lastIndexOf(".", _hostname.lastIndexOf(".")-1));
}
else if(index===1){
_hostname=(Cli_Data.cookieDomain!=='' ? Cli_Data.cookieDomain:'');
}
else if(index===2){
if(_hostname.indexOf("www")!=1){
_hostname=_hostname.replace('www','');
}}
index=index + 1;
document.cookie=name + "=" + value + expires + ";domain="+ _hostname + ";path=/";
if(index <=2){
this.eraseCookie(name, expires, index);
}},
exists: function (name){
return (this.read(name)!==null);
},
getallcookies:function(){
var pairs=document.cookie.split(";");
var cookieslist={};
for (var i=0; i < pairs.length; i++){
var pair=pairs[i].split("=");
cookieslist[(pair[0] + '').trim()]=unescape(pair[1]);
}
return cookieslist;
},
cookieExist: function(name){
cookie_pattern=new RegExp("^(.*;)?\\s*"+name+"\\s*=\\s*[^;]+(.*)?$");
if(!document.cookie.match(cookie_pattern)){
return false;
}
return true;
}}
var CLI=
{
bar_config:{},
consent:{},
allowedCategories:[],
showagain_config:{},
set:function(args){
if(typeof JSON.parse!=="function"){
console.log("CookieLawInfo requires JSON.parse but your browser doesn't support it");
return;
}
if(typeof args.settings!=='object'){
this.settings=JSON.parse(args.settings);
}else{
this.settings=args.settings;
}
this.bar_elm=jQuery(this.settings.notify_div_id);
this.showagain_elm=jQuery(this.settings.showagain_div_id);
this.banner_heading=jQuery('#wt-cli-cookie-banner-title');
this.main_button=jQuery('.cli-plugin-main-button');
this.main_link=jQuery('.cli-plugin-main-link');
this.reject_link=jQuery('.cookie_action_close_header_reject');
this.settings_link=jQuery('.cli_settings_button');
this.delete_link=jQuery(".cookielawinfo-cookie-delete");
this.accept_all_button=jQuery('.wt-cli-accept-all-btn');
if(this.settings.cookie_bar_as=='popup'){
CLI_COOKIEBAR_AS_POPUP=true;
}
this.cliRenewConsent();
this.configBar();
this.toggleBar();
this.attachDelete();
this.attachEvents();
this.configButtons();
this.addStyleAttribute();
this.settingsPopUp();
this.cookieLawInfoRunCallBacks();
this.acceptPageNavigation();
var cli_hidebar_on_readmore=this.hideBarInReadMoreLink();
if(this.settings.scroll_close===true&&cli_hidebar_on_readmore===false){
window.addEventListener("scroll",CLI.closeOnScroll, false);
}},
hideBarInReadMoreLink:function(){
if(CLI.settings.button_2_hidebar===true&&this.main_link.length>0&&this.main_link.hasClass('cli-minimize-bar')){
jQuery('.wt-cli-cookie-bar-container').addClass('wt-cli-hide-bar');
this.hideHeader();
this.showagain_elm.slideDown(this.settings.animate_speed_show);
return true;
}
return false;
},
settingsPopUp:function(){
jQuery(document).on('click keypress','.cli_settings_button',function(e){
var key=e.which;
e.preventDefault();
if(key===1||key===13){
if(CLI.settings.cookie_setting_popup==true){
jQuery('#cliSettingsPopup').addClass("cli-show").css({'opacity':0}).animate({'opacity':1});
jQuery('#cliSettingsPopup').removeClass('cli-blowup cli-out').addClass("cli-blowup");
jQuery('#cliSettingsPopup').attr('aria-hidden', false);
jQuery('body').addClass("cli-modal-open");
jQuery(".cli-settings-overlay").addClass("cli-show");
jQuery("#cookie-law-info-bar").css({'opacity':.1});
jQuery("#cliModalClose").focus();
if(!jQuery('.cli-settings-mobile').is(':visible')){
jQuery('#cliSettingsPopup').find('.cli-nav-link:eq(0)').click();
}}else{
jQuery('#cookie-law-info-bar .cli-tab-container').slideToggle(CLI.settings.animate_speed_show);
}}
});
jQuery('#cliModalClose').click(function(){
CLI.settingsPopUpClose();
});
jQuery('#cliModalClose').keydown(function(e){
var key=e.which
if(key===9){
if(e.shiftKey===true){
e.preventDefault()
jQuery('#wt-cli-privacy-save-btn').focus()
}}
});
document.addEventListener('keydown', function(e){
var key=e.which;
if(key===27&&jQuery('#cliSettingsPopup').hasClass('cli-show')){
CLI.settingsPopUpClose();
}});
jQuery("#cliSettingsPopup").click(function(e){
if(!(document.getElementsByClassName('cli-modal-dialog')[0].contains(e.target))){
CLI.settingsPopUpClose();
}});
jQuery('.cli_enable_all_btn').click(function(){
var cli_toggle_btn=jQuery(this);
var enable_text=cli_toggle_btn.attr('data-enable-text');
var disable_text=cli_toggle_btn.attr('data-disable-text');
if(cli_toggle_btn.hasClass('cli-enabled')){
CLI.disableAllCookies();
cli_toggle_btn.html(enable_text);
}else{
CLI.enableAllCookies();
cli_toggle_btn.html(disable_text);
}
jQuery(this).toggleClass('cli-enabled');
});
this.settingsTabbedAccordion();
this.toggleUserPreferenceCheckBox();
this.privacyReadmore();
},
settingsTabbedAccordion:function(){
jQuery(document).on('click keypress','.cli-tab-header',function(e){
if(!(jQuery(e.target).hasClass('cli-slider')||jQuery(e.target).hasClass('cli-user-preference-checkbox'))){
var key=e.which;
e.preventDefault();
if(key===1||key===13){
var currentElement=jQuery(this);
var tabLink=currentElement.closest('.cli-tab-header').find('.cli-nav-link');
if(currentElement.hasClass("cli-tab-active")){
currentElement.removeClass("cli-tab-active");
currentElement.siblings(".cli-tab-content").slideUp(200);
tabLink.attr('aria-expanded', false);
}else{
jQuery(".cli-tab-header").removeClass("cli-tab-active");
currentElement.addClass("cli-tab-active");
jQuery(".cli-tab-content").slideUp(200);
currentElement.siblings(".cli-tab-content").slideDown(200);
tabLink.attr('aria-expanded', true);
}}
}});
},
settingsPopUpClose:function(){
jQuery('#cliSettingsPopup').removeClass('cli-show');
jQuery('#cliSettingsPopup').addClass('cli-out');
jQuery('#cliSettingsPopup').attr('aria-hidden', true);
jQuery('body').removeClass("cli-modal-open");
jQuery(".cli-settings-overlay").removeClass("cli-show");
jQuery("#cookie-law-info-bar").css({'opacity':1});
jQuery(".cli_settings_button").focus();
},
toggleUserPreferenceCheckBox:function(){
jQuery('.cli-user-preference-checkbox').each(function(){
var categoryCookie='cookielawinfo-'+jQuery(this).attr('data-id');
var categoryCookieValue=CLI_Cookie.read(categoryCookie);
if(categoryCookieValue==null){
if(jQuery(this).is(':checked')){
CLI_Cookie.set(categoryCookie,'yes',CLI_ACCEPT_COOKIE_EXPIRE);
}else{
CLI_Cookie.set(categoryCookie,'no',CLI_ACCEPT_COOKIE_EXPIRE);
}}else{
if(categoryCookieValue=="yes"){
jQuery(this).prop("checked",true);
}else{
jQuery(this).prop("checked",false);
}}
});
jQuery('.cli-user-preference-checkbox').click(function(){
var dataID=jQuery(this).attr('data-id');
var currentToggleElm=jQuery('.cli-user-preference-checkbox[data-id='+dataID+']');
if(jQuery(this).is(':checked')){
CLI_Cookie.set('cookielawinfo-'+dataID,'yes',CLI_ACCEPT_COOKIE_EXPIRE);
currentToggleElm.prop('checked',true);
}else{
CLI_Cookie.set('cookielawinfo-'+dataID,'no',CLI_ACCEPT_COOKIE_EXPIRE);
currentToggleElm.prop('checked',false);
}
CLI.checkCategories();
CLI.generate_user_preference_cookie();
CLI.generateConsent();
});
},
attachEvents:function(){
jQuery(document).on('click keypress','.wt-cli-privacy-btn',function(e){
var key=e.which;
e.preventDefault();
if(key===1||key===13){
var action=jQuery(this).attr('data-cli-action');
if(action==='accept_all'){
CLI.enableAllCookies();
}
CLI.accept_close();
CLI.saveLog('accept');
CLI.settingsPopUpClose();
}});
jQuery('.wt-cli-privacy-overview-actions').find('a').last().keydown(function(e){
var key=e.which
if(key===9){
if(e.shiftKey===false){
e.preventDefault()
jQuery('#cliModalClose').focus()
}}
});
jQuery(document).on('click keypress','.cli_action_button',function(e){
var key=e.which;
e.preventDefault();
if(key===1||key===13){
var elm=jQuery(this);
var button_action=elm.attr('data-cli_action');
var open_link=elm[0].hasAttribute("href")&&elm.attr("href").charAt(0)!=='#' ? true:false;
var new_window=false;
if(button_action=='accept'){
if(e.originalEvent!==undefined){
if(CLI.settings.accept_all==true){
CLI.enableAllCookies();
}}else{
CLI.settingsPopUpClose();
}
CLI.accept_close();
new_window=CLI.settings.button_1_new_win ? true:false;
}
else if(button_action=='accept_all'){
CLI.enableAllCookies();
CLI.accept_close();
new_window=CLI.settings.button_7_new_win ? true:false;
}
else if(button_action=='reject'){
CLI.disableAllCookies();
CLI.reject_close();
new_window=CLI.settings.button_3_new_win ? true:false;
}
CLI.saveLog(button_action);
if(open_link){
if(new_window){
window.open(elm.attr("href"),'_blank');
}else{
window.location.href=elm.attr("href");
}}
}});
jQuery(document).on('click','.cli_cookie_close_button',function(e){
e.preventDefault();
var elm=jQuery(this);
var button_action=elm.attr('data-cli_action');
if(CLI.settings.accept_all==true){
CLI.enableAllCookies();
}
CLI.accept_close();
CLI.saveLog(button_action);
});
},
saveLog:function(button_action){
if(CLI.settings.logging_on){
var ccpaOptedOut=cliBlocker.ccpaOptedOut();
cookies=CLI_Cookie.getallcookies();
cookies.ccpaOptout=ccpaOptedOut;
jQuery.ajax({
url: log_object.ajax_url,
type: 'POST',
data:{
action: 'wt_log_visitor_action',
wt_clicked_button_id: '',
wt_user_action:button_action,
cookie_list:cookies
},
success:function (response){
}});
}},
attachDelete:function(){
this.delete_link.click(function (){
CLI_Cookie.erase(CLI_ACCEPT_COOKIE_NAME);
for(var k in Cli_Data.nn_cookie_ids){
CLI_Cookie.erase(Cli_Data.nn_cookie_ids[k]);
}
CLI.generate_user_preference_cookie();
CLI.generateConsent();
window.location.reload();
return false;
});
},
configButtons:function(){
this.main_button.css('color',this.settings.button_1_link_colour);
if(this.settings.button_1_as_button){
this.main_button.css('background-color',this.settings.button_1_button_colour);
this.main_button.hover(function (){
jQuery(this).css('background-color',CLI.settings.button_1_button_hover);
},function (){
jQuery(this).css('background-color',CLI.settings.button_1_button_colour);
});
}
this.main_link.css('color',this.settings.button_2_link_colour);
if(this.settings.button_2_as_button){
this.main_link.css('background-color',this.settings.button_2_button_colour);
this.main_link.hover(function (){
jQuery(this).css('background-color',CLI.settings.button_2_button_hover);
},function (){
jQuery(this).css('background-color',CLI.settings.button_2_button_colour);
});
}
this.reject_link.css('color',this.settings.button_3_link_colour);
if(this.settings.button_3_as_button){
this.reject_link.css('background-color',this.settings.button_3_button_colour);
this.reject_link.hover(function (){
jQuery(this).css('background-color',CLI.settings.button_3_button_hover);
},function (){
jQuery(this).css('background-color',CLI.settings.button_3_button_colour);
});
}
this.settings_link.css('color',this.settings.button_4_link_colour);
if(this.settings.button_4_as_button){
this.settings_link.css('background-color',this.settings.button_4_button_colour);
this.settings_link.hover(function (){
jQuery(this).css('background-color',CLI.settings.button_4_button_hover);
},function (){
jQuery(this).css('background-color',CLI.settings.button_4_button_colour);
});
}
this.accept_all_button.css('color',this.settings.button_7_link_colour);
if(this.settings.button_7_as_button){
this.accept_all_button.css('background-color',this.settings.button_7_button_colour);
this.accept_all_button.hover(function (){
jQuery(this).css('background-color',CLI.settings.button_7_button_hover);
},function (){
jQuery(this).css('background-color',CLI.settings.button_7_button_colour);
});
}},
toggleBar:function(){
if(CLI_COOKIEBAR_AS_POPUP){
this.barAsPopUp(1);
}
if(CLI.settings.cookie_bar_as=='widget'){
this.barAsWidget(1);
}
if(this.settings.show_once_yn){
setTimeout(function(){
if(!CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)){
CLI.close_header();
}},CLI.settings.show_once);
}
this.showagain_elm.on('click keypress', function (e){
var key=e.which;
if(key===1||key===13){
e.preventDefault();
CLI.showagain_elm.slideUp(CLI.settings.animate_speed_hide, function(){
CLI.bar_elm.slideDown(CLI.settings.animate_speed_show);
CLI.refocusElement();
if(CLI_COOKIEBAR_AS_POPUP){
CLI.showPopupOverlay();
}});
}});
},
configShowAgain:function(){
this.showagain_config={
'background-color': this.settings.background,
'color':this.settings.text,
'position': 'fixed',
'font-family': this.settings.font_family
};
if(this.settings.border_on){
var border_to_hide='border-' + this.settings.notify_position_vertical;
this.showagain_config['border']='1px solid ' + this.l1hs(this.settings.border);
this.showagain_config[border_to_hide]='none';
}
var cli_win=jQuery(window);
var cli_winw=cli_win.width();
var showagain_x_pos=this.settings.showagain_x_position;
if(cli_winw<300){
showagain_x_pos=10;
this.showagain_config.width=cli_winw-20;
}else{
this.showagain_config.width='auto';
}
var cli_defw=cli_winw>400 ? 500:cli_winw-20;
if(CLI_COOKIEBAR_AS_POPUP){
var sa_pos=this.settings.popup_showagain_position;
var sa_pos_arr=sa_pos.split('-');
if(sa_pos_arr[1]=='left'){
this.showagain_config.left=showagain_x_pos;
}else if(sa_pos_arr[1]=='right'){
this.showagain_config.right=showagain_x_pos;
}
if(sa_pos_arr[0]=='top'){
this.showagain_config.top=0;
}else if(sa_pos_arr[0]=='bottom'){
this.showagain_config.bottom=0;
}
this.bar_config['position']='fixed';
}else if(this.settings.cookie_bar_as=='widget'){
this.showagain_config.bottom=0;
if(this.settings.widget_position=='left'){
this.showagain_config.left=showagain_x_pos;
}else if(this.settings.widget_position=='right'){
this.showagain_config.right=showagain_x_pos;
}}else{
if(this.settings.notify_position_vertical=="top"){
this.showagain_config.top='0';
}
else if(this.settings.notify_position_vertical=="bottom"){
this.bar_config['position']='fixed';
this.bar_config['bottom']='0';
this.showagain_config.bottom='0';
}
if(this.settings.notify_position_horizontal=="left"){
this.showagain_config.left=showagain_x_pos;
}else if(this.settings.notify_position_horizontal=="right"){
this.showagain_config.right=showagain_x_pos;
}}
this.showagain_elm.css(this.showagain_config);
},
configBar:function(){
var templateID='';
this.bar_config={
'background-color':this.settings.background,
'color':this.settings.text,
'font-family':this.settings.font_family
};
if(jQuery(".wt-cli-template")[0]){
var templateElm=jQuery(".wt-cli-template");
var templateClasses=templateElm.attr('class');
var templateClasses=templateClasses.split(" ");
var matchingID=templateClasses.filter(function (value){
return value.match(/\bcli-style/);
});
templateID=matchingID[0];
this.bar_elm.attr('data-template-id',templateID);
}
if(jQuery(".wt-cli-category-widget")[0]){
this.bar_elm.addClass('wt-cli-category-widget-active');
}
if(this.settings.cookie_setting_popup===false){
this.barPopupStyle();
}
if(this.settings.notify_position_vertical=="top"){
this.bar_config['top']='0';
if(this.settings.header_fix===true){
this.bar_config['position']='fixed';
}}else{
this.bar_config['bottom']='0';
}
this.configShowAgain();
this.bar_elm.css(this.bar_config).hide();
},
l1hs:function(str){
if(str.charAt(0)=="#"){
str=str.substring(1, str.length);
}else{
return "#" + str;
}
return this.l1hs(str);
},
close_header:function(){
CLI_Cookie.set(CLI_ACCEPT_COOKIE_NAME,'yes',CLI_ACCEPT_COOKIE_EXPIRE);
if(CLI.settings.accept_all==true){
CLI.enableAllCookies();
}
CLI.accept_close();
this.hideHeader();
CLI.saveLog('accept');
},
accept_close:function(){
this.hidePopupOverlay();
CLI_Cookie.set(CLI_ACCEPT_COOKIE_NAME,'yes',CLI_ACCEPT_COOKIE_EXPIRE);
if(this.settings.notify_animate_hide){
this.bar_elm.slideUp(this.settings.animate_speed_hide,cliBlocker.runScripts);
}else{
this.bar_elm.hide(0,cliBlocker.runScripts);
}
if(this.settings.showagain_tab){
this.showagain_elm.slideDown(this.settings.animate_speed_show);
}
this.generate_user_preference_cookie();
this.generateConsent();
CLI.cookieLawInfoRunCallBacks();
if(this.settings.accept_close_reload===true){
this.reload_current_page();
}
return false;
},
reject_close:function(){
this.hidePopupOverlay();
for(var k in Cli_Data.nn_cookie_ids){
CLI_Cookie.erase(Cli_Data.nn_cookie_ids[k]);
}
CLI_Cookie.set(CLI_ACCEPT_COOKIE_NAME,'no',CLI_ACCEPT_COOKIE_EXPIRE);
if(this.settings.notify_animate_hide){
this.bar_elm.slideUp(this.settings.animate_speed_hide,cliBlocker.runScripts);
}else{
this.bar_elm.hide(0,cliBlocker.runScripts);
}
if(this.settings.showagain_tab){
this.showagain_elm.slideDown(this.settings.animate_speed_show);
}
this.generate_user_preference_cookie();
CLI.generateConsent();
if(this.settings.reject_close_reload===true){
this.reload_current_page();
}
return false;
},
generate_user_preference_cookie:function(){
var cli_user_preference_arr=new Array();
var cli_user_preference_val='';
if(CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)){
cli_user_preference_arr.push('cli-'+CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME));
}
jQuery('.cli-user-preference-checkbox').each(function(){
if(jQuery(this).is(':checked')){
cli_user_preference_arr.push(jQuery(this).attr('data-id')+'-yes');
}else{
cli_user_preference_arr.push(jQuery(this).attr('data-id')+'-no');
}});
if(cli_user_preference_arr.length>0){
cli_user_preference_val=Cli_Data.current_lang+'-'+cli_user_preference_arr.join('-');
}
CLI_Cookie.set('cli_user_preference',cli_user_preference_val,CLI_ACCEPT_COOKIE_EXPIRE);
},
isBase64:function(str){
if(str===''||str.trim()===''){ return false; }
try {
return btoa(atob(str))==str;
} catch (err){
return false;
}},
generateConsent:function(){
var preferenceCookie=CLI_Cookie.read(CLI_PREFERNCE_COOKIE);
cliConsent={};
if(preferenceCookie!==null){
if(CLI.isBase64(preferenceCookie)){
cliConsent=window.atob(preferenceCookie);
}else{
cliConsent=decodeURIComponent(preferenceCookie);
}
cliConsent=JSON.parse(cliConsent);
}
cliConsent.ver=Cli_Data.consentVersion;
categories=[];
jQuery('.cli-user-preference-checkbox').each(function(){
categoryVal='';
cli_chkbox_data_id=jQuery(this).attr('data-id');
cli_chkbox_data_id=cli_chkbox_data_id.replace('checkbox-','');
if(jQuery(this).is(':checked')){
categoryVal='true';
}else{
categoryVal='false';
}
cliConsent[cli_chkbox_data_id]=categoryVal;
});
cliConsent=JSON.stringify(cliConsent);
cliConsent=window.btoa(cliConsent);
CLI_Cookie.set(CLI_PREFERNCE_COOKIE,cliConsent,CLI_ACCEPT_COOKIE_EXPIRE);
},
cliRenewConsent:function(){
var preferenceCookie=CLI_Cookie.read(CLI_PREFERNCE_COOKIE);
if(preferenceCookie!==null){
if(CLI.isBase64(preferenceCookie)){
cliConsent=window.atob(preferenceCookie);
}else{
cliConsent=decodeURIComponent(preferenceCookie);
}
cliConsent=JSON.parse(cliConsent);
consentCurrentVersion=parseInt(cliConsent.ver);
consentRenewVersion=parseInt(Cli_Data.consentVersion);
if(typeof(cliConsent.ver)!=='undefined'){
if(cliConsent.ver!==Cli_Data.consentVersion){
CLI_Cookie.erase(CLI_ACCEPT_COOKIE_NAME);
CLI_Cookie.erase(CLI_PREFERNCE_COOKIE);
CLI_Cookie.erase('cli_user_preference');
for(var k in Cli_Data.nn_cookie_ids){
CLI_Cookie.erase(Cli_Data.nn_cookie_ids[k]);
}}
}}
},
reload_current_page:function(){
window.location.reload();
},
add_clear_cache_url_query:function(){
var cli_rand=new Date().getTime()/1000;
var cli_url=window.location.href;
var cli_hash_arr=cli_url.split('#');
var cli_urlparts=cli_hash_arr[0].split('?');
if(cli_urlparts.length>=2){
var cli_url_arr=cli_urlparts[1].split('&');
cli_url_temp_arr=new Array();
for(var cli_i=0; cli_i<cli_url_arr.length; cli_i++){
var cli_temp_url_arr=cli_url_arr[cli_i].split('=');
if(cli_temp_url_arr[0]=='cli_action'){
}else{
cli_url_temp_arr.push(cli_url_arr[cli_i]);
}}
cli_urlparts[1]=cli_url_temp_arr.join('&');
cli_url=cli_urlparts.join('?')+(cli_url_temp_arr.length>0 ? '&': '')+'cli_action=';
}else{
cli_url=cli_hash_arr[0]+'?cli_action=';
}
cli_url+=cli_rand;
if(cli_hash_arr.length>1){
cli_url+='#'+cli_hash_arr[1];
}
return cli_url;
},
closeOnScroll:function(){
if(window.pageYOffset > 100&&!CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)){
if(CLI.settings.accept_all==true){
CLI.enableAllCookies();
}
CLI.accept_close();
CLI.saveLog('accept');
if(CLI.settings.scroll_close_reload===true){
window.location.reload();
}
window.removeEventListener("scroll",CLI.closeOnScroll,false);
}},
displayHeader:function(){
if(this.settings.notify_animate_show){
this.bar_elm.slideDown(this.settings.animate_speed_show);
}else{
this.bar_elm.show();
CLI.refocusElement();
}
this.showagain_elm.hide();
if(CLI_COOKIEBAR_AS_POPUP){
this.showPopupOverlay();
}},
hideHeader:function(){
if(this.settings.showagain_tab){
if(this.settings.notify_animate_show){
this.showagain_elm.slideDown(this.settings.animate_speed_show);
}else{
this.showagain_elm.show();
}}else{
this.showagain_elm.hide();
}
this.bar_elm.slideUp(this.settings.animate_speed_show);
this.hidePopupOverlay();
},
hidePopupOverlay:function(){
jQuery('body').removeClass("cli-barmodal-open");
jQuery(".cli-popupbar-overlay").removeClass("cli-show");
},
showPopupOverlay:function(){
if(this.bar_elm.length){
if(this.settings.popup_overlay){
if(!(this.main_link.hasClass('cli-minimize-bar'))){
jQuery('body').addClass("cli-barmodal-open");
jQuery(".cli-popupbar-overlay").addClass("cli-show");
}}
}},
barAsWidget:function(a){
var cli_elm=this.bar_elm;
cli_elm.attr('data-cli-type','widget');
var cli_win=jQuery(window);
var cli_winh=cli_win.height()-40;
var cli_winw=cli_win.width();
var cli_defw=cli_winw>465 ? 445:cli_winw-60;
cli_elm.css({
'width':cli_defw,'height':'auto','max-height':cli_winh,'overflow':'auto','position':'fixed','box-shadow':'rgba(0,0,0,.5) 0px 5px 10px','box-sizing':'border-box'
});
if(this.settings.widget_position=='left'){
cli_elm.css({
'left':'30px','right':'auto','bottom':'30px','top':'auto'
});
}else{
cli_elm.css({
'left':'auto','right':'30px','bottom':'30px','top':'auto'
});
}
if(a){
this.setResize();
}},
barAsPopUp:function(a){
if(typeof cookie_law_info_bar_as_popup==='function'){
return false;
}
var cli_elm=this.bar_elm;
cli_elm.attr('data-cli-type','popup');
var cli_win=jQuery(window);
var cli_winh=cli_win.height();
var cli_defh=cli_winh > 500 ? 500:cli_winh;
var cli_winw=cli_win.width();
var cli_defw=cli_winw>700 ? 500:cli_winw-20;
cli_elm.css({
'width':cli_defw,'height':'auto','max-height':cli_defh,'bottom':'','top':'50%','left':'50%','transform':'translate(-50%, -50%)','overflow':'auto'
});
if(a){
this.setResize();
}},
setResize:function(){
var resizeTmr=null;
jQuery(window).resize(function(){
clearTimeout(resizeTmr);
resizeTmr=setTimeout(function(){
if(CLI_COOKIEBAR_AS_POPUP){
CLI.barAsPopUp();
}
if(CLI.settings.cookie_bar_as=='widget'){
CLI.barAsWidget();
}
CLI.configShowAgain();
},500);
});
},
isValidHex:function(color){
if(!color||typeof color!=='string') return false;
if(color.substring(0, 1)==='#') color=color.substring(1);
switch(color.length){
case 3: return /^[0-9A-F]{3}$/i.test(color);
case 6: return /^[0-9A-F]{6}$/i.test(color);
case 8: return /^[0-9A-F]{8}$/i.test(color);
default: return false;
}
return false;
},
ColorLuminance:function(hex, lum){
hex=String(hex).replace(/[^0-9a-f]/gi, '');
if(hex.length < 6){
hex=hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];
}
lum=lum||0;
var rgb="#", c, i;
for (i=0; i < 3; i++){
c=parseInt(hex.substr(i*2,2), 16);
c=Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16);
rgb +=("00"+c).substr(c.length);
}
return rgb;
},
rgb2hex:function(rgb){
rgb=rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
return (rgb&&rgb.length===4) ? "#" +
("0" + parseInt(rgb[1],10).toString(16)).slice(-2) +
("0" + parseInt(rgb[2],10).toString(16)).slice(-2) +
("0" + parseInt(rgb[3],10).toString(16)).slice(-2):'';
},
lightOrDark:function(color){
var r, g, b, hsp;
if(color.match(/^rgb/)){
color=color.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);
r=color[1];
g=color[2];
b=color[3];
}else{
color=+("0x" + color.slice(1).replace(color.length < 5&&/./g, '$&$&'));
r=color >> 16;
g=color >> 8 & 255;
b=color & 255;
}
hsp=Math.sqrt(0.299 * (r * r) +
0.587 * (g * g) +
0.114 * (b * b)
);
if(hsp>127.5){
return 'light';
}else{
return 'dark';
}},
barPopupStyle:function(){
var acceptBtn=jQuery('.cli_action_button[data-cli_action=accept]');
var primaryColor=this.settings.button_1_button_colour;
var primaryLinkColor=this.settings.button_1_link_colour;
var barColor=this.settings.background;
var extractedStyle='';
var primaryBtnStyle=this.settings.button_1_style;
Object.keys(primaryBtnStyle).forEach(function(element){
extractedStyle+=primaryBtnStyle[element][0]+':'+primaryBtnStyle[element][1]+';';
});
var shadeColor;
if(!CLI.isValidHex(barColor)){
barColor=CLI.rgb2hex(barColor);
}
if(barColor=="#000000"){
shadeColor='#191919';
}else{
var intensity=CLI.lightOrDark(barColor);
if(intensity=='light'){
shadeColor=CLI.ColorLuminance(barColor, -0.05);
}else{
shadeColor=CLI.ColorLuminance(barColor, 0.4);
}}
jQuery("<style>")
.prop("type", "text/css")
.html("\
#cookie-law-info-bar .cli-switch input:checked + .cli-slider{\
background-color: "+primaryColor+";\
}\
#cookie-law-info-bar  .cli-tab-header{\
background-color: "+shadeColor+"\
}\
#cookie-law-info-bar .cli-switch .cli-slider:before{\
background-color: "+barColor+";\
}\
#cookie-law-info-bar .cli-tab-footer .cli-btn{\
background-color:"+primaryColor+";"+extractedStyle+"\
}\
").appendTo("head");
},
enableAllCookies:function(){
jQuery('.cli-user-preference-checkbox').each(function(){
var cli_chkbox_elm=jQuery(this);
var cli_chkbox_data_id=cli_chkbox_elm.attr('data-id');
if(cli_chkbox_data_id!='checkbox-necessary'){
cli_chkbox_elm.prop('checked',true);
CLI_Cookie.set('cookielawinfo-'+cli_chkbox_data_id,'yes',CLI_ACCEPT_COOKIE_EXPIRE);
}});
},
disableAllCookies:function(){
jQuery('.cli-user-preference-checkbox').each(function(){
var cli_chkbox_elm=jQuery(this);
var cli_chkbox_data_id=cli_chkbox_elm.attr('data-id');
cliCategorySlug=cli_chkbox_data_id.replace('checkbox-','');
if(Cli_Data.strictlyEnabled.indexOf(cliCategorySlug)===-1){
cli_chkbox_elm.prop('checked',false);
CLI_Cookie.set('cookielawinfo-'+cli_chkbox_data_id,'no',CLI_ACCEPT_COOKIE_EXPIRE);
}});
},
privacyReadmore:function(){
var originalHtml='';
Trunc={
addReadmore:function(textBlock){
if(textBlock.html().length > Cli_Data.privacy_length){
jQuery('.cli-privacy-readmore').show();
}else{
jQuery('.cli-privacy-readmore').hide();
}},
truncateText:function(textBlock){
var strippedText=jQuery('<div />').html(textBlock.html());
strippedText.find('table').remove();
textBlock.html(strippedText.html());
currentText=textBlock.text();
if(currentText.trim().length > Cli_Data.privacy_length){
var newStr=currentText.substring(0, Cli_Data.privacy_length);
textBlock.empty().html(newStr).append('...');
}},
replaceText: function(textBlock, original){
return textBlock.html(original);
}};
jQuery('.cli-privacy-content .cli-privacy-content-text').each(function (){
var el=jQuery(this);
clone=el.clone();
originalHtml=clone.html();
Trunc.addReadmore(el);
Trunc.truncateText(el);
});
jQuery(document).on('click keypress','a.cli-privacy-readmore',function(e){
var key=e.which;
e.preventDefault();
if(key===1||key===13){
var currentElement=jQuery(this);
var privacyElement=currentElement.closest('.cli-privacy-overview');
var privacyContent=privacyElement.find('.cli-privacy-content-text');
if(privacyElement.hasClass('cli-collapsed')){
Trunc.truncateText(privacyContent);
privacyElement.removeClass('cli-collapsed');
privacyContent.css('height', '100%');
}else{
privacyElement.addClass('cli-collapsed');
Trunc.replaceText(privacyContent, originalHtml);
}}
});
},
checkCategories:function(){
var cliAllowedCategories=[];
var cli_categories={};
jQuery('.cli-user-preference-checkbox').each(function(){	var status=false;
cli_chkbox_elm=jQuery(this);
cli_chkbox_data_id=cli_chkbox_elm.attr('data-id');
cli_chkbox_data_id=cli_chkbox_data_id.replace('checkbox-','');
cli_chkbox_data_id_trimmed=cli_chkbox_data_id.replace('-','_')
if(jQuery(cli_chkbox_elm).is(':checked')){
status=true;
cliAllowedCategories.push(cli_chkbox_data_id);
}
cli_categories[cli_chkbox_data_id_trimmed]=status;
});
CLI.allowedCategories=cliAllowedCategories;
CLI.consent=cli_categories;
},
cookieLawInfoRunCallBacks:function(){
this.checkCategories();
if(CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)=='yes'){
if("function"==typeof CookieLawInfo_Accept_Callback){
CookieLawInfo_Accept_Callback();
}}
},
addStyleAttribute:function(){
var bar=this.bar_elm;
var styleClass='';
if(jQuery(bar).find('.cli-bar-container').length > 0){
styleClass=jQuery('.cli-bar-container').attr('class');
styleClass=jQuery.trim(styleClass.replace('cli-bar-container',''));
jQuery(bar).attr('data-cli-style',styleClass);
}},
getParameterByName: function(name, url){
if(!url) url=window.location.href;
name=name.replace(/[\[\]]/g, '\\$&');
var regex=new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
results=regex.exec(url);
if(!results) return null;
if(!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
},
acceptPageNavigation: function(){
if(Boolean(this.settings.accept_close_page_navigation)===true&&!CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)){
jQuery(document).on('click','a', function (){
var href=jQuery(this).attr('href');
if(href!==undefined){
CLI.close_header();
}});
}},
refocusElement: function(){
if(this.banner_heading.length > 0){
this.banner_heading.focus();
}else{
this.bar_elm.find('a').first().focus();
}}
}
var cliBlocker =
{
blockingStatus: true,
geoIP: false,
scriptsLoaded: false,
ccpaEnabled:false,
ccpaRegionBased:false,
ccpaApplicable:false,
ccpaBarEnabled: false,
cliShowBar: true ,
isBypassEnabled: CLI.getParameterByName('cli_bypass'),
checkPluginStatus:function(callbackA , callbackB){
cliBlocker.ccpaEnabled=Boolean(Cli_Data.ccpaEnabled);
cliBlocker.ccpaRegionBased=Boolean(Cli_Data.ccpaRegionBased);
cliBlocker.ccpaBarEnabled=Boolean(Cli_Data.ccpaBarEnabled);
if(cliBlocker.ccpaEnabled===true){
cliBlocker.ccpaApplicable=true;
if(Cli_Data.ccpaType==='ccpa'){
cliBlocker.blockingStatus=false;
cliBlocker.cliShowBar=false;
if(cliBlocker.ccpaBarEnabled===true){
cliBlocker.cliShowBar=true;
cliBlocker.blockingStatus=true;
}}
}
if(Cli_Data.geoIP==='enabled'||(cliBlocker.ccpaEnabled===true&&cliBlocker.ccpaRegionBased===true) ){
if(Boolean(Cli_Data.use_custom_geolocation_api)===true){
cliBlocker.tryCustomGeoLocationService(callbackA, callbackB);
}else{
jQuery.getJSON('https://ipapi.co/json/', function(data){
cliBlocker.geolocationHandler(data, callbackA, callbackB);
}).fail(function(){
cliBlocker.tryCustomGeoLocationService(callbackA, callbackB);
});
}}else{
if(cliBlocker.isBypassEnabled==="1"){
cliBlocker.blockingStatus=false;
}
callbackA();
callbackB();
}},
tryCustomGeoLocationService: function(callbackA, callbackB){
jQuery.getJSON(Cli_Data.custom_geolocation_api, function(data){
cliBlocker.geolocationHandler(data, callbackA, callbackB);
});
},
geolocationHandler:function(data, callbackA, callbackB){
var euCountries=Cli_Data.eu_countries;
if((data.in_eu===false)&&(euCountries.indexOf(data.country)===-1)){
if(Cli_Data.geoIP==='enabled'){
cliBlocker.blockingStatus=false;
cliBlocker.cliShowBar=false;
}else{
if(Cli_Data.ccpaType!=='ccpa'){
cliBlocker.blockingStatus=true;
cliBlocker.cliShowBar=true;
}}
}else{
jQuery('body').addClass('wt-cli-geoip-on wt-cli-eu-country');
}
if(cliBlocker.ccpaEnabled===true){
if(cliBlocker.ccpaRegionBased===true&&data.region_code!=='CA'){
cliBlocker.ccpaApplicable=false;
if(Cli_Data.ccpaType==='ccpa'){
cliBlocker.cliShowBar=false;
cliBlocker.blockingStatus=false;
}
jQuery('.wt-cli-ccpa-opt-out,.wt-cli-ccpa-checkbox,.wt-cli-ccpa-element').remove();
}else{
cliBlocker.ccpaApplicable=true;
if(cliBlocker.ccpaBarEnabled===true){
cliBlocker.cliShowBar=true;
}}
}
if(cliBlocker.blockingStatus===false){
if("function"==typeof CookieLawInfo_Accept_Callback){
CookieLawInfo_Accept_Callback();
}
jQuery('body').addClass('wt-cli-geoip-on wt-cli-non-eu-country');
CLI.hidePopupOverlay();
if(cliBlocker.ccpaApplicable!==true){
cliBlocker.removeAllPreferenceCookies();
jQuery('.wt-cli-geoip-on.wt-cli-non-eu-country').find('.wt-cli-element').remove();
}}
callbackA();
callbackB();
},
cookieBar: function(){
if(cliBlocker.cliShowBar===false){
jQuery('.wt-cli-cookie-bar-container').remove();
}else{
jQuery('.wt-cli-cookie-bar-container').show();
if(!CLI_Cookie.exists(CLI_ACCEPT_COOKIE_NAME)){
CLI.displayHeader();
}else{
CLI.hideHeader();
}}
},
removeAllPreferenceCookies:function(){
cliPreferenceCookies=Cli_Data.cookielist;
for (var key in cliPreferenceCookies){
CLI_Cookie.erase('cookielawinfo-checkbox-'+key);
}},
removeCookieByCategory:function(){
if(cliBlocker.blockingStatus===true){
if(CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)!==null){
var non_necessary_cookies=Cli_Data.non_necessary_cookies;
for (var key in non_necessary_cookies){
currentCategory=key;
if(CLI.allowedCategories.indexOf(currentCategory)===-1){
var nonNecessaryCookies=non_necessary_cookies[currentCategory];
for(var i=0; i < nonNecessaryCookies.length; i++){
if(CLI_Cookie.read(nonNecessaryCookies[i])!==null){
CLI_Cookie.erase(nonNecessaryCookies[i]);
}}
}}
}}
},
runScripts:function(){
srcReplaceableElms=['iframe','IFRAME','EMBED','embed','OBJECT','object','IMG','img','SOURCE','source'];
var genericFuncs =
{
renderByElement: function(callback){
cliScriptFuncs.renderScripts();
cliHtmlElmFuncs.renderSrcElement();
callback();
cliBlocker.scriptsLoaded=true;
},
reviewConsent:function(){
jQuery(document).on('click','.cli_manage_current_consent,.wt-cli-manage-consent-link',function(){
CLI.bar_elm.slideDown(CLI.settings.animate_speed_show);
});
}};
var cliScriptFuncs =
{
scriptsDone:function(){
if(Boolean(Cli_Data.triggerDomRefresh)===true){
var DOMContentLoadedEvent=document.createEvent('Event')
DOMContentLoadedEvent.initEvent('DOMContentLoaded', true, true)
window.document.dispatchEvent(DOMContentLoadedEvent)
}},
seq :function(arr, callback, index){
if(typeof index==='undefined'){
index=0
}
arr[index](function (){
index++
if(index===arr.length){
callback()
}else{
cliScriptFuncs.seq(arr, callback, index)
}})
},
insertScript:function($script,callback){
var s='';
var allowedAttributes=[
'data-cli-class',
'data-cli-label',
'data-cli-placeholder',
'data-cli-script-type',
'data-cli-src'
];
var scriptType=$script.getAttribute('data-cli-script-type');
var elementPosition=$script.getAttribute('data-cli-element-position');
var isBlock=$script.getAttribute('data-cli-block');
var blockIfCCPA=$script.getAttribute('data-cli-block-if-ccpa-optout');
var s=document.createElement('script');
var ccpaOptedOut=cliBlocker.ccpaOptedOut();
s.type='text/plain';
if($script.async){
s.async=$script.async;
}
if($script.defer){
s.defer=$script.defer;
}
if($script.src){
s.onload=callback
s.onerror=callback
s.src=$script.src
}else{
s.textContent=$script.innerText
}
if($script.hasAttribute('data-cli-id')){
s.id=$script.getAttribute('data-cli-id');
}
var attrs=jQuery($script).prop("attributes");
for (var ii=0; ii < attrs.length; ++ii){
if(attrs[ii].nodeName!=='id'){
s.setAttribute(attrs[ii].nodeName,attrs[ii].value);
}}
if(cliBlocker.blockingStatus===true){
if((CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)=='yes'&&CLI.allowedCategories.indexOf(scriptType)!==-1)||(CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)==null&&isBlock==='false')){
s.setAttribute('data-cli-consent','accepted');
s.type='text/javascript';
}
if(Cli_Data.ccpaType==='ccpa'&&blockIfCCPA!=='true'){
s.type='text/javascript';
}}else{
s.type='text/javascript';
}
if(cliBlocker.ccpaApplicable===true&&blockIfCCPA==='true'){
if(ccpaOptedOut===true||CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)==null){
s.type='text/plain';
}}
if($script.type!=s.type){
$script.parentNode.insertBefore(s,$script);
if(!$script.src){
callback()
}
$script.parentNode.removeChild($script);
}else{
callback();
}},
renderScripts:function(){
var $scripts=document.querySelectorAll('script[data-cli-class="cli-blocker-script"]');
if($scripts.length > 0){
var runList=[]
var typeAttr
Array.prototype.forEach.call($scripts, function ($script){
typeAttr=$script.getAttribute('type')
var elmType=$script.tagName;
runList.push(function (callback){
cliScriptFuncs.insertScript($script, callback)
})
})
cliScriptFuncs.seq(runList, cliScriptFuncs.scriptsDone);
}}
};
var cliHtmlElmFuncs={
renderSrcElement: function(){
var blockingElms=document.querySelectorAll('[data-cli-class="cli-blocker-script"]');
var ccpaOptedOut=cliBlocker.ccpaOptedOut();
for (var i=0; i < blockingElms.length; i++){
var currentElm=blockingElms[i];
var elmType=currentElm.tagName;
if(srcReplaceableElms.indexOf(elmType)!==-1){
var elmCategory=currentElm.getAttribute('data-cli-script-type');
var isBlock=currentElm.getAttribute('data-cli-block');
var blockIfCCPA=currentElm.getAttribute('data-cli-block-if-ccpa-optout');
if(cliBlocker.blockingStatus===true){
if((CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)=='yes'&&CLI.allowedCategories.indexOf(elmCategory)!==-1)||(CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)==null&&isBlock==='false')){
if(cliBlocker.ccpaApplicable==true&&blockIfCCPA==='true'&&ccpaOptedOut===true){
this.addPlaceholder(currentElm);
}else{
this.replaceSrc(currentElm);
}}else{
if(Cli_Data.ccpaType==='ccpa'&&blockIfCCPA!=='true'){
this.replaceSrc(currentElm);
}else{
this.addPlaceholder(currentElm);
}}
}else{
if(cliBlocker.ccpaApplicable==true&&blockIfCCPA==='true'){
if(ccpaOptedOut===true||CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)==null){
this.addPlaceholder(currentElm);
}else{
this.replaceSrc(currentElm);
}}else{
this.replaceSrc(currentElm);
}}
}}
},
addPlaceholder:function(htmlElm){
if(jQuery(htmlElm).prev('.wt-cli-iframe-placeholder').length===0){
var htmlElemName=htmlElm.getAttribute('data-cli-label');
var htmlElemType=htmlElm.getAttribute('data-cli-placeholder');
var htmlElemWidth=htmlElm.getAttribute('width');
var htmlElemHeight=htmlElm.getAttribute('height');
if(htmlElemWidth==null){
htmlElemWidth=htmlElm.offsetWidth;
}
if(htmlElemHeight==null){
htmlElemHeight=htmlElm.offsetHeight;
}
pixelPattern=/px/;
htmlElemWidth=((pixelPattern.test(htmlElemWidth)) ? htmlElemWidth:htmlElemWidth+'px');
htmlElemHeight=((pixelPattern.test(htmlElemHeight)) ? htmlElemHeight:htmlElemHeight+'px');
var addPlaceholder='<div style="width:'+htmlElemWidth+'; height:'+htmlElemHeight+';" class="wt-cli-iframe-placeholder"><div class="wt-cli-inner-text">'+htmlElemType+'</div></div>';
addPlaceholder.width=htmlElemWidth;
addPlaceholder.height=htmlElemHeight;
if(htmlElm.tagName!=='IMG'){
jQuery(addPlaceholder).insertBefore(htmlElm);
}
htmlElm.removeAttribute('src');
htmlElm.style.display='none';
}},
replaceSrc: function(htmlElm){
if(!htmlElm.hasAttribute('src')){
var htmlElemSrc=htmlElm.getAttribute('data-cli-src');
htmlElm.setAttribute('src',htmlElemSrc);
if(jQuery(htmlElm).prev('.wt-cli-iframe-placeholder').length > 0){
jQuery(htmlElm).prev('.wt-cli-iframe-placeholder').remove();
}
htmlElm.style.display='block';
}}
};
genericFuncs.reviewConsent();
genericFuncs.renderByElement(cliBlocker.removeCookieByCategory);
},
ccpaOptedOut: function (){
var ccpaOptedOut=false;
var preferenceCookie=CLI_Cookie.read(CLI_PREFERNCE_COOKIE);
if(preferenceCookie!==null){
if(CLI.isBase64(preferenceCookie)){
cliConsent=window.atob(preferenceCookie);
}else{
cliConsent=decodeURIComponent(preferenceCookie);
}
cliConsent=JSON.parse(cliConsent);
if(typeof cliConsent.ccpaOptout!=='undefined'){
ccpaOptedOut=cliConsent.ccpaOptout;
}}
return ccpaOptedOut;
}}
jQuery(document).ready(function(){
if(typeof cli_cookiebar_settings!='undefined'){
CLI.set({
settings:cli_cookiebar_settings
});
cliBlocker.checkPluginStatus(cliBlocker.cookieBar,cliBlocker.runScripts);
}else{
var data={
action: 'cli_get_settings_json',
};
jQuery.ajax({
url: Cli_Data.ajax_url,
data: data,
dataType: 'json',
type: 'GET',
success: function (response){
CLI.set({
settings:response
});
cliBlocker.checkPluginStatus(cliBlocker.cookieBar,cliBlocker.runScripts);
}});
}});
!function(o){var t={url:!1,callback:!1,target:!1,duration:120,on:"mouseover",touch:!0,onZoomIn:!1,onZoomOut:!1,magnify:1};o.zoom=function(t,e,n,i){var u,a,c,r,l,m,f,s=o(t),h=s.css("position"),d=o(e);return t.style.position=/(absolute|fixed)/.test(h)?h:"relative",t.style.overflow="hidden",n.style.width=n.style.height="",o(n).addClass("zoomImg").css({position:"absolute",top:0,left:0,opacity:0,width:n.width*i,height:n.height*i,border:"none",maxWidth:"none",maxHeight:"none"}).appendTo(t),{init:function(){a=s.outerWidth(),u=s.outerHeight(),e===t?(r=a,c=u):(r=d.outerWidth(),c=d.outerHeight()),l=(n.width-a)/r,m=(n.height-u)/c,f=d.offset()},move:function(o){var t=o.pageX-f.left,e=o.pageY-f.top;e=Math.max(Math.min(e,c),0),t=Math.max(Math.min(t,r),0),n.style.left=t*-l+"px",n.style.top=e*-m+"px"}}},o.fn.zoom=function(e){return this.each(function(){var n=o.extend({},t,e||{}),i=n.target&&o(n.target)[0]||this,u=this,a=o(u),c=document.createElement("img"),r=o(c),l="mousemove.zoom",m=!1,f=!1;if(!n.url){var s=u.querySelector("img");if(s&&(n.url=s.getAttribute("data-src")||s.currentSrc||s.src,n.alt=s.getAttribute("data-alt")||s.alt),!n.url)return}a.one("zoom.destroy",function(o,t){a.off(".zoom"),i.style.position=o,i.style.overflow=t,c.onload=null,r.remove()}.bind(this,i.style.position,i.style.overflow)),c.onload=function(){var t=o.zoom(i,u,c,n.magnify);function e(e){t.init(),t.move(e),r.stop().fadeTo(o.support.opacity?n.duration:0,1,"function"==typeof n.onZoomIn&&n.onZoomIn.call(c))}function s(){r.stop().fadeTo(n.duration,0,"function"==typeof n.onZoomOut&&n.onZoomOut.call(c))}"grab"===n.on?a.on("mousedown.zoom",function(n){1===n.which&&(o(document).one("mouseup.zoom",function(){s(),o(document).off(l,t.move)}),e(n),o(document).on(l,t.move),n.preventDefault())}):"click"===n.on?a.on("click.zoom",function(n){return m?void 0:(m=!0,e(n),o(document).on(l,t.move),o(document).one("click.zoom",function(){s(),m=!1,o(document).off(l,t.move)}),!1)}):"toggle"===n.on?a.on("click.zoom",function(o){m?s():e(o),m=!m}):"mouseover"===n.on&&(t.init(),a.on("mouseenter.zoom",e).on("mouseleave.zoom",s).on(l,t.move)),n.touch&&a.on("touchstart.zoom",function(o){o.preventDefault(),f?(f=!1,s()):(f=!0,e(o.originalEvent.touches[0]||o.originalEvent.changedTouches[0]))}).on("touchmove.zoom",function(o){o.preventDefault(),t.move(o.originalEvent.touches[0]||o.originalEvent.changedTouches[0])}).on("touchend.zoom",function(o){o.preventDefault(),f&&(f=!1,s())}),"function"==typeof n.callback&&n.callback.call(c)},c.setAttribute("role","presentation"),c.alt=n.alt||"",c.src=n.url})},o.fn.zoom.defaults=t}(window.jQuery);
jQuery(function(t){if("undefined"==typeof wc_single_product_params)return!1;t("body").on("init",".wc-tabs-wrapper, .woocommerce-tabs",function(){t(this).find(".wc-tab, .woocommerce-tabs .panel:not(.panel .panel)").hide();var e=window.location.hash,i=window.location.href,o=t(this).find(".wc-tabs, ul.tabs").first();e.toLowerCase().indexOf("comment-")>=0||"#reviews"===e||"#tab-reviews"===e?o.find("li.reviews_tab a").trigger("click"):i.indexOf("comment-page-")>0||i.indexOf("cpage=")>0?o.find("li.reviews_tab a").trigger("click"):"#tab-additional_information"===e?o.find("li.additional_information_tab a").trigger("click"):o.find("li:first a").trigger("click")}).on("click",".wc-tabs li a, ul.tabs li a",function(e){e.preventDefault();var i=t(this),o=i.closest(".wc-tabs-wrapper, .woocommerce-tabs"),a=o.find(".wc-tabs, ul.tabs");a.find("li").removeClass("active"),a.find('a[role="tab"]').attr("aria-selected","false").attr("tabindex","-1"),o.find(".wc-tab, .panel:not(.panel .panel)").hide(),i.closest("li").addClass("active"),i.attr("aria-selected","true").attr("tabindex","0"),o.find("#"+i.attr("href").split("#")[1]).show()}).on("keydown",".wc-tabs li a, ul.tabs li a",function(e){var i="rtl"===document.documentElement.dir,o=e.key,a=i?"ArrowLeft":"ArrowRight",r=i?"ArrowRight":"ArrowLeft",n="ArrowDown",s="ArrowUp",l="Home",c="End";if([a,r,n,s,c,l].includes(o)){var d=t(this),p=d.closest(".wc-tabs-wrapper, .woocommerce-tabs").find(".wc-tabs, ul.tabs").find('a[role="tab"]'),h=p.length-1,g=p.index(d),u=o===r||o===s?g-1:g+1,m="horizontal";if(p.length>=2){var _=p[0].getBoundingClientRect(),f=p[1].getBoundingClientRect();m=Math.abs(f.top-_.top)>Math.abs(f.left-_.left)?"vertical":"horizontal"}("vertical"!==m||o!==r&&o!==a)&&("horizontal"!==m||o!==s&&o!==n)&&(e.preventDefault(),o===r&&0===g&&"horizontal"===m||o===s&&0===g&&"vertical"===m||o===c?u=h:(a===o&&g===h&&"horizontal"===m||n===o&&g===h&&"vertical"===m||o===l)&&(u=0),p.eq(u).focus())}}).on("click","a.woocommerce-review-link",function(){return t(".reviews_tab a").trigger("click"),!0}).on("init","#rating",function(){t(this).hide().before('<p class="stars">\t\t\t\t\t\t<span role="group" aria-labelledby="comment-form-rating-label">\t\t\t\t\t\t\t<a role="radio" tabindex="0" aria-checked="false" class="star-1" href="#">'+wc_single_product_params.i18n_rating_options[0]+'</a>\t\t\t\t\t\t\t<a role="radio" tabindex="-1" aria-checked="false" class="star-2" href="#">'+wc_single_product_params.i18n_rating_options[1]+'</a>\t\t\t\t\t\t\t<a role="radio" tabindex="-1" aria-checked="false" class="star-3" href="#">'+wc_single_product_params.i18n_rating_options[2]+'</a>\t\t\t\t\t\t\t<a role="radio" tabindex="-1" aria-checked="false" class="star-4" href="#">'+wc_single_product_params.i18n_rating_options[3]+'</a>\t\t\t\t\t\t\t<a role="radio" tabindex="-1" aria-checked="false" class="star-5" href="#">'+wc_single_product_params.i18n_rating_options[4]+"</a>\t\t\t\t\t\t</span>\t\t\t\t\t</p>")}).on("click","#respond p.stars a",function(){var e=t(this),i=e.closest("p.stars").find("a").index(e)+1,o=t(this).closest("#respond").find("#rating"),a=t(this).closest(".stars");return o.val(i),e.siblings("a").removeClass("active").attr("aria-checked","false").attr("tabindex","-1"),e.addClass("active").attr("aria-checked","true").attr("tabindex","0"),a.addClass("selected"),!1}).on("click","#respond #submit",function(){var e=t(this).closest("#respond").find("#rating"),i=e.val();if(e.length>0&&!i&&"yes"===wc_single_product_params.review_rating_required)return window.alert(wc_single_product_params.i18n_required_rating_text),!1}).on("keyup",".wc-tabs li a, ul.tabs li a, #respond p.stars a",function(e){var i=e.key,o=["ArrowRight","ArrowDown"];o.concat(["ArrowLeft","ArrowUp"]).includes(i)&&(e.preventDefault(),e.stopPropagation(),o.includes(i)?t(this).next().focus().click():t(this).prev().focus().click())}),t(".wc-tabs-wrapper, .woocommerce-tabs, #rating").trigger("init");var e=function(e,i){this.$target=e,this.$images=t(".woocommerce-product-gallery__image",e),0!==this.$images.length?(e.data("product_gallery",this),this.flexslider_enabled="function"==typeof t.fn.flexslider&&wc_single_product_params.flexslider_enabled,this.zoom_enabled="function"==typeof t.fn.zoom&&wc_single_product_params.zoom_enabled,this.photoswipe_enabled="undefined"!=typeof PhotoSwipe&&wc_single_product_params.photoswipe_enabled,i&&(this.flexslider_enabled=!1!==i.flexslider_enabled&&this.flexslider_enabled,this.zoom_enabled=!1!==i.zoom_enabled&&this.zoom_enabled,this.photoswipe_enabled=!1!==i.photoswipe_enabled&&this.photoswipe_enabled),1===this.$images.length&&(this.flexslider_enabled=!1),this.initFlexslider=this.initFlexslider.bind(this),this.initZoom=this.initZoom.bind(this),this.initZoomForTarget=this.initZoomForTarget.bind(this),this.initPhotoswipe=this.initPhotoswipe.bind(this),this.onResetSlidePosition=this.onResetSlidePosition.bind(this),this.getGalleryItems=this.getGalleryItems.bind(this),this.openPhotoswipe=this.openPhotoswipe.bind(this),this.trapFocusPhotoswipe=this.trapFocusPhotoswipe.bind(this),this.handlePswpTrapFocus=this.handlePswpTrapFocus.bind(this),this.flexslider_enabled?(this.initFlexslider(i.flexslider),e.on("woocommerce_gallery_reset_slide_position",this.onResetSlidePosition)):this.$target.css("opacity",1),this.zoom_enabled&&(this.initZoom(),e.on("woocommerce_gallery_init_zoom",this.initZoom)),this.photoswipe_enabled&&this.initPhotoswipe()):this.$target.css("opacity",1)};e.prototype.initFlexslider=function(e){var i=this.$target,o=this,a=t.extend({selector:".woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image",start:function(){i.css("opacity",1)},after:function(t){o.initZoomForTarget(o.$images.eq(t.currentSlide))}},e);i.flexslider(a),t(".woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image:eq(0) .wp-post-image").one("load",function(){var e=t(this);e&&setTimeout(function(){var t=e.closest(".woocommerce-product-gallery__image").height(),i=e.closest(".flex-viewport");t&&i&&i.height(t)},100)}).each(function(){this.complete&&t(this).trigger("load")})},e.prototype.initZoom=function(){"complete"===document.readyState?this.initZoomForTarget(this.$images.first()):t(window).on("load",()=>{this.initZoomForTarget(this.$images.first())})},e.prototype.initZoomForTarget=function(e){if(!this.zoom_enabled)return!1;var i=this.$target.width(),o=!1;if(t(e).each(function(e,a){if(t(a).find("img").data("large_image_width")>i)return o=!0,!1}),o){var a=t.extend({touch:!1,callback:function(){var t=this;setTimeout(function(){t.removeAttribute("role"),t.setAttribute("alt",""),t.setAttribute("aria-hidden","true")},100)}},wc_single_product_params.zoom_options);"ontouchstart"in document.documentElement&&(a.on="click"),e.trigger("zoom.destroy"),e.zoom(a),setTimeout(function(){e.find(":hover").length&&e.trigger("mouseover")},100)}},e.prototype.initPhotoswipe=function(){this.zoom_enabled&&this.$images.length>0?(this.$target.prepend('<a href="#" role="button" class="woocommerce-product-gallery__trigger" aria-haspopup="dialog" aria-controls="photoswipe-fullscreen-dialog" aria-label="'+wc_single_product_params.i18n_product_gallery_trigger_text+'"><span aria-hidden="true">🔍</span></a>'),this.$target.on("click",".woocommerce-product-gallery__trigger",this.openPhotoswipe),this.$target.on("keydown",".woocommerce-product-gallery__trigger",t=>{" "===t.key&&this.openPhotoswipe(t)}),this.$target.on("click",".woocommerce-product-gallery__image a",function(t){t.preventDefault()}),this.flexslider_enabled||this.$target.on("click",".woocommerce-product-gallery__image a",this.openPhotoswipe)):this.$target.on("click",".woocommerce-product-gallery__image a",this.openPhotoswipe)},e.prototype.onResetSlidePosition=function(){this.$target.flexslider(0)},e.prototype.getGalleryItems=function(){var e=this.$images,i=[];return e.length>0&&e.each(function(e,o){var a=t(o).find("img");if(a.length){var r=a.attr("data-large_image"),n=a.attr("data-large_image_width"),s=a.attr("data-large_image_height"),l={alt:a.attr("alt"),src:r,w:n,h:s,title:a.attr("data-caption")?a.attr("data-caption"):a.attr("title")};i.push(l)}}),i},e.prototype.openPhotoswipe=function(e){e.preventDefault();var i,o=t(".pswp")[0],a=this.getGalleryItems(),r=t(e.target),n=e.currentTarget,s=this;i=0<r.closest(".woocommerce-product-gallery__trigger").length?this.$target.find(".flex-active-slide"):r.closest(".woocommerce-product-gallery__image");var l=t.extend({index:t(i).index(),addCaptionHTMLFn:function(t,e){return t.title?(e.children[0].textContent=t.title,!0):(e.children[0].textContent="",!1)},timeToIdle:0},wc_single_product_params.photoswipe_options),c=new PhotoSwipe(o,PhotoSwipeUI_Default,a,l);c.listen("afterInit",function(){s.trapFocusPhotoswipe(!0)}),c.listen("close",function(){s.trapFocusPhotoswipe(!1),n.focus()}),c.init()},e.prototype.trapFocusPhotoswipe=function(t){var e=document.querySelector(".pswp");e&&(t?e.addEventListener("keydown",this.handlePswpTrapFocus):e.removeEventListener("keydown",this.handlePswpTrapFocus))},e.prototype.handlePswpTrapFocus=function(t){var e=t.currentTarget.querySelectorAll("button:not([disabled])"),i=Array.from(e).filter(function(t){return"none"!==t.style.display&&"none"!==window.getComputedStyle(t).display});if(!(1>=i.length)){var o=i[0],a=i[i.length-1];"Tab"===t.key&&(t.shiftKey?document.activeElement===o&&(t.preventDefault(),a.focus()):document.activeElement===a&&(t.preventDefault(),o.focus()))}},t.fn.wc_product_gallery=function(t){return new e(this,t||wc_single_product_params),this},t(".woocommerce-product-gallery").each(function(){t(this).trigger("wc-product-gallery-before-init",[this,wc_single_product_params]),t(this).wc_product_gallery(wc_single_product_params),t(this).trigger("wc-product-gallery-after-init",[this,wc_single_product_params])})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self,function(){var n=e.Cookies,o=e.Cookies=t();o.noConflict=function(){return e.Cookies=n,o}}())}(this,function(){"use strict";function e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}return function t(n,o){function r(t,r,i){if("undefined"!=typeof document){"number"==typeof(i=e({},o,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var u in i)i[u]&&(c+="; "+u,!0!==i[u]&&(c+="="+i[u].split(";")[0]));return document.cookie=t+"="+n.write(r,t)+c}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],o={},r=0;r<t.length;r++){var i=t[r].split("="),c=i.slice(1).join("=");try{var u=decodeURIComponent(i[0]);if(o[u]=n.read(c,u),e===u)break}catch(f){}}return e?o[e]:o}},remove:function(t,n){r(t,"",e({},n,{expires:-1}))},withAttributes:function(n){return t(this.converter,e({},this.attributes,n))},withConverter:function(n){return t(e({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(n)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"})});
function on_keydown_remove_from_cart(e){" "===e.key&&(e.preventDefault(),e.currentTarget.click())}function focus_populate_live_region(){var e=["woocommerce-message","woocommerce-error","wc-block-components-notice-banner"].map(function(e){return"."+e+'[role="alert"]'}).join(", "),o=document.querySelectorAll(e);if(0!==o.length){var t=o[0];t.setAttribute("tabindex","-1");var n=setTimeout(function(){t.focus(),clearTimeout(n)},500)}}function refresh_sorted_by_live_region(){var e=document.querySelector(".woocommerce-result-count");if(e){var o=e.innerHTML;e.setAttribute("aria-hidden","true");var t=setTimeout(function(){e.setAttribute("aria-hidden","false"),e.innerHTML="",e.innerHTML=o,clearTimeout(t)},2e3)}}function on_document_ready(){focus_populate_live_region(),refresh_sorted_by_live_region()}jQuery(function(e){e(".woocommerce-ordering").on("change","select.orderby",function(){e(this).closest("form").trigger("submit")}),e("input.qty:not(.product-quantity input.qty)").each(function(){var o=parseFloat(e(this).attr("min"));o>=0&&parseFloat(e(this).val())<o&&e(this).val(o)});var o="store_notice"+(e(".woocommerce-store-notice").data("noticeId")||"");if("hidden"===Cookies.get(o))e(".woocommerce-store-notice").hide();else{function t(o){["Enter"," "].includes(o.key)&&(o.preventDefault(),e(".woocommerce-store-notice__dismiss-link").click())}e(".woocommerce-store-notice").show(),e(".woocommerce-store-notice__dismiss-link").on("click",function n(r){Cookies.set(o,"hidden",{path:"/"}),e(".woocommerce-store-notice").hide(),r.preventDefault(),e(".woocommerce-store-notice__dismiss-link").off("click",n).off("keydown",t)}).on("keydown",t)}e(".woocommerce-input-wrapper span.description").length&&e(document.body).on("click",function(){e(".woocommerce-input-wrapper span.description:visible").prop("aria-hidden",!0).slideUp(250)}),e(".woocommerce-input-wrapper").on("click",function(e){e.stopPropagation()}),e(".woocommerce-input-wrapper :input").on("keydown",function(o){var t=e(this).parent().find("span.description");if(27===o.which&&t.length&&t.is(":visible"))return t.prop("aria-hidden",!0).slideUp(250),o.preventDefault(),!1}).on("click focus",function(){var o=e(this).parent(),t=o.find("span.description");o.addClass("currentTarget"),e(".woocommerce-input-wrapper:not(.currentTarget) span.description:visible").prop("aria-hidden",!0).slideUp(250),t.length&&t.is(":hidden")&&t.prop("aria-hidden",!1).slideDown(250),o.removeClass("currentTarget")}),e.scroll_to_notices=function(o){o.length&&e("html, body").animate({scrollTop:o.offset().top-100},1e3)},e('.woocommerce form .woocommerce-Input[type="password"]').wrap('<span class="password-input"></span>'),e(".woocommerce form input").filter(":password").parent("span").addClass("password-input"),e(".password-input").each(function(){const o=e(this).find("input").attr("id");e(this).append('<button type="button" class="show-password-input" aria-label="'+woocommerce_params.i18n_password_show+'" aria-describedBy="'+o+'"></button>')}),e(".show-password-input").on("click",function(o){o.preventDefault(),e(this).hasClass("display-password")?(e(this).removeClass("display-password"),e(this).attr("aria-label",woocommerce_params.i18n_password_show)):(e(this).addClass("display-password"),e(this).attr("aria-label",woocommerce_params.i18n_password_hide)),e(this).hasClass("display-password")?e(this).siblings(['input[type="password"]']).prop("type","text"):e(this).siblings('input[type="text"]').prop("type","password"),e(this).siblings("input").focus()}),e("a.coming-soon-footer-banner-dismiss").on("click",function(o){var t=e(o.target);e.ajax({type:"post",url:t.data("rest-url"),data:{woocommerce_meta:{coming_soon_banner_dismissed:"yes"}},beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",t.data("rest-nonce"))},complete:function(){e("#coming-soon-footer-banner").hide()}})}),"undefined"==typeof wc_add_to_cart_params&&e(document.body).on("keydown",".remove_from_cart_button",on_keydown_remove_from_cart),e(document.body).on("item_removed_from_classic_cart updated_wc_div",focus_populate_live_region)}),document.addEventListener("DOMContentLoaded",on_document_ready);
(function($,window){"use strict";$.extend({replaceTag:function(element,tagName,withDataAndEvents,deepWithDataAndEvents){var newTag=$("<"+tagName+">")[0];$.each(element.attributes,function(){newTag.setAttribute(this.name,this.value)});$(element).children().clone(withDataAndEvents,deepWithDataAndEvents).appendTo(newTag);return newTag}});$.fn.extend({replaceTag:function(tagName,withDataAndEvents,deepWithDataAndEvents){return this.map(function(){return jQuery.replaceTag(this,tagName,withDataAndEvents,deepWithDataAndEvents)})}});$.xt_woovs_variation_form=function(form,options){var self=this;self.events={};self.$form=$(form);self.form=form;self.is_ajax=!!self.$form.data("ajax");if(self.$form.hasClass("xt_woovs-support")){return self.$form.data("xt-woovs")}setTimeout(function(){var currentEvents=self.$form.data("events");if(self.is_ajax||currentEvents&&typeof currentEvents.found_variation==="undefined"){self.$form.wc_variation_form()}},1e3);self.is_touch=XT.isTouchDevice();self.options=$.extend({},$.xt_woovs_variation_form.defaultOptions,options);self.product_id=self.$form.data("product_id");self.$product=self.$form.closest(".product");self.$swatches_wrap=self.$form.find(".xt_woovs-swatches-wrap");self.$swatches=self.$swatches_wrap.find(".xt_woovs-swatches");self.is_single_product=!self.is_archive_product;self.is_archive_product=self.$form.hasClass("xt_woovs-archives-product");self.is_catalog_mode=self.is_archive_product&&!!XT_WOOVS.catalog_mode;self.select_options_button=self.$product.find(".xt_woovs_select_options_button");self.add_to_cart_button=self.$product.find(".single_add_to_cart_button");self.on_demand=self.$form.closest(".xt_woovs-on-demand");self.on_demand_display_type=self.on_demand.length?self.on_demand.data("display"):null;self.on_demand_visibility_type=self.on_demand.length?self.on_demand.data("visibility"):null;self.on_demand_trigger=self.on_demand.length?self.select_options_button:null;self.on_demand_backlayer=self.$product.find(".xt_woovs-display-backlayer");self.on_demand_preview=self.$product.find(".xt_woovs-on-demand-preview");self.trigger_on_hover=self.is_catalog_mode&&!!XT_WOOVS.catalog_mode_hover;self.on_demand_close_btn=self.on_demand.find("> span > span");self.on_demand_active=false;self.original_price=self.$product.find(".price").first().html();self.price_selector=self.is_archive_product?".price":".summary .price";self.product_variations=self.$form.data("product_variations");self.is_ajax_variation=!self.product_variations;self.enable_deselect=!self.trigger_on_hover&&self.$swatches_wrap.hasClass("xt_woovs-enable-deselect");self.auto_select=self.$swatches_wrap.hasClass("xt_woovs-auto-select");self.auto_select_on_select=self.$swatches_wrap.hasClass("xt_woovs-auto-select-on-select");self.disabled_clickable=self.$swatches_wrap.hasClass("xt_woovs-disabled-clickable");self.tooltip_enabled=false;self.init=function(){self.fixSingleProductPriceDisplay();self.resetEvents();self.initEvents();setTimeout(function(){if(self.auto_select){self.autoSelectFirstAvailable()}self.$form.trigger("reload_product_variations");self.$form.find(":input").trigger("change");self.$form.trigger("xt_woovs_loaded",[self]);$(document).trigger("xt_woovs_loaded",[self.$form]);self.$form.data("xt-woovs",self);self.$form.addClass("xt_woovs-support")},1)};self.fixSingleProductPriceDisplay=function(){if(self.is_single_product){var $price=self.$product.find(".summary .price").first();var is_variation_price=$price.closest(".woocommerce-variation-price").length>0;if($price.length&&!is_variation_price){self.$form.addClass("xt_woovs-hide-variation-price")}}};self.setCurrentValueLabel=function($el,value){var attributeRow=$el.closest("tr");var currentValueEl=attributeRow.find("td.label .xt_woovs-attribute-value");var valueEl=$('<span class="xt_woovs-attribute-value">'+value+"</span>");if(attributeRow.length){if(currentValueEl.length){currentValueEl.remove()}attributeRow.find("td.label").append(valueEl)}};self.autoSelectAttributes=function(force){force=typeof force!=="undefined";if(!force&&!self.auto_select_on_select){return}setTimeout(function(){self.$swatches.each(function(){var has_selected=$(this).find(".xt_woovs-selected").length>0;if(!has_selected){var swatch=$(this).find(".swatch:not(.xt_woovs-disabled):not(.xt_woovs-selected)").first();if(swatch.length){self.toggleSwatch(swatch,false,false)}}})},10)};self.autoSelectFirstAvailable=function(){var first_attribute=self.$swatches.first();var has_selected=first_attribute.find(".xt_woovs-selected").length>0;if(has_selected){return}var first_attribute_option=first_attribute.find(".swatch").first();if(first_attribute_option.length){first_attribute_option.trigger("click");self.autoSelectAttributes(true)}};self.setClearButtonVisibility=function(){var $reset=self.$form.find(".reset_variations");setTimeout(function(){if($reset.css("visibility")!=="hidden"){$reset.addClass("xt_woovs-reset-visible")}else{$reset.removeClass("xt_woovs-reset-visible")}},2)};self.initEvents=function(reset){var func=typeof reset!=="undefined"?"off":"on";if(self.on_demand.length){if(self.on_demand_display_type==="inline"&&self.on_demand_visibility_type==="hover"&&!self.is_touch){self.on_demand_trigger[func]("click",self.events.showOnHover);self.on_demand_trigger[func]("mouseenter",self.events.showOnHover)}else{self.on_demand_trigger[func]("click",self.events.showOnClick);self.on_demand_backlayer[func]("click",self.events.showOnClick)}if(self.on_demand_display_type==="inline"&&!self.is_touch){self.on_demand[func]("mouseleave",self.events.showOnHover)}self.on_demand_close_btn[func]("click",function(){self.closeOnDemand ()})}self.$form[func]("woocommerce_variation_has_changed",self.events.onVariationChanged);self.$form[func]("found_variation",self.events.onVariationFound);self.$form[func]("check_variations",self.events.onCheckVariations);self.$form[func]("reset_data",self.events.onReset);if(self.trigger_on_hover){self.$form[func]("mouseover",".swatch",self.events.onSwatchHover)}self.$form[func]("click",".swatch",self.events.onSwatchClick);self.$form[func]("change",".swatch.swatch-radio",self.events.onSwatchRadioChange);self.$form[func]("click",".reset_variations",self.events.onReset);self.$form[func]("mouseenter",".xt_woovs-has-tooltip",self.events.onTooltipEnter);self.$form[func]("mouseleave",".xt_woovs-has-tooltip",self.events.onTooltipLeave);self.$form[func]("mousemove",".xt_woovs-has-tooltip",self.events.onTooltipMove)};self.resetEvents=function(){self.initEvents(true)};self.resetLoopImage=function(){var $img=self.findLoopImage();if($img){$img.attr("src",$img.attr("src-bkp"));if($img.attr("srcset-bkp")){$img.attr("srcset",$img.attr("srcset-bkp"));$img.attr("sizes",$img.attr("sizes-bkp"))}}};self.findLoopImage=function(){var $image=self.$product.find("img.attachment-shop_catalog");if($image.length===0){$image=self.$product.find(".woocommerce-LoopProduct-link img");if($image.length===0){$image=self.$product.find("img.attachment-woocommerce_thumbnail");if($image.length===0){$image=self.$product.find("img.woocommerce-LoopProduct-link");if($image.length===0){$image=self.$product.find("img.wp-post-image")}}}}return $image.length>0?$image:null};self.showOnDemand=function(){$.xt_woovs_variation_form.forms.forEach(function(form){if(form.on_demand.length){form.closeOnDemand ()}});if(self.on_demand_backlayer.length){self.on_demand_backlayer.addClass("xt_woovs-active")}self.on_demand_trigger.addClass("xt_woovs-active");self.on_demand.addClass("xt_woovs-active");self.on_demand_active=true;if(["modal","drawer"].includes(self.on_demand_display_type)){$("html,body").css("overflow","hidden")}};self.closeOnDemand=function(){if(self.on_demand_backlayer.length){self.on_demand_backlayer.removeClass("xt_woovs-active")}self.on_demand_trigger.removeClass("xt_woovs-active");self.on_demand.removeClass("xt_woovs-active");self.on_demand_active=false;if(["modal","drawer"].includes(self.on_demand_display_type)){$("html,body").css("overflow","")}};self.events.showOnHover=function(e){if(e.type==="click"){e.preventDefault();return}self.on_demand.parent().css("position","relative");if(e.type==="mouseenter"){if(!self.on_demand_active){self.showOnDemand ()}}else{var can_autoclose=navigator.userAgent.search(/Firefox/)===-1;if(can_autoclose&&self.on_demand_active&&e.relatedTarget&&!$(e.relatedTarget).is(self.on_demand)&&!$(e.relatedTarget).is(self.on_demand_backlayer)){self.closeOnDemand ()}}};self.events.showOnClick=function(e){e.preventDefault();if(!self.on_demand_active){self.showOnDemand ()}else{self.closeOnDemand ()}};self.toggleSwatch=function(el,clearOnReselect,autoSelect){clearOnReselect=typeof clearOnReselect!=="undefined"?clearOnReselect:false;autoSelect=typeof autoSelect!=="undefined"?autoSelect:true;var $el=$(el),$select=$el.parent().prev().find("select"),value=$el.data("value"),$option=$select.find('option[value="'+value+'"]');if($option.prop("disabled")&&self.disabled_clickable){$option.prop("disabled",false).prop("selected",true);$select.trigger("change");$option.prop("disabled",true).removeProp("selected");return}if($el.hasClass("xt_woovs-selected")){if(clearOnReselect){value=""}else{return}}$select.val(value).trigger("change");$select.trigger("click");$select.trigger("focusin");if(self.is_touch){$select.trigger("touchstart")}$el.trigger("focus");$el.trigger("xt_woovs_selected_item",[value,$select,self.$swatches]);if(value!==""){if(autoSelect){self.autoSelectAttributes()}}else if(clearOnReselect){$el.removeClass("xt_woovs-selected");if(self.on_demand_preview.length){self.on_demand_preview.empty()}if(self.is_archive_product){self.resetLoopImage()}}};self.events.onSwatchHover=function(e){e.preventDefault();e.stopPropagation();self.toggleSwatch(this)};self.events.onSwatchClick=function(e){e.preventDefault();e.stopPropagation();self.toggleSwatch(this,self.enable_deselect)};self.events.onSwatchRadioChange=function(e){e.preventDefault();e.stopPropagation();var $el=$(this),$select=$el.parent().prev().find("select"),value=$el.val();$select.val(e).trigger("change");$select.trigger("click");$select.trigger("focusin");$el.parent(".swatch-radio").removeClass("xt_woovs-selected xt_woovs-disabled").addClass("xt_woovs-selected");$el.parent(".swatch-radio").trigger("xt_woovs_selected_item",[value,$select,self.$swatches])};self.events.onVariationChanged=function(){self.$swatches.each(function(){var $this=$(this);var selected="",$select=$this.prev().find("select"),options=$select.find("option"),current=$select.find("option:selected"),eq=$select.find("option").eq(1),swatch=$this.find(".swatch"),selects=[];options.each(function(){if($(this).val()!==""&&!$(this).prop("disabled")){selects.push($(this).val());selected=current?current.val():eq.val()}});swatch.each(function(){var attribute_value=$(this).attr("data-value");if(!self.is_catalog_mode&&_.indexOf(selects,attribute_value)===-1){$(this).removeClass("xt_woovs-selected").addClass("xt_woovs-disabled")}else{$(this).removeClass("xt_woovs-disabled");if(current.val()!==""){if(attribute_value===selected){self.setCurrentValueLabel($(this),attribute_value);$(this).addClass("xt_woovs-selected")}else{$(this).removeClass("xt_woovs-selected")}}}});$this.trigger("xt_woovs_items_updated")})};self.events.onVariationFound=function(e,variation){if(self.$product.length){var timeout=self.on_demand_active?20:100;setTimeout(function(){var $price=self.$product.find(self.price_selector).first();var is_variation_price=$price.closest(".woocommerce-variation-price").length>0;if(variation.price_html!==""&&$price.length&&!is_variation_price){var price_tag=$price.prop("tagName");$price.replaceWith($(variation.price_html).filter(".price"));$price=self.$product.find(self.price_selector).first();$price.replaceWith($price.clone().replaceTag(price_tag,true,true))}if(self.is_archive_product&&variation.image.src!==""){var $img=self.findLoopImage();if($img){if(!$img.attr("src-bkp")){$img.attr("src-bkp",$img.attr("src"))}var attributes={alt:variation.image.alt,src:variation.image.thumb_src,width:variation.image.thumb_src_w,height:variation.image.thumb_src_h};if($img.attr("srcset")){if(!$img.attr("srcset-bkp")){$img.attr("srcset-bkp",$img.attr("srcset"));$img.attr("sizes-bkp",$img.attr("sizes"))}attributes.srcset=variation.image.srcset;attributes.sizes=variation.image.sizes}$img.attr(attributes);if(self.on_demand_preview.length){var $preview=self.on_demand_preview.find("img");if($preview.length){$preview.attr(attributes)}else{$preview=$img.clone();self.on_demand_preview.html($preview)}}}}self.$form.trigger("xt_woovs_found_variation")},timeout)}};self.events.onCheckVariations=function(){self.setClearButtonVisibility()};self.events.onReset=function(){self.$product.find(self.price_selector).first().html(self.original_price);self.$swatches.each(function(){var swatch=$(this).find(".swatch");swatch.each(function(){if(!self.is_ajax_variation){$(this).removeClass("xt_woovs-selected xt_woovs-disabled");if($(this).hasClass("swatch-radio")){$(this).find("input:radio").prop("disabled",false).prop("checked",false)}}else{if($(this).hasClass("swatch-radio")){}}self.setCurrentValueLabel($(this),"")})});self.$form.find(".reset_variations").removeClass("xt_woovs-reset-visible");self.$form.trigger("xt_woovs_reset_data");self.$form.trigger("woocommerce_variation_has_changed")};self.events.onTooltipEnter=function(e){if(!self.tooltip_enabled){self.tooltip_enabled=true;var title=$(this).attr("title");var type=$(this).data("tooltip_type");var value=$(this).data("tooltip_value");value=type==="text"?value:'<img src="'+value+'" />';$(this).data("tiptext",title).removeAttr("title");$('<span class="xt_woovs-tooltip">').addClass("tooltip-"+type).html(value).appendTo("body").css("top",e.pageY-10+"px").css("left",e.pageX+20+"px").fadeIn("slow")}};self.events.onTooltipLeave=function(){$(this).attr("title",$(this).data("tiptext"));$(".xt_woovs-tooltip").remove();self.tooltip_enabled=false};self.events.onTooltipMove=function(e){var mousex=e.pageX;var mousey=e.pageY-$(this).outerHeight()-$(".xt_woovs-tooltip").outerHeight();$(".xt_woovs-tooltip").css({top:mousey,left:mousex})};self.init();$(document).trigger("xt_woovs",[self.$form]);return self};$.xt_woovs_variation_form.defaultOptions={};$.xt_woovs_variation_form.forms=[];$.fn.xt_woovs_variation_form=function(options){return this.each(function(){$.xt_woovs_variation_form.forms.push(new $.xt_woovs_variation_form(this,options))})};$(function(){var init=function(isAjax){isAjax=typeof isAjax!=="undefined"&&isAjax;$(".variations_form").each(function(){if($(this).data("initialized")!==true){if(isAjax){$(this).data("ajax",true)}$(this).xt_woovs_variation_form();$(this).data("initialized",true)}})};$(document.body).on("quick-view-displayed xt_atc_added_to_cart",function(evt){$.xt_woovs_variation_form.forms.forEach(function(form){if(form.on_demand.length&&form.on_demand_display_type!=="inline"){if(form.on_demand_active){setTimeout(function(){form.closeOnDemand ()},10)}}})});$(document.body).on("quick-view-displayed",function(){init()});$(document).ajaxComplete(function(event,request,settings){init(true)});var observer=new MutationObserver(function(mutations){mutations.forEach(function(mutation){if(mutation.attributeName=="class"&&mutation.target.classList.contains("variations_form")&&mutation.target.classList.contains("populated")&&$(mutation.target).data("initialized")!==true){init()}})});observer.observe(document.body,{attributes:true,subtree:true});init();$(document.body).trigger("xt_woovs_initialized");window.xt_woovs_init=init})})(jQuery,window);