PageSourceSearch

https://www.backsplash.com/wp-content/cache/flying-press/3ebd65203ef5.tm-epo.js

js backsplash.com collected 2026-09-25 23:40:25 UTC 383,396 bytes, 1,167 lines download raw bytes

1(function(window,document,$){'use strict';var tcAPI={};var TMEPOJS=window.TMEPOJS;var wp=window.wp;var TMEPOQTRANSLATEXJS=window.TMEPOQTRANSLATEXJS;var noUiSlider=window.noUiSlider;var ClipboardEvent=window.ClipboardEvent;var DataTransfer=window.DataTransfer;var lateVariationEvent=[];var latecpflogicactions=[];var tmLazyloadContainer=!1;var variationsFormIsLoaded=!1;var jBody=$('body');var jWindow=$(window);var jDocument=$(document);var errorObject;var FloatingTotalsBox;var currentAjaxButton;var currentAddToCartButton;var errorContainer=$(window);var tcmexp=window.tcmexp;var _=window._;var priceCache=!1;var getLocalInputDecimalSeparator=function(){if(TMEPOJS.tm_epo_global_input_decimal_separator===''){return TMEPOJS.currency_format_decimal_sep}
2return $.epoAPI.locale.getSystemDecimalSeparator()};var getLocalDecimalSeparator=function(){if(TMEPOJS.tm_epo_global_displayed_decimal_separator===''){return TMEPOJS.currency_format_decimal_sep}
3return $.epoAPI.locale.getSystemDecimalSeparator()};var getLocalThousandSeparator=function(){if(TMEPOJS.tm_epo_global_displayed_decimal_separator===''){return TMEPOJS.currency_format_thousand_sep}
4return $.epoAPI.locale.getSystemDecimalSeparator()};var getEpoDelay=function(){if(TMEPOJS.tm_epo_start_animation_delay){return TMEPOJS.tm_epo_start_animation_delay}else if(window.tc_epo_delay){return window.tc_epo_delay}
5return 500};var getEpoAnimationDelay=function(){if(TMEPOJS.tm_epo_animation_delay){return TMEPOJS.tm_epo_start_animation_delay}else if(window.tc_epo_animation_delay){return window.tc_epo_animation_delay}
6return 500};var originalVal=$.fn.val;if(!TMEPOJS||!wp){return}
7$.fn.val=function(){var result=originalVal.apply(this,arguments);if(arguments.length>0){if($(this).is('.input-text.qty')){$(this).trigger('change.cpf')}}
8return result};if(TMEPOJS.tm_epo_no_lazy_load==='no'&&$.lazyLoadXT){$.extend($.lazyLoadXT,{autoInit:!1,updateEvent:$.lazyLoadXT.updateEvent+' tmlazy'})}
9tcAPI.localInputDecimalSeparator=getLocalInputDecimalSeparator();tcAPI.localDecimalSeparator=getLocalDecimalSeparator();tcAPI.localThousandSeparator=getLocalThousandSeparator();tcAPI.epoDelay=getEpoDelay();tcAPI.epoAnimationDelay=getEpoAnimationDelay();tcAPI.getElementFromFieldCache=[];tcAPI.epoSelector='.tc-extra-product-options';tcAPI.associatedEpoSelector='.tc-extra-product-options-inline';tcAPI.associatedEpoCart='.tc-epo-element-product-container-cart';tcAPI.addToCartSelector="input[name='add-to-cart']";tcAPI.tcAddToCartSelector='input.tc-add-to-cart';tcAPI.qtySelector="input.qty,input[name='quantity'],select.qty,.drop-down-button #qty,.plus-minus-button #qty,.slider-input #amount";tcAPI.associateQtySelector='input.tm-qty-alt';tcAPI.addToCartButtonSelector='.add_to_cart_button, .single_add_to_cart_button';tcAPI.compositeSelector='.bto_item,.component';tcAPI.nativeProductPriceSelector=TMEPOJS.tm_epo_global_product_price_selector||'.woocommerce .product p.price, .wc-block-components-product-price';tcAPI.associatedNativeProductPriceSelector='.product-price .associated-price';tcAPI.templateEngine=$.epoAPI.applyFilter('tc_adjust_templateEngine',{plain_price:wp.template('tc-plain-price'),suffix:wp.template('tc-suffix'),main_suffix:wp.template('tc-main-suffix'),price:wp.template('tc-price'),price_m:wp.template('tc-price-m'),sale_price:wp.template('tc-sale-price'),sale_price_m10:wp.template('tc-sale-price-m10'),sale_price_m01:wp.template('tc-sale-price-m01'),sale_price_m11:wp.template('tc-sale-price-m11'),tc_chars_remanining:wp.template('tc-chars-remanining'),tc_final_totals:wp.template('tc-final-totals'),tc_floating_box:wp.template('tc-floating-box'),tc_floating_box_nks:wp.template('tc-floating-box-nks'),tc_formatted_price:wp.template('tc-formatted-price'),tc_formatted_sale_price:wp.template('tc-formatted-sale-price'),tc_lightbox:wp.template('tc-lightbox'),tc_lightbox_zoom:wp.template('tc-lightbox-zoom'),tc_section_pop_link:wp.template('tc-section-pop-link'),tc_upload_messages:wp.template('tc-upload-messages')});$.tcAPI=function(){return tcAPI};$.tcAPIGet=function(name){return tcAPI[name]};$.tcAPISet=function(name,value){tcAPI[name]=value};if($.tc_validator){$.extend($.tc_validator.messages,{required:TMEPOJS.tm_epo_global_validator_messages.required,email:TMEPOJS.tm_epo_global_validator_messages.email,url:TMEPOJS.tm_epo_global_validator_messages.url,number:TMEPOJS.tm_epo_global_validator_messages.number,digits:TMEPOJS.tm_epo_global_validator_messages.digits,maxlengthsingle:$.tc_validator.format(TMEPOJS.tm_epo_global_validator_messages.maxlengthsingle),maxlength:$.tc_validator.format(TMEPOJS.tm_epo_global_validator_messages.maxlength),minlengthsingle:$.tc_validator.format(TMEPOJS.tm_epo_global_validator_messages.minlengthsingle),minlength:$.tc_validator.format(TMEPOJS.tm_epo_global_validator_messages.minlength),max:$.tc_validator.format(TMEPOJS.tm_epo_global_validator_messages.max),min:$.tc_validator.format(TMEPOJS.tm_epo_global_validator_messages.min),step:$.tc_validator.format(TMEPOJS.tm_epo_global_validator_messages.step),lettersonly:$.tc_validator.format(TMEPOJS.tm_epo_global_validator_messages.lettersonly),lettersspaceonly:$.tc_validator.format(TMEPOJS.tm_epo_global_validator_messages.lettersspaceonly),alphanumeric:$.tc_validator.format(TMEPOJS.tm_epo_global_validator_messages.alphanumeric),alph
9anumericunicode:$.tc_validator.format(TMEPOJS.tm_epo_global_validator_messages.alphanumericunicode),alphanumericunicodespace:$.tc_validator.format(TMEPOJS.tm_epo_global_validator_messages.alphanumericunicodespace),repeaterminrows:$.tc_validator.format(TMEPOJS.tm_epo_global_validator_messages.repeaterminrows),repeatermaxrows:$.tc_validator.format(TMEPOJS.tm_epo_global_validator_messages.repeatermaxrows)});$.tc_validator.addMethod('alphanumeric',function(value,element){return this.optional(element)||/^[a-zA-Z0-9.-]+$/i.test(value)},$.tc_validator.messages.alphanumeric);$.tc_validator.addMethod('lettersonly',function(value,element){return this.optional(element)||/^[a-z]+$/i.test(value)},$.tc_validator.messages.lettersonly);$.tc_validator.addMethod('lettersspaceonly',function(value,element){return this.optional(element)||/^[a-z,\u0020]+$/i.test(value)},$.tc_validator.messages.lettersspaceonly);$.tc_validator.addMethod('alphanumericunicode',function(value,element){return(this.optional(element)||/^[\u0030-\u0039\u0041-\u005A\u0061-\u007A\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\u0148\u014A-\u017F\u0180-\u01BF\u01C4-\u024F\u1E02-\u1EF3\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u3040-\u309f\u30a0-\u30ff\u4e00-\u9faf\u3400-\u4dbf\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF\u10E60-\u10E7F\u1EC70-\u1ECBF\u1ED00-\u1ED4F\u1EE00-\u1EEFF\u0530-\u1058F]+$/i.test(value))},$.tc_validator.messages.alphanumericunicode);$.tc_validator.addMethod('alphanumericunicodespace',function(value,element){return(this.optional(element)||/^[\u0030-\u0039\u0041-\u005A\u0061-\u007A\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\u0148\u014A-\u017F\u0180-\u01BF\u01C4-\u024F\u1E02-\u1EF3\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u3040-\u309f\u30a0-\u30ff\u4e00-\u9faf\u3400-\u4dbf\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF\u10E60-\u10E7F\u1EC70-\u1ECBF\u1ED00-\u1ED4F\u1EE00-\u1EEFF\u0530-\u1058F,\u0020]+$/i.test(value))},$.tc_validator.messages.alphanumericunicodespace);$.tc_validator.addMethod('repeaterminrows',function(value,element,param){return $.epoAPI.math.toInt($(element).closest('.tc-element-inner-wrap').find('.tc-repeater-element').length)>=$.epoAPI.math.toInt(param)},$.tc_validator.messages.repeaterminrows);$.tc_validator.addMethod('repeatermaxrows',function(value,element,param){return $.epoAPI.math.toInt($(element).closest('.tc-element-inner-wrap').find('.tc-repeater-element').length)<=$.epoAPI.math.toInt(param)},$.tc_validator.messages.repeatermaxrows);$.tc_validator.addMethod('product_element_radio_qty',function(value,element){var qty=$(element).closest('.tm-element-ul-product').find('input.tc-epo-field-product.tmcp-radio:checked').closest('.tc-epo-element-product-holder').find('.tm-qty').first().val();return qty>0},$.tc_validator.messages.required);$.tc_validator.addMethod('product_element_select_qty',function(value,element){var qty=$(element).closest('.tm-element-ul-product').find('select.tc-epo-field-product.tmcp-select').closest('.tc-epo-element-product-holder').find('.tm-qty').first().val();return qty>0},$.tc_validator.messages.required)}
10$.epoAPI.util.unformat=function(o){var a=$.epoAPI.math.unformat(o,tcAPI.localInputDecimalSeparator);var n=parseFloat(a);if(!Number.isFinite(n)){return a}
11return n};if(!$.tmType){$.tmType=function(obj){return Object.prototype.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}}
12if(!$.is_on_screen){$.fn.is_on_screen=function(){var win=$(window);var scroll=$.epoAPI.dom.scroll();var bounds=this.offset();var viewport={top:scroll.top,left:scroll.left};viewport.right=viewport.left+win.width();viewport.bottom=viewport.top+win.height();bounds.right=bounds.left+this.outerWidth();bounds.bottom=bounds.top+this.outerHeight();return!(viewport.right<bounds.left||viewport.left>bounds.right||viewport.bottom<bounds.top||viewport.top>bounds.bottom)}}
13if(!$().tmtoggle){$.fn.tmtoggle=function(){var elements=this;var is_one_open_for_accordion=!1;var init_done=0;if(elements.length===0){return}
14if(window.tc_accordion_offset===undefined){window.tc_accordion_offset=-100}
15elements.toArray().forEach(function(t){var headers;var wrap;var wraps;t=$(t);if(!t.data('tm-toggle-init')){t.data('tm-toggle-init',1);headers=t.find('.tm-toggle');wrap=t.find('.tm-collapse-wrap');wraps=$('.tm-collapse.tmaccordion');if(wraps.closest('.tc-epo-element-product-holder').length>0){wraps=wraps.closest('.tc-epo-element-product-holder').find('.tm-collapse.tmaccordion').find('.tm-toggle')}else{wraps=$('.tm-collapse.tmaccordion').not('.tc-epo-element-product-holder .tm-collapse.tmaccordion').find('.tm-toggle')}
16if(headers.length===0||wrap.length===0){return}
17if(wrap.is('.closed')){$(wrap).removeClass('closed open').addClass('closed').hide();$(headers).find('.tm-arrow').removeClass('tcfa-angle-down tcfa-angle-up').addClass('tcfa-angle-down');$(headers).removeClass('toggle-header-open toggle-header-closed').addClass('toggle-header-closed');$(headers).attr('aria-expanded',!1)}else{$(wrap).removeClass('closed open').addClass('open').show();$(headers).find('.tm-arrow').removeClass('tcfa-angle-down tcfa-angle-up').addClass('tcfa-angle-up');$(headers).removeClass('toggle-header-open toggle-header-closed').addClass('toggle-header-open');$(headers).attr('aria-expanded',!0);is_one_open_for_accordion=!0}
18headers.toArray().forEach(function(header){header=$(header);header.on('closewrap.tmtoggle',function(){if(t.is('.tmaccordion')&&$(wrap).is('.closed')){return}
19$(wrap).removeClass('closed open').addClass('closed');$(this).find('.tm-arrow').removeClass('tcfa-angle-down tcfa-angle-up').addClass('tcfa-angle-down');$(this).removeClass('toggle-header-open toggle-header-closed').addClass('toggle-header-closed');$(this).attr('aria-expanded',!1);$(wrap).removeClass('tm-animated fadein');if(t.is('.tmaccordion')){$(wrap).animate({height:'toggle'},100,function(){$(wrap).hide()})}else{$(wrap).animate({height:'toggle'},100,function(){$(wrap).hide()})}
20jWindow.trigger('tmlazy')});header.on('openwrap.tmtoggle',function(e,data){if(t.is('.tmaccordion')){$(wraps).not($(this)).trigger('closewrap.tmtoggle')}
21$(wrap).removeClass('closed open').addClass('open');$(this).find('.tm-arrow').removeClass('tcfa-angle-down tcfa-angle-up').addClass('tcfa-angle-up');$(this).removeClass('toggle-header-open toggle-header-closed').addClass('toggle-header-open');$(this).attr('aria-expanded',!0);$(wrap).show().removeClass('tm-animated fadein').addClass('tm-animated fadein');setTimeout(function(){jWindow.trigger('tmlazy')},200);setTimeout(function(){if(data===undefined&&init_done&&t.is('.tmaccordion')&&!t.is_on_screen()){jWindow.tcScrollTo(header,10,window.tc_accordion_offset)}},110)});header.on('click.tmtoggle keydown.tmtoggle',function(e){if(e.type==='keydown'&&e.key!=='Enter'){return}
22e.preventDefault();if($(wrap).is('.closed')){$(this).trigger('openwrap.tmtoggle')}else{$(this).trigger('closewrap.tmtoggle')}});header.find('.tm-qty').closest('.cpf-element').find('.tm-epo-field').on('change.cpf',function(){header.trigger('openwrap.tmtoggle')})})}});if(undefined===window.tc_accordion_closed_on_page_load&&!is_one_open_for_accordion&&elements.filter('.tmaccordion').length>0){elements.filter('.tmaccordion').first().find('.tm-toggle').trigger('openwrap.tmtoggle',{nomove:1})}
23init_done=1;return elements}}
24if(!$().tmpoplink){$.fn.tmpoplink=function(options){var elements=this;var floatbox_template;var settings={classname:'flasho tc-wrapper cart-popup'};if(elements.length===0){return}
25if(options){settings=$.extend({},settings,options)}
26floatbox_template=function(data){return $.epoAPI.template.html(wp.template('tc-cart-options-popup'),{title:data.title,id:data.id,html:data.html,close:TMEPOJS.i18n_close})};return elements.toArray().forEach(function(t){var id;var title;var html;var $_html;t=$(t);if(t.is('.tc-poplink')){return}
27t.addClass('tc-poplink');id=t.attr('href');title=t.attr('data-title');html=$(id).html();if(!title){title=TMEPOJS.i18n_addition_options}
28$_html=floatbox_template({id:'tc-floatbox-content',html:html,title:title});t.on('click.tmpoplink',function(e){$.tcFloatBox({fps:1,ismodal:!1,width:'80%',height:'80%',classname:settings.classname,data:$_html});e.preventDefault()})})}}
29function readableFileSize(a,b,c,d,e){b=Math;c=b.log;d=1024;e=c(a)/c(d)|0;return((a/b.pow(d,e)).toFixed(e?2:0))+' '+(e?'KMGTPEZY'[--e]+'B':'bytes')}
30function toggleState(thisProductContainerWrap,disabled){thisProductContainerWrap.toArray().forEac
30h(function(setter){setter=$(setter);setter.find(':input').prop('disabled',function(i,v){var state=$(this).data('tc-state');if(state===undefined){$(this).data('tc-state',v);return disabled}
31if(state===!1){return disabled}
32return state})})}
33function calculateTaxAmount(priceWithTax,_cart){var taxable;var tax_rate;var pricesIncludeTax;var tax_display_mode;var current_variation;var priceWithoutTax;var taxAmount=0;if(_cart){taxable=_cart.attr('data-taxable');tax_rate=_cart.attr('data-tax-rate');pricesIncludeTax=_cart.attr('data-prices-include-tax')||TMEPOJS.prices_include_tax;tax_display_mode=_cart.attr('data-tax-display-mode');if(_cart.data('current_variation')!==undefined){current_variation=_cart.data('current_variation')}
34if(current_variation!==undefined){current_variation=_cart.data('current_variation');taxable=current_variation.tc_is_taxable;tax_rate=current_variation.tc_tax_rate}}
35if(taxable){tax_rate=parseFloat(tax_rate/100);if(pricesIncludeTax==='1'){if(tax_display_mode==='incl'){priceWithTax=parseFloat(priceWithTax);priceWithoutTax=priceWithTax/(1+tax_rate);taxAmount=priceWithTax-priceWithoutTax}else{priceWithoutTax=priceWithTax;taxAmount=priceWithTax*tax_rate}}else if(tax_display_mode==='incl'){priceWithoutTax=priceWithTax/(1+tax_rate);taxAmount=priceWithTax-priceWithoutTax}
36taxAmount=$.epoAPI.math.toFloat(taxAmount)}
37return taxAmount}
38function get_price_including_tax(price,_cart,element,force,variation,pricetype,doubleforce){var taxable;var tax_rate;var prices_include_tax;var is_vat_exempt;var non_base_location_prices;var taxes_of_one;var base_taxes_of_one;var modded_taxes_of_one;var current_variation;if(!Number.isFinite(parseFloat(price))){price=0}
39price=price*10000;if(_cart){taxable=_cart.attr('data-taxable');tax_rate=_cart.attr('data-tax-rate');prices_include_tax=_cart.attr('data-prices-include-tax')||TMEPOJS.prices_include_tax;is_vat_exempt=_cart.attr('data-is-vat-exempt');non_base_location_prices=_cart.attr('data-non-base-location-prices');taxes_of_one=_cart.attr('data-taxes-of-one');base_taxes_of_one=_cart.attr('data-base-taxes-of-one');modded_taxes_of_one=_cart.attr('data-modded-taxes-of-one');if(_cart.data('current_variation')!==undefined){current_variation=_cart.data('current_variation')}else if(variation!==undefined){current_variation=variation}
40if(current_variation!==undefined){current_variation=_cart.data('current_variation');taxable=current_variation.tc_is_taxable;tax_rate=current_variation.tc_tax_rate;non_base_location_prices=current_variation.tc_non_base_location_prices;taxes_of_one=current_variation.tc_taxes_of_one;base_taxes_of_one=current_variation.tc_base_taxes_of_one;modded_taxes_of_one=current_variation.tc_modded_taxes_of_one}
41if(element){if(element.data('tax-obj')){tax_rate=element.data('tax-obj');if(tax_rate.has_fee==='no'){taxable=!1}else if(tax_rate.has_fee==='yes'){taxable=!0}
42if(base_taxes_of_one===''||base_taxes_of_one===undefined){base_taxes_of_one=tax_rate/100}
43if(tax_rate.base_taxes_of_one!==undefined){base_taxes_of_one=tax_rate.base_taxes_of_one}
44tax_rate=tax_rate.tax_rate;taxes_of_one=tax_rate/100}}
45if(taxable){if(prices_include_tax==='1'&&!force){if(is_vat_exempt==='1'){if(non_base_location_prices==='1'){price=parseFloat(price)-(taxes_of_one*price)}else{price=parseFloat(price)-(base_taxes_of_one*price)}}else if(non_base_location_prices==='1'){price=parseFloat(price)-(base_taxes_of_one*price)+(modded_taxes_of_one*price)}}else if(element||current_variation===undefined||doubleforce){price=parseFloat(price)+(parseFloat(price)*taxes_of_one)}}}
46price=price/10000;return price}
47function get_price_excluding_tax(price,_cart,element,force,variation,pricetype,doubleforce){var taxable;var tax_rate;var taxes_of_one;var base_taxes_of_one;var prices_include_tax;var current_variation;var tax_display_mode;if(!Number.isFinite(parseFloat(price))){price=0}
48price=price*10000;if(_cart){tax_display_mode=_cart.attr('data-tax-display-mode');taxable=_cart.attr('data-taxable');tax_rate=_cart.attr('data-tax-rate');taxes_of_one=_cart.attr('data-taxes-of-one');base_taxes_of_one=_cart.attr('data-base-taxes-of-one');prices_include_tax=_cart.attr('data-prices-include-tax');if(_cart.data('current_variation')!==undefined){current_variation=_cart.data('current_variation')}
48else if(variation!==undefined){current_variation=variation}
49if(current_variation!==undefined){taxable=current_variation.tc_is_taxable;tax_rate=current_variation.tc_tax_rate;taxes_of_one=current_variation.tc_taxes_of_one;base_taxes_of_one=current_variation.tc_base_taxes_of_one}
50if(element){if(element.data('tax-obj')){tax_rate=element.data('tax-obj');if(tax_rate.has_fee==='no'){taxable=!1}else if(tax_rate.has_fee==='yes'){taxable=!0}
51if(base_taxes_of_one===''||base_taxes_of_one===undefined){base_taxes_of_one=tax_rate/100}
52if(tax_rate.base_taxes_of_one!==undefined){base_taxes_of_one=tax_rate.base_taxes_of_one}
53tax_rate=tax_rate.tax_rate}}
54if(taxable){if(prices_include_tax==='1'||force){if(tax_display_mode==='incl'){}else if(element||current_variation===undefined||force||doubleforce){if(base_taxes_of_one===taxes_of_one){price=parseFloat(price)-parseFloat(taxes_of_one*price)}else{price=price*(1-parseFloat(base_taxes_of_one))}}}}}
55price=price/10000;return price}
56function tm_set_tax_price(value,_cart,element,pricetype,force,variation,doubleforce){var tax_display_mode;if(!Number.isFinite(parseFloat(value))){value=0}
57if(_cart){tax_display_mode=_cart.attr('data-tax-display-mode')||TMEPOJS.tax_display_mode;if(tax_display_mode==='incl'){value=get_price_including_tax(value,_cart,element,force,variation,pricetype,doubleforce)}else{value=get_price_excluding_tax(value,_cart,element,force,variation,pricetype,doubleforce)}}
58return value}
59function formatPrice(value,args){var data;if(!args){args={}}
60data=$.extend({symbol:'',format:'',decimal:tcAPI.localDecimalSeparator,thousand:tcAPI.localThousandSeparator,precision:TMEPOJS.currency_format_num_decimals},args);if(TMEPOJS.tm_epo_trim_zeros==='yes'){if(((value%1).toString()!=='0')===!1){data.precision=0}}
61return $.epoAPI.applyFilter('tc_formatPrice',$.epoAPI.math.format(value,data),data,value)}
62function tm_set_price_(value,sign){return(sign+formatPrice(value,{symbol:TMEPOJS.currency_format_symbol,format:TMEPOJS.currency_format}))}
63function tm_set_price(value,_cart,notax,element,pricetype){var val;var sign=TMEPOJS.option_plus_sign+' ';if(!notax){value=tm_set_tax_price(value,_cart,element,pricetype)}
64val=Math.abs(value);if(TMEPOJS.tm_epo_global_options_price_sign==='minus'){sign=''}
65if(value<0){sign=TMEPOJS.option_minus_sign+' '}
66return tm_set_price_(val,sign)}
67function tm_get_price(value,_cart,notax,element,pricetype,force){if(!notax){value=tm_set_tax_price(value,_cart,element,pricetype,force)}
68return value}
69FloatingTotalsBox=function(this_epo_totals_container,is_quickview,main_cart){this.this_epo_totals_container=this_epo_totals_container;this.is_quickview=is_quickview;this.main_cart=main_cart;if(!is_quickview&&TMEPOJS.floating_totals_box&&TMEPOJS.floating_totals_box!=='disable'&&main_cart&&this_epo_totals_container.length){this.init();return this}
70return!1};FloatingTotalsBox.prototype={constructor:FloatingTotalsBox,onUpdate:function(){var tm_epo_totals_html=this.this_epo_totals_container.data('tm-html');var tm_floating_box_data=this.this_epo_totals_container.data('tm-floating-box-data');var values_obj=[];var floatingBoxHtml;var floatingBoxaddToCartButton;var len;var i;var row;var tempDiv;var j;var spans;var container;if(tm_floating_box_data&&tm_floating_box_data.length){len=tm_floating_box_data.length;for(i=0;i<len;i++){row=tm_floating_box_data[i];row.title=row.title?String(row.title):'&nbsp;';row.value=row.value?String(row.value):'&nbsp;';if(row.title!=='&nbsp;'){tempDiv=document.createElement('div');tempDiv.innerHTML=row.title;spans=tempDiv.querySelectorAll('span');for(j=0;j<spans.length;j++){spans[j].remove()}
71row.title=tempDiv.innerHTML}
72if(this.is_nks){if(row.label_show!==''){row.title=''}
73if(row.value_show!==''){row.value=''}}
74if(TMEPOJS.tm_epo_auto_hide_price_if_zero==='yes'&&$.epoAPI.util.isEmpty(row.price)===!0){row.price=''}else{row.price=tm_set_price(row.price,this.this_epo_totals_container,!0)}
75values_obj.push({label_show:row.label_show,value_show:row.value_show,title:row.title,value:row.value,quantity:row.quantity,price:row.price})}}
76if(((tm_epo_totals_html&&tm_epo_totals_html==='')&&(!tm_floating_box_data||!tm_floating_box_data.length))||!((tm_epo_totals_html&&tm_epo_totals_html!=='')||this.is_nks)){tm_epo_totals_html='';this.floatingBox.hide()}
77floatingBoxHtml=$.epoAPI.template.html(this.engineTemplate,{html_before:TMEPOJS.floating_totals_box_html_before,html_after:TMEPOJS.floating_totals_box_html_after,option_label:TMEPOJS.i18n_option_label,option_value:TMEPOJS.i18n_option_value,option_qty:TMEPOJS.i18n_option_qty,option_price:TMEPOJS.i18n_option_price,values:values_obj,totals:tm_epo_totals_html});this.floatingBox.html(floatingBoxHtml);this.onUpdateScroll();if(TMEPOJS.tm_epo_no_lazy_load!=='yes'){this.floatingBox.addClass('lazyxt');container=this.floatingBox.find('img.tmlazy');container.lazyLoadXT();container.on('lazyshow',function(){jWindow.trigger('lazyLoadXToncomplete')})}
78if(TMEPOJS.floating_totals_box_add_button==='yes'){floatingBoxaddToCartButton=this.main_cart.find(tcAPI.addToCartButtonSelector).first();floatingBoxaddToCartButton.tcClone().addClass('tc-add-to-cart-button').on('click',function(){floatingBoxaddToCartButton.trigger('click')}).appendTo(this.floatingBox)}},onUpdateScroll:function(){if(TMEPOJS.floating_totals_box_visibility==='always'){if((this.floatingBox.children().length===0||this.floatingBox.text().trim()==='')&&!this.is_nks_alt){this.floatingBox.hide()}else{this.floatingBox.show()}
79return}
80if(TMEPOJS.floating_totals_box_visibility==='hideafterscroll'){if(jWindow.scrollTop()>
80$.epoAPI.math.toFloat(TMEPOJS.floating_totals_box_pixels)&&!this.is_nks_alt){if(!this.floatingBox.is(':hidden')){if(this.is_nks===!1){this.floatingBox.fadeOut()}else{this.floatingBox.hide()}}}else if(this.floatingBox.is(':hidden')||this.is_nks_alt){if(!(this.floatingBox.children().length===0||this.floatingBox.text().trim()==='')||this.is_nks_alt){if(this.is_nks===!1){this.floatingBox.fadeIn()}else{this.floatingBox.show()}}}}
81if(TMEPOJS.floating_totals_box_visibility==='afterscroll'){if(jWindow.scrollTop()>$.epoAPI.math.toFloat(TMEPOJS.floating_totals_box_pixels)||this.is_nks_alt){if((this.floatingBox.is(':hidden')&&!(this.floatingBox.children().length===0||this.floatingBox.text().trim()===''))||this.is_nks_alt){if(this.is_nks===!1){this.floatingBox.fadeIn()}else{this.floatingBox.show()}}else if(!this.floatingBox.is(':hidden')&&(this.floatingBox.children().length===0||this.floatingBox.text().trim()==='')){if(this.is_nks===!1){this.floatingBox.fadeOut()}else{this.floatingBox.hide()}}}else if(!this.floatingBox.is(':hidden')){if(this.is_nks===!1){this.floatingBox.fadeOut()}else{this.floatingBox.hide()}}}},addEvents:function(){this.onUpdate();this.main_cart.on('tm-epo-after-update',this.onUpdate.bind(this));this.main_cart.on('tm-epo-short-update',this.onUpdate.bind(this));if(this.is_nks===!1){jWindow.on('scroll',this.onUpdateScroll.bind(this))}},init:function(){this.floatingBox=$('<div class="tm-floating-box '+TMEPOJS.floating_totals_box+'"></div>');this.nks_selector=$('.tm-floating-box-nks').first();this.alt_selector=$('.tm-floating-box-alt').first();this.engineTemplate=tcAPI.templateEngine.tc_floating_box;this.is_nks=!1;this.is_nks_alt=!1;if(this.nks_selector.length>0){this.is_nks=!0;this.floatingBox.removeClass('top left right bottom').appendTo(this.nks_selector).show()}else if(this.alt_selector.length>0){this.floatingBox.removeClass('top left right bottom').appendTo(this.alt_selector).hide()}else{this.floatingBox.appendTo('body').hide()}
82if(this.nks_selector.length>0||this.alt_selector.length>0){this.is_nks_alt=!0;this.engineTemplate=tcAPI.templateEngine.tc_floating_box_nks}
83this.addEvents()}};$.tcFloatingTotalsBox=function(this_epo_totals_container,is_quickview,main_cart){var data=!1;if(this_epo_totals_container&&this_epo_totals_container.length&&this_epo_totals_container.data('tcfloatingtotalsbox')===undefined){data=new FloatingTotalsBox(this_epo_totals_container,is_quickview,main_cart);this_epo_totals_container.data('tcfloatingtotalsbox',data)}
84return data};$.tc_product_image={};$.tc_product_image_store={};$.tc_replace_object_values=function(obj1,obj2){Object.keys(obj1).forEac
84h(function(x){Object.keys(obj1[x]).forEach(function(attr){if(undefined!==obj2[x]&&undefined!==obj2[x][attr]&&Object.prototype.hasOwnProperty.call(obj2[x],attr)){obj1[x][attr]=obj2[x][attr]}})});return obj1};$.tc_maybe_copy_object_values=function(obj1,obj2){Object.keys(obj2).forEach(function(x){Object.keys(obj2[x]).forEach(function(attr){if(undefined!==obj2[x]&&Object.prototype.hasOwnProperty.call(obj2[x],attr)&&undefined!==obj2[x][attr]&&(undefined===obj1[x]||undefined===obj1[x][attr])){if(undefined===obj1[x]){obj1[x]={}}
85obj1[x][attr]=obj2[x][attr]}})});return obj1};$.tc_pre_populate_store=function(){var obj={};obj[0]={};obj[1]={};obj[2]={};obj[3]={};obj[0].src='';obj[0].srcset='';obj[0].sizes='';obj[0].title='';obj[0].alt='';obj[0]['data-src']='';obj[0]['data-large_image']='';obj[0]['data-large_image_width']='';obj[0]['data-large_image_height']='';obj[1]['data-thumb']='';obj[2].src='';obj[3].href='';obj[3].title='';return obj};$.tc_populate_store=function(img,product_element){var $gallery_img=product_element.find('.flex-control-nav li:eq(0) img');var $gallery_wrapper=product_element.find('.woocommerce-product-gallery__wrapper ');var $product_img_wrap=$gallery_wrapper.find('.woocommerce-product-gallery__image, .woocommerce-product-gallery__image--placeholder').eq(0);var $product_img=img;var $product_link=img.closest('a');var obj={};obj[0]={};obj[1]={};obj[2]={};obj[3]={};obj[0].src=$product_img.attr('src');obj[0].srcset=$product_img.attr('srcset');obj[0].sizes=$product_img.attr('sizes');obj[0].title=$product_img.attr('title');obj[0].alt=$product_img.attr('alt');obj[0]['data-src']=$product_img.attr('data-src');obj[0]['data-large_image']=$product_img.attr('data-large_image');obj[0]['data-large_image_width']=$product_img.attr('data-large_image_width');obj[0]['data-large_image_height']=$product_img.attr('data-large_image_height');obj[1]['data-thumb']=$product_img_wrap.attr('data-thumb');obj[2].src=$gallery_img.attr('src');obj[3].href=$product_link.attr('href');obj[3].title=$product_link.attr('title');return obj};$.tc_maybe_copy_object_values_from_img=function(obj1,img,product_element){var $gallery_img=product_element.find('.flex-control-nav li:eq(0) img');var $gallery_wrapper=product_element.find('.woocommerce-product-gallery__wrapper');var $product_img_wrap=$gallery_wrapper.find('.woocommerce-product-gallery__image, .woocommerce-product-gallery__image--placeholder').eq(0);var $product_img=img;var $product_link=img.closest('a');var all=[$product_img,$product_img_wrap,$gallery_img,$product_link];var attrs_all=[['src','srcset','sizes','title','alt','data-src','data-large_image','data-large_image_width','data-large_image_height','large-image'],['data-thumb'],['src'],['href','title']];var i;var item;var attrs;var attr;var j;for(i=0;i<all.length;i++){item=all[i];if(item&&item[0]){attrs=item[0].attributes;for(j=0;j<attrs.length;j++){attr=attrs[j];if(attr.specified&&attrs_all[i].indexOf(attr.name)!==-1){if(obj1[i]===undefined||(obj1[i]!==undefined&&obj1[i][attr.name]===undefined)){if(undefined===obj1[i]){obj1[i]={}}
86obj1[i][attr.name]=attr.value}}}}}
87return obj1};$.fn.tc_set_attr=function(attr,value,id){if(undefined===id){id=0}
88if(undefined===$.tc_product_image[id]||(undefined!==$.tc_product_image[id]&&undefined===$.tc_product_image[id][attr])){if(undefined===$.tc_product_image[id]){$.tc_product_image[id]={}}
89$.tc_product_image[id][attr]='';if(this.attr(attr)){$.tc_product_image[id][attr]=this.attr(attr)}}
90if(!1===value){this.removeAttr(attr)}else{this.attr(attr,value)}};$.fn.tc_reset_attr=function(attr,id){if(undefined===id){id=0}
91if(undefined===$.tc_product_image[id]){return}
92if(undefined!==$.tc_product_image[id][attr]){this.attr(attr,$.tc_product_image[id][attr])}
93delete $.tc_product_image[id][attr]};$.fn.tc_update_attr=function(attr,id){if(undefined===id){id=0}
94if(undefined!==$.tc_product_image[id]){$.tc_product_image[id][attr]=this.attr(attr)}};$.fn.tc_image_update=function(dom,image){var element=$(dom);var $form=this;var $image=$(image);var epo_object=$form.data('epo_object');var image_info;var $product_img;var product_element=epo_object.main_product.closest('#product-'+epo_object.product_id);var $product_element=product_element;var $product_img_thumb;var $product_link;var use_image_info;if(product_element.length<=0){$product_element=epo_object.main_product.closest('.post-'+epo_object.product_id)}
95$product_img_thumb=$product_element.find('.flex-control-nav li:eq(0) img');if(element.is('select')){element=element.children('option:selected')}
96image_info=element.data('image-variations');if(TMEPOJS.tm_epo_global_product_image_selector!==''){$product_img=$(TMEPOJS.tm_epo_global_product_image_selector)}else{$product_img=$product_element.find('a.woocommerce-main-image img, img.woocommerce-main-image,a img').not('.thumbnails img,.product_list_widget img,img.emoji,a.woocommerce-product-gallery__trigger img').first()}
97$product_link=$product_img.closest('a');if($product_img.length>1){$product_img=$product_img.first()}
98if(element&&image_info&&$image.length>0){$image.removeAttr('data-o_src').removeAttr('data-o_title').removeAttr('data-o_alt').removeAttr('data-o_srcset').removeAttr('data-o_sizes').removeAttr('srcset').removeAttr('sizes');use_image_info=image_info.imagep;if(!image_info.imagep.image_link){use_image_info=image_info.image}
99$image.attr('title',use_image_info.image_title);$image.attr('alt',use_image_info.image_alt);if(use_image_info.image_srcset){$image.attr('srcset',use_image_info.image_srcset)}
100if(use_image_info.image_sizes){$image.attr('sizes',use_image_info.image_sizes)}
101$product_img.tc_set_attr('title',use_image_info.image_title);$product_img.tc_set_attr('alt',use_image_info.image_alt);$product_img.tc_set_attr('data-large-image',use_image_info.image_link);if($product_img.data.wc27_zoom_target){$product_img.data.wc27_zoom_target.tc_set_attr('data-thumb',use_image_info.image_link);$product_img_thumb.tc_set_attr('src',use_image_info.image_link);if(use_image_info.image_srcset){$product_img_thumb.tc_set_attr('srcset',use_image_info.image_srcset)}
102if(use_image_info.image_sizes){$product_img_thumb.tc_set_attr('sizes',use_image_info.image_sizes)}}
103$product_link.tc_set_attr('href',use_image_info.image_link);$product_link.tc_set_attr('title',use_image_info.image_caption)}else{$product_img.tc_reset_attr('title');$product_img.tc_reset_attr('alt');$product_img.tc_reset_attr('data-large-image');if($product_img.data.wc27_zoom_target){$product_img.data.wc27_zoom_target.tc_reset_attr('data-thumb');$product_img_thumb.tc_reset_attr('src');$product_img_thumb.tc_reset_attr('srcset');$product_img_thumb.tc_reset_attr('sizes')}
104$product_link.tc_reset_attr('href');$product_link.tc_reset_attr('title')}};$.fn.tm_find_matching_variations=function(product_variations,settings){var matching=[];var i;var variation;if(product_variations){for(i=0;i<product_variations.length;i+=1){variation=product_variations[i];if($.fn.tm_variations_match(variation.attributes,settings)){matching.push(variation)}}}
105return matching};$.fn.tm_variations_match=function(attrs1,attrs2){var match=!0;var val1;var val2;
105Object.keys(attrs1).forEach(function(x){if(Object.prototype.hasOwnProperty.call(attrs1,x)){val1=attrs1[x];val2=attrs2[x];if(val1!==undefined&&val2!==undefined&&val1.length!==0&&val2.length!==0&&val1!==val2){match=!1}}});return match};function get_element_from_field(element,ckey){var $element=$(element);var data_uniqid;var the_epo_id;var _class;var epoContainer;if($element.length===0){return}
106if($element.is('.cpf-section')){return element.find('.tm-epo-field')}
107data_uniqid=$element.attr('data-uniqid');epoContainer=$element.closest(tcAPI.epoSelector);the_epo_id=epoContainer.attr('data-epo-id');if(!epoContainer.is('.reactivate')&&tcAPI.getElementFromFieldCache&&tcAPI.getElementFromFieldCache[the_epo_id]&&tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid]&&tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey]){return tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey]}
108_class=$element.attr('class').split(' ').map(function(cls){if(cls.indexOf('cpf-type-',0)!==-1){return cls}
109return null}).filter(function(v){if(v!==null&&v!==undefined){return v}
110return null});if(_class.length>0){_class=_class[0];if(_class==='cpf-type-product'){if($element.is('.cpf-type-product-mode-product')||$element.is('.cpf-type-product-checkbox')||$element.is('.cpf-type-product-thumbnailmultiple')||$element.is('.cpf-type-product-custombundle')){_class='cpf-type-checkbox'}else if($element.is('.cpf-type-product-dropdown')){_class='cpf-type-select'}else{_class='cpf-type-radio'}}
111if(tcAPI.getElementFromFieldCache[the_epo_id]===undefined){tcAPI.getElementFromFieldCache[the_epo_id]=[]}
112if(tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid]===undefined){tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid]=[]}
113switch(_class){case 'cpf-type-radio':tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey]=$element.find('.tm-epo-field.tmcp-radio');return tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey];case 'cpf-type-checkbox':tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey]=$element.find('.tm-epo-field.tmcp-checkbox');return tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey];case 'cpf-type-select':tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey]=$element.find('.tm-epo-field.tmcp-select');return tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey];case 'cpf-type-selectmultiple':tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey]=$element.find('.tm-epo-field.tmcp-selectmultiple');return tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey];case 'cpf-type-textarea':tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey]=$element.find('.tm-epo-field.tmcp-textarea');return tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey];case 'cpf-type-textfield':tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey]=$element.find('.tm-epo-field.tmcp-textfield');return tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey];case 'cpf-type-color':tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey]=$element.find('.tm-epo-field.tm-color-picker');return tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey];case 'cpf-type-range':tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey]=$element.find('.tm-epo-field.tmcp-range');return tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey];case 'cpf-type-date':tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey]=$element.find('.tm-epo-field.tmcp-date');return tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey];case 'cpf-type-time':tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey]=$element.find('.tm-epo-field.tmcp-time');return tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey];case 'cpf-type-variations':tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey]=$element.closest('.cpf-section').find('.tm-epo-field.tm-epo-variation-element');return tcAPI.getElementFromFieldCache[the_epo_id][data_uniqid][ckey]}}}
114if(!$().tclightbox){$.fn.tclightbox=function(){var elements=this;if(elements.length===0){return}
115return elements.toArray().forEach(function(lb){var $this=$(lb);var _imgsrc;var _label;var _input;var tclightboxwrap;var _img_button;var preload_img;var addButtonEvent;if($this.is('.tcinit')){return}
116_imgsrc=$this.attr('src')||$this.attr('data-original');_label=$this.closest('label');_input=_label.closest('.tmcp-field-wrap').find(".tm-epo-field[id='"+_label.attr('for')+"']");_imgsrc=$this.attr('data-large_image')||_input.attr('data-imagel')||_input.attr('data-imagep')||_input.attr('data-image')||_imgsrc;if(!_imgsrc){return}
117$this.addClass('tcinit').before($.epoAPI.template.html(tcAPI.templateEngine.tc_lightbox,{}));tclightboxwrap=$this.prev();$this.wrap("<div class='tc-lightbox-image-wrap'/>");$this.after(tclightboxwrap);_img_button=tclightboxwrap.find('.tc-lightbox-button');addButtonEvent=function(){_img_button.addClass('tcinit').on('click.tclightbox',function(buttonevent){var size;var _img;if($('.tc-closing.tc-lightbox').length>0){return}
118size=$.epoAPI.dom.size();_img=$('<img>').addClass('tc-lightbox-img').attr('src',_imgsrc).css('maxHeight',size.visibleHeight+'px').css('maxWidth',size.visibleWidth+'px');$.tcFloatBox({fps:1,ismodal:!1,width:'auto',height:'auto',classname:'flasho tc-lightbox',animateIn:'tc-lightbox-zoomin',animateOut:'tc-lightbox-zoomout',data:$.epoAPI.template.html(tcAPI.templateEngine.tc_lightbox_zoom,{img:_img[0].outerHTML}),zIndex:102001,cancelClass:'.tc-lightbox-img, .tc-lightbox-button-close',unique:!0});buttonevent.preventDefault()})};if(TMEPOJS.tm_epo_preload_lightbox_image==='yes'){preload_img=new Image();preload_img.src=_imgsrc;preload_img.onload=function(){addButtonEvent()}}else{addButtonEvent()}})}}
119if(!$().tmsectionpoplink){$.fn.tmsectionpoplink=function(){var elements=this;if(elements.length===0){return}
120return elements.toArray().forEach(function(pl){var $this=$(pl);var id;var title;var section;var clicked;var cancelfunc;var cancelpop;if($this.data('tmsectionpoplink')){return}
121$this.data('tmsectionpoplink',!0);id=$this.attr('data-sectionid');title=TMEPOJS.i18n_addition_options;section=$this.closest(".cpf-section[data-uniqid='"+id+"']");clicked=!1;cancelfunc=function(){var pop=$('#tm-section-pop-up');pop.parents().removeClass('noanimated');pop.after(section);pop.remove();section.find('.tm-section-link').show();section.find('.tm-section-pop').hide()};cancelpop=function(e){if(e.target===$('.flasho')[0]||$(e.target).closest('.flasho').length){return}
122cancelfunc()};if($this.attr('data-title')){title=$this.attr('data-title')}
123$this.on('click.tmsectionpoplink',function(e){var pop;e.preventDefault();clicked=!1;section.before($.epoAPI.template.html(tcAPI.templateEngine.tc_section_pop_link,{title:title,close:TMEPOJS.i18n_close}));pop=$('#tm-section-pop-up');pop.on('click',cancelpop);pop.find('.float-editbox').prepend(section);section.find('.tm-section-link').hide();section.find('.tm-section-pop').show();pop.parents().addClass('noanimated');pop.find('.floatbox-cancel').on('click',function(){if(clicked){return}
124clicked=!0;cancelfunc()});jWindow.trigger('tmlazy');jWindow.trigger('tmsectionpoplink')})})}}
125function getVariationIdSelector(currentCart){var variationIdSelector="input[name^='variation_id']";if(currentCart.find('input.variation_id').length>0){variationIdSelector='input.variation_id'}else{variationIdSelector='input.product-variation-id'}
126return variationIdSelector}
127function getVariationIdElement(currentCart,not){var variationIdSelector=getVariationIdSelector(currentCart);var variationIdElement=currentCart.find(variationIdSelector);if(currentCart.is('.tc-epo-element-product-container-cart')){variationIdElement=currentCart.closest('.tc-epo-element-product-li-container').find(variationIdSelector)}else{variationIdElement=currentCart.find(variationIdSelector).not('.tc-epo-element-product-container-variation-id '+variationIdSelector)}
128if(not){variationIdElement=variationIdElement.not(not)}
129return variationIdElement}
130function getCurrentVariation(currentCart){var field_div;var newCart;if(currentCart.is('.tc-epo-element-product-container-cart')){field_div=currentCart.closest('.cpf-element');if(field_div.is('.cpf-type-product-thumbnailmultiple')||field_div.is('.cpf-type-product-checkbox')||field_div.is('.cpf-type-product-custombundle')){newCart=currentCart.closest('.tc-epo-element-product-holder').find('.tc-epo-element-product-container-variation-id')}else if(field_div.is('.cpf-type-product-thumbnail')||field_div.is('.cpf-type-product-radio')||field_div.is('.cpf-type-product-dropdown')||field_div.is('.cpf-type-product-single')){newCart=field_div.find('.tc-epo-element-product-container-variation-id')}
131if(newCart&&newCart.length){currentCart=newCart}}
132return currentCart.find(getVariationIdSelector(currentCart)).val()||0}
133function getQtyElement(currentCart){var qty=currentCart.find(tcAPI.qtySelector).last();if(qty.length===0){qty=currentCart.find(tcAPI.associateQtySelector).last()}
134qty=$.epoAPI.applyFilter('tc_getQtyElement',qty,currentCart);return qty}
135function getCurrentQty(currentCart){return $.epoAPI.applyFilter('tc_getCurrentQty',$.epoAPI.math.toFloat
135(getQtyElement(currentCart).val()),currentCart)}
136function add_variation_event(name,selector,func){lateVariationEvent[lateVariationEvent.length]={name:name,selector:selector,func:func}}
137function field_is_active(field,nochecks,single,simpleCheck){var ret=!0;var insideProductCheck=!1;var productElement;field=$(field);productElement=field.filter('.tc-epo-field-product');if(productElement.length&&productElement.data('islogicinit')===undefined){insideProductCheck=!0}
138field.toArray().forEach(function(element){if(!ret&&field.has('.tc-epo-field-product').length){if(insideProductCheck||productElement.is('.tcdisabled')){if(simpleCheck){field_check_active_simple(element)}else{field_check_active(element,nochecks,single,simpleCheck)}}}else if(simpleCheck){ret=field_check_active_simple(element)}else{ret=field_check_active(element,nochecks,single,simpleCheck)&&ret}});return ret}
139function field_check_active_simple(field){var hideElement;var isInsideProductElement;var productElementActive;var productElementSectionActive;var section;field=$(field);if(field.is('.cpf-element')){hideElement=field;field=field.find('.tmcp-field, .tmcp-fee-field')}else{hideElement=field.closest('.cpf-element')}
140section=hideElement.closest('.cpf-section');isInsideProductElement=!field.is('.tc-epo-field-product')&&hideElement.closest('.cpf-type-product');if(isInsideProductElement.length){productElementActive=isInsideProductElement.data('isactive');isInsideProductElement=isInsideProductElement.closest('.cpf-section');productElementSectionActive=isInsideProductElement.data('isactive')}
141if(productElementActive!==!1&&productElementSectionActive!==!1&&hideElement.data('isactive')!==!1&&section.data('isactive')!==!1){return!0}
142return!1}
143function field_check_active(field,nochecks,single){var hideElement;var singleField;var ul;var isInsideProductElement;var productElementActive;var productElementSectionActive;var productElementQty;var section;var disableElements;var sectionLi;var allSectionsDisabled;var tabSlide;var epoFields;field=$(field);if(field.is('.cpf-element')){hideElement=field;field=field.find('.tmcp-field, .tmcp-fee-field')}else{hideElement=field.closest('.cpf-element')}
144section=hideElement.closest('.cpf-section');sectionLi=section.closest('.tm-extra-product-options-field');if(single){ul=field.closest('.tmcp-ul-wrap')}else{ul=hideElement}
145if(field.is('.tc-epo-field-product')&&field.data('islogicinit')===undefined){field.data('islogicinit',1)}
146if(!field.is('.tc-force-disabled')){isInsideProductElement=!field.is('.tc-epo-field-product')&&hideElement.closest('.cpf-type-product');if(isInsideProductElement.length){productElementQty=isInsideProductElement.find(tcAPI.associateQtySelector);if(productElementQty.length){if($.epoAPI.math.toFloat(productElementQty.val())>0){field.removeClass('ignore');productElementQty.removeClass('ignore')}else{field.addClass('ignore');productElementQty.addClass('ignore')}}
147productElementActive=isInsideProductElement.data('isactive');isInsideProductElement=isInsideProductElement.closest('.cpf-section');productElementSectionActive=isInsideProductElement.data('isactive')}
148if(productElementActive!==!1&&productElementSectionActive!==!1&&hideElement.data('isactive')!==!1&&section.data('isactive')!==!1){singleField=field.first();field.prop('disabled',!1);if(field.data('tc-state')!==undefined){field.data('tc-state',!1)}
149if(TMEPOJS.tm_epo_show_only_active_quantities!=='yes'){if(singleField.is(':radio, .cpf-type-radio')||singleField.is(':checkbox, .cpf-type-checkbox')){field.filter(':checked').closest('.tmcp-field-wrap').find('.tm-qty, .tc-qty-button').prop('disabled',!1);field.not(':checked').closest('.tmcp-field-wrap').find('.tm-qty, .tc-qty-button').prop('disabled',!0)}else if(singleField.is('select, .cpf-type-select, .cpf-type-selectmultiple')){if(singleField.val()){ul.find('.tm-qty, .tc-qty-button').prop('disabled',!1)}else{ul.find('.tm-qty, .tc-qty-button').prop('disabled',!0)}}else if(singleField.val()){ul.find('.tm-qty, .tc-qty-button').prop('disabled',!1)}else{ul.find('.tm-qty, .tc-qty-button').prop('disabled',!0)}}else if(!nochecks){hideElement.find('.tm-quantity').trigger('showhide.cpfcustom')}
150if(!singleField.is('.cpf-element')){field.removeClass('tcdisabled').addClass('tcenabled');
150if(field.is('.tmcp-upload')){if(field.next('.tmcp-upload-hidden').length){field.next('.tmcp-upload-hidden').removeClass('tcdisabled').addClass('tcenabled').prop('disabled',!1)}}}
151hideElement.removeClass('tc-container-disabled').addClass('tc-container-enabled');hideElement.find('.product-variation-id, .tc-epo-field-product-counter').prop('disabled',!1);field.trigger({type:'tm-field-is-active',field:field,value:!0});section.removeClass('section-disabled');sectionLi.removeClass('tc-hidden');hideElement.closest('.owl-item').removeClass('tc-hidden-visibility');return!0}}
152if(!field.is('.cpf-element')){field.prop('disabled',!0).removeClass('tcenabled').addClass('tcdisabled');if(field.data('tc-state')!==undefined){field.data('tc-state',!0)}
153hideElement.find('.tm-qty, .tc-qty-button').prop('disabled',!0);if(field.is('.tmcp-upload')){if(field.next('.tmcp-upload-hidden').length){field.next('.tmcp-upload-hidden').removeClass('tcenabled').addClass('tcdisabled').prop('disabled',!0)}}}
154if(field.is('.tc-force-disabled')){epoFields=hideElement.find('.tmcp-field, .tmcp-fee-field');if(epoFields.length!==epoFields.filter('.tc-force-disabled').length){return!1}}
155hideElement.removeClass('tc-container-enabled').addClass('tc-container-disabled');hideElement.find('.product-variation-id, .tc-epo-field-product-counter').prop('disabled',!0);field.trigger({type:'tm-field-is-active',field:field,value:!1});disableElements=section.find('.cpf-element.tc-container-enabled').length===0;if(disableElements){section.addClass('section-disabled');allSectionsDisabled=sectionLi.children('.cpf-section').filter(function(){return!$(this).hasClass('section-disabled')}).length===0;if(allSectionsDisabled){sectionLi.addClass('tc-hidden')}}
156tabSlide=hideElement.closest('.tc-tab-slide').find('.cpf-element.tc-container-enabled').length===0;if(tabSlide){hideElement.closest('.owl-item').addClass('tc-hidden-visibility')}
157return!1}
158function tm_variation_check_match(element,val2,operator){var $element=$(element);var epoId=$element.attr('data-epo_id')||$element.attr('data-epo-id');var productId=$element.attr('data-product_id')||$element.attr('data-product-id');var variationsForm=$('.variations_form[data-epo_id="'+epoId+'"][data-product_id="'+productId+'"]');var val1;var variationIdSelector='input[name^="variation_id"]';var $variationId;variationsForm=$.epoAPI.applyFilter('tm_variation_check_match_variationsForm',variationsForm,epoId,productId,$element);if($element.attr('data-product_type')==='variation'){variationsForm=$element;$variationId=productId}
159if(variationsForm.length===0&&$element.is('.cpf-type-variations')&&!epoId&&!productId){variationsForm=$element.closest('.tc-epo-element-product-container');if(variationsForm.length){productId=variationsForm.attr('data-product_id');$variationId=productId}}
160if(variationsForm.length===0){return!1}
161if(!$variationId){$variationId=variationsForm.find(variationIdSelector);if($variationId.length===0){variationIdSelector='input.variation_id';$variationId=variationsForm.find(variationIdSelector);if($variationId.length===0){$variationId=variationsForm.closest('.tc-epo-element-product-li-container').find('.product-variation-id')}}
162if($variationId.length){$variationId=$variationId.val()}else{$variationId=0}}
163if(element!==null&&val2!==null&&element!==undefined&&val2!==undefined&&element!==!1&&val2!==!1){if(val2){val2=parseInt(val2,10)}else{val2=-1}}
164val1=parseInt($variationId,10);if(!Number.isFinite(val1)){val1=0}
165if(!Number.isFinite(val2)){val2=0}
166switch(operator){case 'is':return val1!==''&&val1===val2;case 'isnot':return val1!==''&&val1!==val2;case 'isempty':return val1===''||val1===0;case 'isnotempty':return val1!==''&&val1!==0;case 'startswith':return val1.toString().startsWith(val2);case 'endswith':return val1.toString().endsWith(val2);case 'greaterthan':return parseFloat(val1)>parseFloat(val2);case 'lessthan':return parseFloat(val1)<parseFloat(val2);case 'greaterthanequal':return parseFloat(val1)>=parseFloat(val2);case 'lessthanequal':return parseFloat(val1)<=parseFloat(val2)}
167return!1}
168function tm_variationattributes_check_match(element,rule){var $element=$(element);var val2=rule.value;var operator=rule.operator;var epoId=$element.attr('data-epo_id')||$element.attr('data-epo-id');var productId=$element.attr('data-product_id')||$element.attr('data-product-id');var variationsForm=$('.variations_form[data-epo_id="'+epoId+'"][data-product_id="'+productId+'"]');var val1;var $att;variationsForm=$.epoAPI.applyFilter('tm_variation_check_match_variationsForm',variationsForm,epoId,productId,$element);if($element.attr('data-product_type')==='variation'){variationsForm=$element}
169if(variationsForm.length===0&&$element.is('.cpf-type-variations')&&!epoId&&!productId){variationsForm=$element.closest('.tc-epo-element-product-container');if(variationsForm.length){productId=variationsForm.attr('data-product_id')}}
170if(variationsForm.length===0){return!1}
171$att=variationsForm.find('[name="attribute_'+rule.taxonomy+'"]');if(!$att.length){return!1}
172val1=$att.find('option:selected').attr('value');switch(operator){case 'is':return val1!==''&&val1===val2;case 'isnot':return val1!==''&&val1!==val2;case 'isempty':return val1===''||val1===0;case 'isnotempty':return val1!==''&&val1!==0;case 'startswith':return val1.toString().startsWith(val2);case 'endswith':return val1.toString().endsWith(val2)}
173return!1}
174function tm_check_match(val1,val2,operator){if(val1!==null&&val2!==null){val1=encodeURIComponent(val1);if($.qtranxj_split){val2=encodeURIComponent($.qtranxj_split(decodeURIComponent(val2))[TMEPOQTRANSLATEXJS.language])}else{val2=encodeURIComponent(decodeURIComponent(val2))}
175if(val1){val1=val1.toLowerCase()}else{val1=''}
176if(val2){val2=val2.toLowerCase()}else{val2=''}}else{return!1}
177val1=val1.toString();val2=val2.toString();switch(operator){case 'is':return val1!==null&&val1===val2;case 'isnot':return val1!==null&&val1!==val2;case 'isempty':return!(val1!=='undefined'&&val1!==undefined&&val1!=='');case 'isnotempty':return val1!=='undefined'&&val1!==undefined&&val1!=='';case 'startswith':return val1.startsWith(val2);case 'endswith':return val1.endsWith(val2);case 'greaterthan':return parseFloat(val1)>parseFloat(val2);case 'lessthan':return parseFloat(val1)<parseFloat(val2);case 'greaterthanequal':return parseFloat(val1)>=parseFloat(val2);case 'lessthanequal':return parseFloat(val1)<=parseFloat(val2)}
178return!1}
179function tm_check_section_match(elements,operator){var any_checked;var val;var all_elements=elements.find('.cpf-element');var radio_checked;var checkbox_checked;var noSplit=!1;if(elements.is('.tc-hidden')){if(operator==='isnotempty'){return!1}else if(operator==='isempty'){return!0}}
180if(operator==='isnotempty'){any_checked=!1}
180else if(operator==='isempty'){any_checked=!0}
181$(all_elements).toArray().forEach(function(element){var _class;var elementToCheck='';element=$(element);if(element.is('.cpf-type-product')){elementToCheck=':not('+tcAPI.associatedEpoSelector+' .tm-epo-field)'}
182if(field_is_active(element,undefined,undefined,!0)){_class=element.attr('class').split(' ').map(function(cls){if(cls.indexOf('cpf-type-',0)!==-1){return cls}
183return null}).filter(function(v){if(v!==null&&v!==undefined){return v}
184return null});if(_class.length>0){_class=_class[0];if(_class==='cpf-type-product'){noSplit=!0;if(element.is('.cpf-type-product-mode-product')||element.is('.cpf-type-product-checkbox')||element.is('.cpf-type-product-thumbnailmultiple')||element.is('.cpf-type-product-custombundle')){_class='cpf-type-checkbox'}else if(element.is('.cpf-type-product-dropdown')){_class='cpf-type-select'}else{_class='cpf-type-radio'}}
185switch(_class){case 'cpf-type-radio':radio_checked=element.find('input.tm-epo-field.tmcp-radio:checked'+elementToCheck);if(operator==='isnotempty'){any_checked=any_checked||radio_checked.length>0;if(radio_checked.length>0){val=radio_checked.length}}else if(operator==='isempty'){any_checked=any_checked&&radio_checked.length===0}
186break;case 'cpf-type-checkbox':checkbox_checked=element.find('input.tm-epo-field.tmcp-checkbox:checked'+elementToCheck);if(operator==='isnotempty'){any_checked=any_checked||checkbox_checked.length>0;if(checkbox_checked.length>0){val=checkbox_checked.length}}else if(operator==='isempty'){any_checked=any_checked&&checkbox_checked.length===0}
187break;case 'cpf-type-select':val=element.find('select.tm-epo-field.tmcp-select'+elementToCheck).val();if(val&&!noSplit){val=val.slice(0,val.lastIndexOf('_'))}
188break;case 'cpf-type-selectmultiple':val=element.find('select.tm-epo-field.tmcp-selectmultiple'+elementToCheck).val();if(val&&!noSplit){val.forEach(function(option,i){val[i]=option.slice(0,option.lastIndexOf('_'))})}
189break;default:val=element.find('.tm-epo-field'+elementToCheck).val();break}
190if(Array.isArray(val)){if(operator==='isnotempty'){any_checked=any_checked||val.some(function(item){return tm_check_match(item,'',operator)})}else if(operator==='isempty'){any_checked=any_checked&&val.every(function(item){return tm_check_match(item,'',operator)})}}else if(operator==='isnotempty'){any_checked=any_checked||tm_check_match(val,'',operator)}else if(operator==='isempty'){any_checked=any_checked&&tm_check_match(val,'',operator)}}else{any_checked=!1}}});return any_checked}
191function tm_check_field_match(f){var element=f.element;var operator=f.rule.operator;var value=f.rule.value;var type=f.type;var val;var radio_checked;var checkbox_checked;var ret;var _class;var noSplit=!1;var elementToCheck='';if(type==='quantity'){return tm_check_match(element.val(),value,operator)}
192if(type==='productid'){return tm_check_match(element,value,operator)}
193if(type==='variation'){return tm_variation_check_match(element,value,operator)}
194if(type==='variationattributes'){return tm_variationattributes_check_match(element,f.rule)}
195element=$(f.element);if(!element.length){return!1}
196if(element.is('.cpf-section')){return tm_check_section_match(element,operator)}
197if(element.is('.cpf-type-product')){elementToCheck=':not('+tcAPI.associatedEpoSelector+' .tm-epo-field)'}
198_class=element.attr('class').split(' ').map(function(cls){if(cls.indexOf('cpf-type-',0)!==-1){return cls}
199return null}).filter(function(v){if(v!==null&&v!==undefined){return v}
200return null});if(_class.length>0){_class=_class[0];if(_class==='cpf-type-product'){noSplit=!0;if(element.is('.cpf-type-product-mode-product')||element.is('.cpf-type-product-checkbox')||element.is('.cpf-type-product-thumbnailmultiple')||element.is('.cpf-type-product-custombundle')){_class='cpf-type-checkbox'}else if(element.is('.cpf-type-product-dropdown')){_class='cpf-type-select'}else{_class='cpf-type-radio'}}
201switch(_class){case 'cpf-type-radio':radio_checked=element.find('input.tm-epo-field.tmcp-radio:checked'+elementToCheck);if(operator==='is'||operator==='isnot'){if(radio_checked.length===0&&operator==='is'){return!1}
202if(radio_checked.length===0&&operator==='isnot'){return!0}}
203if(operator==='isnotempty'){return radio_checked.length>0}
204if(operator==='isempty'){return radio_checked.length===0}
205val=element.find('input.tm-epo-field.tmcp-radio:checked'+elementToCheck).val();if(val&&!noSplit){val=val.slice(0,val.lastIndexOf('_'))}
206break;case 'cpf-type-checkbox':checkbox_checked=element.find('input.tm-epo-field.tmcp-checkbox:checked'+elementToCheck);if(operator==='is'||operator==='isnot'){if(checkbox_checked.length===0&&operator==='is'){return!1}
207if(checkbox_checked.length===0&&operator==='isnot'){return!0}
208ret=!1;
208checkbox_checked.toArray().forEach(function(el){val=$(el).val();if(val&&!noSplit){val=val.slice(0,val.lastIndexOf('_'))}
209if(tm_check_match(val,value,operator)){ret=!0}else if(operator==='isnot'){ret=!1;return!1}});return ret}
210if(operator==='isnotempty'){return checkbox_checked.length>0}
211if(operator==='isempty'){return checkbox_checked.length===0}
212break;case 'cpf-type-select':val=element.find('select.tm-epo-field.tmcp-select'+elementToCheck).val();if(val&&!noSplit){val=val.slice(0,val.lastIndexOf('_'))}
213break;case 'cpf-type-selectmultiple':val=element.find('select.tm-epo-field.tmcp-selectmultiple'+elementToCheck).val();if(val&&!noSplit){val.forEach(function(option,i){val[i]=option.slice(0,option.lastIndexOf('_'))})}
214break;case 'cpf-type-variations':return tm_variation_check_match(element,value,operator);default:val=element.find('.tm-epo-field'+elementToCheck).val();break}
215if(Array.isArray(val)){return val.some(function(item){return tm_check_match(item,value,operator)})}
216return tm_check_match(val,value,operator)}
217return!1}
218function tm_check_rules(o,theevent){o.toArray().forEach(function(oel){var $this=$(oel);var matches=$this.data('matches');var toggle=$this.data('toggle');var fields=$this.data('fields');var checked=[];var show=toggle!=='show';var ifield;var i;var field;var ii;var im;var sectionFields;var isInSectionRepeater;if(!fields){return}
219sectionFields=$this.closest('.tc-section-fields');isInSectionRepeater=sectionFields.is('.tc-repeater-section');for(i=0;i<fields.length;i++){ifield=fields[i];if(Array.isArray(ifield)){checked[i]=0;for(ii=0;ii<ifield.length;ii++){field=ifield[ii];if(isInSectionRepeater){field.element=sectionFields.find('[data-uniqid="'+field.element.attr('data-uniqid')+'"')}
220if(theevent!=='cpflogic'||field_is_active($(field.element),undefined,undefined,!0)){if(tm_check_field_match(field)){checked[i]=(checked[i]||0)+1}}}}}
221for(im=0;im<matches.length;im++){if(parseInt(checked[im],10)===parseInt(matches[im],10)){show=!show;break}}
222if(show){if(theevent==='cpflogic'&&!$this.data('did_initial_activation')){latecpflogicactions.push(function(){var enabledEpos=$this.find('.tm-epo-field.tcenabled');enabledEpos.toArray().forEach(function(el){el=$(el);if(!el.data('initial_activation')&&!$this.closest('.cpf-section').is('.tc-hidden')&&field_is_active(el)){el.trigger('tc_element_epo_rules');el.data('initial_activation',1)}});if(($this.is('.cpf-element')&&enabledEpos.length)||$this.is('.cpf-section')){$this.data('did_initial_activation',1)}})}
223$this.removeClass('tc-hidden')}else{$this.addClass('tc-hidden')}
224$this.data('isactive',show).trigger('tc-logic')})}
225function run_cpfdependson(obj){var iscpfdependson;var last_activate_field=[];var epo_object;if(!$(obj).length){obj='body'}
226obj=$(obj);iscpfdependson=obj.find('.iscpfdependson');iscpfdependson.toArray().forEach(function(elements){$(elements).toArray().forEach(function(el){tm_check_rules($(el))})});iscpfdependson.toArray().forEach(function(elements){$(elements).toArray().forEach(function(el){tm_check_rules($(el),'cpflogic')})});iscpfdependson.toArray().forEach(function(elements){$(elements).toArray().forEach(function(o){o=$(o);if(o.is('.cpf-section')){o=o.find('.cpf-element')}
227o.toArray().forEach(function(theelement){var $theelement=$(theelement);var $theelementepos=$theelement.find('.tm-epo-field');var len=$theelementepos.length;if(len>0){field_is_active($theelementepos)}else{field_is_active($theelement)}})})});latecpflogicactions.forEach(function(func){func()});latecpflogicactions=[];if($().selectric){$('.tm-extra-product-options select').selectric('refresh')}
228setTimeout(function(){$('.tm-owl-slider').toArray().forEach(function(slider){$(slider).trigger('refresh.owl.carousel')})},200);obj.find('.tm-product-image:checked,select.tm-product-image').toArray().forEach(function(t){t=$(t);if(field_is_active(t)&&t.val()!==''){last_activate_field.push(t)}});if(last_activate_field.length){last_activate_field[last_activate_field.length-1].trigger('tm_trigger_product_image')}else{epo_object=obj.data('epo_object');if(epo_object){epo_object.main_product.trigger('tm_restore_product_image')}}
229jWindow.trigger('cpflogicrun');jWindow.trigger('tmlazy');jWindow.trigger('cpflogicdone')}
230if(!$().cpfdependson){$.fn.cpfdependson=function(fields,toggle,refresh,epoObject){var elements=this;var matches=[];var $this_epo_container=null;var get_element;var $element;var $pid1;var $epo_id1;var _events;var $container;var i;var ii;var iii;var e;var ifield;var field;var $this;var show;var sectionFields;var isInSectionRepeater;if(!elements.length||typeof fields!=='object'){return}
231if(!toggle){toggle='show'}
232sectionFields=elements.first().closest('.tc-section-fields');isInSectionRepeater=sectionFields.is('.tc-repeater-section');for(i=0;i<fields.length;i++){matches[i]=0;ifield=fields[i];if(Array.isArray(ifield)){for(ii=0;ii<ifield.length;ii++){field=ifield[ii];if(typeof field!=='object'){continue}
233if(isInSectionRepeater){field.element=sectionFields.find('[data-uniqid="'+field.element.attr('data-uniqid')+'"')}
234if(field.type==='quantity'){if(!field.element.data('didcpflogic')){_events='change.cpflogic input.cpflogic';field.element.off(_events).on(_events,function(){run_cpfdependson(epoObject.this_epo_container)}).data('didcpflogic',1)}}else if(field.type==='variation'||field.type==='variationattributes'){add_variation_event('found_variation.tmlogic',!1,function(){run_cpfdependson(field.element);jWindow.trigger('tm-do-epo-update')});add_variation_event('hide_variation.tmlogic',!1,function(){run_cpfdependson(field.element);jWindow.trigger('tm-do-epo-update')})}else{get_element=get_element_from_field(field.element,isInSectionRepeater?sectionFields.index():0);if(get_element&&get_element.length>0){for(iii=0;iii<get_element.length;iii++){if(!get_element[iii]){continue}
235$element=$(get_element[iii]);if($element.length===0){continue}
236_events='change.cpflogic';if(!$this_epo_container||$this_epo_container.closest(tcAPI.associatedEpoSelector).length){$container=$element.closest(tcAPI.epoSelector);$pid1='.tm-product-id-'+$container.attr('data-product-id');$epo_id1="[data-epo-id='"+$container.attr('data-epo-id')+"']";$this_epo_container=$(tcAPI.epoSelector+$pid1+$epo_id1)}
237if(!$element.data('tmhaslogicevents')||refresh){if(!$element.data('tmhaslogicevents')&&$element.is('.tm-epo-variation-element')){add_variation_event('found_variation.tmlogic',!1,function(){run_cpfdependson($this_epo_container);jWindow.trigger('tm-do-epo-update')});add_variation_event('hide_variation.tmlogic',!1,function(){run_cpfdependson($this_epo_container);jWindow.trigger('tm-do-epo-update')})}else{if($element.is(':text, textarea')){_events='change.cpflogic input.cpflogic'}
238if($element.is(':input[type="number"]')){_events='change.cpflogic input.cpflogic keypress.cpflogic'}
239$element.off(_events).on(_events,function(){run_cpfdependson($this_epo_container)})}
240$element.data('tmhaslogicevents',1)}}}}
241matches[i]++}}}
242for(e=0;e<elements.length;e++){$this=$(elements[e]);show=toggle==='hide';$this.data({matches:matches,toggle:toggle,fields:fields,isactive:show});if(show){$this.removeClass('tc-hidden')}else{$this.addClass('tc-hidden')}}
243elements.addClass('iscpfdependson is-epo-depend').data('iscpfdependson',1);return elements};$.fn.run_cpfdependson=function(){run_cpfdependson()}}
244$.tcepo={formSubmitEvents:{},oneOptionIsSelected:{},initialActivation:{},lateFieldsPrices:{},errorObject:{},showHideTotal:{}};function validate_logic(l){return typeof l==='object'&&'toggle' in l&&'rules' in l&&l.rules.length>0}
245function convert_rules(rules){if(rules.what){if(rules.what==='all'){rules.rules=[rules.rules]}else if(rules.what==='any'){rules.rules=rules.rules.reduce(function(accumulator,elrule){accumulator.push([elrule]);return accumulator},[])}
246delete rules.what}
247return rules}
248function getLogicType(section,element){var type='element';if(section==='product-properties'){switch(String(element)){case '0':type='quantity';break;case '1':type='productid';break;case '2':type='variation';break;case '3':type='variationattributes';break}}
249return type}
250function cpf_section_logic(epoObject){var obj=epoObject.this_epo_container;var root_element=$(obj);var all_sections=root_element.find('.cpf-section').not('.cpf-type-product .cpf-section');var search_obj;var cpf_section;var sect;var logic;var haslogic;var fields;var section;var element;var type;var obj_section;var obj_element;var closestProductElement;var selector='[data-haslogic="1"]';if(root_element.is('.cpf-section')){search_obj=!1}else{search_obj=all_sections}
251if(!epoObject.is_associated){selector='[data-haslogic="1"]:not(".cpf-type-product .cpf-section")'}
252root_element.toArray().forEach(function(obj_el){if($(obj_el).is('.cpf-section')){cpf_section=$(obj_el)}else{cpf_section=$(obj_el).find('.cpf-section')}
253cpf_section.filter(selector).toArray().forEach(function(el){var irule;var rule;var i;var ii;sect=$(el);logic=sect.data('logic');logic=convert_rules(logic);haslogic=parseInt(sect.data('haslogic'),10);fields=[];closestProductElement=sect.parent().closest('.cpf-type-product');if(haslogic===1&&validate_logic(logic)){for(i=0;i<logic.rules.length;i++){irule=logic.rules[i];if(!irule||!Array.isArray(irule)){continue}
254fields[i]=[];for(ii=0;ii<irule.length;ii++){rule=irule[ii];section=rule.section;element=rule.element;type=getLogicType(section,element);if(type==='quantity'){if(closestProductElement.length){obj_element=epoObject.main_cart.find(tcAPI.associateQtySelector)}else{obj_element=epoObject.main_cart.find(epoObject.qtySelector)}}else if(type==='productid'){obj_element=epoObject.product_id}else if(type==='variation'||type==='variationattributes'){if(closestProductElement.length){obj_element=closestProductElement.find('.tc-epo-element-product-container');if(!obj_element.length){obj_element=closestProductElement.closest('.tc-epo-element-product-container')}}else{obj_element=root_element}}else if(search_obj){if(closestProductElement.length){obj_section=root_element.find('.cpf-section').filter("[data-uniqid='"+section+"']");if(element!==section){obj_element=obj_section.find('.cpf-element').eq(element)}else{obj_element=obj_section}}else{obj_section=search_obj.filter("[data-uniqid='"+section+"']");if(element!==section){obj_element=obj_section.find('.cpf-element:not(.cpf-element .cpf-element)').eq(element)}else{obj_element=obj_section}}}else if(element!==section){obj_element=root_element.find('.cpf-element').eq(element)}else{obj_section=root_element.find('.cpf-section').filter("[data-uniqid='"+section+"']");obj_element=obj_section}
255fields[i].push({element:obj_element,rule:rule,type:type})}}
256if(!sect.data('iscpfdependson')){sect.data('cpfdependson-fields',fields);sect.cpfdependson(fields,logic.toggle,!1,epoObject)}else{sect.cpfdependson(sect.data('cpfdependson-fields'),logic.toggle,!0,epoObject)}}})})}
257function cpf_element_logic(epoObject){var obj=epoObject.this_epo_container;var root_element=$(obj);var all_sections=root_element.find('.cpf-section').not('.cpf-type-product .cpf-section');var search_obj;var current_element;var logic;var haslogic;var section;var element;var type;var obj_section;var obj_element;var closestProductElement;var isInProductElement=!1;var selector='.cpf-element[data-haslogic="1"]';if(root_element.parent().is(tcAPI.associatedEpoSelector)){all_sections=root_element.find('.cpf-section');isInProductElement=!0}
258if(root_element.is('.cpf-section')){search_obj=!1}else{search_obj=all_sections}
259if(!epoObject.is_associated){selector='.cpf-element[data-haslogic="1"]:not(".cpf-type-product .cpf-element")'}
260root_element.find(selector).toArray().forEach(function(el){var fields=[];var irule;var rule;var i;var ii;current_element=$(el);logic=current_element.data('logic');logic=convert_rules(logic);haslogic=parseInt(current_element.data('haslogic'),10);if(isInProductElement){closestProductElement=root_element}else{closestProductElement=current_element.parent().closest('.cpf-type-product')}
261if(haslogic===1&&validate_logic(logic)){for(i=0;i<logic.rules.length;i++){irule=logic.rules[i];if(!irule||!Array.isArray(irule)){continue}
262fields[i]=[];for(ii=0;ii<irule.length;ii++){rule=irule[ii];section=rule.section;element=rule.element;type=getLogicType(section,element);if(type==='quantity'){if(closestProductElement.length){obj_element=epoObject.main_cart.find(tcAPI.associateQtySelector)}else{obj_element=epoObject.main_cart.find(epoObject.qtySelector)}}else if(type==='productid'){obj_element=epoObject.product_id}else if(type==='variation'||type==='variationattributes'){if(closestProductElement.length){obj_element=closestProductElement.find('.tc-epo-element-product-container');if(!obj_element.length){obj_element=closestProductElement.closest('.tc-epo-element-product-container')}}else{obj_element=root_element}}else if(search_obj){if(closestProductElement.length){obj_section=root_element.find('.cpf-section').filter("[data-uniqid='"+section+"']");if(element!==section){obj_element=obj_section.find('.cpf-element').eq(element)}else{obj_element=obj_section}}else{obj_section=search_obj.filter("[data-uniqid='"+section+"']");if(element!==section){obj_element=obj_section.find('.cpf-element:not(.cpf-element .cpf-element)').eq(element)}else{obj_element=obj_section}}}else if(element!==section){obj_element=root_element.find('.cpf-element').eq(element)}else{obj_section=root_element.find('.cpf-section').filter("[data-uniqid='"+section+"']");obj_element=obj_section}
263fields[i].push({element:obj_element,rule:rule,type:type})}}
264if(!current_element.data('iscpfdependson')){current_element.data('cpfdependson-fields',fields);current_element.cpfdependson(fields,logic.toggle,!1,epoObject)}else{current_element.cpfdependson(current_element.data('cpfdependson-fields'),logic.toggle,!0,epoObject)}}})}
265function tm_set_price_without_tax(value,_cart,force){var taxable;var tax_rate;var tax_display_mode;var prices_include_tax;if(_cart){taxable=_cart.attr('data-taxable');tax_rate=_cart.attr('data-tax-rate');tax_display_mode=_cart.attr('data-tax-display-mode');prices_include_tax=_cart.attr('data-prices-include-tax');if(force||(taxable&&tax_display_mode==='incl'&&prices_include_tax!=='1')){value=parseFloat(value)/(1+(tax_rate/100))}}
266return value}
267function tm_set_price_with_tax(value,_cart,force){var taxable;var tax_rate;var tax_display_mode;var prices_include_tax;if(_cart){taxable=_cart.attr('data-taxable');tax_rate=_cart.attr('data-tax-rate');tax_display_mode=_cart.attr('data-tax-display-mode');prices_include_tax=_cart.attr('data-prices-include-tax');if(force||(taxable&&tax_display_mode!=='incl'&&prices_include_tax==='1')){value=parseFloat(value)*(1+(tax_rate/100))}}
268return value}
269function tm_set_backend_price(value,_cart,variation){var taxable;var tax_display_mode;var prices_include_tax;if(_cart){taxable=_cart.attr('data-taxable');tax_display_mode=_cart.attr('data-tax-display-mode');prices_include_tax=_cart.attr('data-prices-include-tax');if(taxable){if(variation&&variation.tc_tax_rate&&String(variation.tc_tax_rate)==='0'){return value}
270if(prices_include_tax==='1'){if(tax_display_mode==='incl'){if(variation.tc_base_taxes_of_one!==variation.tc_modded_taxes_of_one){value=parseFloat(((1-variation.tc_taxes_of_one)*value)*(1/(1-variation.tc_base_taxes_of_one)))}}else{value=tm_set_price_with_tax(value,_cart)}}else if(prices_include_tax!=='1'&&tax_display_mode==='incl'){value=tm_set_price_without_tax(value,_cart)}}}
271return value}
272function tm_set_price_totals(value,_cart,notax,element){var sign='';var val;if(!notax){value=tm_set_tax_price(value,_cart,element,undefined,
272!0)}
273val=Math.abs(value);if(value<0){sign=TMEPOJS.minus_sign+' '}
274return tm_set_price_(val,sign)}
275function replace_suffixes(value,rawValue,tc_totals_ob,totalsHolder){if(totalsHolder.attr('data-tax-display-mode')==='excl'){tc_totals_ob[value]=tc_totals_ob[value].replaceAll('{price_excluding_tax}',tm_set_price_totals(tc_totals_ob[rawValue],totalsHolder,!0));tc_totals_ob[value]=tc_totals_ob[value].replaceAll('{price_including_tax}',tm_set_price_totals(tm_set_price_with_tax(tc_totals_ob[rawValue],totalsHolder,!0),totalsHolder,!0))}else{tc_totals_ob[value]=tc_totals_ob[value].replaceAll('{price_including_tax}',tm_set_price_totals(tc_totals_ob[rawValue],totalsHolder,!0));tc_totals_ob[value]=tc_totals_ob[value].replaceAll('{price_excluding_tax}',tm_set_price_totals(tm_set_price_without_tax(tc_totals_ob[rawValue],totalsHolder,!0),totalsHolder,!0))}
276return tc_totals_ob}
277function replace_suffixes_in_html(html,price,totalsHolder){if(totalsHolder.attr('data-tax-display-mode')==='excl'){html=html.replaceAll('{price_excluding_tax}',tm_set_price_totals(price,totalsHolder,!0));html=html.replaceAll('{price_including_tax}',tm_set_price_totals(tm_set_price_with_tax(price,totalsHolder,!0),totalsHolder,!0))}else{html=html.replaceAll('{price_including_tax}',tm_set_price_totals(price,totalsHolder,!0));html=html.replaceAll('{price_excluding_tax}',tm_set_price_totals(tm_set_price_without_tax(price,totalsHolder,!0),totalsHolder,!0))}
278return html}
279function tm_force_update_price(epoObject,obj,price,formatted_price,original_price,useFormattedPrice){tm_update_price({epoObject:epoObject,obj:obj,price:price,formatted_price:formatted_price,original_price:original_price,force:!0,useFormattedPrice:useFormattedPrice})}
280function tm_update_price(priceobj){var $obj;var w;var $ba_amount;var f;var pw;var price;var formatted_price;var original_price;var force;var useFormattedPrice;var template;var templatePrice;var html;var totalsHolder;var sign;$obj=$(priceobj.obj);if($obj.length===0){return}
281w=$obj.closest('.tmcp-field-wrap');pw=$obj.closest('.tc-price-wrap');f=w.find('.tm-epo-field');price=priceobj.price||0;formatted_price=priceobj.formatted_price||'';original_price=priceobj.original_price||'';force=priceobj.force||!1;useFormattedPrice=priceobj.useFormattedPrice||!1;totalsHolder=priceobj.epoObject.this_epo_totals_container;if(!force&&f.attr('data-no-price-change')==='1'&&f.data('price-changed')){return}
282price=$.epoAPI.applyFilter('tc_adjust_update_price_price',price);formatted_price=$.epoAPI.applyFilter('tc_adjust_update_price_formatted_price',formatted_price,price);original_price=$.epoAPI.applyFilter('tc_adjust_update_price_original_price',original_price);if(!Number.isFinite(parseFloat(original_price))){original_price=0}
283if(!Number.isFinite(parseFloat(price))){price=0}
284$ba_amount=w.find('.before-amount,.after-amount');if((TMEPOJS.tm_epo_auto_hide_price_if_zero==='yes'&&($.epoAPI.util.isEmpty(price)===!1||(TMEPOJS.tm_epo_no_hide_price_if_original_not_zero==='yes'&&$.epoAPI.util.isEmpty(price)===!0&&$.epoAPI.util.isEmpty(original_price)===!1)))||TMEPOJS.tm_epo_auto_hide_price_if_zero!=='yes'){if(($.epoAPI.util.isEmpty(price)===!0&&f.attr('data-no-price')==='1')||(!force&&f.length>0&&(f.attr('data-no-price')==='1'||(f.attr('data-type')==='variable'&&!f.data('price'))))){pw.addClass('tm-hidden');$obj.addClass('tm-hidden');$obj.empty();$ba_amount.addClass('tm-hidden')}else{if(original_price&&original_price!==undefined&&parseFloat(original_price)!==parseFloat(price)){if(useFormattedPrice){template=tcAPI.templateEngine.plain_price;templatePrice={price:formatted_price}}else{if(price<0&&!original_price<0){template=tcAPI.templateEngine.sale_price_m10;price=Math.abs(price)}else if(!price<0&&original_price<0){template=tcAPI.templateEngine.sale_price_m01;original_price=Math.abs(original_price)}else if(price<0&&original_price<0){template=tcAPI.templateEngine.sale_price_m11;price=Math.abs(price);original_price=Math.abs(original_price)}else{template=tcAPI.templateEngine.sale_price}
285templatePrice={price:formatPrice(original_price),sale_price:formatPrice(price)}}}else if(useFormattedPrice){template=tcAPI.templateEngine.plain_price;templatePrice={price:formatted_price}}else{template=tcAPI.templateEngine.price;if(price<0){template=tcAPI.templateEngine.price_m;
285price=Math.abs(price)}
286templatePrice={price:formatPrice(price)}}
287html=$.epoAPI.util.decodeHTML($.epoAPI.template.html(template,templatePrice));html=replace_suffixes_in_html(html,price,totalsHolder);html=$.epoAPI.applyFilter('tc_adjust_update_price_formatted_price_html',html);sign='';if(!useFormattedPrice&&price>0&&TMEPOJS.tm_epo_global_options_price_sign!=='minus'){sign=TMEPOJS.option_plus_sign+' '}
288$obj.html(sign+html);pw.removeClass('tm-hidden');$obj.removeClass('tm-hidden');$ba_amount.removeClass('tm-hidden')}}else{pw.addClass('tm-hidden');$obj.addClass('tm-hidden');$obj.empty();$ba_amount.addClass('tm-hidden')}}
289function get_variation_current_settings(form,epoObject){var current_settings={};if(epoObject.thisForm){form=epoObject.thisForm}
290form.find('.variations select, .tc-epo-variable-product-selector').toArray().forEach(function(el){var attribute_name;var value;el=$(el);if(typeof el.data('attribute_name')!=='undefined'){attribute_name=el.data('attribute_name')}else{attribute_name=el.attr('name')}
291value=el.val();current_settings[attribute_name]=value});return current_settings}
292function do_tm_custom_variations_update(form,all_variations,epoObject){var check_if_all_are_not_set=[];var formSettings=get_variation_current_settings(form,epoObject);var redo_check=!0;var variationId=form.find(getVariationIdSelector(form)).val();var ii;variationId=(variationId!=='0'&&variationId!=='')||form.find('.cpf-type-variations').find('.tm-epo-variation-element:checked').length>0||form.find('.cpf-type-variations').find('.tm-epo-variation-element option[value!=""]:selected');if(!variationId){return}
293form.find('.cpf-type-variations').toArray().forEach(function(el,i){var t=$(el).find('.tm-epo-variation-element');var id;var v;var exists=!1;check_if_all_are_not_set[i]=!0;if(t.is('select')){id=$.epoAPI.dom.id(t.attr('data-tm-for-variation'));v=t.val();if(v){check_if_all_are_not_set[i]=!1}
294t.children('option').toArray().forEach(function(o){exists=!1;form.find("[data-attribute_name='attribute_"+id+"']").children('option').toArray().forEach(function(att){if($(att).attr('value')===$(o).attr('value')){exists=!0;return!1}});if(!exists){$(o).prop('disabled',!0).hide()}else{$(o).prop('disabled',!1).show()}})}else{t.toArray().forEach(function(oe){var o=$(oe);var li=o.closest('li');var input=li.find('.tm-epo-variation-element');var this_settings=$.extend(!0,{},formSettings);var matching_variations;var variation;var is_in_stock;id=o.attr('data-tm-for-variation');v=o.val();if(o.is(':checked')){check_if_all_are_not_set[i]=!1}
295this_settings['attribute_'+id]=v;matching_variations=$.fn.tm_find_matching_variations(all_variations,this_settings);variation=matching_variations.shift();is_in_stock=variation&&'is_in_stock' in variation&&variation.is_in_stock;if(!is_in_stock){if(!input.is(':checked')&&!is_in_stock){li.addClass('pointereventsoff')}else{li.removeClass('pointereventsoff')}
296o.attr('disabled','disabled').addClass('tm-disabled');input.attr('disabled','disabled');input.attr('data-tm-disabled','disabled');li.addClass('tm-attribute-disabled').fadeTo('fast',0.5)}else{o.prop('disabled',!1).removeClass('tm-disabled');li.removeClass('pointereventsoff tm-attribute-disabled').fadeTo('fast',1,function(){$(this).css('opacity','')});input.prop('disabled',!1);input.removeAttr('data-tm-disabled')}})}});if(check_if_all_are_not_set){check_if_all_are_not_set.shift();for(ii=0;ii<check_if_all_are_not_set.length;ii++){if(check_if_all_are_not_set[ii]===!1){redo_check=!1;break}}
297if(redo_check){form.find('.cpf-type-variations').first().toArray().forEach(function(el){var t;var li;var input;t=$(el).find('.tm-epo-variation-element');if(!t.is('select')){t.toArray().forEach(function(o){o=$(o);li=o.closest('li');input=li.find('.tm-epo-variation-element');o.prop('disabled',!1).removeClass('tm-disabled');li.removeClass('tm-attribute-disabled').stop().css('opacity','');input.prop('disabled',!1);input.removeAttr('data-tm-disabled')})}})}}}
298function tm_custom_variations_update(form,epoObject){var data;var all_variations=form.data('product_variations');var product_id=parseInt(form.data('product_id'),10);var globalVariationObject=form.data('globalVariationObject')||!1;if(TMEPOJS.skipCustomVariationsUpdate){return}
299if(!product_id){product_id=form.data('tc_product_id')}
300if(!product_id&&form.is(tcAPI.compositeSelector)){data=form.find('.component_options').data('options_data');product_id=data[0].option_id;if(!all_variations){all_variations=form.find('.details.component_data').data('product_variations')}}
301if(!epoObject.is_associated){if(!all_variations&&window.product_variations&&window.product_variations.product_id){all_variations=window.product_variations.product_id}
302if(!all_variations&&window.product_variations){all_variations=window.product_variations}
303if(!all_variations&&window['product_variations_'+product_id]){all_variations=window['product_variations_'+product_id]}}
304if(!all_variations){if(!globalVariationObject){data={action:'woocommerce_tm_get_variations_array',post_id:product_id};$.post(TMEPOJS.ajax_url,data,function(response){globalVariationObject=response;form.data('globalVariationObject',response);do_tm_custom_variations_update(form,globalVariationObject.variations,epoObject)},'json')}else{do_tm_custom_variations_update(form,globalVariationObject.variations,epoObject)}
305return}
306do_tm_custom_variations_update(form,all_variations,epoObject)}
307function tm_fix_stock(cart,html){var custom_variations;var section;if(html===undefined){return!1}
308cart=$(cart);custom_variations=cart.find('.tm-epo-variation-element').first();section=custom_variations.closest('.tm-epo-variation-section');if(custom_variations.length){section.find('.tm-stock').remove();section.append('<div class="tm-stock">'+html+'</div>');return!0}
309cart.find('.tm-stock').remove();cart.find('.variations').after('<div class="tm-stock">'+html+'</div>');return!0}
310function fix_stock($this,form){var stock;if(TMEPOJS.tm_epo_global_move_out_of_stock==='no'){return}
311stock=$this.find('.woocommerce-variation-availability').last();if(!stock.length){stock=$this.find('.stock').last()}
312if(stock.length){form.find('.tm-stock').remove();if(tm_fix_stock(form,stock.prop('outerHTML'))){stock.remove()}}else{form.find('.tm-stock').remove()}}
313function get_main_input_id(main_product,product,id){var selector='';var inputid;if(id){selector=selector+"[value='"+id+"']"}
314if(!product){product=main_product}
315inputid=product.find(tcAPI.addToCartSelector+selector);if(inputid.length===0){inputid=product.find(tcAPI.tcAddToCartSelector+selector)}
316return inputid.last()}
317function get_main_form(main_product,product,selector,id){if(!selector){selector='form'}
318return get_main_input_id(main_product,product,id).closest(selector)}
319function get_main_cart(main_product,product,selector,id){return get_main_form(main_product,product,selector,id)}
320function tm_get_native_prices_block(obj){var selector=$.epoAPI.applyFilter('tcGetNativePrice
320sBlockSelector','.single_variation .price',obj);return $(obj).find(selector).not('.tc-price')}
321function tm_set_url_fields(){jDocument.on('click.cpfurl change.cpfurl tmredirect','.tc-url-container .tmcp-radio, .tc-url-container .tmcp-radio+label',function(e){var data_url=$(this).attr('data-url');if(data_url){if(window.location!==data_url){e.preventDefault();window.location=data_url}}});jDocument.on('change.cpfurl tmredirect','.tc-url-container .tmcp-select',function(e){var data_url=$(this).children('option:selected').attr('data-url');if(data_url){if(window.location!==data_url){e.preventDefault();window.location=data_url}}})}
322function tm_floating_totals(this_epo_totals_container,is_quickview,main_cart){$.tcFloatingTotalsBox(this_epo_totals_container,is_quickview,main_cart)}
323function tm_show_hide_add_to_cart_button(main_product,currentEpoObject){var button;var qty;var showHideCart=currentEpoObject.showHideCart;if(!currentEpoObject.is_associated&&showHideCart!==undefined){if(TMEPOJS.tm_epo_hide_add_cart_button==='yes'||TMEPOJS.tm_epo_hide_all_add_cart_button==='yes'||TMEPOJS.tm_epo_hide_required_add_cart_button==='yes'){button=main_product.find(tcAPI.addToCartButtonSelector).first();qty=main_product.find(tcAPI.qtySelector).first();if(showHideCart){button.removeClass('tc-hide-add-to-cart-button');qty.removeClass('tc-hide-add-to-cart-button')}else{button.addClass('tc-hide-add-to-cart-button');qty.addClass('tc-hide-add-to-cart-button')}
324jWindow.trigger('epoShowHideCart',{main_product:main_product,currentEpoObject:currentEpoObject,showHideCart:showHideCart,button:button,qty:qty})}}}
325function addShowHidetoEpoObject(currentEpoObject,epoEventId,epoObject){var has_epo;var this_epo_container;var epos;var allElementsAreSelected;var showHideCart=!0;var showHideTotal=!0;var one_option_is_selected=$.tcepo.oneOptionIsSelected[epoEventId];if(currentEpoObject.is_associated){currentEpoObject=$.epoAPI.applyFilter('tc_currentEpoObject_associated',currentEpoObject,epoEventId,epoObject);return currentEpoObject}
326if(typeof epoObject==='object'){has_epo=epoObject.has_epo;this_epo_container=epoObject.this_epo_container;has_epo=has_epo&&(this_epo_container.find('.tmcp-fee-field').length||this_epo_container.find('.tmcp-field').not('.cpf-type-variations .tmcp-field').length)}else{has_epo=epoObject}
327currentEpoObject.showHideCart=undefined;currentEpoObject.showHideTotal=undefined;if(has_epo&&(TMEPOJS.tm_epo_hide_add_cart_button==='yes'||TMEPOJS.tm_epo_hide_all_add_cart_button==='yes'||TMEPOJS.tm_epo_hide_required_add_cart_button==='yes'||TMEPOJS.tm_epo_hide_totals_until_any==='yes'||TMEPOJS.tm_epo_hide_totals_until_all_required==='yes'||TMEPOJS.tm_epo_hide_totals_until_all==='yes')){if(TMEPOJS.tm_epo_hide_add_cart_button==='yes'){showHideCart=one_option_is_selected}
328if(TMEPOJS.tm_epo_hide_totals_until_any==='yes'){showHideTotal=one_option_is_selected}
329if(TMEPOJS.tm_epo_hide_required_add_cart_button==='yes'||TMEPOJS.tm_epo_hide_totals_until_all_required==='yes'){epos=currentEpoObject.this_epo_container.find('.cpf-element').not('.cpf-type-variations').filter('.tc-container-enabled.tc-is-required');allElementsAreSelected=checkFullSelection(epos);if(TMEPOJS.tm_epo_hide_required_add_cart_button==='yes'){showHideCart=allElementsAreSelected}
330if(TMEPOJS.tm_epo_hide_totals_until_all_required==='yes'){showHideTotal=allElementsAreSelected}}
331if(TMEPOJS.tm_epo_hide_all_add_cart_button==='yes'||TMEPOJS.tm_epo_hide_totals_until_all==='yes'){epos=currentEpoObject.this_epo_container.find('.cpf-element').not('.cpf-type-variations').filter('.tc-container-enabled');allElementsAreSelected=checkFullSelection(epos);if(TMEPOJS.tm_epo_hide_all_add_cart_button==='yes'){showHideCart=allElementsAreSelected}
332if(TMEPOJS.tm_epo_hide_totals_until_all==='yes'){showHideTotal=allElementsAreSelected}}
333currentEpoObject.showHideCart=showHideCart;currentEpoObject.showHideTotal=showHideTotal;$.tcepo.showHideTotal[epoEventId]=showHideTotal}
334currentEpoObject=$.epoAPI.applyFilter('tc_currentEpoObject',currentEpoObject,epoEventId,epoObject);return currentEpoObject}
335function checkFullSelection(epos,mode){var funcCallback=function(element){var elementToCheck='';var _class;var noSplit=!1;var radio_checked;var checkbox_checked;var val;element=$(element);if(element.is('.cpf-type-product')){elementToCheck=':not('+tcAPI.associatedEpoSelector+' .tm-epo-field)'}
336_class=element.attr('class').split(' ').map(function(cls){if(cls.indexOf('cpf-type-',0)!==-1){return cls}
337return null}).filter(function(v){if(v!==null&&v!==undefined){return v}
338return null});if(_class.length>0){_class=_class[0];if(_class==='cpf-type-product'){noSplit=!0;if(element.is('.cpf-type-product-mode-product')||element.is('.cpf-type-product-checkbox')||element.is('.cpf-type-product-thumbnailmultiple')||element.is('.cpf-type-product-custombundle')){_class='cpf-type-checkbox'}else if(element.is('.cpf-type-product-dropdown')){_class='cpf-type-select'}else{_class='cpf-type-radio'}}
339switch(_class){case 'cpf-type-radio':radio_checked=element.find('input.tm-epo-field.tmcp-radio:checked'+elementToCheck);return radio_checked.length>0;case 'cpf-type-checkbox':checkbox_checked=element.find('input.tm-epo-field.tmcp-checkbox:checked'+elementToCheck);return checkbox_checked.length>0;case 'cpf-type-select':val=element.find('select.tm-epo-field.tmcp-select'+elementToCheck).val();if(val&&!noSplit){val=val.slice(0,val.lastIndexOf('_'))}
340break;case 'cpf-type-selectmultiple':val=element.find('select.tm-epo-field.tmcp-selectmultiple'+elementToCheck).val();if(val&&!noSplit){val.forEach(function(option,i){val[i]=option.slice(0,option.lastIndexOf('_'))})}
341break;default:val=element.find('.tm-epo-field'+elementToCheck).val();break}
342if(Array.isArray(val)){return val.some(function(item){return item!==''})}
343return val!==''}
344return!1};if(mode==='some'){return epos.toArray().some(funcCallback)}
345return epos.toArray().every(funcCallback)}
346function goto_error_item(item,epoEventId){var el=$.tcepo.errorObject[epoEventId]||item;var elsection;var elsectionlink;var cpfElement;var productSection;var pos;if(el){if(TMEPOJS.tm_epo_disable_error_scroll!=='yes'){elsection=el.closest('.cpf-section');elsectionlink=elsection.find('.tm-section-link');cpfElement=el.closest('.cpf-element');productSection=el.closest('.cpf-type-product').closest('.cpf-section');if(productSection.length&&productSection.find('.tm-toggle').length){productSection.find('.tm-toggle').trigger('openwrap.tmtoggle')}
347if(elsection.find('.tm-toggle').length){elsection.find('.tm-toggle').trigger('openwrap.tmtoggle')}
348if(window.tc_validation_offset===undefined){window.tc_validation_offset=-100}
349if(elsection.is('.section_popup')){errorContainer.tcScrollTo(elsectionlink,300,window.tc_validation_offset);elsectionlink.trigger('click.tmsectionpoplink')}else if(elsection.is('.tm-owl-slider-section')){pos=el.closest('.owl-item').index();elsection.find('.tcowl-carousel').trigger('to.owl.carousel',[pos,100]);setTimeout(function(){elsection.find('.tcowl-carousel').trigger('refresh.owl.carousel');if(cpfElement.length>0){errorContainer.tcScrollTo(cpfElement,300,window.tc_validation_offset)}},200)}else if(elsection.is('.tc-tabs-section')){pos=el.closest('.tc-tab-slide').index();el.closest('.tc-tabs').find('.tc-tab-headers .tc-tab-header .tab-header[data-id="tc-tab-slide'+pos+'"]').trigger('click.tmtabs');setTimeout(function(){if(cpfElement.length>0){errorContainer.tcScrollTo(cpfElement,300,window.tc_validation_offset)}},200)}else if(cpfElement.length>0){errorContainer.tcScrollTo(cpfElement,300,window.tc_validation_offset)}}
350if(!item){$.tcepo.errorObject[epoEventId]=!1}}}
351function tm_limit_c_selection(field,prevent){var allowed=parseInt(field.attr('data-limit'),10);var checked=!1;var val;var q;if(allowed>0){checked=0;field.closest('.tm-extra-product-options-checkbox').find("input.tm-epo-field[type='checkbox']:checked").toArray().forEac
351h(function(cb){cb=$(cb);q=cb.closest('li.tmcp-field-wrap').find('input.tm-qty');if(q.length>0){val=parseInt(q.val(),10);if(val<=0){val=1}
352checked=parseInt(checked,10)+val}else{checked=parseInt(checked,10)+1}});if(checked>allowed){if(prevent){field.prop('checked','').trigger('change')}
353return!1}}
354return!0}
355function tm_exact_c_selection(field,prevent){var allowed=parseInt(field.attr('data-exactlimit'),10);var checked=!1;var val;var q;if(allowed>0){checked=0;field.closest('.tm-extra-product-options-checkbox').find("input.tm-epo-field[type='checkbox']:checked").toArray().forEach(function(cb){cb=$(cb);q=cb.closest('li.tmcp-field-wrap').find('input.tm-qty');if(q.length>0){val=parseInt(q.val(),10);if(val<=0){val=1}
356checked=parseInt(checked,10)+val}else{checked=parseInt(checked,10)+1}});if(checked>allowed){if(prevent){field.prop('checked','').trigger('change')}
357return!1}}
358return!0}
359function tm_limit_cont(fields,main_product,epoEventId){var checkall=!0;var first_error_obj=!1;var limit;var eln;var checked;var val;var q;var ew;var em;var message;fields.toArray().forEach(function(field){field=$(field);limit=field.find("[type='checkbox'][data-limit]");if(limit.length&&field_is_active(limit)){eln=parseInt(limit.attr('data-limit'),10);checked=0;field.find("input.tm-epo-field[type='checkbox']:checked").toArray().forEach(function(cb){cb=$(cb);q=cb.closest('li.tmcp-field-wrap').find('input.tm-qty');if(q.length>0){val=parseInt(q.val(),10);if(val<=0){val=1}
360checked=parseInt(checked,10)+val}else{checked=parseInt(checked,10)+1}});ew=field.closest('.cpf-element');em=ew.find('div.tm-error-min');if(eln<checked){checkall=!1;first_error_obj=field;if(eln===1){message=TMEPOJS.tm_epo_global_validator_messages.epolimitsingle.replaceAll('{0}',eln)}else{message=TMEPOJS.tm_epo_global_validator_messages.epolimit.replaceAll('{0}',eln)}
361if(em.length){em.remove()}
362if(TMEPOJS.tm_epo_global_error_label_placement==='before'){field.closest('.tc-element-container').before('<div class="tm-error-min tm-error tc-cell tcwidth tcwidth-100">'+message+'</div>')}else{field.closest('.tc-element-container').after('<div class="tm-error-min tm-error tc-cell tcwidth tcwidth-100">'+message+'</div>')}
363main_product.find(tcAPI.addToCartButtonSelector).first().removeClass('disabled loading fpd-disabled').prop('disabled',!1)}else{em.remove()}}});if(first_error_obj){$.tcepo.errorObject[epoEventId]=first_error_obj}
364return checkall}
365function tm_check_limit_cont(limit_cont,main_product,epoEventId){$.tcepo.formSubmitEvents[epoEventId][$.tcepo.formSubmitEvents[epoEventId].length]={trigger:function(){return tm_limit_cont(limit_cont,main_product,epoEventId)},on_true:function(){return!0},on_false:function(){goto_error_item($(limit_cont).find('.tm-epo-field').first(),epoEventId);return!0}}}
366function tm_exactlimit_cont(fields,main_product,epoEventId){var checkall=!0;var first_error_obj=!1;var exactlimit;var eln;var checked;var val;var q;var ew;var em;var message;fields.toArray().forEach(function(field){field=$(field);exactlimit=field.find("[type='checkbox'][data-exactlimit]");if(exactlimit.length&&field_is_active(exactlimit)){eln=parseInt(exactlimit.attr('data-exactlimit'),10);checked=0;field.find("input.tm-epo-field[type='checkbox']:checked").toArray().forEach(function(cb){cb=$(cb);q=cb.closest('li.tmcp-field-wrap').find('input.tm-qty');if(q.length>0){val=parseInt(q.val(),10);if(val<=0){val=1}
367checked=parseInt(checked,10)+val}else{checked=parseInt(checked,10)+1}});ew=field.closest('.cpf-element');em=ew.find('div.tm-error-min');if(eln!==checked){checkall=!1;first_error_obj=field;if(eln===1){message=TMEPOJS.tm_epo_global_validator_messages.epoexactsingle.replaceAll('{0}',eln)}else{message=TMEPOJS.tm_epo_global_validator_messages.epoexact.replaceAll('{0}',eln)}
368if(em.length){em.remove()}
369if(TMEPOJS.tm_epo_global_error_label_placement==='before'){field.closest('.tc-element-container').before('<div class="tm-error-min tm-error tc-cell tcwidth tcwidth-100">'+message+'</div>')}else{field.closest('.tc-element-container').after('<div class="tm-error-min tm-error tc-cell tcwidth tcwidth-100">'+message+'</div>')}
370main_product.find(tcAPI.addToCartButtonSelector).first().removeClass('disabled loading fpd-disabled').prop('disabled',!1)}else{em.remove()}}});if(first_error_obj){$.tcepo.errorObject[epoEventId]=first_error_obj}
371return checkall}
372function tm_check_exactlimit_cont(exactlimit_cont,main_product,epoEventId){$.tcepo.formSubmitEvents[epoEventId][$.tcepo.formSubmitEvents[epoEventId].length]={trigger:function(){return tm_exactlimit_cont(exactlimit_cont,main_product,epoEventId)},on_true:function(){return!0},on_false:function(){goto_error_item($(exactlimit_cont).find('.tm-epo-field').first(),epoEventId);return!0}}}
373function tm_minimumlimit_cont(fields,epoEventId){var checkall=!0;var first_error_obj=!1;var eln;var checked;var val;var q;var ew;var em;var message;
373fields.toArray().forEach(function(field){var minimumlimit;field=$(field);minimumlimit=field.find("[type='checkbox'][data-minimumlimit]");if(minimumlimit.length&&field_is_active(minimumlimit)){eln=parseInt(minimumlimit.attr('data-minimumlimit'),10);checked=0;field.find("input.tm-epo-field[type='checkbox']:checked").toArray().forEach(function(cb){cb=$(cb);q=cb.closest('li.tmcp-field-wrap').find('input.tm-qty');if(q.length>0){val=parseInt(q.val(),10);if(val<=0){val=1}
374checked=parseInt(checked,10)+val}else{checked=parseInt(checked,10)+1}});ew=field.closest('.cpf-element');em=ew.find('div.tm-error-min');if(eln>checked){checkall=!1;first_error_obj=field;if(eln===1){message=TMEPOJS.tm_epo_global_validator_messages.epominsingle.replaceAll('{0}',eln)}else{message=TMEPOJS.tm_epo_global_validator_messages.epomin.replaceAll('{0}',eln)}
375if(em.length){em.remove()}
376if(TMEPOJS.tm_epo_global_error_label_placement==='before'){field.closest('.tc-element-container').before('<div class="tm-error-min tm-error tc-cell tcwidth tcwidth-100">'+message+'</div>')}else{field.closest('.tc-element-container').after('<div class="tm-error-min tm-error tc-cell tcwidth tcwidth-100">'+message+'</div>')}}else{em.remove()}}});if(first_error_obj){$.tcepo.errorObject[epoEventId]=first_error_obj}
377return checkall}
378function tm_check_minimumlimit_cont(minimumlimit_cont,epoEventId){$.tcepo.formSubmitEvents[epoEventId][$.tcepo.formSubmitEvents[epoEventId].length]={trigger:function(){return tm_minimumlimit_cont(minimumlimit_cont,epoEventId)},on_true:function(){return!0},on_false:function(){goto_error_item(!1,epoEventId);return!0}}}
379function cleanPrice(price){if(price===null){return 0}
380if(typeof price==='object'){price=price[0]}
381if(!Number.isFinite(parseFloat(price))){price=0}
382return price}
383function tm_apply_dpd(price,totals,apply,force){price=cleanPrice(price);if(apply){price=$.epoAPI.applyFilter('tc_apply_dpd',price,totals,apply,force)}
384return price}
385function tm_calculate_product_regular_price(totals,allowfalse){var price=0;if(totals.length>0){price=totals.data('regular-price')}
386price=$.epoAPI.applyFilter('tc_calculate_product_regular_price',price,totals);if(allowfalse&&price===!1){return!1}
387price=parseFloat(price);if(!Number.isFinite(price)){price=0}
388return price}
389function tm_calculate_product_price(totals,allowfalse){var price=0;if(totals.length>0){price=totals.data('price')}
390price=$.epoAPI.applyFilter('tc_calculate_product_price',price,totals);if(allowfalse&&price===!1){return!1}
391price=parseFloat(price);if(!Number.isFinite(price)){price=0}
392return price}
393function calculateMathPrice(price,thisElement,epoObject,noevents,useOriginalPrice,funcTotal,cumulativeTotal,mathskip){var formula=price.toString();var val=0;var matches;var match;var elementWrap;var allElements;var element;var reg;var elementPrice=0;var pos;var type;var id;var thisVal;var thisValForced;var thisElementId=thisElement.closest('.cpf-element').attr('data-uniqid');var thisElementWrap=thisElement.closest('.tmcp-ul-wrap');var totalsHolder_tc_totals_ob=epoObject.this_epo_totals_container.data('totalsHolder_tc_totals_ob');var thisElementIndex=thisElementWrap.find('.tmcp-field, .tmcp-fee-field, .tmcp-sub-fee-field').filter(':checked').index(thisElement);var thisElementIndexForced=thisElementWrap.find('.tmcp-field, .tmcp-fee-field, .tmcp-sub-fee-field').index(thisElement);var this_epo_container=epoObject.is_associated?epoObject.this_epo_container:epoObject.this_epo_container.not(tcAPI.epoSelector+' '+tcAPI.associatedEpoSelector);var constants=$.epoAPI.util.parseJSON(TMEPOJS.tm_epo_math)||{};var productPrice;var dynamicProductPrice;var __price;var __price_type;if(thisElementIndex===-1&&!thisElement.is('.tmcp-checkbox, .tmcp-radio')){thisElementIndex=0}
394if(thisElementIndexForced===-1&&!thisElement.is('.tmcp-checkbox, .tmcp-radio')){thisElementIndexForced=0}
395if(!thisElement.is('.tcdisabled')&&!noevents&&!thisElement.data('addedtcEpoBeforeOptionPriceCalculation')){jWindow.on('tcEpoBeforeOptionPriceCalculation.math'+thisElementId,function(){tm_element_epo_rules(epoObject,thisElement,undefined,undefined,undefined,!0)});jWindow.on('tcEpoAfterNormalOptionPriceCalculation.math'+thisElementId,function(){thisElement.data('fetchOptionPrices',!1);thisElement.data('fetchOptionPrices-forced',!1);thisElement.data('fetchOptionPrices-fee',!1);thisElement.data('fetchOptionPrices-fee-forced',!1);thisElement.data('fetchOptionPrices-sub-fee',!1);thisElement.data('fetchOptionPrices-sub-fee-forced',!1)});thisElement.data('addedtcEpoBeforeOptionPriceCalculation',1)}
396if(thisElement.is('.tmcp-field')){if(thisElement.data('fetchOptionPrices')){thisVal=thisElement.data('fetchOptionPrices');thisValForced=thisElement.data('fetchOptionPrices-forced')}else{thisVal=fetchOptionPrices(epoObject,thisElementWrap,'.tmcp-field',0,0,[],!0,undefined,undefined,undefined,undefined,undefined,
396!0);thisValForced=fetchOptionPrices(epoObject,thisElementWrap,'.tmcp-field',0,0,[],!0,!0,undefined,undefined,undefined,undefined,!0);thisElement.data('fetchOptionPrices',thisVal);thisElement.data('fetchOptionPrices-forced',thisValForced)}}else if(thisElement.is('.tmcp-fee-field')){if(thisElement.data('fetchOptionPrices-fee')){thisVal=thisElement.data('fetchOptionPrices-fee');thisValForced=thisElement.data('fetchOptionPrices-fee-forced')}else{thisVal=fetchOptionPrices(epoObject,thisElementWrap,'.tmcp-fee-field',0,0,[],!0,undefined,undefined,undefined,undefined,undefined,!0);thisValForced=fetchOptionPrices(epoObject,thisElementWrap,'.tmcp-fee-field',0,0,[],!0,!0,undefined,undefined,undefined,undefined,!0);thisElement.data('fetchOptionPrices-fee',thisVal);thisElement.data('fetchOptionPrices-fee-forced',thisValForced)}}else if(thisElement.is('.tmcp-sub-fee-field')){if(thisElement.data('fetchOptionPrices-sub-fee')){thisVal=thisElement.data('fetchOptionPrices-sub-fee');thisValForced=thisElement.data('fetchOptionPrices-sub-fee-forced')}else{thisVal=fetchOptionPrices(epoObject,thisElementWrap,'.tmcp-sub-fee-field',0,0,[],!0,undefined,undefined,undefined,undefined,undefined,!0);thisValForced=fetchOptionPrices(epoObject,thisElementWrap,'.tmcp-sub-fee-field',0,0,[],!0,!0,undefined,undefined,undefined,undefined,!0);thisElement.data('fetchOptionPrices-sub-fee',thisVal);thisElement.data('fetchOptionPrices-sub-fee-forced',thisValForced)}}
397Object.keys(constants).forEach(function(key){var name;var value;if(constants[key].name!==''&&constants[key].value!==''){name=constants[key].name;value=constants[key].value;if(name.startsWith('{')){formula=formula.replaceAll(name,value)}else if(constants[key].name.isNumeric()){formula=formula.replaceAll('{'+name+'}',value)}else{name='{'+name+'}';if(value.startsWith('{')){formula=formula.replaceAll(name,value)}else{formula=formula.replaceAll(name,$.epoAPI.math.unformat(value.replace(',','.')))}}}});if(totalsHolder_tc_totals_ob!==undefined){formula=formula.replaceAll('{quantity}',$.epoAPI.math.unformat(totalsHolder_tc_totals_ob.qty));if(useOriginalPrice&&totalsHolder_tc_totals_ob.original_product_price!==undefined){productPrice=$.epoAPI.math.unformat(totalsHolder_tc_totals_ob.original_product_price)}else{productPrice=$.epoAPI.math.unformat(totalsHolder_tc_totals_ob.product_price)}
398if(totalsHolder_tc_totals_ob.dynamic_product_price!==undefined){dynamicProductPrice=$.epoAPI.math.unformat(totalsHolder_tc_totals_ob.dynamic_product_price)}else{dynamicProductPrice=0}}else{formula=formula.replaceAll('{quantity}',0);productPrice=0;dynamicProductPrice=0}
399productPrice=$.epoAPI.math.toFloat(productPrice);formula=formula.replaceAll('{product_price}',productPrice);formula=formula.replaceAll('{dynamic_product_price}',dynamicProductPrice);if(!funcTotal){funcTotal=0}
400funcTotal=$.epoAPI.math.toFloat(funcTotal);if(!cumulativeTotal){cumulativeTotal=0}
401cumulativeTotal=$.epoAPI.math.toFloat(cumulativeTotal);formula=formula.replaceAll('{options_total}',funcTotal);formula=formula.replaceAll('{product_price_plus_options_total}',productPrice+funcTotal);formula=formula.replaceAll('{cumulative_total}',cumulativeTotal);formula=formula.replaceAll('{product_price_plus_cumulative_total}',productPrice+cumulativeTotal);if(thisValForced.floatingBoxData!==undefined&&thisValForced.floatingBoxData[thisElementIndexForced]!==undefined){if(thisValForced.floatingBoxData[thisElementIndexForced].input_type==='number'||thisValForced.floatingBoxData[thisElementIndexForced].input_type==='hidden'){formula=formula.replaceAll('{this.value}',$.epoAPI.math.toFloat($.epoAPI.math.unformat(thisValForced.floatingBoxData[thisElementIndexForced].valueText)))}else{formula=formula.replaceAll('{this.value}',$.epoAPI.math.toFloat($.epoAPI.math.unformat(thisValForced.floatingBoxData[thisElementIndexForced].valueText,tcAPI.localDecimalSeparator)))}
402formula=formula.replaceAll('{this.rawvalue}',thisValForced.floatingBoxData[thisElementIndexForced].valueText);formula=formula.replaceAll('{this.text}',thisValForced.floatingBoxData[thisElementIndexForced].valueText);formula=formula.replaceAll('{this.value.length}
402',thisValForced.floatingBoxData[thisElementIndexForced].valueText.length)}else{formula=formula.replaceAll('{this.value}',0).replaceAll('{this.rawvalue}','').replaceAll('{this.text}','').replaceAll('{this.value.length}',0)}
403formula=formula.replaceAll('{this.count}',thisVal.floatingBoxData.length).replaceAll('{this.count.quantity}',thisVal.floatingBoxData.map(function(x){return x.quantity}).reduce(function(acc,thisval){return $.epoAPI.math.toFloat(acc)+$.epoAPI.math.toFloat(thisval)},0)).replaceAll('{this.quantity}',thisElement.data('tm-quantity'));if(formula.match(/\{(\s)*?field\.([^}]*)}/)){matches=formula.match(/\{(\s)*?field\.([^}]*)}/g);matches.forEach(function(field){match=field.match(/\{(\s)*?field\.([^}]*)}/);if(undefined!==match[2]&&'string'===typeof match[2]){pos=match[2].lastIndexOf('.');if(pos!==-1){id=match[2].substring(0,pos);type=match[2].substring(pos+1);if($.inArray(type,['price','value','value.length','rawvalue','text','text.length','quantity','count','count.quantity'])!==-1){elementWrap=this_epo_container.find("[data-uniqid='"+$.epoAPI.util.escapeSelector(id)+"']");if(elementWrap.length){allElements=elementWrap.find('.tmcp-field, .tmcp-fee-field, .tmcp-sub-fee-field');element=allElements.first();if(!thisElement.is('.tcdisabled')&&!noevents&&!thisElement.data('addedfieldtcEpoBeforeOptionPriceCalculation')){jWindow.on('tcEpoBeforeOptionPriceCalculation.math'+thisElementId,function(){tm_element_epo_rules(epoObject,thisElement,undefined,undefined,undefined,!0);thisElement.trigger('tm-math-select-change-html-all')});thisElement.data('addedfieldtcEpoBeforeOptionPriceCalculation',1)}
404val=0;switch(type){case 'text':case 'rawvalue':val='';break}
405if(elementWrap.is('.tc-container-enabled')){if(!mathskip){allElements.toArray().forEach(function(singleElement){singleElement=$(singleElement);if(thisElement.attr('id')!==singleElement.attr('id')&&(thisElement.is('.tmcp-dynamic')||singleElement.is('.tmcp-dynamic'))){tm_element_epo_rules(epoObject,singleElement,undefined,undefined,undefined,!0,undefined,undefined,!0)}
406if(!noevents&&!singleElement.data('addedmathevent')){singleElement.on('input.mathevent',function(){if(!thisElement.is('.tcdisabled')){thisElement.trigger('change.cpf',{calculateMathPrice:1})}});singleElement.data('addedmathevent',1)}})}
407if(element.is('.tmcp-field')){val=fetchOptionPrices(epoObject,elementWrap,'.tmcp-field',0,0,[],!0,undefined,undefined,!0,undefined,undefined,!0)}else if(element.is('.tmcp-fee-field')){val=fetchOptionPrices(epoObject,elementWrap,'.tmcp-fee-field',0,0,[],!0,undefined,undefined,!0,undefined,undefined,!0)}else if(element.is('.tmcp-sub-fee-field')){val=fetchOptionPrices(epoObject,elementWrap,'.tmcp-sub-fee-field',0,0,[],!0,undefined,undefined,!0,undefined,undefined,!0)}
408switch(type){case 'price':val=val.total;if(thisElement.is('.tmcp-dynamic')){__price=get_type(epoObject,element,'price');__price_type=get_type(epoObject,element,'price_type');if('math'===__price_type&&__price.includes('{dynamic_product_price}')){val=0}}
409break;case 'value':case 'text':case 'rawvalue':if(val.floatingBoxData){val=val.floatingBoxData.map(function(x){if(x.input_type==='number'||x.input_type==='hidden'){if(type==='text'||type==='rawvalue'){return x.valueText}
410return $.epoAPI.math.unformat(x.valueText)}
411if(type==='text'||type==='rawvalue'){return x.valueText}
412return $.epoAPI.math.unformat(x.valueText,tcAPI.localInputDecimalSeparator)}).reduce(function(acc,thisval){if(type==='text'||type==='rawvalue'){return acc+thisval}
413return $.epoAPI.math.toFloat(acc)+$.epoAPI.math.toFloat(thisval)},(type==='text'||type==='rawvalue')?'':0);if(type==='text'||type==='rawvalue'){if(val===''){val="''"}else if(!val.toString().isNumeric()){val="'"+val.replaceAll("'","\\'")+"'"}}}
414break;case 'value.length':case 'text.length':if(val.floatingBoxData){val=val.floatingBoxData.map(function(x){return x.valueText}).reduce(function(acc,thisval){return $.epoAPI.math.toFloat(acc)+thisval.length},0)}
415break;case 'quantity':case 'count.quantity':if(val.floatingBoxData){val=val.floatingBoxData.map(function(x){return x.quantity}
415).reduce(function(acc,thisval){return $.epoAPI.math.toFloat(acc)+$.epoAPI.math.toFloat(thisval)},0)}
416break;case 'count':if(val.floatingBoxData){val=val.floatingBoxData.length}
417break}
418if(type!=='text'&&type!=='rawvalue'){val=$.epoAPI.math.toFloat(val);if(!Number.isFinite(val)){val=0}}}}else{val=0;switch(type){case 'text':case 'rawvalue':val='';break}}
419reg=new RegExp(match[0]);if(type==='text'||type==='rawvalue'){formula=val===''?formula.replace(reg,"''"):formula.replace(reg,val)}else{formula=!Number.isFinite(val)?formula.replace(reg,"'"+val.replace("'","\\'")+"'"):formula.replace(reg,val)}}}}})}
420try{elementPrice=tcmexp.evaluate(formula)}catch(e){elementPrice=0}
421return elementPrice}
422function get_type(epoObject,obj,type){var element=$(obj);var setter=element;var cart;var current_variation;var rules;var rulestype;var _rulestype;var pricetype;var variation_id_selector;var _tmcpulwrap;var price;var _rules;cart=epoObject.main_cart;variation_id_selector="input[name^='variation_id']";if(cart.find('input.variation_id').length>0){variation_id_selector='input.variation_id'}
423current_variation=cart.find(variation_id_selector).val();if(!current_variation){current_variation=0}
424if(element.is('select')){setter=element.find('option:selected')}
425rules=$.epoAPI.util.parseJSON(setter.attr('data-rules'));rulestype=$.epoAPI.util.parseJSON(setter.attr('data-rulestype'));pricetype='';if(typeof rules==='object'){if(current_variation in rules){price=rules[current_variation]}else{_rules=$.epoAPI.util.parseJSON(element.closest('.tmcp-ul-wrap').attr('data-rules'));if(typeof _rules==='object'){if(current_variation in _rules){price=_rules[current_variation]}else{price=rules[0]}}else{price=rules[0]}}
426if(typeof rulestype==='object'){if(current_variation in rulestype){pricetype=rulestype[current_variation]}else{_rulestype=$.epoAPI.util.parseJSON(element.closest('.tmcp-ul-wrap').attr('data-rulestype'));if(typeof _rulestype==='object'){if(current_variation in _rulestype){pricetype=_rulestype[current_variation]}else{pricetype=rulestype[0]}}else{pricetype=rulestype[0]}}}else{rulestype=$.epoAPI.util.parseJSON(element.closest('.tmcp-ul-wrap').attr('data-rulestype'));if(typeof rulestype==='object'){if(current_variation in rulestype){pricetype=rulestype[current_variation]}else{pricetype=rulestype[0]}}}}else{_tmcpulwrap=element.closest('.tmcp-ul-wrap');rules=$.epoAPI.util.parseJSON(_tmcpulwrap.attr('data-rules'));if(typeof rules==='object'){if(current_variation in rules){price=rules[current_variation]}else{price=rules[0]}
427if(typeof rulestype==='object'){if(current_variation in rulestype){pricetype=rulestype[current_variation]}else{_rulestype=$.epoAPI.util.parseJSON(_tmcpulwrap.attr('data-rulestype'));if(typeof _rulestype==='object'){if(current_variation in _rulestype){pricetype=_rulestype[current_variation]}else{pricetype=rulestype[0]}}else{pricetype=rulestype[0]}}}else{rulestype=$.epoAPI.util.parseJSON(_tmcpulwrap.attr('data-rulestype'));if(typeof rulestype==='object'){if(current_variation in rulestype){pricetype=rulestype[current_variation]}else{pricetype=rulestype[0]}}}}}
428if(typeof price==='object'){price=price[0]}
429if(typeof pricetype==='object'){pricetype=pricetype[0]}
430if(element.is('.tmcp-fee-field')){if($.inArray(pricetype,['fee','stepfee','currentstepfee'])!==-1){pricetype=''}}
431if(type==='price'){return price}
432return pricetype}
433function wordLength(str){var regex=new RegExp(/[\p{L}\d!@#$%^&*()_+=\{[\}\]|\\"':;?/>.<,-]+/,'gu');var m;var len=0;while((m=regex.exec(str))!==null){if(m.index===regex.lastIndex){regex.lastIndex++}
434len=len+m.length}
435return len}
436function tm_calculate_price_by_type(pricetype,price,original_price,setter,product_price,product_original_price,epoTotalsContainer,apply_dpd,funcTotal,cumulativeTotal,mathskip,manthnoevent,cart,element,epoObject,bundleid,epoEventId,is_range_field){var undiscounted_price;var freechars,textlength,cart_total,min_value;var mathopc=!1;var setterValue=setter.val();switch(pricetype){case '':undiscounted_price=price;price=tm_apply_dpd(price,epoTotalsContainer,apply_dpd);break;case 'fixednon':freechars=parseInt(setter.attr('data-freechars'),10);if(!Number.isFinite(freechars)){freechars=0}
437textlength=setterValue.length-freechars;if(textlength<=0){price=0}
438undiscounted_price=price;price=tm_apply_dpd(price,epoTotalsContainer,apply_dpd);break;case 'math':if(price!==original_price){mathopc=!0}else{mathopc=!1}
439if(mathopc){original_price=calculateMathPrice(original_price,element,epoObject,!0,!0,funcTotal,cumulativeTotal,mathskip)}
440price=calculateMathPrice(price,element,epoObject,manthnoevent,$.epoAPI.applyFilter('tc_use_undiscounted_price',undefined,element,cart,epoTotalsContainer),funcTotal,cumulativeTotal,mathskip);if(!mathopc){original_price=price}
441undiscounted_price=price;price=tm_apply_dpd(price,epoTotalsContainer,apply_dpd);break;case 'percent_cart_total':cart_total=parseFloat(TMEPOJS.cart_total);if(!Number.isFinite(cart_total)){cart_total=0}
442undiscounted_price=(price/100)*cart_total;price=(tm_apply_dpd(price,epoTotalsContainer,apply_dpd)/100)*cart_total;original_price=(tm_apply_dpd(original_price,epoTotalsContainer,apply_dpd)/100)*cart_total;break;case 'percent':undiscounted_price=(price/100)*product_price;price=(tm_apply_dpd(price,epoTotalsContainer,apply_dpd)/100)*product_price;original_price=(original_price/100)*product_original_price;break;case 'percentcurrenttotal':$.tcepo.lateFieldsPrices[epoEventId].push({setter:setter,price:price,original_price:original_price,bundleid:bundleid,pricetype:pricetype});setter.data('tm-price-for-late',price).data('tm-original-price-for-late',original_price).data('islate',1).addClass('tm-epo-late-field');undiscounted_price=0;price=0;original_price=0;break;case 'fixedcurrenttotal':price=tm_apply_dpd(price,epoTotalsContainer,apply_dpd);$.tcepo.lateFieldsPrices[epoEventId].push({setter:setter,price:price,original_price:original_price,bundleid:bundleid,pricetype:pricetype});setter.data('tm-price-for-late',price).data('tm-original-price-for-late',original_price).data('islate',1).addClass('tm-epo-late-field');undiscounted_price=0;price=0;original_price=0;break;case 'word':undiscounted_price=price*wordLength(setterValue);price=tm_apply_dpd(price,epoTotalsContainer,apply_dpd)*wordLength(setterValue);original_price=original_price*wordLength(setterValue);break;case 'wordpercent':undiscounted_price=(price/100)*product_price*wordLength(setterValue);price=(tm_apply_dpd(price,epoTotalsContainer,apply_dpd)/100)*product_price*wordLength(setterValue);original_price=(original_price/100)*product_original_price*wordLength(setterValue);break;case 'wordnon':freechars=parseInt(setter.attr('data-freechars'),10);if(!Number.isFinite(freechars)){freechars=0}
443textlength=wordLength(setterValue)-freechars;if(textlength<0){textlength=0}
444undiscounted_price=price*textlength;price=tm_apply_dpd(price,epoTotalsContainer,apply_dpd)*textlength;original_price=original_price*textlength;break;case 'wordpercentnon':freechars=parseInt(setter.attr('data-freechars'),10);if(!Number.isFinite(freechars)){freechars=0}
445textlength=wordLength(setterValue)-freechars;if(textlength<0){textlength=0}
446undiscounted_price=(price/100)*product_price*textlength;price=(tm_apply_dpd(price,epoTotalsContainer,apply_dpd)/100)*product_price*textlength;original_price=(original_price/100)*product_original_price*textlength;break;case 'char':undiscounted_price=price*setterValue.length;price=tm_apply_dpd(price,epoTotalsContainer,apply_dpd)*setterValue.length;original_price=original_price*setterValue.length;break;case 'charpercent':undiscounted_price=(price/100)*product_price*setterValue.length;price=(tm_apply_dpd(price,epoTotalsContainer,apply_dpd)/100)*product_price*setterValue.length;original_price=(original_price/100)*product_original_price*setterValue.length;break;case 'charnospaces':undiscounted_price=price*setterValue.replace(/\s/g,'').length;price=tm_apply_dpd(price,epoTotalsContainer,apply_dpd)*setterValue.replace(/\s/g,'').length;original_price=original_price*setterValue.replace(/\s/g,'').length;break;case 'charnofirst':textlength=setterValue.length-1;if(textlength<0){textlength=0}
447undiscounted_price=price*textlength;price=tm_apply_dpd(price,epoTotalsContainer,apply_dpd)*textlength;original_price=original_price*textlength;break;case 'charnon':freechars=parseInt(setter.attr('data-freechars'),10);if(!Number.isFinite(freechars)){freechars=0}
448textlength=setterValue.length-freechars;if(textlength<0){textlength=0}
449undiscounted_price=price*textlength;price=tm_apply_dpd(price,epoTotalsContainer,apply_dpd)*textlength;original_price=original_price*textlength;break;case 'charpercentnon':freechars=parseInt(setter.attr('data-freechars'),10);if(!Number.isFinite(freechars)){freechars=0}
450textlength=setterValue.length-freechars;if(textlength<0){textlength=0}
451undiscounted_price=(price/100)*product_price*textlength;price=(tm_apply_dpd(price,epoTotalsContainer,apply_dpd)/100)*product_price*textlength;original_price=(original_price/100)*product_original_price*textlength;break;case 'charnonnospaces':freechars=parseInt(setter.attr('data-freechars'),10);if(!Number.isFinite(freechars)){freechars=0}
452textlength=setterValue.replace(/\s/g,'').length-freechars;if(textlength<0){textlength=0}
453undiscounted_price=price*textlength;price=tm_apply_dpd(price,epoTotalsContainer,apply_dpd)*textlength;original_price=original_price*textlength;break;case 'charpercentnonnospaces':freechars=parseInt(setter.attr('data-freechars'),10);if(!Number.isFinite(freechars)){freechars=0}
454textlength=setterValue.replace(/\s/g,'').length-freechars;if(textlength<0){textlength=0}
455undiscounted_price=(price/100)*product_price*textlength;price=(tm_apply_dpd(price,epoTotalsContainer,apply_dpd)/100)*product_price*textlength;original_price=(original_price/100)*product_original_price*textlength;break;case 'charpercentnofirst':textlength=setterValue.length-1;if(textlength<0){textlength=0}
456undiscounted_price=(price/100)*product_price*textlength;price=(tm_apply_dpd(price,epoTotalsContainer,apply_dpd)/100)*product_price*textlength;original_price=(original_price/100)*product_original_price*textlength;break;case 'step':if(is_range_field){undiscounted_price=price*setterValue;price=tm_apply_dpd(price,epoTotalsContainer,apply_dpd)*setterValue;original_price=original_price*$.epoAPI.math.toFloat(setterValue)}else{undiscounted_price=price*$.epoAPI.math.toFloat(setterValue);price=tm_apply_dpd(price,epoTotalsContainer,apply_dpd)*$.epoAPI.math.toFloat(setterValue);original_price=original_price*$.epoAPI.math.toFloat(setterValue)}
457break;case 'currentstep':if(is_range_field){undiscounted_price=setterValue;price=tm_apply_dpd(setterValue,epoTotalsContainer,apply_dpd);original_price=tm_apply_dpd(setterValue,epoTotalsContainer,apply_dpd)}else{undiscounted_price=$.epoAPI.math.toFloat(setterValue);price=tm_apply_dpd($.epoAPI.math.toFloat(setterValue),epoTotalsContainer,apply_dpd);
457original_price=tm_apply_dpd($.epoAPI.math.toFloat(setterValue),epoTotalsContainer,apply_dpd)}
458break;case 'intervalstep':if(is_range_field){min_value=parseFloat($('.tm-range-picker[data-field-id="'+setter.attr('id')+'"]').attr('data-min'));undiscounted_price=price*(setterValue-min_value);price=tm_apply_dpd(price,epoTotalsContainer,apply_dpd)*(setterValue-min_value);original_price=original_price*(setterValue-min_value)}
459break;case 'row':undiscounted_price=price*((setterValue.match(/(\r\n|\n|\r)/gm)||[]).length+1);price=tm_apply_dpd(price,epoTotalsContainer,apply_dpd)*((setterValue.match(/(\r\n|\n|\r)/gm)||[]).length+1);original_price=original_price*((setterValue.match(/(\r\n|\n|\r)/gm)||[]).length+1);break}
460return{price:price,original_price:original_price,undiscounted_price:undiscounted_price}}
461function tm_element_epo_rules(epoObject,obj,args,setter_override,noremove,manthnoevent,funcTotal,cumulativeTotal,mathskip){var element=obj instanceof $?obj:$(obj);var setterall=element;var cart;var current_variation;var bundleid;var epoTotalsContainer;var apply_dpd;var product_price;var product_original_price;var is_range_field=element.is('.tmcp-range');var rules;var rulestype;var original_rules;var _rules;var _rulestype;var _original_rules;var pricetype;var price;var original_price;var raw_price;var raw_original_price;var formatted_price='';var main_product=epoObject.main_product;var epoEventId=epoObject.epoEventId;var variation_id_selector;var _tmcpulwrap;var per_product_pricing=!0;var addedPrice=0;var originalAddedPrice=0;var undiscounted_raw_price;var undiscounted_raw_original_price;var undiscounted_price;var undiscounted_original_price;var isFilled;var useFormattedPrice=!1;var priceResult;if(element.data('associated_price_set')){return}
462if(!args){cart=epoObject.main_cart;if(cart.data('per_product_pricing')!==undefined){per_product_pricing=cart.data('per_product_pricing')}
463variation_id_selector="input[name^='variation_id']";if(cart.find('input.variation_id').length>0){variation_id_selector='input.variation_id'}
464current_variation=cart.find(variation_id_selector).val();bundleid=$.epoAPI.applyFilter('tc_get_bundleid',cart.attr('data-product_id'),cart,epoObject);if(!current_variation){current_variation=0}
465epoTotalsContainer=$.epoAPI.applyFilter('tc_get_totals_container',epoObject.this_epo_totals_container,element,main_product,bundleid);product_price=tm_calculate_product_price(epoTotalsContainer);product_original_price=tm_calculate_product_regular_price(epoTotalsContainer);apply_dpd=epoTotalsContainer.data('fields-price-rules')}else{cart=args.cart;current_variation=args.current_variation;bundleid=args.bundleid;epoTotalsContainer=args.epoTotalsContainer;product_price=args.product_price;product_original_price=args.product_original_price;apply_dpd=args.apply_dpd;per_product_pricing=args.per_product_pricing}
466product_price=$.epoAPI.applyFilter('tc_alter_product_price',product_price,element,cart,epoTotalsContainer,bundleid);product_original_price=$.epoAPI.applyFilter('tc_alter_product_original_price',product_original_price,element,cart,epoTotalsContainer);if(product_price===!1||!per_product_pricing){return}
467if(element.is('select')){setterall=element.find('option:selected')}
468if(setter_override){setterall=setter_override}
469setterall.toArray().forEach(function(setter){setter=$(setter);rules=$.epoAPI.util.parseJSON(setter.attr('data-rules'));rulestype=$.epoAPI.util.parseJSON(setter.attr('data-rulestype'));original_rules=$.epoAPI.util.parseJSON(setter.attr('data-original-rules'));if(element.is('.tmcp-dynamic')){rules=$.epoAPI.util.parseJSON(setter.attr('data-formula'));original_rules=$.epoAPI.util.parseJSON(setter.attr('data-formula'));rulestype=$.epoAPI.util.parseJSON(setter.attr('data-calculation-type'))}
470if(original_rules===undefined){original_rules=rules}
471pricetype='';if(typeof rules==='object'){if(current_variation in rules){price=rules[current_variation];original_price=original_rules[current_variation]}else{_rules=$.epoAPI.util.parseJSON(element.closest('.tmcp-ul-wrap').attr('data-rules'));_original_rules=element.closest('.tmcp-ul-wrap').data('original-rules');if(typeof _rules==='object'){if(current_variation in _rules){price=_rules[current_variation]}else{price=rules[0]}}else{price=rules[0]}
472if(typeof _original_rules==='object'){if(current_variation in _original_rules){original_price=_original_rules[current_variation]}else{original_price=original_rules[0]}}else{original_price=original_rules[0]}}
473if(typeof rulestype==='object'){if(current_variation in rulestype){pricetype=rulestype[current_variation]}else{_rulestype=$.epoAPI.util.parseJSON(element.closest('.tmcp-ul-wrap').attr('data-rulestype'));if(typeof _rulestype==='object'){if(current_variation in _rulestype){pricetype=_rulestype[current_variation]}else{pricetype=rulestype[0]}}else{pricetype=rulestype[0]}}}else{rulestype=$.epoAPI.util.parseJSON(element.closest('.tmcp-ul-wrap').attr('data-rulestype'));if(typeof rulestype==='object'){if(current_variation in rulestype){pricetype=rulestype[current_variation]}else{pricetype=rulestype[0]}}}}else{_tmcpulwrap=element.closest('.tmcp-ul-wrap');rules=$.epoAPI.util.parseJSON(_tmcpulwrap.attr('data-rules'));original_rules=$.epoAPI.util.parseJSON(_tmcpulwrap.attr('data-original-rules'));if(typeof rules==='object'){if(current_variation in rules){price=rules[current_variation]}else{price=rules[0]}
474if(typeof original_rules==='object'){if(current_variation in original_rules){original_price=original_rules[current_variation]}else{original_price=original_rules[0]}}else{original_price=price}
475if(typeof rulestype==='object'){if(current_variation in rulestype){pricetype=rulestype[current_variation]}else{_rulestype=$.epoAPI.util.parseJSON(_tmcpulwrap.attr('data-rulestype'));if(typeof _rulestype==='object'){if(current_variation in _rulestype){pricetype=_rulestype[current_variation]}else{pricetype=rulestype[0]}}else{pricetype=rulestype[0]}}}else{rulestype=$.epoAPI.util.parseJSON(_tmcpulwrap.attr('data-rulestype'));if(typeof rulestype==='object'){if(current_variation in rulestype){pricetype=rulestype[current_variation]}else{pricetype=rulestype[0]}}}}}
476if(typeof pricetype==='object'){pricetype=pricetype[0]}
477if(element.is('.tmcp-fee-field')){if($.inArray(pricetype,['fee','stepfee','currentstepfee'])!==-1){pricetype=''}
478apply_dpd=0}
479if(noremove===undefined){if(element.is('select')){element.find('option').removeClass('tm-epo-late-field').removeData('tm-price-for-late islate')}else{setter.removeClass('tm-epo-late-field').removeData('tm-price-for-late islate')}}
480if(pricetype!=='math'){price=cleanPrice(price);original_price=cleanPrice(original_price)}else if(typeof price==='object'){price=price[0]}
481undiscounted_raw_price=price;undiscounted_raw_original_price=original_price;priceResult=tm_calculate_price_by_type(pricetype,price,original_price,setter,product_price,product_original_price,epoTotalsContainer,apply_dpd,funcTotal,cumulativeTotal,mathskip,manthnoevent,cart,element,epoObject,bundleid,epoEventId,is_range_field);
481price=priceResult.price;original_price=priceResult.original_price;undiscounted_price=priceResult.undiscounted_price;raw_price=price;raw_original_price=original_price;undiscounted_original_price=original_price;undiscounted_raw_price=undiscounted_price;undiscounted_raw_original_price=undiscounted_original_price;if(element.data('tm-quantity')){undiscounted_price=undiscounted_price*parseFloat(element.data('tm-quantity'));undiscounted_original_price=undiscounted_original_price*parseFloat(element.data('tm-quantity'));undiscounted_raw_price=undiscounted_raw_price*parseFloat(element.data('tm-quantity'));undiscounted_raw_original_price=undiscounted_raw_original_price*parseFloat(element.data('tm-quantity'));price=price*parseFloat(element.data('tm-quantity'));original_price=original_price*parseFloat(element.data('tm-quantity'));raw_price=raw_price*parseFloat(element.data('tm-quantity'));raw_original_price=raw_original_price*parseFloat(element.data('tm-quantity'))}
482addedPrice=addedPrice+parseFloat(price);originalAddedPrice=originalAddedPrice+parseFloat(original_price);element.data('price_set',1);setter.data('price_set',1);setter.data('undiscounted_raw_price',undiscounted_raw_price);setter.data('undiscounted_raw_original_price',undiscounted_raw_original_price);setter.data('undiscounted_price',tm_set_tax_price(undiscounted_price,epoTotalsContainer,setter,pricetype));setter.data('undiscounted_original_price',tm_set_tax_price(undiscounted_original_price,epoTotalsContainer,setter,pricetype));setter.data('raw_price',raw_price);setter.data('raw_original_price',raw_original_price);setter.data('price',tm_set_tax_price(price,epoTotalsContainer,setter,pricetype));setter.data('original_price',tm_set_tax_price(original_price,epoTotalsContainer,setter,pricetype));if(!setter_override){if(element.is('.tc-epo-field-product')){isFilled=!1;if(element.is('select')){if(element.val()!==''){isFilled=!0}}else if((element.is(':checkbox')||element.is(':radio'))){if(element.is(':checked')){isFilled=!0}}else if(element.val()!==''){isFilled=!0}
483if(!isFilled){formatted_price=setter.data('price-html');useFormattedPrice=!0}}
484tm_update_price({epoObject:epoObject,obj:setter.closest('.tmcp-field-wrap').find('.tc-price'),price:tm_get_price(addedPrice,epoTotalsContainer,!1,setter,pricetype),formatted_price:formatted_price,original_price:tm_get_price(originalAddedPrice,epoTotalsContainer,!1,setter,pricetype),force:!1,useFormattedPrice:useFormattedPrice});element.data('price-changed',1)}})}
485function tm_epo_rules(epoObject,theCart){var all_carts;var variation_id_selector;var per_product_pricing=!0;var current_variation;var bundleid;var epoContainer;var epoTotalsContainer;var apply_dpd;var rules;var original_rules;var price;var original_price;var product_price;var product_original_price;var all_fields;var active_fields;var args;var main_product=epoObject.main_product;var epoEventId=epoObject.epoEventId;var this_epo_container=epoObject.this_epo_container;var this_epo_totals_container=epoObject.this_epo_totals_container;if(!theCart){all_carts=main_product.find('.cart')}else{all_carts=theCart}
486if(all_carts.length<=0){return}
487$.tcepo.lateFieldsPrices[epoEventId]=[];all_carts.toArray().forEach(function(cart){cart=$(cart);variation_id_selector="input[name^='variation_id']";if(cart.find('input.variation_id').length>0){variation_id_selector='input.variation_id'}
488if(cart.data('per_product_pricing')!==undefined){per_product_pricing=cart.data('per_product_pricing')}
489current_variation=cart.find(variation_id_selector).val();bundleid=$.epoAPI.applyFilter('tc_get_bundleid',cart.attr('data-product_id'),cart,epoObject);if(!current_variation){current_variation=0}
490epoContainer=$.epoAPI.applyFilter('tc_get_epo_container',this_epo_container,cart,main_product,bundleid);epoTotalsContainer=$.epoAPI.applyFilter('tc_get_totals_container',this_epo_totals_container,cart,main_product,bundleid);apply_dpd=epoTotalsContainer.data('fields-price-rules');if(!epoContainer.data('tm_rules_init_done')){if(epoTotalsContainer.data('force-quantity')){cart.find(tcAPI.qtySelector).val(epoTotalsContainer.data('force-quantity'))}
491epoContainer.toArray().forEach(function(el){$(el).closest('.tmcp-field-wrap').find('.tm-epo-field').data('tm-quantity',$(el).val())});epoContainer.find('.tmcp-attributes, .tmcp-elements').toArray().forEach(function(element){element=$(element);rules=$.epoAPI.util.parseJSON(element.attr('data-rules'));original_rules=$.epoAPI.util.parseJSON(element.attr('data-original-rules'));if(typeof rules!=='object'){rules={0:'0'}}
492if(typeof original_rules!=='object'){original_rules={0:'0'}}
493if(typeof rules==='object'){price=tm_apply_dpd(rules[$.epoAPI.math.toFloat(current_variation)],epoTotalsContainer,apply_dpd);original_price=tm_apply_dpd(original_rules[$.epoAPI.math.toFloat(current_variation)],epoTotalsContainer,apply_dpd);element.find('.tmcp-field, .tmcp-fee-field ').toArray().forEach(function(el){el=$(el);if(per_product_pricing){if(el.attr('data-no-price')==='1'){price=0;original_price=0}
494el.data('raw_price',price);el.data('raw_original_price',original_price);el.data('price',tm_set_tax_price(price,epoTotalsContainer,el));el.data('original_price',tm_set_tax_price(original_price,epoTotalsContainer,el));tm_update_price({epoObject:epoObject,obj:el.closest('.tmcp-field-wrap').find('.tc-price'),price:tm_get_price(price,epoTotalsContainer),original_price:tm_get_price(original_price,epoTotalsContainer),force:!1,useFormattedPrice:!1})}else{el.data('price',0);el.data('original_price',0);el.closest('.tmcp-field-wrap').find('.amount').empty()}})}});epoContainer.data('tm_rules_init_done',1)}
495if(!per_product_pricing){return!0}
496product_price=tm_calculate_product_price(epoTotalsContainer);product_original_price=tm_calculate_product_regular_price(epoTotalsContainer);args={cart:cart,current_variation:current_variation,bundleid:bundleid,epoTotalsContainer:epoTotalsContainer,product_price:product_price,product_original_price:product_original_price,apply_dpd:apply_dpd,per_product_pricing:per_product_pricing};all_fields=epoContainer.find('.tmcp-field,.tmcp-sub-fee-field,.tmcp-fee-field');if(!epoObject.is_associated){all_fields=all_fields.not(tcAPI.associatedEpoSelector+' '+'.tmcp-field,'+tcAPI.associatedEpoSelector+' '+'.tmcp-sub-fee-field,'+tcAPI.associatedEpoSelector+' '+'.tmcp-fee-field')}
497active_fields=all_fields.filter('.tcenabled');if(!$.tcepo.initialActivation[epoEventId]||(active_fields.length===0&&all_fields.length>0)){all_fields.toArray().forEach(function(el){field_is_active($(el))});epoContainer.find('.cpf-type-divider,.cpf-type-header').toArray().forEach(function(el){field_is_active($(el))});$.tcepo.initialActivation[epoEventId]=!0}
498all_fields.filter('.tcenabled').toArray().forEach(function(element){tm_element_epo_rules(epoObject,element,args)});all_fields.toArray().forEach(function(element){$(element).on('tc_element_epo_rules',function(){tm_element_epo_rules(epoObject,element,args)})})})}
499function add_late_fields_prices(epoObject,currentProductPrice,originalProductPrice,options_total,original_options_total,bid,_cart,applydpd){var total=0;var originalTotal=0;var totalFees=0;var originalTotalFees=0;var price;var originalPrice;var priceType;var setter;var id;var hidden;var bundleid;var realSetter;var productId;var epoId;var epoEventId=epoObject.epoEventId;var taxPrice;var taxOriginalPrice;var hiddenName;var productPrice;var oProductPrice;var apply_dpd;if(applydpd!==undefined){apply_dpd=applydpd}else{apply_dpd=epoObject.this_epo_totals_container.data('fields-price-rules')}
500productPrice=currentProductPrice;oProductPrice=originalProductPrice;$.tcepo.lateFieldsPrices[epoEventId].forEach(function(field){price=field.price;originalPrice=field.original_price;priceType=field.pricetype;setter=field.setter;bundleid=field.bundleid;realSetter=setter;if(priceType==='percentcurrenttotal'){hiddenName='_hidden'}else{hiddenName='_hiddenfixed'}
501if(setter.is('option')){realSetter=setter.closest('select')}
502productPrice=parseFloat($.epoAPI.applyFilter('tc_alter_product_price',productPrice,realSetter,_cart,epoObject.this_epo_totals_container,bid));oProductPrice=parseFloat($.epoAPI.applyFilter('tc_alter_original_product_price',oProductPrice,realSetter,_cart,epoObject.this_epo_totals_container,bid));id=$.epoAPI.dom.id(realSetter.attr('name'));productId=$('.tc-totals-form.tm-totals-form-'+_cart.attr('data-cart-id')).attr('data-product-id');epoId=$('.tc-totals-form.tm-totals-form-'+_cart.attr('data-cart-id')).attr('data-epo-id');hidden=$(tcAPI.epoSelector+'.tm-product-id-'+productId+"[data-epo-id='"+epoId+"']").find('#'+id+hiddenName);if(bundleid===bid){if(priceType==='percentcurrenttotal'){price=(parseFloat(price)/100)*(tm_apply_dpd(parseFloat(productPrice),epoObject.this_epo_totals_container,apply_dpd)+parseFloat(options_total));originalPrice=(parseFloat(originalPrice)/100)*(parseFloat(oProductPrice)+parseFloat(original_options_total))}else if(priceType==='fixedcurrenttotal'){price=parseFloat(price)+parseFloat(options_total);originalPrice=parseFloat(originalPrice)+parseFloat(original_options_total)}
503if(realSetter.data('tm-quantity')){price=price*parseFloat(realSetter.data('tm-quantity'));originalPrice=originalPrice*parseFloat(realSetter.data('tm-quantity'))}
504if(setter.data('isset')===1&&field_is_active(setter)){if(realSetter.is('.tmcp-field')){total=total+price;originalTotal=originalTotal+originalPrice}else if(realSetter.is('.tmcp-fee-field')){totalFees=totalFees+price;originalTotalFees=originalTotalFees+originalPrice}}
505taxPrice=tm_set_tax_price(price,_cart,setter);
505taxOriginalPrice=tm_set_tax_price(originalPrice,_cart,setter);setter.data('price',taxPrice);setter.data('pricew',taxPrice);setter.data('original_price',taxOriginalPrice);setter.data('original_pricew',taxOriginalPrice);tm_update_price({epoObject:epoObject,obj:setter.closest('.tmcp-field-wrap').find('.tc-price'),price:tm_get_price(taxPrice,_cart,!1,setter),original_price:tm_get_price(taxOriginalPrice,_cart,!1,setter),force:!1,useFormattedPrice:!1});if(hidden.length===0){realSetter.before('<input type="hidden" id="'+id+hiddenName+'" name="'+id+hiddenName+'" value="'+tm_set_price_without_tax(price,_cart)+'">')}
506if(setter.is('.tm-epo-field.tmcp-radio')||setter.is('.tm-epo-field.tmcp-checkbox')){if(setter.is(':checked')){hidden.val(tm_set_price_without_tax(price,_cart))}}else{hidden.val(tm_set_price_without_tax(price,_cart))}}else if(setter.data('pricew')!==undefined){tm_update_price({epoObject:epoObject,obj:setter.closest('.tmcp-field-wrap').find('.tc-price'),price:setter.data('pricew'),original_price:(setter.data('original_pricew')!==undefined?setter.data('original_pricew'):setter.data('pricew')),force:!1,useFormattedPrice:!1})}});return{normal:[total,originalTotal],fees:[totalFees,originalTotalFees]}}
507function tm_lazyload(){var container;if(TMEPOJS.tm_epo_no_lazy_load==='yes'){return}
508if(tmLazyloadContainer){container=$(tmLazyloadContainer).find('img.tmlazy')}else{container=$(tcAPI.epoSelector+' img.tmlazy, .tc-styled-variations img.tmlazy')}
509container.lazyLoadXT();container.on('lazyshow',function(){jWindow.trigger('lazyLoadXToncomplete')})}
510function tm_css_styles(obj){var $cart;var sliderSection;if(!obj){return}
511$cart=$('.cart');sliderSection=obj.find('.tm-owl-slider-section');if(!sliderSection.length){sliderSection=obj;if(!sliderSection.is('.tc-repeater-section')){sliderSection=!1}}
512if(sliderSection){sliderSection.toArray().forEach(function(slider){slider=$(slider);slider.find('.tc-slider-content').addClass('tm-owl-slider');slider=slider.find('.tm-owl-slider');if(slider.length){slider.addClass('tcowl-carousel-show').addClass('tcowl-carousel').on('changed.owl.carousel',function(){$cart.css('display','block').addClass('slider-setup')}).tmowlCarousel(Object.assign({rtl:TMEPOJS.isRTL==='1',dots:!1,nav:!0,items:1,autoHeight:!0,mouseDrag:!1,touchDrag:!0,navText:[TMEPOJS.i18n_prev_text,TMEPOJS.i18n_next_text],navClass:['owl-prev button','owl-next button'],navElement:'a',loop:!1,navRewind:!1},window.tmowlCarouselSettings||{}));slider.removeClass('tcowl-carousel-show')}})}
513if($.fn.tcTabs){obj.find('.tc-tabs').tcTabs({headers:'tc-tab-headers',header:'tab-header',dataopenattribute:'data-tab',sortabletabs:!1})}}
514function repeaterAdd(el,elementInnerWrap){var cpf=elementInnerWrap.closest('.cpf-element');var maxRows=cpf.data('repeater-max-rows');var minRows=cpf.data('repeater-min-rows')||1;var repeater=elementInnerWrap.find('.tc-repeater-element');var rows=repeater.length;var repeaterLast=repeater.last();var repeaterLastUL=repeaterLast.find('.tmcp-ul-wrap');var clone;var cloneUl;var index=el.data('tc-repeater-init');if(maxRows){if(rows>=maxRows){return!1}}
515if(rows+1>=maxRows&&el.is('.tc-repeater-add')){el.closest('.tc-repeater-wrap').addClass('tc-hidden')}
516if(repeaterLastUL.is('.tm-element-ul-date, .tm-element-ul-time')){repeaterLastUL.find('.tm-epo-field').tm_datepicker('destroy');repeaterLastUL.find('.tmcp-date-select').off()}
517if(repeaterLastUL.is('.tm-element-ul-color')){repeaterLastUL.find('.tm-epo-field').spectrum('destroy')}
518clone=repeaterLast.tcClone(!0);clone.find('.tm-epo-field').attr('id',function(i,value){return value.replace(/\_\d+$/g,'')+'_'+index});clone.find('[data-for]').attr('data-for',function(i,value){return value.replace(/\_\d+$/g,'')+'_'+index});clone.find('[for]:not(:has(.tmcp-date-select))').attr('for',function(i,value){return value.replace(/\_\d+$/g,'')+'_'+index});clone.find('[data-field-id]').attr('data-field-id',function(i,value){return value.replace(/\_\d+$/g,'')+'_'+index});clone.find('[data-tm-date]').attr('data-tm-date',function(i,value){return value.replace(/\_\d+$/g,'')+'_'+index});clone.find('.tmcp-date-select').attr('id',function(i,value){return $(this).attr('data-tm-date')+'_'+value.substring(value.lastIndexOf('_')+1)});clone.find('[for]:has(.tmcp-date-select)').attr('for',function(i,value){return $(this).find('.tmcp-date-select').attr('data-tm-date')+'_'+value.substring(value.lastIndexOf('_')+1)});clone.find('.tm-epo-field').attr('name',function(i,value){return value.replace(/\[\d+\]/g,'['+index+']')});clone.find('.tm-qty').attr('name',function(i,value){return value.replace(/\[\d+\]/g,'['+index+']')});clone.find('.tmcp-date-select').attr('name',function(i,value){return value.replace(/\[\d+\]/g,'['+index+']')});cloneUl=clone.find('.tmcp-ul-wrap');if(rows>=minRows&&elementInnerWrap.find('.tc-repeater-element').length>=1){elementInnerWrap.find('.tc-repeater-delete').removeClass('tc-hidden');clone.find('.tc-repeater-delete').removeClass('tc-hidden')}
519if(cloneUl.is('.tm-element-ul-checkbox')){clone.find('li.tmcp-field-wrap').removeClass('tc-active');clone.find('.tm-epo-field.tmcp-checkbox').prop('checked',!1);clone.find('.tm-epo-field.tmcp-checkbox').filter(function(i,x){return $.inArray($(x).val(),el.data('repeater-init-value'))!==-1}).prop('checked',!0).closest('li.tmcp-field-wrap').addClass('tc-active')}else if(cloneUl.is('.tm-element-ul-radio')){clone.find('li.tmcp-field-wrap').removeClass('tc-active');clone.find('.tm-epo-field.tmcp-radio').filter(function(i,x){return $(x).val()===el.data('repeater-init-value')}).prop('checked',!0).closest('li.tmcp-field-wrap').addClass('tc-active')}else{clone.find('.tm-epo-field').val(el.data('repeater-init-value'))}
520if(!cloneUl.is('.tm-element-ul-checkbox')&&!cloneUl.is('.tm-element-ul-radio')){clone.find('.tm-epo-field').val(el.data('repeater-init-value'))}
521if(cloneUl.is('.tm-element-ul-upload')){clone.find('.tc-upload-preview').remove();clone.find('.tm-filename').remove()}
522clone.find('.tc-element-qty').toArray().forEach(function(elc){var qelc=$(elc);var defaultValue=qelc.attr('data-default-value');qelc.val(defaultValue).trigger('change')});el.data('tc-repeater-init',el.data('tc-repeater-init')+1);return[clone,repeaterLast,repeaterLastUL]}
523function repeaterAddAfter(epoObject,clone,repeaterLastUL,doevents){var cloneUl=clone.find('.tmcp-ul-wrap');if(cloneUl.is('.tm-element-ul-range')){clone.find('.tm-range-picker').removeData('tc-picker-init').attr('class','tm-range-picker').html('');setRangePickers(clone)}
524if(cloneUl.is('.tm-element-ul-date, .tm-element-ul-time')){tm_set_datepicker(repeaterLastUL);tm_set_datepicker(cloneUl)}
525if(cloneUl.is('.tm-element-ul-color')){tm_set_color_pickers(repeaterLastUL);tm_set_color_pickers(cloneUl)}
526clone.find('.tm-tooltip').removeData('tctooltip').removeData('tm-has-tm-tip');$.tcToolTip(clone.find('.tm-tooltip'));clone.find('.tm-epo-field').removeData('addedtcEpoBeforeOptionPriceCalculation').toArray().forEach(function(elc){elc=$(elc);field_is_active(elc,!1,!0);if(elc.is('.tcenabled')){tm_element_epo_rules(epoObject,elc)}
527elc.on('tc_element_epo_rules',function(){tm_element_epo_rules(epoObject,elc)})});if(!doevents){return}
528if(cloneUl.is('.tm-element-ul-checkbox')){clone.find('.tm-epo-field.tmcp-checkbox').filter(':checked').trigger('change.cpf')}else if(cloneUl.is('.tm-element-ul-radio')){clone.find('.tm-epo-field.tmcp-radio').filter(':checked').trigger('change.cpf')}else{clone.find('.tm-epo-field').trigger('change.cpf')}}
529function repeaterDelete(elementInnerWrap,repeaterElement,repeaterObj,$this){var cpf=elementInnerWrap.closest('.cpf-element');var minRows=cpf.data('repeater-min-rows');var rows=elementInnerWrap.find('.tc-repeater-element').length;var repeaterElementIndex=repeaterElement.index();var message;if(minRows){if(rows<=minRows){if($.tc_validator&&$this){message='<div class="tm-error-repeater tm-error tc-cell tcwidth tcwidth-100">'+$.tc_validator.messages.repeaterminrows(minRows)+'</div>';$this.tcToolTip({tip:message,onetime:!0,trigger:!0,tipclass:'tc-error'})}
530return!1}}
531if(rows===1){return}
532if(rows===2||(rows-1)<=minRows){elementInnerWrap.find('.tc-repeater-delete').addClass('tc-hidden')}
533if(repeaterObj.is('.tc-repeater-add')){repeaterObj.closest('.tc-repeater-wrap').removeClass('tc-hidden')}
534repeaterElement.remove();repeaterObj.data('tc-repeater-init',repeaterObj.data('tc-repeater-init')-1);if(repeaterElementIndex+1===rows){return}
535elementInnerWrap.find('.tc-repeater-element').toArray().forEach(function(clone,index){clone=$(clone);clone.find('.tm-epo-field').attr('id',function(i,value){return value.replace(/\_\d+$/g,'')+((index!==0)?'_'+index:'')});clone.find('[data-for]').attr('data-for',function(i,value){return value.replace(/\_\d+$/g,'')+((index!==0)?'_'+index:'')});clone.find('[for]:not(:has(.tmcp-date-select))').attr('for',function(i,value){return value.replace(/\_\d+$/g,'')+((index!==0)?'_'+index:'')});clone.find('[data-field-id]').attr('data-field-id',function(i,value){return value.replace(/\_\d+$/g,'')+((index!==0)?'_'+index:'')});clone.find('[data-tm-date]').attr('data-tm-date',function(i,value){return value.replace(/\_\d+$/g,'')+((index!==0)?'_'+index:'')});clone.find('.tmcp-date-select').attr('id',function(i,value){return $(this).attr('data-tm-date')+'_'+value.substring(value.lastIndexOf('_')+1)});clone.find('[for]:has(.tmcp-date-select)').attr('for',function(i,value){return $(this).find('.tmcp-date-select').attr('data-tm-date')+'_'+value.substring(value.lastIndexOf('_')+1)});clone.find('.tm-epo-field').attr('name',function(i,value){return value.replace(/\[\d+\]/g,'['+index+']')});clone.find('.tm-qty').attr('name',function(i,value){return value.replace(/\[\d+\]/g,'['+index+']')});clone.find('.tmcp-date-select').attr('name',function(i,value){return value.replace(/\[\d+\]/g,'['+index+']')})})}
536function repeaterDeleteSection(elementInnerWrap,repeaterElement,repeaterObj,$this){var cpf=elementInnerWrap.closest('.cpf-section');var minRows=cpf.data('repeater-min-rows');var rows=elementInnerWrap.find('.tc-repeater-section').length;var repeaterElementIndex=repeaterElement.index();var message;if(minRows){if(rows<=minRows){if($.tc_validator&&$this){message='<div class="tm-error-repeater tm-error tc-cell tcwidth tcwidth-100">'+$.tc_validator.messages.repeaterminrows(minRows)+'</div>';$this.tcToolTip({tip:message,onetime:!0,trigger:!0,tipclass:'tc-error'})}
537return!1}}
538if(rows===1){return}
539if(rows===2||(rows-1)<=minRows){elementInnerWrap.find('.tc-repeater-section-delete').addClass('tc-hidden');elementInnerWrap.find('.tc-repeater-section').removeClass('has-delete');cpf.find('.tcowl-carousel').trigger('refresh.owl.carousel')}
540if(repeaterObj.is('.tc-section-repeater-add')){repeaterObj.closest('.tc-repeater-wrap').removeClass('tc-hidden')}
541repeaterElement.remove();repeaterObj.data('tc-repeater-init',repeaterObj.data('tc-repeater-init')-1);if(repeaterElementIndex+1===rows){return}
542elementInnerWrap.find('.tc-repeater-section').toArray().forEach(function(clone,index){clone=$(clone);clone.find('.tm-epo-field').attr('id',function(i,value){return value.replace(/\_\d+$/g,'')+((index!==0)?'_'+index:'')});clone.find('[data-for]').attr('data-for',function(i,value){return value.replace(/\_\d+$/g,'')+((index!==0)?'_'+index:'')});clone.find('[for]:not(:has(.tmcp-date-select))').attr('for',function(i,value){return value.replace(/\_\d+$/g,'')+((index!==0)?'_'+index:'')});clone.find('[data-field-id]').attr('data-field-id',function(i,value){return value.replace(/\_\d+$/g,'')+((index!==0)?'_'+index:'')});clone.find('[data-tm-date]').attr('data-tm-date',function(i,value){return value.replace(/\_\d+$/g,'')+((index!==0)?'_'+index:'')});clone.find('.tmcp-date-select').attr('id',function(i,value){return $(this).attr('data-tm-date')+'_'+value.substring(value.lastIndexOf('_')+1)});clone.find('[for]:has(.tmcp-date-select)').attr('for',function(i,value){return $(this).find('.tmcp-date-select').attr('data-tm-date')+'_'+value.substring(value.lastIndexOf('_')+1)});clone.find('.tm-epo-field').attr('name',function(i,value){return value.replace(/\[\d+\]/g,'['+index+']')});clone.find('.tm-qty').attr('name',function(i,value){return value.replace(/\[\d+\]/g,'['+index+']')});clone.find('.tmcp-date-select').attr('name',function(i,value){return value.replace(/\[\d+\]/g,'['+index+']')})})}
543function repeaterAddSection(el,elementInnerWrap){var cpf=elementInnerWrap.closest('.cpf-section');var maxRows=cpf.data('repeater-max-rows');var minRows=cpf.data('repeater-min-rows')||1;var repeater=elementInnerWrap.find('.tc-repeater-section');var rows=repeater.length;var repeaterLast=repeater.last();var repeaterLastUL=repeaterLast.find('.tmcp-ul-wrap');var clone;var cloneUl;var index=el.data('tc-repeater-init');var repeaterInitValue=el.data('repeater-init-value');if(maxRows){if(rows>=maxRows){return!1}}
544if(rows+1>=maxRows&&el.is('.tc-repeater-add')){el.closest('.tc-repeater-wrap').addClass('tc-hidden')}
545repeaterLastUL.toArray().forEach(function(field){var rlul=$(field);if(rlul.is('.tm-element-ul-date, .tm-element-ul-time')){rlul.find('.tm-epo-field').tm_datepicker('destroy');rlul.find('.tmcp-date-select').off()}
546if(rlul.is('.tm-element-ul-color')){rlul.find('.tm-epo-field').spectrum('destroy')}});clone=repeaterLast.tcClone(!0);clone.find('.tm-epo-field').attr('id',function(i,value){return value.replace(/\_\d+$/g,'')+'_'+index});clone.find('[data-for]').attr('data-for',function(i,value){return value.replace(/\_\d+$/g,'')+'_'+index});clone.find('[for]:not(:has(.tmcp-date-select))').attr('for',function(i,value){return value.replace(/\_\d+$/g,'')+'_'+index});clone.find('[data-field-id]').attr('data-field-id',function(i,value){return value.replace(/\_\d+$/g,'')+'_'+index});clone.find('[data-tm-date]').attr('data-tm-date',function(i,value){return value.replace(/\_\d+$/g,'')+'_'+index});clone.find('.tmcp-date-select').attr('id',function(i,value){return $(this).attr('data-tm-date')+'_'+value.substring(value.lastIndexOf('_')+1)});clone.find('[for]:has(.tmcp-date-select)').attr('for',function(i,value){return $(this).find('.tmcp-date-select').attr('data-tm-date')+'_'+value.substring(value.lastIndexOf('_')+1)});clone.find('.tm-epo-field').attr('name',function(i,value){return value.replace(/\[\d+\]/g,'['+index+']')});clone.find('.tm-qty').attr('name',function(i,value){return value.replace(/\[\d+\]/g,'['+index+']')});clone.find('.tmcp-date-select').attr('name',function(i,value){return value.replace(/\[\d+\]/g,'['+index+']')});cloneUl=clone.find('.tmcp-ul-wrap');if(rows>=minRows&&elementInnerWrap.find('.tc-repeater-section').length>=1){elementInnerWrap.find('.tc-repeater-section-delete').removeClass('tc-hidden');clone.find('.tc-repeater-section-delete').removeClass('tc-hidden');repeater.addClass('has-delete');clone.addClass('has-delete');cpf.find('.tcowl-carousel').trigger('refresh.owl.carousel')}
547cloneUl.toArray().forEach(function(field){var cUl=$(field);if(cUl.is('.tm-element-ul-checkbox')){cUl.find('li.tmcp-field-wrap').removeClass('tc-active');cUl.find('.tm-epo-field.tmcp-checkbox').prop('checked',!1);
547cUl.find('.tm-epo-field.tmcp-checkbox').filter(function(i,x){var $field=$(x);var fieldId=$field.attr('id').replace(/_(\d+)$/,'');return $.inArray($field.val(),repeaterInitValue[fieldId])!==-1}).prop('checked',!0).closest('li.tmcp-field-wrap').addClass('tc-active')}else if(cUl.is('.tm-element-ul-radio')){cUl.find('li.tmcp-field-wrap').removeClass('tc-active');cUl.find('.tm-epo-field.tmcp-radio').filter(function(i,x){var $field=$(x);var fieldId=$field.attr('id').replace(/_(\d+)$/,'');return $field.val()===repeaterInitValue[fieldId]}).prop('checked',!0).closest('li.tmcp-field-wrap').addClass('tc-active')}else{cUl.find('.tm-epo-field').each(function(){var $field=$(this);var fieldId=$field.attr('id').replace(/_(\d+)$/,'');if(repeaterInitValue.hasOwnProperty(fieldId)){$field.val(repeaterInitValue[fieldId])}})}
548if(!cUl.is('.tm-element-ul-checkbox')&&!cUl.is('.tm-element-ul-radio')){cUl.find('.tm-epo-field').each(function(){var $field=$(this);var fieldId=$field.attr('id').replace(/_(\d+)$/,'');if(repeaterInitValue.hasOwnProperty(fieldId)){$field.val(repeaterInitValue[fieldId])}})}
549if(cUl.is('.tm-element-ul-upload')){cUl.find('.tc-upload-preview').remove();cUl.find('.tm-filename').remove()}});clone.find('.tc-element-qty').toArray().forEach(function(elc){var qelc=$(elc);var defaultValue=qelc.attr('data-default-value');qelc.val(defaultValue).trigger('change')});el.data('tc-repeater-init',el.data('tc-repeater-init')+1);return[clone,repeaterLast,repeaterLastUL]}
550function repeaterAddSectionAfter(epoObject,clone,repeaterLastUL,doevents){var cloneUl=clone.find('.tmcp-ul-wrap');var doDate;var doColor;cloneUl.toArray().forEach(function(field){var cUL=$(field);if(cUL.is('.tm-element-ul-range')){cUL.find('.tm-range-picker').removeData('tc-picker-init').attr('class','tm-range-picker').html('');setRangePickers(cUL)}
551if(cUL.is('.tm-element-ul-date, .tm-element-ul-time')){doDate=!0;tm_set_datepicker(cUL)}
552if(cUL.is('.tm-element-ul-color')){doColor=!0;tm_set_color_pickers(cUL)}
553if(doevents){if(cUL.is('.tm-element-ul-checkbox')){cUL.find('.tm-epo-field.tmcp-checkbox').filter(':checked').trigger('change.cpf')}else if(cUL.is('.tm-element-ul-radio')){cUL.find('.tm-epo-field.tmcp-radio').filter(':checked').trigger('change.cpf')}else{cUL.find('.tm-epo-field').trigger('change.cpf')}}});if(doDate){tm_set_datepicker(repeaterLastUL)}
554if(doColor){tm_set_color_pickers(repeaterLastUL)}
555clone.find('.tm-tooltip').removeData('tctooltip').removeData('tm-has-tm-tip');$.tcToolTip(clone.find('.tm-tooltip'));clone.find('.tm-epo-field').removeData('addedtcEpoBeforeOptionPriceCalculation').toArray().forEach(function(elc){elc=$(elc);field_is_active(elc,!1,!0);if(elc.is('.tcenabled')){tm_element_epo_rules(epoObject,elc)}
556elc.on('tc_element_epo_rules',function(){tm_element_epo_rules(epoObject,elc)})});clone.find('.tc-tabs').removeData('tctabs');clone.find('.tcowl-carousel').removeData('owl.carousel');clone.find('.owl-nav, .owl-dots').remove();tm_css_styles(clone)}
557function tm_set_repeaters(obj,epoObject){var currentCart;var qtyElement;var quantityRepeaters;var sectionQuantityRepeaters;if(!obj){return}
558obj=$(obj);if(obj.length){currentCart=epoObject.main_cart;qtyElement=getQtyElement(currentCart);qtyElement=$.epoAPI.applyFilter('qtyElementForRepeaterQuantity',qtyElement,{epo:epoObject,currentCart:currentCart,obj:obj,qtyElement:qtyElement});quantityRepeaters=obj.find('.tc-repeater-quantity');quantityRepeaters.toArray().forEach(function(repeater,qx){var el=$(repeater);var tmEpoField;var repeaterElement;var length;var elementInnerWrap;var maxRows=el.data('repeater-max-rows');if(el.data('tc-repeater-init')){return}
559repeaterElement=el.find('.tc-repeater-element');length=repeaterElement.length;tmEpoField=repeaterElement.first().find('.tm-epo-field');if(tmEpoField.is(':checkbox')){el.data('repeater-init-value',tmEpoField.filter(':checked').toArray().map(function(x){return $(x).val()}))}else if(tmEpoField.is(':radio')){el.data('repeater-init-value',tmEpoField.filter(':checked').val())}else{el.data('repeater-init-value',tmEpoField.val())}
560el.data('tc-repeater-init',length);el.data('tc-repeater-name',tmEpoField.attr('name'));if(qtyElement.length){elementInnerWrap=el.find('.tc-element-inner-wrap');qtyElement.off('change.r'+qx+'cpf input.r'+qx+'cpf').on('change.r'+qx+'cpf input.r'+qx+'cpf',function(event){var field=$(this);var prevValue=field.data('epopreviousvalue');var value=$.epoAPI.applyFilter('qtyElementForRepeaterQuantityValue',field.val(),{epo:epoObject,currentCart:currentCart,obj:obj,qtyElement:qtyElement,field:field});var difference=value-prevValue;var thisRepeaterElement;var i;var ele;var cloned;var repeaterLastUL;var fieldprevval;if(prevValue===undefined){prevValue=value-1;difference=value-prevValue}
561if(event.isTrigger!==undefined){prevValue=el.find('.tc-element-inner-wrap').find('.tc-repeater-element').length;difference=value-prevValue}
562if(maxRows&&difference>maxRows){difference=maxRows-1}
563if(difference===0){return}
564fieldprevval=$.epoAPI.applyFilter('qtyElementForRepeaterQuantity_epopreviousvalue',field.val(),{epo:epoObject,currentCart:currentCart,obj:obj,qtyElement:qtyElement,field:field});if(fieldprevval<=0){fieldprevval=1}
565if(qx===quantityRepeaters.length){field.data('epopreviousvalue',fieldprevval)}
566if(difference>0){thisRepeaterElement=elementInnerWrap.find('.tc-repeater-element').eq(value-1);if(thisRepeaterElement.length){return}
567for(i=0;i<difference;i++){cloned=repeaterAdd(el,elementInnerWrap);if(cloned){if(ele){ele=ele.add(cloned[0])}else{ele=cloned[0]}
568if(i===0){repeaterLastUL=cloned[2]}}}
569if(ele){ele.appendTo(elementInnerWrap.find('.tc-element-container'));repeaterAddAfter(epoObject,ele,repeaterLastUL)}}else{for(i=value-difference;i>value;i-=1){thisRepeaterElement=elementInnerWrap.find('.tc-repeater-element').eq(i-1);repeaterDelete(elementInnerWrap,thisRepeaterElement,el)}}
570currentCart.trigger({type:'tm-epo-update',norules:2})});qtyElement.data('epopreviousvalue',$.epoAPI.applyFilter('qtyElementForRepeaterQuantityValue',qtyElement.val(),{epo:epoObject,currentCart:currentCart,obj:obj,qtyElement:qtyElement,field:qtyElement})).trigger('change')}});
570obj.find('.tc-repeater-add').toArray().forEach(function(repeater){var el=$(repeater);var tmEpoField;var elementInnerWrap;var repeaterElement;var length;if(el.data('tc-repeater-init')){return}
571elementInnerWrap=el.closest('.tc-element-inner-wrap');repeaterElement=elementInnerWrap.find('.tc-repeater-element');length=repeaterElement.length;tmEpoField=repeaterElement.first().find('.tm-epo-field');if(elementInnerWrap.find('.tc-repeater-element').length>1){elementInnerWrap.find('.tc-repeater-delete').removeClass('tc-hidden')}
572if(tmEpoField.is(':checkbox')){el.data('repeater-init-value',tmEpoField.filter(':checked').toArray().map(function(x){return $(x).val()}))}else if(tmEpoField.is(':radio')){el.data('repeater-init-value',tmEpoField.filter(':checked').val())}else{el.data('repeater-init-value',tmEpoField.val())}
573el.data('tc-repeater-init',length);el.data('tc-repeater-name',tmEpoField.attr('name'));el.on('click.repeater',function(){var ele=repeaterAdd(el,elementInnerWrap);if(ele){ele[0].appendTo(elementInnerWrap.find('.tc-element-container'));repeaterAddAfter(epoObject,ele[0],ele[2],!0)}})});obj.find('.tc-repeater-delete .delete').on('click',function(){var $this=$(this);var elementInnerWrap=$this.closest('.tc-element-inner-wrap');var repeaterElement=$this.closest('.tc-repeater-element');repeaterDelete(elementInnerWrap,repeaterElement,elementInnerWrap.find('.tc-repeater-add'),$this);epoObject.form.trigger({type:'tm-epo-update',norules:2})});obj.find('.tc-section-repeater-add').toArray().forEach(function(repeater){var el=$(repeater);var tmEpoField;var elementInnerWrap;var repeaterElement;var length;var fieldData=[];if(el.data('tc-repeater-init')){return}
574elementInnerWrap=el.closest('.tc-section-inner-wrap');repeaterElement=elementInnerWrap.find('.tc-repeater-section');length=repeaterElement.length;tmEpoField=elementInnerWrap.find('.sections_repeater');if(elementInnerWrap.find('.tc-repeater-section').length>1){elementInnerWrap.find('.tc-section-repeater-delete').removeClass('tc-hidden')}
575repeaterElement.first().find('.tm-epo-field').toArray().forEach(function(field){var epofield=$(field);var id=epofield.attr('id');if(epofield.is(':checkbox')){fieldData[id]=epofield.filter(':checked').toArray().map(function(x){return $(x).val()})}else if(epofield.is(':radio')){fieldData[id]=epofield.filter(':checked').val()}else{fieldData[id]=epofield.val()}});el.data('repeater-init-value',fieldData);el.data('tc-repeater-init',length);el.data('tc-repeater-name',tmEpoField.attr('name'));el.on('click.repeater',function(){var ele=repeaterAddSection(el,elementInnerWrap);if(ele){ele[1].after(ele[0]);repeaterAddSectionAfter(epoObject,ele[0],ele[2],!0);tmEpoField.val(function(i,currentValue){return currentValue?parseInt(currentValue,10)+1:2})}})});sectionQuantityRepeaters=obj.find('.tc-section-repeater-quantity');sectionQuantityRepeaters.toArray().forEach(function(repeater,qx){var el=$(repeater);var tmEpoField;var elementInnerWrap;var repeaterElement;var length;var fieldData=[];var maxRows=el.closest('.cpf-section').data('repeater-max-rows');if(el.data('tc-repeater-init')){return}
576elementInnerWrap=el.find('.tc-section-inner-wrap');repeaterElement=elementInnerWrap.find('.tc-repeater-section');length=repeaterElement.length;tmEpoField=elementInnerWrap.find('.sections_repeater');repeaterElement.first().find('.tm-epo-field').toArray().forEach(function(field){var epofield=$(field);var id=epofield.attr('id');if(epofield.is(':checkbox')){fieldData[id]=epofield.filter(':checked').toArray().map(function(x){return $(x).val()})}else if(epofield.is(':radio')){fieldData[id]=epofield.filter(':checked').val()}else{fieldData[id]=epofield.val()}});el.data('repeater-init-value',fieldData);el.data('tc-repeater-init',length);el.data('tc-repeater-name',tmEpoField.attr('name'));if(qtyElement.length){qtyElement.off('change.rs'+qx+'cpf input.rs'+qx+'cpf').on('change.rs'+qx+'cpf input.rs'+qx+'cpf',function(event){var field=$(this);var prevValue=field.data('epopreviousvalue'+qx);var value=$.epoAPI.applyFilter('qtyElementForRepeaterQuantityValue',field.val(),{epo:epoObject,currentCart:currentCart,obj:obj,qtyElement:qtyElement,field:field});var difference=value-prevValue;var thisRepeaterElement;var i;var ele;var cloned;var repeaterLastUL;var fieldprevval;var firstcloned;if(prevValue===undefined){prevValue=value-1;difference=value-prevValue}
577if(event.isTrigger!==undefined){prevValue=el.find('.tc-section-inner-wrap').find('.tc-repeater-section').length;difference=value-prevValue}
578if(maxRows&&difference>maxRows){difference=maxRows-1}
579if(difference===0){return}
580fieldprevval=$.epoAPI.applyFilter('qtyElementForRepeaterQuantity_epopreviousvalue',field.val(),{epo:epoObject,currentCart:currentCart,obj:obj,qtyElement:qtyElement,field:field});if(fieldprevval<=0){fieldprevval=1}
581if(qx===quantityRepeaters.length){field.data('epopreviousvalue'+qx,fieldprevval)}
582if(difference>0){thisRepeaterElement=elementInnerWrap.find('.tc-repeater-section').eq(value-1);if(thisRepeaterElement.length){return}
583for(i=0;i<difference;i++){cloned=repeaterAddSection(el,elementInnerWrap);if(cloned){if(!firstcloned){firstcloned=cloned}
584if(ele){ele=ele.add(cloned[0])}else{ele=cloned[0]}
585if(i===0){repeaterLastUL=cloned[2]}}}
586if(ele){tmEpoField.val(function(ii,currentValue){return currentValue?parseInt(currentValue,10)+parseInt(difference,10):2});firstcloned[1].after(ele);repeaterAddSectionAfter(epoObject,ele,repeaterLastUL)}}else{for(i=value-difference;i>value;i-=1){thisRepeaterElement=elementInnerWrap.find('.tc-repeater-section').eq(i-1);repeaterDeleteSection(elementInnerWrap,thisRepeaterElement,el)}
587tmEpoField.val(elementInnerWrap.find('.tc-repeater-section').length)}
588currentCart.trigger({type:'tm-epo-update',norules:2})});qtyElement.data('epopreviousvalue'+qx,$.epoAPI.applyFilter('qtyElementForRepeaterQuantityValue',qtyElement.val(),{epo:epoObject,currentCart:currentCart,obj:obj,qtyElement:qtyElement,field:qtyElement})).trigger('change')}});obj.find('.tc-repeater-section-delete .delete').on('click',function(){var $this=$(this);var elementInnerWrap=$this.closest('.tc-section-inner-wrap');var repeaterElement=$this.closest('.tc-repeater-section');var tmEpoField;tmEpoField=elementInnerWrap.find('.sections_repeater');repeaterDeleteSection(elementInnerWrap,repeaterElement,elementInnerWrap.find('.tc-section-repeater-add'),$this);tmEpoField.val(function(ii,currentValue){return currentValue?parseInt(currentValue,10)-1:2});epoObject.form.trigger({type:'tm-epo-update',norules:2})})}}
589function tm_set_color_pickers(obj){if(!obj){return}
590obj=$(obj).find('.tm-color-picker');if(obj.length){obj.spectrum({type:'color',theme:'epo',showButtons:!0,allowEmpty:!0,showInitial:!0,showInput:!0,clickoutFiresChange:!1,chooseText:TMEPOJS.closeText,cancelText:TMEPOJS.i18n_cancel,clearText:''});obj.spectrum('enable')}}
591function tm_set_lightbox(obj){if(!obj){return}
592if($(obj).length){$(function(){$(obj).tclightbox()})}}
593function has_active_changes_product_image(field){var uic=field.closest('.tmcp-field-wrap').find('label img');var src=$(uic).first().attr('data-original');if(field.is('select.tm-product-image')){field=field.children('option:selected')}
594if(!src){src=$(uic).first().attr('src')}
595if(!src){src=field.attr('data-image')}
596if(field.attr('data-imagep')){src=field.attr('data-imagep')}
597if(src){return!0}
598return!1}
599function tm_set_upload_fields(epoObject){var field;var dT;var name;var file;var selector=epoObject.is_associated?epoObject.this_epo_container.find('.tm-epo-field.tmcp-upload'):epoObject.this_epo_container.find('.tm-epo-field.tmcp-upload').not(tcAPI.epoSelector+' '+tcAPI.associatedEpoSelector+' .tm-epo-field.tmcp-upload');try{selector.not(tcAPI.epoSelector+' '+tcAPI.associatedEpoSelector+' .tm-epo-field.tmcp-upload').toArray().forEach(function(el){var dataFiles;var dataFilename;file=[];field=$(el);if(field.attr('data-file')===''){return!1}
600dataFiles=field.attr('data-file').split('|');if(dataFiles.length===0){return!1}
601if(ClipboardEvent||DataTransfer){dT=new ClipboardEvent('').clipboardData||new DataTransfer()}
602dataFiles.forEach(function(dataFile){dataFilename=$.epoAPI.util.basename(dataFile);if(ClipboardEvent||DataTransfer){dT.items.add(new File([dataFile],dataFilename))}
603file.push(dataFile)});if(dT){el.files=dT.files}
604file=file.join('|');name=field.attr('name');field.trigger('tcupload');field.after('<input type="hidden" class="tmcp-upload-hidden" name="'+name+'" value="'+file+'">');field.removeAttr('data-file')})}catch(err){window.console.log(err);$('.tm-epo-field.tmcp-upload').not('.tm-multiple-file-upload').addClass('tc-nodt');errorObject=err}}
605function tm_set_upload_rules(epoObject){var epoEventId=epoObject.epoEventId;var this_epo_container=epoObject.this_epo_container;if(TMEPOJS.tm_epo_upload_popup==='yes'){$.tcepo.formSubmitEvents[epoEventId][$.tcepo.formSubmitEvents[epoEventId].length]={trigger:function(){return!0},on_true:function(){var upload_fields=this_epo_container.data('num_uploads');var thisPopup;var ajaxSuccessFunc;if(upload_fields&&Object.keys(upload_fields).length){thisPopup=$.tcFloatBox({fps:1,ismodal:!0,width:'50%',height:'300px',classname:'flasho tc-wrapper',data:$.epoAPI.template.html(tcAPI.templateEngine.tc_upload_messages,{files:upload_fields,title:TMEPOJS.i18n_uploading_files,message:TMEPOJS.i18n_uploading_message})});ajaxSuccessFunc=function(){thisPopup.destroy();jDocument.off('ajaxSuccess',ajaxSuccessFunc)};jDocument.on('ajaxSuccess',ajaxSuccessFunc)}
606return!0},on_false:function(){return!0}}}}
607function tm_set_expanables(){var obj=$('.tc-expand');obj.toArray().forEach(function(o){var el=$(o);var max=parseInt(el.attr('data-max-items'),10);var ul=el.find('.tmcp-ul-wrap');var gap=ul.css('gap')||ul.css('row-gap');var lis=ul.find('> li');var lisMax=lis.slice(0,max);var height;var totalHeight;if(lisMax.length){totalHeight=lis.toArray().reduce(function(sum,element){return sum+$(element).outerHeight(!0)},0);totalHeight='calc(100px + '+totalHeight+'px + ('+gap+' * ('+max+' - 1) ) )';height=lisMax.toArray().reduce(function(sum,element){return sum+$(element).outerHeight(!0)},0);height='calc('+height+'px + ('+gap+' * ('+max+' - 1) ) )';ul.css('max-height',height);ul.after($('<button type="button" data-height="'+height+'" data-total-height="'+totalHeight+'" class="button load-more-button">Load more</button>'))}});jDocument.on('click.txexpand','.load-more-button',function(){var b=$(this);var h;if(b.is('.expanded')){b.removeClass('expanded')}else{b.addClass('expanded')}
608h=b.is('.expanded')?$(this).attr('data-total-height'):$(this).attr('data-height');b.prev().css('max-height',h)})}
609function tm_set_checkboxes_rules(epoObject){var this_epo_container=epoObject.this_epo_container;var main_product=epoObject.main_product;var epoEventId=epoObject.epoEventId;var limit_cont=this_epo_container.find('.tm-limit');var exactlimit_cont=this_epo_container.find('.tm-exactlimit');var minimumlimit_cont=this_epo_container.find('.tm-minimumlimit');this_epo_container.on('change.cpflimit','input.tm-epo-field.tmcp-checkbox',function(){var $this=$(this);tm_limit_c_selection($this,!0);tm_exact_c_selection($this,!0)});if(limit_cont.length){tm_check_limit_cont(limit_cont,main_product,epoEventId)}
610if(exactlimit_cont.length){tm_check_exactlimit_cont(exactlimit_cont,main_product,epoEventId)}
611if(minimumlimit_cont.length){tm_check_minimumlimit_cont(minimumlimit_cont,epoEventId)}}
612function tm_theme_specific_actions(epoObject){var this_epo_container=epoObject.this_epo_container;var theme_name=TMEPOJS.theme_name;var all_epo_selects;var blaszok_selects;if(theme_name){theme_name=theme_name.toLowerCase();all_epo_selects=this_epo_container.find('select');switch(theme_name){case 'flatsome':case 'flatsome-child':case 'flatsome child':all_epo_selects.wrap('<div class="custom select-wrapper"/>');break;case 'avada':case 'avada-child':case 'avada child':all_epo_selects.wrap('<div class="avada-select-parent tm-select-parent"></div>');$('<div class="select-arrow">&#xe61f;
612</div>').appendTo(this_epo_container.find('.tm-select-parent'));if(window.calc_select_arrow_dimensions){window.calc_select_arrow_dimensions();jWindow.on('tmsectionpoplink cpflogicdone',function(){window.calc_select_arrow_dimensions()})}else if(window.calcSelectArrowDimensions){window.calcSelectArrowDimensions();jWindow.on('tmsectionpoplink cpflogicdone',function(){window.calcSelectArrowDimensions()})}
613break;case 'bazar':case 'bazar-child':case 'bazar child':all_epo_selects.wrap('<div class="tm-select-wrapper select-wrapper"/>');break;case 'blaszok':case 'blaszok-child':case 'blaszok child':blaszok_selects=function(){setTimeout(function(){$('.tm-extra-product-options select').not('.hasCustomSelect').filter(':visible').toArray().forEach(function(el){el=$(el);if(!el.is('.mpcthSelect')){el.width(el.outerWidth());el.customSelect({customClass:'mpcthSelect'})}})},100)};jWindow.on('cpflogicrun',function(){blaszok_selects()});jWindow.on('epo_options_visible',function(){blaszok_selects()});break;case 'handmade':case 'handmade child theme':$('.tm-owl-slider.tcowl-carousel').addClass('manual');break}
614jWindow.trigger('tm-theme-specific-actions',{epo:{theme_name:theme_name,all_epo_selects:all_epo_selects}})}
615jDocument.off('click.cpf','.quantity:not(.buttons_added) .minus, .quantity:not(.buttons_added) .plus').on('click.cpf','.quantity:not(.buttons_added) .minus, .quantity:not(.buttons_added) .plus',function(){$(this).closest('.quantity').find(tcAPI.qtySelector).trigger('change.cpf')})}
616function tm_custom_variations(epoObject,form,item_id,$main_product,$epo_holder){var epoEventId=epoObject.epoEventId;var variation_id_selector="input[name^='variation_id']";var tm_epo_variation_section;var li_variations;var composite_load_test;var form_event;var type;var name;var selector;var func;var i;var eventName=epoObject.is_associated?'tc_variation_form.tmlogic':'wc_variation_form.tmlogic';var eventNamePrefix=epoObject.is_associated?'tc_':'';var variationsForm=epoObject.variations_form;var variationsTable=epoObject.is_associated?variationsForm.find('.tc-epo-element-variations'):variationsForm.find('.variations');var resetSelector=epoObject.is_associated?'.tc-epo-element-variable-reset-variations':'.reset_variations';variationsForm.attr('data-epo_id',epoObject.epo_id);if(form.find('input.variation_id').length>0){variation_id_selector='input.variation_id'}
617if($epo_holder.find('.tm-epo-variation-element').length||$epo_holder.data('tm-epo-variation-element')){tm_epo_variation_section=$epo_holder.find('.tm-epo-variation-section').first();tm_epo_variation_section.find('.cpf-type-variations').attr('data-epo_id',epoObject.epo_id).attr('data-product_id',variationsForm.attr('data-product_id'));$epo_holder.data('tm-epo-variation-element',tm_epo_variation_section.find('.tm-epo-variation-element'));if(item_id&&item_id!=='main'&&!epoObject.is_associated){variationsForm=epoObject.form;variationsTable=variationsForm.find('.composite_component[data-item_id="'+item_id+'"]').find('.variations');variationsForm.attr('data-epo_id',epoObject.epo_id);if(variationsTable.length===0){return}
618li_variations=tm_epo_variation_section.closest('li.tm-extra-product-options-field');if(!tm_epo_variation_section.is('.tm-hidden')){variationsTable.hide()}
619variationsTable.after(tm_epo_variation_section.addClass('tm-extra-product-options nopadding'));if(li_variations.children().length===0||li_variations.text().trim()===''){li_variations.remove()}
620if(!tm_epo_variation_section.is('.section_popup')){tm_epo_variation_section.removeClass('tc-cell');tm_epo_variation_section.wrap("<div class='tc-styled-variations'></div>")}else{tm_epo_variation_section.wrap("<div class='tc-styled-variations tc-row'></div>")}
621composite_load_test=!1;form.off(eventName).on(eventName,function(){composite_load_test=!0;variationsForm.on('click.tmlogic','.reset_variations',function(){tm_epo_variation_section.find('select.tm-epo-variation-element').val('').children('option').prop('disabled',!1).show();tm_epo_variation_section.find('.tm-epo-variation-element').prop('disabled',!1).removeClass('tm-disabled').prop('checked',!1).closest('li').show();jWindow.trigger('tmlazy');tm_epo_variation_section.find('.tm-epo-variation-element').trigger('tm_trigger_product_image');tm_epo_variation_section.find('li').removeClass('tc-active tm-attribute-disabled').css('opacity','')});form.off('woocommerce_update_variation_values_tmlogic').on('woocommerce_update_variation_values_tmlogic',function(){tm_custom_variations_update(form,epoObject)});for(i=0;i<lateVariationEvent.length;i+=1){form_event=lateVariationEvent[i];type=typeof form_event;if(type==='object'){name=typeof form_event.name==='string'||!1;selector=typeof form_event.selector==='string'||!1;func=typeof form_event.func==='function'||!1;if(name&&func){if(selector==="input[name='variation_id']"){selector=variation_id_selector}
622if(form_event.selector){form.data('tm-styled-variations',1).off(eventNamePrefix+form_event.name+i,selector).on(eventNamePrefix+form_event.name+i,selector,form_event.func)}else{form.data('tm-styled-variations',1).off(eventNamePrefix+form_event.name+i).on(eventNamePrefix+form_event.name+i,form_event.func)}}}}
623lateVariationEvent=[];tm_epo_variation_section.find('.tm-epo-variation-element:not(.tm-hidden .tm-epo-variation-element)').last().trigger('tm_epo_variation_element_change')});$(function(){if(composite_load_test===!1){form.trigger(eventName)}})}else{if(tm_epo_variation_section.length){if(!tm_epo_variation_section.is('.tm-hidden')){variationsTable.hide()}
624li_variations=tm_epo_variation_section.closest('li.tm-extra-product-options-field');variationsTable.after(tm_epo_variation_section.addClass('tm-extra-product-options nopadding'));if(li_variations.children().length===0||li_variations.text().trim()===''){li_variations.remove()}
625if(!tm_epo_variation_section.is('.section_popup')){tm_epo_variation_section.removeClass('tc-cell');tm_epo_variation_section.wrap("<div class='tc-styled-variations'></div>")}else{tm_epo_variation_section.wrap("<div class='tc-styled-variations tc-row'></div>")}
626variationsForm.off('click.tmlogic',resetSelector).on('click.tmlogic',resetSelector,function(){tm_epo_variation_section.find('select.tm-epo-variation-element').val('').children('option').prop('disabled',!1).show();tm_epo_variation_section.find('.tm-epo-variation-element').prop('disabled',!1).removeClass('tm-disabled').prop('checked',!1).closest('li').show();jWindow.trigger('tmlazy');tm_epo_variation_section.find('.tm-epo-variation-element').trigger('tm_trigger_product_image');tm_epo_variation_section.find('li').removeClass('tc-active tm-attribute-disabled').css('opacity','')})}
627variationsForm.off('woocommerce_update_variation_values_tmlogic').on('woocommerce_update_variation_values_tmlogic',function(){tm_custom_variations_update(variationsForm,epoObject)});for(i=0;i<lateVariationEvent.length;i+=1){form_event=lateVariationEvent[i];type=typeof form_event;if(type==='object'){name=typeof form_event.name==='string'||!1;selector=typeof form_event.selector==='string'||!1;func=typeof form_event.func==='function'||!1;if(name&&func){if(selector==="input[name='variation_id']"){selector=variation_id_selector}
628if(form_event.selector){variationsForm.data('tm-styled-variations',1).off(eventNamePrefix+form_event.name+i,selector).on(eventNamePrefix+form_event.name+i,selector,form_event.func)}else{variationsForm.data('tm-styled-variations',1).off(eventNamePrefix+form_event.name+i).on(eventNamePrefix+form_event.name+i,form_event.func)}}}}
629lateVariationEvent=[];tm_epo_variation_section.find('.tm-epo-variation-element:not(.tm-hidden .tm-epo-variation-element)').last().trigger('tm_epo_variation_element_change')}
630$.tcepo.formSubmitEvents[epoEventId][$.tcepo.formSubmitEvents[epoEventId].length]={trigger:function(){return!0},on_true:function(){tm_epo_variation_section.find('.tm-epo-variation-element').attr('disabled','disabled');return!0},on_false:function(){tm_epo_variation_section.find('.tm-epo-variation-element').prop('disabled',!1)}};$(document.body).on('added_to_cart',function(){tm_epo_variation_section.find('.tm-epo-variation-element').prop('disabled',!1)})}}
631function repopulate_backup_image_atts(img,product_element){var $gallery_img=product_element.find('.flex-control-nav li:eq(0) img');var $gallery_wrapper=product_element.find('.woocommerce-product-gallery__wrapper ');var $product_img_wrap=$gallery_wrapper.find('.woocommerce-product-gallery__image, .woocommerce-product-gallery__image--placeholder').eq(0);var $product_img=img;var $product_link=img.closest('a');$product_img.attr('data-o_'+'src',$.tc_product_image_store[0].src);$product_img.attr('data-o_'+'srcset',$.tc_product_image_store[0].srcset);$product_img.attr('data-o_'+'sizes',$.tc_product_image_store[0].sizes);$product_img.attr('data-o_'+'title',$.tc_product_image_store[0].title);$product_img.attr('data-o_'+'alt',$.tc_product_image_store[0].alt);$product_img.attr('data-o_'+'data-src',$.tc_product_image_store[0]['data-src']);$product_img.attr('data-o_'+'data-large_image',$.tc_product_image_store[0]['data-large_image']);$product_img.attr('data-o_'+'data-large_image_width',$.tc_product_image_store[0]['data-large_image_width']);$product_img.attr('data-o_'+'data-large_image_height',$.tc_product_image_store[0]['data-large_image_height']);$product_img_wrap.attr('data-o_'+'data-thumb',$.tc_product_image_store[1]['data-thumb']);if($.tc_product_image_store[2]){$gallery_img.attr('data-o_'+'src',$.tc_product_image_store[2].src)}
632$product_link.attr('data-o_'+'href',$.tc_product_image_store[3].href);$product_link.attr('data-o_'+'title',$.tc_product_image_store[3].title)}
633function reset_saved_image(img,product_element){var $gallery_img=product_element.find('.flex-control-nav li:eq(0) img');var $gallery_wrapper=product_element.find('.woocommerce-product-gallery__wrapper ');var $product_img_wrap=$gallery_wrapper.find('.woocommerce-product-gallery__image, .woocommerce-product-gallery__image--placeholder').eq(0);var $product_img=img;var $product_link=img.closest('a');if(!$.isEmptyObject($.tc_product_image)){$.tc_product_image_store=$.tc_pre_populate_store();$.tc_product_image_store=$.tc_maybe_copy_object_values($.tc_product_image_store,$.tc_product_image)}else{$.tc_product_image_store=$.tc_populate_store(img,product_element)}
634$product_img.tc_update_attr('src',0);$product_img.tc_update_attr('srcset',0);$product_img.tc_update_attr('sizes',0);$product_img.tc_update_attr('title',0);$product_img.tc_update_attr('alt',0);$product_img.tc_update_attr('data-src',0);$product_img.tc_update_attr('data-large_image',0);$product_img.tc_update_attr('data-large_image_width',0);$product_img.tc_update_attr('data-large_image_height',0);$product_img_wrap.tc_update_attr('data-thumb',1);$gallery_img.tc_update_attr('src',2);$product_link.tc_update_attr('href',3);$product_link.tc_update_attr('title',3)}
634
635function image_update(data,img,product_element){var $gallery_img=product_element.find('.flex-control-nav li:eq(0) img');var $gallery_wrapper=product_element.find('.woocommerce-product-gallery__wrapper ');var $product_img_wrap=$gallery_wrapper.find('.woocommerce-product-gallery__image, .woocommerce-product-gallery__image--placeholder').eq(0);var $product_img=img;var $product_link=img.closest('a');var $img_zoom=$product_link.next('.zoomImg');if(data&&data.image_link&&data.image_link&&data.image_link.length>1){if(data.full_src===null||data.full_src===''){data.full_src=data.image_link}
636if(data.full_src_w===null||data.full_src_w===''){data.full_src_w=$product_img.attr('data-large_image_width')}
637if(data.full_src_h===null||data.full_src_h===''){data.full_src_h=$product_img.attr('data-large_image_height')}
638if($product_img.length){if(!data.image_srcset){data.image_sizes=!1}
639if(!data.image_sizes){data.image_srcset=!1}
640$product_img.tc_set_attr('src',data.image_link,0);$product_img.tc_set_attr('srcset',data.image_srcset,0);$product_img.tc_set_attr('sizes',data.image_sizes,0);$product_img.tc_set_attr('title',data.image_title,0);$product_img.tc_set_attr('alt',data.image_alt,0);$product_img.tc_set_attr('data-src',data.full_src,0);$product_img.tc_set_attr('data-large_image',data.full_src,0);$product_img.tc_set_attr('data-large_image_width',data.full_src_w,0);$product_img.tc_set_attr('data-large_image_height',data.full_src_h,0);$product_img_wrap.tc_set_attr('data-thumb',data.image_link,1)}
641if($gallery_img.length){$gallery_img.tc_set_attr('src',data.image_link,2);$gallery_img.tc_set_attr('srcset',data.image_srcset,2);$gallery_img.tc_set_attr('sizes',data.image_sizes,2)}
642if($product_link.length){$product_link.tc_set_attr('href',data.full_src,3);$product_link.tc_set_attr('title',data.image_caption,3)}
643if($img_zoom.length){$img_zoom.tc_set_attr('src',data.full_src,4)}}else{if($product_img.length){$product_img.tc_reset_attr('src',0);$product_img.tc_reset_attr('srcset',0);$product_img.tc_reset_attr('sizes',0);$product_img.tc_reset_attr('title',0);$product_img.tc_reset_attr('alt',0);$product_img.tc_reset_attr('data-src',0);$product_img.tc_reset_attr('data-large_image',0);$product_img.tc_reset_attr('data-large_image_width',0);$product_img.tc_reset_attr('data-large_image_height',0);$product_img_wrap.tc_reset_attr('data-thumb',1)}
644if($gallery_img.length){$gallery_img.tc_reset_attr('src',2);$gallery_img.tc_reset_attr('srcset',2);$gallery_img.tc_reset_attr('sizes',2)}
645if($product_link.length){$product_link.tc_reset_attr('href',3);$product_link.tc_reset_attr('title',3)}
646if($img_zoom.length){$img_zoom.tc_reset_attr('src',4)}}}
647function get_main_product_image(epoObject,product_element){var img;if(epoObject.is_associated){img=product_element.find('.tc-product-image .wp-post-image').first()}else if(TMEPOJS.tm_epo_global_product_image_selector!==''){img=$(TMEPOJS.tm_epo_global_product_image_selector)}else{img=product_element.find('.woocommerce-product-gallery__image:not(.clone), .woocommerce-product-gallery__image--placeholder:not(.clone)').eq(0).find('.wp-post-image').first();if(img.length===0){img=product_element.find('a.woocommerce-main-image img, img.woocommerce-main-image,a img').not('.thumbnails img,.product_list_widget img').first()}
648if(img.length===0){img=product_element.find('img.wp-post-image').not('.thumbnails img,.product_list_widget img').first()}
649if(img.length===0){img=product_element.find('.elementor-widget-wd_single_product_gallery img.wp-post-image').first()}
650if(img.length===0){img=product_element.find('.elementor-widget-ae-post-image .wp-post-image').first()}
651if(img.length===0){img=$('.woocommerce div.product div.images').not('.thumbnails img,.product_list_widget img').first()}}
652if($(img).length>1){img=$(img).first()}
653return img}
654function get_product_element(epoObject){var main_product;var product_id;var product_element;if(epoObject.is_associated){return epoObject.main_product.closest('.tc-epo-element-product-container')}
655main_product=epoObject.main_product;product_id=epoObject.product_id;product_element=main_product.closest('#product-'+product_id);if(product_element.length<=0){product_element=main_product.closest('.post-'+product_id)}
656return product_element}
657function gallery_compatibility_actions(gallery_type,clone_image,preload_img,visible,event_data,$form,product_element){var gallery;var _elements;var ge;var galleryWidth;var zoomEnabled;var image;var zoom_options;for(gallery in gallery_type){if(Object.prototype.hasOwnProperty.call(gallery_type,gallery)){gallery=gallery_type[gallery];if(gallery.enabled){switch(gallery.type){case 'yith':if(!clone_image){if(!visible){gallery.yith_wcmg_zoom.attr('href',gallery._yith_wcmg_default_zoom)}else{gallery.yith_wcmg_zoom.attr('href',gallery.yith_wcmg_default_zoom)}
658if(gallery.element.data('yith_magnifier')){gallery.element.yith_magnifier('destroy')}
659gallery.element.yith_magnifier(window.yith_magnifier_options)}else{clone_image.attr('srcset',preload_img).attr('src-orig',preload_img);if(gallery.element.data('yith_magnifier')){gallery.element.yith_magnifier('destroy')}
660_elements={elements:{zoom:$('.yith_magnifier_zoom'),zoomImage:clone_image,gallery:$('.yith_magnifier_gallery li a')}};gallery.element.yith_magnifier($.extend(!0,{},window.yith_magnifier_options,_elements))}
661break;case 'iosslider':setTimeout(function(g){g.element.iosSlider('update')}.bind(null,gallery),150);break;case 'flexslider':jWindow.trigger('resize');break;case 'elevatezoom':gallery.element.each(function(g,j){var elevateZoom=j(this).data('elevateZoom');if(typeof elevateZoom!=='undefined'){elevateZoom.swaptheimage(g,g)}}.bind(null,preload_img,$));break;case 'easyzoom':gallery.element.swap(null,preload_img);break;case 'easyzoom-flatsome':gallery.element.swap(preload_img,preload_img);break;case 'woocommerce':if(clone_image){gallery.element.flexslider(0);gallery.element.trigger('woocommerce_gallery_reset_slide_position');ge=gallery.element;window.setTimeout(function(g,w){g.trigger('woocommerce_gallery_init_zoom');w.trigger('resize')}.bind(null,ge,jWindow),10)}
662break;case 'zoom':if(product_element){galleryWidth=product_element.find('.woocommerce-product-gallery--with-images').width();zoomEnabled=!1;image=gallery.element.find('img.wp-post-image');if(image.attr('data-large_image_width')>galleryWidth){zoomEnabled=!0}
663if(zoomEnabled){zoom_options={touch:!1};if('ontouchstart' in window){zoom_options.on='click'}
664gallery.element.trigger('zoom.destroy');gallery.element.zoom(zoom_options)}else{gallery.element.trigger('zoom.destroy')}}
665break}}}}
666jWindow.trigger('tm_gallery_compatibility_actions',{event_data:event_data,product_element:product_element,form:$form})}
667function get_gallery_type(epoObject,img,product_element){var is_yith_wcmg;var yith_wcmg;var yith_wcmg_zoom;var yith_wcmg_default_zoom;var _yith_wcmg_default_zoom;var yith_wcmg_default_image;var is_iosSlider;var is_iosSlider_element;var is_flexslider;var is_flexslider_element;var is_elevateZoom;var is_elevateZoom_obj;var is_easyzoom;var is_easyzoom_element;var is_easyzoom_flatsome;var is_easyzoom_flatsome_element;var is_wc27_gallery;var is_wc27_gallery_element;var wc27_zoom_target;var wc_single_product_params;var zoom_target_temp;var is_zoom_enabled;var zoom_images;var gallery;if(epoObject.is_associated){return{}}
668is_yith_wcmg=!1;yith_wcmg=$('.images');yith_wcmg_zoom=$('.yith_magnifier_zoom');yith_wcmg_default_zoom=yith_wcmg.find('.yith_magnifier_zoom').first().attr('href');_yith_wcmg_default_zoom=yith_wcmg_default_zoom;yith_wcmg_default_image=yith_wcmg.find('.yith_magnifier_zoom img').first().attr('src');is_iosSlider=!1;is_iosSlider_element=$('.iosSlider.product-gallery-slider,.iosSlider.product-slider');is_flexslider=!1;is_flexslider_element=product_element.find('.images .fusion-flexslider');is_elevateZoom=img.data('elevateZoom')||!1;is_elevateZoom_obj=product_element.find('div.product-images .woocommerce-main-image');is_easyzoom=!1;
668is_easyzoom_element=product_element.find('.images .easyzoom');is_easyzoom_flatsome=!1;is_easyzoom_flatsome_element=product_element.find('.images .easyzoom');is_wc27_gallery=!1;is_wc27_gallery_element=product_element.find('.woocommerce-product-gallery');wc27_zoom_target=!1;wc_single_product_params=window.wc_single_product_params;is_zoom_enabled=typeof $.fn.zoom==='function'&&wc_single_product_params&&wc_single_product_params.zoom_enabled;zoom_images=!1;if(window.yith_magnifier_options&&yith_wcmg.data('yith_magnifier')){is_yith_wcmg=!0}
669if(is_iosSlider_element.length&&is_iosSlider_element.iosSlider){is_iosSlider=!0}
670if(is_flexslider_element.length&&is_flexslider_element.flexslider){is_flexslider=!0}
671if(is_easyzoom_element.length&&is_easyzoom_element.filter('.images .easyzoom.first').data('easyZoom')){is_easyzoom_element=is_easyzoom_element.filter('.images .easyzoom.first').data('easyZoom');is_easyzoom=!0}
672if(!is_easyzoom){is_easyzoom_flatsome_element=product_element.find('.images .has-image-zoom .slide');if(is_easyzoom_flatsome_element.length&&is_easyzoom_flatsome_element.filter('.images .has-image-zoom .slide.first').data('easyZoom')){is_easyzoom_flatsome_element=is_easyzoom_flatsome_element.filter('.images .has-image-zoom .slide.first').data('easyZoom');is_easyzoom_flatsome=!0}}
673if(document.readyState==='complete'){setTimeout(function(){if(is_easyzoom_element.length&&is_easyzoom_element.data('easyZoom')){is_easyzoom_element=is_easyzoom_element.data('easyZoom');is_easyzoom=!0}
674if(is_easyzoom_flatsome_element.length&&is_easyzoom_flatsome_element.data('easyZoom')){is_easyzoom_flatsome_element=is_easyzoom_flatsome_element.data('easyZoom');is_easyzoom_flatsome=!0}},150)}else{jWindow.on('load',function(){setTimeout(function(){if(is_easyzoom_element.length&&is_easyzoom_element.data('easyZoom')){is_easyzoom_element=is_easyzoom_element.data('easyZoom');is_easyzoom=!0}
675if(is_easyzoom_flatsome_element.length&&is_easyzoom_flatsome_element.data('easyZoom')){is_easyzoom_flatsome_element=is_easyzoom_flatsome_element.data('easyZoom');is_easyzoom_flatsome=!0}},150)})}
676if(is_wc27_gallery_element.length&&is_wc27_gallery_element.data('flexslider')){is_wc27_gallery=!0;if(typeof $.fn.zoom==='function'&&wc_single_product_params&&wc_single_product_params.zoom_enabled){zoom_target_temp=img.closest('.woocommerce-product-gallery__image');if(zoom_target_temp.length>0){wc27_zoom_target=zoom_target_temp;img.data.wc27_zoom_target=wc27_zoom_target}}}
677if(!is_wc27_gallery&&is_zoom_enabled){zoom_images=product_element.find('.woocommerce-product-gallery .woocommerce-product-gallery__image')}
678gallery={is_yith_wcmg:{type:'yith',enabled:is_yith_wcmg,element:yith_wcmg,yith_wcmg_zoom:yith_wcmg_zoom,_yith_wcmg_default_zoom:_yith_wcmg_default_zoom,yith_wcmg_default_image:yith_wcmg_default_image},is_iosSlider:{type:'iosslider',enabled:is_iosSlider,element:is_iosSlider_element},is_flexslider:{type:'flexslider',enabled:is_flexslider,element:is_flexslider_element},is_elevateZoom:{type:'elevatezoom',enabled:is_elevateZoom,element:is_elevateZoom_obj},is_easyzoom:{type:'easyzoom',enabled:is_easyzoom,element:is_easyzoom_element},is_easyzoom_flatsome:{type:'easyzoom-flatsome',enabled:is_easyzoom_flatsome,element:is_easyzoom_flatsome_element},is_wc27_gallery:{type:'woocommerce',enabled:is_wc27_gallery,element:is_wc27_gallery_element},is_zoom_enabled:{type:'zoom',enabled:!is_wc27_gallery&&is_zoom_enabled,element:zoom_images}};return gallery}
679function tm_product_image_self(epoObject){var this_epo_container=epoObject.is_associated?epoObject.this_epo_container:epoObject.this_epo_container.not(tcAPI.epoSelector+' '+tcAPI.associatedEpoSelector);var variationsForm=epoObject.variations_form;var main_product=epoObject.main_product;var $form=epoObject.form;var img;var gallery_type;var product_element=get_product_element(epoObject);var last_active_field=[];var el;var el_current;var imp;var selector;var eventNamePrefix=epoObject.is_associated?'tc_':'';var main_tc_product_image_store;img=get_main_product_image(epoObject,product_element);gallery_type=get_gallery_type(epoObject,img,product_element);if($(img).length>0){$form.on(eventNamePrefix+'reset_image.tcpi',function(){setTimeout(function(){if(TMEPOJS.tm_epo_global_image_recalculate==='yes'){img=get_main_product_image(epoObject,product_element);$.tc_product_image_store=main_tc_product_image_store}
680$.tc_product_image=$.tc_replace_object_values($.tc_product_image,$.tc_product_image_store);last_active_field=[];$(this_epo_container.find('.tm-product-image:checked,select.tm-product-image')).add(variationsForm.find('.tm-epo-variation-section').first().find('.tm-product-image:checked,select.tm-product-image')).toArray().forEach(function(pi){pi=$(pi);if(field_is_active(pi)&&pi.val()!==''){last_active_field.push(pi)}});if(last_active_field.length){last_active_field[last_active_field.length-1].trigger('tm_trigger_product_image')}else{$.tc_product_image_store=$.tc_populate_store(img,product_element)}},window.tc_epo_product_image_change_delay||0)});$form.on(eventNamePrefix+'found_variation.tcpi',function(){setTimeout(function(){if(TMEPOJS.tm_epo_global_image_recalculate==='yes'){img=get_main_product_image(epoObject,product_element)}
681reset_saved_image(img,product_element);last_active_field=[];$(this_epo_container.find('.tm-product-image:checked,select.tm-product-image')).add(variationsForm.find('.tm-epo-variation-section').first().find('.tm-product-image:checked,select.tm-product-image')).toArray().forEac
681h(function(pi){pi=$(pi);if(field_is_active(pi)&&pi.val()!==''){last_active_field.push(pi)}});if(last_active_field.length){repopulate_backup_image_atts(img,product_element);last_active_field[last_active_field.length-1].trigger('tm_trigger_product_image')}},window.tc_epo_product_image_change_delay||0)});$.tc_product_image_store=$.tc_maybe_copy_object_values_from_img($.tc_product_image_store,img,product_element);main_tc_product_image_store=$.epoAPI.util.deepCopyArray($.tc_product_image_store);main_product.off('tm_change_product_image').on('tm_change_product_image',function(evt,event_data){var data;evt.stopImmediatePropagation();el=event_data.element;el_current=event_data.element_current;if(el&&el_current){imp=el.data('imagep');selector='';if(imp!==''){selector='imagep'}else if(el.data('changes-product-image')==='images'){selector='image'}
682data=event_data.element_current.data('image-variations');if(data){data=data[selector]}
683if(data===undefined){return}
684last_active_field=[];$(this_epo_container.find('.tm-product-image:checked,select.tm-product-image')).add(variationsForm.find('.tm-epo-variation-section').first().find('.tm-product-image:checked,select.tm-product-image')).toArray().forEach(function(pi){pi=$(pi);if(pi.is('option')){pi=pi.closest('select')}
685if(pi.val()!==''&&field_is_active(pi)){last_active_field.push(pi)}});if(last_active_field.length){if(!last_active_field[last_active_field.length-1].is(el)){return}}
686setTimeout(function(){if(TMEPOJS.tm_epo_global_image_recalculate==='yes'){img=get_main_product_image(epoObject,product_element)}
687image_update(data,img,product_element);gallery_compatibility_actions(gallery_type,img,data.image_link,!1,event_data,$form,product_element)},window.tc_epo_product_image_change_delay||0)}});main_product.off('tm_restore_product_image').on('tm_restore_product_image',function(evt,event_data){evt.stopImmediatePropagation();el=event_data?event_data.element:!1;last_active_field=[];if(el){$(this_epo_container.find('.tm-product-image:checked,select.tm-product-image')).add(variationsForm.find('.tm-epo-variation-section').first().find('.tm-product-image:checked,select.tm-product-image')).toArray().forEach(function(pi){pi=$(pi);if(field_is_active(pi)&&pi.val()!==''){last_active_field.push(pi)}});if(last_active_field.length){if(!last_active_field[last_active_field.length-1].is(el)){last_active_field[last_active_field.length-1].trigger('tm_trigger_product_image');return}}}
688setTimeout(function(){if(TMEPOJS.tm_epo_global_image_recalculate==='yes'){img=get_main_product_image(epoObject,product_element)}
689image_update(!1,img,product_element);gallery_compatibility_actions(gallery_type,!1,img.attr('src'),!1,event_data,$form,product_element)},window.tc_epo_product_image_change_delay||0)});last_active_field=[];$(this_epo_container.find('.tm-product-image:checked,select.tm-product-image')).add(variationsForm.find('.tm-epo-variation-section').first().find('.tm-product-image:checked,select.tm-product-image')).toArray().forEach(function(pi){pi=$(pi);if(field_is_active(pi)&&pi.val()!==''){last_active_field.push(pi)}});if(last_active_field.length){last_active_field[last_active_field.length-1].trigger('tm_trigger_product_image')}}
690jWindow.trigger('tm_product_image_loaded')}
691function tm_product_image_inline(epoObject){var this_epo_container=epoObject.is_associated?epoObject.this_epo_container:epoObject.this_epo_container.not(tcAPI.epoSelector+' '+tcAPI.associatedEpoSelector);var main_product=epoObject.main_product;var product_id=epoObject.product_id;var $form=epoObject.form;var img;var product_element=get_product_element(epoObject);var gallery_type;var a;var img_src_original;var img_width;var img_height;var last_active_field=[];img=get_main_product_image(epoObject,product_element);gallery_type=get_gallery_type(epoObject,img,product_element);if($(img).length>0){img.data('tm-current-image',!1);a=img.closest('a');img_src_original=img.attr('src');img_width=img.width();img_height=img.height();main_product.off('tm_change_product_image').on('tm_change_product_image',function(evt,e){setTimeout(function(){var variation_element_section;var is_variation_element;var $this_epo_container;var tm_last_visible_image_element;var last_activate_field=[];var tm_current_image_element_id;var can_show_image;var $main_product;var $current_product_element;var preload_width;var preload_height;var current_cloned_image;var preloader;var clone_image;var preload_img;var preload_img_onerror;if(TMEPOJS.tm_epo_global_image_recalculate==='yes'){img=get_main_product_image(epoObject,product_element)}
692variation_element_section=e.element.closest('.cpf-section');is_variation_element=variation_element_section.is('.tm-epo-variation-section');$this_epo_container=e.epo_holder;if(is_variation_element){$this_epo_container=variation_element_section}
693tm_last_visible_image_element=$this_epo_container.find('.tm-product-image:checked,select.tm-product-image');last_activate_field=[];tm_current_image_element_id=e.element.attr('id');can_show_image=!0;$main_product=e.main_product;$current_product_element=$main_product.closest('#product-'+product_id);preload_width=img_width;preload_height=img_height;preloader=$("<div class='blockUI blockOverlay tm-preloader-img'></div>");if($current_product_element.length<=0){$current_product_element=$main_product.closest('.post-'+product_id)}
694current_cloned_image=$current_product_element.find('#'+tm_current_image_element_id+'_tmimage');if(current_cloned_image.length===0){current_cloned_image=img}
695preload_img_onerror=function(){preloader.remove();$form.tc_image_update(!1);img.data('tm-current-image',!1);$current_product_element.find('.tm-clone-product-image').hide();img.show()};if(e.src===current_cloned_image.attr('src')&&current_cloned_image.is(':visible')){return}
696if(e.src===!1){preload_img_onerror();return}
697preloader.css({width:preload_width,height:preload_height});tm_last_visible_image_element.toArray().forEach(function(ie){ie=$(ie);if(field_is_active(ie)&&has_active_changes_product_image(ie)&&tm_check_field_match({element:ie.closest('.cpf-element'),rule:{operator:'isnotempty',value:''},type:'element'})){last_activate_field.push(ie)}});if(last_activate_field.length){tm_last_visible_image_element=last_activate_field[last_activate_field.length-1]}
698if(tm_last_visible_image_element.attr('id')!==e.element.attr('id')){can_show_image=!1}
699clone_image=img.tcClone();preload_img=new Image();clone_image.removeAttr('data-o_src').removeAttr('data-o_title').removeAttr('data-o_alt').removeAttr('data-o_srcset').removeAttr('data-o_sizes').removeAttr('srcset').removeAttr('sizes');if(can_show_image){img.before(preloader)}
700gallery_type.is_yith_wcmg.yith_wcmg_default_zoom=gallery_type.is_yith_wcmg.element.find('.yith_magnifier_zoom').first().attr('href');gallery_type.is_yith_wcmg.yith_wcmg_default_image=gallery_type.is_yith_wcmg.element.find('.yith_magnifier_zoom img').first().attr('src');preload_img.onerror=function(){preload_img_onerror()};preload_img.onload=function(){if('naturalHeight' in this){if(this.naturalHeight+this.naturalWidth===0){this.onerror();return}}else if(this.width+this.height===0){this.onerror();return}
701$current_product_element.find('#'+tm_current_image_element_id+'_tmimage').remove();$current_product_element.find('.tm-clone-product-image').hide();clone_image.prop('src',preload_img.src).hide();img.hide().after(clone_image);clone_image.css('opacity',0).show();gallery_compatibility_actions(gallery_type,clone_image,preload_img.src);preloader.animate({opacity:0}
701,750,'easeOutExpo',function(){preloader.remove()});clone_image.animate({opacity:1},window.tc_epo_image_animation_delay||1500,'easeOutExpo',function(){});jWindow.trigger('tm_change_product_image_loaded',{src:e.src,element:e.element,main_product:e.main_product,epo_holder:e.epo_holder})};clone_image.attr('id',tm_current_image_element_id+'_tmimage').addClass('tm-clone-product-image').hide();if(clone_image.attr('src-orig')){clone_image.attr('src-orig',e.src)}
702if(can_show_image){preload_img.src=e.src;$form.tc_image_update(e.element,clone_image);img.data('tm-current-image',tm_current_image_element_id);jWindow.trigger('tm_change_product_image_show',{src:e.src,element:e.element,main_product:e.main_product,epo_holder:e.epo_holder})}else{clone_image.prop('src',e.src).hide();img.after(clone_image)}
703jWindow.trigger('tm_change_product_image_end',{src:e.src,element:e.element,main_product:e.main_product,epo_holder:e.epo_holder})},window.tc_epo_product_image_change_delay||0)});main_product.off('tm_restore_product_image').on('tm_restore_product_image',function(evt,e){setTimeout(function(){var tm_current_image_element_id;var $main_product;var $current_product_element;var variation_element_section;var is_variation_element;var current_element;var current_image_replacement;var found;var is_it_visible;var len;var el_to_check;var imgSrc;var $this_epo_container;var i;if(!e||!e.element){return!1}
704if(TMEPOJS.tm_epo_global_image_recalculate==='yes'){img=get_main_product_image(epoObject,product_element)}
705jWindow.trigger('tm_restore_product_image_pre',{element:e.element,main_product:e.main_product,epo_holder:e.epo_holder});tm_current_image_element_id=e.element.attr('id');$main_product=e.main_product;$current_product_element=$main_product.closest('#product-'+product_id);variation_element_section=e.element.closest('.cpf-section');is_variation_element=variation_element_section.is('.tm-epo-variation-section');found=!1;imgSrc=img_src_original;$this_epo_container=e.epo_holder;if(is_variation_element){$this_epo_container=variation_element_section}
706if($current_product_element.length<=0){$current_product_element=$main_product.closest('.post-'+product_id)}
707is_it_visible=$current_product_element.find('#'+tm_current_image_element_id+'_tmimage').is(':visible');$current_product_element.find('#'+tm_current_image_element_id+'_tmimage').remove();if($current_product_element.find('.tm-clone-product-image').length===0){img.show();img.data('tm-current-image',!1);$form.tc_image_update(!1)}else{if(!is_it_visible){jWindow.trigger('tm_restore_product_image_loaded_exit',{element:e.element,main_product:e.main_product,epo_holder:e.epo_holder});return}
708len=$current_product_element.find('.tm-clone-product-image').length;tm_current_image_element_id=img.data('tm-current-image');for(i=len-1;i>=0;i-=1){current_image_replacement=$current_product_element.find('.tm-clone-product-image').eq(i);current_element=current_image_replacement.attr('id').replace('_tmimage','');el_to_check=$this_epo_container.find("[id='"+current_element+"']");if(el_to_check.is(':checked')&&el_to_check.closest('.cpf-element').is(':visible')){$current_product_element.find('.tm-clone-product-image').eq(i).show();a.attr('href',$current_product_element.find('.tm-clone-product-image').eq(i).prop('src'));img.data('tm-current-image',current_element);found=!0;break}else{$current_product_element.find('.tm-clone-product-image').eq(i).hide()}}
709if(!found){img.show();img.data('tm-current-image',!1);$form.tc_image_update(!1)}else{$current_product_element.find('#'+tm_current_image_element_id+'_tmimage').remove()}}
710if(found){imgSrc=current_image_replacement.attr('src')}
711gallery_compatibility_actions(gallery_type,!1,imgSrc,$current_product_element.find('.tm-clone-product-image').filter(':visible').length);jWindow.trigger('tm_restore_product_image_loaded',{element:e.element,main_product:e.main_product,epo_holder:e.epo_holder})},window.tc_epo_product_image_change_delay||0)});main_product.off('tm_attempt_product_image').on('tm_attempt_product_image',function(evt,e){setTimeout(function(){var $main_product;var $current_product_element;var variation_element_section;var is_variation_element;var $this_epo_container;var tm_last_visible_image_element;var last_activate_field;var tm_last_visible_image_element_id;var current_image_replacement;var current_element;var found;var tm_current_image_element_id;var len;var imgSrc;var el_to_check;var tmcie_id;var i;if(TMEPOJS.tm_epo_global_image_recalculate==='yes'){img=get_main_product_image(epoObject,product_element)}
712$main_product=e.main_product;$current_product_element=$main_product.closest('#product-'+product_id);if(e.element){variation_element_section=e.element.closest('.cpf-section')}else{variation_element_section=$($main_product.find('.tm-epo-variation-section').first(),e.epo_holder)}
713is_variation_element=variation_element_section.is('.tm-epo-variation-section');$this_epo_container=e.epo_holder;if(is_variation_element){$this_epo_container=variation_element_section}
714tm_last_visible_image_element=$this_epo_container.find('.tm-product-image:checked,select.tm-product-image');last_activate_field=[];tm_last_visible_image_element_id='';found=!1;tm_current_image_element_id=img.data('tm-current-image');imgSrc=img_src_original;if($current_product_element.length<=0){$current_product_element=$main_product.closest('.post-'+product_id)}
715$this_epo_container=$main_product.find('.tm-epo-variation-section').first().add(e.epo_holder);tm_last_visible_image_element=$this_epo_container.find('.tm-product-image:checked,select.tm-product-image');
715tm_last_visible_image_element.toArray().forEach(function(ie){ie=$(ie);if(field_is_active(ie)&&has_active_changes_product_image(ie)&&tm_check_field_match({element:ie.closest('.cpf-element'),rule:{operator:'isnotempty',value:''},type:'element'})){last_activate_field.push(ie)}});if(last_activate_field.length){tm_last_visible_image_element=last_activate_field[last_activate_field.length-1];tm_last_visible_image_element_id=tm_last_visible_image_element.attr('id')}
716if(last_activate_field.length&&tm_last_visible_image_element.length&&(!tm_current_image_element_id||tm_last_visible_image_element_id!==tm_current_image_element_id)){tm_last_visible_image_element.last().trigger('tm_trigger_product_image');return}
717tmcie_id=$this_epo_container.find("[id='"+tm_current_image_element_id+"']").closest('.cpf-element');if(!tm_current_image_element_id||(tmcie_id.data('isactive')!==!1&&tmcie_id.closest('.cpf-section').data('isactive')!==!1)){return}
718$current_product_element.find('#'+tm_current_image_element_id+'_tmimage').remove();len=$current_product_element.find('.tm-clone-product-image').length;if(len===0){img.show();img.data('tm-current-image',!1);$form.tc_image_update(!1)}else{for(i=len-1;i>=0;i-=1){current_image_replacement=$current_product_element.find('.tm-clone-product-image').eq(i);current_element=current_image_replacement.attr('id').replace('_tmimage','');el_to_check=$this_epo_container.find("[id='"+current_element+"']");if(el_to_check.is(':checked')&&el_to_check.closest('.cpf-element').is(':visible')){$current_product_element.find('.tm-clone-product-image').eq(i).show();a.attr('href',$current_product_element.find('.tm-clone-product-image').eq(i).prop('src'));img.data('tm-current-image',current_element);found=!0;break}else{$current_product_element.find('.tm-clone-product-image').eq(i).hide()}}
719if(!found){img.show();img.data('tm-current-image',!1);$form.tc_image_update(!1)}}
720if(found){imgSrc=current_image_replacement.attr('src')}
721gallery_compatibility_actions(gallery_type,!1,imgSrc,$current_product_element.find('.tm-clone-product-image').filter(':visible').length)},window.tc_epo_product_image_change_delay||0)});$(this_epo_container.find('.tm-product-image:checked,select.tm-product-image')).add(main_product.find('.tm-epo-variation-section').first().find('.tm-product-image:checked,select.tm-product-image')).toArray().forEach(function(pi){pi=$(pi);if(field_is_active(pi)&&pi.val()!==''){last_active_field.push(pi)}});if(last_active_field.length){last_active_field[last_active_field.length-1].trigger('tm_trigger_product_image')}}
722jWindow.trigger('tm_product_image_loaded')}
723function tm_product_image(epoObject){var galleryImages;setTimeout(function(){if(TMEPOJS.tm_epo_global_product_image_mode==='inline'){tm_product_image_inline(epoObject)}else{tm_product_image_self(epoObject)}
724if($.fn.wc_product_gallery){galleryImages=epoObject.this_epo_container;if(epoObject.is_associated){galleryImages=epoObject.main_product}
725galleryImages.find('.cpf-type-product-custombundle .tc-associated-product-image').tclightbox()}},window.tc_epo_product_image_setup_delay||0)}
726function tc_compatibility(epoObject){jWindow.trigger('tm-epo-compatibility',{epo:epoObject})}
727function setRangePickers(obj){if(!noUiSlider){return}
728obj.find('.tm-range-picker').toArray().forEach(function(picker){var el=$(picker);var $decimals=el.attr('data-step').split('.');var $tmfid=obj.find('#'+$.epoAPI.dom.id(el.attr('data-field-id')));var $min=parseFloat(el.attr('data-min'));var $max=parseFloat(el.attr('data-max'));var $start=parseFloat(el.attr('data-start'));var $step=parseFloat(el.attr('data-step'));var $show_picker_value=el.attr('data-show-picker-value');var $show_label=el.closest('li').find('.tm-show-picker-value');var $noofpips=parseFloat(el.attr('data-noofpips'));var $pips=null;var $tmh;if(el.data('tc-picker-init')){return}
729el.data('tc-picker-init',1);if($decimals.length===1){$decimals=0}else{$decimals=$decimals[1].length}
730if(!Number.isFinite($min)){$min=0}
731if(!Number.isFinite($max)){$max=0}
732if($max<=$min){$max=parseFloat($max)+1}
733$start=$.epoAPI.math.unformat($start,tcAPI.localDecimalSeparator);if(!Number.isFinite($start)){$start=0}
734$start=formatPrice($start,{precision:$decimals});if(!Number.isFinite($step)){$step=0}
735if(!Number.isFinite($noofpips)){$noofpips=10}
736if($noofpips<2){$noofpips=2}
737if(el.attr('data-pips')==='yes'){$pips={mode:'count',values:$noofpips,filter:function(value,type){value=parseFloat($.epoAPI.math.toFixed(value,$decimals));if($step<=0){return 0}
738if(type===1){if(!Number.isInteger(value)){return 2}}
739return type},format:{from:function(value){return $.epoAPI.math.unformat(value,tcAPI.localIn
739putDecimalSeparator)},to:function(value){return formatPrice(value,{precision:$decimals})}},density:2}}
740noUiSlider.create(el.get(0),{direction:TMEPOJS.text_direction,start:$start,step:$step,connect:'lower',behaviour:'tap',format:{from:function(value){return $.epoAPI.math.unformat(value,tcAPI.localDecimalSeparator)},to:function(value){return formatPrice(value,{precision:$decimals})}},range:{min:[$min],max:[$max]},pips:$pips,tooltips:{from:function(value){return $.epoAPI.math.unformat(value,tcAPI.localInputDecimalSeparator)},to:function(value){return formatPrice(value,{precision:$decimals})}}});$tmh=el.find('.noui-handle-lower');el.get(0).noUiSlider.on('slide',function(){$tmfid.trigger('change.cpf')});el.get(0).noUiSlider.on('update',function(values,handle){values[handle]=$.epoAPI.math.unformat(values[handle],tcAPI.localDecimalSeparator);handle=0;if($show_picker_value!=='left'&&$show_picker_value!=='right'){$tmh.attr('title',formatPrice(values[handle],{precision:$decimals}))}
741$tmfid.val(values[handle]).trigger('change');if($show_picker_value!==''){$show_label.html(formatPrice(values[handle],{precision:$decimals}))}});if($show_picker_value!==''){$show_label.html($start)}
742if($show_picker_value!=='left'&&$show_picker_value!=='right'){$tmh.attr('title',$start);el.addClass('noui-show-tooltip')}})}
743function setRangePickersEvents(){if(!noUiSlider||jDocument.data('setRangePickersEvents')){return}
744jDocument.on('click','.tm-show-picker-value',function(){var $this=$(this);var li=$this.closest('.tmcp-field-wrap');var value=li.find('.tmcp-range').val();var edit;var html5Slider=$this.closest('.tmcp-field-wrap').find('.tm-range-picker');$this.addClass('tc-hidden').after($('<input type="number" class="tm-show-picker-value-edit">'));edit=li.find('.tm-show-picker-value-edit');edit.focus().val(value).wrap('<div class="tm-show-picker-value-edit-wrap"></div>');edit.attr('step',html5Slider.attr('data-step'));edit.attr('min',html5Slider.attr('data-min'));edit.attr('max',html5Slider.attr('data-max'));$('.tm-show-picker-value-edit').focus().on('focusout',function(){$this=li.find('.tm-show-picker-value-edit');$this.closest('.tmcp-field-wrap').find('.tm-show-picker-value').removeClass('tc-hidden');$this.closest('.tm-show-picker-value-edit-wrap').remove()})});jDocument.on('change input','.tm-show-picker-value-edit',function(){var $this=$(this);var html5Slider=$this.closest('.tmcp-field-wrap').find('.tm-range-picker');var $decimals=html5Slider.attr('data-step').split('.');var value=$this.val();if($decimals.length===1){$decimals=0}else{$decimals=$decimals[1].length}
745html5Slider.get(0).noUiSlider.set([formatPrice(value,{precision:$decimals}),null])});jDocument.on('keydown','.tm-show-picker-value-edit',function(event){var key;key=event.which;if(key===13){event.preventDefault()}});jDocument.data('setRangePickersEvents',1)}
746function validate_date_with_options(date,inputElement){var input=$(inputElement);var inst=$.tm_datepicker._getInst(input[0]);var enabled_only_dates=input.data('tc-enabled_only_dates');var disabled_weekdays=input.data('tc-disabled_weekdays');var disabled_months=input.data('tc-disabled_months');var disabled_dates=input.data('tc-disabled_dates');var format=input.data('tc-format');var day=date.getDay();var month=date.getDay()+1;var string;if(!$.tm_datepicker._isInRange(inst,date)){return!1}
747if(enabled_only_dates!==''){string=$.tm_datepicker.formatDate(format,date);return enabled_only_dates.indexOf(string)!==-1}
748if(disabled_weekdays.indexOf(day.toString())!==-1){return!1}
749if(disabled_months.indexOf(month.toString())!==-1){return!1}
750if(disabled_dates!==''){string=$.tm_datepicker.formatDate(format,date);return disabled_dates.indexOf(string)===-1}
751return!0}
752function correctDate(days){var sign,testDate,count,added,noOfDaysToAdd;if(days.toString().isNumeric()){sign=days===0?days:(days>0?1:-1);if(sign!==0){testDate=new Date();count=1;added=!1;noOfDaysToAdd=Math.abs(days);while(count<=noOfDaysToAdd){if(added===!1){added=0}
753testDate.setDate(testDate.getDate()+(1*sign));added++;if(testDate.getDay()!==0&&testDate.getDay()!==6){count++}}
754if(added!==!1){days=added*sign}}}
755return days}
756function tm_set_datepicker(obj){var inputIds;var elem;var timepickerSelector='.tm-epo-timepicker';if(!$.tm_datepicker){return}
757inputIds=$('input').map(function(){return this.id}).get().join(' ');
757elem=document.createElement('input');elem.setAttribute('type','date');if(elem.type==='text'){timepickerSelector='.tm-epo-system-timepicker'}
758obj.find(timepickerSelector).toArray().forEach(function(el){var field=$(el);var _mintime=null;var _maxtime=null;var format=field.attr('data-time-format').trim();var date_theme=field.attr('data-time-theme').trim();var date_theme_size=field.attr('data-time-theme-size').trim();var date_theme_position=field.attr('data-time-theme-position').trim();var data_translation_hour=field.attr('data-tranlation-hour').trim();var data_translation_minute=field.attr('data-tranlation-minute').trim();var data_translation_second=field.attr('data-tranlation-second').trim();field.attr('type','text');if(field.attr('data-min-time').trim()!==''){_mintime=field.attr('data-min-time').trim()}
759if(field.attr('data-max-time').trim()!==''){_maxtime=field.attr('data-max-time').trim()}
760if(field.attr('data-custom-time-format').trim()!==''){format=field.attr('data-custom-time-format').trim()}
761if(!data_translation_hour){data_translation_hour=TMEPOJS.hourText}
762if(!data_translation_minute){data_translation_minute=TMEPOJS.minuteText}
763if(!data_translation_second){data_translation_second=TMEPOJS.secondText}
764field.tm_timepicker(Object.assign({isRTL:TMEPOJS.isRTL,hourText:data_translation_hour,minuteText:data_translation_minute,secondText:data_translation_second,timeFormat:format,minTime:_mintime,maxTime:_maxtime,closeText:TMEPOJS.closeText,showOn:'both',buttonText:'',beforeShow:function(input,inst){$(inst.dpDiv).removeClass(inputIds).removeClass('tm-ui-skin-epo tm-ui-skin-epo-black tm-datepicker-medium tm-datepicker-small tm-datepicker-large tm-datepicker-normal tm-datepicker-top tm-datepicker-bottom').addClass(this.id+' tm-bsbb-all tm-ui-skin-'+date_theme+' tm-timepicker tm-datepicker tm-datepicker-'+date_theme_position+' tm-datepicker-'+date_theme_size).appendTo('body');jDocument.off('click','.tm-ui-dp-overlay').on('click','.tm-ui-dp-overlay',function(){field.tm_timepicker('hide')});jBody.addClass('tm-static');field.prop('readonly',!0);jWindow.trigger({type:'tm-timepicker-beforeShow',input:input,inst:inst})},onClose:function(){jBody.removeClass('tm-static');field.prop('readonly',!1);field.trigger('change')}},window.tmTimepickerSettings||window.timepicker_settings||{}));$('#ui-tm-datepicker-div').hide()});obj.find('.tm-epo-datepicker').toArray().forEach(function(el){var field=$(el);var startDate=parseInt(field.attr('data-start-year').trim(),10);var endDate=parseInt(field.attr('data-end-year').trim(),10);var minDate=field.attr('data-min-date').trim();var maxDate=field.attr('data-max-date').trim();var disabled_dates=field.attr('data-disabled-dates').trim();var enabled_only_dates=field.attr('data-enabled-only-dates').trim();var exlude_disabled=field.attr('data-exlude-disabled').trim();var disabled_weekdays=field.attr('data-disabled-weekdays').trim().split(',');var disabled_months=field.attr('data-disabled-months').trim().split(',');var format=field.attr('data-date-format').trim();var show=field.attr('data-date-showon').trim();var default_date=field.attr('data-date-defaultdate').trim();var date_theme=field.attr('data-date-theme').trim();var date_theme_size=field.attr('data-date-theme-size').trim();var date_theme_position=field.attr('data-date-theme-position').trim();var $split;var $index;var $split2;var $index2;if(disabled_dates!==''){$split=disabled_dates.split(',');$index=disabled_dates.indexOf(',');if($index!==-1&&$split.length>0){disabled_dates=$split}}
765if(enabled_only_dates!==''){$split2=enabled_only_dates.split(',');$index2=enabled_only_dates.indexOf(',');if($index2!==-1&&$split2.length>0){enabled_only_dates=$split2}}
766if(minDate===''){if(startDate===''){minDate=null}else{minDate=new Date(startDate,1-1,1)}}else if(exlude_disabled){minDate=correctDate(minDate)}
767if(maxDate===''){if(endDate===''){maxDate=null}else{maxDate=new Date(endDate,12-1,31)}}else if(exlude_disabled){maxDate=correctDate(maxDate)}
768field.data('tc-enabled_only_dates',enabled_only_dates);field.data('tc-disabled_weekdays',disabled_weekdays);field.data('tc-disabled_months',disabled_months);field.data('tc-disabled_dates',disabled_dates);field.data('tc-format',format);field.tm_datepicker(Object.assign({monthNames:TMEPOJS.monthNames,monthNamesShort:TMEPOJS.monthNamesShort,dayNames:TMEPOJS.dayNames,dayNamesShort:TMEPOJS.dayNamesShort,dayNamesMin:TMEPOJS.dayNamesMin,isRTL:TMEPOJS.isRTL,showOtherMonths:!0,selectOtherMonths:!0,showOn:show,defaultDate:default_date,buttonText:'',showButtonPanel:!0,firstDay:TMEPOJS.first_day,closeText:TMEPOJS.closeText,currentText:TMEPOJS.currentText,dateFormat:format,minDate:minDate,maxDate:maxDate,onSelect:function(){var input=$(this);var id='#'+$.epoAPI.dom.id(input.attr('id'));var date=input.tm_datepicker('getDate');var day='';var month='';var year='';var day_field=obj.find(id+'_day');var month_field=obj.find(id+'_month');var year_field=obj.find(id+'_year');var string;var ld;if(date){day=date.getDate();month=date.getMonth()+1;year=date.getFullYear();string=$.tm_datepicker.formatDate(format,date);if(disabled_months.indexOf(month.toString())!==-1||disabled_weekdays.indexOf(date.getDay().toString())!==-1||disabled_dates.indexOf(string)!==-1||(enabled_only_dates!==''&&enabled_only_dates.indexOf(string)===-1)){ld=input.data('tm-last-date');
768if(input.data('tm-last-date')){ld=input.data('tm-last-date')}else{ld=''}
769input.val(ld);input.tm_datepicker('setDate',ld);if(ld){date=input.tm_datepicker('getDate');day=date.getDate();month=date.getMonth()+1;year=date.getFullYear()}else{day='';month='';year=''}}}
770day_field.val(day);month_field.val(month);year_field.val(year);input.data('tm-last-date',input.val());input.tm_datepicker('hide')},beforeShow:function(input,inst){$(inst.dpDiv).removeClass(inputIds).removeClass('tm-datepicker-normal tm-datepicker-top tm-datepicker-bottom').addClass(this.id+' tm-bsbb-all tm-ui-skin-'+date_theme+' tm-datepicker tm-datepicker-'+date_theme_position+' tm-datepicker-'+date_theme_size).appendTo('body');jDocument.off('click','.tm-ui-dp-overlay').on('click','.tm-ui-dp-overlay',function(){field.tm_datepicker('hide')});jDocument.off('click','.ui-tm-datepicker-current').on('click','.ui-tm-datepicker-current',function(){var tempDate=new Date(),today=$.tm_datepicker._daylightSavingAdjust(new Date(tempDate.getFullYear(),tempDate.getMonth(),tempDate.getDate()));var day=today.getDay();var month=today.getMonth()+1;var id='#'+inst.id.replace(/\\\\/g,'\\');var check=!1;var string;var date=field.tm_datepicker('getDate');if(enabled_only_dates!==''){string=$.tm_datepicker.formatDate(format,date);check=enabled_only_dates.indexOf(string)!==-1}else if(disabled_months.indexOf(month.toString())!==-1||disabled_weekdays.indexOf(day.toString())!==-1){check=!1}else{if(disabled_dates!==''){string=$.tm_datepicker.formatDate(format,date);return[disabled_dates.indexOf(string)===-1,'']}
771check=!0}
772if(check){$.tm_datepicker._setDate(inst,today);$.tm_datepicker._gotoToday(id)}});jBody.addClass('tm-static');jWindow.trigger({type:'tm-datepicker-beforeShow',input:input,inst:inst})},onClose:function(){jBody.removeClass('tm-static');field.trigger('change')},beforeShowDay:function(date){var day=date.getDay();var month=date.getMonth()+1;var string;if(enabled_only_dates!==''){string=$.tm_datepicker.formatDate(format,date);return[enabled_only_dates.indexOf(string)!==-1,'']}
773if(disabled_months.indexOf(month.toString())!==-1||disabled_weekdays.indexOf(day.toString())!==-1){return[!1,'']}
774if(disabled_dates!==''){string=$.tm_datepicker.formatDate(format,date);return[disabled_dates.indexOf(string)===-1,'']}
775return[!0,'']}},window.tmDatepickerSettings||{}));$('#ui-tm-datepicker-div').hide()});obj.find('.tmcp-date-select').on('change.cpf',function(){var id='#'+$.epoAPI.dom.id($(this).attr('data-tm-date'));var input=obj.find(id);var format=input.attr('data-date-format');var day=obj.find(id+'_day').val();var month=obj.find(id+'_month').val();var year=obj.find(id+'_year').val();var dateFormat=$.tm_datepicker.formatDate(format,new Date(year,parseInt(month,10)-1,day));if(day>0&&month>0&&year>0){input.tm_datepicker('setDate',dateFormat);input.trigger('change')}else{input.val('');input.trigger('change.cpf')}}).on('focus.cpf',function(){var id='#'+$.epoAPI.dom.id($(this).attr('data-tm-date'));var input=obj.find(id);var day_select=obj.find(id+'_day');var month_select=obj.find(id+'_month');var year_select=obj.find(id+'_year');var day=day_select.val();var month=month_select.val();var year=year_select.val();var _select=$(this);
775if((year!==''&&month!==''&&day!=='')||(year!==''&&month!==''&&day==='')||(day!==''&&year!==''&&month==='')||(day!==''&&month!==''&&year==='')){_select.find('option').toArray().forEach(function(element){var option=$(element);var val=option.val();var date_string=year+'-'+month+'-'+day;var d;if(_select.is('.tmcp-date-day')){if(year===''||month===''){return}
776date_string=year+'-'+month+'-'+val}else if(_select.is('.tmcp-date-month')){if(year===''||day===''){return}
777date_string=year+'-'+val+'-'+day}else if(_select.is('.tmcp-date-year')){if(day===''||month===''){return}
778date_string=val+'-'+month+'-'+day}
779if(val!==''){try{d=$.tm_datepicker.parseDate('yy-mm-dd',date_string);if(d){if(validate_date_with_options(d,input)){option.prop('disabled',!1)}else{option.prop('disabled',!0)}}}catch(err){window.console.log(err);option.prop('disabled',!0);errorObject=err}}})}else{day_select.find('option').prop('disabled',!1);month_select.find('option').prop('disabled',!1);year_select.find('option').prop('disabled',!1)}});jWindow.on('resizestart',function(){var activeElement=$(document.activeElement);if(activeElement.is('.hasDatepicker')){activeElement.data('resizestarted',!0);if($(window).width()<768){activeElement.data('resizewidth',!0);return}
780activeElement.tm_datepicker('hide')}});jWindow.on('resizestop',function(){var activeElement=$(document.activeElement);if(activeElement.is('.hasDatepicker')&&activeElement.data('resizestarted')){if(activeElement.data('resizewidth')){activeElement.tm_datepicker('hide')}
781activeElement.tm_datepicker('show')}
782activeElement.data('resizestarted',!1);activeElement.data('resizewidth',!1)})}
783function apply_submit_events(epoObject){var epoEventId=epoObject.epoEventId;var main_product=epoObject.main_product;var type;var form_is_submit=!$.tcepo.formSubmitEvents[epoEventId].some(function(form_event){return typeof form_event&&(typeof form_event.trigger==='function'||!1)&&!form_event.trigger()});$.tcepo.formSubmitEvents[epoEventId].forEach(function(form_event){type=typeof form_event;if(type==='object'){if(form_is_submit){form_event.on_true()}else{form_event.on_false()}}});if(!form_is_submit){setTimeout(function(){main_product.find(tcAPI.addToCartButtonSelector).first().removeClass('disabled').removeClass('loading').prop('disabled',!1).removeClass('fpd-disabled')},100)}
784jWindow.trigger('tm-apply-submit-events',{epo:{form_is_submit:form_is_submit}});return form_is_submit}
785function tm_apply_validation(epoObject){var form=epoObject.form;var this_epo_container=epoObject.this_epo_container;var main_product=epoObject.main_product;var epoEventId=epoObject.epoEventId;var validation_rules;var has_rules;if(TMEPOJS.tm_epo_global_enable_validation==='yes'){validation_rules={};this_epo_container.find('.tmcp-ul-wrap').toArray().forEach(function(tmcpulwrap){var field;var field_name;var subFieldName;var subRule;var productField;tmcpulwrap=$(tmcpulwrap);has_rules=tmcpulwrap.data('tm-validation');if(has_rules&&$.tmType(has_rules)==='object'){field=tmcpulwrap.find('.tm-epo-field');field_name=field.first().attr('name');if(tmcpulwrap.is('.tm-extra-product-options-radio.tm-element-ul-radio')){field_name=field.last().attr('name');validation_rules[field_name]=has_rules}else if(tmcpulwrap.is('.tm-extra-product-options-checkbox.tm-element-ul-checkbox')){field.toArray().forEach(function(fname){if('required' in has_rules){has_rules.required=function(elem){var len=tmcpulwrap.find('input.tm-epo-field.tmcp-checkbox:checked').length;if(len===0){if(field.last().attr('name')===$(elem).attr('name')){return!0}
786return!1}
787return len<=0}}
788validation_rules[$(fname).attr('name')]=has_rules})}else if(tmcpulwrap.is('.tm-extra-product-options-product.tm-element-ul-product')){field=field.filter('.tc-epo-field-product');if(field.is(':checkbox')){field.toArray().forEach(function(fname){if('required' in has_rules){productField=$(fname);if(productField.is(':checkbox')){has_rules.required=function(elem){var checkedFields=tmcpulwrap.find('input.tm-epo-field.tmcp-checkbox:checked');var len=checkedFields.length;var qtyCheck;if(len===0){if(field.last().attr('name')===$(elem).attr('name')){return!0}
789return!1}
790qtyCheck=checkedFields.map(function(){return $(this)}).get().some(function(element){return element.closest('.tc-epo-element-product-holder').find('.tm-qty').first().val()<=0});if(len>0){return qtyCheck}
791return len<=0};if(productField.attr('data-type')==='variable'){subFieldName=productField.closest('.tc-epo-element-product-holder').find('.product-variation-id').first().attr('name');subRule={required:function(elem){var element=$(elem);var holder=element.closest('.tc-epo-element-product-holder');var checkbox=holder.find('.tc-epo-field-product');if(field_is_active(checkbox,!0)&&checkbox.is(':checked')){return!0}
792return!1}};validation_rules[subFieldName]=subRule}}}
793validation_rules[productField.attr('name')]=has_rules})}else if(field.is(':radio')){has_rules.product_element_radio_qty=!0;validation_rules[field.attr('name')]=has_rules;subFieldName=field.closest('.tc-element-container').find('.product-variation-id').first().attr('name');subRule={required:function(elem){var element=$(elem);var holder=element.closest('.tc-element-container');var radiobutton=holder.find('.tc-epo-field-product:checked');if(radiobutton.length&&radiobutton.attr('data-type')==='variable'&&field_is_active(radiobutton,!0)&&radiobutton.is(':checked')){return!0}
794return!1}};validation_rules[subFieldName]=subRule}else if(field.is('select')){has_rules.product_element_select_qty=!0;validation_rules[field.attr('name')]=has_rules;subFieldName=field.closest('.tc-element-container').find('.product-variation-id').first().attr('name');subRule={required:function(elem){var element=$(elem);var holder=element.closest('.tc-element-container');var select=holder.find('.tc-epo-field-product');if(select.length&&select.children(':selected').attr('data-type')==='variable'&&field_is_active(select,!0)){return!0}
795return!1}};validation_rules[subFieldName]=subRule}}
795else{validation_rules[field_name]=has_rules}}});form.removeData('tc_validator');form.tc_validate({focusInvalid:!1,ignore:tcAPI.qtySelector+',.tcdisabled,.tmcp-upload-hidden,#wc_bookings_field_duration,input.tm-qty:hidden[type="number"],input.input-text.qty,.ignore,.variations select,.tc-epo-variable-product-selector,.tm-extra-product-options-variations input,.tm-extra-product-options-variations select,input:not('+tcAPI.epoSelector+' input),select:not('+tcAPI.epoSelector+' select)',rules:validation_rules,errorClass:'tm-error',validClass:'tm-valid',errorElement:'label',errorPlacement:function(error,element){error.addClass('tc-cell tcwidth tcwidth-100');if(TMEPOJS.tm_epo_global_error_label_placement==='before'){element.closest('.tc-element-container').before(error)}else{element.closest('.tc-element-container').after(error)}
796return!1},invalidHandler:function(event,validator){jWindow.trigger('tm-invalidHandler',{epo:{validator:validator}});setTimeout(function(){if(!main_product.find(tcAPI.addToCartButtonSelector).first().is('.disabled')){main_product.find(tcAPI.addToCartButtonSelector).first().removeClass('loading').prop('disabled',!1).removeClass('fpd-disabled');main_product.find(tcAPI.addToCartButtonSelector).first().removeClass('disabled').removeClass('loading').prop('disabled',!1).removeClass('fpd-disabled')}},100);if(validator.errorList&&validator.errorList[0]&&validator.errorList[0].element){goto_error_item($(validator.errorList[0].element),epoEventId)}},submitHandler:function(){var ajaxSuccessFunc;if(!epoObject.is_quickview){main_product.find(tcAPI.addToCartButtonSelector).first().addClass('disabled');ajaxSuccessFunc=function(){main_product.find(tcAPI.addToCartButtonSelector).first().removeClass('disabled');jDocument.off('ajaxSuccess',ajaxSuccessFunc)};jDocument.on('ajaxSuccess',ajaxSuccessFunc)}
797return apply_submit_events(epoObject)}});form.find(tcAPI.addToCartButtonSelector).on('click',function(e){if(!form.tc_validate().form()){e.preventDefault();e.stopImmediatePropagation()}});return!0}
798return!1}
799function tm_form_submit_event(epoObject){var form=epoObject.form;var epoEventId=epoObject.epoEventId;jWindow.trigger('tm-from-submit',{epo:epoObject,functions:{tm_apply_validation:tm_apply_validation,apply_submit_events:apply_submit_events}});if(!tm_apply_validation(epoObject)&&$.tcepo.formSubmitEvents[epoEventId].length){form.on('submit',function(){apply_submit_events(epoObject)})}
800jWindow.on('tc_apply_validation',function(){return tm_apply_validation(epoObject)})}
801function found_variation_tmepo(dataObject){var epoHolder=dataObject.epoHolder;var totalsHolder=dataObject.totalsHolder;var totalsHolderContainer=dataObject.totalsHolderContainer;var currentCart=dataObject.currentCart;var variationForm=dataObject.variationForm;var variation=dataObject.variation;var variations=totalsHolder.data('variations');var product_price;totalsHolder.data('current_variation',variation);if(variation&&'display_price' in variation&&!totalsHolder.data('tm-epo-is-woocs')){product_price=variation.display_price;totalsHolder.data('priceIsWithDiscount','1');totalsHolder.removeData('tcprice')}else if(variations&&variation&&variation.variation_id&&variations[variation.variation_id]!==undefined){product_price=variations[variation.variation_id];totalsHolder.removeData('tcprice')}else if(variation&&$(variation.price_html).find('.amount:last').length){product_price=$(variation.price_html).find('.amount:last').text();product_price=product_price.replace(TMEPOJS.currency_format_thousand_sep,'');product_price=product_price.replace(TMEPOJS.currency_format_decimal_sep,'.');product_price=product_price.replace(/[^0-9.]/g,'');product_price=parseFloat(product_price);totalsHolder.removeData('tcprice')}
802product_price=tm_set_backend_price(product_price,totalsHolder,variation);totalsHolder.data('price',product_price);totalsHolderContainer.find('.cpf-product-price').val(product_price);setTimeout(function(){epoHolder.find('select.tm-epo-field').trigger('tm-select-change-html-all-math')},100);if(!variationForm.data('tm-styled-variations')){currentCart.trigger({type:'tm-epo-update'})}}
803function fetchOptionPrices(epoObject,epoHolder,selector,total,original_total,floatingBoxData,showTotal,forced,setPriceTax,useUndiscountedPrice,mathTotal,cumulative,nopriceCac
803heSelector,cartQty){var obj;var noDpd;var priceArray;var priceCacheSelector='none';var total_taxed;var original_total_taxed;var vat_total=0;var currentTotalsContainer;var epoinline;var funcTotal;var cumulativeTotal;if(!nopriceCacheSelector){priceCacheSelector=epoHolder.attr('class')+epoHolder.attr('data-uniqid')+selector+epoObject.is_associated+setPriceTax+forced+setPriceTax+useUndiscountedPrice||'none'}
804if(priceCacheSelector!=='none'&&priceCache!==!0&&priceCache!==!1&&priceCache[priceCacheSelector]!==undefined){return priceCache[priceCacheSelector]}
805noDpd=useUndiscountedPrice?'undiscounted_':'';obj=epoHolder.find(selector);if(epoObject.is_associated===!1){obj=obj.not(tcAPI.associatedEpoSelector+' '+selector+',.cpf-type-variations '+selector)}
806if(!forced){obj=obj.filter('.tcenabled')}
807if(!total){total=0}
808if(!original_total){original_total=0}
809funcTotal=total;cumulativeTotal=total;total_taxed=total;original_total_taxed=original_total;if(!floatingBoxData){floatingBoxData=[]}
810currentTotalsContainer=epoObject.this_epo_totals_container;if(obj.length){obj.toArray().forEach(function(tmcpfield){var field=$(tmcpfield);var _value='';var fieldval;var field_div=field.closest('.cpf-element');var field_wrap=field.closest('.tmcp-field-wrap');var field_label_show=field_div.attr('data-fblabelshow');var field_value_show=field_div.attr('data-fbvalueshow');var field_title='';var option_quantity=field_wrap.find('.tm-qty').val();var option_price;var option_price_taxed;var option_original_price;var option_original_price_taxed;var liw;var cri;var tl;var options;var forrangepicker;var $decimals;var _valueText='';var setter;var dofloatingBoxData=!1;if(selector==='.tc-epo-field-product'){if(field_div.is('.cpf-type-product-thumbnailmultiple')||field_div.is('.cpf-type-product-checkbox')||field_div.is('.cpf-type-product-custombundle')){epoinline=field.closest('.tc-epo-element-product-holder').find(tcAPI.associatedEpoSelector)}else if(field_div.is('.cpf-type-product-thumbnail')||field_div.is('.cpf-type-product-radio')||field_div.is('.cpf-type-product-dropdown')){epoinline=field_div.find('.tc-epo-element-product-container[data-product_id="'+field.val()+'"]').find(tcAPI.associatedEpoSelector)}else if(field_div.is('.cpf-type-product-single')){epoinline=field_div.find(tcAPI.associatedEpoSelector)}
811currentTotalsContainer=$('.tc-epo-totals'+'.tm-product-id-'+epoinline.attr('data-product-id')+'[data-epo-id="'+epoinline.attr('data-epo-id')+'"]')}
812if(currentTotalsContainer.length){if(field_label_show===''){field_title=field_div.find('.tc-epo-element-label-text').html()}
813if(option_quantity===undefined){option_quantity=''}
814if(mathTotal){tm_element_epo_rules(epoObject,field,undefined,undefined,undefined,undefined,funcTotal,cumulativeTotal)}
815if(field.is(':checkbox, :radio, :input')){option_price=0;option_price_taxed=0;option_original_price=0;option_original_price_taxed=0;if(field.is('.tmcp-checkbox, .tmcp-radio')){if(forced||field.is(':checked')){option_price=field.data(noDpd+'raw_price');option_price_taxed=field.data(noDpd+'price');option_original_price=field.data(noDpd+'raw_original_price');option_original_price_taxed=field.data(noDpd+'original_price');showTotal=!0;field.data('isset',1);liw=field.closest('li.tmcp-field-wrap');cri=liw.find('.tc-image');_value='';_valueText='';tl=field.closest('li.tmcp-field-wrap').find('.tc-label-text');if(tl.length){_value=tl.html();_valueText=_value}
816if(cri.length){cri=cri.closest('.tc-label-wrap').clone().addClass('tc-img-floating');cri.find('.tc-label, .tc-epo-style-wrapper, .tc-input-wrap').remove();_value=cri[0].outerHTML+'<span class="tc-label-text">'+_value+'</span>'}
817dofloatingBoxData=!0}else{field.data('isset',0)}}else if(field.is('.tmcp-select')){setter=field.find('option:selected');option_price=setter.data(noDpd+'raw_price');option_price_taxed=setter.data(noDpd+'price');option_original_price=setter.data(noDpd+'raw_original_price');option_original_price_taxed=setter.data(noDpd+'original_price');options=field.children('option:selected');if(!(options.val()===''&&options.attr('data-rulestype')==='')){showTotal=!0}
818field.find('option').data('isset',0);setter.data('isset',1);if(!(setter.val()===''&&setter.attr('data-rulestype')==='')){_value=setter.attr('data-text');dofloatingBoxData=!0;_valueText=_value}}else if(field.is('.tmcp-selectmultiple')){setter=field.find('option:selected');
818setter.toArray().forEach(function(setterel){setterel=$(setterel);option_price=option_price+$.epoAPI.math.toFloat(setterel.data(noDpd+'raw_price'));option_price_taxed=option_price_taxed+$.epoAPI.math.toFloat(setterel.data(noDpd+'price'));option_original_price=option_original_price+$.epoAPI.math.toFloat(setterel.data(noDpd+'raw_original_price'));option_original_price_taxed=option_original_price_taxed+$.epoAPI.math.toFloat(setterel.data(noDpd+'original_price'));options=field.children('option:selected');if(!(options.val()===''&&options.attr('data-rulestype')==='')){showTotal=!0}
819field.find('option').data('isset',0);setterel.data('isset',1);if(!(setterel.val()===''&&setterel.attr('data-rulestype')==='')){_value=setterel.attr('data-text');dofloatingBoxData=!0;_valueText=_value}})}else{fieldval=field.val();if(field.is("[type='file']")){fieldval=fieldval.replace('C:\\fakepath\\','')}
820if(fieldval){if(field.is('.tmcp-range')&&fieldval==='0'){field.data('isset',0)}else{option_price=field.data(noDpd+'raw_price');option_price_taxed=field.data(noDpd+'price');option_original_price=field.data(noDpd+'raw_original_price');option_original_price_taxed=field.data(noDpd+'original_price');showTotal=!0;field.data('isset',1);_value=fieldval;if(field.is('.tmcp-range')){forrangepicker=field.closest('.tmcp-field-wrap').find('.tm-range-picker');$decimals=forrangepicker.attr('data-step').split('.');if($decimals.length===1){$decimals=0}else{$decimals=$decimals[1].length}
821_value=formatPrice(_value,{precision:$decimals})}
822dofloatingBoxData=!0;if(field.is('.tmcp-dynamic')){field_label_show='hidden';field_value_show='hidden'}
823_valueText=fieldval}}else{field.data('isset',0)}}
824if(!option_price){option_price=0}
825if(!option_original_price){option_original_price=0}
826if(!option_price_taxed){option_price_taxed=0}
827if(!option_original_price_taxed){option_original_price_taxed=0}
828if(dofloatingBoxData){floatingBoxData.push({title:field_title,value:_value,valueText:_valueText,price:option_price_taxed,original_price:option_original_price_taxed,quantity:option_quantity,label_show:field_label_show,value_show:field_value_show,input_type:field.attr('type')})}
829if(undefined!==cartQty&&cartQty>0&&field.is('.tc-is-dnmpbq')){option_price=option_price/cartQty}
830option_price_taxed=tm_set_tax_price(option_price,currentTotalsContainer,field,undefined,undefined,undefined,!0);option_original_price_taxed=tm_set_tax_price(option_original_price,currentTotalsContainer,field,undefined,undefined,undefined,!0);if(setPriceTax){option_price=option_price_taxed;option_original_price=option_original_price_taxed}
831total=$.epoAPI.math.toFloat(total)+$.epoAPI.math.toFloat(option_price);total=$.epoAPI.math.toFloat($.epoAPI.math.round(total,10));original_total=$.epoAPI.math.toFloat(original_total)+$.epoAPI.math.toFloat(option_original_price);original_total=$.epoAPI.math.toFloat($.epoAPI.math.round(original_total,10));total_taxed=$.epoAPI.math.toFloat(total_taxed)+$.epoAPI.math.toFloat(option_price_taxed);total_taxed=$.epoAPI.math.toFloat($.epoAPI.math.round(total_taxed,10));vat_total=vat_total+$.epoAPI.math.toFloat(calculateTaxAmount(option_price_taxed,currentTotalsContainer));original_total_taxed=$.epoAPI.math.toFloat(original_total_taxed)+$.epoAPI.math.toFloat(option_original_price_taxed);original_total_taxed=$.epoAPI.math.toFloat($.epoAPI.math.round(original_total_taxed,10));if(cumulative){cumulativeTotal=total}}}})}
832priceArray={total:total,original_total:original_total,total_taxed:total_taxed,original_total_taxed:original_total_taxed,vat_total:vat_total,floatingBoxData:floatingBoxData,showTotal:showTotal,elementsLength:obj.length};if(priceCache===!0){priceCache={};priceCache[priceCacheSelector]=priceArray}
832else if(priceCache!==!0&&priceCache!==!1){priceCache[priceCacheSelector]=priceArray}
833return priceArray}
834function show_product_html(thisEpoObject,thisMainProduct,thisVariableProductContainer,type,$this,currentCart,variableProductContainers,isTrigger,qtyalt){var epoObjectCopy=$.extend(!0,{},thisEpoObject);var item_tm_extra_product_options=thisVariableProductContainer.find(tcAPI.associatedEpoSelector);var item=thisVariableProductContainer;var newEpoObject;var showOnly=!0;$this.removeData('triggeredforced');if(item.closest('.cpf-element').is('.tc-hidden')){return}
835variableProductContainers.addClass('tm-hidden');if(variableProductContainers.length){toggleState(variableProductContainers,!0)}
836if(type==='variable'){if(!thisVariableProductContainer.is('.tc-init-variations')){thisVariableProductContainer.addClass('variations_form');setTimeout(function(){newEpoObject=tm_init_epo(item,!1,item_tm_extra_product_options.attr('data-product-id'),item_tm_extra_product_options.attr('data-epo-id'),$this,epoObjectCopy);thisVariableProductContainer.addClass('tc-init-variations');thisVariableProductContainer.tc_product_variation_form($this,currentCart,variableProductContainers,newEpoObject)},40);showOnly=!1}else{thisVariableProductContainer.trigger('refresh.tc-variation-form')}}else if(!thisVariableProductContainer.is('.tc-init-product')){thisVariableProductContainer.addClass('tc-init-product');variableProductContainers.find('.tc-epo-element-variable-product').removeClass('variations_form');variableProductContainers.find('.tc-epo-element-variations').removeClass('variations');setTimeout(function(){tm_init_epo(item,!1,item_tm_extra_product_options.attr('data-product-id'),item_tm_extra_product_options.attr('data-epo-id'),$this,epoObjectCopy)},20);showOnly=!1}
837setTimeout(function(){if(variableProductContainers.length){toggleState(thisVariableProductContainer,!1)}
838thisVariableProductContainer.find(':checkbox:checked, :radio:checked').toArray().forEach(function(vpc){$(vpc).closest('.tmcp-field-wrap').addClass('tc-active')})},10);setTimeout(function(){if(qtyalt.length){qtyalt.trigger('change')}
839if(thisVariableProductContainer.find(tcAPI.epoSelector).length===0){thisVariableProductContainer.addClass('no-epo')}
840thisVariableProductContainer.removeClass('tm-hidden');if(showOnly){jWindow.trigger('cpflogicdone');thisVariableProductContainer.find('.tm-quantity').trigger('showhide.cpfcustom')}
841if(isTrigger===undefined&&TMEPOJS.tm_epo_global_product_element_scroll==='yes'){jWindow.tcScrollTo(thisVariableProductContainer,200,$.epoAPI.math.toFloat(TMEPOJS.tm_epo_global_product_element_scroll_offset))}
842jWindow.trigger('show_product_html',{thisEpoObject:thisEpoObject,thisMainProduct:thisMainProduct,thisVariableProductContainer:thisVariableProductContainer,type:type,this:$this,currentCart:currentCart,variableProductContainers:variableProductContainers,isTrigger:isTrigger,qtyalt:qtyalt})},210)}
843function setQtyData(qtyElement,value){var data=qtyElement.data();if(value===undefined){value=qtyElement.val()}
844if(data){Object.keys(data).filter(function(key){return key.indexOf('epopreviousvalue')===0}).forEach(function(key){qtyElement.data(key,value)})}}
845function epoEventHandlers(epoObject,cartContainer,alternativeCart){var product_id=epoObject.product_id;var main_product=epoObject.main_product;var main_cart=epoObject.main_cart;var this_epo_container=epoObject.this_epo_container;var this_totals_container=epoObject.this_totals_container;var this_epo_totals_container=epoObject.this_epo_totals_container;var epoEventId=epoObject.epoEventId;var main_epo_inside_form=epoObject.main_epo_inside_form;var epo_id_selector=epoObject.epo_id_selector;var epo_id=epoObject.epo_id;var product_id_selector=epoObject.product_id_selector;var itemId='main';var epoHolder;var totalsHolderContainer;var totalsHolder;var currentCart;var variation_id_selector;var this_product_type;var variationForm;var qtyElement;var finalTotalBoxMode;var finalTotalBoxShowFinal;var finalTotalBoxShowOptions;var eventName=epoObject.is_associated?'tc-variation-form':'wc-variation-form';var eventNamePrefix=epoObject.is_associated?'tc_':'';var epoVariationSection;var thismaxlength;var epoFieldAll;var selectSelector;var epoFieldText;var epoResetRadio;var epoFieldUpload;var epoFieldHasClearButton;var tmQty;var tmQuantity;if(alternativeCart&&cartContainer){itemId=$.epoAPI.applyFilter('tc_get_item_id',cartContainer.attr('data-item_id'),cartContainer);epoHolder=main_product.find('.tm-extra-product-options.tm-cart-'+itemId);totalsHolderContainer=main_product.find('.tm-totals-form-'+itemId);totalsHolder=main_product.find('.tm-epo-totals.tm-cart-'+itemId);variationForm=cartContainer.find('.variations_form').first()}else{if(!main_cart||main_cart.length===0){if(this_epo_container.is('.tc-shortcode')){main_cart=main_product}else{main_cart=get_main_cart(main_product,main_product,'form',product_id)}}
846cartContainer=main_cart.parent();epoHolder=this_epo_container;totalsHolderContainer=this_totals_container;totalsHolder=this_epo_totals_container;variationForm=epoObject.variations_form}
847if(epoObject.is_associated){itemId=epoHolder.attr('data-cart-id')}
848currentCart=alternativeCart||main_cart;totalsHolder.data('tm_for_cart',currentCart);variation_id_selector=getVariationIdSelector(currentCart);qtyElement=getQtyElement(currentCart);totalsHolder.data('variationIdElement',getVariationIdElement(currentCart,'.wceb_picker_wrap '+variation_id_selector));totalsHolder.data('qty_element',qtyElement);this_product_type=totalsHolder.data('type');variationForm.data('tc_product_id',product_id);finalTotalBoxMode=totalsHolder.attr('data-tm-epo-final-total-box');finalTotalBoxShowFinal=totalsHolder.attr('data-tm-epo-show-final-total');finalTotalBoxShowOptions=totalsHolder.attr('data-tm-epo-show-options-total');jWindow.trigger('epoEventHandlersStart',{epo:epoObject,cart:currentCart,alternativeCart:alternativeCart,cartContainer:cartContainer,totalsHolderContainer:totalsHolderContainer,totalsHolder:totalsHolder,epoHolder:epoHolder});jWindow.on('epoCalculateRules',function(event,dataObject){if(event&&dataObject&&dataObject.currentCart){tm_epo_rules(epoObject,dataObject.currentCart)}});if(currentCart.is('form')){currentCart.on('reset',function(){var form=$(this);setTimeout(function(){$(form.data('epo_id_selector')).find('.tm-epo-field').trigger('change')},1)})}
849tm_epo_rules(epoObject,currentCart);epoFieldAll=epoHolder.find('.tm-epo-field');
849if(!epoObject.is_associated){epoFieldAll=epoFieldAll.not(tcAPI.epoSelector+' '+tcAPI.associatedEpoSelector+' .tm-epo-field')}
850epoFieldText=epoHolder.find('.tm-epo-field.tmcp-textarea,.tm-epo-field.tmcp-textfield');if(!epoObject.is_associated){epoFieldText=epoFieldText.not(tcAPI.epoSelector+' '+tcAPI.associatedEpoSelector+' .tm-epo-field')}
851epoResetRadio=epoHolder.find('.tm-epo-reset-radio');if(!epoObject.is_associated){epoResetRadio=epoResetRadio.not(tcAPI.epoSelector+' '+tcAPI.associatedEpoSelector+' .tm-epo-reset-radio')}
852epoFieldUpload=epoHolder.find('.tm-epo-field.tmcp-upload');if(!epoObject.is_associated){epoFieldUpload=epoFieldUpload.not(tcAPI.epoSelector+' '+tcAPI.associatedEpoSelector+' .tm-epo-field.tmcp-upload')}
853epoFieldHasClearButton=epoHolder.find('.tm-has-clearbutton .tm-epo-field');if(!epoObject.is_associated){epoFieldHasClearButton=epoFieldHasClearButton.not(tcAPI.epoSelector+' '+tcAPI.associatedEpoSelector+' .tm-has-clearbutton .tm-epo-field')}
854tmQty=epoHolder.find('.tm-quantity .tm-qty');if(!epoObject.is_associated){tmQty=tmQty.not(tcAPI.epoSelector+' '+tcAPI.associatedEpoSelector+' .tm-quantity .tm-qty')}
855tmQuantity=epoHolder.find('.tm-quantity');if(!epoObject.is_associated){tmQuantity=tmQuantity.not(tcAPI.epoSelector+' '+tcAPI.associatedEpoSelector+' .tm-quantity')}
856selectSelector=epoHolder.find('select.tm-epo-field');if(!epoObject.is_associated){selectSelector=selectSelector.not(tcAPI.epoSelector+' '+tcAPI.associatedEpoSelector+' select.tm-epo-field')}
857selectSelector.off('tm-select-change-html').on('tm-select-change-html',function(){var field=$(this);var e_tip;var e_description;var sign;var formatted_price;if(field.is('.tc-epo-field-product')||field.is('.tmcp-selectmultiple')){return}
858if(main_cart&&main_cart.data('per_product_pricing')!==undefined&&!main_cart.data('per_product_pricing')){return}
859formatted_price=tm_set_price(field.find('option:selected').data('price'),totalsHolder,!0,field);e_tip=field.closest('.tmcp-field-wrap').find('.tc-tooltip');e_description=field.closest('.tmcp-field-wrap').find('.tc-inline-description');tm_update_price({epoObject:epoObject,obj:field.closest('.tmcp-field-wrap').find('.tc-price'),price:field.find('option:selected').data('price'),original_price:field.find('option:selected').data('original_price'),force:!1,useFormattedPrice:!1});if(e_tip.length>0){e_tip.attr('data-tm-tooltip-html',field.find('option:selected').attr('data-tm-tooltip-html')).trigger('tc-tooltip-html-changed')}
860if(e_description.length>0){if(field.find('option:selected').attr('data-tm-tooltip-html')){e_description.html(field.find('option:selected').attr('data-tm-tooltip-html'))}else{e_description.html('')}}
861if((field.find('option:selected').attr('data-hide-amount')==='0'||TMEPOJS.tm_epo_show_price_inside_option_hidden_even==='yes')&&TMEPOJS.tm_epo_show_price_inside_option==='yes'&&field.find('option:selected').attr('data-text')&&(field.find('option:selected').data('price')||(TMEPOJS.tm_epo_no_hide_price_if_original_not_zero==='yes'&&field.find('option:selected').data('original_price')))){if((TMEPOJS.tm_epo_auto_hide_price_if_zero==='yes'&&$.epoAPI.util.isEmpty(field.find('option:selected').data('price'))===!1)||(TMEPOJS.tm_epo_auto_hide_price_if_zero!=='yes'&&field.find('option:selected').attr('data-price')!=='')){sign='';field.find('option:selected').html(field.find('option:selected').attr('data-text')+' ('+sign+formatted_price+')')}else{field.find('option:selected').html(field.find('option:selected').attr('data-text'))}}
862if(field.val()===''){e_tip.addClass('tm-hidden')}else if(field.find('option:selected').attr('data-tm-tooltip-html')){e_tip.removeClass('tm-hidden')}else{e_tip.addClass('tm-hidden')}}).off('tm-math-select-change-html-all tm-select-change-html-all tm-select-change-html-all-math').on('tm-math-select-change-html-all tm-select-change-html-all tm-select-change-html-all-math',function(event){var field=$(this);var e_tip;var e_description;var divider;var thisformatted_price;if(field.is('.tc-epo-field-product')){return}
863e_tip=field.closest('.tmcp-field-wrap').find('.tc-tooltip');e_description=field.closest('.tmcp-field-wrap').find('.tc-inline-description');if(e_tip.length>0){e_tip.attr('data-tm-tooltip-html',field.find('option:selected').attr('data-tm-tooltip-html')).trigger('tc-tooltip-html-changed')}
864if(field.val()===''){e_tip.addClass('tm-hidden')}else if(field.find('option:selected').attr('data-tm-tooltip-html')){e_tip.removeClass('tm-hidden')}else{e_tip.addClass('tm-hidden')}
865if(e_description.length>0){if(field.find('option:selected').attr('data-tm-tooltip-html')){e_description.html(field.find('option:selected').attr('data-tm-tooltip-html'))}else{e_description.html('')}}
866if(main_cart&&main_cart.data('per_product_pricing')!==undefined&&!main_cart.data('per_product_pricing')){return}
867if(TMEPOJS.tm_epo_show_price_inside_option==='yes'){field.find('option').toArray().forEac
867h(function(thisoption){thisoption=$(thisoption);if(!thisoption.val()){return!0}
868if(event.type==='tm-select-change-html-all'){thisoption.removeClass('tm-epo-late-field').removeData('tm-price-for-late islate');tm_element_epo_rules(epoObject,field,undefined,thisoption,1)}else if(event.type==='tm-math-select-change-html-all'){tm_element_epo_rules(epoObject,field,undefined,thisoption,1,!0)}else if(event.type==='tm-select-change-html-all-math'){thisoption.removeClass('tm-epo-late-field').removeData('tm-price-for-late islate');tm_element_epo_rules(epoObject,field,undefined,thisoption,1,!0)}
869divider=1;if(TMEPOJS.tm_epo_multiply_price_inside_option!=='yes'){divider=field.data('tm-quantity')}
870if(!divider){divider=1}
871if((TMEPOJS.tm_epo_auto_hide_price_if_zero==='yes'&&$.epoAPI.util.isEmpty(thisoption.data('price'))===!1)||(TMEPOJS.tm_epo_auto_hide_price_if_zero!=='yes'&&thisoption.attr('data-price')!=='')){thisformatted_price=tm_set_price(thisoption.data('price')/divider,totalsHolder,!0,field);if((thisoption.attr('data-hide-amount')==='0'||TMEPOJS.tm_epo_show_price_inside_option_hidden_even==='yes')&&thisoption.attr('data-text')){thisoption.html(thisoption.attr('data-text')+' ('+thisformatted_price+')')}}else{thisoption.html(thisoption.attr('data-text'))}})}}).off('tm-select-price-update-html-all').on('tm-select-price-update-html-all',function(){var field=$(this);var divider;var thisformatted_price;if(field.is('.tc-epo-field-product')){return}
872if(main_cart&&main_cart.data('per_product_pricing')!==undefined&&!main_cart.data('per_product_pricing')){return}
873if(TMEPOJS.tm_epo_show_price_inside_option==='yes'){field.find('option').toArray().forEach(function(thisoption){thisoption=$(thisoption);if(!thisoption.val()){return!0}
874divider=1;if(TMEPOJS.tm_epo_multiply_price_inside_option!=='yes'){divider=field.data('tm-quantity')}
875if(!divider){divider=1}
876if((TMEPOJS.tm_epo_auto_hide_price_if_zero==='yes'&&$.epoAPI.util.isEmpty(thisoption.data('price'))===!1)||(TMEPOJS.tm_epo_auto_hide_price_if_zero!=='yes'&&thisoption.attr('data-price')!=='')){thisformatted_price=tm_set_price(thisoption.data('price')/divider,totalsHolder,!0,field);if((thisoption.attr('data-hide-amount')==='0'||TMEPOJS.tm_epo_show_price_inside_option_hidden_even==='yes')&&thisoption.attr('data-text')){thisoption.html(thisoption.attr('data-text')+' ('+thisformatted_price+')')}}else{thisoption.html(thisoption.attr('data-text'))}})}}).off('tm-select-change').on('tm-select-change',function(){var field=$(this);var thisElementId=field.closest('.cpf-element').attr('data-uniqid');if(field.is('.tc-epo-field-product')){return}
877if(main_cart&&main_cart.data('per_product_pricing')!==undefined&&!main_cart.data('per_product_pricing')){return}
878field.removeData('addedtcEpoBeforeOptionPriceCalculation');field.removeData('addedfieldtcEpoBeforeOptionPriceCalculation');jWindow.off('tcEpoBeforeOptionPriceCalculation.math'+thisElementId);jWindow.off('tcEpoAfterNormalOptionPriceCalculation.math'+thisElementId);field.trigger('tm-select-change-html');field.trigger('tm-select-change-html-all');currentCart.trigger({type:'tm-epo-update',norules:1,element:field})}).trigger('tm-select-change-html-all');tmQty.off('focus.cpf').on('focus.cpf',function(){var qtyField=$(this);var field=qtyField.closest('.tmcp-field-wrap').find('.tm-epo-field');var currentVal=parseFloat(qtyField.val());var max=parseFloat(qtyField.attr('max'));var min=parseFloat(qtyField.attr('min'));var step=qtyField.attr('step');var check1=tm_limit_c_selection(field,!1);var check2=tm_exact_c_selection(field,!1);var check3=!0;if(!currentVal||currentVal===''||currentVal==='NaN'){currentVal=0}
879if(max===''||max==='NaN'){max=''}
880if(min===''||min==='NaN'){min=0}
881if(step==='any'||step===''||step===undefined||parseFloat(step)==='NaN'){step=1}
882if(currentVal<min||currentVal>max){check3=!1}
883if(check1&&check2&&check3){setQtyData(qtyField,currentVal)}else{setQtyData(qtyField,min)}}).off('change.cpf').on('change.cpf',function(event,data){var qtyField=$(this);var field=qtyField.closest('.tmcp-field-wrap').find('.tm-epo-field');var currentVal=parseFloat(qtyField.val());var max=parseFloat(qtyField.attr('max'));var min=parseFloat(qtyField.attr('min'));var step=qtyField.attr('step');var check1=tm_limit_c_selection(field,!1);var check2=tm_exact_c_selection(field,!1);var check3=!0;if(!currentVal||currentVal===''||currentVal==='NaN'){currentVal=0}
884if(max===''||max==='NaN'){max=''}
885if(min===''||min==='NaN'){min=0}
886if(step==='any'||step===''||step===undefined||parseFloat(step)==='NaN'){step=1}
887if(currentVal<min||currentVal>max){check3=!1}
888if(check1&&check2&&check3){if(!epoObject.noEpoUpdate){field.data('tm-quantity',qtyField.val()).trigger('change',data)}else{field.data('tm-quantity',qtyField.val()).trigger('change.cpf',data).trigger('change.cpfproduct',data)}
889field.trigger('tm-select-change-html-all')}else if(qtyField.data('epopreviousvalue')){qtyField.val(qtyField.data('epopreviousvalue'))}else{qtyField.val(min)}
890qtyField.trigger('cpf-changed')}).off('tmaddquantity').on('tmaddquantity',function(){var qtyField=$(this);var field=qtyField.closest('.tmcp-field-wrap').find('.tm-epo-field');field.data('tm-quantity',qtyField.val())});thismaxlength=epoHolder.find('.tmcp-textfield.tm-epo-field[maxlength],textarea.tm-epo-field[maxlength]');if(!epoObject.is_associated){thismaxlength=thismaxlength.not(tcAPI.epoSelector+' '+tcAPI.associatedEpoSelector+' .tm-epo-field')}
891thismaxlength.toArray().forEach(function(field){var innerWrap;var html;field=$(field);if(field.data('tcmaxlength')){return}
892field.data('tcmaxlength',1);innerWrap=field.closest('.tmcp-field-wrap-inner');html=$.epoAPI.template.html(tcAPI.templateEngine.tc_chars_remanining,{maxlength:field.attr('maxlength'),characters_remaining:TMEPOJS.i18n_characters_remaining});innerWrap.append($(html))});thismaxlength.off('change.tc_maxlen input.tc_maxlen').on('change.tc_maxlen input.tc_maxlen',function(){var field=$(this);field.closest('.tmcp-field-wrap').find('.tc-chars-remanining').html(parseInt(field.attr('maxlength'),10)-parseInt(field.val().length,10))});epoFieldAll.off('tm_trigger_product_image').on('tm_trigger_product_image',function(){var field=$(this);var currentElement;var uic;var variation_element_section;var is_variation_element;var src;if(field.is('.tm-product-image:checkbox, .tm-product-image:radio, select.tm-product-image')){uic=field.closest('.tmcp-field-wrap').find('label img');variation_element_section=field.closest('.cpf-section');is_variation_element=variation_element_section.is('.tm-epo-variation-section');currentElement=field;if(field.is('select.tm-product-image')){currentElement=field.children('option:selected')}
893if($(uic).length>0||(is_variation_element&&currentElement.attr('data-image')!==undefined)||(currentElement.attr('data-image')!==undefined&&currentElement.attr('data-image')!=='')||(currentElement.attr('data-imagep')!==undefined&&currentElement.attr('data-imagep')!=='')){if(field.is(':checked')||(field.is('select.tm-product-image')&&field.val()!==''&&(field.find('option:selected').attr('data-rules')!==''||field.is('.tm-epo-variation-element')))){src=$(uic).first().attr('data-original');if(!src&&!is_variation_element){src=$(uic).first().attr('src')}
894if(!src){src=currentElement.attr('data-image')}
895if(currentElement.attr('data-imagep')){src=currentElement.attr('data-imagep')}
896if(src){main_product.trigger('tm_change_product_image',{src:src,element:field,element_current:currentElement,main_product:main_product,epo_holder:epoHolder})}else{main_product.trigger('tm_change_product_image',{src:!1,element:field,element_current:currentElement,main_product:main_product,epo_holder:epoHolder})}}else{main_product.trigger('tm_restore_product_image',{element:field,element_current:currentElement,main_product:main_product,epo_holder:epoHolder})}}else{main_product.trigger('tm_restore_product_image',{element:field,element_current:currentElement,main_product:main_product,epo_holder:epoHolder})}}else{main_product.trigger('tm_attempt_product_image',{element:field,element_current:currentElement,main_product:main_product,epo_holder:epoHolder})}});tmQuantity.off('showhide.cpfcustom').on('showhide.cpfcustom',function(){var quantity_selector=$(this);var field=quantity_selector.closest('.tmcp-field-wrap').find('.tm-epo-field');var show=!1;var tmqty;var tmqtyval;var tmqtymin;var radios;var tmqtybuttons;if(!field.is('.tm-epo-variation-element')){if(field.is('select')){if(field.val()!==''){show=!0}}else if(field.is(':checkbox')){if(field.is(':checked')){show=!0}}else if(field.is(':radio')){if(field.is(':checked')){show=!0;if(TMEPOJS.tm_epo_show_only_active_quantities==='yes'){radios=field.closest('.tc-element-inner-wrap').find('.tm-epo-field.tmcp-radio');
896radios.toArray().forEach(function(rd){$(rd).closest('.tmcp-field-wrap').find('.tm-quantity').hide()})}}}else if(field.val()){show=!0}
897tmqty=quantity_selector.find('.tm-qty');tmqtybuttons=quantity_selector.find('.tc-qty-button');tmqtyval=tmqty.val();tmqtymin=tmqty.attr('min')||'';if(show){if(TMEPOJS.tm_epo_show_only_active_quantities==='yes'){quantity_selector.show()}
898tmqty.removeClass('ignore').prop('disabled',!1);tmqtybuttons.prop('disabled',!1)}else{if(TMEPOJS.tm_epo_show_only_active_quantities==='yes'){quantity_selector.hide();if(!tmqtyval){tmqty.val(tmqtymin)}}
899tmqty.addClass('ignore').prop('disabled',!0);tmqtybuttons.prop('disabled',!0)}
900if(epoHolder.is('.tc-show')){setTimeout(function(){quantity_selector.closest('.tcowl-carousel').trigger('refresh.owl.carousel')},200)}}});epoFieldAll.off('change.cpfcustom').on('change.cpfcustom',function(){$(this).closest('.tmcp-field-wrap').find('.tm-quantity').trigger('showhide.cpfcustom')});epoFieldAll.off('change.cpf').on('change.cpf',function(event,data){var field=$(this);var is_li=field.closest('.tmcp-field-wrap');var is_ul=field.closest('.tmcp-ul-wrap');var is_replace;var connector=is_ul.attr('data-tm-connector');if(field.is(':checkbox, :radio')){if(field.is(':radio')){if(!data){if(connector!==undefined){$('[data-tm-connector="'+connector+'"]').find('.tmcp-field-wrap').removeClass('tc-active').find('.tm-epo-reset-radio').addClass('tm-hidden')}else{is_ul.find('.tmcp-field-wrap').removeClass('tc-active')}}
901if(connector!==undefined){$('[data-tm-connector="'+connector+'"]').find('.tmcp-field-wrap').removeClass('tc-active').find('.tm-epo-reset-radio').addClass('tm-hidden')}}
902if(field.is(':checked')){is_li.addClass('tc-active')}else{is_li.removeClass('tc-active')}}
903if(!field.is('.tm-epo-variation-element')){if(field.is('.use_images:checkbox, .use_images:radio')&&field.attr('data-imagec')){is_replace=is_li.find('.radio-image,.checkbox-image').first();if(is_replace.length>0){if(field.is(':checked')){is_replace.prop('src',field.attr('data-imagec'))}else{is_replace.prop('src',field.attr('data-image'))}}}
904if(field.is('.use_images:radio')&&!data){field.closest('.cpf-type-radio').find('.use_images:radio').not(field).toArray().forEach(function(r){r=$(r);r.closest('.tmcp-field-wrap').find('.radio-image').first().prop('src',r.attr('data-image'))})}
905if(field.is('.tmcp-range')){field.trigger('change.cpflogic')}
906if(field.is('select')){field.trigger('tm-select-change')}else{if(field.is('.tmcp-radio')){field.closest('.cpf-element').find('.tm-quantity .tm-qty').toArray().forEach(function(tmqty){tmqty=$(tmqty);if(!tmqty.closest('li.tmcp-field-wrap').find('.tmcp-radio').is(':checked')){tmqty.attr('disabled','disabled')}else{tmqty.prop('disabled',!1)}})}
907priceCache=!0;currentCart.trigger({type:'tm-epo-update',norules:1,element:field});priceCache=!1}}
908field.trigger('tm_trigger_product_image');if(epoHolder.is('.tc-show')){setTimeout(function(){$('.tm-owl-slider').toArray().forEach(function(slider){$(slider).trigger('refresh.owl.carousel')})},200)}
909main_product.trigger('tm_attempt_product_image',{element:field,main_product:main_product,epo_holder:epoHolder})});epoFieldAll.filter('.tm-epo-field:text,input.tm-epo-field[type="number"],textarea.tm-epo-field').off('input.cpf').on('input.cpf',function(){$(this).trigger('change.cpf',{autoload:1})});epoFieldAll.filter(':checkbox:checked, :radio:checked').toArray().forEach(function(cb){$(cb).closest('.tmcp-field-wrap').addClass('tc-active').trigger('change.cpf',{autoload:1})});epoFieldHasClearButton.off('change.cpfclearbutton').on('change.cpfclearbutton cpfclearbutton',function(){var field=$(this);var radioResetElement;var fieldWrap=field.closest('.tmcp-field-wrap');var fieldSearch;if(field.is(':checked')){fieldSearch=field.closest('.tc-element-inner-wrap');if(fieldSearch.find('.tc-epo-element-product-li-container').length){fieldSearch=fieldSearch.find('.tmcp-ul-wrap').first().children('.tmcp-field-wrap').not('.tc-epo-element-product-li-container')}
910radioResetElement=fieldSearch.find('.tm-epo-reset-radio');if(!radioResetElement.length){radioResetElement=field.closest('.tc-element-inner-wrap').find('.tm-epo-reset-radio').first()}
911radioResetElement.removeClass('tm-hidden');fieldWrap.append(radioResetElement)}});epoResetRadio.off('click.cpf').on('click.cpf',function(){var radioResetElement=$(this);var fieldContainer=radioResetElement.closest('.tc-element-inner-wrap');var checkedRadios=fieldContainer.find('.tm-epo-field.tmcp-radio:checked');if(checkedRadios.length){checkedRadios.prop('checked',!1);checkedRadios.trigger('change',{forced:1})}
912radioResetElement.addClass('tm-hidden')});if(_&&_.debounce){epoFieldText.on('keyup',_.debounce(function(){var $this=$(this);var mainform=currentCart;if(epoObject.is_associated){mainform=epoObject.mainEpoObject.form}
913if(TMEPOJS.tm_epo_global_enable_validation==='yes'&&$.tc_validator&&$this.closest('.tmcp-ul-wrap').data('tm-validation')&&$this.tc_rules()){mainform.tc_validate().element
913($this)}
914$this.trigger('change.cpf');$this.closest('.tmcp-field-wrap').find('.tm-quantity').trigger('showhide.cpfcustom')},10))}
915epoFieldUpload.off('change.cpfv tcupload').on('change.cpfv tcupload',function(){var field=$(this);var label=field.closest('label');var li=field.closest('.tmcp-field-wrap');var cpfUploadContainer=li.find('.cpf-upload-container');var name=li.find('.tm-filename');var val=field.val().replace('C:\\fakepath\\','');var valHidden=[];var num_uploads;var windowURL=window.URL||window.webkitURL;var files;var image;var uploadPreview=li.find('.tc-upload-preview');var addImage;var uniqid;if(cpfUploadContainer.length&&name.length<=0){name=$('<span class="tm-filename"></span>');label.after(name)}
916if(val===undefined||val==='undefined'){val=''}
917field.next('.tmcp-upload-hidden').remove();valHidden=field.attr('data-file');valHidden=valHidden?valHidden.split('|'):[];if(this.files){files=Array.from(this.files)}else if(valHidden.length>0){files=valHidden}
918if(files.length>1){name.html(''+files.length+' '+(files.length===1?TMEPOJS.i18n_file:TMEPOJS.i18n_files))}else if(files.length===1){name.html(val)}else{name.empty()}
919if(!uploadPreview.length){uploadPreview=$('<div class="tc-upload-preview tc-hidden"></div>');li.append(uploadPreview)}
920uploadPreview.empty();num_uploads=epoHolder.data('num_uploads');if(!num_uploads){num_uploads=[]}
921uniqid=field.closest('.cpf-element').attr('data-uniqid');if(!num_uploads[uniqid]){num_uploads[uniqid]=[]}
922if((val||files.length>0)&&windowURL&&windowURL.createObjectURL){if(TMEPOJS.tm_epo_upload_inline_image_preview==='yes'){if(files.length>1){uploadPreview.addClass('multiple')}else{uploadPreview.removeClass('multiple')}
923uploadPreview.removeClass('tc-hidden')}
924addImage=function(dataFile,src,i,fileHolder,ext){var size=field[0].files&&field[0].files[i]&&field[0].files[i].size?field[0].files[i].size:0;var imageHTML='<div class="tc-upload-image">';if(src){imageHTML=imageHTML+'<img src="'+src+'">'}else{imageHTML=imageHTML+'<div class="tc-file-ext-overlay"></div>'}
925imageHTML=imageHTML+'<div class="tc-file-name">'+dataFile.name+'</div>';if(ClipboardEvent||DataTransfer){imageHTML=imageHTML+'<button type="button" class="tc-upload-remove"><svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M11.586 13l-2.293 2.293a1 1 0 0 0 1.414 1.414L13 14.414l2.293 2.293a1 1 0 0 0 1.414-1.414L14.414 13l2.293-2.293a1 1 0 0 0-1.414-1.414L13 11.586l-2.293-2.293a1 1 0 0 0-1.414 1.414L11.586 13z" fill="currentColor" fill-rule="nonzero"/></svg></button>'}
926if(ext){imageHTML=imageHTML+'<div class="tc-file-ext">'+ext+'</div>'}
927imageHTML=imageHTML+'<div class="tc-file-size">'+readableFileSize(size)+'</div>';imageHTML=imageHTML+'</div>';fileHolder.append(imageHTML)};files.forEach(function(dataFile,i){var fileHolder;if(TMEPOJS.tm_epo_upload_inline_image_preview==='yes'){fileHolder=$('<div class="tc-upload-file"></div>');uploadPreview.append(fileHolder);image=new Image();image.onload=function(){addImage(dataFile,this.src,i,fileHolder)};image.onerror=function(){addImage(dataFile,!1,i,fileHolder,dataFile.name.split('.').pop())};if(valHidden.length>0){image.src=valHidden[i]}else{image.src=windowURL.createObjectURL(dataFile);windowURL.revokeObjectURL(dataFile)}}
928num_uploads[uniqid].push(dataFile.name)});epoHolder.data('num_uploads',num_uploads)}else{delete num_uploads[uniqid]}
929if(num_uploads[uniqid]&&num_uploads[uniqid].length===0){delete num_uploads[uniqid]}});jDocument.on('click','.tc-upload-remove',function(){var $this=$(this);var val;var cpfElement;var input;var fileWrap;var li;var uploadPreview;var name;var index;var files;var dT;var num_uploads;var uniqid;var uploadHidden;var dataFiles;if(ClipboardEvent||DataTransfer){cpfElement=$this.closest('.cpf-element');input=cpfElement.find('.tm-epo-field');fileWrap=$this.closest('.tc-upload-file');li=$this.closest('.tmcp-field-wrap');uploadPreview=li.find('.tc-upload-preview');name=li.find('.tm-filename');index=fileWrap.index();val=input.val().replace('C:\\fakepath\\','');if(val===undefined||val==='undefined'){val=''}
930files=Array.from(input[0].files);files.splice(index,1);dT=new ClipboardEvent('').clipboardData||new DataTransfer();
930files.forEach(function(dataFile){dT.items.add(dataFile)});if(files.length>1){uploadPreview.addClass('multiple')}else{uploadPreview.removeClass('multiple')}
931input[0].files=dT.files;fileWrap.remove();if(dT.files.length>1){name.html(''+dT.files.length+' '+(dT.files.length===1?TMEPOJS.i18n_file:TMEPOJS.i18n_files))}else if(dT.files.length===1){name.html(val)}else{name.empty()}
932num_uploads=epoHolder.data('num_uploads');if(!num_uploads){num_uploads=[]}
933uniqid=cpfElement.closest('.cpf-element').attr('data-uniqid');if(!num_uploads[uniqid]){num_uploads[uniqid]=[]}
934num_uploads[uniqid].splice(index,1);if(num_uploads[uniqid].length===0){delete num_uploads[uniqid];input.val('')}
935uploadHidden=input.next('.tmcp-upload-hidden');if(uploadHidden.length){dataFiles=uploadHidden.val().split('|');if(dataFiles.length>0){dataFiles.splice(index,1)}
936if(dataFiles.length===0){uploadHidden.remove()}else{uploadHidden.val(dataFiles.join('|'))}}
937epoHolder.data('num_uploads',num_uploads)}});qtyElement.off('change.cpf input.cpf').on('change.cpf input.cpf',function(){var field=$(this);currentCart.trigger('tm-epo-check-dpd');setQtyData(field);currentCart.trigger({type:'tm-epo-update',norules:2})});setQtyData(qtyElement);epoHolder.find('.cpf-type-product').off('tc-logic').on('tc-logic',function(){var $this=$(this);if($this.find('.tc-init').length){return}
938if($this.data('isactive')&&!$this.data('donetclogic')){$this.data('donetclogic',!0);$this.find('.tc-epo-field-product').trigger('change.cpfproduct',{forced:3})}});epoHolder.find('.cpf-type-product .tc-epo-field-product.tc-epo-field-product-checkbox').off('change.cpfrequired').on('change.cpfrequired',function(){var $this=$(this);var cpfElement=$this.closest('.cpf-element');var checkboxes;var checkboxesChecked;var checkboxesNotChecked;if(cpfElement.is('.tc-is-required')){checkboxes=cpfElement.find('.tmcp-field.tc-epo-field-product-checkbox');checkboxesNotChecked=checkboxes.not(':checked');checkboxesChecked=cpfElement.find('.tmcp-field.tc-epo-field-product-checkbox:checked');if(checkboxesChecked.length>0){checkboxesNotChecked.prop('required',!1);checkboxesChecked.prop('required',!0)}else{checkboxes.attr('required',!0);checkboxes.prop('required',!0)}}});epoHolder.find('.cpf-type-product .tc-epo-field-product').off('change.cpfproduct').on('change.cpfproduct',function(e,data){var $this=$(this);var value;var type;var selected;var variableProductContainers;var thisVariableProductContainer;var elementContainer=$this.closest('.cpf-element');var productContainerWraps=elementContainer.find('.tc-epo-element-product-container-wrap');var thisProductContainerWrap=$this.closest('.tmcp-field-wrap').find('.tc-epo-element-product-container-wrap');var hasProductContainerWrap=thisProductContainerWrap.length>0;var postData;var skip=!1;var isTrigger=1000;var qtyalt;var associatedSetter=$this;var associatedElement;var isFilled;var productPrice;var originalProductPrice;var epoField=elementContainer.find('.tm-epo-field').not('.tc-epo-element-product-li-container .tm-epo-field');var checked=epoField.filter(':checked');var qty;var counter=$this.attr('data-counter');if(!1===elementContainer.data('isactive')){return}
939if(data&&data.forced===2){return}
940if(e.isTrigger!==undefined&&$this.data('triggeredonce')&&!(data&&data.forced)){return}
941if($this.data('triggeredforced')===3){return}
942$this.data('triggeredonce',1);if(!$this.is(':checkbox')){isTrigger=e.isTrigger}
943if(epoField.is(':radio')){if(checked.length>0){qty=checked.closest('.tmcp-field-wrap').find('input.tm-qty')}}else if(epoField.is(':checkbox')){if(checked.length>0){qty=$this.closest('.tmcp-field-wrap').find('input.tm-qty')}}else{qty=epoField.closest('.tmcp-field-wrap').find('input.tm-qty')}
944if($this.is(':checkbox')){if($this.is('.tc-epo-field-product-hidden')){if($this.is(':checked')){productContainerWraps.addClass('tc-active-product')}else{productContainerWraps.removeClass('tc-active-product')}
945value=$this.val();type=$this.attr('data-type');elementContainer.find('.tc-epo-element-product-li-container:not(.tc-hidden-container .tc-epo-element-product-li-container)').removeClass('tm-hidden')}else{if(!$this.is(':checked')){if(hasProductContainerWrap){thisProductContainerWrap.addClass('tm-hidden')}
946if(!(data&&data.forced)){return}
947skip=!0}else if(hasProductContainerWrap){thisProductContainerWrap.removeClass('tm-hidden')}
948if(!skip){value=$this.val();type=$this.attr('data-type');elementContainer.find('.tc-epo-element-product-li-container:not(.tc-hidden-container .tc-epo-element-product-li-container)').removeClass('tm-hidden')}}}else if($this.is(':radio')){if(!$this.is(':checked')){if(hasProductContainerWrap){thisProductContainerWrap.addClass('tm-hidden')}
949if(!(data&&data.forced)){return}
950skip=!0}
950else if(hasProductContainerWrap){productContainerWraps.addClass('tm-hidden');thisProductContainerWrap.removeClass('tm-hidden')}
951if(!skip){value=$this.val();type=$this.attr('data-type');elementContainer.find('.tc-epo-element-product-li-container:not(.tc-hidden-container .tc-epo-element-product-li-container)').removeClass('tm-hidden')}}else if($this.is('select')){selected=$this.children(':selected');associatedSetter=selected;counter=selected.index();if($this.children(':first').val()===''){counter--}
952value=$this.val();type=selected.attr('data-type');elementContainer.find('.tc-epo-element-product-li-container:not(.tc-hidden-container .tc-epo-element-product-li-container)').removeClass('tm-hidden')}
953if($this.is('.tc-epo-field-product-checkbox')){variableProductContainers=thisProductContainerWrap.find('.tc-epo-element-product-container')}else{variableProductContainers=elementContainer.find('.tc-epo-element-product-container')}
954thisVariableProductContainer=variableProductContainers.filter('[data-product_id="'+value+'"]');qtyalt=thisVariableProductContainer.find(tcAPI.associateQtySelector);if(productContainerWraps.html()!==''&&qty&&qty.length>0&&qtyalt.length===0){qty.val(0)}
955if($this.is(':checkbox')){if($this.is('.tc-epo-field-product-hidden')){if($this.is(':checked')){if(qtyalt.val()==='0'){if(qtyalt.attr('min')!=='0'){qtyalt.val(qtyalt.attr('min')).trigger('change')}}}else{qtyalt.val(0);qtyalt.closest('.tm-quantity-alt').removeClass('tm-hidden');if(data.forced!==1){qtyalt.closest('.tm-quantity-alt').find('.single_add_to_cart_product').trigger('cpfqtybutton')}
956productContainerWraps.find(tcAPI.associatedEpoCart).trigger('tm-epo-update')}}}else if($this.is(':radio')){if($this.val()&&!$this.data('set_initial')){if(qtyalt.val()==='0'){if(qtyalt.attr('min')!=='0'){qtyalt.val(qtyalt.attr('min')).trigger('change')}
957$this.data('set_initial',1)}}}else if($this.is('select')){if($this.val()&&!$this.data('set_initial')){if(qtyalt.val()==='0'){if(qtyalt.attr('min')!=='0'){qtyalt.val(qtyalt.attr('min')).trigger('change')}
958$this.data('set_initial',1)}}}else{return}
959if(!value){variableProductContainers.addClass('tm-hidden');productPrice=$.epoAPI.util.parseJSON(associatedSetter.attr('data-rules'));productPrice=productPrice[0]||0;originalProductPrice=$.epoAPI.util.parseJSON(associatedSetter.attr('data-original-rules'));originalProductPrice=originalProductPrice||0;if(associatedSetter.is('.tcenabled')){associatedSetter.data('associated_price_set',1)}
960associatedSetter.data('price_set',1);associatedSetter.data('raw_price',productPrice);associatedSetter.data('raw_original_price',originalProductPrice);associatedSetter.data('price',productPrice);associatedSetter.data('original_price',originalProductPrice);associatedElement=associatedSetter;if(associatedElement.is('option')){associatedElement=associatedSetter.closest('select')}
961isFilled=!1;if(associatedElement.is('.tc-epo-field-product')){if(associatedElement.is('select')){if(associatedElement.val()!==''){isFilled=!0}}else if((associatedElement.is(':checkbox')||associatedElement.is(':radio'))){if(associatedElement.is(':checked')){isFilled=!0}}else if(associatedElement.val()!==''){isFilled=!0}}
962tm_force_update_price(epoObject,associatedSetter.closest('.tmcp-field-wrap').find('.tc-price').not(tcAPI.associatedEpoSelector+' .tc-price'),productPrice,isFilled?tm_set_price_totals(productPrice):associatedSetter.data('price-html'),originalProductPrice,!isFilled);qtyElement.trigger('change.cpf');return}
963if(thisVariableProductContainer.length===0){if(data&&data.forced===3){$this.data('triggeredforced',3)}
964postData={action:'wc_epo_get_associated_product_html',product_id:value,parent_id:epoHolder.attr('data-product-id'),mode:elementContainer.attr('data-mode'),layout_mode:elementContainer.attr('data-product-layout-mode'),uniqid:elementContainer.attr('data-uniqid'),name:$this.attr('name'),counter:counter,quantity_min:elementContainer.attr('data-quantity-min'),quantity_max:elementContainer.attr('data-quantity-max'),priced_individually:elementContainer.attr('data-priced-individually'),discount:elementContainer.attr('data-discount'),discount_type:elementContainer.attr('data-discount-type'),discount_exclude_addons:elementContainer.attr('data-discount-exclude-
964addons'),show_image:elementContainer.attr('data-show-image'),show_title:elementContainer.attr('data-show-title'),show_title_link:elementContainer.attr('data-show-title-link'),show_price:elementContainer.attr('data-show-price'),show_description:elementContainer.attr('data-show-description'),show_meta:elementContainer.attr('data-show-meta'),disable_epo:elementContainer.attr('data-disable-epo')};elementContainer.block({message:null,overlayCSS:{background:'#fff',opacity:0.6}});$.ajax({url:TMEPOJS.ajax_url,type:'POST',data:postData,dataType:'json',success:function(response){if(response.result===200){thisVariableProductContainer=$(response.html);if(hasProductContainerWrap){$this.closest('.tmcp-field-wrap').find('.tc-epo-element-product-container-wrap').empty().append(thisVariableProductContainer)}else{elementContainer.find('.tc-epo-element-product-container-wrap').append(thisVariableProductContainer)}
965show_product_html(epoObject,main_product,thisVariableProductContainer,type,$this,currentCart,variableProductContainers,isTrigger,qtyalt);thisVariableProductContainer.find(tcAPI.associateQtySelector).trigger('change');jWindow.trigger('tc_apply_validation')}},complete:function(){elementContainer.unblock()}})}else{show_product_html(epoObject,main_product,thisVariableProductContainer,type,$this,currentCart,variableProductContainers,isTrigger,qtyalt);thisVariableProductContainer.find(tcAPI.associateQtySelector).trigger('change')}});jDocument.off('click.cpfqtybutton cpfqtybutton','.cpf-type-product .single_add_to_cart_product').on('click.cpfqtybutton cpfqtybutton','.cpf-type-product .single_add_to_cart_product',function(){var $this=$(this);var qtyalt=$this.closest('.tm-quantity-alt').find(tcAPI.associateQtySelector);var isAdd=$this.is('.alt');var productContainerWraps=$this.closest('.cpf-element').find('.tc-epo-element-product-container-wrap');var qtyMin;var qtyMax;if($this.data('inittriggeredonce')){qtyMin=$.epoAPI.math.toInt(qtyalt.attr('data-min'));qtyMax=$.epoAPI.math.toInt(qtyalt.attr('data-max'));if(isAdd){productContainerWraps.addClass('tc-active-product');qtyalt.attr('min',qtyMin);if(qtyMax){qtyalt.attr('max',qtyMax)}
966if(qtyalt.val()==='0'){if(qtyalt.attr('min')==='0'){qtyalt.val(1).trigger('change')}else{qtyalt.val(qtyalt.attr('min')).trigger('change')}}
967$this.removeClass('alt').text($this.attr('data-remove'))}else{productContainerWraps.removeClass('tc-active-product');qtyalt.val(0).trigger('change');qtyalt.closest('.tm-quantity-alt').removeClass('tm-hidden');$this.addClass('alt').text($this.attr('data-add'))}}
968$this.data('inittriggeredonce',1);productContainerWraps.find(tcAPI.associatedEpoCart).trigger('tm-epo-update')});jDocument.off('change.cpfqtyalt input.cpfqtyalt','.cpf-type-product '+tcAPI.associateQtySelector).on('change.cpfqtyalt input.cpfqtyalt','.cpf-type-product '+tcAPI.associateQtySelector,function(){var $this=$(this);var epoField=$this.closest('.cpf-element').find('.tm-epo-field').not('.tc-epo-element-product-li-container .tm-epo-field');var addButton=$this.closest('.tm-quantity-alt').find('.single_add_to_cart_product');var checked=epoField.filter(':checked');var qty;var qtyMin;var qtyMax;var associatedEpoCart;qtyMin=$.epoAPI.math.toInt($this.attr('min'));qtyMax=$.epoAPI.math.toInt($this.attr('max'));if(epoField.is('.tc-epo-field-product-hidden')&&epoField.is(':checkbox')){if(checked.length===0&&$this.val()!=='0'){epoField.prop('checked',!0).trigger('change');checked=epoField.filter(':checked')}else if($this.val()==='0'&&checked.length){epoField.prop('checked',!1).trigger('change')}}
969if(epoField.is(':radio')){if(checked.length===0){return}
970qty=checked.closest('.tmcp-field-wrap').find('input.tm-qty').not('.tc-element-qty')}else if(epoField.is(':checkbox')){if(checked.length===0){return}
971qty=$this.closest('.tmcp-field-wrap').find('input.tm-qty').not('.tc-element-qty')}else{qty=epoField.closest('.tmcp-field-wrap').find('input.tm-qty').not('.tc-element-qty')}
972if(qty.length===0){return}
973qty.attr('min',qtyMin);if(qtyMax){qty.attr('max',qtyMax)}
974associatedEpoCart=$this.closest('.tc-epo-element-product-container').find(tcAPI.associatedEpoCart);associatedEpoCart.trigger('tm-epo-update');qty.val($this.val());
974if($.epoAPI.math.toFloat($this.val())>0){associatedEpoCart.find('.tm-epo-field.tcenabled').removeClass('ignore');$this.removeClass('ignore')}else{associatedEpoCart.find('.tm-epo-field.tcenabled').addClass('ignore');$this.addClass('ignore')}
975epoField.trigger('change.cpfproduct',{forced:2});if(addButton.data('inittriggeredonce')){if($this.val()==='0'){addButton.removeClass('alt')}else{addButton.addClass('alt')}}
976addButton.trigger('cpfqtybutton')});jDocument.off('click.cbsmel').on('click.cbsmel','.tc-choice-button-selector',function(e){var $field=$(this).closest('.tmcp-field-wrap').find('.tm-epo-field');e.stopPropagation();if($field.length){$field.trigger('click')}});currentCart.off('tm-epo-update').on('tm-epo-update',function(event){var cart=$(this);var bundleid;var productPrice=!1;var rawProductPrice=0;var productRegularPrice=!1;var rawProductRegularPrice=0;var total=0;var original_total=0;var showTotal=!1;var cartQty;var elementQty=1;var priceOverrideMode;var perProductPricing=!0;var floatingBoxData=[];var currentVariation;var cart_fee_options_total=0;var cart_fee_options_original_total=0;var _total;var _original_total;var late_total_price;var tc_totals_ob={};var formatted_options_total;var formatted_options_original_total;var formatted_fees_total;var formatted_fees_original_total;var formatted_final_total;var formatted_final_original_total;var extraFee=0;var raw_extraFee=0;var product_total_price;var product_total_original_price;var calculateFinalProductPrice;var total_plus_fee;var original_total_plus_fee;var product_total_price_without_options;var unit_price;var unit_original_price;var formatted_unit_price;var formatted_unit_original_price;var html;var show_options_total=!1;var show_vat_options_total=!1;var show_fees_total=!1;var formatted_extra_fee='';var show_extra_fee=!1;var show_final_total=!1;var hide_native_price;var update_native_html;var _fprice;var _f_regular_price;var customerPriceFormat;var currentEpoObject;var raw_total;var raw__total;var raw_original_total;var raw__original_total;var raw_cart_fee_options_total;var raw_cart_fee_options_original_total;var raw_total_plus_fee;var raw_original_total_plus_fee;var raw_product_total_price_without_options;var raw_product_total_price;var raw_product_total_original_price;var fetch;var customer_price_format_wrap_start='';var customer_price_format_wrap_end='';var associatedSetter;var associatedPrice;var associatedRawPrice;var associatedOriginalPrice;var associatedRawOriginalPrice;var associatedFormattedPrice;var nativeProductPriceSelector;var elementsLength;var productFieldSyncVatTotal=0;var productFieldSyncTotal=0;var productFieldSyncOriginalTotal=0;var productFieldSyncTotalTaxed=0;var productFieldSyncOriginalTotalTaxed=0;var totalProductField=0;var originalTotalProductField=0;var totalProductFieldTaxed=0;var originalTotalProductFieldTaxed=0;var _ftotal;var _foriginal_total;var totalsHolder_tc_totals_ob;var temp;var vat_options_total;var vat_options_total_plus_fee;var formatted_vat_options_total;var formatted_vat_options_total_plus_fee;var vat_total;var formatted_vat_total;var vat_product_base;var formatted_vat_product_base;var pricesIncludeTax;var dynamicCheck;var dynamicProductPrice=0;if(event.epoObject){currentEpoObject=$.extend(!0,{},event.epoObject)}else{currentEpoObject=$.extend(!0,{},epoObject)}
977if(!currentEpoObject){return}
978if(currentEpoObject.noEpoUpdate){return}
979jWindow.trigger('tcEpoUpdateStart',{epo:currentEpoObject,alternativeCart:currentEpoObject,this_product_type:this_product_type,cart:cart,totalsHolder:totalsHolder,fetchOptionPrices:fetchOptionPrices,epoHolder:epoHolder});bundleid=$.epoAPI.applyFilter('tc_get_bundleid',cart.attr('data-product_id'),cart,currentEpoObject);priceOverrideMode=totalsHolder.attr('data-price-override');cartQty=getCurrentQty(cart);currentVariation=getCurrentVariation(cart);if(currentEpoObject.associated_connect&&currentEpoObject.associated_connect.length===1){cartQty=parseFloat(currentEpoObject.main_product.find(tcAPI.associateQtySelector).not(tcAPI.associatedEpoSelector+' '+tcAPI.qtySelector).last().val())}
980event.stopImmediatePropagation();
980productPrice=$.epoAPI.applyFilter('tcGetCurrentProductPrice',tm_calculate_product_price(totalsHolder,!0),currentCart,totalsHolder);rawProductPrice=productPrice;productRegularPrice=$.epoAPI.applyFilter('tcGetCurrentProductRegularPrice',tm_calculate_product_regular_price(totalsHolder,!0),currentCart,totalsHolder);rawProductRegularPrice=productRegularPrice;productPrice=$.epoAPI.applyFilter('tcCalculateCurrentProductPrice',productPrice,{epo:currentEpoObject,alternativeCart:alternativeCart,cart:cart,main_product:main_product});if(!Number.isFinite(cartQty)||totalsHolder.attr('data-is-sold-individually')||getQtyElement(cart).length===0){cartQty=1}
981if(TMEPOJS.tm_epo_total_price_as_unit_price==='yes'){cartQty=1}
982totalsHolder_tc_totals_ob={qty:cartQty,product_price:rawProductPrice,original_product_price:rawProductRegularPrice};totalsHolder.data('totalsHolder_tc_totals_ob',totalsHolder_tc_totals_ob);if(!event.norules){tm_epo_rules(currentEpoObject,cart)}else if(event.norules){if(event.norules===1){tm_element_epo_rules(currentEpoObject,event.element)}
983$.tcepo.lateFieldsPrices[epoEventId]=[];epoHolder.find('.tm-epo-late-field').toArray().forEach(function(setter){setter=$(setter);setter.data('price',0);$.tcepo.lateFieldsPrices[epoEventId].push({setter:setter,price:setter.data('tm-price-for-late'),original_price:setter.data('tm-original-price-for-late'),bundleid:bundleid,pricetype:get_type(currentEpoObject,setter,'price_type')})})}
984dynamicCheck=epoHolder.find('.tmcp-dynamic.dynamic-product-price:not(.tc-is-math-special, .tc-is-math-cumulative)');if(currentEpoObject.is_associated===!1){dynamicCheck=dynamicCheck.not(tcAPI.associatedEpoSelector+' '+'.tmcp-dynamic.dynamic-product-price:not(.tc-is-math-special, .tc-is-math-cumulative)')}
985dynamicCheck=dynamicCheck.filter('.tcenabled');if(dynamicCheck.length>0){fetch=fetchOptionPrices(currentEpoObject,epoHolder,'.tmcp-dynamic.dynamic-product-price:not(.tc-is-math-special, .tc-is-math-cumulative)',0,0,floatingBoxData,showTotal,undefined,undefined,undefined,!0,undefined,undefined,cartQty);productPrice=fetch.total;dynamicProductPrice=productPrice;rawProductRegularPrice=fetch.original_total;rawProductPrice=dynamicProductPrice;productRegularPrice=dynamicProductPrice;totalsHolderContainer.find('.cpf-dynamic-product-price').val(dynamicProductPrice);totalsHolder_tc_totals_ob.dynamic_product_price=dynamicProductPrice;totalsHolder.data('totalsHolder_tc_totals_ob',totalsHolder_tc_totals_ob)}
986if(currentEpoObject.associated_connect&&currentEpoObject.associated_connect.length===1){associatedSetter=currentEpoObject.associated_connect;if(currentEpoObject.associated_connect.is('select')){associatedSetter=currentEpoObject.associated_connect.find('option:selected')}}
987if(productPrice===!1){totalsHolder.data('tm-floating-box-data',[]);totalsHolder.empty();if(currentEpoObject.associated_connect&&currentEpoObject.associated_connect.length===1){tm_force_update_price(epoObject,associatedSetter.closest('.tmcp-field-wrap').find('.tc-price').not(tcAPI.associatedEpoSelector+' .tc-price'),0,'',0)}
988main_cart.trigger('tm-epo-short-update',{container:cartContainer});return}
989elementQty=$.epoAPI.applyFilter('tcAlterElementQty',elementQty,{epo:currentEpoObject,alternativeCart:alternativeCart,currentCart:currentCart,main_product:main_product});if(currentCart.data('per_product_pricing')!==undefined){perProductPricing=currentCart.data('per_product_pricing')}
990perProductPricing=$.epoAPI.applyFilter('tcCalculatePerProductPricing',perProductPricing,{epo:currentEpoObject,alternativeCart:alternativeCart,cart:cart,main_product:main_product});if(main_epo_inside_form&&TMEPOJS.tm_epo_totals_box_placement==='woocommerce_before_add_to_cart_button'){if((this_product_type==='variable'||this_product_type==='variable-subscription')&&!totalsHolder.data('moved_inside')){totalsHolder.data('moved_inside',1)}}
991jWindow.trigger('tcEpoBeforeOptionPriceCalculation',{epo:currentEpoObject,alternativeCart:currentEpoObject,this_product_type:this_product_type,cart:cart,totalsHolder:totalsHolder,fetchOptionPrices:fetchOptionPrices,epoHolder:epoHolder,total:total,original_total:original_total,floatingBoxData:floatingBoxData,showTotal:showTotal,cart_fee_options_total:cart_fee_options_total,cart_fee_options_original_total:cart_fee_options_original_total});if(!currentEpoObject.associated_connect&&!event.noassociated){if(TMEPOJS.tm_epo_global_product_element_quantity_sync==='yes'&&!cart.is($.tcAPI().associatedEpoCart)){cart.find($.tcAPI().associatedEpoCart).filter(':visible').toArray().forEac
991h(function(acart){$(acart).trigger({type:'tm-epo-update',noassociated:1})})}}
992fetch=fetchOptionPrices(currentEpoObject,epoHolder,'.tmcp-field:not(.tmcp-dynamic,.tc-epo-field-product, .tc-is-math-special, .tc-is-math-cumulative)',total,original_total,floatingBoxData,showTotal,undefined,undefined,undefined,undefined,undefined,undefined,cartQty);total=fetch.total;original_total=fetch.original_total;floatingBoxData=fetch.floatingBoxData;showTotal=fetch.showTotal;elementsLength=fetch.elementsLength;fetch=fetchOptionPrices(currentEpoObject,epoHolder,'.tc-epo-field-product',productFieldSyncTotal,productFieldSyncOriginalTotal,floatingBoxData,showTotal,undefined,undefined,undefined,undefined,undefined,undefined,cartQty);productFieldSyncTotal=fetch.total;productFieldSyncOriginalTotal=fetch.original_total;productFieldSyncTotalTaxed=fetch.total_taxed;productFieldSyncOriginalTotalTaxed=fetch.original_total_taxed;productFieldSyncVatTotal=fetch.vat_total;floatingBoxData=fetch.floatingBoxData;showTotal=fetch.showTotal;elementsLength=elementsLength+fetch.elementsLength;totalsHolder.data('tm-floating-box-data',floatingBoxData);fetch=fetchOptionPrices(currentEpoObject,epoHolder,'.tmcp-fee-field',cart_fee_options_total,cart_fee_options_original_total,floatingBoxData,showTotal,!1,!0,undefined,undefined,undefined,undefined,cartQty);cart_fee_options_total=fetch.total;cart_fee_options_original_total=fetch.original_total;floatingBoxData=fetch.floatingBoxData;showTotal=fetch.showTotal;elementsLength=elementsLength+fetch.elementsLength;jWindow.trigger('tcEpoAfterNormalOptionPriceCalculation',{epo:currentEpoObject,alternativeCart:currentEpoObject,this_product_type:this_product_type,cart:cart,totalsHolder:totalsHolder,fetchOptionPrices:fetchOptionPrices,epoHolder:epoHolder,total:total,original_total:original_total,floatingBoxData:floatingBoxData,showTotal:showTotal,cart_fee_options_total:cart_fee_options_total,cart_fee_options_original_total:cart_fee_options_original_total});_total=total;_original_total=original_total;late_total_price=add_late_fields_prices(currentEpoObject,parseFloat(productPrice),parseFloat(rawProductRegularPrice),parseFloat(_total+productFieldSyncTotal),parseFloat(_original_total+productFieldSyncOriginalTotal),bundleid,totalsHolder);fetch=fetchOptionPrices(currentEpoObject,epoHolder,'.tmcp-field.tc-is-math-special:not(.tmcp-dynamic)',total,original_total,floatingBoxData,showTotal,undefined,undefined,undefined,!0,undefined,undefined,cartQty);total=fetch.total;original_total=fetch.original_total;floatingBoxData=fetch.floatingBoxData;showTotal=fetch.showTotal;elementsLength=elementsLength+fetch.elementsLength;_total=total;_original_total=original_total;_total=_total+late_total_price.normal[0];_original_total=_original_total+late_total_price.normal[1];cart_fee_options_total=cart_fee_options_total+late_total_price.fees[0];cart_fee_options_original_total=cart_fee_options_original_total+late_total_price.fees[1];total=_total;original_total=_original_total;fetch=fetchOptionPrices(currentEpoObject,epoHolder,'.tmcp-field.tc-is-math-cumulative:not(.tmcp-dynamic)',total,original_total,floatingBoxData,showTotal,undefined,undefined,undefined,!0,!0,undefined,cartQty);total=fetch.total;original_total=fetch.original_total;floatingBoxData=fetch.floatingBoxData;showTotal=fetch.showTotal;elementsLength=elementsLength+fetch.elementsLength;_total=total;_original_total=original_total;dynamicCheck=epoHolder.find('.tmcp-dynamic.dynamic-product-price.tc-is-math-special');if(currentEpoObject.is_associated===!1){dynamicCheck=dynamicCheck.not(tcAPI.associatedEpoSelector+' '+'.tmcp-dynamic.dynamic-product-price.tc-is-math-special')}
993dynamicCheck=dynamicCheck.filter('.tcenabled');if(dynamicCheck.length>0){fetch=fetchOptionPrices(currentEpoObject,epoHolder,'.tmcp-field.tmcp-dynamic.dynamic-product-price.tc-is-math-special',dynamicProductPrice+total,dynamicProductPrice+original_total,floatingBoxData,showTotal,undefined,undefined,undefined,!0,undefined,undefined,cartQty);dynamicProductPrice=$.epoAPI.math.toFloat(fetch.total)-$.epoAPI.math.toFloat(total);
993productPrice=dynamicProductPrice;rawProductRegularPrice=$.epoAPI.math.toFloat(fetch.original_total)-$.epoAPI.math.toFloat(original_total);rawProductPrice=dynamicProductPrice;productRegularPrice=dynamicProductPrice;totalsHolderContainer.find('.cpf-dynamic-product-price').val(dynamicProductPrice);totalsHolder_tc_totals_ob.dynamic_product_price=dynamicProductPrice;totalsHolder.data('totalsHolder_tc_totals_ob',totalsHolder_tc_totals_ob)}
994dynamicCheck=epoHolder.find('.tmcp-dynamic.dynamic-product-price.tc-is-math-cumulative');if(currentEpoObject.is_associated===!1){dynamicCheck=dynamicCheck.not(tcAPI.associatedEpoSelector+' '+'.tmcp-dynamic.dynamic-product-price.tc-is-math-cumulative')}
995dynamicCheck=dynamicCheck.filter('.tcenabled');if(dynamicCheck.length>0){fetch=fetchOptionPrices(currentEpoObject,epoHolder,'.tmcp-field.tmcp-dynamic.dynamic-product-price.tc-is-math-cumulative',dynamicProductPrice+total,dynamicProductPrice+original_total,floatingBoxData,showTotal,undefined,undefined,undefined,!0,undefined,undefined,cartQty);dynamicProductPrice=$.epoAPI.math.toFloat(fetch.total)-$.epoAPI.math.toFloat(total);productPrice=dynamicProductPrice;rawProductRegularPrice=$.epoAPI.math.toFloat(fetch.original_total)-$.epoAPI.math.toFloat(original_total);rawProductPrice=dynamicProductPrice;productRegularPrice=dynamicProductPrice;totalsHolderContainer.find('.cpf-dynamic-product-price').val(dynamicProductPrice);totalsHolder_tc_totals_ob.dynamic_product_price=dynamicProductPrice;totalsHolder.data('totalsHolder_tc_totals_ob',totalsHolder_tc_totals_ob)}
996dynamicCheck=epoHolder.find('.tmcp-dynamic.dynamic-product-price');if(currentEpoObject.is_associated===!1){dynamicCheck=dynamicCheck.not(tcAPI.associatedEpoSelector+' '+'.tmcp-dynamic.dynamic-product-price')}
997dynamicCheck=dynamicCheck.filter('.tcenabled');if(!dynamicCheck.length>0){totalsHolderContainer.find('.cpf-dynamic-product-price').val('')}
998dynamicProductPrice=0;dynamicCheck=epoHolder.find('.tmcp-dynamic.calculation:not(.tc-is-math-special, .tc-is-math-cumulative)');if(currentEpoObject.is_associated===!1){dynamicCheck=dynamicCheck.not(tcAPI.associatedEpoSelector+' '+'.tmcp-dynamic.calculation:not(.tc-is-math-special, .tc-is-math-cumulative)')}
999dynamicCheck=dynamicCheck.filter('.tcenabled');if(dynamicCheck.length>0){dynamicCheck.toArray().forEach(function(setter){var f;var ulWrap;var setterVal;setter=$(setter);ulWrap=setter.closest('.tmcp-ul-wrap');f=fetchOptionPrices(epoObject,ulWrap,'.tmcp-dynamic.calculation:not(.tc-is-math-special, .tc-is-math-cumulative)',dynamicProductPrice,dynamicProductPrice,[],!0,!0,undefined,undefined,undefined,!0,undefined,undefined,cartQty);setterVal=f.total;if(setter.is('.result-as-price')){setterVal=tm_set_price_totals(setterVal,totalsHolder,!0)}
1000ulWrap.find('.tc-result').html(setterVal)})}
1001dynamicCheck=epoHolder.find('.tmcp-dynamic.calculation.tc-is-math-special');if(currentEpoObject.is_associated===!1){dynamicCheck=dynamicCheck.not(tcAPI.associatedEpoSelector+' '+'.tmcp-dynamic.calculation.tc-is-math-special')}
1002dynamicCheck=dynamicCheck.filter('.tcenabled');if(dynamicCheck.length>0){dynamicCheck.toArray().forEach(function(setter){var f;var ulWrap;var setterVal;setter=$(setter);ulWrap=setter.closest('.tmcp-ul-wrap');f=fetchOptionPrices(epoObject,ulWrap,'.tmcp-field.tmcp-dynamic.calculation.tc-is-math-special',dynamicProductPrice+total,dynamicProductPrice+original_total,[],!0,!0,undefined,undefined,!0);setterVal=$.epoAPI.math.toFloat(f.total)-$.epoAPI.math.toFloat(total);if(setter.is('.result-as-price')){setterVal=tm_set_price_totals(setterVal,totalsHolder,!0)}
1003ulWrap.find('.tc-result').html(setterVal)})}
1004dynamicCheck=epoHolder.find('.tmcp-dynamic.calculation.tc-is-math-cumulative');if(currentEpoObject.is_associated===!1){dynamicCheck=dynamicCheck.not(tcAPI.associatedEpoSelector+' '+'.tmcp-dynamic.calculation.tc-is-math-cumulative')}
1005dynamicCheck=dynamicCheck.filter('.tcenabled');if(dynamicCheck.length>0){dynamicCheck.toArray().forEach(function(setter){var f;var ulWrap;var setterVal;setter=$(setter);ulWrap=setter.closest('.tmcp-ul-wrap');f=fetchOptionPrices(epoObject,ulWrap,'.tmcp-field.tmcp-dynamic.calculation.tc-is-math-cumulative',dynamicProductPrice+total,dynamicProductPrice+original_total,[],!0,
1005!0,undefined,undefined,!0,undefined,undefined,undefined,cartQty);setterVal=$.epoAPI.math.toFloat(f.total)-$.epoAPI.math.toFloat(total);if(setter.is('.result-as-price')){setterVal=tm_set_price_totals(setterVal,totalsHolder,!0)}
1006ulWrap.find('.tc-result').html(setterVal)})}
1007dynamicProductPrice=0;dynamicCheck=epoHolder.find('.tmcp-dynamic.change-product-weight:not(.tc-is-math-special, .tc-is-math-cumulative)');if(currentEpoObject.is_associated===!1){dynamicCheck=dynamicCheck.not(tcAPI.associatedEpoSelector+' '+'.tmcp-dynamic.change-product-weight:not(.tc-is-math-special, .tc-is-math-cumulative)')}
1008dynamicCheck=dynamicCheck.filter('.tcenabled');if(dynamicCheck.length>0){dynamicCheck.toArray().forEach(function(setter){var f;var ulWrap;setter=$(setter);ulWrap=setter.closest('.tmcp-ul-wrap');f=fetchOptionPrices(epoObject,ulWrap,'.tmcp-dynamic.change-product-weight:not(.tc-is-math-special, .tc-is-math-cumulative)',dynamicProductPrice,dynamicProductPrice,[],!0,!0,undefined,undefined,undefined,undefined,undefined,undefined,cartQty);ulWrap.find('.tc-result').html(f.total)})}
1009dynamicCheck=epoHolder.find('.tmcp-dynamic.change-product-weight.tc-is-math-special');if(currentEpoObject.is_associated===!1){dynamicCheck=dynamicCheck.not(tcAPI.associatedEpoSelector+' '+'.tmcp-dynamic.change-product-weight.tc-is-math-special')}
1010dynamicCheck=dynamicCheck.filter('.tcenabled');if(dynamicCheck.length>0){dynamicCheck.toArray().forEach(function(setter){var f;var ulWrap;setter=$(setter);ulWrap=setter.closest('.tmcp-ul-wrap');f=fetchOptionPrices(epoObject,ulWrap,'.tmcp-field.tmcp-dynamic.change-product-weight.tc-is-math-special',dynamicProductPrice+total,dynamicProductPrice+original_total,[],!0,!0,undefined,undefined,!0,undefined,undefined,undefined,cartQty);ulWrap.find('.tc-result').html($.epoAPI.math.toFloat(f.total)-$.epoAPI.math.toFloat(total))})}
1011dynamicCheck=epoHolder.find('.tmcp-dynamic.change-product-weight.tc-is-math-cumulative');if(currentEpoObject.is_associated===!1){dynamicCheck=dynamicCheck.not(tcAPI.associatedEpoSelector+' '+'.tmcp-dynamic.change-product-weight.tc-is-math-cumulative')}
1012dynamicCheck=dynamicCheck.filter('.tcenabled');if(dynamicCheck.length>0){dynamicCheck.toArray().forEach(function(setter){var f;var ulWrap;setter=$(setter);ulWrap=setter.closest('.tmcp-ul-wrap');f=fetchOptionPrices(epoObject,ulWrap,'.tmcp-field.tmcp-dynamic.change-product-weight.tc-is-math-cumulative',dynamicProductPrice+total,dynamicProductPrice+original_total,[],!0,!0,undefined,undefined,!0,undefined,undefined,undefined,cartQty);ulWrap.find('.tc-result').html($.epoAPI.math.toFloat(f.total)-$.epoAPI.math.toFloat(total))})}
1013dynamicProductPrice=0;dynamicCheck=epoHolder.find('.tmcp-dynamic.override-product-price:not(.tc-is-math-special, .tc-is-math-cumulative)');if(currentEpoObject.is_associated===!1){dynamicCheck=dynamicCheck.not(tcAPI.associatedEpoSelector+' '+'.tmcp-dynamic.override-product-price:not(.tc-is-math-special, .tc-is-math-cumulative)')}
1014dynamicCheck=dynamicCheck.filter('.tcenabled');if(dynamicCheck.length>0){fetch=fetchOptionPrices(currentEpoObject,epoHolder,'.tmcp-dynamic.override-product-price:not(.tc-is-math-special, .tc-is-math-cumulative)',dynamicProductPrice,dynamicProductPrice,floatingBoxData,showTotal,undefined,undefined,undefined,undefined,undefined,undefined,cartQty);dynamicProductPrice=fetch.total;productPrice=dynamicProductPrice;rawProductRegularPrice=fetch.original_total;rawProductPrice=dynamicProductPrice;productRegularPrice=dynamicProductPrice;_total=dynamicProductPrice;_original_total=dynamicProductPrice;totalsHolderContainer.find('.cpf-override-product-price').val(dynamicProductPrice);totalsHolder_tc_totals_ob.override_product_price=dynamicProductPrice;totalsHolder.data('totalsHolder_tc_totals_ob',totalsHolder_tc_totals_ob)}
1015dynamicCheck=epoHolder.find('.tmcp-dynamic.override-product-price.tc-is-math-special');if(currentEpoObject.is_associated===!1){dynamicCheck=dynamicCheck.not(tcAPI.associatedEpoSelector+' '+'.tmcp-dynamic.override-product-price.tc-is-math-special')}
1016dynamicCheck=dynamicCheck.filter('.tcenabled');if(dynamicCheck.length>0){fetch=fetchOptionPrices(currentEpoObject,epoHolder,'.tmcp-field.tmcp-dynamic.override-product-price.tc-is-math-special',dynamicProductPrice+total,dynamicProductPrice+original_total,floatingBoxData,showTotal,undefined,undefined,undefined,
1016!0,undefined,undefined,cartQty);dynamicProductPrice=$.epoAPI.math.toFloat(fetch.total)-$.epoAPI.math.toFloat(total);productPrice=dynamicProductPrice;rawProductRegularPrice=$.epoAPI.math.toFloat(fetch.original_total)-$.epoAPI.math.toFloat(original_total);rawProductPrice=dynamicProductPrice;productRegularPrice=dynamicProductPrice;_total=dynamicProductPrice;_original_total=dynamicProductPrice;totalsHolderContainer.find('.cpf-override-product-price').val(dynamicProductPrice);totalsHolder_tc_totals_ob.override_product_price=dynamicProductPrice;totalsHolder.data('totalsHolder_tc_totals_ob',totalsHolder_tc_totals_ob)}
1017dynamicCheck=epoHolder.find('.tmcp-dynamic.override-product-price.tc-is-math-cumulative');if(currentEpoObject.is_associated===!1){dynamicCheck=dynamicCheck.not(tcAPI.associatedEpoSelector+' '+'.tmcp-dynamic.override-product-price.tc-is-math-cumulative')}
1018dynamicCheck=dynamicCheck.filter('.tcenabled');if(dynamicCheck.length>0){fetch=fetchOptionPrices(currentEpoObject,epoHolder,'.tmcp-field.tmcp-dynamic.override-product-price.tc-is-math-cumulative',dynamicProductPrice+total,dynamicProductPrice+original_total,floatingBoxData,showTotal,undefined,undefined,undefined,!0,undefined,undefined,cartQty);dynamicProductPrice=$.epoAPI.math.toFloat(fetch.total)-$.epoAPI.math.toFloat(total);productPrice=dynamicProductPrice;rawProductRegularPrice=$.epoAPI.math.toFloat(fetch.original_total)-$.epoAPI.math.toFloat(original_total);rawProductPrice=dynamicProductPrice;productRegularPrice=dynamicProductPrice;_total=dynamicProductPrice;_original_total=dynamicProductPrice;totalsHolderContainer.find('.cpf-override-product-price').val(dynamicProductPrice);totalsHolder_tc_totals_ob.override_product_price=dynamicProductPrice;totalsHolder.data('totalsHolder_tc_totals_ob',totalsHolder_tc_totals_ob)}
1019dynamicCheck=epoHolder.find('.tmcp-dynamic.override-product-price');if(currentEpoObject.is_associated===!1){dynamicCheck=dynamicCheck.not(tcAPI.associatedEpoSelector+' '+'.tmcp-dynamic.override-product-price')}
1020dynamicCheck=dynamicCheck.filter('.tcenabled');if(!dynamicCheck.length>0){totalsHolderContainer.find('.cpf-override-product-price').val('')}else{_total=0;_original_total=0}
1021jWindow.trigger('tcEpoAfterOptionPriceCalculation',{epo:currentEpoObject,alternativeCart:currentEpoObject,this_product_type:this_product_type,cart:cart,totalsHolder:totalsHolder,fetchOptionPrices:fetchOptionPrices,epoHolder:epoHolder,total:total,original_total:original_total,floatingBoxData:floatingBoxData,showTotal:showTotal,cart_fee_options_total:cart_fee_options_total,cart_fee_options_original_total:cart_fee_options_original_total});setTimeout(function(){epoHolder.find('select.tm-epo-field').trigger('tm-select-price-update-html-all')},1);$.tcepo.oneOptionIsSelected[epoEventId]=showTotal;currentEpoObject=addShowHidetoEpoObject(currentEpoObject,epoEventId,elementsLength);tm_show_hide_add_to_cart_button(main_product,currentEpoObject);if(cart_fee_options_total>0){showTotal=!0}
1022if(alternativeCart&&!perProductPricing){showTotal=!1}
1023if(finalTotalBoxMode==='enable'||finalTotalBoxMode==='hideifoptionsiszero'||finalTotalBoxMode==='hideiftotaliszero'){showTotal=!0}
1024if(cartQty>1){showTotal=!0}
1025if((this_product_type==='variable'||this_product_type==='variable-subscription')&&!$.epoAPI.math.toFloat(currentVariation)){showTotal=!1}
1026if(finalTotalBoxMode==='disable'){showTotal=!1}
1027if(TMEPOJS.tm_epo_change_variation_price==='yes'||TMEPOJS.tm_epo_change_original_price==='yes'){showTotal=!0}
1028if(currentEpoObject.is_associated&&!perProductPricing){showTotal=!1}
1029product_total_price=parseFloat(productPrice*cartQty);if(TMEPOJS.extraFee){extraFee=parseFloat(TMEPOJS.extraFee);if(!Number.isFinite(extraFee)){extraFee=0}}
1030calculateFinalProductPrice=$.epoAPI.applyFilter('tcCalculateFinalProductPrice',!1,{alternativeCart:alternativeCart,product_price:productPrice,product_total_price:product_total_price,v_product_price:rawProductPrice,tm_set_tax_price:tm_set_tax_price,main_product:main_product,totalsHolder:totalsHolder,cartQty:cartQty});if(calculateFinalProductPrice!==!1&&typeof calculateFinalProductPrice
1030==='object'&&Object.prototype.hasOwnProperty.call(calculateFinalProductPrice,'productPrice')&&Object.prototype.hasOwnProperty.call(calculateFinalProductPrice,'productTotalPrice')){productPrice=calculateFinalProductPrice.productPrice;product_total_price=calculateFinalProductPrice.productTotalPrice}
1031_total=$.epoAPI.applyFilter('tc_adjust_options_price_per_unit',_total,product_total_price);total=parseFloat(_total*cartQty*elementQty);total=$.epoAPI.applyFilter('tc_adjust_options_total_price',total,cartQty,elementQty,_total,totalsHolder);if(TMEPOJS.tm_epo_global_product_element_quantity_sync==='no'){totalProductField=parseFloat(productFieldSyncTotal);totalProductFieldTaxed=parseFloat(productFieldSyncTotalTaxed)}else{totalProductField=parseFloat(productFieldSyncTotal*cartQty*elementQty);totalProductFieldTaxed=parseFloat(productFieldSyncTotalTaxed*cartQty*elementQty)}
1032totalProductField=$.epoAPI.applyFilter('tc_adjust_options_productfield_total_price',totalProductField,cartQty,elementQty,_total,totalsHolder);totalProductFieldTaxed=$.epoAPI.applyFilter('tc_adjust_options_productfield_total_price_taxed',totalProductFieldTaxed,cartQty,elementQty,_total,totalsHolder);_original_total=$.epoAPI.applyFilter('tc_adjust_options_price_per_unit',_original_total,product_total_price);original_total=parseFloat(_original_total*cartQty*elementQty);original_total=$.epoAPI.applyFilter('tc_adjust_options_original_total_price',original_total,cartQty,elementQty,_original_total,totalsHolder);if(TMEPOJS.tm_epo_global_product_element_quantity_sync==='no'){originalTotalProductField=parseFloat(productFieldSyncOriginalTotal);originalTotalProductFieldTaxed=parseFloat(productFieldSyncOriginalTotalTaxed)}else{originalTotalProductField=parseFloat(productFieldSyncOriginalTotal*cartQty*elementQty);originalTotalProductFieldTaxed=parseFloat(productFieldSyncOriginalTotalTaxed*cartQty*elementQty)}
1033originalTotalProductField=$.epoAPI.applyFilter('tc_adjust_options_productfield_original_total_price',originalTotalProductField,cartQty,elementQty,_original_total,totalsHolder);originalTotalProductFieldTaxed=$.epoAPI.applyFilter('tc_adjust_options_productfield_original_total_price_taxed',originalTotalProductFieldTaxed,cartQty,elementQty,_original_total,totalsHolder);if(priceOverrideMode==='1'&&parseFloat(total)>0){productPrice=0;rawProductPrice=0;product_total_price=0}
1034product_total_price=$.epoAPI.applyFilter('tc_adjust_product_total_price_without_options',product_total_price);total=$.epoAPI.applyFilter('tcAdjustTotal',total,{epo:currentEpoObject,totalsHolder:totalsHolder,cart:cart,main_product:main_product});totalProductField=$.epoAPI.applyFilter('tcAdjustProductFieldTotal',totalProductField,{epo:currentEpoObject,totalsHolder:totalsHolder,cart:cart,main_product:main_product});totalProductFieldTaxed=$.epoAPI.applyFilter('tcAdjustProductFieldTotalTaxed',totalProductFieldTaxed,{epo:currentEpoObject,totalsHolder:totalsHolder,cart:cart,main_product:main_product});original_total=$.epoAPI.applyFilter('tcAdjustOriginalTotal',original_total,{epo:currentEpoObject,totalsHolder:totalsHolder,cart:cart,main_product:main_product});originalTotalProductField=$.epoAPI.applyFilter('tcAdjustProductFieldOriginalTotal',originalTotalProductField,{epo:currentEpoObject,totalsHolder:totalsHolder,cart:cart,main_product:main_product});originalTotalProductFieldTaxed=$.epoAPI.applyFilter('tcAdjustProductFieldOriginalTotalTaxed',originalTotalProductFieldTaxed,{epo:currentEpoObject,totalsHolder:totalsHolder,cart:cart,main_product:main_product});total=parseFloat($.epoAPI.applyFilter('tc_adjust_total',total,totalsHolder));cart_fee_options_total=parseFloat($.epoAPI.applyFilter('tc_adjust_totals_fee',cart_fee_options_total,totalsHolder));original_total=parseFloat($.epoAPI.applyFilter('tc_adjust_original_total',original_total,totalsHolder));cart_fee_options_original_total=parseFloat($.epoAPI.applyFilter('tc_adjust_original_total_fee',cart_fee_options_original_total,totalsHolder));raw_extraFee=extraFee;total_plus_fee=total+cart_fee_options_total;original_total_plus_fee=original_total+cart_fee_options_original_total;raw_total=total;raw__total=_total;raw_cart_fee_options_total=cart_fee_options_total;raw_total_plus_fee=total_plus_fee;raw_original_total=original_total;raw__original_total=_original_total;raw_cart_fee_options_original_total=cart_fee_options_original_total;raw_original_total_plus_fee=original_total_plus_fee;raw_product_total_price_without_options=product_total_price;raw_product_total_price=parseFloat(product_total_price+total_plus_fee+raw_extraFee);raw_product_total_original_price=parseFloat(rawProductRegularPrice+original_total_plus_fee+raw_extraFee);
1034productPrice=tm_set_tax_price(productPrice,totalsHolder,undefined,undefined,undefined,undefined,!0);productRegularPrice=tm_set_tax_price(productRegularPrice,totalsHolder,undefined,undefined,undefined,undefined,!0);product_total_price=tm_set_tax_price(product_total_price,totalsHolder,undefined,undefined,undefined,undefined,!0);total=tm_set_tax_price(total,totalsHolder,undefined,undefined,undefined,undefined,!0);_total=tm_set_tax_price(_total,totalsHolder,undefined,undefined,undefined,undefined,!0);total_plus_fee=parseFloat(cart_fee_options_total)+parseFloat(total);original_total=tm_set_tax_price(original_total,totalsHolder,undefined,undefined,undefined,undefined,!0);_original_total=tm_set_tax_price(_original_total,totalsHolder,undefined,undefined,undefined,undefined,!0);original_total_plus_fee=parseFloat(cart_fee_options_original_total)+parseFloat(original_total);extraFee=tm_set_tax_price(extraFee,totalsHolder,undefined,undefined,undefined,undefined,!0);product_total_price_without_options=product_total_price;product_total_price=$.epoAPI.applyFilter('tc_adjust_product_total_price',parseFloat(product_total_price+total_plus_fee+extraFee),product_total_price_without_options,total_plus_fee,extraFee,total,cart_fee_options_total,totalsHolder);product_total_original_price=$.epoAPI.applyFilter('tc_adjust_product_total_original_price',parseFloat(product_total_price_without_options+original_total_plus_fee+extraFee),product_total_price_without_options,original_total_plus_fee,extraFee,original_total,cart_fee_options_original_total,totalsHolder);pricesIncludeTax=totalsHolder.attr('data-prices-include-tax')||TMEPOJS.prices_include_tax;if(pricesIncludeTax==='1'){vat_options_total=productFieldSyncVatTotal+parseFloat(calculateTaxAmount(total,totalsHolder));vat_options_total_plus_fee=productFieldSyncVatTotal+parseFloat(calculateTaxAmount(total_plus_fee,totalsHolder));vat_total=productFieldSyncVatTotal+parseFloat(calculateTaxAmount(product_total_price,totalsHolder));vat_product_base=parseFloat(calculateTaxAmount(product_total_price_without_options,totalsHolder))}else{vat_options_total=productFieldSyncVatTotal+parseFloat(total-raw_total);vat_options_total_plus_fee=productFieldSyncVatTotal+parseFloat(total_plus_fee-raw_total_plus_fee);vat_total=productFieldSyncVatTotal+parseFloat(product_total_price-raw_product_total_price);vat_product_base=parseFloat(product_total_price_without_options-raw_product_total_price_without_options)}
1035raw_total=raw_total+totalProductField;raw__total=raw__total+totalProductField;raw_total_plus_fee=raw_total_plus_fee+totalProductField;raw_original_total=raw_original_total+originalTotalProductField;raw__original_total=raw__original_total+originalTotalProductField;raw_original_total_plus_fee=raw_original_total_plus_fee+originalTotalProductField;raw_product_total_price=raw_product_total_price+totalProductField;raw_product_total_original_price=raw_product_total_original_price+originalTotalProductField;total=total+totalProductFieldTaxed;_total=_total+totalProductFieldTaxed;total_plus_fee=total_plus_fee+totalProductFieldTaxed;original_total=original_total+originalTotalProductFieldTaxed;_original_total=_original_total+originalTotalProductFieldTaxed;original_total_plus_fee=original_total_plus_fee+originalTotalProductFieldTaxed;product_total_price=product_total_price+totalProductFieldTaxed;product_total_original_price=product_total_original_price+originalTotalProductFieldTaxed;unit_price=parseFloat(productPrice+parseFloat(_total));unit_original_price=parseFloat(productPrice+parseFloat(_original_total));if(TMEPOJS.tm_epo_fees_on_unit_price==='yes'){unit_price=parseFloat(productPrice+parseFloat(_total)+parseFloat(parseFloat(cart_fee_options_total)/cartQty));unit_original_price=parseFloat(productPrice+parseFloat(_original_total)+parseFloat(parseFloat(cart_fee_options_original_total)/cartQty))}
1036formatted_unit_price=tm_set_price_totals(unit_price,totalsHolder,!0);formatted_unit_original_price=tm_set_price_totals(unit_original_price,totalsHolder,!0);if(extraFee){show_extra_fee=!0;formatted_extra_fee=tm_set_price_totals(extraFee,totalsHolder,!0)}
1037formatted_final_total=tm_set_price_totals(product_total_price,totalsHolder,!0);formatted_final_original_total=tm_set_price_totals(product_total_original_price,totalsHolder,!0);formatted_options_total=tm_set_price_totals(total,totalsHolder,!0);formatted_fees_total=tm_set_price_totals(cart_fee_options_total,totalsHolder,!0);formatted_options_original_total=tm_set_price_totals(original_total,totalsHolder,!0);formatted_fees_original_total=tm_set_price_totals(cart_fee_options_original_total,totalsHolder,!0);formatted_vat_options_total=tm_set_price_totals(vat_options_total);formatted_vat_options_total_plus_fee=tm_set_price_totals(vat_options_total_plus_fee);formatted_vat_total=tm_set_price_totals(vat_total);formatted_vat_product_base=tm_set_price_totals(vat_product_base);formatted_unit_price=$.epoAPI.applyFilter('tc_adjust_formatted_unit_price',formatted_unit_price,productPrice,_total,cart_fee_options_total,cartQty);formatted_options_total=$.epoAPI.applyFilter('tc_adjust_formatted_options_total',formatted_options_total,total,_total,cartQty);formatted_fees_total=$.epoAPI.applyFilter('tc_adjust_formatted_fees_total',formatted_fees_total,cart_fee_options_total);formatted_final_total=$.epoAPI.applyFilter('tc_adjust_formatted_final_total',formatted_final_total,product_total_price,product_total_price_without_options,total_plus_fee,extraFee,cartQty);formatted_unit_price=$.epoAPI.applyFilter('tcAdjustFormattedUnitPrice',formatted_unit_price,{epo:currentEpoObject,totalsHolder:totalsHolder,event:event,unit_price:unit_price,productPrice:productPrice,_total:_total,total_plcart_fee_options_totals_fee:cart_fee_options_total,cartQty:cartQty});formatted_unit_original_price=$.epoAPI.applyFilter('tcAdjustFormattedUnitOriginalPrice',formatted_unit_original_price,{epo:currentEpoObject,totalsHolder:totalsHolder,event:event,unit_original_price:unit_original_price,productPrice:productPrice,_original_total:_original_total,total_plcart_fee_options_totals_fee:cart_fee_options_total,cartQty:cartQty});formatted_options_total=$.epoAPI.applyFilter('tcAdjustFormattedOptionsTotal',formatted_options_total,{epo:currentEpoObject,totalsHolder:totalsHolder,event:event,total:total,_total:_total,total_plus_fee:total_plus_fee,extraFee:extraFee,cartQty:cartQty});formatted_options_original_total=$.epoAPI.applyFilter('tcAdjustFormattedOptionsOriginalTotal',formatted_options_original_total,{epo:currentEpoObject,totalsHolder:totalsHolder,event:event,original_total:original_total,_original_total:_original_total,original_total_plus_fee:original_total_plus_fee,extraFee:extraFee,cartQty:cartQty});formatted_fees_total=$.epoAPI.applyFilter('tcAdjustFormattedFeesTotal',formatted_fees_total,{epo:currentEpoObject,totalsHolder:totalsHolder,event:event,cart_fee_options_total:cart_fee_options_total,extraFee:extraFee,cartQty:cartQty});formatted_fees_original_total=$.epoAPI.applyFilter('tcAdjustFormattedFeesOriginalTotal',formatted_fees_original_total,{epo:currentEpoObject,totalsHolder:totalsHolder,event:event,cart_fee_options_original_total:cart_fee_options_original_total,extraFee:extraFee,cartQty:cartQty});formatted_final_total=$.epoAPI.applyFilter('tcAdjustFormattedFinalTotal',formatted_final_total,{epo:currentEpoObject,totalsHolder:totalsHolder,event:event,product_total_price:product_total_price,product_total_price_without_options:product_total_price_without_options,total_plus_fee:total_plus_fee,extraFee:extraFee,cartQty:cartQty});formatted_final_original_total=$.epoAPI.applyFilter('tcAdjustFormattedFinalOriginalTotal',formatted_final_original_total,{epo:currentEpoObject,totalsHolder:totalsHolder,event:event,product_total_original_price:product_total_original_price,product_total_price_without_options:product_total_price_without_options,original_total_plus_fee:original_total_plus_fee,extraFee:extraFee,cartQty:cartQty});if((total>0&&finalTotalBoxShowOptions==='showtgz')||finalTotalBoxShowOptions==='show'){show_options_total=!0;
1037if(TMEPOJS.tm_epo_enable_vat_options_total==='yes'){show_vat_options_total=!0}}
1038if(cart_fee_options_total!==0){show_fees_total=!0}
1039if(formatted_final_total&&finalTotalBoxShowFinal==='show'){show_final_total=!0}
1040tc_totals_ob={qty:cartQty,product_price:productPrice,raw_product_price:rawProductPrice,product_regular_price:productRegularPrice,raw_product_regular_price:rawProductRegularPrice,formatted_product_price:tm_set_price_totals(parseFloat(productPrice)*cartQty),late_total_prices:late_total_price,late_total_price:tm_set_tax_price(late_total_price[0],totalsHolder),late_total_original_price:tm_set_tax_price(late_total_price[1],totalsHolder),raw_options_price_per_unit:raw__total,raw_options_total_price:raw_total,raw_cart_fee_options_total_price:raw_cart_fee_options_total,raw_total_plus_fee:raw_total_plus_fee,raw_options_original_price_per_unit:raw__original_total,raw_options_original_total_price:raw_original_total,raw_cart_fee_options_original_total_price:raw_cart_fee_options_original_total,raw_original_total_plus_fee:raw_original_total_plus_fee,raw_product_total_price:raw_product_total_price,raw_product_total_original_price:raw_product_total_original_price,raw_product_total_price_without_options:raw_product_total_price_without_options,options_price_per_unit:_total,options_total_price:total,cart_fee_options_total_price:cart_fee_options_total,total_plus_fee:total_plus_fee,options_original_price_per_unit:_original_total,options_original_total_price:original_total,cart_fee_options_total_original_price:cart_fee_options_original_total,original_total_plus_fee:original_total_plus_fee,vat_options_total:vat_options_total,vat_options_total_plus_fee:vat_options_total_plus_fee,formatted_vat_options_total:formatted_vat_options_total,formatted_vat_options_total_plus_fee:formatted_vat_options_total_plus_fee,vat_total:vat_total,formatted_vat_total:formatted_vat_total,vat_product_base:vat_product_base,formatted_vat_product_base:formatted_vat_product_base,product_total_price:product_total_price,product_total_original_price:product_total_original_price,product_total_price_without_options:product_total_price_without_options,product_unit_price:unit_price,product_unit_original_price:unit_original_price,formatted_unit_price:formatted_unit_price,formatted_options_total:formatted_options_total,formatted_fees_total:formatted_fees_total,formatted_final_total:formatted_final_total,formatted_unit_original_price:formatted_unit_original_price,formatted_options_original_total:formatted_options_original_total,formatted_fees_original_total:formatted_fees_original_total,formatted_final_original_total:formatted_final_original_total,formatted_extra_fee:formatted_extra_fee,show_options_total:show_options_total,show_fees_total:show_fees_total,show_extra_fee:show_extra_fee,show_final_total:show_final_total,show_options_vat:show_vat_options_total,show_unit_price:TMEPOJS.tm_epo_show_unit_price==='yes',unit_price:currentEpoObject.is_associated?TMEPOJS.i18n_item_unit_price:TMEPOJS.i18n_unit_price,options_total:currentEpoObject.is_associated?TMEPOJS.i18n_item_options_total:TMEPOJS.i18n_options_total,options_vat_total:currentEpoObject.is_associated?TMEPOJS.i18n_item_vat_options_total:TMEPOJS.i18n_vat_options_total,final_total:currentEpoObject.is_associated?TMEPOJS.i18n_item_final_total:TMEPOJS.i18n_final_total,fees_total:TMEPOJS.i18n_fees_total,extra_fee:TMEPOJS.i18n_extra_fee,totals_box_before_unit_price:TMEPOJS.totals_box_before_unit_price,totals_box_after_unit_price:TMEPOJS.totals_box_after_unit_price,totals_box_before_vat_options_totals_price:TMEPOJS.totals_box_before_vat_options_totals_price,totals_box_after_vat_options_totals_price:TMEPOJS.totals_box_after_vat_options_totals_price,totals_box_before_options_totals_price:TMEPOJS.totals_box_before_options_totals_price,totals_box_after_options_totals_price:TMEPOJS.totals_box_after_options_totals_price,totals_box_before_fee_totals_price:TMEPOJS.totals_box_before_fee_totals_price,totals_box_after_fee_totals_price:TMEPOJS.totals_box_after_fee_totals_price,totals_box_before_extra_fee_price:TMEPOJS.totals_box_before_extra_fee_price,totals_box_after_extra_fee_price:TMEPOJS.totals_box_after_extra_fee_price,totals_box_before_final_totals_price:TMEPOJS.totals_box_before_final_totals_price,totals_box_after_final_totals_price:TMEPOJS.totals_box_after_final_totals_price};if(TMEPOJS.customer_price_format){customer_price_format_wrap_start=TMEPOJS.customer_price_format_wrap_start;customer_price_format_wrap_end=TMEPOJS.customer_price_format_wrap_end;customerPriceFormat=TMEPOJS.customer_price_format}
1041if(formatted_options_total&&total>=0){_ftotal=formatPrice(total);_foriginal_total=formatPrice(original_total);if(customerPriceFormat){_ftotal=customerPriceFormat.replaceAll('__PRICE__',_ftotal).replaceAll('__CODE__',TMEPOJS.current_currency);if(!totalsHolder.data('is-on-sale')){_foriginal_total=customerPriceFormat.replaceAll('__PRICE__',_foriginal_total).replaceAll('__CODE__',TMEPOJS.current_currency)}}
1042_ftotal=$.epoAPI.applyFilter('tcFilterFormattedFTotal',_ftotal,{epo:currentEpoObject,totalsHolder:totalsHolder,event:event,total:total,_total:_total,total_plus_fee:total_plus_fee,extraFee:extraFee,cartQty:cartQty});_foriginal_total=$.epoAPI.applyFilter('tcFilterFormattedFOriginalTotal',_foriginal_total,{epo:currentEpoObject,totalsHolder:totalsHolder,event:event,original_total:original_total,total:original_total,_total:_total,total_plus_fee:total_plus_fee,extraFee:extraFee,cartQty:cartQty});if(TMEPOJS.tm_epo_enable_original_final_total==='yes'&&total!==original_total){tc_totals_ob.formatted_options_total=$.epoAPI.util.decodeHTML($.epoAPI.template.html(tcAPI.templateEngine.tc_formatted_sale_price,{price:_foriginal_total,sale_price:_ftotal,customer_price_format_wrap_start:customer_price_format_wrap_start,customer_price_format_wrap_end:customer_price_format_wrap_end}));tc_totals_ob._foriginal_total=_foriginal_total;tc_totals_ob._ftotal=_ftotal}else{tc_totals_ob.formatted_options_total=$.epoAPI.util.decodeHTML($.epoAPI.util.decodeHTML($.epoAPI.template.html(tcAPI.templateEngine.tc_formatted_price,{price:_ftotal,customer_price_format_wrap_start:customer_price_format_wrap_start,customer_price_format_wrap_end:customer_price_format_wrap_end})))}}
1043if(formatted_final_total&&product_total_price>=0){_fprice=formatPrice(product_total_price);if(priceOverrideMode==='1'&&parseFloat(total)>0){_f_regular_price=parseFloat(raw_original_total+extraFee)}else{_f_regular_price=parseFloat(parseFloat(rawProductRegularPrice*cartQty)+raw_original_total)}
1044if(customerPriceFormat){_fprice=customerPriceFormat.replaceAll('__PRICE__',_fprice).replaceAll('__CODE__',TMEPOJS.current_currency);if(!totalsHolder.data('is-on-sale')){_f_regular_price=customerPriceFormat.replaceAll('__PRICE__',_f_regular_price).replaceAll('__CODE__',TMEPOJS.current_currency)}}
1045_fprice=$.epoAPI.applyFilter('tc_adjust_native_price',_fprice,product_total_price);_f_regular_price=tm_set_tax_price(_f_regular_price,totalsHolder,undefined,undefined,undefined,undefined,
1045!0)+parseFloat(cart_fee_options_original_total)+parseFloat(extraFee);_f_regular_price=formatPrice(_f_regular_price);_f_regular_price=$.epoAPI.applyFilter('tc_adjust_native_regular_price',_f_regular_price,product_total_price);if(TMEPOJS.tm_epo_enable_original_final_total==='yes'&&((totalsHolder.data('is-on-sale')&&priceOverrideMode!=='1')||_f_regular_price!==_fprice)){tc_totals_ob.formatted_final_total=$.epoAPI.util.decodeHTML($.epoAPI.template.html(tcAPI.templateEngine.tc_formatted_sale_price,{price:_f_regular_price,sale_price:_fprice,customer_price_format_wrap_start:customer_price_format_wrap_start,customer_price_format_wrap_end:customer_price_format_wrap_end}))}else{tc_totals_ob.formatted_final_total=$.epoAPI.util.decodeHTML($.epoAPI.util.decodeHTML($.epoAPI.template.html(tcAPI.templateEngine.tc_formatted_price,{price:_fprice,customer_price_format_wrap_start:customer_price_format_wrap_start,customer_price_format_wrap_end:customer_price_format_wrap_end})))}
1046tc_totals_ob._f_regular_price=_f_regular_price;tc_totals_ob._fprice=_fprice}
1047tc_totals_ob.formatted_unit_price=tc_totals_ob.formatted_unit_price+$.epoAPI.util.decodeHTML($.epoAPI.util.decodeHTML($.epoAPI.template.html(tcAPI.templateEngine.suffix)));tc_totals_ob.formatted_options_total=tc_totals_ob.formatted_options_total+$.epoAPI.util.decodeHTML($.epoAPI.util.decodeHTML($.epoAPI.template.html(tcAPI.templateEngine.suffix)));tc_totals_ob.formatted_final_total=tc_totals_ob.formatted_final_total+$.epoAPI.util.decodeHTML($.epoAPI.util.decodeHTML($.epoAPI.template.html(tcAPI.templateEngine.suffix)));tc_totals_ob=replace_suffixes('formatted_fees_original_total','cart_fee_options_total_original_price',tc_totals_ob,totalsHolder);tc_totals_ob=replace_suffixes('formatted_fees_total','cart_fee_options_total_price',tc_totals_ob,totalsHolder);tc_totals_ob=replace_suffixes('formatted_final_original_total','product_total_original_price',tc_totals_ob,totalsHolder);tc_totals_ob=replace_suffixes('formatted_final_total','product_total_price',tc_totals_ob,totalsHolder);tc_totals_ob=replace_suffixes('formatted_options_original_total','options_original_total_price',tc_totals_ob,totalsHolder);tc_totals_ob=replace_suffixes('formatted_options_total','options_total_price',tc_totals_ob,totalsHolder);tc_totals_ob=replace_suffixes('formatted_unit_original_price','product_unit_original_price',tc_totals_ob,totalsHolder);tc_totals_ob=replace_suffixes('formatted_unit_price','product_unit_price',tc_totals_ob,totalsHolder);if($.tcepo.showHideTotal!==undefined&&$.tcepo.showHideTotal[epoEventId]!==undefined){showTotal=$.tcepo.showHideTotal[epoEventId]}
1048tc_totals_ob=$.epoAPI.applyFilter('tc_adjust_tc_totals_ob',tc_totals_ob,{epo_object:currentEpoObject,showTotal:showTotal,epoHolder:epoHolder,totalsHolder:totalsHolder,replace_suffixes:replace_suffixes,replace_suffixes_in_html:replace_suffixes_in_html,tm_set_tax_price:tm_set_tax_price,tm_set_price:tm_set_price,tm_set_price_totals:tm_set_price_totals,product_total_price:product_total_price,product_price:productPrice,qty:cartQty});if(tc_totals_ob.showTotal!==undefined){showTotal=tc_totals_ob.showTotal}
1049currentEpoObject.tc_totals_ob=tc_totals_ob;showTotal=$.epoAPI.applyFilter('tcFinalTotalsBoxVisibility',showTotal,{epo:currentEpoObject,alternativeCart:alternativeCart,cart:cart,main_product:main_product,totalsHolder:totalsHolder,this_epo_totals_container:this_epo_totals_container});html=$.epoAPI.template.html(tcAPI.templateEngine.tc_final_totals,tc_totals_ob);totalsHolder.data('tm-html',html);totalsHolder.data('tc_totals_ob',tc_totals_ob);if(currentEpoObject.associated_connect&&currentEpoObject.associated_connect.length===1){if(currentEpoObject.associated_connect.attr('data-no-price')==='1'){associatedPrice=0;associatedRawPrice=0;associatedOriginalPrice=0;associatedRawOriginalPrice=0;associatedFormattedPrice='';tm_force_update_price(epoObject,associatedSetter.closest('.tmcp-field-wrap').find('.tc-price').not(tcAPI.associatedEpoSelector+' .tc-price'),associatedPrice,associatedFormattedPrice,associatedOriginalPrice)}else{associatedPrice=tc_totals_ob.product_price+tc_totals_ob.options_price_per_unit+(tc_totals_ob.cart_fee_options_total_price/tc_totals_ob.qty);associatedRawPrice=tc_totals_ob.raw_product_price+tc_totals_ob.raw_options_price_per_unit+(tc_totals_ob.raw_cart_fee_options_total_price/tc_totals_ob.qty);associatedOriginalPrice=tc_totals_ob.product_regular_price+tc_totals_ob.options_original_price_per_unit+(tc_totals_ob.cart_fee_options_total_original_price/tc_totals_ob.qty);associatedRawOriginalPrice=tc_totals_ob.raw_product_regular_price+tc_totals_ob.raw_options_original_price_per_unit+(tc_totals_ob.raw_cart_fee_options_original_total_price/tc_totals_ob.qty);associatedFormattedPrice=tm_set_price(associatedPrice,currentEpoObject.this_epo_totals_container,!1,associatedSetter);tm_force_update_price(epoObject,associatedSetter.closest('.tmcp-field-wrap').find('.tc-price').not(tcAPI.associatedEpoSelector+' .tc-price'),associatedPrice,associatedFormattedPrice,associatedOriginalPrice);currentEpoObject.associated_connect.data('tm-quantity',tc_totals_ob.qty);if(currentEpoObject.associated_connect.data('tm-quantity')){associatedPrice=associatedPrice*parseFloat(currentEpoObject.associated_connect.data('tm-quantity'));associatedRawPrice=associatedRawPrice*parseFloat(currentEpoObject.associated_connect.data('tm-quantity'));associatedOriginalPrice=associatedOriginalPrice*parseFloat(currentEpoObject.associated_connect.data('tm-quantity'));associatedRawOriginalPrice=associatedRawOriginalPrice*parseFloat(currentEpoObject.associated_connect.data('tm-quantity'))}
1050associatedFormattedPrice=tm_set_price(associatedPrice,currentEpoObject.this_epo_totals_container,!1,associatedSetter)}
1051currentEpoObject.associated_connect.data('price_set',1);if(associatedSetter.is('.tcenabled')){associatedSetter.data('associated_price_set',1)}
1052associatedSetter.data('price_set',1);associatedSetter.data('raw_price',associatedRawPrice);associatedSetter.data('raw_original_price',associatedRawOriginalPrice);associatedSetter.data('price',tm_set_tax_price(associatedPrice,currentEpoObject.this_epo_totals_container,associatedSetter));associatedSetter.data('original_price',tm_set_tax_price(associatedOriginalPrice,currentEpoObject.this_epo_totals_container,associatedSetter));currentEpoObject.associated_connect.data('price-changed',1);setTimeout(function(){if(!(currentEpoObject.associated_connect&&event.noassociated)){currentEpoObject.mainEpoObject.main_cart.trigger({type:'tm-epo-update',norules:2})}},20)}
1053jWindow.trigger('tcEpoAfterCalculateTotals',{epo:currentEpoObject,alternativeCart:alternativeCart,this_product_type:this_product_type,cart:cart,bundleid:bundleid,totalsObject:tc_totals_ob,main_product:main_product,per_product_pricing:perProductPricing,event:event});hide_native_price=$.epoAPI.applyFilter('hide_native_price',!0);if(cartQty>0){if(TMEPOJS.tm_epo_change_variation_price==='yes'){if(hide_native_price===!0&&finalTotalBoxMode!=='disable'){tm_get_native_prices_block(cart).hide()}else{tm_get_native_prices_block(cart).show()}}
1054if(!showTotal||finalTotalBoxMode==='disable'||(finalTotalBoxMode==='hideiftotaliszero'&&product_total_price===0)||(finalTotalBoxMode==='hideifoptionsiszero'&&total_plus_fee===0)){html='';totalsHolder.html(html);totalsHolder.data('tm-floating-box-data',[])}else{totalsHolder.html(html);jWindow.trigger('tc-totals-container',{epo:tc_totals_ob,totals_holder:totalsHolder,data:{epo_object:currentEpoObject,tm_set_price:tm_set_price,tm_set_price_totals:tm_set_price_totals,product_total_price:product_total_price,product_price:productPrice,qty:cartQty},tm_epo_js:TMEPOJS})}
1055if(formatted_final_total&&product_total_price>=0){if(TMEPOJS.tm_epo_change_variation_price==='yes'){setTimeout(function(){update_native_html=tm_get_native_prices_block(cart);
1055if(totalsHolder.data('is-on-sale')){temp=$.epoAPI.util.decodeHTML($.epoAPI.template.html(tcAPI.templateEngine.tc_formatted_sale_price,{price:_f_regular_price,sale_price:_fprice,customer_price_format_wrap_start:customer_price_format_wrap_start,customer_price_format_wrap_end:customer_price_format_wrap_end,before_price_text:TMEPOJS.variation_price_before_price_text,after_price_text:TMEPOJS.variation_price_after_price_text}));temp=temp+$.epoAPI.util.decodeHTML($.epoAPI.util.decodeHTML($.epoAPI.template.html(tcAPI.templateEngine.main_suffix)));temp={formatted:temp,raw:tc_totals_ob.product_total_price};temp=replace_suffixes('formatted','raw',temp,totalsHolder);temp=temp.formatted;update_native_html.html(temp).show()}else{temp=$.epoAPI.util.decodeHTML($.epoAPI.template.html(tcAPI.templateEngine.tc_formatted_price,{price:_fprice,customer_price_format_wrap_start:customer_price_format_wrap_start,customer_price_format_wrap_end:customer_price_format_wrap_end,before_price_text:TMEPOJS.variation_price_before_price_text,after_price_text:TMEPOJS.variation_price_after_price_text}));temp=temp+$.epoAPI.util.decodeHTML($.epoAPI.util.decodeHTML($.epoAPI.template.html(tcAPI.templateEngine.main_suffix)));temp={formatted:temp,raw:tc_totals_ob.product_total_price};temp=replace_suffixes('formatted','raw',temp,totalsHolder);temp=temp.formatted;update_native_html.html(temp).show()}},310)}
1056if(TMEPOJS.tm_epo_change_original_price==='yes'){if(!alternativeCart||main_product.find('.cpf-bto-price').length===0){if(currentEpoObject.associated_connect){nativeProductPriceSelector=currentEpoObject.main_product.find(tcAPI.associatedNativeProductPriceSelector)}else{nativeProductPriceSelector=currentEpoObject.main_product.find(tcAPI.nativeProductPriceSelector);if(nativeProductPriceSelector.length===0){nativeProductPriceSelector=$(tcAPI.nativeProductPriceSelector)}}
1057if(nativeProductPriceSelector.length===0&&main_product.is('.tc-after-shop-loop')){nativeProductPriceSelector=main_product.closest('.product').find('.price').not('.tc-after-shop-loop .price')}
1058if(nativeProductPriceSelector.data('tc-original-html')===undefined){nativeProductPriceSelector.data('tc-original-html',nativeProductPriceSelector.html())}
1059if(product_total_price>0){if(totalsHolder.data('is-on-sale')){temp=$.epoAPI.util.decodeHTML($.epoAPI.template.html(tcAPI.templateEngine.tc_formatted_sale_price,{price:_f_regular_price,sale_price:_fprice,customer_price_format_wrap_start:customer_price_format_wrap_start,customer_price_format_wrap_end:customer_price_format_wrap_end,before_price_text:TMEPOJS.product_price_before_price_text,after_price_text:TMEPOJS.product_price_after_price_text}));temp=temp+$.epoAPI.util.decodeHTML($.epoAPI.util.decodeHTML($.epoAPI.template.html(tcAPI.templateEngine.main_suffix)));temp={formatted:temp,raw:tc_totals_ob.product_total_price};temp=replace_suffixes('formatted','raw',temp,totalsHolder);temp=temp.formatted;nativeProductPriceSelector.html(temp).show()}else{temp=$.epoAPI.util.decodeHTML($.epoAPI.template.html(tcAPI.templateEngine.tc_formatted_price,{price:_fprice,customer_price_format_wrap_start:customer_price_format_wrap_start,customer_price_format_wrap_end:customer_price_format_wrap_end,before_price_text:TMEPOJS.product_price_before_price_text,after_price_text:TMEPOJS.product_price_after_price_text}));temp=temp+$.epoAPI.util.decodeHTML($.epoAPI.util.decodeHTML($.epoAPI.template.html(tcAPI.templateEngine.main_suffix)));temp={formatted:temp,raw:tc_totals_ob.product_total_price};temp=replace_suffixes('formatted','raw',temp,totalsHolder);temp=temp.formatted;nativeProductPriceSelector.html(temp).show()}}else if(this_product_type&&this_product_type!=='composite'){if(currentEpoObject.associated_connect){if(currentEpoObject.variations_form.length){temp=currentEpoObject.this_epo_totals_container.data('variationIdElement');if(temp.length>0){temp=parseFloat(temp.val());if(!(!temp||temp===0)){nativeProductPriceSelector.html($.epoAPI.util.decodeHTML(TMEPOJS.assoc_current_free_text))}}}else{nativeProductPriceSelector.html($.epoAPI.util.decodeHTML(TMEPOJS.assoc_current_free_text))}}else{nativeProductPriceSelector.html($.epoAPI.util.decodeHTML(TMEPOJS.current_free_text))}}}
1060jWindow.trigger('tcEpoMaybeChangePriceHtml',{epo:currentEpoObject,alternativeCart:alternativeCart,this_product_type:this_product_type,cart:cart,bundleid:bundleid,totalsObject:tc_totals_ob,main_product:main_product,nativePrice:_fprice})}}
1061if(alternativeCart){main_cart.trigger({type:'tm-epo-update',norules:1})}else{this_epo_totals_container.data('is_active',!0)}}else{if(currentEpoObject.associated_connect){nativeProductPriceSelector=currentEpoObject.main_product.find(tcAPI.associatedNativeProductPriceSelector);nativeProductPriceSelector.html(nativeProductPriceSelector.data('tc-original-html'))}
1062tm_get_native_prices_block(cart).toArray().forEach(function(npb){var $npb=$(npb);if(!$npb.data('tm-original-html')){$npb.data('tm-original-html',$npb.html())}else{$npb.html($npb.data('tm-original-html'))}});if(rawProductPrice===0&&TMEPOJS.tm_epo_remove_free_price_label==='yes'){tm_get_native_prices_block(cart).hide()}else if(TMEPOJS.tm_epo_change_variation_price==='yes'&&!(hide_native_price===!0&&finalTotalBoxMode!=='disable')){tm_get_native_prices_block(cart).show()}
1063totalsHolder.empty();if(alternativeCart){main_cart.trigger({type:'tm-epo-update',norules:1})}}
1064main_cart.trigger('tm-epo-after-update',{container:cartContainer});jWindow.trigger('tc-epo-after-update',{epo:tc_totals_ob,totals_holder:totalsHolder,data:{epo_object:currentEpoObject,add_late_fields_prices:add_late_fields_prices,tm_set_price:tm_set_price,tm_set_price_totals:tm_set_price_totals,product_total_price:product_total_price,replace_suffixes_in_html:replace_suffixes_in_html,product_price:productPrice,qty:cartQty,bundleid:bundleid,currentCart:currentCart},tm_epo_js:TMEPOJS})});if(this_product_type==='variable'||this_product_type==='variable-subscription'){epoVariationSection=epoHolder.find('.tm-epo-variation-section').first();epoVariationSection.find('.tm-epo-reset-variation').off('click.cpfv').on('click.cpfv',function(){var field=$(this);var id=$.epoAPI.dom.id(field.attr('data-tm-for-variation'));var section=field.closest('.cpf-type-variations');var inputs=field.closest('.cpf-element').find('.tm-epo-variation-element');var lis=field.closest('.cpf-element').find('.tmcp-field-wrap');inputs.prop('checked',!1);lis.removeClass('tc-active');variationForm.find("[data-attribute_name='attribute_"+id+"']").val('').trigger('change');variationForm.find("[data-attribute_name='attribute_"+id+"']").trigger('focusin');main_product.find('.cpf-type-variations').not(section).toArray().forEach(function(el){variationForm.find("[data-attribute_name='attribute_"+$.epoAPI.dom.id($(el).find('.tm-epo-variation-element').first().attr('data-tm-for-variation'))+"']").trigger('focusin')});field.trigger('blur');variationForm.trigger('woocommerce_update_variation_values_tmlogic')});epoVariationSection.find('input.tm-epo-variation-element,input.tm-epo-variation-element + span').off('mouseup.cpfv').on('mouseup.cpfv',function(){var field=$(this);var id;if(field.is('span')){field=field.prev('input')}
1065if(field.attr('disabled')){variationForm.find('.reset_variations').trigger('click')}
1066id=$.epoAPI.dom.id(field.attr('data-tm-for-variation'));variationForm.find("[data-attribute_name='attribute_"+id+"']").trigger('focusin')});epoVariationSection.off('click.'+eventName+'.tmepo','.reset_variations, .tc-epo-element-variable-reset-variations').on('click.'+eventName+'.tmepo','.reset_variations, .tc-epo-element-variable-reset-variations',{_epoObject:epoObject},function(event){var _nativeProductPriceSelector;if(TMEPOJS.tm_epo_change_original_price==='yes'){if(!alternativeCart||main_product.find('.cpf-bto-price').length===0){if(event.data._epoObject.associated_connect){_nativeProductPriceSelector=event.data._epoObject.main_product.find(tcAPI.associatedNativeProductPriceSelector)}else{_nativeProductPriceSelector=$(tcAPI.nativeProductPriceSelector)}
1067if(_nativeProductPriceSelector.data('tc-original-html')){_nativeProductPriceSelector.html(_nativeProductPriceSelector.data('tc-original-html'))}}}
1068variationForm.find('.variations .reset_variations, .tc-epo-element-variable-reset-variations').first().trigger('click')});epoVariationSection.find('.tm-epo-variation-element').off('change.cpfv tm_epo_variation_element_change').on('change.cpfv tm_epo_variation_element_change',function(e){var field=$(this);var id=$.epoAPI.dom.id(field.attr('data-tm-for-variation'));var value=field.val();var section=field.closest('.cpf-type-variations');var nativeSelect=variationForm.find("[data-attribute_name='attribute_"+id+"']");var exists;if(field.closest('.tm-epo-variation-section').is('.tm-hidden')){return}
1069if(!(e&&e.type&&e.type==='tm_epo_variation_element_change')){exists=!1;nativeSelect.each(function(){if(this.value===value){exists=!0;return!1}});if(!exists){nativeSelect.trigger('focusin')}
1070nativeSelect.val(value).trigger('change')}
1071if(!value){nativeSelect.trigger('focusin')}
1072main_product.find('.cpf-type-variations').not(section).toArray().forEac
1072h(function(vr){variationForm.find('#'+$.epoAPI.dom.id($(vr).find('.tm-epo-variation-element').first().attr('data-tm-for-variation'))).trigger('focusin')});field.trigger('blur');variationForm.trigger('woocommerce_update_variation_values_tmlogic')}).off('focusin.cpfv').on('focusin.cpfv',function(){var field=$(this);var id;if(!field.is('select')){return}
1073id=$.epoAPI.dom.id(field.attr('data-tm-for-variation'));variationForm.find("[data-attribute_name='attribute_"+id+"']").trigger('focusin');variationForm.trigger('woocommerce_update_variation_values_tmlogic')});variationForm.off(eventNamePrefix+'found_variation.tmepo tm_fix_stock','.single_variation_wrap').on(eventNamePrefix+'found_variation.tmepo tm_fix_stock','.single_variation_wrap',function(){fix_stock($(this),cartContainer)});variationForm.off(eventNamePrefix+'found_variation.tmepo').on(eventNamePrefix+'found_variation.tmepo',function(event,variation){var form=$(this);totalsHolder.data('is-on-sale',variation.tc_is_on_sale);totalsHolder.data('regular-price',tm_set_backend_price(variation.display_regular_price,totalsHolder,variation));jWindow.trigger('tm-epo-found-variation',{epo:epoObject,totalsHolder:totalsHolder,totalsHolderContainer:totalsHolderContainer,currentCart:currentCart,variationForm:form,variation:variation});found_variation_tmepo({epoHolder:epoHolder,totalsHolder:totalsHolder,totalsHolderContainer:totalsHolderContainer,currentCart:currentCart,variationForm:form,variation:variation});fix_stock(form,cartContainer)}).off(eventNamePrefix+'hide_variation.tmepo').on(eventNamePrefix+'hide_variation.tmepo',{_epoObject:epoObject},function(event){var _nativeProductPriceSelector;if(TMEPOJS.tm_epo_change_original_price==='yes'){if(!alternativeCart||main_product.find('.cpf-bto-price').length===0){if(event.data._epoObject.associated_connect){_nativeProductPriceSelector=event.data._epoObject.main_product.find(tcAPI.associatedNativeProductPriceSelector)}else{_nativeProductPriceSelector=$(tcAPI.nativeProductPriceSelector)}
1074if(_nativeProductPriceSelector.data('tc-original-html')){_nativeProductPriceSelector.html(_nativeProductPriceSelector.data('tc-original-html'))}}}
1075totalsHolder.data('price',!1);totalsHolder.removeData('tcprice');currentCart.trigger({type:'tm-epo-update',norules:2})}).off(eventNamePrefix+'check_variations.tmepo').on(eventNamePrefix+'check_variations.tmepo',function(){var data={};var chosen=0;var reset=epoVariationSection.find('.reset_variations');variationForm.find('.variations select, .tc-epo-variable-product-selector').toArray().forEach(function(sl){var $this=$(sl);var attribute_name=$this.data('attribute_name')||$this.attr('name');var value=$this.val()||'';if(value.length>0){chosen++}
1076data[attribute_name]=value});if(chosen>0){if(reset.css('visibility')==='hidden'){reset.css('visibility','visible').hide().fadeIn()}}else{reset.css('visibility','hidden')}}).trigger(eventNamePrefix+'check_variations');tm_custom_variations(epoObject,cartContainer,itemId,main_product,epoHolder)}
1077selectSelector.trigger('tm-select-change-html');tmQty.trigger('change.cpf',{init:1});tmQuantity.trigger('showhide.cpfcustom');epoFieldHasClearButton.filter(':checked').trigger('cpfclearbutton');jWindow.on('tm-do-epo-update',function(){currentCart.trigger({type:'tm-epo-update'})});jWindow.trigger('tm-epo-init-events',{epo:{epo_id:epo_id,form:epoObject.form,currentCart:currentCart,cart_container:cartContainer,epo_holder:epoHolder,totals_holder_container:totalsHolderContainer,totals_holder:totalsHolder,main_cart:main_cart,main_epo_inside_form:main_epo_inside_form,product_id_selector:product_id_selector,epo_id_selector:epo_id_selector,product_id:product_id,this_epo_container:this_epo_container,this_totals_container:this_totals_container,this_epo_totals_container:this_epo_totals_container}});jWindow.trigger('epoEventHandlers',{epo:epoObject,currentCart:currentCart,cartContainer:cartContainer,qtyElement:qtyElement,epoHolder:epoHolder,totalsHolderContainer:totalsHolderContainer,totalsHolder:totalsHolder,variationForm:variationForm,variation_id_selector:variation_id_selector,main_epo_inside_form:main_epo_inside_form,this_product_type:this_product_type,get_price_excluding_tax:get_price_excluding_tax,get_price_including_tax:get_price_including_tax});if(finalTotalBoxMode!=='disable'){totalsHolderContainer.addClass('tc-show')}
1078jWindow.trigger('epo_options_before_visible');if(TMEPOJS.tm_epo_progressive_display==='yes'){setTimeout(function(){epoHolder.css('opacity',0).addClass('tc-show').animate({opacity:1},tcAPI.epoAnimationDelay,'easeOutExpo',function(){jWindow.trigger('epo_options_visible');jWindow.trigger('tmlazy')})},tcAPI.epoDelay)}else{epoHolder.addClass('tc-show');jWindow.trigger('epo_options_visible');jWindow.trigger('tmlazy')}
1079main_product.addClass('tc-init')}
1080function run_wc_variation_form_cpf(epoObject){var form=epoObject.variations_form;var cart=epoObject.main_cart;var this_epo_container=epoObject.this_epo_container;var eventName=epoObject.is_associated?'tc_variation_form.cpf':'wc_variation_form.cpf';var run=function(){if(form.data('epo_loaded')){return}
1081cpf_section_logic(epoObject);cpf_element_logic(epoObject);jWindow.on('epoEventHandlers',function(){run_cpfdependson(this_epo_container);tm_lazyload()});$.tcepo.lateFieldsPrices[epoObject.epoEventId]=[];epoEventHandlers(epoObject);tm_set_upload_fields(epoObject);tm_product_image(epoObject);jWindow.trigger('epo-after-init-in-timeout',{epo:epoObject});epoObject.noEpoUpdate=!1;cart.trigger('tm-epo-check-dpd');cart.trigger({type:'tm-epo-update',rules:'init'});form.data('epo_loaded',!0)};form.off(eventName).on(eventName,function(){run()});setTimeout(function(){form.trigger(eventName)},window.tcVariationDelayCheck||2000);if(variationsFormIsLoaded){form.trigger(eventName)}
1082jWindow.trigger('epo-after-init',{epo:epoObject})}
1083function detect_variation_swatches_interval(epoObject){var $id=requestAnimationFrame(function(){detect_variation_swatches_interval(epoObject)});var obj=epoObject.variations_form;var bound=obj.data('bound');var eventName=epoObject.is_associated?'tc_variation_form.cpf':'wc_variation_form.cpf';if(bound){cancelAnimationFrame($id);run_wc_variation_form_cpf(epoObject);obj.trigger(eventName)}}
1084function manualInitEPO(epoObject,item,itemCart,itemEpoContainer,main_product){var epoObjectOriginal=$.extend(!0,{},epoObject);var product_id=itemEpoContainer.attr('data-product-id');var epo_id=itemEpoContainer.attr('data-epo-id');var product_id_selector='.tm-product-id-'+product_id;var epo_id_selector="[data-epo-id='"+epo_id+"']";var epoEventId='p'+product_id+'e'+epo_id;var this_epo_container=$(tcAPI.epoSelector+product_id_selector+epo_id_selector);var this_totals_container=$('.tc-totals-form'+product_id_selector+epo_id_selector);var this_epo_totals_container=$('.tc-epo-totals'+product_id_selector+epo_id_selector);epoObject.isManual=!0;$.tcepo.formSubmitEvents[epoEventId]=[];$.tcepo.errorObject[epoEventId]=!1;$.tcepo.initialActivation[epoEventId]=!1;epoObject.product_id=product_id;epoObject.product_id_selector=product_id_selector;epoObject.epo_id=epo_id;epoObject.epo_id_selector=epo_id_selector;epoObject.epoEventId=epoEventId;epoObject.noEpoUpdate=!0;epoObject.thisForm=item;epoObject.this_epo_container=this_epo_container;epoObject.this_totals_container=this_totals_container;epoObject.this_epo_totals_container=this_epo_totals_container;tm_lazyload();main_product.find('.tm-collapse').tmtoggle();main_product.find('.tm-section-link').tmsectionpoplink();tm_set_datepicker(item);setRangePickers(item);setRangePickersEvents();tm_set_repeaters(item,epoObject);tm_css_styles(item);tm_set_color_pickers(itemEpoContainer);tm_set_lightbox(itemEpoContainer.find('.tc-lightbox-image').not('.tm-extra-product-options-variations .radio-image'));cpf_section_logic(epoObject);cpf_element_logic(epoObject);run_cpfdependson(itemEpoContainer);$.tcToolTip(item.find('.tm-tooltip'));epoEventHandlers(epoObject,item,itemCart);epoObject.noEpoUpdate=!1;itemCart.trigger({type:'tm-epo-update',norules:2});setTimeout(function(){epoObject.main_cart.trigger({type:'tm-epo-update',epoObject:epoObjectOriginal,norules:1})},200);fix_stock(itemCart,item)}
1085function tm_init_epo(main_product,is_quickview,product_id,epo_id,associated_connect,mainEpoObject,reactivate){var main_cart=!1;var main_epo_inside_form=!1;var main_totals_inside_form=!1;var epoEventId;var has_epo=typeof product_id!=='undefined';var not_has_epo=!1;var add_to_cart_field;var product_id_selector;var epo_id_selector;var this_epo_container;var this_totals_container;var this_epo_totals_container;var epo_object;var variations_form;var detect_variation_swatches=$('.variation_form_section .variations-table').length>0;var is_associated=!1;main_product=$(main_product);if(main_product.is('.tc-init')&&!reactivate){return!0}
1086if(is_quickview){errorContainer=main_product}else{errorContainer=$(window)}
1087jWindow.trigger('tm-epo-init-start');if(!has_epo){if(main_product.is('.product')){not_has_epo=!0;has_epo=jBody.find(tcAPI.epoSelector).length}}
1088if(!has_epo&&TMEPOJS.tm_epo_enable_final_total_box_all==='no'&&!main_product.is('.tm-no-options-composite')){jWindow.trigger('tm-epo-init-end-no-options');return}
1089if(not_has_epo){jWindow.trigger('tm-epo-init-no-options');if(main_product.is('.product')&&!(main_product.is('.tm-no-options-pxq')||main_product.is('.tm-no-options-composite'))){main_product=jBody}}
1090if(!product_id){add_to_cart_field=main_product.find(tcAPI.addToCartSelector).last();if(add_to_cart_field.length>0){product_id=add_to_cart_field.val()}else{add_to_cart_field=$('.tc-totals-form.tm-totals-form-main');product_id=add_to_cart_field.attr('data-product-id')}
1091if(!product_id){product_id=''}}
1092if(!epo_id){epo_id=parseInt(main_product.find('input.tm-epo-counter').last().val(),10);if(!Number.isFinite(epo_id)){epo_id=''}}
1093product_id_selector='.tm-product-id-'+product_id;epo_id_selector="[data-epo-id='"+epo_id+"']";this_epo_container=$(tcAPI.epoSelector+product_id_selector+epo_id_selector);this_totals_container=$('.tc-totals-form'+product_id_selector+epo_id_selector);this_epo_totals_container=$('.tc-epo-totals'+product_id_selector+epo_id_selector);variations_form=main_product.find('.variations_form').not('.composite_component .variations_form').first();epoEventId='p'+product_id+'e'+epo_id;if(variations_form&&variations_form.attr('data-product_id')){if(variations_form.attr('data-product_id')!==product_id){variations_form=main_product.find(".variations_form[data-product_id='"+product_id+"']")}}
1094main_cart=get_main_cart(main_product,main_product,'form',product_id);if(main_cart.length===0){if(main_product.is('.tc-shortcode-wrap')){main_cart=get_main_cart(this_totals_container,this_totals_container,'.tc-totals-form',product_id)}else if(main_product.is('.tc-epo-element-product-container')){main_cart=main_product.find(tcAPI.associatedEpoCart);
1094if(main_cart.length===0){main_cart=this_epo_container.parent(tcAPI.associatedEpoSelector);if(main_cart.length===0){main_cart=main_product.find('.tc-epo-element-product-container-right')}}
1095is_associated=!0}}
1096if(is_associated&&variations_form.length===0&&main_product.is('.variations_form')){variations_form=main_product}
1097$.tcepo.formSubmitEvents[epoEventId]=[];$.tcepo.errorObject[epoEventId]=!1;$.tcepo.initialActivation[epoEventId]=!1;if(main_cart.find(tcAPI.epoSelector).length>0){main_epo_inside_form=!0}
1098if(main_cart.find('.tc-totals-form').length>0){main_totals_inside_form=!0}
1099if(!main_totals_inside_form){$.tcepo.formSubmitEvents[epoEventId][$.tcepo.formSubmitEvents[epoEventId].length]={trigger:function(){return!0},on_true:function(){var epos_hidden=$('.tc-totals-form.tm-product-id-'+product_id+"[data-epo-id='"+epo_id+"']").tcClone();var formepo=$('<div class="tm-hidden tm-formepo-normal"></div>');main_cart.find('.tm-formepo-normal').remove();formepo.append(epos_hidden);main_cart.append(formepo);return!0},on_false:function(){setTimeout(function(){$('.tm-formepo-normal').remove()},100)}}}
1100if(!main_epo_inside_form){$.tcepo.formSubmitEvents[epoEventId][$.tcepo.formSubmitEvents[epoEventId].length]={trigger:function(){return!0},on_true:function(){var epos=$(tcAPI.epoSelector+'.tm-product-id-'+product_id+"[data-epo-id='"+epo_id+"']").tcClone().addClass('formepo');var formepo=$('<div class="tm-hidden tm-formepo"></div>');main_cart.find('.tm-formepo').remove();formepo.append(epos);main_cart.append(formepo);return!0},on_false:function(){setTimeout(function(){$('.tm-formepo').remove()},100)}}}
1101epo_object={main_product:main_product,main_cart:main_cart,epo_id:epo_id,form:get_main_form(main_product),main_epo_inside_form:main_epo_inside_form,product_id_selector:product_id_selector,epo_id_selector:epo_id_selector,product_id:product_id,this_epo_container:this_epo_container,this_totals_container:this_totals_container,this_epo_totals_container:this_epo_totals_container,qtySelector:tcAPI.qtySelector,manualInitEPO:manualInitEPO,epoEventId:epoEventId,variations_form:variations_form,has_epo:has_epo,is_quickview:is_quickview,is_associated:is_associated,is_epo_shortcode:this_epo_container.is('.tc-shortcode'),mainEpoObject:mainEpoObject,associated_connect:associated_connect,noEpoUpdate:!0};$(epo_object.form).data('epo_object',epo_object);this_epo_container.data('epo_object',epo_object);main_cart.data('product_id',product_id).data('epo_id',epo_id).data('product_id_selector',product_id_selector).data('epo_id_selector',epo_id_selector);tm_set_checkboxes_rules(epo_object);tm_set_upload_rules(epo_object);tm_set_datepicker(this_epo_container);setRangePickers(this_epo_container);setRangePickersEvents();tm_set_repeaters(this_epo_container,epo_object);tm_set_url_fields();$.tcToolTip(this_epo_container.find('.tm-tooltip'));this_epo_container.find('.tm-collapse').tmtoggle();this_epo_container.find('.tm-section-link').tmsectionpoplink();if(reactivate){this_epo_container.addClass('reactivate')}
1102if(variations_form.length>0){if(reactivate){variations_form.data('epo_loaded',!1)}
1103this_epo_totals_container.data('price',!1);if(detect_variation_swatches){detect_variation_swatches_interval(epo_object)}else{run_wc_variation_form_cpf(epo_object)}}else{setTimeout(function(){cpf_section_logic(epo_object);cpf_element_logic(epo_object);jWindow.on('epoEventHandlers',function(){run_cpfdependson(this_epo_container);tm_lazyload()});$.tcepo.lateFieldsPrices[epoEventId]=[];epoEventHandlers(epo_object);tm_set_upload_fields(epo_object);tm_product_image(epo_object);jWindow.trigger('epo-after-init-in-timeout',{epo:epo_object});main_cart.trigger('tm-epo-check-dpd');epo_object.noEpoUpdate=!1;main_cart.trigger({type:'tm-epo-update',rules:'init'})},20);jWindow.trigger('epo-after-init',{epo:epo_object})}
1104tm_css_styles(this_epo_container);tm_set_color_pickers(this_epo_container);tm_set_lightbox(this_epo_container.find('.tc-lightbox-image').not('.tm-extra-product-options-variations .radio-image'));tm_theme_specific_actions(epo_object);tc_compatibility(epo_object);if(!is_associated){tm_floating_totals(this_epo_totals_container,is_quickview,main_cart);tm_form_submit_event(epo_object);epo_object=addShowHidetoEpoObject(epo_object,epoEventId,epo_object);tm_show_hide_add_to_cart_button(main_product,epo_object)}
1105jWindow.trigger('tm-epo-init-end',{epo:epo_object,replace_suffixes_in_html:replace_suffixes_in_html});return epo_object}
1106function manual_init(container,reactivate){var $this=$(container);var product_id=$this.attr('data-product-id');var epo_id=$this.attr('data-epo-id');var quickview_floating=!1;var testForm=$this.parent();if(!testForm.is('form')){testForm=$this.closest('form');if(!testForm.is('form')){testForm=$this.parent()}}
1107testForm=testForm.parent();tm_init_epo(testForm,quickview_floating,product_id,epo_id,undefined,undefined,reactivate)}
1108function init_epo_plugin(){var epo_container;var epo_options_container;if(TMEPOJS.tm_epo_no_lazy_load==='no'){$.extend($.lazyLoadXT,{autoInit:!1,selector:'img.tmlazy',srcAttr:'data-original',visibleOnly:!1,updateEvent:$.lazyLoadXT.updateEvent+' tmlazy'})}
1109epo_container=$('.tm-no-options-pxq, .tm-no-options-composite');if(epo_container.length>0){epo_container.addClass('initializing');
1109epo_container.toArray().forEach(function(product_wrap){var inputepoid;product_wrap=$(product_wrap);inputepoid=product_wrap.find('input.tm-epo-counter');if(inputepoid.length>1){inputepoid.toArray().forEach(function(ec){var currentepoid=$(ec);var currentcart=currentepoid.closest('.cart');var currentcartparent=currentcart.parent();if(currentcartparent.is('form')){currentcartparent=currentcartparent.parent()}
1110if(!currentcartparent.is('.initializing')){tm_init_epo(currentcartparent,!1,undefined,parseInt(currentepoid.val(),10))}})}else{tm_init_epo(product_wrap,!1)}
1111epo_container.removeClass('initializing')})}
1112setTimeout(function(){try{epo_options_container=$(tcAPI.epoSelector).not(tcAPI.associatedEpoSelector+' '+tcAPI.epoSelector+', .tm-no-options-pxq, .tm-no-options-composite, .wc-product-table '+tcAPI.epoSelector);if(epo_options_container.length>0){epo_container.addClass('initializing');epo_options_container.toArray().forEach(function(ec){var $this=$(ec);var product_id=$this.attr('data-product-id');var epo_id=$this.attr('data-epo-id');var quickview_floating=!1;var jProductWrap;
1112var addInputs=!1;var inputepoid;jProductWrap=$this.closest('.tc-after-shop-loop.tm-has-options');if(jProductWrap.length===0){jProductWrap=$(tcAPI.tcAddToCartSelector+"[data-epo-id='"+epo_id+"'][value='"+product_id+"']").closest('form,.cart').first().parent();if(jProductWrap.length===0){jProductWrap=$(tcAPI.addToCartSelector+"[value='"+product_id+"']").closest('form,.cart').first().parent();if(jProductWrap.length===0){jProductWrap=$this.closest('form,.cart').first().parent('.tm-has-options');if(jProductWrap.length===0){if($this.is('.tc-shortcode')){jProductWrap=$this.wrap('<div class="tc-shortcode-wrap tc-wrap-'+epo_id+'"></div>');jProductWrap=$this.parent()}
1113if(jProductWrap.length>0){addInputs=!0}}}}}else{addInputs=!0}
1114if(jProductWrap.length>0){if(addInputs){quickview_floating=!0;$this.closest('form,.cart').first().append($('<input name="add-to-cart" value="'+product_id+'" type="hidden">'));$this.closest('form,.cart').first().append($('<input type="hidden" value="" class="variation_id" name="variation_id">'))}
1115if(jProductWrap.is('form')){jProductWrap=jProductWrap.parent()}
1116inputepoid=jProductWrap.find('input.tm-epo-counter');if(inputepoid.length>1){inputepoid.toArray().forEach(function(c){var currentepoid=$(c);var currentcart=currentepoid.closest('.cart');var currentcartparent=currentcart.parent();if(currentcartparent.is('form')){currentcartparent=currentcartparent.parent()}
1117if(!currentcartparent.is('.initializing')){tm_init_epo(currentcartparent,quickview_floating,product_id,parseInt(currentepoid.val(),10))}})}else{tm_init_epo(jProductWrap,quickview_floating,product_id,epo_id)}}});epo_container.removeClass('initializing')}}catch(err){window.console.log(err);errorObject=err}},1)}
1118$.tcepo.tm_init_epo=function(main_product,is_quickview,product_id,epo_id){tm_init_epo(main_product,is_quickview,product_id,epo_id)};$.tcepo.tmLazyloadContainer=function(container){tmLazyloadContainer=container};jWindow.on('tc_manual_init',function(evt,container){var reactivate;if('container' in container&&'reactivate' in container){reactivate=container.reactivate;container=container.container}
1119manual_init(container,reactivate)});function tcAjaxAddToCart($this){var _pid;var epos;var _cpf_product_price;var _dynamic_product_price;var _override_product_price;var form_prefix;var epoid;var obj;var data;var tcTotalsForm;currentAjaxButton=$this;_pid=currentAjaxButton.attr('data-product_id');if(undefined===_pid){_pid=currentAjaxButton.val()}
1120if(undefined!==_pid){epoid=currentAjaxButton.closest('.cart').find('.tm-epo-counter').val();if(!epoid){epoid=currentAjaxButton.attr('data-epo-id');if(!epoid){return}}
1121if(currentAjaxButton.closest('.tm-has-options').length!==1&&currentAjaxButton.attr('data-epo-id')===undefined){return}
1122obj={};epos=$(tcAPI.epoSelector+'.tm-product-id-'+_pid+'[data-epo-id="'+epoid+'"]');if(epos.length>1){if(epos.filter('.formepo')){epos=epos.filter('.formepo')}else{epos=epos.first()}}
1123if(epos.length===1){tcTotalsForm=$('.tc-totals-form.tm-product-id-'+_pid+'[data-epo-id="'+epoid+'"]');_cpf_product_price=tcTotalsForm.find('.cpf-product-price').val();_dynamic_product_price=tcTotalsForm.find('.cpf-dynamic-product-price').val();_override_product_price=tcTotalsForm.find('.cpf-override-product-price').val();form_prefix=tcTotalsForm.find('.tc_form_prefix').val();obj=$.extend(obj,{tcajax:1,tcaddtocart:_pid,cpf_product_price:_cpf_product_price,dynamic_product_price:_dynamic_product_price,override_product_price:_override_product_price});if(form_prefix){obj.tc_form_prefix=form_prefix}}
1124data=currentAjaxButton.data();TMEPOJS.ajaxbuttondata=$.epoAPI.util.deepCopyArray(data);TMEPOJS.ajaxbutton=currentAjaxButton;currentAjaxButton.removeData();currentAjaxButton.data($.extend(data,epos.tcSerializeObject(),obj));TMEPOJS.ajaxdata={epos:epos,_pid:_pid,data:data}}}
1125function ajaxAddToCartFunctions(){$(document).on('click.tcajax','body.mfn-ajax-add-to-cart .single_add_to_cart_button:not(.disabled)',function(){var formepo;var $this=$(this);tcAjaxAddToCart($this);TMEPOJS.ajaxdata.cart=$this.closest('.cart');TMEPOJS.ajaxdata.cart.find('.tm-formepo').remove();formepo=$("<div class='tm-hidden tm-formepo'></div>");formepo.append(TMEPOJS.ajaxdata.epos.tcClone().addClass('formepo'));$this.after(formepo)});jBody.on('click.tcajax','.ajax_add_to_cart',function(){tcAjaxAddToCart($(this));if(undefined!==TMEPOJS.ajaxdata){delete TMEPOJS.ajaxdata}});jBody.on('click.tcajax','.single_add_to_cart_button',function(){currentAddToCartButton=$(this)});$(document.body).on('added_to_cart',function(){if(TMEPOJS.ajaxbuttondata&&TMEPOJS.ajaxbutton instanceof $){TMEPOJS.ajaxbutton.removeData();TMEPOJS.ajaxbutton.data(TMEPOJS.ajaxbuttondata)}})}
1126ajaxAddToCartFunctions();$(function(){tcAPI=$.epoAPI.applyFilter('tc_api',tcAPI);jWindow.on('lazyLoadXToncomplete',function(){$('.tm-owl-slider').toArray().forEac
1126h(function(slider){$(slider).trigger('refresh.owl.carousel')})});jWindow.on('tc_init_epo_plugin',function(evt){init_epo_plugin(evt)});jWindow.on('tcShowLastError',function(){window.console.log(errorObject)});$.ajaxPrefilter(function(options,originalOptions){var found=!1;var hashes;var hash;var i;var params;var $thisbutton;var _data;var _urldata;var _pid;var epos;var _cpf_product_price;var _dynamic_product_price;var _override_product_price;var form_prefix;var obj;var oldData;var formData;var can_be_added=!1;var associativeArray={};var tcTotalsForm;if(TMEPOJS.tm_epo_enable_in_shop==='yes'){hashes=options.url.split('?');if(hashes&&hashes.length>=1){hashes=hashes[1];if(hashes){hash=hashes.split('&');for(i=0;i<hash.length;i+=1){params=hash[i].split('=');if(params.length>=1){if(params[0]&&params[1]&&params[0]==='wc-ajax'&&params[1]==='add_to_cart'){found=!0}}}
1127if(found){options.originalsuccess=options.success;options.success=function(response){if(response&&response.error&&response.product_url){if(currentAjaxButton&&currentAjaxButton.length===1){$thisbutton=currentAjaxButton}
1128$thisbutton=$(".ajax_add_to_cart[data-product_id='"+originalOptions.data.product_id+"']");$thisbutton.removeClass('added');$thisbutton.removeClass('loading')}else{options.originalsuccess.call(null,response)}}}}}}
1129if(FormData&&originalOptions.data){_data=originalOptions.data;if(typeof originalOptions.data==='string'){_data=$.epoAPI.util.parseParams(originalOptions.data)}
1130if(typeof _data[0]==='object'){_data.forEach(function(item){associativeArray[item.name]=item.value});_data=associativeArray}
1131_urldata=[];if(originalOptions.url&&originalOptions.url.indexOf){_urldata=$.epoAPI.util.parseParams(originalOptions.url.slice(originalOptions.url.indexOf('?')+1))}
1132if('quantity' in _data&&_data.tcaddtocart&&(_data.product_id||_data['add-to-cart']||_urldata.product_id||_urldata['add-to-cart'])){can_be_added=!0;_pid=_data.tcaddtocart}else if(Array.isArray(_data)){can_be_added=_data.some(function(item){return item.name==='quantity'})&&_data.some(function(item){return item.name==='add-to-cart'})&&_data.some(function(item){return item.name==='tcaddtocart'});_pid=_data.find(function(item){return item.name==='tcaddtocart'});if(_pid){_pid=_pid.value}else{_pid=!1}}
1133if(!_pid){if('qty' in _data&&_data.tcaddtocart){can_be_added=!0;_pid=_data.tcaddtocart}}
1134if(can_be_added){if(currentAjaxButton&&currentAjaxButton.length===1&&currentAjaxButton.closest('.tm-has-options').length===1){epos=currentAjaxButton.closest('.tm-has-options').find(tcAPI.epoSelector+'.tm-product-id-'+_pid)}else{epos=$(tcAPI.epoSelector+'.tm-product-id-'+_pid)}
1135if(epos.length>1){if(epos.filter('.formepo')){epos=epos.filter('.formepo')}else{epos=epos.first()}}
1136if(epos.length===1){tcTotalsForm=$('.tc-totals-form.tm-product-id-'+_pid);_cpf_product_price=tcTotalsForm.find('.cpf-product-price').val();_dynamic_product_price=tcTotalsForm.find('.cpf-dynamic-product-price').val();_override_product_price=tcTotalsForm.find('.cpf-override-product-price').val();form_prefix=tcTotalsForm.find('.tc_form_prefix').val();obj={tcajax:1,tcaddtocart:_pid,cpf_product_price:_cpf_product_price,dynamic_product_price:_dynamic_product_price,override_product_price:_override_product_price};if(form_prefix){obj.tc_form_prefix=form_prefix}
1137oldData=$.epoAPI.util.parseParams(options.data,!0);oldData=$.extend(oldData,epos.tcSerializeObject(),obj);formData=new FormData();Object.keys(oldData).forEach(function(key){if(key){formData.append(key,oldData[key])}});epos.find(':file').toArray().forEach(function(el){for(i=0;i<$(el)[0].files.length;i++){if(!el.multiple){formData.delete($(el).attr('name'))}
1138formData.append($(el).attr('name'),$(el)[0].files[i])}});options.data=formData;options.contentType=!1;options.cache=!1;options.processData=!1}}}});jDocument.ajaxSuccess(function(event,request,settings){var qv_container=TMEPOJS.quickview_array||'null';var fromaddons=TMEPOJS.quickview_container||'null';var added={};var selectors;var container;var product_id;var epo_id;var noProductCheck;var testContainer;var parsedUrl;var time=1;var detectContainer;var requestContainer;if(undefined!==TMEPOJS.ajaxdata){TMEPOJS.ajaxdata.cart.find('.tm-formepo').remove();delete TMEPOJS.ajaxdata}
1139parsedUrl=$.epoAPI.util.parseParams(settings.data);if(parsedUrl.action==='wc_epo_get_associated_product_html'){return}
1140$('.tm-formepo-normal').remove();$('.tm-formepo').remove();$('.tm-cart-link').tmpoplink();qv_container=$.epoAPI.util.parseJSON(qv_container);fromaddons=$.epoAPI.util.parseJSON(fromaddons);for(selectors in fromaddons){if(Object.prototype.hasOwnProperty.call(fromaddons,selectors)){added[fromaddons[selectors][0]]=$(fromaddons[selectors][1])}}
1141$.extend(qv_container,added);detectContainer=function(){var keyfound=!1;Object.keys(qv_container).forEach(function(key){if($(qv_container[key]).length){keyfound=key}});return keyfound};requestContainer=function(times){var id=requestAnimationFrame(function(){setTimeout(function(){requestContainer(times-1)},200)});var key=detectContainer();var epoContainer;var initepo;if(key||0===times){cancelAnimationFrame(id);if(key){noProductCheck=!1;container=$(qv_container[key]);if(container.length>1&&currentAddToCartButton&&currentAddToCartButton.length){container=currentAddToCartButton.closest(qv_container[key])}
1142if(container.length>1&&key!=='quickview_pro'){return!0}
1143if(key==='woothemes_quick_view'&&container.is('.fusion-woocommerce-quick-view-container')){return!0}
1144if(key==='fusion_quick_view_load'&&container.find(tcAPI.epoSelector).length===0){return!0}
1145if(key==='woodmart_quick_shop'){parsedUrl=$.epoAPI.util.parseParams(settings.url);if(parsedUrl.action==='woodmart_quick_shop'){testContainer=$($.epoAPI.util.escapeSelector(qv_container[key]+'.post-'+parsedUrl.id));if(testContainer.length){container=testContainer;noProductCheck=!0}}}
1146if(key==='woodmart_quick_view'){parsedUrl=$.epoAPI.util.parseParams(settings.url);if(parsedUrl.action==='woodmart_quick_view'){testContainer=$($.epoAPI.util.escapeSelector(qv_container[key]+'.post-'+parsedUrl.id));if(testContainer.length){container=testContainer;noProductCheck=!0}}}
1147if(key==='quickview_pro'){parsedUrl=settings.url.split('/');if(parsedUrl.length){testContainer=$($.epoAPI.util.escapeSelector(qv_container[key]+' .post-'+parsedUrl[parsedUrl.length-1]));if(testContainer.length){container=testContainer;noProductCheck=!0}}}
1148if(key==='exwoofood_booking_info'||key==='wqv_popup_content'||key==='wp_food'||key==='jet_popup_get_content'){noProductCheck=!0}
1149if(key==='woofood'&&settings.data){parsedUrl=$.epoAPI.util.parseParams(settings.data);if(parsedUrl.action==='woofood_quickview_ajax'){testContainer=testContainer=container.find('form').parent();if(testContainer.length){container=testContainer;noProductCheck=!0}}}
1150if(container.find('.product').length===0&&container.is('.product')){noProductCheck=!0}
1151if((container.find('.product').length>0||noProductCheck)){container.removeClass('tc-init');if(key==='fusion_quick_view_load'||key==='jet_popup_get_content'||key==='wp_food'||key==='woodmart_quick_shop'||key==='woodmart_quick_view'||key==='lightboxpro'||key==='jckqv_quick_view'||key==='yith_quick_view'||key==='theme_flatsome_quick_view'){variationsFormIsLoaded=!0}
1152tmLazyloadContainer=container;if(tmLazyloadContainer.length>1){while(tmLazyloadContainer.length>1){tmLazyloadContainer=tmLazyloadContainer.filter(function(){return $(this).find(tcAPI.epoSelector).length>0});if(tmLazyloadContainer.length===0){break}}
1153if(tmLazyloadContainer.length===0){setTimeout(function(){requestContainer(10)},1000);return!0}}
1154epoContainer=tmLazyloadContainer.find(tcAPI.epoSelector);if(epoContainer.length===0){delete qv_container[key];requestContainer(10);return!0}
1155if(key==='fusion_quick_view_load'){time=1400}
1156initepo=function(redo){setTimeout(function(){product_id=epoContainer.attr('data-product-id');epo_id=epoContainer.attr('data-epo-id');if(key==='woodmart_quick_shop'){container.addClass('has-options')}
1157tcAPI.getElementFromFieldCache=[];tm_init_epo(tmLazyloadContainer,!0,product_id,epo_id,undefined,undefined,redo);jWindow.trigger('tmlazy');jWindow.trigger('tm_epo_loaded_quickview');if($.jMaskGlobals){tmLazyloadContainer.find($.jMaskGlobals.maskElements).toArray().forEach(function(t){t=$(t);if(t.attr('data-mask')){t.mask(t.attr('data-mask'))}})}},time)};initepo();if(key==='minimog_product_quick_view'){$('.minimog-product').on('click','.quick-view-btn',function(evt){var $button=$(this);var productID=$button.data('pid');var $template=jBody.children('#'+'modal-quick-view-product-'+productID);evt.preventDefault();evt.stopPropagation();if($button.hasClass('loading')){return}
1158if(!$.fn.MinimogModal){return}
1159if($template.length>0){tmLazyloadContainer=$('.modal-quick-view-popup');initepo(!0)}})}}}}};requestContainer(10)});init_epo_plugin();$('.tm-cart-link').tmpoplink();jBody.on('updated_checkout wc_fragments_loaded wc_fragments_refreshed wc_fragment_refresh',function(){$('.tm-cart-link').tmpoplink()});jWindow.trigger('tmlazy');jWindow.trigger('tm_epo_loaded')});function associated_table_item(){$('.tc-associated-table-product td.product-name').toArray().forEach(function(el){el=$(el);if(el.find('.product-name').length===0){el.wrapInner($('<div class="tc-associated-table-product-indent"></div>'))}})}
1160jBody.on('updated_checkout updated_cart_totals',function(){associated_table_item()});associated_table_item();$(function(){var ua=navigator.userAgent||navigator.vendor||window.opera;ua=(ua.indexOf('FBAN')>-1)||(ua.indexOf('FBAV')>-1)||(ua.indexOf('Instagram')>-1);if(ua){$('.tmcp-upload').removeAttr('accept')}
1161jDocument.on('click','.quantity .jckqv-qty-spinner, .quantity .ui-spinner-button',function(){$(this).closest('.quantity').find(tcAPI.qtySelector).trigger('change')});$(document).on('click','.tm-quantity .tc-qty-button, .tm-quantity-alt .tc-qty-button',function(){var qty=$(this).closest('.tm-quantity, .tm-quantity-alt').find('.tm-qty, .tm-qty-alt');var val=parseFloat(qty.val());var max=parseFloat(qty.attr('max'));var min=parseFloat(qty.attr('min'));var step=parseFloat(qty.attr('step'));if(isNaN(step)){step=1}
1162if($(this).is('.plus')){if(!isNaN(max)&&(max<=val)){qty.val(max)}else{qty.val(val+step)}}else if(!isNaN(min)&&(min>=val)){qty.val(min)}else if(val>0){qty.val(val-step)}
1163$(this).closest('.tm-quantity, .tm-quantity-alt').find('input.tm-qty, input.tm-qty-alt').trigger('change')});$('#wholesale_form').on('submit',function(){var _product_id=$('form.cart').find(tcAPI.addToCartSelector).val();var epos=$(tcAPI.epoSelector+".tm-cart-main[data-product-id='"+_product_id+"']").tcClone();var epos_hidden=$(".tm-totals-form-main[data-product-id='"+_product_id+"']").tcClone();var formepo=$("<div class='tm-hidden tm-formepo'></div>");formepo.append(epos);formepo.append(epos_hidden);$(this).append(formepo);return!0});jDocument.on('click','#add_to_quote',function(e){var form;var epo_id;var epos;if(TMEPOJS&&TMEPOJS.tm_epo_global_enable_validation==='yes'){form=$(this).parents('form');epo_id=parseInt(form.find('.tm-epo-counter').val(),10);epos=$(tcAPI.epoSelector+"[data-epo-id='"+epo_id+"']");if(TMEPOJS.tm_epo_global_enable_validation==='yes'&&$.tc_validator&&form.length>0&&epos.length>0&&!form.tc_validate().form()){e.stopImmediatePropagation()}}});$('.single_add_to_cart_button.paypal_checkout_button').on('click',function(event){var form=$('.cart');var validator;if(form.data('tc_validator')){validator=form.data('tc_validator');if(validator.errorList){event.stopImmediatePropagation()}}});$('.wc-product-table').on('init.wcpt',function(event,table){table.$table.find(tcAPI.epoSelector).addClass('hidden');table.$table.find('thead tr').append('<th>&nbsp;</th>');setTimeout(function(){table.$table.find('.cart:not(.cart_group)').toArray().forEac
1163h(function(c){var epo=$(c).find(tcAPI.epoSelector);var tr=epo.closest('tr');$("<td class='wc-product-table-epo'></td>").appendTo(tr).append(epo);$(window).trigger('tc_manual_init',epo);epo.removeClass('hidden')})},500)});$('.generate-product-link').on('click',function(e){var url=new URL(window.location.href);var params=url.searchParams;var newUrl;var processedRadios={};e.preventDefault();$(tcAPI.epoSelector+':visible').find('.tm-epo-field:enabled').each(function(){var name=this.name;var value;var checkedRadio;if(this.type==='radio'){if(processedRadios[name]){return}
1164processedRadios[name]=!0;checkedRadio=$(tcAPI.epoSelector+':visible').find('.tm-epo-field[name="'+name+'"]:checked');value=checkedRadio.length?checkedRadio.val():''}else if(this.type==='checkbox'){value=this.checked?this.value:''}else{value=$(this).val()}
1165if(name&&value!==''){params.set(name,value)}
1166if(value===''){params.delete(name)}});for(const[key,val]of params.entries()){if(val===''){params.delete(key)}}
1167newUrl=url.toString();history.replaceState(null,null,newUrl);navigator.clipboard.writeText(newUrl).then(function(){window.alert('Link copied to clipboard:\n'+newUrl)}).catch(function(err){window.console.error('Could not copy: ',err)})})})}(window,document,window.jQuery))

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.