!function(e){function t(i){if(r[i])return r[i].exports;var a=r[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};t.m=e,t.c=r,t.d=function(e,r,i){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=5)}([,,,,,function(e,t,r){r(6),e.exports=r(7)},function(e,t){var r=Stripe(give_stripe_vars.publishable_key);give_stripe_vars.stripe_account_id&&(r=Stripe(give_stripe_vars.publishable_key,{stripeAccount:give_stripe_vars.stripe_account_id})),document.addEventListener("DOMContentLoaded",function(e){function t(e,t){t.classList.contains("float-labels-enabled")&&Array.prototype.forEach.call(t.querySelectorAll(".give-stripe-cc-field-wrap"),function(t,r){var i=t.querySelector("label"),a=t.querySelector("div"),s=t.querySelector(".give-stripe-cc-field"),l=i.parentElement;Array.prototype.includes("give-fl-label",i.classList)||(i.className=i.classList+" give-fl-label"),Array.prototype.includes("give-fl-label",i.classList)||(s.className=s.classList+" give-fl-input"),Array.prototype.includes("give-fl-wrap give-fl-wrap-input give-fl-is-required",a.classList)||(a.className=a.classList+" give-fl-wrap give-fl-wrap-input give-fl-is-required"),Array.prototype.forEach.call(v[e],function(e){e.selector.indexOf(s.id)>0&&e.item.on("change",function(e){!1!==e.empty&&!0!==e.complete||Array.prototype.includes("give-fl-is-active",l.classList)?!0===e.empty&&!1===e.complete&&(l.classList.remove("give-fl-is-active"),l.className=l.classList):l.className=l.classList+" give-fl-is-active"})})})}function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];Object.keys(t).length>0&&(n=t[0].item),Array.prototype.forEach.call(t,function(t,r){!1===t.isCardMounted&&(t.item.mount(t.selector+e),t.isCardMounted=!0)})}function a(){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)})}function s(e,t,r){var i=[],a=give_stripe_vars.element_base_styles,s=give_stripe_vars.element_complete_styles,l=give_stripe_vars.element_empty_styles,c=give_stripe_vars.element_invalid_styles,n={base:a,complete:s,empty:l,invalid:c},o={focus:"focus",empty:"empty",invalid:"invalid"};if("multi"===give_stripe_vars.cc_fields_format){var d=t.create("cardNumber",{style:n,classes:o,placeholder:give_stripe_vars.card_number_placeholder_text});d.addEventListener("change",function(t){var r="diners"===t.brand?"dinersclub":t.brand;e.querySelector(".card-type").className="card-type "+r});var v=t.create("cardExpiry",{style:n,classes:o}),u=t.create("cardCvc",{style:n,classes:o,placeholder:give_stripe_vars.card_cvc_placeholder_text});i.push(d,u,v)}else if("single"===give_stripe_vars.cc_fields_format){var p=t.create("card",{style:n,classes:o,hidePostalCode:!!give_stripe_vars.checkout_address});i.push(p)}return i}function l(e,t){e.find('input[name="give_stripe_source"]').val(t.id),e.get(0).submit()}function c(e,t){var i={type:"card",owner:{}},a=e.find('input[name="give-form-id"]').val(),s=e.find("[id^=give-purchase-button]"),c=e.find(".card-name").val();if(e.find("[id^=give-purchase-button]").attr("disabled","disabled"),"multi"===give_stripe_vars.cc_fields_format&&""!==c&&(i.owner.name=c),give_stripe_vars.checkout_address){var n=e.find(".card-address").val(),o=e.find(".card-address-2").val(),d=e.find(".card-city").val(),v=e.find(".card_state").val(),u=e.find(".card-zip").val(),p=e.find(".billing-country").val();i.owner.address={line1:n||"",line2:o||"",city:d||"",state:v||"",postal_code:u||"",country:p||""}}return r.createSource(t,i).then(function(t){if(t.error){var r='

'+t.error.message+"

";s.attr("disabled",!1),jQuery(".give-loading-animation").fadeOut(),e.find("[id^=give-stripe-payment-errors-"+a+"]").html(r),give_global_vars.complete_purchase?s.val(give_global_vars.complete_purchase):s.val(s.data("before-validation-label"))}else l(e,t.source)}),!1}var n={},o=[],d="",v=[],u=[],p=[],f=give_stripe_vars.preferred_locale,_=document.querySelectorAll(".give-form-wrap"),g=Object.entries(give_stripe_vars.element_font_styles),y=!0,m=!1,b=void 0;try{for(var h,A=g[Symbol.iterator]();!(y=(h=A.next()).done);y=!0){var w=h.value;p[w[0]]=w[1]}}catch(e){m=!0,b=e}finally{try{!y&&A.return&&A.return()}finally{if(m)throw b}}Array.prototype.forEach.call(_,function(e){var l=e.querySelector(".give-form"),c=r.elements({locale:f});p.length>0&&(c=r.elements({fonts:p,locale:f})),null!==l.querySelector(".give-gateway:checked").value&&(d=l.querySelector(".give-gateway:checked").value);var n=l.getAttribute("data-id"),_=l.querySelector(".give-submit");o=s(l,c,n),"single"===give_stripe_vars.cc_fields_format?u=["#give-stripe-single-cc-fields-"]:"multi"===give_stripe_vars.cc_fields_format&&(u=["#give-card-number-field-","#give-card-cvc-field-","#give-card-expiration-field-"]),v[n]=[],Array.prototype.forEach.call(u,function(e,t){v[n][t]=[],v[n][t].item=o[t],v[n][t].selector=e,v[n][t].isCardMounted=!1}),jQuery(document).on("give_gateway_loaded",function(e,r,s){a(v[n]),"stripe"===l.querySelector(".give-gateway-option-selected .give-gateway").value&&(_.setAttribute("disabled","disabled"),i(n,v[n]),_.removeAttribute("disabled")),t(n,l)}),"stripe"===d?(_.setAttribute("disabled","disabled"),i(n,v[n]),_.removeAttribute("disabled")):a(o),t(n,l)}),jQuery("body").on("submit",".give-form",function(e){var t=jQuery(this),r=t.find('input[name="give-form-id-prefix"]').val();("stripe"===t.find("input.give-gateway:checked").val()||give_stripe_vars.stripe_card_update)&&(c(t,v[r][0].item),e.preventDefault())})})},function(e,t){}]); //# sourceMappingURL=give-stripe.js.map