function t_prod__init(t){var e=document.querySelector("#rec"+t);if(e){var r=e.querySelectorAll(".js-product");Array.prototype.forEach.call(r,(function(t){t.querySelector(".js-product-option, .js-product-multioption")&&t_prod__initProduct(t)}))}}function t_prod__initProduct(t,e){var r=t;"string"==typeof r&&(r=e),t_prod__initPrice(r),t_prod__addEvents__options(r),t_prod__updatePrice(r,e)}function t_prod__initPrice(t){var e=t;if(e instanceof Element||(e=e[0]),e){var r=e.querySelector(".js-product-price");r||(e.insertAdjacentHTML("beforeend",''),r=e.querySelector(".js-product-price"));var i=r.textContent,n=r.getAttribute("data-product-price-def"),c=r.getAttribute("data-product-price-def-str");if(i){if(!n&&!c){var o=t_prod__cleanPrice(i);r.setAttribute("data-product-price-def",o),r.setAttribute("data-product-price-def-str",i.replace(/"/g,""))}}else r.setAttribute("data-product-price-def",0)}}function t_prod__updatePrice(t,e){var r,i,n,c=t;if(c instanceof Element||(c=c[0]),c){var o=c.querySelector(".js-product-price"),a=c.querySelectorAll(".js-product-option-variants"),d,p=0;if(o){var s=o.parentNode,u,l=null==(i=s=(null==(r=s)?void 0:r.classList.value.split(/\s+/).some((function(t){return t.endsWith("__price")})))?s:null)?void 0:i.parentNode,_;l=(null==(n=l)?void 0:n.classList.value.split(/\s+/).some((function(t){return t.endsWith("__price-wrapper")})))?l:null;var v=o.getAttribute("data-product-price-def");v*=1;var f=0,y=function t(e){if(e){var r=t_prod__cleanPrice(e);-1!==e.indexOf("+")?p+=r:0!==parseFloat(r)&&(v=r)}else f+=1};Array.prototype.forEach.call(a,(function(t){var e=t.querySelector("option:checked").getAttribute("data-product-variant-price");y(e)}));var g=c.querySelectorAll('.js-product-multioption input[type="checkbox"]:checked'),b;if(Array.prototype.forEach.call(g,(function(t){var e=t.getAttribute("data-product-variant-price");y(e)})),d=v+p,o.classList.contains("js-store-prod-price-range-val")||o.classList.contains("js-catalog-prod-price-range-val"))o.setAttribute("data-product-price-range-val",t_prod__roundPrice(d));else if(d>0){l&&"hidden"===l.style.visibility&&(l.style.visibility=""),s&&"none"===s.style.display&&(s.style.display="");var E=t_prod__showPrice(t_prod__roundPrice(d),e),h=o.getAttribute("data-product-price-def-str"),w=f===a.length,A=c.classList.contains("js-store-product")||c.classList.contains("js-catalog-product");if(w&&!A){var j=t_prod__saveUserInputInPrice(d,E,h);o.innerHTML=j}else o.innerHTML=E}else l&&""===l.style.visibility&&(l.style.visibility="hidden"),s&&""===s.style.display&&(s.style.display="none"),o.innerHTML=o.getAttribute("data-product-price-def-str")}}}function t_prod__saveUserInputInPrice(t,e,r){if(!r)return e;if(-1!==r.indexOf(e))return r;var i=t.toString();if(e!==r)if(window.tcart&&"00"===window.tcart.currency_dec){var n=window.tcart.currency_sep,c=e.replace(n+"00","");if(-1!==r.indexOf(c))return r.replace(c,e);if(-1!==r.indexOf(i))return r.replace(i,e)}else if(-1!==r.indexOf(i))return r.replace(i,e);return e}function t_prod__addEvents__options(t){var e=t;if(e instanceof Element||(e=e[0]),e){var r=e.querySelectorAll(".js-product-option-variants");Array.prototype.forEach.call(r,(function(t){var e=t.closest(".js-product");t.addEventListener("change",(function(){t_prod__updatePrice(e),t_triggerEvent(document.body,"twishlist_addbtn")}))}));var i=e.querySelectorAll('.js-product-multioption input[type="checkbox"]');Array.prototype.forEach.call(i,(function(t){var e=t.closest(".js-product");t.addEventListener("change",(function(){t_prod__updatePrice(e),t_triggerEvent(document.body,"twishlist_addbtn")}))}))}}function t_prod__cleanPrice(t){var e=t;return e?(e=(e=e.toString()).replace(",",".").replace(/[^0-9.]/g,""),e=parseFloat(e).toFixed(2),isNaN(e)&&(e=0),e=parseFloat(e),(e*=1)<0&&(e=0)):e=0,e}function t_prod__roundPrice(t){var e=t;return e?(e=parseFloat(e).toFixed(2),e=parseFloat(e),(e*=1)<0&&(e=0)):e=0,e}function t_prod__showPrice(t,e){var r=t;if(r){var i;if(r=r.toString(),window.tcart&&window.tcart.currency_dec&&"00"===window.tcart.currency_dec||e&&e.currencyDecimal&&"00"===e.currencyDecimal)if(-1===r.indexOf(".")&&-1===r.indexOf(","))r+=".00";else 1===r.substr(r.indexOf(".")+1).length&&(r+="0");r=r.replace(/\B(?=(\d{3})+(?!\d))/g," "),r=window.tcart&&window.tcart.currency_sep&&"."===window.tcart.currency_sep||e&&e.currencySeparator&&"."===e.currencySeparator?r.replace(",","."):r.replace(".",",")}else r="";return r}function t_triggerEvent(t,e){var r;document.createEvent?(r=document.createEvent("HTMLEvents")).initEvent(e,!0,!1):document.createEventObject&&((r=document.createEventObject()).eventType=e),r.eventName=e,t.dispatchEvent?t.dispatchEvent(r):t.fireEvent?t.fireEvent("on"+r.eventType,r):t[e]?t[e]():t["on"+e]&&t["on"+e]()}