1(()=>{"use strict";const e=async()=>{document.addEventListener("easycredit-submit",e=>{if(!(e instanceof CustomEvent))return;const t=e.target;t&&"EASYCREDIT-EXPRESS-BUTTON"===t.tagName&&(t.closest(".wc-block-components-express-payment")||(e.preventDefault(),function(e){let t;const n=e.target,o=n.closest(".summary");if(o instanceof HTMLElement&&(t=o.querySelector("form.cart")),t||(t=document.querySelector("form.cart")),t||(t=document.querySelector("form.woocommerce-cart-form")),!(t instanceof HTMLFormElement))return;const i=(e=>{let t={};e.express="1";for(let[n,o]of Object.entries(e))t["easycredit["+n+"]"]=o;return t})(e.detail),r=t.querySelector('button[name="add-to-cart"], button.single_add_to_cart_button');if(r){let e;return r.getAttribute("value")&&(i["add-to-cart"]=r.getAttribute("value")),void((e=((e,t)=>{if(!(e instanceof HTMLFormElement))return!1;const n=e.getAttribute("action"),o=e.getAttribute("method");if(!n||!o)return!1;const i=document.createElement("form");i.setAttribute("action",n),i.setAttribute("method",o),i.style.display="none";const r=new FormData(e);for(const[e,n]of Object.entries(t))r.set(e,n);for(const e of r.keys()){const t=document.createElement("input");t.setAttribute("type","hidden"),t.setAttribute("name",e),t.setAttribute("value",r.get(e)),i.appendChild(t)}return document.body.appendChild(i),i})(t,i))&&e.submit())}if(n.closest(".wc-proceed-to-checkout")&&n.dataset.url){const e=new URLSearchParams(i).toString();return void(window.location.href=n.dataset.url+"?"+e)}window.alert("Die Express-Zahlung mit easyCredit konnte nicht gestartet werden."),console.error("easyCredit payment could not be started. Please check the integration.")}(e)))},!0),document.querySelectorAll("form.variations_form").forEach(e=>{jQuery(e).on("show_variation",function(e,t){const n=document.querySelector("easycredit-express-button");n instanceof HTMLElement&&(n.style.display="block",n.setAttribute("amount",t&&t.is_in_stock?t.display_price:1))}),e.addEventListener("hide_variation",function(){const e=document.querySelector("easycredit-express-button");e instanceof HTMLElement&&(e.style.display="none")})})},t=["shipping-service-provider","widerruf-digital-acknowledgement","age-rating","german-market-custom-checkbox"],n="p.legal, .wc-gzd-checkbox, .wc-gzd-checkboxes, [data-checkbox], .german-market-checkbox-p",o=['input[name="legal"]','input[name="terms"]',...t.map(e=>`input[name="${e}"]`),"p.legal input[type='checkbox']",".wc-gzd-checkbox input[type='checkbox']",".wc-gzd-checkboxes input[type='checkbox']","[data-checkbox] input[type='checkbox']",".german-market-checkbox-p input[type='checkbox']"].join(", "),i=["first_name","last_name","company","address_1","address_2","city","state","postcode","country","email","phone"],r=(e,t)=>{const n=e.elements.namedItem(t);return n instanceof RadioNodeList||n instanceof HTMLInputElement||n instanceof HTMLSelectElement||n instanceof HTMLTextAreaElement?n.value??"":""},c=(e,t)=>{document.querySelectorAll("easycredit-checkout").forEach(n=>{n instanceof HTMLElement&&(n.setAttribute("alert",e),n.alert=e,(e||t)&&n.removeAttribute("payment-plan"))})},s=async e=>{const{billing:t,shipping:n}=(e=>{const t={},n={},o=e.querySelector("#ship-to-different-address-checkbox")?.checked;for(const c of i)t[c]=r(e,`billing_${c}`),o&&(n[c]=r(e,`shipping_${c}`));if(!o)for(const e of i)"email"!==e&&"phone"!==e&&(n[e]=t[e]??"");return{billing:t,shipping:n}})(e),o=await fetch("/wp-json/easycredit/v1/checkout-validation",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({billing:t,shipping:n})});return o.ok?o.json():{message:"",invalidated:!1}},a=(e,o)=>!!o&&(e.is('input[name="legal"]')||e.is('input[name="terms"]')||(e=>{if(!e.length)return!1;const n=e.attr("name")??"";return!!t.includes(n)||e.closest(".german-market-checkbox-p").length>0})(e)||e.closest(n).length>0),l=(e,t=!1)=>{const i=jQuery(e);let r=!1;const c=i.find('input[name="terms"]:visible');if(c.length&&c.closest(".form-row").removeClass("woocommerce-invalid"),i.find(".input-text, select, input:checkbox").filter((e,n)=>!a(jQuery(n),t)).trigger("validate"),t&&i.find(o).closest(`.form-row, ${n}`).removeClass("woocommerce-invalid woocommerce-invalid-required-field"),c.length&&c.closest(".form-row").removeClass("woocommerce-invalid"),i.find(".woocommerce-invalid:visible").not(c.closest(".form-row")).filter((e,n
1)=>!a(jQuery(n).find("input, select").first(),t)).length>0&&(r=!0),i.find(".validate-required:visible").each(function(){const e=jQuery(this),n=e.find("input.input-text, select, input:checkbox");n.length&&(a(n,t)||(n.is(":checkbox")?!n.is(":checked"):""===n.val()||null===n.val())&&(r=!0,e.addClass("woocommerce-invalid woocommerce-invalid-required-field")))}),r){const e=i.find(".woocommerce-invalid:visible").first();e.length&&jQuery("html, body").animate({scrollTop:e.offset().top-100},500)}return!r},m=e=>document.querySelector('easycredit-checkout[payment-type="'+e+'"]'),d=e=>{let t,n=0;const o=e=>{window.clearTimeout(t),t=window.setTimeout(async()=>{const t=++n;try{const o=await s(e);if(t!==n)return;c(o.message||"",Boolean(o.invalidated))}catch{t===n&&c("",!1)}},400)};document.addEventListener("easycredit-submit",e=>{const t=(e=>{if(!(e instanceof CustomEvent))return null;const t="function"==typeof e.composedPath?e.composedPath():[e.target];for(const e of t)if(e instanceof HTMLElement&&"EASYCREDIT-CHECKOUT"===e.tagName)return e;return null})(e);t&&e instanceof CustomEvent&&(e.preventDefault(),(async(e,t)=>{const n=e.closest("form");if(!(n instanceof HTMLFormElement))return;const o=(e=>{const t=e.getAttribute("payment-plan"),n=e.paymentPlan,o=t??n;return Boolean(o&&""!==String(o).trim())})(e);if(!l(n,!o))return void e.dispatchEvent(new Event("closeModal"));try{const t=await s(n);if(c(t.message||"",Boolean(t.invalidated)),t.message||t.invalidated)return void e.dispatchEvent(new Event("closeModal"))}catch{}const i=[];o||i.push({name:"easycredit[submit]",value:"1"}),t.detail&&t.detail.numberOfInstallments&&i.push({name:"easycredit[number-of-installments]",value:t.detail.numberOfInstallments}
1),i.forEach(e=>{const t=document.createElement("input");t.type="hidden",t.name=e.name,t.value=e.value,n.appendChild(t)}),jQuery(n).submit()})(t,e))},!0),e.addEventListener("change",t=>{const n=t.target;n instanceof Element&&e instanceof HTMLFormElement&&(e=>null!==e.closest(".woocommerce-billing-fields")||null!==e.closest(".woocommerce-shipping-fields")||e.matches("#billing_company")||e.matches("#shipping_company")||e.matches("#ship-to-different-address-checkbox"))(n)&&o(e)}),e.addEventListener("input",t=>{const n=t.target;n instanceof Element&&e instanceof HTMLFormElement&&(n.matches("#billing_company")||n.matches("#shipping_company")||n.closest(".woocommerce-billing-fields")||n.closest(".woocommerce-shipping-fields"))&&o(e)})},u=(e,t,n)=>{jQuery(e).on("checkout_place_order_"+t,()=>{const t=m(n);return!("none"!==t.style.display&&t.isActive&&!t.paymentPlan&&""===t.alert&&!e.querySelector('input[name="easycredit[submit]"]')&&(t.scrollIntoView({behavior:"smooth"}),"INSTALLMENT"===n&&t.dispatchEvent(new Event("openModal")),1))}),"INSTALLMENT"===n&&jQuery(document.body).on("checkout_error",()=>{m(n).dispatchEvent(new Event("closeModal"))})},p=(e,t=null,n=null)=>{let o;null===t&&(t=document);const i="meta[name=easycredit-"+e+"]";if(n instanceof HTMLElement){let e;if((e=n.closest("li.product"))&&(o=e.querySelector(i)))return o.content}return(o=t.querySelector(i))?o.content:null},f=()=>{document.querySelectorAll("form.variations_form").forEach(e=>{jQuery(e).on("show_variation",function(e,t){const n=e.currentTarget.closest(".product.product-type-variable")?.querySelector("easycredit-widget");n&&t?.display_price&&n.setAttribute("amount",t.is_in_stock?t.display_price:1)})})},y={easycredit_ratenkauf:"INSTALLMENT",easycredit_rechnung:"BILL"};(async()=>{await("complete"===document.readyState?Promise.resolve():new Promise(e=>{window.addEventListener("load",()=>e(),{once:!0})})),e(),(async()=>{await(()=>{const e=document.querySelector("easycredit-box-listing.easycredit-box-listing-adjusted");if(!(e&&e instanceof HTMLElement&&e.parentElement))return;const t=[...e.parentElement.children].filter(t=>t!==e)[0],n=t.clientWidth,o=t.clientHeight,i=t.className;e.style.width=n+"px",e.style.height=o+"px",e.style.visibility="hidden",e.className=e.className+" "+i,"LI"===t.tagName&&(e.style.display="list-item",e.style.listStyle="none","UL"===e.parentElement.tagName&&(e.parentElement.className=e.parentElement.className+" easycredit-card-columns-adjusted"))})(),await(async()=>{await customElements.whenDefined("easycredit-box-listing");const e=document.querySelector("easycredit-box-listing.easycredit-box-listing-adjusted");if(!(e instanceof HTMLElement&&e.shadowRoot))return;e.style.visibility="";const t=e.shadowRoot.querySelector(".ec-box-listing");t instanceof HTMLElement&&(t.style.maxWidth="100%",t.style.height="100%");const n=e.shadowRoot.querySelector(".ec-box-listing__image");n instanceof HTMLElement&&(n.style.minHeight="100%")})(),await(()=>{const e=document.querySelector("easycredit-box-listing");if(!(e instanceof HTMLElement&&e.parentElement))return;const t=[...e.parentElement.children].filter(t=>t!==e),n=e.getAttribute("position"),o=n?Number(n)-1:0,i=o?Number(n)-2:0;!n||o<=0||(t[i]?t[i].after(e):e.parentElement.append(e))})()})(),(()=>{const e=p("widget-selector"),t=p("api-key");if(!e||!t)return;let n=(e=>{let t;if(t=e.match(/(.+) easycredit-widget(\[.+?\])$/)){const e=t[2].split("]").map(e=>e.slice(1).split("=")).filter(([e,t])=>e).reduce((e,[t,n])=>({...e,[t]:n}),{});return{selector:t[1],attributes:e}}return{selector:e}})(e);Array.from(document.querySelectorAll(n.selector)).filter(e=>{const t=window.getComputedStyle(e);return"hidden"!==t.visibility&&"0"!==t.opacity}).forEach(e=>{((e,t,n)=>{let o=p("amount",e,t);if(null===o||isNaN(o)){const e=t.parentNode;o=e&&e.querySelector("[itemprop=price]")?e.querySelector("[itemprop=price]").content:null}if(null===o||isNaN(o))return;let i=document.createElement("easycredit-widget");if(i.setAttribute("webshop-id",p("api-key")),i.setAttribute("amount",o),i.setAttribute("payment-types",p("payment-types")),n)for(const[e,t]of Object.entries(n))i.setAttribute(e,t);t.parentNode?.insertBefore(i,t.nextSibling)})(document,e,n.attributes)}),f()})();const t=document.querySelector("form.woocommerce-checkout, form#order_review");if(t){d(t);for(const[e,n]of Object.entries(y))u(t,e,n)}})().catch(e=>{console.error("EasyCredit initialization failed:",e)})})();
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.