(()=>{var e={};document.addEventListener("DOMContentLoaded",(function(t){var i=[],a="",r=[],n=[],l=[],s=give_stripe_vars.preferred_locale,d=document.querySelectorAll(".give-form-wrap");function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=Object.keys(t).length;i>0&&t[0].item,Array.prototype.forEach.call(t,(function(t,i){!1===t.isCardMounted&&(t.item.mount(t.selector+e),t.isCardMounted=!0)}))}function v(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];Array.prototype.forEach.call(e,(function(e,t){!0===e.isCardMounted&&(e.item.unmount(),e.isCardMounted=!1)}))}0!==Object.keys(give_stripe_vars.element_font_styles).length&&l.push(give_stripe_vars.element_font_styles),Array.prototype.forEach.call(d,(function(t){var d=t.querySelector(".give-form");if(null!==d){var c=d.getAttribute("data-publishable-key"),u=d.getAttribute("data-account"),p=d.getAttribute("data-id");if(null!==c){e[p]=Stripe(c),0!==u.trim().length&&(e[p]=Stripe(c,{stripeAccount:u}));var _=e[p].elements({locale:s});l.length>0&&(_=e[p].elements({fonts:l,locale:s})),null!==d.querySelector(".give-gateway:checked").value&&(a=d.querySelector(".give-gateway:checked").value);var g=d.querySelector(".give-submit");i=function(e,t,i){var r=[],n=give_stripe_vars.element_base_styles,l=give_stripe_vars.element_complete_styles,s=give_stripe_vars.element_empty_styles,d=give_stripe_vars.element_invalid_styles,o=e.querySelector("#give-stripe-becs-fields-"+i),v={style:{base:n,complete:l,empty:s,invalid:d},classes:{focus:"focus",empty:"empty",invalid:"invalid"}};if("stripe_becs"===a){var c=o.getAttribute("data-hide_icon"),u=o.getAttribute("data-icon_style");v.iconStyle=u,v.hideIcon="disabled"===c}var p=t.create("auBankAccount",v);return r.push(p),r}(d,_,p),n=["#give-stripe-becs-fields-"],r[p]=[],Array.prototype.forEach.call(n,(function(e,t){r[p][t]=[],r[p][t].item=i[t],r[p][t].selector=e,r[p][t].isCardMounted=!1})),jQuery(document).on("give_gateway_loaded",(function(e,t,i){v(r[p]),"stripe_becs"===d.querySelector(".give-gateway-option-selected .give-gateway").value&&o(p,r[p])})),"stripe_becs"===a||give_stripe_vars.stripe_becs_update?(g.setAttribute("disabled","disabled"),o(p,r[p]),g.removeAttribute("disabled")):v(i)}}})),jQuery("body").on("submit",".give-form",(function(t){var i=jQuery(this),a=i.find('input[name="give-form-id-prefix"]').val();("stripe_becs"===i.find("input.give-gateway:checked").val()||give_stripe_vars.stripe_becs_update)&&(!function(t,i){var a={billing_details:{name:"",email:""}},r=t.find('input[name="give-form-id"]').val(),n=t.find('input[name="give-form-id-prefix"]').val(),l=t.find('input[name="give_first"]').val(),s=t.find('input[name="give_last"]').val(),d=t.find('input[name="give_email"]').val(),o=t.find("[id^=give-purchase-button]");if(t.find("[id^=give-purchase-button]").attr("disabled","disabled"),a.billing_details.name=l+" "+s,a.billing_details.email=d,give_stripe_vars.checkout_address&&!give_stripe_vars.stripe_becs_update){var v=t.find(".card-address").val(),c=t.find(".card-address-2").val(),u=t.find(".card-city").val(),p=t.find(".card_state").val(),_=t.find(".card-zip").val(),g=t.find(".billing-country").val();a.billing_details.address={line1:v||"",line2:c||"",city:u||"",state:p||"",postal_code:_||"",country:g||""}}e[n].createPaymentMethod("au_becs_debit",i,a).then((function(e){if(e.error){var i='<div class="give_errors"><p class="give_error">'.concat(e.error.message,"</p></div>");o.attr("disabled",!1),jQuery(".give-loading-animation").fadeOut(),t.find("[id^=give-stripe-payment-errors-"+r+"]").html(i),give_global_vars.complete_purchase?o.val(give_global_vars.complete_purchase):o.val(o.data("before-validation-label"))}else!function(e,t){e.find('input[name="give_stripe_payment_method"]').val(t.id),e.get(0).submit()}(t,e.paymentMethod)}))}(i,r[a][0].item),t.preventDefault())}))}))})();