(function ($){
$(document).on('click', 'a.remove', function(){
$('.woocommerce .woocommerce-error').remove();
});
})(jQuery);
;
(function (global, factory){
typeof exports==='object'&&typeof module!=='undefined' ? module.exports=factory() :
typeof define==='function'&&define.amd ? define(factory) :
(global=typeof globalThis!=='undefined' ? globalThis:global||self, (function (){
var current=global.Cookies;
var exports=global.Cookies=factory();
exports.noConflict=function (){ global.Cookies=current; return exports; };})());
})(this, (function (){ 'use strict';
function assign (target){
for (var i=1; i < arguments.length; i++){
var source=arguments[i];
for (var key in source){
target[key]=source[key];
}}
return target
}
var defaultConverter={
read: function (value){
if(value[0]==='"'){
value=value.slice(1, -1);
}
return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
},
write: function (value){
return encodeURIComponent(value).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
decodeURIComponent
)
}};
function init (converter, defaultAttributes){
function set (name, value, attributes){
if(typeof document==='undefined'){
return
}
attributes=assign({}, defaultAttributes, attributes);
if(typeof attributes.expires==='number'){
attributes.expires=new Date(Date.now() + attributes.expires * 864e5);
}
if(attributes.expires){
attributes.expires=attributes.expires.toUTCString();
}
name=encodeURIComponent(name)
.replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
.replace(/[()]/g, escape);
var stringifiedAttributes='';
for (var attributeName in attributes){
if(!attributes[attributeName]){
continue
}
stringifiedAttributes +='; ' + attributeName;
if(attributes[attributeName]===true){
continue
}
stringifiedAttributes +='=' + attributes[attributeName].split(';')[0];
}
return (document.cookie =
name + '=' + converter.write(value, name) + stringifiedAttributes)
}
function get (name){
if(typeof document==='undefined'||(arguments.length&&!name)){
return
}
var cookies=document.cookie ? document.cookie.split('; '):[];
var jar={};
for (var i=0; i < cookies.length; i++){
var parts=cookies[i].split('=');
var value=parts.slice(1).join('=');
try {
var found=decodeURIComponent(parts[0]);
jar[found]=converter.read(value, found);
if(name===found){
break
}} catch (e){}}
return name ? jar[name]:jar
}
return Object.create({
set,
get,
remove: function (name, attributes){
set(
name,
'',
assign({}, attributes, {
expires: -1
})
);
},
withAttributes: function (attributes){
return init(this.converter, assign({}, this.attributes, attributes))
},
withConverter: function (converter){
return init(assign({}, this.converter, converter), this.attributes)
}},
{
attributes: { value: Object.freeze(defaultAttributes) },
converter: { value: Object.freeze(converter) }}
)
}
var api=init(defaultConverter, { path: '/' });
return api;
}));
jQuery(function($){
if(typeof wc_cart_fragments_params==='undefined'){
return false;
}
var $supports_html5_storage=true,
cart_hash_key=wc_cart_fragments_params.cart_hash_key;
try {
$supports_html5_storage=('sessionStorage' in window&&window.sessionStorage!==null);
window.sessionStorage.setItem('wc', 'test');
window.sessionStorage.removeItem('wc');
window.localStorage.setItem('wc', 'test');
window.localStorage.removeItem('wc');
} catch(err){
$supports_html5_storage=false;
}
function set_cart_creation_timestamp(){
if($supports_html5_storage){
sessionStorage.setItem('wc_cart_created',(new Date()).getTime());
}}
function set_cart_hash(cart_hash){
if($supports_html5_storage){
localStorage.setItem(cart_hash_key, cart_hash);
sessionStorage.setItem(cart_hash_key, cart_hash);
}}
var $fragment_refresh={
url: wc_cart_fragments_params.wc_ajax_url.toString().replace('%%endpoint%%', 'get_refreshed_fragments'),
type: 'POST',
data: {
time: new Date().getTime()
},
timeout: wc_cart_fragments_params.request_timeout,
success: function(data){
if(data&&data.fragments){
$.each(data.fragments, function(key, value){
$(key).replaceWith(value);
});
if($supports_html5_storage){
sessionStorage.setItem(wc_cart_fragments_params.fragment_name, JSON.stringify(data.fragments) );
set_cart_hash(data.cart_hash);
if(data.cart_hash){
set_cart_creation_timestamp();
}}
$(document.body).trigger('wc_fragments_refreshed');
}},
error: function(){
$(document.body).trigger('wc_fragments_ajax_error');
}};
function refresh_cart_fragment(){
$.ajax($fragment_refresh);
}
if($supports_html5_storage){
var cart_timeout=null,
day_in_ms=(24 * 60 * 60 * 1000);
$(document.body).on('wc_fragment_refresh updated_wc_div', function(){
refresh_cart_fragment();
});
$(document.body).on('added_to_cart removed_from_cart', function(event, fragments, cart_hash){
var prev_cart_hash=sessionStorage.getItem(cart_hash_key);
if(prev_cart_hash===null||prev_cart_hash===undefined||prev_cart_hash===''){
set_cart_creation_timestamp();
}
sessionStorage.setItem(wc_cart_fragments_params.fragment_name, JSON.stringify(fragments) );
set_cart_hash(cart_hash);
});
$(document.body).on('wc_fragments_refreshed', function(){
clearTimeout(cart_timeout);
cart_timeout=setTimeout(refresh_cart_fragment, day_in_ms);
});
$(window).on('storage onstorage', function(e){
if(cart_hash_key===e.originalEvent.key&&localStorage.getItem(cart_hash_key)!==sessionStorage.getItem(cart_hash_key)
){
refresh_cart_fragment();
}});
$(window).on('pageshow' , function(e){
if(e.originalEvent.persisted){
$('.widget_shopping_cart_content').empty();
$(document.body).trigger('wc_fragment_refresh');
}});
try {
var wc_fragments=JSON.parse(sessionStorage.getItem(wc_cart_fragments_params.fragment_name) ),
cart_hash=sessionStorage.getItem(cart_hash_key),
cookie_hash=Cookies.get('woocommerce_cart_hash'),
cart_created=sessionStorage.getItem('wc_cart_created');
if(cart_hash===null||cart_hash===undefined||cart_hash===''){
cart_hash='';
}
if(cookie_hash===null||cookie_hash===undefined||cookie_hash===''){
cookie_hash='';
}
if(cart_hash&&(cart_created===null||cart_created===undefined||cart_created==='') ){
throw 'No cart_created';
}
if(cart_created){
var cart_expiration=(( 1 * cart_created) + day_in_ms),
timestamp_now=(new Date()).getTime();
if(cart_expiration < timestamp_now){
throw 'Fragment expired';
}
cart_timeout=setTimeout(refresh_cart_fragment,(cart_expiration - timestamp_now) );
}
if(wc_fragments&&wc_fragments['div.widget_shopping_cart_content']&&cart_hash===cookie_hash){
$.each(wc_fragments, function(key, value){
$(key).replaceWith(value);
});
$(document.body).trigger('wc_fragments_loaded');
}else{
throw 'No fragment';
}} catch(err){
refresh_cart_fragment();
}}else{
refresh_cart_fragment();
}
if(Cookies.get('woocommerce_items_in_cart') > 0){
$('.hide_cart_widget_if_empty').closest('.widget_shopping_cart').show();
}else{
$('.hide_cart_widget_if_empty').closest('.widget_shopping_cart').hide();
}
$(document.body).on('adding_to_cart', function(){
$('.hide_cart_widget_if_empty').closest('.widget_shopping_cart').show();
});
var hasSelectiveRefresh=(
'undefined'!==typeof wp &&
wp.customize &&
wp.customize.selectiveRefresh &&
wp.customize.widgetsPreview &&
wp.customize.widgetsPreview.WidgetPartial
);
if(hasSelectiveRefresh){
wp.customize.selectiveRefresh.bind('partial-content-rendered', function(){
refresh_cart_fragment();
});
}});