')),r.append(o)),e=o.get(0)}return jQuery(e).length?e:null}},{key:"toKey",value:function(t){return Array.isArray(t)?JSON.stringify(t):t}}],r&&vt(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();window.widgetBuilder=window.widgetBuilder||new mt;const gt=window.widgetBuilder;r(3123),r(561);var bt=function(t){var e,r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[(e=n,e.replace(/([-_]\w)/g,(function(t){return t[1].toUpperCase()})))]=t[n]);return r},wt=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:",",n=t.split(r);return n.includes(e)||n.push(e),n.join(r)},xt=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:",",n=t.split(r),o=n.indexOf(e);return-1!==o&&n.splice(o,1),n.join(r)};function _t(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return St(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?St(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function St(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r1&&void 0!==arguments[1]&&arguments[1])}(this.gateway.button.wrapper,this.formSelector);this.render(),this.renderer.enableSmartButtons(this.gateway.button.wrapper),ot(this.gateway.button.wrapper),this.handleButtonStatus()}},{key:"handleButtonStatus",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];y.handleButtonStatus(this,{formSelector:this.formSelector}),t&&this.simulateCartThrottled()}},{key:"init",value:function(){var t=this,e=this.form();if(e){jQuery(document).on("change",this.formSelector,(function(){t.handleChange()})),this.mutationObserver.observe(e,{childList:!0,subtree:!0});var r=e.querySelector(".single_add_to_cart_button");r&&new MutationObserver(this.handleButtonStatus.bind(this)).observe(r,{attributes:!0}),jQuery(document).on("ppcp_should_show_messages",(function(e,r){t.shouldRender()||(r.result=!1)})),this.shouldRender()&&(this.render(),this.handleChange())}}},{key:"shouldRender",value:function(){return null!==this.form()&&!this.isWcsattSubscriptionMode()}},{key:"shouldEnable",value:function(){var t=this.form(),e=t?t.querySelector(".single_add_to_cart_button"):null;return y.shouldEnable(this)&&!this.priceAmountIsZero()&&(null===e||!e.classList.contains("disabled"))}},{key:"priceAmount",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=[function(){var t;return null===(t=document.querySelector("form.cart ins .woocommerce-Price-amount"))||void 0===t?void 0:t.innerText},function(){var t;return null===(t=document.querySelector("form.cart .woocommerce-Price-amount"))||void 0===t?void 0:t.innerText},function(){var t=document.querySelector(".product .woocommerce-Price-amount");return t&&1===Array.from(t.parentElement.querySelectorAll(".woocommerce-Price-amount")).filter((function(t){return!t.parentElement.classList.contains("woocommerce-price-suffix")})).length?t.innerText:null}].map((function(t){return t()})).find((function(t){return t}));return void 0===e?t:e?parseFloat(e.replace(/,/g,".").replace(/([^\d,\.\s]*)/g,"")):0}},{key:"priceAmountIsZero",value:function(){var t=this.priceAmount(-1);return-1!==t&&(!t||0===t)}},{key:"isWcsattSubscriptionMode",value:function(){return null!==document.querySelector('.wcsatt-options-product:not(.wcsatt-options-product--hidden) .subscription-option input[type="radio"]:checked')||null!==document.querySelector('.wcsatt-options-prompt-label-subscription input[type="radio"]:checked')}},{key:"variations",value:function(){var t,e;return this.hasVariations()?(e=null===(t=document.querySelector("form.cart"))||void 0===t?void 0:t.querySelectorAll("[name^='attribute_']"),function(t){if(Array.isArray(t))return Ct(t)}(e)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||kt(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map((function(t){return{value:t.value,name:t.name}})):null}},{key:"hasVariations",value:function(){var t;return null===(t=document.querySelector("form.cart"))||void 0===t?void 0:t.classList.contains("variations_form")}},{key:"render",value:function(){var t=new K(this.gateway,new O(this.gateway.ajax.change_cart.endpoint,this.gateway.ajax.change_cart.nonce),this.form(),this.errorHandler);if(PayPalCommerceGateway.data_client_id.has_subscriptions&&PayPalCommerceGateway.data_client_id.paypal_subscriptions_enabled){document.getElementById("ppc-button-ppcp-gateway").innerHTML="";var e=null!==this.variations()?function(t){var e="";return PayPalCommerceGateway.variable_paypal_subscription_variations.forEach((function(r){var n={};t.forEach((function(t){var e=t.name,r=t.value;Object.assign(n,function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}({},e.replace("attribute_",""),r))})),JSON.stringify(n)===JSON.stringify(r.attributes)&&""!==r.subscription_plan&&(e=r.subscription_plan)})),e}(this.variations()):PayPalCommerceGateway.subscription_plan_id;if(!e)return;if(this.subscriptionButtonsLoaded)return;return function(t,e,r){at(t).then((function(t){t.Buttons(e).render(r)}))}({clientId:PayPalCommerceGateway.client_id,currency:PayPalCommerceGateway.currency,intent:"subscription",vault:!0},t.subscriptionsConfiguration(e),this.gateway.button.wrapper),void(this.subscriptionButtonsLoaded=!0)}this.renderer.render(t.configuration())}},{key:"simulateCart",value:function(){var t=this;if(this.gateway.simulate_cart.enabled){var e=new K(null,null,this.form(),this.errorHandler),r=PayPalCommerceGateway.data_client_id.has_subscriptions&&PayPalCommerceGateway.data_client_id.paypal_subscriptions_enabled?e.getSubscriptionProducts():e.getProducts();new Pt(this.gateway.ajax.simulate_cart.endpoint,this.gateway.ajax.simulate_cart.nonce).simulate((function(e){jQuery(document.body).trigger("ppcp_product_total_updated",[e.total]);var r,n,o={};if("boolean"==typeof e.button.is_disabled&&(o=d()(o,{button:{is_disabled:e.button.is_disabled}})),"boolean"==typeof e.messages.is_hidden&&(o=d()(o,{messages:{is_hidden:e.messages.is_hidden}})),o&&y.updateScriptData(t,o),"1"===t.gateway.single_product_buttons_enabled){for(var i=t.gateway.url_params["enable-funding"],a=t.gateway.url_params["disable-funding"],c=0,u=Object.entries(e.funding);c>>0)+"_",o=0;return function t(n){if(this instanceof t)throw new TypeError("Symbol is not a constructor");return new e(r+(n||"")+"_"+o++,n)}})),i("Symbol.iterator",(function(t){if(t)return t;t=Symbol("Symbol.iterator");for(var r="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),i=0;i0&&void 0!==arguments[0]?arguments[0]:"form.woocommerce-checkout";Bt(this,t),this.target=e}var e,r;return e=t,(r=[{key:"setTarget",value:function(t){this.target=t}},{key:"block",value:function(){jQuery(this.target).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}},{key:"unblock",value:function(){jQuery(this.target).unblock()}}])&&Nt(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Gt(t){return Gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gt(t)}function Mt(){Mt=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new S(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=w(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function f(){}function p(){}function d(){}var h={};c(h,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(j([])));v&&v!==e&&r.call(v,o)&&(h=v);var m=d.prototype=f.prototype=Object.create(h);function g(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==Gt(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function j(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function Dt(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function Ht(t,e){for(var r=0;r=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function Jt(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}const Yt=function(t){return new Promise(function(){var e,r=(e=$t().mark((function e(r,n){var o,i,a,c;return $t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,o=new qt,i=new Wt(t.labels.error.generic,document.querySelector(".woocommerce-notices-wrapper")),a="checkout"===t.context?"form.checkout":"form#order_review",c=t.early_checkout_validation_enabled?new Qt(t.ajax.validate_checkout.endpoint,t.ajax.validate_checkout.nonce):null){e.next=8;break}return r(),e.abrupt("return");case 8:c.validate(document.querySelector(a)).then((function(t){t.length>0?(o.unblock(),i.clear(),i.messages(t),jQuery(document.body).trigger("checkout_error",[i.currentHtml()]),n()):r()})),e.next=15;break;case 11:e.prev=11,e.t0=e.catch(0),console.error(e.t0),n();case 15:case"end":return e.stop()}}),e,null,[[0,11]])})),function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(t){Jt(i,n,o,a,c,"next",t)}function c(t){Jt(i,n,o,a,c,"throw",t)}a(void 0)}))});return function(t,e){return r.apply(this,arguments)}}())};function Kt(t){return Kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kt(t)}function Xt(){Xt=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new S(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=w(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function f(){}function p(){}function d(){}var h={};c(h,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(j([])));v&&v!==e&&r.call(v,o)&&(h=v);var m=d.prototype=f.prototype=Object.create(h);function g(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==Kt(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function j(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function Zt(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function te(t,e){for(var r=0;r0?s.messages(t.data.errors):(null===(o=t.data.details)||void 0===o?void 0:o.length)>0?s.message(t.data.details.map((function(t){return"".concat(t.issue," ").concat(t.description)})).join("
")):s.message(t.data.message),jQuery(document.body).trigger("checkout_error",[s.currentHtml()])}throw{type:"create-order-error",data:t.data}}var i=document.createElement("input");return i.setAttribute("type","hidden"),i.setAttribute("name","ppcp-resume-order"),i.setAttribute("value",t.data.custom_id),document.querySelector(l).appendChild(i),t.data.id}))},onApprove:Ft(this,this.errorHandler,this.spinner),onCancel:function(){r.unblock()},onError:function(e){console.error(e),r.unblock(),e&&"create-order-error"===e.type||t.errorHandler.genericError()}}}}],n&&te(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),t}();function re(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],a=!0,c=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(t){c=!0,o=t}finally{try{a||null==r.return||r.return()}finally{if(c)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return ne(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ne(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ne(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);rdiv")&&document.querySelector(this.gateway.hosted_fields.wrapper+">div").setAttribute("style","");var t=new ee(PayPalCommerceGateway,this.errorHandler,this.spinner);if(PayPalCommerceGateway.data_client_id.has_subscriptions&&PayPalCommerceGateway.data_client_id.paypal_subscriptions_enabled)return this.renderer.render(t.subscriptionsConfiguration(),{},t.configuration()),void(PayPalCommerceGateway.subscription_product_allowed||(this.gateway.button.is_disabled=!0,this.handleButtonStatus()));this.renderer.render(t.configuration(),{},t.configuration())}}},{key:"updateUi",value:function(){var t,e=i(),r=e===n.PAYPAL,o=e===n.CARDS,a=[n.CARD_BUTTON].includes(e),c=o&&(t=document.querySelector("#saved-credit-card"))&&""!==t.value,u=!r&&!o&&!a,s=PayPalCommerceGateway.is_free_trial_cart,l=""!==PayPalCommerceGateway.vaulted_paypal_email,f=ie({},Object.entries(PayPalCommerceGateway.separate_buttons).reduce((function(t,e){var r=re(e,2),n=(r[0],r[1]);return ie(ie({},t),{},ae({},n.id,n.wrapper))}),{}));nt(this.standardOrderButtonSelector,r&&s&&l||u||c,"ppcp-hidden"),rt(".ppcp-vaulted-paypal-details",r),rt(this.gateway.button.wrapper,r&&!(s&&l)),rt(this.gateway.hosted_fields.wrapper,o&&!c);for(var p=0,d=Object.entries(f);p=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function je(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],a=!0,c=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(t){c=!0,o=t}finally{try{a||null==r.return||r.return()}finally{if(c)throw o}}return i}}(t,e)||Oe(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Oe(t,e){if(t){if("string"==typeof t)return Ee(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ee(t,e):void 0}}function Ee(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},n=d()(this.defaultSettings,e),o=Object.fromEntries(Object.entries(n.separate_buttons).filter((function(t){var e=je(t,2),r=(e[0],e[1]);return document.querySelector(r.wrapper)}))),i=0!==Object.keys(o).length;if(i){var a,c=Se(paypal.getFundingSources().filter((function(t){return!(t in o)})));try{for(c.s();!(a=c.n()).done;){var u=a.value,s=be(n.button.style,u);this.renderButtons(n.button.wrapper,s,t,i,u)}}catch(t){c.e(t)}finally{c.f()}}else this.renderButtons(n.button.wrapper,n.button.style,t,i);this.creditCardRenderer&&this.creditCardRenderer.render(n.hosted_fields.wrapper,r);for(var l=0,f=Object.entries(o);l4&&void 0!==arguments[4]?arguments[4]:null;if(document.querySelector(t)&&!this.isAlreadyRendered(t,i,n)){i&&(r.fundingSource=i);var a=function(){return xe(xe({style:e},r),{},{onClick:o.onSmartButtonClick,onInit:function(e,r){o.onSmartButtonsInit&&o.onSmartButtonsInit(e,r),o.handleOnButtonsInit(t,e,r)}})};jQuery(document).off(this.reloadEventName,t).on(this.reloadEventName,t,(function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;if(!i||!n||n===i){var c=d()(o.defaultSettings,r),u=bt(c.url_params);at(u=d()(u,c.script_attributes)).then((function(e){gt.setPaypal(e),gt.registerButtons([t,i],a()),gt.renderAll()}))}})),this.renderedSources.add(t+(null!=i?i:"")),"undefined"!=typeof paypal&&void 0!==paypal.Buttons&&(gt.registerButtons([t,i],a()),gt.renderButtons([t,i]))}else gt.renderButtons([t,i])}},{key:"isAlreadyRendered",value:function(t,e){return this.renderedSources.has(t+(null!=e?e:""))}},{key:"disableCreditCardFields",value:function(){this.creditCardRenderer.disableFields()}},{key:"enableCreditCardFields",value:function(){this.creditCardRenderer.enableFields()}},{key:"onButtonsInit",value:function(t,e,r){this.onButtonsInitListeners[t]=r?[]:this.onButtonsInitListeners[t]||[],this.onButtonsInitListeners[t].push(e)}},{key:"handleOnButtonsInit",value:function(t,e,r){if(this.buttonsOptions[t]={data:e,actions:r},this.onButtonsInitListeners[t]){var n,o=Se(this.onButtonsInitListeners[t]);try{for(o.s();!(n=o.n()).done;){var i=n.value;"function"==typeof i&&i(xe({wrapper:t},this.buttonsOptions[t]))}}catch(t){o.e(t)}finally{o.f()}}}},{key:"disableSmartButtons",value:function(t){if(this.buttonsOptions[t])try{this.buttonsOptions[t].actions.disable()}catch(t){console.log("Failed to disable buttons: "+t)}}},{key:"enableSmartButtons",value:function(t){if(this.buttonsOptions[t])try{this.buttonsOptions[t].actions.enable()}catch(t){console.log("Failed to enable buttons: "+t)}}}],r&&Pe(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();r(2479);const Ce=function(t){var e=window.getComputedStyle(t),r=document.createElement("span");return r.setAttribute("id",t.id),r.setAttribute("class",t.className),Object.values(e).forEach((function(t){e[t]&&isNaN(t)&&"background-image"!==t&&r.style.setProperty(t,""+e[t])})),r};function Ae(t,e){for(var r=0;r")):null!==(o=t.details)&&void 0!==o&&o.length?e.errorHandler.message(t.details.map((function(t){return"".concat(t.issue," ").concat(t.description)})).join("
")):(null===(i=t.data)||void 0===i||null===(a=i.errors)||void 0===a?void 0:a.length)>0?e.errorHandler.messages(t.data.errors):null!==(c=t.data)&&void 0!==c&&c.message?e.errorHandler.message(t.data.message):t.message?e.errorHandler.message(t.message):e.errorHandler.genericError()}))}else{this.spinner.unblock();var u=this.defaultConfig.labels.error.generic;this.emptyFields.size>0?u=this.defaultConfig.hosted_fields.labels.fields_empty:this.cardValid?this.formValid||(u=this.defaultConfig.hosted_fields.labels.fields_not_valid):u=this.defaultConfig.hosted_fields.labels.card_not_supported,this.errorHandler.message(u)}}},{key:"_cardNumberFiledCLassNameByCardType",value:function(t){return"american-express"===t?"amex":t.replace("-","")}},{key:"_recreateElementClassAttribute",value:function(t,e){t.removeAttribute("class"),t.setAttribute("class",e)}}])&&Ae(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();var Te=function(t){var e=["appearance","color","direction","font","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-weight","letter-spacing","line-height","opacity","outline","padding","padding-bottom","padding-left","padding-right","padding-top","text-shadow","transition","-moz-appearance","-moz-osx-font-smoothing","-moz-tap-highlight-color","-moz-transition","-webkit-appearance","-webkit-osx-font-smoothing","-webkit-tap-highlight-color","-webkit-transition"],r=window.getComputedStyle(t),n={};return Object.values(r).forEach((function(t){r[t]&&e.includes(t)&&(n[t]=""+r[t])})),n};function Ie(t,e){for(var r=0;r=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function Me(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function De(t,e){for(var r=0;r0)){t.next=20;break}return this.spinner.unblock(),this.errorHandler.messages(e),jQuery(document.body).trigger("checkout_error",[this.errorHandler.currentHtml()]),t.abrupt("return");case 20:t.next=25;break;case 22:t.prev=22,t.t1=t.catch(11),console.error(t.t1);case 25:return t.next=27,fetch(this.config.ajax.vault_paypal.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:this.config.ajax.vault_paypal.nonce,return_url:location.href})});case 27:return r=t.sent,t.next=30,r.json();case 30:if((n=t.sent).success){t.next=33;break}throw Error(n.data.message);case 33:location.href=n.data.approve_link,t.next=41;break;case 36:t.prev=36,t.t2=t.catch(9),this.spinner.unblock(),console.error(t.t2),this.errorHandler.message(data.data.message);case 41:case"end":return t.stop()}}),t,this,[[1,6],[9,36],[11,22]])})),o=function(){var t=this,e=arguments;return new Promise((function(r,o){var i=n.apply(t,e);function a(t){Me(i,r,o,a,c,"next",t)}function c(t){Me(i,r,o,a,c,"throw",t)}a(void 0)}))},function(){return o.apply(this,arguments)})}],r&&De(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Qe(t){return Qe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qe(t)}function Ue(){Ue=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new S(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=w(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function f(){}function p(){}function d(){}var h={};c(h,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(j([])));v&&v!==e&&r.call(v,o)&&(h=v);var m=d.prototype=f.prototype=Object.create(h);function g(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==Qe(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function j(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function Ve(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function We(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}(this.contextBootstrapWatchers);try{for(n.s();!(r=n.n()).done;)(0,r.value)(this.contextBootstrapRegistry[t])}catch(t){n.e(t)}finally{n.f()}}}])&&Je(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();window.ppcpResources=window.ppcpResources||{};const Ke=window.ppcpResources.ButtonModuleWatcher=window.ppcpResources.ButtonModuleWatcher||new Ye;function Xe(t,e){for(var r=0;r=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function er(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=500?n.addClass("ppcp-width-500"):o>=300?n.addClass("ppcp-width-300"):n.addClass("ppcp-width-min");var i=n.children(":visible").first();n.find(e.selectorInContainer).each((function(t,e){var r=jQuery(e);if(r.is(i))return r.css("margin-top","0px"),!0;var n=r.height(),o=Math.max(11,Math.round(.3*n));r.css("margin-top","".concat(o,"px"))}))};for(r.s();!(t=r.n()).done;)n()}catch(t){r.e(t)}finally{r.f()}}}])&&rr(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function or(t,e){if(t){if("string"==typeof t)return ir(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ir(t,e):void 0}}function ir(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function ur(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}var sr=new qt(document.querySelector(".ppc-button-wrapper")),lr=new qt("#ppcp-hosted-fields");document.addEventListener("DOMContentLoaded",(function(){if("undefined"==typeof PayPalCommerceGateway||ar(PayPalCommerceGateway)){if("checkout"===PayPalCommerceGateway.context||0!==PayPalCommerceGateway.data_client_id.user||!PayPalCommerceGateway.data_client_id.has_subscriptions){var t=[n.PAYPAL].concat(function(t){if(Array.isArray(t))return ir(t)}(c=Object.entries(PayPalCommerceGateway.separate_buttons).map((function(t){var e,r,n=(r=2,function(t){if(Array.isArray(t))return t}(e=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],a=!0,c=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(t){c=!0,o=t}finally{try{a||null==r.return||r.return()}finally{if(c)throw o}}return i}}(e,r)||or(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());return n[0],n[1].id})))||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(c)||or(c)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),e=function(){if(!(!["checkout","pay-now"].includes(PayPalCommerceGateway.context)||Ot()||PayPalCommerceGateway.is_free_trial_cart&&""!==PayPalCommerceGateway.vaulted_paypal_email)){var e=i(),r=t.includes(e),a=e===n.CARDS;nt(o,!r&&!a,"ppcp-hidden"),r?sr.block():sr.unblock(),a?lr.block():lr.unblock()}};jQuery(document).on("hosted_fields_loaded",(function(){lr.unblock()}));var r=!1,a=!1;e(),jQuery(document.body).on("updated_checkout payment_method_selected",(function(){r||a||e()})),function(t,e){var r,n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if("undefined"==typeof paypal){if(jt.onLoadedCallbacks.push(e),o&&jt.onErrorCallbacks.push(o),!jt.isLoading){jt.isLoading=!0;var i=function(){jt.isLoading=!1,jt.onLoadedCallbacks=[],jt.onErrorCallbacks=[]},a=function(t){gt.setPaypal(t);var e,r=_t(jt.onLoadedCallbacks);try{for(r.s();!(e=r.n()).done;)(0,e.value)()}catch(t){r.e(t)}finally{r.f()}i()},c=function(t){var e,r=_t(jt.onErrorCallbacks);try{for(r.s();!(e=r.n()).done;)(0,e.value)(t)}catch(t){r.e(t)}finally{r.f()}i()},u=bt(t.url_params);if(t.script_attributes&&(u=d()(u,t.script_attributes)),null!==(r=t.data_client_id)&&void 0!==r&&r.set_attribute)ft(u,t.data_client_id,a,c);else{var s=null==t||null===(n=t.save_payment_methods)||void 0===n?void 0:n.id_token;s&&(u["data-user-id-token"]=s),at(u).then(a).catch(c)}}}else e()}(PayPalCommerceGateway,(function(){r=!0,function(){var t,e="form.woocommerce-checkout",r=PayPalCommerceGateway.context,o=new Wt(PayPalCommerceGateway.labels.error.generic,null!==(t=document.querySelector(e))&&void 0!==t?t:document.querySelector(".woocommerce-notices-wrapper")),a=new qt,c=new ze(PayPalCommerceGateway.ajax.save_checkout_form.endpoint,PayPalCommerceGateway.ajax.save_checkout_form.nonce),u=PayPalCommerceGateway.early_checkout_validation_enabled?new Qt(PayPalCommerceGateway.ajax.validate_checkout.endpoint,PayPalCommerceGateway.ajax.validate_checkout.nonce):null,s=new He(PayPalCommerceGateway,e,c,u,a,o);jQuery("form.woocommerce-checkout input").on("keydown",(function(t){"Enter"===t.key&&[n.PAYPAL,n.CARDS,n.CARD_BUTTON].includes(i())&&t.preventDefault()}));var l=function(){if(PayPalCommerceGateway.basic_checkout_validation_enabled){var t=Array.from(jQuery("form.woocommerce-checkout .validate-required.woocommerce-invalid:visible"));if(t.length){var e=document.querySelector(".woocommerce-billing-fields"),r=document.querySelector(".woocommerce-shipping-fields"),n=PayPalCommerceGateway.labels.error.required.elements,i=t.map((function(t){var o,i=null===(o=t.querySelector("[name]"))||void 0===o?void 0:o.getAttribute("name");if(i&&i in n)return n[i];var a=t.querySelector("label").textContent.replaceAll("*","").trim();return null!=e&&e.contains(t)&&(a=PayPalCommerceGateway.labels.billing_field.replace("%s",a)),null!=r&&r.contains(t)&&(a=PayPalCommerceGateway.labels.shipping_field.replace("%s",a)),PayPalCommerceGateway.labels.error.required.field.replace("%s","".concat(a,""))})).filter((function(t){return t.length>2}));return o.clear(),i.length?o.messages(i):o.message(PayPalCommerceGateway.labels.error.required.generic),!1}}return!0},f=function(){var t,n=(t=cr().mark((function t(n,o){var i;return cr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(window.ppcpFundingSource=n.fundingSource,jQuery("form.woocommerce-checkout .validate-required:visible :input").each((function(t,e){jQuery(e).trigger("validate")})),l()){t.next=5;break}return t.abrupt("return",o.reject());case 5:if((i=document.querySelector(e))&&(jQuery("#ppcp-funding-source-form-input").remove(),i.insertAdjacentHTML("beforeend",''))),!PayPalCommerceGateway.is_free_trial_cart||"card"===n.fundingSource||PayPalCommerceGateway.subscription_plan_id){t.next=11;break}return s.handle(),t.abrupt("return",o.reject());case 11:if("checkout"!==r){t.next=20;break}return t.prev=12,t.next=15,c.save(i);case 15:t.next=20;break;case 17:t.prev=17,t.t0=t.catch(12),console.error(t.t0);case 20:case"end":return t.stop()}}),t,null,[[12,17]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){ur(i,n,o,a,c,"next",t)}function c(t){ur(i,n,o,a,c,"throw",t)}a(void 0)}))});return function(t,e){return n.apply(this,arguments)}}(),p=new Le(PayPalCommerceGateway,o,a);void 0!==paypal.CardFields&&(p=new Re(PayPalCommerceGateway,o,a,(function(){return l()})));var d=new ke(p,PayPalCommerceGateway,f,(function(){jQuery(document).trigger("ppcp-smart-buttons-init",void 0),sr.unblock()})),h=new Ne(PayPalCommerceGateway.messages);if("1"===PayPalCommerceGateway.mini_cart_buttons_enabled){var y=new m(PayPalCommerceGateway,d,o);y.init(),Ke.registerContextBootstrap("mini-cart",y)}if("product"===r&&("1"===PayPalCommerceGateway.single_product_buttons_enabled||!1===PayPalCommerceGateway.messages.is_hidden&&document.querySelector(PayPalCommerceGateway.messages.wrapper))){var v=new Tt(PayPalCommerceGateway,d,o);v.init(),Ke.registerContextBootstrap("product",v)}if("cart"===r){var g=new Rt(PayPalCommerceGateway,d,o);g.init(),Ke.registerContextBootstrap("cart",g)}if("checkout"===r){var b=new ue(PayPalCommerceGateway,d,a,o);b.init(),Ke.registerContextBootstrap("checkout",b)}if("pay-now"===r){var w=new ve(PayPalCommerceGateway,d,a,o);w.init(),Ke.registerContextBootstrap("pay-now",w)}new Ze(PayPalCommerceGateway,h).init(),function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".ppcp-button-apm",r=e;if(!window.ppcpApmButtons){if(t&&t.button){var n=t.button.wrapper;jQuery(n).children('div[class^="item-"]').length>0&&(e+=", ".concat(n,' div[class^="item-"]'),r+=', div[class^="item-"]')}window.ppcpApmButtons=new nr(e,r)}}(PayPalCommerceGateway)}()}),(function(){a=!0,nt(o,!0,"ppcp-hidden"),sr.unblock(),lr.unblock()}))}}else console.error("PayPal button could not be configured.");var c}))})()})()