(()=>{functione(t){returne="function"==typeofSymbol&&"symbol"==typeofSymbol.iterator?function(e){returntypeofe}:function(e){returne&&"function"==typeofSymbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeofe},e(t)}functiont(t,n){for(varr=0;r<n.length;r++){varo=n[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"ino&&(o.writable=!0),Object.defineProperty(t,(a=o.key,u=void0,u=function(t,n){if("object"!==e(t)||null===t)returnt;varr=t[Symbol.toPrimitive];if(void0!==r){varo=r.call(t,n||"default");if("object"!==e(o))returno;thrownewTypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(a,"string"),"symbol"===e(u)?u:String(u)),o)}vara,u}(new(function(){functione(){vart,n;!function(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}(this,e),this.mollie=Mollie(null===(t=document.querySelector("meta[name=mollie-profileId]"))||void0===t?void0:t.content,{testmode:null===(n=document.querySelector("meta[name=mollie-testmode]"))||void0===n?void0:n.content,locale:"en_US"})}varn,r,o;returnn=e,(r=[{key:"createCardHolderInput",value:function(){vare=this.mollie.createComponent("cardHolder");e.mount("#card-holder");vart=document.getElementById("card-holder-error");returne.addEventListener("change",(function(e){e.error&&e.touched?t.textContent=e.error:t.textContent=""})),this}},{key:"createCardNumberInput",value:function(){vare=this.mollie.createComponent("cardNumber");e.mount("#card-number");vart=document.getElementById("card-number-error");returne.addEventListener("change",(function(e){e.error&&e.touched?t.textContent=e.error:t.textContent=""})),this}},{key:"createExpiryDateInput",value:function(){vare=this.mollie.createComponent("expiryDate");e.mount("#expiry-date");vart=document.getElementById("expiry-date-error");returne.addEventListener("change",(function(e){e.error&&e.touched?t.textContent=e.error:t.textContent=""})),this}},{key:"createCvvInput",value:function(){vare=this.mollie.createComponent("verificationCode");e.mount("#cvv");vart=document.getElementById("cvv-error");returne.addEventListener("change",(function(e){e.error&&e.touched?t.textContent=e.error:t.textContent=""})),this}},{key:"handlePayNowButton",value:function(){if(document.getElementById("pay-now").disabled=!0,""!==document.querySelector("input[name=token]").value)returndocument.querySelector("input[name=gateway_response]").value="",document.getElementById("server-response").submit();this.mollie.createToken().then((function(e){vart=e.token,n=e.error;if(n){document.getElementById("pay-now").disabled=!1;varr=document.getElementById("errors");returnr.innerText=n.message,void(r.hidden=!1)}varo=document.querySelector('input[name="token-billing-checkbox"]:checked');o&&(document.querySelector('input[name="store_card"]').value=o.value),document.querySelector("input[name=gateway_response]").value=t,document.querySelector("input[name=token]").value="",document.getElementById("server-response").submit()}))}},{key:"handle",value:function(){vare=this;this.createCardHolderInput().createCardNumberInput().createExpiryDateInput().createCvvInput(),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach((function(e){returne.addEventListener("click",(function(e){document.getElementById("mollie--payment-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=e.target.dataset.token}))})),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",(function(e){document.getElementById("mollie--payment-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value=""})),document.getElementById("pay-now").addEventListener("click",(function(){returne.handlePayNowButton()}))}}])&&t(n.prototype,r),o&&t(n,o),Object.defineProperty(n,"prototype",{writable:!1}),e}())).handle()})();