// source --> https://staklorezac.com/wp-content/plugins/woocommerce-measurement-price-calculator/assets/js/frontend/wc-measurement-price-calculator.min.js?ver=3.23.10 
jQuery(function(o){var e,a;function c(a){if(void 0===wc_price_calculator_params.page_loaded){var e=a,c=o.cookie(wc_price_calculator_params.cookie_name);if(!1!==o.isPlainObject(c)&&!o.isEmptyObject(c)){for(var r in c)!1!==c.hasOwnProperty(r)&&e.find('.amount_needed[name="'+r+'"]:not(.fixed-value), input[name="'+r+'"].qty').val(c[r]);o("form.cart").trigger("wc-measurement-price-calculator-update"),setTimeout(function(a){return function(){a.trigger("mpc-change")}}(e.find("input.amount_needed:first")),100)}wc_price_calculator_params.page_loaded=!0}else setTimeout(function(){var c={};a.find(".amount_needed:input, input[name=quantity]").each(function(a,e){c[e.name]=e.value}),o.cookie(wc_price_calculator_params.cookie_name,c)},100)}function p(a,e,c,r){a=(a+"").replace(/[^0-9+\-Ee.]/g,"");var a=isFinite(+a)?+a:0,e=isFinite(+e)?Math.abs(e):0,r=void 0===r?",":r,c=void 0===c?".":c,t="";return 3<(t=new BigNumber(a).toFixed(e).split("."))[0].length&&(t[0]=t[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,r)),(t[1]||"").length<e&&(t[1]=t[1]||"",t[1]+=new Array(e-t[1].length+1).join("0")),t.join(c)}function u(a,e,c){return a=function(a){a&&null!==a?isNaN(a)||(a=a.toString()):a="";0<a.length&&(a=a.replace(",","."));return a}(a),a=new BigNumber(a),void 0!==wc_price_calculator_params.unit_normalize_table[e]&&(a=void 0!==wc_price_calculator_params.unit_normalize_table[e].inverse&&wc_price_calculator_params.unit_normalize_table[e].inverse?a.div(wc_price_calculator_params.unit_normalize_table[e].factor):a.times(wc_price_calculator_params.unit_normalize_table[e].factor),e=wc_price_calculator_params.unit_normalize_table[e].unit),(a=void 0!==wc_price_calculator_params.unit_conversion_table[e]&&void 0!==wc_price_calculator_params.unit_conversion_table[e][c]?void 0!==wc_price_calculator_params.unit_conversion_table[e][c].inverse&&wc_price_calculator_params.unit_conversion_table[e][c].inverse?a.div(wc_price_calculator_params.unit_conversion_table[e][c].factor):a.times(wc_price_calculator_params.unit_conversion_table[e][c].factor):a).toNumber()}function l(a){var e;return(e=a.match(/(\d+)\s+(\d+)\/(\d+)/))?0!==e[3]?parseFloat(e[1])+e[2]/e[3]:parseFloat(e[1]):(e=a.match(/(\d+)\/(\d+)/))?0!==e[2]?e[1]/e[2]:0:""===a?0:parseFloat(a)}function m(a){var e=o.trim(wc_price_calculator_params.woocommerce_price_thousand_sep).toString(),c=o.trim(wc_price_calculator_params.woocommerce_price_decimal_sep).toString();if(a&&null!==a?isNaN(a)||(a=a.toString()):a="",0<a.length){if("."===e&&a.match(/\./g)&&!a.match(new RegExp(c,"g")))return a;a=(a="."===e?a.replace(/\./g,""):a.replace(new RegExp(e,"g"),"")).replace(c,".")}return a}function s(a){var e="",c=wc_price_calculator_params.woocommerce_price_num_decimals,r=wc_price_calculator_params.woocommerce_currency_pos,t=wc_price_calculator_params.woocommerce_currency_symbol;switch(a=p(a,c,wc_price_calculator_params.woocommerce_price_decimal_sep,wc_price_calculator_params.woocommerce_price_thousand_sep),"yes"===wc_price_calculator_params.woocommerce_price_trim_zeros&&0<c&&(a=a.replace(new RegExp(function(a,e){return(a+"").replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\"+(e||"")+"-]","g"),"\\$&")}(wc_price_calculator_params.woocommerce_price_decimal_sep,"/")+"0+$"),"")),r){case"left":e='<span class="amount">'+t+a+"</span>";break;case"right":e='<span class="amount">'+a+t+"</span>";break;case"left_space":e='<span class="amount">'+t+"&nbsp;"+a+"</span>";break;case"right_space":e='<span class="amount">'+a+"&nbsp;"+t+"</span>"}return e}o.cookie.json=!0,o(document).bind("reset_image",function(){wc_price_calculator_params.product_price="",wc_price_calculator_params.product_measurement_value="",wc_price_calculator_params.product_measurement_unit="",o(".variable_price_calculator").hide()}),o(".amount_needed:input").on("keypress",function(a){if(a.key===wc_price_calculator_params.woocommerce_price_thousand_sep)return a.preventDefault(),!1}),o(".wc-measurement-price-calculator-input-help").tipTip({attribute:"title",defaultPosition:"left"}),"undefined"!=typeof wc_price_calculator_params&&"pricing"===wc_price_calculator_params.calculator_type&&(o("form.cart").bind("wc-measurement-price-calculator-update",function(){o(".amount_needed:input").each(function(a,e){e=o(e);var c=l("number"===o(this).attr("type")?e.val():m(e.val()));e.trigger("wc-measurement-price-calculator-product-measurement-change",[c])}),o(".amount_needed:input").each(function(a,e){e=o(e);var c,r,t=l("number"===o(this).attr("type")?e.val():m(e.val()));if(!t||t<0)return _=0,!1;t=u(t,e.data("unit"),e.data("common-unit")),"area-linear"===wc_price_calculator_params.measurement_type?_?_+=2*t:_=2*t:"area-surface"===wc_price_calculator_params.measurement_type?_||(e=u(l(e=m(o("#length_needed").val())),o("#length_needed").data("unit"),o("#length_needed").data("common-unit")),c=u(l(c=m(o("#width_needed").val())),o("#width_needed").data("unit"),o("#width_needed").data("common-unit")),r=u(l(r=m(o("#height_needed").val())),o("#height_needed").data("unit"),o("#height_needed").data("common-unit")),_=2*(e*c+c*r+e*r)):_?_*=t:_=t}),_=u(_,wc_price_calculator_params.product_total_measurement_common_unit,wc_price_calculator_params.product_price_unit),wc_price_calculator_params.pricing_rules&&(c=_,r=null,o.each(wc_price_calculator_params.pricing_rules,function(a,e){if(c>=parseFloat(e.range_start)&&(""===e.range_end||c<=e.range_end))return r=e,!1}),(a=r)?(wc_price_calculator_params.product_price=parseFloat(a.price),o(".single_variation span.price").html(a.price_html)):(wc_price_calculator_params.product_price="",o(".single_variation span.price").html(""))),o("#_measurement_needed").val(_),o("#_measurement_needed_unit").val(wc_price_calculator_params.product_price_unit);var _,c,r,a=0,e=parseFloat(wc_price_calculator_params.pricing_overage),t=o(".product_price"),i=o(".product_price_overage"),n=(_?(a=wc_price_calculator_params.product_price*_,wc_price_calculator_params.minimum_price>a&&(a=parseFloat(wc_price_calculator_params.minimum_price)),0<e&&(a+=n=a*e,i.html(s(n))),t.html(s(a)).trigger("wc-measurement-price-calculator-product-price-change",[_,a])):(t.html("").trigger("wc-measurement-price-calculator-product-price-change"),0<e&&i.html("")),null);(n=o(".wc-measurement-price-calculator-total-amount"))&&(t=wc_price_calculator_params,e=parseFloat(_.toFixed(t.measurement_display_precision)),n.text(p(e,t.measurement_display_precision,t.woocommerce_price_decimal_sep,t.woocommerce_price_thousand_sep))),"undefined"!=typeof woocommerce_addons_params&&0<o("form.cart").find("#product-addons-total").length&&(woocommerce_addons_params.product_price=(""===a?0:a).toFixed(2),o("form.cart").trigger("woocommerce-product-addons-update"))}),o("form.cart").trigger("wc-measurement-price-calculator-update"),o(".amount_needed:input").on("keyup change mpc-change",function(){var a=o(this).closest("form.cart");a.trigger("wc-measurement-price-calculator-update"),c(a)}).first().trigger("mpc-change"),o(".single_variation, .single_variation_wrap").bind("show_variation",function(a,e){var c=parseFloat(e.price),r=parseFloat(e.minimum_price);wc_price_calculator_params.product_price=c,wc_price_calculator_params.minimum_price=r,o("form.cart").trigger("wc-measurement-price-calculator-show-variation",e),o("form.cart").trigger("wc-measurement-price-calculator-update"),o(".variable_price_calculator").show()}),o(document.body).bind("updated_addons",function(){var a=o("form.cart"),e=a.find("#product-addons-total");e.data("price")!==woocommerce_addons_params.product_price&&0<e.length&&(e.data("price",woocommerce_addons_params.product_price),a.trigger("woocommerce-product-addons-update"))})),"undefined"!=typeof wc_price_calculator_params&&"quantity"===wc_price_calculator_params.calculator_type&&(o("form.cart").bind("wc-measurement-price-calculator-quantity-changed",function(a,t){wc_price_calculator_params.product_measurement_value&&(o(!(2<arguments.length&&void 0!==arguments[2])||arguments[2]?".amount_needed, .amount_actual":".amount_actual").each(function(a,e){var c,r;e=o(e),1<o(".amount_needed").length||(c=u(wc_price_calculator_params.product_measurement_value,wc_price_calculator_params.product_measurement_unit,e.data("unit")),c=parseFloat((c*t).toFixed(wc_price_calculator_params.measurement_precision)),r=wc_price_calculator_params,e.is("input")?"number"!==e.attr("type")?e.val(p(c,wc_price_calculator_params.measurement_display_precision,r.woocommerce_price_decimal_sep,r.woocommerce_price_thousand_sep)):e.val(c):e.text(p(c,wc_price_calculator_params.measurement_display_precision,r.woocommerce_price_decimal_sep,r.woocommerce_price_thousand_sep)))}),o(".total_price").html(s(t*wc_price_calculator_params.product_price)).trigger("wc-measurement-price-calculator-quantity-total-price-change",[t,wc_price_calculator_params.product_price]))}),e=!1,o("form.cart").bind("wc-measurement-price-calculator-update",function(){var _,a,r;wc_price_calculator_params.product_measurement_value&&(o("input.amount_needed").each(function(a,e){var c,r,t=l(m((e=o(e)).val()));if(!t||t<0)return _=0,!1;t=u(t,e.data("unit"),e.data("common-unit")),"area-linear"===wc_price_calculator_params.measurement_type?_?_+=2*t:_=2*t:"area-surface"===wc_price_calculator_params.measurement_type?_||(e=u(l(e=m(o("#length_needed").val())),o("#length_needed").data("unit"),o("#length_needed").data("common-unit")),c=u(l(c=m(o("#width_needed").val())),o("#width_needed").data("unit"),o("#width_needed").data("common-unit")),r=u(l(r=m(o("#height_needed").val())),o("#height_needed").data("unit"),o("#height_needed").data("common-unit")),_=2*(e*c+c*r+e*r)):_?_*=t:_=t}),_)&&(a=u(wc_price_calculator_params.product_measurement_value,wc_price_calculator_params.product_measurement_unit,wc_price_calculator_params.product_total_measurement_common_unit),(r=Math.ceil((_/a).toFixed(wc_price_calculator_params.measurement_precision)))<parseFloat(wc_price_calculator_params.quantity_range_min_value)&&(r=parseFloat(wc_price_calculator_params.quantity_range_min_value)),e=!!(parseFloat(wc_price_calculator_params.quantity_range_max_value)&&r>parseFloat(wc_price_calculator_params.quantity_range_max_value))&&(r=parseFloat(wc_price_calculator_params.quantity_range_max_value),!0),o("input[name=quantity]").val(r),o(".amount_actual").each(function(a,e){e=o(e);var c=u(wc_price_calculator_params.product_measurement_value,wc_price_calculator_params.product_measurement_unit,e.data("unit")),c=parseFloat((c*r).toFixed(wc_price_calculator_params.measurement_display_precision));e.is("input")?e.val(c):e.text(p(c,wc_price_calculator_params.measurement_display_precision,wc_price_calculator_params.woocommerce_price_decimal_sep,wc_price_calculator_params.woocommerce_price_thousand_sep))}),e?(o("#stock-discrepancy-warning").remove(),o(".entry-summary").find(".cart").after('<p id="stock-discrepancy-warning" class="woocommerce-error">'+wc_price_calculator_params.stock_warning+"</p>")):o("#stock-discrepancy-warning").remove(),o(".total_price").html(s(r*wc_price_calculator_params.product_price)).trigger("wc-measurement-price-calculator-total-price-change",[r,wc_price_calculator_params.product_price]))}),(a=o(".amount_needed:input")).on("keyup change mpc-change",function(){var a=o(this).closest("form.cart");a.trigger("wc-measurement-price-calculator-update"),c(a)}),a.on("blur mpc-change",function(){var a=o(this).closest("form.cart"),e=o("input[name=quantity]").val();a.trigger("wc-measurement-price-calculator-quantity-changed",[e,!1])}),a.trigger("mpc-change"),o("input[name=quantity]").on("change mpc-change",function(a){var e=o(this).closest("form.cart");e.trigger("wc-measurement-price-calculator-quantity-changed",[a.target.value]),c(e)}).trigger("change"),o(".single_variation, .single_variation_wrap").bind("show_variation",function(a,e){wc_price_calculator_params.product_price=parseFloat(e.price),wc_price_calculator_params.product_measurement_value=parseFloat(e.product_measurement_value),wc_price_calculator_params.product_measurement_unit=e.product_measurement_unit,e.product_measurement_value?(0<o("input.amount_needed").length&&o("input.amount_needed").val()?o("form.cart").trigger("wc-measurement-price-calculator-update"):o("form.cart").trigger("wc-measurement-price-calculator-quantity-changed",[o("input[name=quantity]").val()]),o(".variable_price_calculator").show()):o(".variable_price_calculator").hide()}))});
//# sourceMappingURL=wc-measurement-price-calculator.min.js.map;