(()=>{"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,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var o=arguments.length,s=new Array(o),c=0;c<o;c++)s[c]=arguments[c];return n=this,r=t,i=[].concat(s),r=m(r),d(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,f()?Reflect.construct(r,i||[],m(n).constructor):r.apply(n,i)),"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&&y(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:(v=l(s().mark((function e(t){var n,r,i,a,c,p,l,h,f,m,y,d,v,g,_,b,w;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.billingDetails,(r=t.shippingAddress)&&(i=r.name,a=void 0===i?"":i,c=r.address,p=void 0===c?null:c,l=u(u({},!!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,v=void 0===d?"":d,g=n.address,_=void 0===g?null:g,b=u(u(u(u({},!!f&&{name:f}),!!_&&{billing_address_1:_.line1||"",billing_address_2:_.line2||"",billing_city:_.city||"",billing_state:_.state||"",billing_postcode:_.postal_code||"",billing_country:_.country||""}),(0,o.isEmail)(y)&&{billing_email:y}),(0,o.isPhoneNumber)(v)&&{billing_phone:v}),this.populate_billing_fields(b)),e.prev=3,e.next=6,this.elements.submit();case 6:return e.next=8,this.stripe.createPaymentMethod({elements:this.elements});case 8:if(!(w=e.sent).error){e.next=11;break}return e.abrupt("return",this.submit_error(w.error));case 11:this.on_token_received(w.paymentMethod),e.next=17;break;case 14:return e.prev=14,e.t0=e.catch(3),e.abrupt("return",this.submit_error(e.t0));case 17:case"end":return e.stop()}}),e,this,[[3,14]])}))),function(e){return v.apply(this,arguments)})},{key:"onShippingAddressChange",value:(p=l(s().mark((function e(t){var n,r,i,o,a,c,p,l;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.reject,r=t.resolve,i=t.address,e.prev=1,e.next=4,this.update_shipping_address({shippingAddress:i});case 4:o=e.sent,a=o.newData,c=a.total,p=a.displayItems,l=a.shippingOptions,this.params.total_cents=c.amount,this.params.items=p,this.params.shipping_options=l,this.elements.update({amount:c.amount}),r(u({shippingRates:l},p.reduce((function(e,t){return e+t.amount}),0)===c.amount&&{lineItems:p})),e.next=16;break;case 13:e.prev=13,e.t0=e.catch(1),n();case 16:case"end":return e.stop()}}),e,this,[[1,13]])}))),function(e){return p.apply(this,arguments)})},{key:"onShippingRateChange",value:(c=l(s().mark((function e(t){var n,r,i,o,a,c,p,l;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.reject,r=t.resolve,i=t.shippingRate,e.prev=1,e.next=4,this.update_shipping_method({shippingOption:i});case 4:o=e.sent,a=o.newData,c=a.total,p=a.displayItems,l=a.shippingOptions,this.params.total_cents=c.amount,this.params.items=p,l.length&&(this.params.shipping_options=l),this.elements.update({amount:c.amount}),r(u({shippingRates:this.params.shipping_options},p.reduce((function(e,t){return e+t.amount}),0)===c.amount&&{lineItems:p})),e.next=16;break;case 13:e.prev=13,e.t0=e.catch(1),n();case 16:case"end":return e.stop()}}),e,this,[[1,13]])}))),function(e){return c.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,i.default)(this.elementSelector).find("iframe").length?(this.expressCheckoutElement.unmount(),(0,i.default)(this.elementSelector).length||this.createElementSelectorHTML(),(0,i.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,i.default)(this.elementSelector).hide(),console.log("Error loading expressCheckout Element: ",e)}},{key:"get_element_options",value:function(){var e=u({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,i.default)(this.elementSelector).closest("form")}},{key:"set_nonce",value:function(e){(0,i.default)('[name="stripe_applepay_token_key"]').length||(0,i.default)(this.elementSelector).append('<input type="hidden" name="stripe_applepay_token_key"/>'),(0,i.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:u({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+="&"+i.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(u({elements:this.elements,clientSecret:t.client_secret,redirect:"if_required"},t&&{confirmParams:u(u({},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,i.default)(document.body).one("updated_checkout",e),(0,i.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,i.default)(n).length&&(0,i.default)(n).val(e[t])}}}],r&&h(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,c,p,v}(e)};var r,i=(r=n(428))&&r.__esModule?r:{default:r},o=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(){s=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},c=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",p=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function h(e,t,n,r){var o=t&&t.prototype instanceof _?t:_,a=Object.create(o.prototype),s=new I(r||[]);return i(a,"_invoke",{value:S(e,n,s)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var m="suspendedStart",y="suspendedYield",d="executing",v="completed",g={};function _(){}function b(){}function w(){}var O={};l(O,c,(function(){return this}));var k=Object.getPrototypeOf,E=k&&k(k(M([])));E&&E!==n&&r.call(E,c)&&(O=E);var P=w.prototype=_.prototype=Object.create(O);function x(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function j(e,t){function n(i,o,s,c){var u=f(e[i],e,o);if("throw"!==u.type){var p=u.arg,l=p.value;return l&&"object"==a(l)&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,s,c)}),(function(e){n("throw",e,s,c)})):t.resolve(l).then((function(e){p.value=e,s(p)}),(function(e){return n("throw",e,s,c)}))}c(u.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function S(t,n,r){var i=m;return function(o,a){if(i===d)throw Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var c=C(s,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===m)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=d;var u=f(t,n,r);if("normal"===u.type){if(i=r.done?v:y,u.arg===g)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(i=v,r.method="throw",r.arg=u.arg)}}}function C(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function R(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[c];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(a(t)+" is not iterable")}return b.prototype=w,i(P,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:b,configurable:!0}),b.displayName=l(w,p,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,l(e,p,"GeneratorFunction")),e.prototype=Object.create(P),e},t.awrap=function(e){return{__await:e}},x(j.prototype),l(j.prototype,u,(function(){return this})),t.AsyncIterator=j,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new j(h(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(P),l(P,p,"Generator"),l(P,c,(function(){return this})),l(P,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=M,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(R),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),R(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;R(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function c(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 u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){d(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function l(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){p(o,r,i,a,s,"next",e)}function s(e){p(o,r,i,a,s,"throw",e)}a(void 0)}))}}function h(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,v(r.key),r)}}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(f=function(){return!!e})()}function m(e){return m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},m(e)}function y(e,t){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},y(e,t)}function d(e,t,n){return(t=v(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(e){var t=function(e,t){if("object"!=a(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=a(r))return r;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 i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}(()=>{var e=n(705),t=i(n(428)),r=i(n(907));function i(e){return e&&e.__esModule?e:{default:e}}function o(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 a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){var r,i,o;r=e,i=t,o=n[t],(i=u(i))in r?Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[i]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e){return s="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},s(e)}function c(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,u(r.key),r)}}function u(e){var t=function(e,t){if("object"!=s(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==s(t)?t:t+""}function p(e,t,n){return t=h(t),function(e,t){if(t&&("object"===s(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,l()?Reflect.construct(t,n||[],h(e).constructor):t.apply(e,n))}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(l=function(){return!!e})()}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}function m(t){this.type="applePay",this.elementSelector="a.wc-stripe-applepay-mini-cart",e.BaseGateway.call(this,t)}m.prototype=Object.assign(m.prototype,e.BaseGateway.prototype,e.CartGateway.prototype);var y=function(e){function n(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),p(this,n,[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&&f(e,t)}(n,e),r=n,(i=[{key:"initialize",value:function(){this.modalOpen=!1,this.createExpressElement(),this.mountPaymentElement(),window.addEventListener("hashchange",this.onHashChange.bind(this)),(0,t.default)(document.body).on("wc_fragments_refreshed wc_fragments_loaded",this.onFragmentsRefreshed.bind(this))}},{key:"onReady",value:function(e){var n=(e.availablePaymentMethods||{}).applePay,r=void 0!==n&&n;this.isEligible=r,this.isEligible?(0,t.default)(this.elementSelector).show():(0,t.default)(this.elementSelector).hide()}},{key:"set_selected_shipping_methods",value:function(e){this.fields.set("shipping_method",e)}},{key:"onFragmentsRefreshed",value:function(){var e=this;setTimeout((function(){var n=(0,t.default)(".woocommerce_"+e.gateway_id+"_gateway_data.cart-page").data("gateway");"object"===s(n)&&(e.params=a(a({},e.params),n)),e.elements=e.create_stripe_elements(),e.createExpressElement(),e.mountPaymentElement()}),350)}},{key:"createElementSelectorHTML",value:function(){(0,t.default)(".woocommerce-mini-cart__buttons").length?(0,t.default)(".woocommerce-mini-cart__buttons").prepend('<a class="wc-stripe-applepay-mini-cart"></a>'):(0,t.default)(".wc-stripe-mini-cart-idx-0").length&&(this.elementSelector=".wc-stripe-mini-cart-idx-0 .wc-stripe-applepay-mini-cart",(0,t.default)(".wc-stripe-mini-cart-idx-0").prepend('<a class="wc-stripe-applepay-mini-cart"></a>'))}},{key:"get_page",value:function(){return"minicart"}}])&&c(r.prototype,i),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,i}((0,r.default)(m));"undefined"!=typeof wc_stripe_applepay_mini_cart_params&&setTimeout((function(){new y(wc_stripe_applepay_mini_cart_params)}),250)})(),(this.wcStripeModules=this.wcStripeModules||{}).applepayMinicart={}})();