(()=>{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)}vart;functionr(t,r){for(varn=0;n<r.length;n++){varo=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"ino&&(o.writable=!0),Object.defineProperty(t,(a=o.key,d=void0,d=function(t,r){if("object"!==e(t)||null===t)returnt;varn=t[Symbol.toPrimitive];if(void0!==n){varo=n.call(t,r||"default");if("object"!==e(o))returno;thrownewTypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(a,"string"),"symbol"===e(d)?d:String(d)),o)}vara,d}varn=null===(t=document.querySelector('meta[name="wepay-action"]'))||void0===t?void0:t.content,o=function(){functione(){vart=arguments.length>0&&void0!==arguments[0]?arguments[0]:"payment";!function(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}(this,e),this.action=t,this.errors=document.getElementById("errors")}vart,n,o;returnt=e,(n=[{key:"initializeWePay",value:function(){vare,t=null===(e=document.querySelector('meta[name="wepay-environment"]'))||void0===e?void0:e.content;returnWePay.set_endpoint("staging"===t?"stage":"production"),this}},{key:"validateCreditCardFields",value:function(){returnthis.myCard=$("#my-card"),""===document.getElementById("cardholder_name")?(document.getElementById("cardholder_name").focus(),this.errors.textContent="Cardholder name required.",void(this.errors.hidden=!1)):""===this.myCard.CardJs("cardNumber").replace(/[^\d]/g,"")?(document.getElementById("card_number").focus(),this.errors.textContent="Card number required.",void(this.errors.hidden=!1)):""===this.myCard.CardJs("cvc").replace(/[^\d]/g,"")?(document.getElementById("cvv").focus(),this.errors.textContent="CVV number required.",void(this.errors.hidden=!1)):""===this.myCard.CardJs("expiryMonth").replace(/[^\d]/g,"")?(this.errors.textContent="Expiry Month number required.",void(this.errors.hidden=!1)):""!==this.myCard.CardJs("expiryYear").replace(/[^\d]/g,"")||(this.errors.textContent="Expiry Year number required.",void(this.errors.hidden=!1))}},{key:"handleAuthorization",value:function(){vare=this;if(this.validateCreditCardFields()){vart=document.getElementById("card_button");t.disabled=!0,t.querySelector("svg").classList.remove("hidden"),t.querySelector("span").classList.add("hidden"),WePay.credit_card.create({client_id:document.querySelector("meta[name=wepay-client-id]").content,user_name:document.getElementById("cardholder_name").value,email:document.querySelector("meta[name=contact-email]").content,cc_number:this.myCard.CardJs("cardNumber").replace(/[^\d]/g,""),cvv:this.myCard.CardJs("cvc").replace(/[^\d]/g,""),expiration_month:this.myCard.CardJs("expiryMonth").replace(/[^\d]/g,""),expiration_year:this.myCard.CardJs("expiryYear").replace(/[^\d]/g,""),address:{country:document.querySelector(["meta[name=country_code"]).content,postal_code:document.querySelector(["meta[name=client-postal-code"]).content}},(function(r){r.error?((t=document.getElementById("card_button")).disabled=!1,t.querySelector("svg").classList.add("hidden"),t.querySelector("span").classList.remove("hidden"),e.errors.textContent="",e.errors.textContent=r.error_description,e.errors.hidden=!1):(document.querySelector('input[name="credit_card_id"]').value=r.credit_card_id,document.getElementById("server_response").submit())}))}}},{key:"completePaymentUsingToken",value:function(e){document.querySelector('input[name="credit_card_id"]').value=null,document.querySelector('input[name="token"]').value=e,document.getElementById("server-response").submit()}},{key:"completePaymentWithoutToken",value:function(){vare=this;if(!this.validateCreditCardFields())returnthis.payNowButton=document.getElementById("pay-now"),this.payNowButton.disabled=!1,this.payNowButton.querySelector("svg").classList.add("hidden"),voidthis.payNowButton.querySelector("span").classList.remove("hidden");WePay.credit_card.create({client_i