!function(e,a){e(document.body).is(".single-product")&&((t=function(){a.BaseGateway.call(this,wc_stripe_payment_request_params),window.addEventListener("hashchange",this.hashchange.bind(this)),this.old_qty=this.get_quantity()}).prototype=e.extend({},a.BaseGateway.prototype,a.ProductGateway.prototype,a.PaymentRequest.prototype),t.prototype.initialize=function(){if(!e(this.container).length)return setTimeout(this.initialize.bind(this),1e3);a.ProductGateway.call(this),a.PaymentRequest.prototype.initialize.call(this)},t.prototype.canMakePayment=function(){a.PaymentRequest.prototype.canMakePayment.apply(this,arguments).then(function(){e(document.body).on("change",'[name="quantity"]',this.maybe_calculate_cart.bind(this)),e(this.container).parent().parent().addClass("active"),this.is_variable_product()?this.variable_product_selected()?(this.cart_calculation(),e(this.container).removeClass("processingFoundVariation")):this.disable_payment_button():this.cart_calculation()}.bind(this))},t.prototype.maybe_calculate_cart=function(t){this.disable_payment_button(),this.old_qty=this.get_quantity();this.get_product_data().variation;this.is_variable_product()&&!this.variable_product_selected()||this.cart_calculation().then(function(){this.is_variable_product()?(this.createPaymentRequest(),this.createPaymentRequestButton(),a.PaymentRequest.prototype.canMakePayment.apply(this,arguments).then(function(){this.enable_payment_button()}.bind(this))):this.enable_payment_button()}.bind(this))},t.prototype.cart_calculation=function(){return a.ProductGateway.prototype.cart_calculation.apply(this,arguments).then(function(t){this.update_from_cart_calculation(t),this.payment_request_options.requestShipping!==t.needsShipping?a.PaymentRequest.prototype.initialize.call(this):this.paymentRequest.update(this.get_payment_request_update({total:{pending:!1}}))}.bind(this))["catch"](function(){}.bind(this))},t.prototype.create_button=function(){e("#wc-stripe-payment-request-container").empty(),a.PaymentRequest.prototype.create_button.apply(this,arguments),this.$button=e("#wc-stripe-payment-request-container")},t.prototype.button_click=function(t){this.$button.is(".disabled")?t.preventDefault():0==this.get_quantity()?(t.preventDefault(),this.submit_error(this.params.messages.invalid_amount)):this.needs_shipping()||this.add_to_cart()},t.prototype.found_variation=function(){a.ProductGateway.prototype.found_variation.apply(this,arguments),this.can_pay&&this.maybe_calculate_cart()},t.prototype.block=function(){e.blockUI({message:this.adding_to_cart?this.params.messages.add_to_cart:null,overlayCSS:{background:"#fff",opacity:.6}})}),e(document.body).is(".woocommerce-cart")&&((t=function(){a.BaseGateway.call(this,wc_stripe_payment_request_params),window.addEventListener("hashchange",this.hashchange.bind(this))}).prototype=e.extend({},a.BaseGateway.prototype,a.CartGateway.prototype,a.PaymentRequest.prototype),t.prototype.initialize=function(){a.CartGateway.call(this),a.PaymentRequest.prototype.initialize.call(this)},t.prototype.canMakePayment=function(){a.PaymentRequest.prototype.canMakePayment.apply(this,arguments).then(function(){e(this.container).addClass("active").parent().addClass("active")}.bind(this))},t.prototype.updated_html=function(){e(this.container).length||(this.can_pay=!1),this.can_pay&&this.initialize()},t.prototype.button_click=function(t){this.paymentRequest.update(this.get_payment_request_update({total:{pending:!1}}))},t.prototype.cart_emptied=function(t){this.can_pay=!1}),e(document.body).is(".woocommerce-checkout")&&((t=function(){a.BaseGateway.call(this,wc_stripe_payment_request_params),window.addEventListener("hashchange",this.hashchange.bind(this))}).prototype=e.extend({},a.BaseGateway.prototype,a.CheckoutGateway.prototype,a.PaymentRequest.prototype),t.prototype.initialize=function(){a.CheckoutGateway.call(this),e("form.checkout").on("change",".form-row:not(.address-field) .input-text",this.update_payment_request.bind(this)),e(this.container).length&&a.PaymentRequest.prototype.initialize.call(this)},t.prototype.canMakePayment=function(){a.PaymentRequest.prototype.canMakePayment.apply(this,arguments).then(function(){var t;this.show_icons(),this.banner_enabled()&&(e(this.banner_container).empty().show().append('<div id="wc-stripe-payment-request-banner"></div>'),e(this.banner_container).show().addClass("active").closest(".wc-stripe-banner-checkout").addClass("active"),(t=this.stripe.elements().create("paymentRequestButton",{paymentRequest:this.paymentRequest,style:{paymentRequestButton:{type:this.params.button.type,theme:this.params.button.theme,height:this.params.button.height}}})).on("click",this.banner_checkout.bind(this)),t.mount("#wc-stripe-payment-request-banner"))}.bind(this))},t.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=e('<div id="wc-stripe-payment-request-container"></div>'),e("#place_order").after(this.$button),a.PaymentRequest.prototype.create_button.call(this),this.trigger_payment_method_selected()},t.prototype.updated_checkout=function(){e(this.container).length&&a.PaymentRequest.prototype.initialize.call(this)},t.prototype.banner_checkout=function(t){this.set_payment_method(this.gateway_id),this.set_use_new_option(!0),e('[name="terms"]').prop("checked",!0)},t.prototype.on_token_received=function(){a.CheckoutGateway.prototype.on_token_received.apply(this,arguments),this.fields.toFormFields(),this.payment_request_options.requestShipping&&this.maybe_set_ship_to_different(),this.checkout_fields_valid()&&this.get_form().trigger("submit")},t.prototype.update_payment_request=function(){e(this.container).length&&a.PaymentRequest.prototype.initialize.call(this)},t.prototype.show_icons=function(){e(this.container).length&&e(this.container).find(".wc-stripe-paymentRequest-icon.gpay").show()});var t=new t;e(document.body).is(".single-product")&&a.product_gateways.push(t)}(jQuery,window.wc_stripe);