(()=>{"use strict";var e=e||{};e.init=function(){var e=$(document).find("input[name=payment_method]").first();e.length&&(e.trigger("click").trigger("change"),e.closest(".list-group-item").find(".payment_collapse_wrap").addClass("show")),$(".stripe-card-wrapper").length>0&&new Card({form:".payment-checkout-form",container:".stripe-card-wrapper",formSelectors:{numberInput:"input#stripe-number",expiryInput:"input#stripe-exp",cvcInput:"input#stripe-cvc",nameInput:"input#stripe-name"}}),$(document).on("change",".js_payment_method",(function(){$(".payment_collapse_wrap").removeClass("collapse").removeClass("show").removeClass("active")})),$(document).off("click",".payment-checkout-btn").on("click",".payment-checkout-btn",(function(e){e.preventDefault();var t=$(this),r=t.closest("form");t.attr("disabled","disabled");var a=t.html();t.html('<i class="fa fa-gear fa-spin"></i> '+t.data("processing-text")),"stripe"===$("input[name=payment_method]:checked").val()?(Stripe.setPublishableKey($("#payment-stripe-key").data("value")),Stripe.card.createToken(r,(function(e,n){n.error?("undefined"!=typeof Botble?Botble.showError(n.error.message,t.data("error-header")):alert(n.error.message),t.removeAttr("disabled"),t.html(a)):(r.append($('<input type="hidden" name="stripeToken">').val(n.id)),r.submit())}))):r.submit()}))},$(document).ready((function(){e.init()}))})();
