(()=>{var e,t={81:()=>{function e(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var a,n,o=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(a=r.next()).done)&&(o.push(a.value),!t||o.length!==t);i=!0);}catch(e){c=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw n}}return o}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return t(e,r);var a=Object.prototype.toString.call(e).slice(8,-1);"Object"===a&&e.constructor&&(a=e.constructor.name);if("Map"===a||"Set"===a)return Array.from(e);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return t(e,r)}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);rsync';var c=new XMLHttpRequest;c.open(n,o,!0),c.send(a),c.onreadystatechange=function(){4==this.readyState&&(200==this.status&&(i.innerHTML='done',i.classList.add("done"),i.disabled=!1,a.get("quantity")&&(r.textContent=parseInt(r.textContent)+parseInt(a.get("quantity"))),a.get("redirect")&&(window.location.href=a.get("redirect"))),400==this.status&&(i.innerHTML='error_outline',i.classList.add("error")))}}))}));var a=document.querySelector(".category-sidebar-toggle"),n=document.querySelector(".category-sidebar");a&&n&&a.addEventListener("click",(function(){if(n.classList.toggle("sidebar-open"),!n.querySelector(".sidebar-close")){var e=document.createElement("button");e.className="sidebar-close",e.setAttribute("aria-label","Luk kategorier"),e.innerHTML='close',e.addEventListener("click",(function(){n.classList.remove("sidebar-open")})),n.prepend(e)}}));document.querySelectorAll('.wizard [data-product] input[type="checkbox"]').forEach((function(e){e.addEventListener("change",(function(e){var t=document.querySelectorAll('.wizard [data-product] input[type="checkbox"]:checked').length;document.querySelector('.wizard [data-step="1"] .next').disabled=t<1}))}));var o=document.querySelector('.wizard [data-step="1"] .next');o&&o.addEventListener("click",(function(e){document.querySelector('.wizard [data-step="1"]').classList.toggle("active"),document.querySelector('.wizard [data-step="2"]').classList.toggle("active")}));var i=document.querySelector('.wizard [data-step="2"] .previous');i&&i.addEventListener("click",(function(e){document.querySelector('.wizard [data-step="1"]').classList.toggle("active"),document.querySelector('.wizard [data-step="2"]').classList.toggle("active")}));var c=document.querySelector('.wizard [data-step="2"] .next');c&&c.addEventListener("click",(function(e){var t,r,a=document.querySelector('select[name="frequency"]').value,n=0;document.querySelectorAll(".wizard [data-product]").forEach((function(e){if(e.querySelector('input[type="checkbox"]').checked){var t=e.querySelector('select[name^="size"]').value,r=e.querySelector('input[name^="quantity"]').value,o=e.querySelector('[data-size="'+t+'"][data-delivery="'+a+'"]').getAttribute("data-price");n+=parseFloat(o)*parseInt(r)}})),document.querySelector(".wizard [data-total]").innerHTML=(t=String(n),(r=t.split(","))[1]||(r[1]="00"),t=(t=r[0].split("").reverse().join("")).replace(/(\d{3}(?!$))/g,"$1."),r[0]=t.split("").reverse().join(""),r.join(",")),document.querySelector('.wizard [data-step="2"]').classList.toggle("active"),document.querySelector('.wizard [data-step="3"]').classList.toggle("active")}));var l=document.querySelector('.wizard [data-step="3"] .previous');l&&l.addEventListener("click",(function(e){document.querySelector('.wizard [data-step="2"]').classList.toggle("active"),document.querySelector('.wizard [data-step="3"]').classList.toggle("active")}));var u=document.querySelectorAll(".calendar > div");u.forEach((function(e){e.hasAttribute("data-unix")&&e.addEventListener("click",(function(t){document.querySelector('input[name="renewal_date"]').value=e.getAttribute("data-unix"),u.forEach((function(e){e.classList.remove("active")})),e.classList.add("active")}))})),jQuery(document).ready((function(t){t("#new_product").on("change",(function(){var r=t(this).val();r?t.ajax({url:ajax_object.ajax_url,method:"POST",data:{action:"fetch_product_variations",product_id:r},success:function(a){if(a.success){var n=a.data.sizes,o=a.data.grinds,i=t("#size".concat(r));i.empty().append(''),n.forEach((function(e){i.append('"))}));var c=t("#grind".concat(r));c.empty().append('');for(var l=0,u=Object.entries(o);l').concat(p,""))}t("#dynamic-options").show()}else alert("Unable to fetch product variations. Please try again."),t("#dynamic-options").hide()},error:function(){alert("An error occurred while fetching product variations."),t("#dynamic-options").hide()}}):t("#dynamic-options").hide()}))}))},870:()=>{}},r={};function a(e){var n=r[e];if(void 0!==n)return n.exports;var o=r[e]={exports:{}};return t[e](o,o.exports,a),o.exports}a.m=t,e=[],a.O=(t,r,n,o)=>{if(!r){var i=1/0;for(s=0;s=o)&&Object.keys(a.O).every((e=>a.O[e](r[l])))?r.splice(l--,1):(c=!1,o0&&e[s-1][2]>o;s--)e[s]=e[s-1];e[s]=[r,n,o]},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={260:0,143:0};a.O.j=t=>0===e[t];var t=(t,r)=>{var n,o,[i,c,l]=r,u=0;if(i.some((t=>0!==e[t]))){for(n in c)a.o(c,n)&&(a.m[n]=c[n]);if(l)var s=l(a)}for(t&&t(r);ua(81)));var n=a.O(void 0,[143],(()=>a(870)));n=a.O(n)})();