(()=>{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++){vara=n[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"ina&&(a.writable=!0),Object.defineProperty(t,(o=a.key,i=void0,i=function(t,n){if("object"!==e(t)||null===t)returnt;varr=t[Symbol.toPrimitive];if(void0!==r){vara=r.call(t,n||"default");if("object"!==e(a))returna;thrownewTypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(o,"string"),"symbol"===e(i)?i:String(i)),a)}varo,i}(new(function(){functione(){!function(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}(this,e)}varn,r,a;returnn=e,(r=[{key:"initBraintreeDataCollector",value:function(){window.braintree.client.create({authorization:document.querySelector("meta[name=client-token]").content},(function(e,t){window.braintree.dataCollector.create({client:t,paypal:!0},(function(e,t){e||(document.querySelector("input[name=client-data]").value=t.deviceData)}))}))}},{key:"mountBraintreePaymentWidget",value:function(){window.braintree.dropin.create({authorization:document.querySelector("meta[name=client-token]").content,container:"#dropin-container",threeDSecure:"true"===document.querySelector("input[name=threeds_enable]").value.toLowerCase()},this.handleCallback)}},{key:"handleCallback",value:function(e,t){if(e)console.error(e);else{varn=document.getElementById("pay-now");params=JSON.parse(document.querySelector("input[name=threeds]").value),n.addEventListener("click",(function(){t.requestPaymentMethod({threeDSecure:{challengeRequested:!0,amount:params.amount,email:params.email,billingAddress:{givenName:params.billingAddress.givenName,surname:params.billingAddress.surname,phoneNumber:params.billingAddress.phoneNumber,streetAddress:params.billingAddress.streetAddress,extendedAddress:params.billingAddress.extendedAddress,locality:params.billingAddress.locality,region:params.billingAddress.region,postalCode:params.billingAddress.postalCode,countryCodeAlpha2:params.billingAddress.countryCodeAlpha2}}},(function(e,t){if(e)returnconsole.log(e),dropin.clearSelectedPaymentMethod(),voidalert("There was a problem verifying this card, please contact your merchant");if("true"===document.querySelector("input[name=threeds_enable]").value&&!t.liabilityShifted)returnconsole.log("Liability did not shift",t),voidalert("There was a problem verifying this card, please contact your merchant");n.disabled=!0,n.querySelector("svg").classList.remove("hidden"),n.querySelector("span").classList.add("hidden"),document.querySelector("input[name=gateway_response]").value=JSON.stringify(t);varr=document.querySelector('input[name="token-billing-checkbox"]:checked');r&&(document.querySelector('input[name="store_card"]').value=r.value),document.getElementById("server-response").submit()}))}))}}},{key:"handle",value:function(){this.initBraintreeDataCollector(),this.mountBraintreePaymentWidget(),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach((function(e){returne.addEventListener("click",(function(e){document.getElementById("dropin-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=e.target.dataset.token,document.getElementById("pay-now-with-token").classList.remove("hidden"),document.getElementById("pay-now").classList.add("hidden")}))})),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",(function(e){document.getElementById("dropin-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="",document.getElementById("pay-now-with-token").classList.add("hidden"),document.getElementById("pay-now").classList.remove("hidden")}));vare=document.getElementById("pay-now