// source --> https://www.daltec.at/wp-content/themes/daltec2025/js/modal-mini-cart.min.js?ver=1759138385 
document.addEventListener("DOMContentLoaded",function(){var modalEl=document.getElementById("miniCartModal");if(!modalEl||!window.bootstrap||!bootstrap.Modal)return;var miniCartModal=new bootstrap.Modal(modalEl,{});var userClosed=false;var openRequested=false;function openMiniCart(){openRequested=true;userClosed=false;if(!modalEl.classList.contains("show"))miniCartModal.show()}document.addEventListener("click",function(e){var ajaxBtn=e.target&&e.target.closest(".ajax_add_to_cart");if(ajaxBtn){setTimeout(openMiniCart,50)}var singleBtn=e.target&&e.target.closest(".single_add_to_cart_button");if(singleBtn){sessionStorage.setItem("wcOpenMiniCartOnce","1");setTimeout(openMiniCart,50)}},true);if(sessionStorage.getItem("wcOpenMiniCartOnce")==="1"){sessionStorage.removeItem("wcOpenMiniCartOnce");setTimeout(openMiniCart,100)}function attachBodyObserver(){var bodyContainer=document.getElementById("miniCartModalBody");if(!bodyContainer)return false;var obs=new MutationObserver(function(){openMiniCart()});obs.observe(bodyContainer,{childList:true,subtree:true});return true}if(!attachBodyObserver()){var waitObs=new MutationObserver(function(){if(attachBodyObserver())waitObs.disconnect()});waitObs.observe(document.body,{childList:true,subtree:true})}modalEl.addEventListener("click",function(e){var closeBtn=e.target&&e.target.closest('[data-bs-dismiss="modal"]');if(closeBtn)userClosed=true});modalEl.addEventListener("hide.bs.modal",function(e){if(!userClosed){e.preventDefault();setTimeout(function(){if(!modalEl.classList.contains("show"))miniCartModal.show()},0)}else{openRequested=false;userClosed=false}})});
// source --> https://www.daltec.at/wp-content/themes/daltec2025/js/toast-woo-msg.min.js?ver=1762175170 
document.addEventListener("DOMContentLoaded",function(){if(!window.bootstrap||!bootstrap.Toast)return;var container=document.getElementById("wooToastContainer");function toastifyNotice(noticeEl){if(!(noticeEl instanceof HTMLElement))return;if(noticeEl.dataset.toastified==="1")return;noticeEl.dataset.toastified="1";var context="info";if(noticeEl.classList.contains("woocommerce-message"))context="success";if(noticeEl.classList.contains("woocommerce-error"))context="danger";if(context==="info")return;var toastEl=document.createElement("div");toastEl.className="toast align-items-center text-bg-"+context+" border-0";toastEl.setAttribute("role","alert");toastEl.setAttribute("aria-live","assertive");toastEl.setAttribute("aria-atomic","true");toastEl.innerHTML=`
      <div class="d-flex">
        <div class="toast-body">${noticeEl.innerHTML}</div>
        <button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
      </div>
    `;container.appendChild(toastEl);noticeEl.remove();var t=new bootstrap.Toast(toastEl,{autohide:true,delay:1e4});t.show()}document.querySelectorAll(".woocommerce-message, .woocommerce-error, .woocommerce-info").forEach(toastifyNotice);var observer=new MutationObserver(function(mutations){mutations.forEach(function(m){m.addedNodes.forEach(function(node){if(!(node instanceof HTMLElement))return;if(node.matches&&node.matches(".woocommerce-message, .woocommerce-error, .woocommerce-info")){toastifyNotice(node)}var inner=node.querySelectorAll&&node.querySelectorAll(".woocommerce-message, .woocommerce-error, .woocommerce-info");if(inner&&inner.length)inner.forEach(toastifyNotice)})})});observer.observe(document.body,{childList:true,subtree:true})});
// source --> https://www.daltec.at/wp-content/themes/daltec2025/js/woocommerce.min.js?ver=1762175173 
document.addEventListener("DOMContentLoaded",function(){calculator();const extATCbtns=document.querySelectorAll(".external-add-to-cart");const wcForm=document.querySelector(".cart");if(!extATCbtns||!wcForm)return;const sbmtBtn=wcForm.querySelector(".single_add_to_cart_button");[...extATCbtns].forEach(btn=>{btn.addEventListener("click",function(e){e.preventDefault();sbmtBtn.click()})})});const parseMoneyToCents=input=>{if(input==null)return NaN;const raw=String(input).trim();let s=raw.replace(/[^\d.,+\-]/g,"");if(!s||/^[+\-]$/.test(s))return NaN;const lastComma=s.lastIndexOf(",");const lastDot=s.lastIndexOf(".");let dec=null;if(lastComma!==-1&&lastDot!==-1){dec=lastComma>lastDot?",":"."}else if(lastComma!==-1){const fracLen=s.length-lastComma-1;dec=fracLen>=1&&fracLen<=2?",":null}else if(lastDot!==-1){const fracLen=s.length-lastDot-1;dec=fracLen>=1&&fracLen<=2?".":null}if(dec===","){s=s.replace(/\./g,"").replace(",",".")}else if(dec==="."){s=s.replace(/,/g,"")}else{s=s.replace(/[.,]/g,"")}const negative=/-/.test(raw);s=s.replace(/[+\-]/g,"");if(!s)return NaN;let euros=0,cents=0;if(s.includes(".")){let[intPart,fracPart=""]=s.split(".");if(intPart==="")intPart="0";fracPart=(fracPart+"00").slice(0,2);euros=Number.parseInt(intPart,10);cents=Number.parseInt(fracPart,10)}else{euros=Number.parseInt(s,10)}if(!Number.isFinite(euros)||!Number.isFinite(cents))return NaN;let total=euros*100+cents;if(negative)total=-total;return total};const formatCents=(cents,locale="de-DE",currency="EUR")=>{return new Intl.NumberFormat(locale,{style:"currency",currency:currency}).format(cents/100)};let total=0;let ids=[];const calculator=()=>{const productName=document.getElementById("product-name");if(!productName||productName.textContent===""||!productName.dataset.productId)return;renderRequestLink(productName.dataset.productId);const related=document.getElementById("related");if(!related)return;const productPrice=document.getElementById("product-price");if(!productPrice||productPrice.textContent==="")return;const calBtns=document.getElementsByClassName(" btn-calulator");if([...calBtns].length===0)return;calculatorRender(productPrice.textContent,productName.textContent,productName.dataset.productId);[...calBtns].forEach(btn=>{if(!btn)return;btn.addEventListener("click",function(){calculatorRender(btn.dataset.productPrice,btn.dataset.productName,btn.dataset.productId,"+1")})})};const calculatorAccumulate=(id=0,price=0,count="0")=>{switch(count){case"-1":ids.splice(ids.indexOf(id),1);total=total-parseMoneyToCents(price);break;default:ids.push(id);total=total+parseMoneyToCents(price);break}};const calculatorRender=(price=0,name="",id=0,count="0")=>{const calcList=document.getElementById("calculator-list");if(!calcList)return;const calcResult=document.getElementById("calculator-result");if(!calcResult)return;const calcCart=document.getElementsByClassName("calculator-cart");if([...calcCart].length===0)return;calculatorAccumulate(id,price,count);switch(count){case"+1":const item=renderItem(name,price);item.id=`calc_${id}`;item.addEventListener("click",function(){calculatorRender(price,name,id,"-1")});calcList.appendChild(item);activateInSingleProductForm(id,count);renderRequestLink(id);break;case"-1":const elem=document.getElementById(`calc_${id}`);if(!elem)return;elem.remove();activateInSingleProductForm(id,count);renderRequestLink(id);break;default:calcList.appendChild(renderItem(name,price));renderRequestLink(id);break}calcResult.textContent=formatCents(total)};const renderItem=(name="",price=0)=>{const div=document.createElement("div");const span0=document.createElement("span");const span1=document.createElement("span");span0.textContent=name;span1.textContent=formatCents(parseMoneyToCents(price));div.appendChild(span0);div.appendChild(span1);return div};const activateInSingleProductForm=(id=0,count="0")=>{const field=document.getElementsByName(`wc_upsell_qty[${id}]`);if(!field||field.length===0)return;let qty=Number.parseInt(field[0].value,10);qty=qty+Number.parseInt(count,10);field[0].value=qty};const renderRequestLink=(id=0)=>{const requestLink=document.getElementsByClassName("calculator-inquiry");if(!requestLink)return;const pIds=!ids||ids.length===0?id:ids.join(",");[...requestLink].forEach(btn=>{const tmp=btn.href.split("?");btn.href=tmp[0]+"?product_ids="+pIds})};const rentalProductsPriceRender=target=>{const targetId=`${target.id}-dynamic`;const id=target.id.split("-").pop();let dynamicPriceContainer=document.getElementById(targetId);if(!dynamicPriceContainer){dynamicPriceContainer=document.createElement("div");dynamicPriceContainer.id=targetId;dynamicPriceContainer.classList.add("price","bg-info","p-3","mx-n2","mb-3")}else{dynamicPriceContainer.innerHTML=""}const dateFrom=new Date(document.getElementById(`wcrp-rental-products-rent-from-${id}`).value).toLocaleDateString("de-DE",{year:"numeric",month:"2-digit",day:"2-digit"});const dateTo=new Date(document.getElementById(`wcrp-rental-products-rent-to-${id}`).value).toLocaleDateString("de-DE",{year:"numeric",month:"2-digit",day:"2-digit"});dynamicPriceContainer.innerHTML=`<span class="icon-calendar-range"></span> ${dateFrom} - ${dateTo}: <span class="fs-4">${formatCents(parseMoneyToCents(target.value))}</span>`;target.parentElement.appendChild(dynamicPriceContainer)};const rentalProductsPrice=()=>{const rentalForm=document.getElementsByClassName("wcrp-rental-products-rental-form");if(!rentalForm||rentalForm.length===0)return;[...rentalForm].forEach(f=>{const id=f.id.split("-").pop();const price=document.getElementById(`wcrp-rental-products-cart-item-price-${id}`);if(!price)return;const observer=new MutationObserver(mutations=>{mutations.forEach(mutation=>{if(mutation.type==="attributes"&&mutation.attributeName==="value"){if(mutation.target.value!=="")rentalProductsPriceRender(mutation.target)}})});observer.observe(price,{attributes:true,attributeFilter:["value"]})})};