(()=>{"use strict";var e={907(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(e){function t(){var e,n,r,o;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,s=new Array(i),u=0;u<i;u++)s[u]=arguments[u];return n=this,r=t,o=[].concat(s),r=y(r),e=function(e,t){if(t&&("object"==a(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(n,m()?Reflect.construct(r,o||[],y(n).constructor):r.apply(n,o)),_(e,"isEligible",!1),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(t,e),n=t,r=[{key:"createExpressElement",value:function(){this.elements&&(this.expressCheckoutElement=this.elements.create("expressCheckout",this.getExpressElementOptions()),this.expressCheckoutElement.on("ready",this.onReady.bind(this)),this.expressCheckoutElement.on("loaderror",this.onLoadError.bind(this)),this.expressCheckoutElement.on("click",this.onClickElement.bind(this)),this.expressCheckoutElement.on("confirm",this.onConfirm.bind(this)),this.expressCheckoutElement.on("cancel",this.onCancel.bind(this)),this.expressCheckoutElement.on("shippingaddresschange",this.onShippingAddressChange.bind(this)),this.expressCheckoutElement.on("shippingratechange",this.onShippingRateChange.bind(this)))}},{key:"onClickElement",value:function(e){var t;this.store_attribution_values();var n={};this.params.items.reduce(function(e,t){return e+t.amount},0)===parseFloat(this.params.total_cents)&&(n.lineItems=this.params.items),null!==(t=this.expressElementOptions)&&void 0!==t&&t.shippingAddressRequired&&this.params.shipping_options.length&&(n.shippingRates=this.params.shipping_options),e.resolve(n),this.modalOpen=!0}},{key:"onReady",value:function(){}},{key:"onConfirm",value:(l=h(s().m(function e(t){var n,r,o,a,u,p,l,h,f,m,y,d,_,b,v,g,w,O;return s().w(function(e){for(;;)switch(e.p=e.n){case 0:return n=t.billingDetails,(r=t.shippingAddress)&&(o=r.name,a=void 0===o?"":o,u=r.address,p=void 0===u?null:u,l=c(c({},!!a&&{name:a}),!!p&&{shipping_address_1:p.line1||"",shipping_address_2:p.line2||"",shipping_city:p.city||"",shipping_state:p.state||"",shipping_postcode:p.postal_code||"",shipping_country:p.country||""}),null!=n&&n.phone&&(l.shipping_phone=n.phone),this.populate_shipping_fields(l)),n&&(h=n.name,f=void 0===h?"":h,m=n.email,y=void 0===m?"":m,d=n.phone,_=void 0===d?"":d,b=n.address,v=void 0===b?null:b,g=c(c(c(c({},!!f&&{name:f}),!!v&&{billing_address_1:v.line1||"",billing_address_2:v.line2||"",billing_city:v.city||"",billing_state:v.state||"",billing_postcode:v.postal_code||"",billing_country:v.country||""}),(0,i.isEmail)(y)&&{billing_email:y}),!!_&&{billing_phone:_}),this.populate_billing_fields(g)),e.p=1,e.n=2,this.elements.submit();case 2:return e.n=3,this.stripe.createPaymentMethod({elements:this.elements});case 3:if(!(w=e.v).error){e.n=4;break}return e.a(2,this.submit_error(w.error));case 4:this.on_token_received(w.paymentMethod),e.n=6;break;case 5:return e.p=5,O=e.v,e.a(2,this.submit_error(O));case 6:return e.a(2)}},e,this,[[1,5]])})),function(e){return l.apply(this,arguments)})},{key:"onShippingAddressChange",value:(p=h(s().m(function e(t){var n,r,o,i,a,u,p,l;return s().w(function(e){for(;;)switch(e.p=e.n){case 0:return n=t.reject,r=t.resolve,o=t.address,e.p=1,e.n=2,this.update_shipping_address({shippingAddress:o});case 2:i=e.v,a=i.newData,u=a.total,p=a.displayItems,l=a.shippingOptions,this.params.total_cents=u.amount,this.params.items=p,this.params.shipping_options=l,this.elements.update({amount:u.amount}),r(c({shippingRates:l},p.reduce(function(e,t){return e+t.amount},0)===u.amount&&{lineItems:p})),e.n=4;break;case 3:e.p=3,e.v,n();case 4:return e.a(2)}},e,this,[[1,3]])})),function(e){return p.apply(this,arguments)})},{key:"onShippingRateChange",value:(u=h(s().m(function e(t){var n,r,o,i,a,u,p,l;return s().w(function(e){for(;;)switch(e.p=e.n){case 0:return n=t.reject,r=t.resolve,o=t.shippingRate,e.p=1,e.n=2,this.update_shipping_method({shippingOption:o});case 2:i=e.v,a=i.newData,u=a.total,p=a.displayItems,l=a.shippingOptions,this.params.total_cents=u.amount,this.params.items=p,l.length&&(this.params.shipping_options=l),this.elements.update({amount:u.amount}),r(c({shippingRates:this.params.shipping_options},p.reduce(function(e,t){return e+t.amount},0)===u.amount&&{lineItems:p})),e.n=4;break;case 3:e.p=3,e.v,n();case 4:return e.a(2)}},e,this,[[1,3]])})),function(e){return u.apply(this,arguments)})},{key:"onCancel",value:function(){this.modalOpen=!1}},{key:"isModalOpen",value:function(){return!!this.modalOpen}},{key:"mountPaymentElement",value:function(){try{this.expressCheckoutElement&&(0===(0,o.default)(this.elementSelector).find("iframe").length?(this.expressCheckoutElement.unmount(),(0,o.default)(this.elementSelector).length||this.createElementSelectorHTML(),(0,o.default)(this.elementSelector).length&&this.expressCheckoutElement.mount(this.elementSelector)):this.onReady({availablePaymentMethods:{applePay:this.isEligible}}))}catch(e){console.log("Error mounting expressCheckoutElement. ",e)}}},{key:"createElementSelectorHTML",value:function(){}},{key:"updatePaymentElement",value:function(){try{this.elements&&this.elements.update(this.get_element_options())}catch(e){console.log("Error updating expressCheckoutElement. ",e)}}},{key:"onLoadError",value:function(e){(0,o.default)(this.elementSelector).hide(),console.log("Error loading expressCheckout Element: ",e)}},{key:"get_element_options",value:function(){var e=c({currency:this.params.currency.toLowerCase(),appearance:{variables:{borderRadius:this.params.button_options.radius}}},this.params.elementOptions);return delete e.paymentMethodTypes,(this.isPaymentMode()||this.isSubscriptionMode())&&(e.amount=parseFloat(this.params.total_cents)>0?parseFloat(this.params.total_cents):100),e}},{key:"get_gateway_data",value:function(){return this.params}},{key:"isPaymentMode",value:function(){return"payment"===this.params.elementOptions.mode}},{key:"isSubscriptionMode",value:function(){return"subscription"===this.params.elementOptions.mode}},{key:"isSetupMode",value:function(){return"setup"===this.params.elementOptions.mode}},{key:"needs_shipping",value:function(){return"1"===this.params.needs_shipping||!0===this.params.needs_shipping}},{key:"get_currency",value:function(){return this.params.currency}},{key:"map_address",value:function(e){return{city:e.city,postcode:e.postal_code,state:e.state,country:e.country}}},{key:"get_form",value:function(){return(0,o.default)(this.elementSelector).closest("form")}},{key:"set_nonce",value:function(e){(0,o.default)('[name="stripe_applepay_token_key"]').length||(0,o.default)(this.elementSelector).append('<input type="hidden" name="stripe_applepay_token_key"/>'),(0,o.default)('[name="stripe_applepay_token_key"]').val(e),this.fields.set(this.gateway_id+"_token_key",e)}},{key:"onHashChange",value:function(e){var t=window.location.hash.match(/response=(.*)/);if(t)try{var n=JSON.parse(window.atob(decodeURIComponent(t[1])));n&&n.hasOwnProperty("client_secret")&&n.gateway_id===this.gateway_id&&this.modalOpen&&(history.pushState({},"",window.location.pathname),"payment_intent"===n.type?this.processPaymentIntent(n):this.processSetupIntent(n))}catch(e){}return!0}},{key:"processPaymentIntent",value:function(e){var t=this;this.stripe.confirmPayment({clientSecret:e.client_secret,redirect:"if_required",confirmParams:c({return_url:e.return_url,payment_method_data:{billing_details:e.billing_details||this.get_billing_details()}},e.confirmation_args&&e.confirmation_args)}).then(function(n){if(n.error)return t.payment_token_received=!1,t.submit_error(n.error);var r=decodeURI(e.return_url);if(r+="&"+o.default.param({_stripe_local_payment:t.gateway_id,payment_intent:n.paymentIntent.id,payment_intent_client_secret:n.paymentIntent.client_secret}),["promptpay","swish","paynow","cashapp"].includes(t.paymentMethodType)){if("requires_action"===n.paymentIntent.status)return t.get_form().unblock().removeClass("processing");if("requires_payment_method"===n.paymentIntent.status)return t.get_form().unblock().removeClass("processing"),t.submit_error({code:n.paymentIntent.last_payment_error.code})}window.location.href=r}).catch(function(e){return t.submit_error(e)})}},{key:"processSetupIntent",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return this.stripe.confirmSetup(c({elements:this.elements,clientSecret:t.client_secret,redirect:"if_required"},t&&{confirmParams:c(c({},t.return_url&&{return_url:t.return_url}),{},{payment_method_data:{billing_details:this.get_billing_details()}},t.confirmParams&&t.confirmParams)})).then(function(t){if(t.error)return e.payment_token_received=!1,e.submit_error(t.error);e.setupIntent=t.setupIntent,e.payment_token_received=!0,e.set_nonce(t.setupIntent.payment_method),e.set_intent(t.setupIntent.id),e.get_form().removeClass("processing"),e.get_form().trigger("submit")}).catch(function(t){return e.submit_error(t)})}},{key:"getExpressElementOptions",value:function(){return this.expressElementOptions={buttonHeight:Math.max(40,Math.min(55,parseInt(this.params.button_options.height))),buttonType:{applePay:this.params.button_options.type},buttonTheme:{applePay:this.params.button_options.theme},paymentMethods:{applePay:"applePay"===this.type?this.params.display_rule:"never",googlePay:"googlePay"===this.type?"always":"never",amazonPay:"amazonPay"===this.type?"auto":"never",paypal:"never",klarna:"klarna"===this.type?"auto":"never",link:"link"===this.type?"auto":"never"},emailRequired:!0,phoneNumberRequired:!0,billingAddressRequired:!0,shippingAddressRequired:this.needs_shipping()},this.expressElementOptions}},{key:"triggerUpdatedCheckout",value:function(){return new Promise(function(e){(0,o.default)(document.body).one("updated_checkout",e),(0,o.default)(document.body).trigger("update_checkout",{update_shipping_method:!1})})}},{key:"populateDomFields",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var t in e){var n="#"+t;(0,o.default)(n).length&&(0,o.default)(n).val(e[t])}}}],r&&f(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,u,p,l}(e)};var r,o=(r=n(428))&&r.__esModule?r:{default:r},i=n(832);function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function s(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var s=r&&r.prototype instanceof p?r:p,c=Object.create(s.prototype);return u(c,"_invoke",function(n,r,o){var i,s,u,p=0,c=o||[],l=!1,h={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,u=e,h.n=n,a}};function f(n,r){for(s=n,u=r,t=0;!l&&p&&!o&&t<c.length;t++){var o,i=c[t],f=h.p,m=i[2];n>3?(o=m===r)&&(u=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,h.v=r,h.n=i[1]):f<m&&(o=n<3||i[0]>r||r>m)&&(i[4]=n,i[5]=r,h.n=m,s=0))}if(o||n>1)return a;throw l=!0,r}return function(o,c,m){if(p>1)throw TypeError("Generator is already running");for(l&&1===c&&f(c,m),s=c,u=m;(t=s<2?e:u)||!l;){i||(s?s<3?(s>1&&(h.n=-1),f(s,u)):h.n=u:h.v=u);try{if(p=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(l=h.n<0)?u:n.call(r,h))!==a)break}catch(t){i=e,s=1,u=t}finally{p=1}}return{value:t,done:l}}}(n,o,i),!0),c}var a={};function p(){}function c(){}function l(){}t=Object.getPrototypeOf;var h=[][r]?t(t([][r]())):(u(t={},r,function(){return this}),t),f=l.prototype=p.prototype=Object.create(h);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,u(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=l,u(f,"constructor",l),u(l,"constructor",c),c.displayName="GeneratorFunction",u(l,o,"GeneratorFunction"),u(f),u(f,o,"Generator"),u(f,r,function(){return this}),u(f,"toString",function(){return"[object Generator]"}),(s=function(){return{w:i,m}})()}function u(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}u=function(e,t,n,r){function i(t,n){u(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},u(e,t,n,r)}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach(function(t){_(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n,r,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,o)}function h(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){l(i,r,o,a,s,"next",e)}function s(e){l(i,r,o,a,s,"throw",e)}a(void 0)})}}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,b(r.key),r)}}function m(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(m=function(){return!!e})()}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}function _(e,t,n){return(t=b(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(e){var t=function(e){if("object"!=a(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}},428(e){e.exports=window.jQuery},705(e){e.exports=window.wc_stripe},832(e){e.exports=window.wp.url}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}var o=n(705),i=u(n(428)),a=n(832),s=u(n(907));function u(e){return e&&e.__esModule?e:{default:e}}function p(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof s?r:s,p=Object.create(u.prototype);return c(p,"_invoke",function(n,r,o){var i,s,u,p=0,c=o||[],l=!1,h={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,u=e,h.n=n,a}};function f(n,r){for(s=n,u=r,t=0;!l&&p&&!o&&t<c.length;t++){var o,i=c[t],f=h.p,m=i[2];n>3?(o=m===r)&&(u=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,h.v=r,h.n=i[1]):f<m&&(o=n<3||i[0]>r||r>m)&&(i[4]=n,i[5]=r,h.n=m,s=0))}if(o||n>1)return a;throw l=!0,r}return function(o,c,m){if(p>1)throw TypeError("Generator is already running");for(l&&1===c&&f(c,m),s=c,u=m;(t=s<2?e:u)||!l;){i||(s?s<3?(s>1&&(h.n=-1),f(s,u)):h.n=u:h.v=u);try{if(p=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(l=h.n<0)?u:n.call(r,h))!==a)break}catch(t){i=e,s=1,u=t}finally{p=1}}return{value:t,done:l}}}(n,o,i),!0),p}var a={};function s(){}function u(){}function l(){}t=Object.getPrototypeOf;var h=[][r]?t(t([][r]())):(c(t={},r,function(){return this}),t),f=l.prototype=s.prototype=Object.create(h);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,c(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=l,c(f,"constructor",l),c(l,"constructor",u),u.displayName="GeneratorFunction",c(l,o,"GeneratorFunction"),c(f),c(f,o,"Generator"),c(f,r,function(){return this}),c(f,"toString",function(){return"[object Generator]"}),(p=function(){return{w:i,m}})()}function c(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}c=function(e,t,n,r){function i(t,n){c(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},c(e,t,n,r)}function l(e,t,n,r,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,o)}function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach(function(t){m(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function m(e,t,n){return(t=d(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,d(r.key),r)}}function d(e){var t=function(e){if("object"!=r(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_=function(){return!!e})()}function b(e,t,n,r){var o=v(g(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof o?function(e){return o.apply(n,e)}:o}function v(){return v="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=g(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},v.apply(null,arguments)}function g(e){return g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},g(e)}function w(e,t){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},w(e,t)}function O(e,t){this.elementSelector=t,o.BaseGateway.call(this,e),this.message_container="li.payment_method_"+this.gateway_id,this.banner_container="li.banner_payment_method_"+this.gateway_id}O.prototype=Object.assign(O.prototype,o.BaseGateway.prototype,o.CheckoutGateway.prototype),new(function(e){function t(e,n){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=function(e,t,n){return t=g(t),function(e,t){if(t&&("object"==r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,_()?Reflect.construct(t,n||[],g(e).constructor):t.apply(e,n))}(this,t,[e,n])).setupIntent=null,o.paymentMethodType=null,o.paymentElementComplete=!1,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&w(e,t)}(t,e),n=t,o=[{key:"initialize",value:function(){this.type="applePay",this.setupEvents(),this.createExpressElement(),this.mountPaymentElement()}},{key:"setupEvents",value:function(){(0,i.default)(document.body).on("updated_checkout",this.onUpdatedCheckout.bind(this)),window.addEventListener("hashchange",this.onHashChange.bind(this))}},{key:"mountPaymentElement",value:function(){(0,i.default)("li.payment_method_"+this.gateway_id).length?b(t,"mountPaymentElement",this,3)([]):this.expressCheckoutElement&&this.expressCheckoutElement.unmount()}},{key:"onReady",value:function(e){var t=(e.availablePaymentMethods||{}).applePay,n=void 0!==t&&t;this.isEligible=n,this.isEligible?((0,i.default)(this.elementSelector).show().addClass("active"),(0,i.default)(".wc-stripe-banner-checkout").addClass("active")):(0,i.default)(this.elementSelector).hide()}},{key:"onClickElement",value:function(e){b(t,"onClickElement",this,3)([e]),(0,i.default)('[name="terms"]').prop("checked",!0),this.set_payment_method(this.gateway_id),this.set_use_new_option(!0)}},{key:"onUpdatedCheckout",value:function(e,t){var n;t&&null!=t&&null!==(n=t.fragments)&&void 0!==n&&n[this.gateway_id]&&(this.params=f(f({},this.params),t.fragments[this.gateway_id]),this.updatePaymentElement()),this.mountPaymentElement()}},{key:"on_token_received",value:(s=p().m(function e(t){return p().w(function(e){for(;;)switch(e.n){case 0:return(0,i.default)('[name="payment_method"]').val(this.gateway_id),this.maybe_set_ship_to_different(),this.fields.toFormFields({update_shipping_method:!1}),e.n=1,this.triggerUpdatedCheckout();case 1:this.payment_token_received=!0,this.set_nonce(t.id),(0,i.default)(document.body).triggerHandler("wc_stripe_applepay_payment_method_received",[t]),this.get_form().trigger("submit");case 2:return e.a(2)}},e,this)}),u=function(){var e=this,t=arguments;return new Promise(function(n,r){var o=s.apply(e,t);function i(e){l(o,n,r,i,a,"next",e)}function a(e){l(o,n,r,i,a,"throw",e)}i(void 0)})},function(e){return u.apply(this,arguments)})},{key:"getExpressElementOptions",value:function(){var e;return this.expressElementOptions=b(t,"getExpressElementOptions",this,3)([]),this.expressElementOptions.emailRequired=!(0,a.isEmail)(null!==(e=(0,i.default)("#billing_email").val())&&void 0!==e?e:""),this.expressElementOptions.phoneNumberRequired=this.fields.required("billing_phone")||this.fields.required("shipping_phone"),this.expressElementOptions}},{key:"populate_shipping_fields",value:function(e){var n=this;b(t,"populate_shipping_fields",this,3)([e]),(0,i.default)(document.body).one("updated_checkout",function(){b(t,"populateDomFields",n,3)([e])})}},{key:"populate_billing_fields",value:function(e){var n=this;b(t,"populate_billing_fields",this,3)([e]),(0,i.default)(document.body).one("updated_checkout",function(){b(t,"populateDomFields",n,3)([e])})}}],o&&y(n.prototype,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,s,u}((0,s.default)(O)))(wc_stripe_applepay_checkout_params,".banner_payment_method_stripe_applepay"),(this.wcStripeModules=this.wcStripeModules||{}).applepayExpressCheckout={}})();