(()=>{"use strict";var t={4744:t=>{var e=function(t){return function(t){return!!t&&"object"==typeof t}(t)&&!function(t){var e=Object.prototype.toString.call(t);return"[object RegExp]"===e||"[object Date]"===e||function(t){return t.$$typeof===n}(t)}(t)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(t,e){return!1!==e.clone&&e.isMergeableObject(t)?u((n=t,Array.isArray(n)?[]:{}),t,e):t;var n}function o(t,e,n){return t.concat(e).map(function(t){return r(t,n)})}function i(t){return Object.keys(t).concat(function(t){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return Object.propertyIsEnumerable.call(t,e)}):[]}(t))}function a(t,e){try{return e in t}catch(t){return!1}}function u(t,n,c){(c=c||{}).arrayMerge=c.arrayMerge||o,c.isMergeableObject=c.isMergeableObject||e,c.cloneUnlessOtherwiseSpecified=r;var l=Array.isArray(n);return l===Array.isArray(t)?l?c.arrayMerge(t,n,c):function(t,e,n){var o={};return n.isMergeableObject(t)&&i(t).forEach(function(e){o[e]=r(t[e],n)}),i(e).forEach(function(i){(function(t,e){return a(t,e)&&!(Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))})(t,i)||(a(t,i)&&n.isMergeableObject(e[i])?o[i]=function(t,e){if(!e.customMerge)return u;var n=e.customMerge(t);return"function"==typeof n?n:u}(i,n)(t[i],e[i],n):o[i]=r(e[i],n))}),o}(t,n,c):r(n,c)}u.all=function(t,e){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(t,n){return u(t,n,e)},{})};var c=u;t.exports=c}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r](i,i.exports,n),i.exports}function r(t,e){void 0===e&&(e={});var n=document.createElement("script");return n.src=t,Object.keys(e).forEach(function(t){n.setAttribute(t,e[t]),"data-csp-nonce"===t&&n.setAttribute("nonce",e["data-csp-nonce"])}),n}function o(t,e){if(void 0===e&&(e=Promise),u(t,e),"undefined"==typeof document)return e.resolve(null);var n=function(t){var e,n,r=t.sdkBaseUrl,o=t.environment,i=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}(t,["sdkBaseUrl","environment"]),a=r||function(t){return"sandbox"===t?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js"}(o),u=i,c=Object.keys(u).filter(function(t){return void 0!==u[t]&&null!==u[t]&&""!==u[t]}).reduce(function(t,e){var n,r=u[e].toString();return n=function(t,e){return(e?"-":"")+t.toLowerCase()},"data"===(e=e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,n)).substring(0,4)||"crossorigin"===e?t.attributes[e]=r:t.queryParams[e]=r,t},{queryParams:{},attributes:{}}),l=c.queryParams,s=c.attributes;return l["merchant-id"]&&-1!==l["merchant-id"].indexOf(",")&&(s["data-merchant-id"]=l["merchant-id"],l["merchant-id"]="*"),{url:"".concat(a,"?").concat((e=l,n="",Object.keys(e).forEach(function(t){0!==n.length&&(n+="&"),n+=t+"="+e[t]}),n)),attributes:s}}(t),o=n.url,c=n.attributes,l=c["data-namespace"]||"paypal",s=a(l);return c["data-js-sdk-library"]||(c["data-js-sdk-library"]="paypal-js"),function(t,e){var n=document.querySelector('script[src="'.concat(t,'"]'));if(null===n)return null;var o=r(t,e),i=n.cloneNode();if(delete i.dataset.uidAuto,Object.keys(i.dataset).length!==Object.keys(o.dataset).length)return null;var a=!0;return Object.keys(i.dataset).forEach(function(t){i.dataset[t]!==o.dataset[t]&&(a=!1)}),a?n:null}(o,c)&&s?e.resolve(s):i({url:o,attributes:c},e).then(function(){var t=a(l);if(t)return t;throw new Error("The window.".concat(l," global variable is not available."))})}function i(t,e){void 0===e&&(e=Promise),u(t,e);var n=t.url,o=t.attributes;if("string"!=typeof n||0===n.length)throw new Error("Invalid url.");if(void 0!==o&&"object"!=typeof o)throw new Error("Expected attributes to be an object.");return new e(function(t,e){if("undefined"==typeof document)return t();var i,a,u,c;a=(i={url:n,attributes:o,onSuccess:function(){return t()},onError:function(){var t=new Error('The script "'.concat(n,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return e(t)}}).onSuccess,u=i.onError,(c=r(i.url,i.attributes)).onerror=u,c.onload=a,document.head.insertBefore(c,document.head.firstElementChild)})}function a(t){return window[t]}function u(t,e){if("object"!=typeof t||null===t)throw new Error("Expected an options object.");var n=t.environment;if(n&&"production"!==n&&"sandbox"!==n)throw new Error('The `environment` option must be either "production" or "sandbox".');if(void 0!==e&&"function"!=typeof e)throw new Error("Expected PromisePonyfill to be a function.")}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),"function"==typeof SuppressedError&&SuppressedError;const c=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;fetch(e.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:e.nonce})}).then(function(t){return t.json()}).then(function(i){var a;(function(t,e){return!(!t||t.user!==e||(new Date).getTime()>=1e3*t.expiration)})(i,e.user)&&(a=i,sessionStorage.setItem("ppcp-data-client-id",JSON.stringify(a)),t["data-client-token"]=i.token,o(t).then(function(t){"function"==typeof n&&n(t)}).catch(function(t){"function"==typeof r&&r(t)}))})};function l(t){return l="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},l(t)}function s(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,l=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||p(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 f(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=p(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}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 o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function p(t,e){if(t){if("string"==typeof t)return y(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(t,e):void 0}}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function d(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,h(r.key),r)}}function h(t){var e=function(t){if("object"!=l(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=l(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==l(e)?e:e+""}var b=function(){return t=function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.paypal=null,this.buttons=new Map,this.messages=new Map,this.renderEventName="ppcp-render",document.ppcpWidgetBuilderStatus=function(){console.log({buttons:e.buttons,messages:e.messages})},jQuery(document).off(this.renderEventName).on(this.renderEventName,function(){e.renderAll()})},(e=[{key:"setPaypal",value:function(t){this.paypal=t,jQuery(document).trigger("ppcp-paypal-loaded",t)}},{key:"registerButtons",value:function(t,e){t=this.sanitizeWrapper(t),this.buttons.set(this.toKey(t),{wrapper:t,options:e})}},{key:"renderButtons",value:function(t){t=this.sanitizeWrapper(t);var e=this.toKey(t);if(this.buttons.has(e)&&!this.hasRendered(t)){var n=this.buttons.get(e),r=this.paypal.Buttons(n.options);if(r.isEligible()){var o=this.buildWrapperTarget(t);o&&(r.hasReturned()?r.resume():r.render(o))}else this.buttons.delete(e)}}},{key:"renderAllButtons",value:function(){var t,e=f(this.buttons);try{for(e.s();!(t=e.n()).done;){var n=s(t.value,1)[0];this.renderButtons(n)}}catch(t){e.e(t)}finally{e.f()}}},{key:"registerMessages",value:function(t,e){this.messages.set(t,{wrapper:t,options:e})}},{key:"renderMessages",value:function(t){var e=this;if(this.messages.has(t)){var n=this.messages.get(t);if(this.hasRendered(t))document.querySelector(t).setAttribute("data-pp-amount",n.options.amount);else{var r=this.paypal.Messages(n.options);r.render(n.wrapper),setTimeout(function(){e.hasRendered(t)||r.render(n.wrapper)},100)}}}},{key:"renderAllMessages",value:function(){var t,e=f(this.messages);try{for(e.s();!(t=e.n()).done;){var n=s(t.value,2),r=n[0];n[1],this.renderMessages(r)}}catch(t){e.e(t)}finally{e.f()}}},{key:"renderAll",value:function(){this.renderAllButtons(),this.renderAllMessages()}},{key:"hasRendered",value:function(t){var e=t;if(Array.isArray(t)){e=t[0];var n,r=f(t.slice(1));try{for(r.s();!(n=r.n()).done;)e+=" .item-"+n.value}catch(t){r.e(t)}finally{r.f()}}var o=document.querySelector(e);return o&&o.hasChildNodes()}},{key:"sanitizeWrapper",value:function(t){return Array.isArray(t)&&1===(t=t.filter(function(t){return!!t})).length&&(t=t[0]),t}},{key:"buildWrapperTarget",value:function(t){var e=t;if(Array.isArray(t)){var n=jQuery(t[0]);if(!n.length)return;var r="item-"+t[1],o=n.find("."+r);o.length||(o=jQuery('<div class="'.concat(r,'"></div>')),n.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}}])&&d(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();window.widgetBuilder=window.widgetBuilder||new b;const v=window.widgetBuilder;var m=n(4744),g=n.n(m),w=function(t){return t.replace(/([-_]\w)/g,function(t){return t[1].toUpperCase()})},S=function(t){var e=function(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[w(n)]=t[n]);return e}(t.url_params);t.script_attributes&&(e=g()(e,t.script_attributes));var n=function(t){var e,n,r=null==t||null===(e=t.save_payment_methods)||void 0===e?void 0:e.id_token;return r&&!0===(null==t||null===(n=t.user)||void 0===n?void 0:n.is_logged)?{"data-user-id-token":r}:{}}(t);return g().all([e,n])};function j(t){return j="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},j(t)}function _(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function O(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?_(Object(n),!0).forEach(function(e){P(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function P(t,e,n){return(e=function(t){var e=function(t){if("object"!=j(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=j(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==j(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function k(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return E(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(E(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,E(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,E(f,"constructor",l),E(l,"constructor",c),c.displayName="GeneratorFunction",E(l,o,"GeneratorFunction"),E(f),E(f,o,"Generator"),E(f,r,function(){return this}),E(f,"toString",function(){return"[object Generator]"}),(k=function(){return{w:i,m:p}})()}function E(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}E=function(t,e,n,r){function i(e,n){E(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},E(t,e,n,r)}function C(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function A(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){C(i,r,o,a,u,"next",t)}function u(t){C(i,r,o,a,u,"throw",t)}a(void 0)})}}var T=new Map,x=new Map,I=function(){var t=A(k().m(function t(e,n){var r;return k().w(function(t){for(;;)switch(t.n){case 0:if(null===(r=n.data_client_id)||void 0===r||!r.set_attribute||!0===n.vault_v3_enabled){t.n=1;break}return t.a(2,new Promise(function(t,r){c(e,n.data_client_id,function(e){v.setPaypal(e),t(e)},r)}));case 1:return t.a(2,null)}},t)}));return function(_x,e){return t.apply(this,arguments)}}(),M=function(){var t=A(k().m(function t(e,n){var r,i,a;return k().w(function(t){for(;;)switch(t.n){case 0:if(e){t.n=1;break}throw new Error("Namespace is required");case 1:if(!T.has(e)){t.n=2;break}return console.log("Script already loaded for namespace: ".concat(e)),t.a(2,T.get(e));case 2:if(!x.has(e)){t.n=3;break}return console.log("Script loading in progress for namespace: ".concat(e)),t.a(2,x.get(e));case 3:return r=O(O({},S(n)),{},{"data-namespace":e}),t.n=4,I(r,n);case 4:if(!(i=t.v)){t.n=5;break}return t.a(2,i);case 5:return a=new Promise(function(t,n){o(r).then(function(n){v.setPaypal(n),T.set(e,n),console.log("Script loaded for namespace: ".concat(e)),t(n)}).catch(function(t){console.error("Failed to load script for namespace: ".concat(e),t),n(t)}).finally(function(){x.delete(e)})}),x.set(e,a),t.a(2,a)}},t)}));return function(e,n){return t.apply(this,arguments)}}();function B(t){return B="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},B(t)}function R(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function D(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,F(r.key),r)}}function F(t){var e=function(t){if("object"!=B(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=B(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==B(e)?e:e+""}var q=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.contextBootstrapRegistry={},this.contextBootstrapWatchers=[]},(e=[{key:"watchContextBootstrap",value:function(t){this.contextBootstrapWatchers.push(t),Object.values(this.contextBootstrapRegistry).forEach(t)}},{key:"registerContextBootstrap",value:function(t,e){this.contextBootstrapRegistry[t]={context:t,handler:e};var n,r=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return R(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?R(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}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 o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}(this.contextBootstrapWatchers);try{for(r.s();!(n=r.n()).done;)(0,n.value)(this.contextBootstrapRegistry[t])}catch(t){r.e(t)}finally{r.f()}}}])&&D(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();window.ppcpResources=window.ppcpResources||{};const G=window.ppcpResources.ButtonModuleWatcher=window.ppcpResources.ButtonModuleWatcher||new q;function H(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function W(t){var e,n=[],r=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return H(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?H(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}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 o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(r.s();!(e=r.n()).done;){var o=e.value,i=o.contactField,a=void 0===i?null:i,u=o.code,c=void 0===u?null:u,l=o.message,s=a?new ApplePayError(c,a,void 0===l?null:l):new ApplePayError(c);n.push(s)}}catch(t){r.e(t)}finally{r.f()}return n}function N(t){return N="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},N(t)}function U(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return L(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(L(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,L(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,L(f,"constructor",l),L(l,"constructor",c),c.displayName="GeneratorFunction",L(l,o,"GeneratorFunction"),L(f),L(f,o,"Generator"),L(f,r,function(){return this}),L(f,"toString",function(){return"[object Generator]"}),(U=function(){return{w:i,m:p}})()}function L(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}L=function(t,e,n,r){function i(e,n){L(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},L(t,e,n,r)}function Q(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function z(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,V(r.key),r)}}function V(t){var e=function(t){if("object"!=N(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=N(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==N(e)?e:e+""}var J=function(){return t=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.url=e,this.nonce=n},e=[{key:"validate",value:(n=U().m(function t(e){var n,r,o;return U().w(function(t){for(;;)switch(t.n){case 0:return n=new FormData(e),t.n=1,fetch(this.url,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:this.nonce,form_encoded:new URLSearchParams(n).toString()})});case 1:return r=t.v,t.n=2,r.json();case 2:if((o=t.v).success){t.n=4;break}if(o.data.refresh&&jQuery(document.body).trigger("update_checkout"),!o.data.errors){t.n=3;break}return t.a(2,o.data.errors);case 3:throw Error(o.data.message);case 4:return t.a(2,[])}},t,this)}),r=function(){var t=this,e=arguments;return new Promise(function(r,o){var i=n.apply(t,e);function a(t){Q(i,r,o,a,u,"next",t)}function u(t){Q(i,r,o,a,u,"throw",t)}a(void 0)})},function(_x){return r.apply(this,arguments)})}],e&&z(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r}();function $(t){return $="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},$(t)}function K(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,X(r.key),r)}}function X(t){var e=function(t){if("object"!=$(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=$(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==$(e)?e:e+""}var Y=function(){return t=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.genericErrorText=e,this.wrapper=n},e=[{key:"genericError",value:function(){this.clear(),this.message(this.genericErrorText)}},{key:"appendPreparedErrorMessageElement",value:function(t){this._getMessageContainer().replaceWith(t)}},{key:"message",value:function(t){this._addMessage(t),this._scrollToMessages()}},{key:"messages",value:function(t){var e=this;t.forEach(function(t){return e._addMessage(t)}),this._scrollToMessages()}},{key:"currentHtml",value:function(){return this._getMessageContainer().outerHTML}},{key:"_addMessage",value:function(t){if("undefined"!=typeof String&&!$(String)||0===t.length)throw new Error("A new message text must be a non-empty string.");var e=this._getMessageContainer(),n=this._prepareMessageElement(t);e.appendChild(n)}},{key:"_scrollToMessages",value:function(){jQuery.scroll_to_notices(jQuery(".woocommerce-error"))}},{key:"_getMessageContainer",value:function(){var t=document.querySelector("ul.woocommerce-error");return null===t&&((t=document.createElement("ul")).setAttribute("class","woocommerce-error"),t.setAttribute("role","alert"),jQuery(this.wrapper).prepend(t)),t}},{key:"_prepareMessageElement",value:function(t){var e=document.createElement("li");return e.innerHTML=t,e}},{key:"clear",value:function(){jQuery(".woocommerce-error, .woocommerce-message").remove()}}],e&&K(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();const Z=Y;function tt(t){return tt="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},tt(t)}function et(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,nt(r.key),r)}}function nt(t){var e=function(t){if("object"!=tt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=tt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==tt(e)?e:e+""}function rt(t,e,n){(function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")})(t,e),e.set(t,n)}function ot(t,e){return t.get(at(t,e))}function it(t,e,n){return t.set(at(t,e),n),n}function at(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var ut=new WeakMap,ct=new WeakMap,lt=new WeakMap,st=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),rt(this,ut,""),rt(this,ct,!1),rt(this,lt,null);for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];n.length&&it(ut,this,"[".concat(n.join(" | "),"]"))},e=[{key:"enabled",set:function(t){it(ct,this,t)}},{key:"log",value:function(){if(ot(ct,this)){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];(t=console).log.apply(t,[ot(ut,this)].concat(n))}}},{key:"error",value:function(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];(t=console).error.apply(t,[ot(ut,this)].concat(n))}},{key:"group",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;ot(ct,this)&&(t&&!ot(lt,this)||(console.groupEnd(),it(lt,this,null)),t&&(console.group(t),it(lt,this,t)))}}],e&&et(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function ft(t){return ft="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},ft(t)}function pt(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return yt(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}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 o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function yt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function dt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ht(r.key),r)}}function ht(t){var e=function(t){if("object"!=ft(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ft(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ft(e)?e:e+""}var bt=function(){return t=function t(e,n){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.selector=e,this.selectorInContainer=n,this.containers=[],this.reloadContainers(),jQuery(window).resize(function(){r.refresh()}).resize(),jQuery(document).on("ppcp-smart-buttons-init",function(){r.refresh()}),jQuery(document).on("ppcp-shown ppcp-hidden ppcp-enabled ppcp-disabled",function(t,e){r.refresh(),setTimeout(r.refresh.bind(r),200)}),new MutationObserver(this.observeElementsCallback.bind(this)).observe(document.body,{childList:!0,subtree:!0})},(e=[{key:"observeElementsCallback",value:function(t,e){var n,r=this.selector+", .widget_shopping_cart, .widget_shopping_cart_content",o=!1,i=pt(t);try{for(i.s();!(n=i.n()).done;){var a=n.value;"childList"===a.type&&a.addedNodes.forEach(function(t){t.matches&&t.matches(r)&&(o=!0)})}}catch(t){i.e(t)}finally{i.f()}o&&(this.reloadContainers(),this.refresh())}},{key:"reloadContainers",value:function(){var t=this;jQuery(this.selector).each(function(e,n){var r=jQuery(n).parent();t.containers.some(function(t){return t.is(r)})||t.containers.push(r)})}},{key:"refresh",value:function(){var t,e=this,n=pt(this.containers);try{var r=function(){var n=t.value,r=jQuery(n),o=r.width();r.removeClass("ppcp-width-500 ppcp-width-300 ppcp-width-min"),o>=500?r.addClass("ppcp-width-500"):o>=300?r.addClass("ppcp-width-300"):r.addClass("ppcp-width-min");var i=r.children(":visible").first();r.find(e.selectorInContainer).each(function(t,e){var n=jQuery(e);if(n.is(i))return n.css("margin-top","0px"),!0;var r=n.height(),o=Math.max(11,Math.round(.3*r));n.css("margin-top","".concat(o,"px"))})};for(n.s();!(t=n.n()).done;)r()}catch(t){n.e(t)}finally{n.f()}}}])&&dt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}(),vt="ppcp-gateway",mt={Cart:"cart",Checkout:"checkout",BlockCart:"cart-block",BlockCheckout:"checkout-block",Product:"product",MiniCart:"mini-cart",PayNow:"pay-now",Preview:"preview",Blocks:["cart-block","checkout-block"],Gateways:["checkout","pay-now"]},gt=function(){var t=document.querySelector('input[name="payment_method"]:checked');return t?t.value:null};function wt(t){return wt="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},wt(t)}function St(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function jt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?St(Object(n),!0).forEach(function(e){_t(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):St(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function _t(t,e,n){return(e=function(t){var e=function(t){if("object"!=wt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=wt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==wt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Ot=Object.freeze({INVALIDATE:"ppcp_invalidate_methods",RENDER:"ppcp_render_method",REDRAW:"ppcp_redraw_method"});function Pt(t){return Object.values(Ot).includes(t)}function kt(t){var e=t.event,n=t.paymentMethod,r=void 0===n?"":n,o=t.callback;if(!Pt(e))throw new Error("Invalid event: ".concat(e));var i=r?"".concat(e,"-").concat(r):e;document.body.addEventListener(i,o)}var Et=function(t){return"string"==typeof t?document.querySelector(t):t};function Ct(t){return Ct="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},Ct(t)}function At(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Tt(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}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 o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function Tt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function xt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Rt(r.key),r)}}function It(t,e,n){Mt(t,e),e.set(t,n)}function Mt(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Bt(t,e,n){return(e=Rt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Rt(t){var e=function(t){if("object"!=Ct(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ct(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ct(e)?e:e+""}function Dt(t,e){return t.get(qt(t,e))}function Ft(t,e,n){return t.set(qt(t,e),n),n}function qt(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var Gt=new WeakMap,Ht=new WeakMap,Wt=new WeakMap,Nt=new WeakMap,Ut=new WeakMap,Lt=new WeakMap,Qt=new WeakMap,zt=new WeakMap,Vt=new WeakMap,Jt=new WeakMap,$t=new WeakMap,Kt=new WeakMap,Xt=new WeakMap,Yt=new WeakMap,Zt=new WeakMap,te=new WeakMap,ee=new WeakMap,ne=new WeakSet,re=function(){return t=function t(e){var n,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Mt(this,r=ne),r.add(this),It(this,Gt,void 0),It(this,Ht,!1),It(this,Wt,!1),It(this,Nt,void 0),It(this,Ut,void 0),It(this,Lt,void 0),It(this,Qt,[]),It(this,zt,void 0),It(this,Vt,void 0),It(this,Jt,void 0),It(this,$t,void 0),It(this,Kt,void 0),It(this,Xt,null),It(this,Yt,!0),It(this,Zt,!0),It(this,te,null),It(this,ee,[]),this.methodId===t.methodId)throw new Error("Cannot initialize the PaymentButton base class");i||(i={});var s=!(null===(n=i)||void 0===n||!n.is_debug),f=this.methodId.replace(/^ppcp?-/,"");Ft(Nt,this,e),Ft(zt,this,i),Ft(Vt,this,a),Ft(Jt,this,o),Ft($t,this,u),Ft(Kt,this,c),this.onClick=l,Ft(Gt,this,new st(f,e)),s&&(Dt(Gt,this).enabled=!0,function(t,e){window.ppcpPaymentButtonList=window.ppcpPaymentButtonList||{};var n=window.ppcpPaymentButtonList;n[t]=n[t]||[],n[t].push(e)}(f,this)),Ft(Ut,this,this.constructor.getWrappers(Dt(zt,this),Dt(Vt,this))),this.applyButtonStyles(Dt(zt,this)),this.registerValidationRules(qt(ne,this,oe).bind(this),qt(ne,this,ie).bind(this)),function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".ppcp-button-apm",n=e;if(!window.ppcpApmButtons){if(t&&t.button){var r=t.button.wrapper;jQuery(r).children('div[class^="item-"]').length>0&&(e+=", ".concat(r,' div[class^="item-"]'),n+=', div[class^="item-"]')}window.ppcpApmButtons=new bt(e,n)}}(Dt(Vt,this)),this.initEventListeners()},e=[{key:"methodId",get:function(){return this.constructor.methodId}},{key:"cssClass",get:function(){return this.constructor.cssClass}},{key:"isInitialized",get:function(){return Dt(Ht,this)}},{key:"context",get:function(){return Dt(Nt,this)}},{key:"buttonConfig",get:function(){return Dt(zt,this)}},{key:"ppcpConfig",get:function(){return Dt(Vt,this)}},{key:"externalHandler",get:function(){return Dt(Jt,this)||{}}},{key:"contextHandler",get:function(){return Dt($t,this)||{}}},{key:"requiresShipping",get:function(){return"function"==typeof this.contextHandler.shippingAllowed&&this.contextHandler.shippingAllowed()}},{key:"wrappers",get:function(){return Dt(Ut,this)}},{key:"style",get:function(){return mt.MiniCart===this.context?Dt(Lt,this).MiniCart:Dt(Lt,this).Default}},{key:"wrapperId",get:function(){return mt.MiniCart===this.context?this.wrappers.MiniCart:this.isSeparateGateway?this.wrappers.Gateway:mt.Blocks.includes(this.context)?this.wrappers.Block:this.wrappers.Default}},{key:"isInsideClassicGateway",get:function(){return mt.Gateways.includes(this.context)}},{key:"isSeparateGateway",get:function(){return Dt(zt,this).is_wc_gateway_enabled&&this.isInsideClassicGateway}},{key:"isCurrentGateway",get:function(){if(!this.isInsideClassicGateway)return!0;var t=gt();return this.isSeparateGateway?this.methodId===t:vt===t}},{key:"isPreview",get:function(){return mt.Preview===this.context}},{key:"isEligible",get:function(){return Dt(Xt,this)},set:function(t){t!==Dt(Xt,this)&&(Ft(Xt,this,t),this.triggerRedraw())}},{key:"isVisible",get:function(){return Dt(Yt,this)},set:function(t){Dt(Yt,this)!==t&&(Ft(Yt,this,t),this.triggerRedraw())}},{key:"isEnabled",get:function(){return Dt(Zt,this)},set:function(t){Dt(Zt,this)!==t&&(Ft(Zt,this,t),this.triggerRedraw())}},{key:"wrapperElement",get:function(){return document.getElementById(this.wrapperId)}},{key:"ppcpButtonWrapperSelector",get:function(){var t,e;return mt.Blocks.includes(this.context)?null:this.context===mt.MiniCart?null===(e=this.ppcpConfig)||void 0===e||null===(e=e.button)||void 0===e?void 0:e.mini_cart_wrapper:null===(t=this.ppcpConfig)||void 0===t||null===(t=t.button)||void 0===t?void 0:t.wrapper}},{key:"isPresent",get:function(){return this.wrapperElement instanceof HTMLElement}},{key:"isButtonAttached",get:function(){if(!Dt(te,this))return!1;for(var t=Dt(te,this).parentElement;null!==(e=t)&&void 0!==e&&e.parentElement;){var e;if("BODY"===t.tagName)return!0;t=t.parentElement}return!1}},{key:"log",value:function(){var t;(t=Dt(Gt,this)).log.apply(t,arguments)}},{key:"error",value:function(){var t;(t=Dt(Gt,this)).error.apply(t,arguments)}},{key:"logGroup",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;Dt(Gt,this).group(t)}},{key:"registerValidationRules",value:function(t,e){}},{key:"validateConfiguration",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=At(Dt(ee,this));try{for(n.s();!(t=n.n()).done;){var r=t.value,o=r.check();if(r.shouldPass&&o)return!0;if(!r.shouldPass&&o)return!e&&r.errorMessage&&this.error(r.errorMessage),!1}}catch(t){n.e(t)}finally{n.f()}return!0}},{key:"applyButtonStyles",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e||(e=this.ppcpConfig),Ft(Lt,this,this.constructor.getStyles(t,e)),this.isInitialized&&this.triggerRedraw()}},{key:"configure",value:function(){}},{key:"init",value:function(){Ft(Ht,this,!0)}},{key:"reinit",value:function(){Ft(Ht,this,!1),Ft(Xt,this,!1)}},{key:"triggerRedraw",value:function(){this.showPaymentGateway(),function(t){var e=t.event,n=t.paymentMethod,r=void 0===n?"":n;if(!Pt(e))throw new Error("Invalid event: ".concat(e));var o=r?"".concat(e,"-").concat(r):e;document.body.dispatchEvent(new Event(o))}({event:Ot.REDRAW,paymentMethod:this.methodId})}},{key:"syncProductButtonsState",value:function(){var t,e=document.querySelector(this.ppcpButtonWrapperSelector);e&&(this.isVisible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}(e),this.isEnabled=!((t=Et(e))&&jQuery(t).hasClass("ppcp-disabled")))}},{key:"initEventListeners",value:function(){var t=this;if(kt({event:Ot.REDRAW,paymentMethod:this.methodId,callback:function(){return t.refresh()}}),this.isInsideClassicGateway){var e=this.isSeparateGateway?this.methodId:vt;kt({event:Ot.INVALIDATE,callback:function(){return t.isVisible=!1}}),kt({event:Ot.RENDER,paymentMethod:e,callback:function(){return t.isVisible=!0}})}this.context===mt.Product&&(jQuery(document).on("ppcp-shown ppcp-hidden ppcp-enabled ppcp-disabled",function(e,n){jQuery(n.selector).is(t.ppcpButtonWrapperSelector)&&t.syncProductButtonsState()}),this.syncProductButtonsState())}},{key:"refresh",value:function(){this.isPresent&&(this.isEligible?(this.applyWrapperStyles(),this.isEligible&&this.isCurrentGateway&&this.isVisible&&(this.isButtonAttached||(this.log("refresh.addButton"),this.addButton()))):this.wrapperElement.style.display="none")}},{key:"showPaymentGateway",value:function(){if(!Dt(Wt,this)&&this.isSeparateGateway&&this.isEligible){var t='style[data-hide-gateway="'.concat(this.methodId,'"]'),e="#".concat(this.wrappers.Default),n=document.querySelector(".wc_payment_method.payment_method_".concat(this.methodId));document.querySelectorAll(t).forEach(function(t){return t.remove()}),"none"!==n.style.display&&""!==n.style.display||(n.style.display="block"),document.querySelectorAll(e).forEach(function(t){return t.remove()}),this.log("Show gateway"),Ft(Wt,this,!0),this.isVisible=this.isCurrentGateway}}},{key:"applyWrapperStyles",value:function(){var t,e,n=this.wrapperElement;if(n){var r,o=this.style,i=o.shape,a=o.height,u=At(Dt(Qt,this));try{for(u.s();!(r=u.n()).done;){var c=r.value;n.classList.remove(c)}}catch(t){u.e(t)}finally{u.f()}Ft(Qt,this,[]);var l=["ppcp-button-".concat(i),"ppcp-button-apm",this.cssClass];(t=n.classList).add.apply(t,l),(e=Dt(Qt,this)).push.apply(e,l),a&&(n.style.height="".concat(a,"px")),n.style.display=this.isVisible?"block":"none";var s=this.context===mt.Product?"form.cart":null;!function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=Et(t);r&&(e?(jQuery(r).removeClass("ppcp-disabled").off("mouseup").find("> *").css("pointer-events",""),function(t,e){jQuery(document).trigger("ppcp-enabled",{handler:"ButtonsDisabler.setEnabled",action:"enable",selector:t,element:e})}(t,r)):(jQuery(r).addClass("ppcp-disabled").on("mouseup",function(t){if(t.stopImmediatePropagation(),n){var e=jQuery(n);e.find(".single_add_to_cart_button").hasClass("disabled")&&e.find(":submit").trigger("click")}}).find("> *").css("pointer-events","none"),function(t,e){jQuery(document).trigger("ppcp-disabled",{handler:"ButtonsDisabler.setEnabled",action:"disable",selector:t,element:e})}(t,r)))}(n,this.isEnabled,s)}}},{key:"addButton",value:function(){throw new Error("Must be implemented by the child class")}},{key:"insertButton",value:function(t){if(this.isPresent){var e=this.wrapperElement;Dt(te,this)&&this.removeButton(),this.log("insertButton",t),Ft(te,this,t),e.appendChild(Dt(te,this))}}},{key:"removeButton",value:function(){if(this.isPresent&&Dt(te,this)){this.log("removeButton");try{this.wrapperElement.removeChild(Dt(te,this))}catch(t){}Ft(te,this,null)}}}],n=[{key:"createButton",value:function(t,e,n,r,o,i){var a,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,c=(a="__ppcpPBInstances",document.body[a]||Object.defineProperty(document.body,a,{value:new Map,enumerable:!1,writable:!1,configurable:!1}),document.body[a]),l="".concat(this.methodId,".").concat(t);if(!c.has(l)){var s=new this(t,e,n,r,o,i,u);c.set(l,s)}return c.get(l)}},{key:"getWrappers",value:function(t,e){throw new Error("Must be implemented in the child class")}},{key:"getStyles",value:function(t,e){throw new Error("Must be implemented in the child class")}}],e&&xt(t.prototype,e),n&&xt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function oe(t,e){Dt(ee,this).push({check:t,errorMessage:e,shouldPass:!1})}function ie(t){Dt(ee,this).push({check:t,shouldPass:!0})}function ae(t){return ae="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},ae(t)}function ue(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return ce(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ce(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}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 o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function ce(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function le(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return se(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(se(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,se(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,se(f,"constructor",l),se(l,"constructor",c),c.displayName="GeneratorFunction",se(l,o,"GeneratorFunction"),se(f),se(f,o,"Generator"),se(f,r,function(){return this}),se(f,"toString",function(){return"[object Generator]"}),(le=function(){return{w:i,m:p}})()}function se(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}se=function(t,e,n,r){function i(e,n){se(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},se(t,e,n,r)}function fe(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function pe(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){fe(i,r,o,a,u,"next",t)}function u(t){fe(i,r,o,a,u,"throw",t)}a(void 0)})}}function ye(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function de(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ye(Object(n),!0).forEach(function(e){_e(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ye(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function he(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Oe(r.key),r)}}function be(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(be=function(){return!!t})()}function ve(t,e,n,r){var o=me(ge(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function me(){return me="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=ge(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},me.apply(null,arguments)}function ge(t){return ge=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ge(t)}function we(t,e){return we=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},we(t,e)}function Se(t,e,n){je(t,e),e.set(t,n)}function je(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _e(t,e,n){return(e=Oe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Oe(t){var e=function(t){if("object"!=ae(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ae(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ae(e)?e:e+""}function Pe(t,e){return t.get(Ee(t,e))}function ke(t,e,n){return t.set(Ee(t,e),n),n}function Ee(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}Bt(re,"methodId","generic"),Bt(re,"cssClass","");var Ce=new WeakMap,Ae=new WeakMap,Te=new WeakMap,xe=new WeakMap,Ie=new WeakMap,Me=new WeakMap,Be=new WeakMap,Re=new WeakMap,De=new WeakMap,Fe=new WeakMap,qe=new WeakSet,Ge=function(t){function e(t,n,r,o,i,a){var u,c,l;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),u=function(t,e,n){return e=ge(e),function(t,e){if(e&&("object"==ae(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,be()?Reflect.construct(e,n||[],ge(t).constructor):e.apply(t,n))}(this,e,[t,n,r,o,i,a]),je(c=u,l=qe),l.add(c),Se(u,Ce,null),Se(u,Ae,[]),Se(u,Te,[]),Se(u,xe,null),Se(u,Ie,null),Se(u,Me,null),Se(u,Be,{}),Se(u,Re,0),Se(u,De,1e3),Se(u,Fe,null),u.init=u.init.bind(u),u.onPaymentAuthorized=u.onPaymentAuthorized.bind(u),u.onButtonClick=u.onButtonClick.bind(u),ke(Be,u,{quantity:null,items:[]}),u.log("Create instance"),u}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&we(t,e)}(e,t),n=e,r=[{key:"requiresShipping",get:function(){var t;return!!ve(e,"requiresShipping",this,1)&&!(null===(t=this.buttonConfig.product)||void 0===t||!t.needShipping)&&(mt.Checkout!==this.context||this.shouldUpdateButtonWithFormData)}},{key:"transactionInfo",get:function(){return Pe(Ie,this)},set:function(t){ke(Ie,this,t),this.refresh()}},{key:"nonce",get:function(){var t=document.getElementById("woocommerce-process-checkout-nonce");return(null==t?void 0:t.value)||this.buttonConfig.nonce}},{key:"registerValidationRules",value:function(t,e){var n=this;e(function(){return n.isPreview}),t(function(){return!Pe(Me,n)},"No API configuration - missing configure() call?"),t(function(){return!Pe(Ie,n)},"No transactionInfo - missing configure() call?"),t(function(){var t;return(null===(t=n.buttonAttributes)||void 0===t?void 0:t.height)&&isNaN(parseInt(n.buttonAttributes.height))},"Invalid height in buttonAttributes"),t(function(){var t;return(null===(t=n.buttonAttributes)||void 0===t?void 0:t.borderRadius)&&isNaN(parseInt(n.buttonAttributes.borderRadius))},"Invalid borderRadius in buttonAttributes"),t(function(){var t;return!(null!==(t=n.contextHandler)&&void 0!==t&&t.validateContext())},"Invalid context handler.")}},{key:"configure",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Pe(Re,this)||ke(Re,this,Date.now()),null!=r&&r.height&&null!=r&&r.borderRadius&&ke(Fe,this,de({},r));var o=null!=r&&r.height?r:Pe(Fe,this);if(Date.now()-Pe(Re,this)>Pe(De,this))return this.log("ApplePay: Timeout waiting for buttonAttributes - proceeding with initialization"),ke(Me,this,t),ke(Ie,this,e),this.buttonAttributes=o||r,void this.init();null!=o&&o.height&&null!=o&&o.borderRadius?(ke(Re,this,0),ke(Me,this,t),ke(Ie,this,e),this.buttonAttributes=o,this.init()):setTimeout(function(){return n.configure(t,e,r)},100)}},{key:"init",value:function(){this.isInitialized||this.validateConfiguration()&&(ve(e,"init",this,3)([]),this.checkEligibility())}},{key:"reinit",value:(a=pe(le().m(function t(){var n=this;return le().w(function(t){for(;;)switch(t.n){case 0:if(this.validateConfiguration(!0)){t.n=1;break}return t.a(2);case 1:return t.n=2,this.contextHandler.transactionInfo().then(function(t){n.transactionInfo=t}).catch(function(t){console.error("Failed to get transaction info:",t)});case 2:ve(e,"reinit",this,3)([]),this.init();case 3:return t.a(2)}},t,this)})),function(){return a.apply(this,arguments)})},{key:"checkEligibility",value:function(){if(this.isPreview)this.isEligible=!0;else try{var t;if(null===(t=window.ApplePaySession)||void 0===t||!t.canMakePayments())return void(this.isEligible=!1);this.isEligible=!!Pe(Me,this).isEligible}catch(t){this.isEligible=!1}}},{key:"applePaySession",value:function(t){this.log("applePaySession",t);var e=new ApplePaySession(4,t);return this.requiresShipping&&(e.onshippingmethodselected=this.onShippingMethodSelected(e),e.onshippingcontactselected=this.onShippingContactSelected(e)),e.onvalidatemerchant=this.onValidateMerchant(e),e.onpaymentauthorized=this.onPaymentAuthorized(e),e.begin(),e}},{key:"applyWrapperStyles",value:function(){var t,n;ve(e,"applyWrapperStyles",this,3)([]);var r=this.wrapperElement;if(r){var o=null!==(t=this.buttonAttributes)&&void 0!==t&&t.height||null!==(n=this.buttonAttributes)&&void 0!==n&&n.borderRadius?this.buttonAttributes:Pe(Fe,this),i=null!=o&&o.height?parseInt(o.height,10):48;isNaN(i)?(r.style.setProperty("--apple-pay-button-height","".concat(48,"px")),r.style.height="".concat(48,"px")):(r.style.setProperty("--apple-pay-button-height","".concat(i,"px")),r.style.height="".concat(i,"px"));var a=null!=o&&o.borderRadius?parseInt(o.borderRadius,10):4;isNaN(a)||(r.style.borderRadius="".concat(a,"px"))}}},{key:"addButton",value:function(){var t,e,n=this,r=this.style,o=r.color,i=r.type,a=r.language;null!==(t=this.buttonAttributes)&&void 0!==t&&t.height||null===(e=Pe(Fe,this))||void 0===e||!e.height||(this.buttonAttributes=de({},Pe(Fe,this)));var u=document.createElement("apple-pay-button");u.id="apple-"+this.wrapperId,u.setAttribute("buttonstyle",o),u.setAttribute("type",i),u.setAttribute("locale",a),u.style.display="block",u.addEventListener("click",function(t){t.preventDefault(),n.onButtonClick()}),this.insertButton(u)}},{key:"onButtonClick",value:(i=pe(le().m(function t(){var e,n,r,o,i,a,u,c;return le().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.log("onButtonClick"),e=this.paymentRequest(),window.ppcpFundingSource="apple_pay",mt.Checkout!==this.context){t.n=6;break}n="form.woocommerce-checkout",r=new Z(PayPalCommerceGateway.labels.error.generic,document.querySelector(".woocommerce-notices-wrapper"));try{o=new FormData(document.querySelector(n)),ke(Ce,this,Object.fromEntries(o.entries())),this.updateRequestDataWithForm(e)}catch(t){console.error(t)}if(this.log("===paymentRequest",e),i=this.applePaySession(e),!(a=PayPalCommerceGateway.early_checkout_validation_enabled?new J(PayPalCommerceGateway.ajax.validate_checkout.endpoint,PayPalCommerceGateway.ajax.validate_checkout.nonce):null)){t.n=5;break}return t.p=1,t.n=2,a.validate(document.querySelector(n));case 2:if(!((u=t.v).length>0)){t.n=3;break}return r.messages(u),jQuery(document.body).trigger("checkout_error",[r.currentHtml()]),i.abort(),t.a(2);case 3:t.n=5;break;case 4:t.p=4,c=t.v,console.error(c);case 5:return t.a(2);case 6:this.applePaySession(e);case 7:return t.a(2)}},t,this,[[1,4]])})),function(){return i.apply(this,arguments)})},{key:"shouldUpdateButtonWithFormData",get:function(){var t;return mt.Checkout===this.context&&"use_applepay"===(null===(t=this.buttonConfig)||void 0===t||null===(t=t.preferences)||void 0===t?void 0:t.checkout_data_mode)}},{key:"shouldCompletePaymentWithContextHandler",get:function(){return!this.contextHandler.shippingAllowed()||mt.Checkout===this.context&&!this.shouldUpdateButtonWithFormData}},{key:"updateRequestDataWithForm",value:function(t){if(this.shouldUpdateButtonWithFormData&&(t.billingContact=this.fillBillingContact(Pe(Ce,this)),this.requiresShipping)){t.shippingContact=this.fillShippingContact(Pe(Ce,this));var e=this.transactionInfo.chosenShippingMethods[0];t.shippingMethods=[];var n,r=ue(this.transactionInfo.shippingPackages);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(e===o.id){var i={label:o.label,detail:"",amount:o.cost_str,identifier:o.id};ke(Te,this,i),t.shippingMethods.push(i);break}}}catch(t){r.e(t)}finally{r.f()}var a,u=ue(this.transactionInfo.shippingPackages);try{for(u.s();!(a=u.n()).done;){var c=a.value;e!==c.id&&t.shippingMethods.push({label:c.label,detail:"",amount:c.cost_str,identifier:c.id})}}catch(t){u.e(t)}finally{u.f()}ke(xe,this,t),this.log("===paymentRequest.shippingMethods",t.shippingMethods)}}},{key:"paymentRequest",value:function(){var t=Pe(Me,this),e=this.buttonConfig,n={countryCode:t.countryCode,merchantCapabilities:t.merchantCapabilities,supportedNetworks:t.supportedNetworks,requiredShippingContactFields:["postalAddress","email","phone"],requiredBillingContactFields:["postalAddress"]};this.requiresShipping||(this.shouldCompletePaymentWithContextHandler?n.requiredShippingContactFields=[]:n.requiredShippingContactFields=["email","phone"]);var r=Object.assign({},n);return r.currencyCode=e.shop.currencyCode,r.total={label:e.shop.totalLabel,type:"final",amount:this.transactionInfo.totalPrice},r}},{key:"refreshProductContextData",value:function(){var t;mt.Product===this.context&&(Pe(Be,this).quantity=null===(t=document.querySelector("input.qty"))||void 0===t?void 0:t.value,Pe(Be,this).items=this.contextHandler.products(),this.log("Products updated",Pe(Be,this)))}},{key:"adminValidation",value:function(t){fetch(this.buttonConfig.ajax_url,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"ppcp_validate","woocommerce-process-checkout-nonce":this.nonce,validation:t}).toString()})}},{key:"onValidateMerchant",value:function(t){var e=this;return function(n){e.log("onvalidatemerchant call"),v.paypal.Applepay().validateMerchant({validationUrl:n.validationURL}).then(function(n){t.completeMerchantValidation(n.merchantSession),e.adminValidation(!0)}).catch(function(n){console.error(n),e.adminValidation(!1),e.log("onvalidatemerchant session abort"),t.abort()})}}},{key:"onShippingMethodSelected",value:function(t){var e=this;this.log("onshippingmethodselected",this.buttonConfig.ajax_url);var n=this.buttonConfig.ajax_url;return function(r){e.log("onshippingmethodselected call");var o=e.getShippingMethodData(r);jQuery.ajax({url:n,method:"POST",data:o,success:function(n){e.log("onshippingmethodselected ok");var o=n.data;!1===n.success&&(o.errors=W(o.errors)),ke(Te,e,r.shippingMethod),o.newShippingMethods=o.newShippingMethods.sort(function(t){return t.label===Pe(Te,e).label?-1:1}),!1===n.success&&(o.errors=W(o.errors)),t.completeShippingMethodSelection(o)},error:function(n,r,o){e.log("onshippingmethodselected error",r),console.warn(r,o),t.abort()}})}}},{key:"onShippingContactSelected",value:function(t){var e=this;this.log("onshippingcontactselected",this.buttonConfig.ajax_url);var n=this.buttonConfig.ajax_url;return function(r){e.log("onshippingcontactselected call");var o=e.getShippingContactData(r);jQuery.ajax({url:n,method:"POST",data:o,success:function(n){e.log("onshippingcontactselected ok");var o=n.data;ke(Ae,e,r.shippingContact),!1===n.success&&(o.errors=W(o.errors)),o.newShippingMethods&&ke(Te,e,o.newShippingMethods[0]),t.completeShippingContactSelection(o)},error:function(n,r,o){e.log("onshippingcontactselected error",r),console.warn(r,o),t.abort()}})}}},{key:"getShippingContactData",value:function(t){var e=this.buttonConfig.product.id;switch(this.refreshProductContextData(),this.context){case mt.Product:return{action:"ppcp_update_shipping_contact",product_id:e,products:JSON.stringify(Pe(Be,this).items),caller_page:"productDetail",product_quantity:Pe(Be,this).quantity,simplified_contact:t.shippingContact,need_shipping:this.requiresShipping,"woocommerce-process-checkout-nonce":this.nonce};case mt.Cart:case mt.Checkout:case mt.BlockCart:case mt.BlockCheckout:case mt.MiniCart:return{action:"ppcp_update_shipping_contact",simplified_contact:t.shippingContact,caller_page:"cart",need_shipping:this.requiresShipping,"woocommerce-process-checkout-nonce":this.nonce}}}},{key:"getShippingMethodData",value:function(t){var e,n,r,o,i,a,u=this.buttonConfig.product.id;switch(this.refreshProductContextData(),this.context){case mt.Product:return{action:"ppcp_update_shipping_method",shipping_method:t.shippingMethod,simplified_contact:this.hasValidContactInfo(Pe(Ae,this))?Pe(Ae,this):null!==(e=null===(n=Pe(xe,this))||void 0===n?void 0:n.shippingContact)&&void 0!==e?e:null===(r=Pe(xe,this))||void 0===r?void 0:r.billingContact,product_id:u,products:JSON.stringify(Pe(Be,this).items),caller_page:"productDetail",product_quantity:Pe(Be,this).quantity,"woocommerce-process-checkout-nonce":this.nonce};case mt.Cart:case mt.Checkout:case mt.BlockCart:case mt.BlockCheckout:case mt.MiniCart:return{action:"ppcp_update_shipping_method",shipping_method:t.shippingMethod,simplified_contact:this.hasValidContactInfo(Pe(Ae,this))?Pe(Ae,this):null!==(o=null===(i=Pe(xe,this))||void 0===i?void 0:i.shippingContact)&&void 0!==o?o:null===(a=Pe(xe,this))||void 0===a?void 0:a.billingContact,caller_page:"cart","woocommerce-process-checkout-nonce":this.nonce}}}},{key:"onPaymentAuthorized",value:function(t){var e=this;return this.log("onpaymentauthorized"),function(){var n=pe(le().m(function n(r){var o,i,a,u,c,l,s,f;return le().w(function(n){for(;;)switch(n.p=n.n){case 0:return e.log("onpaymentauthorized call"),o=function(){var t=pe(le().m(function t(n){return le().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,o){try{var i,a=n.billing_contact||Pe(xe,e).billingContact,u=n.shipping_contact||Pe(xe,e).shippingContact,c=Pe(Te,e)||(Pe(xe,e).shippingMethods||[])[0],l={action:"ppcp_create_order",caller_page:e.context,product_id:null!==(i=e.buttonConfig.product.id)&&void 0!==i?i:null,products:JSON.stringify(Pe(Be,e).items),product_quantity:Pe(Be,e).quantity,shipping_contact:u,billing_contact:a,token:r.payment.token,shipping_method:c,"woocommerce-process-checkout-nonce":e.nonce,funding_source:"applepay",_wp_http_referer:"/?wc-ajax=update_order_review",paypal_order_id:n.paypal_order_id};e.log("onpaymentauthorized request",e.buttonConfig.ajax_url,n),jQuery.ajax({url:e.buttonConfig.ajax_url,method:"POST",data:l,complete:function(){e.log("onpaymentauthorized complete")},success:function(n){e.log("onpaymentauthorized ok"),t(n)},error:function(t,n,r){e.log("onpaymentauthorized error",n),o(new Error(r))}})}catch(t){e.error("onpaymentauthorized catch",t)}}))},t)}));return function(e){return t.apply(this,arguments)}}(),n.n=1,e.contextHandler.createOrder();case 1:return i=n.v,e.log("onpaymentauthorized paypal order ID",i,r.payment.token,r.payment.billingContact),n.p=2,n.n=3,v.paypal.Applepay().confirmOrder({orderId:i,token:r.payment.token,billingContact:r.payment.billingContact});case 3:if(a=n.v,e.log("onpaymentauthorized confirmOrderResponse",a),!a||!a.approveApplePayPayment){n.n=13;break}if("APPROVED"!==a.approveApplePayPayment.status){n.n=11;break}if(n.p=4,!e.shouldCompletePaymentWithContextHandler){n.n=6;break}return u=!1,n.n=5,e.contextHandler.approveOrder({orderID:i},{restart:function(){return new Promise(function(t){u=!0,t()})},order:{get:function(){return new Promise(function(t){t(null)})}}});case 5:u?(e.error("onpaymentauthorized approveOrder FAIL"),t.completePayment(ApplePaySession.STATUS_FAILURE),t.abort()):(e.log("onpaymentauthorized approveOrder OK"),t.completePayment(ApplePaySession.STATUS_SUCCESS)),n.n=8;break;case 6:return c={billing_contact:r.payment.billingContact,shipping_contact:r.payment.shippingContact,paypal_order_id:i},n.n=7,o(c);case 7:"success"===(l=n.v).result?(t.completePayment(ApplePaySession.STATUS_SUCCESS),window.location.href=l.redirect):t.completePayment(ApplePaySession.STATUS_FAILURE);case 8:n.n=10;break;case 9:n.p=9,s=n.v,t.completePayment(ApplePaySession.STATUS_FAILURE),t.abort(),console.error(s);case 10:n.n=12;break;case 11:console.error("Error status is not APPROVED"),t.completePayment(ApplePaySession.STATUS_FAILURE);case 12:n.n=14;break;case 13:console.error("Invalid confirmOrderResponse"),t.completePayment(ApplePaySession.STATUS_FAILURE);case 14:n.n=16;break;case 15:n.p=15,f=n.v,console.error("Error confirming order with applepay token",f),t.completePayment(ApplePaySession.STATUS_FAILURE),t.abort();case 16:return n.a(2)}},n,null,[[4,9],[2,15]])}));return function(_x){return n.apply(this,arguments)}}()}},{key:"fillBillingContact",value:function(t){return Ee(qe,this,He).call(this,t,"billing","")}},{key:"fillShippingContact",value:function(t){return null!=t&&t.shipping_first_name?Ee(qe,this,He).call(this,t,"shipping","billing"):this.fillBillingContact(t)}},{key:"hasValidContactInfo",value:function(t){return Array.isArray(t)?t.length>0:Object.keys(t||{}).length>0}}],o=[{key:"getWrappers",value:function(t,e){var n,r,o;return function(){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=function(t){return t.replace(/^#/,"")};return{Default:o(arguments.length>0&&void 0!==arguments[0]?arguments[0]:""),SmartButton:o(e),Block:o(n),Gateway:o(r),MiniCart:o(t)}}((null==t||null===(n=t.button)||void 0===n?void 0:n.wrapper)||"",(null==t||null===(r=t.button)||void 0===r?void 0:r.mini_cart_wrapper)||"",(null==e||null===(o=e.button)||void 0===o?void 0:o.wrapper)||"","ppc-button-applepay-container","ppc-button-ppcp-applepay")}},{key:"getStyles",value:function(t,e){var n=(null==t?void 0:t.button)||{},r={color:n.color,lang:n.lang,type:n.type},o={style:r,mini_cart_style:r};return function(t,e){return{Default:jt(jt({},t.style),e.style),MiniCart:jt(jt({},t.mini_cart_style),e.mini_cart_style)}}((null==e?void 0:e.button)||{},o)}}],r&&he(n.prototype,r),o&&he(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i,a}(re);function He(t,e,n){t&&"object"===ae(t)||(t={});var r=function(r){return t["".concat(e,"_").concat(r)]||t["".concat(n,"_").concat(r)]||""};return{givenName:r("first_name"),familyName:r("last_name"),emailAddress:r("email"),phoneNumber:r("phone"),addressLines:[r("address_1"),r("address_2")],locality:r("city"),postalCode:r("postcode"),countryCode:r("country"),administrativeArea:r("state")}}_e(Ge,"methodId","ppcp-applepay"),_e(Ge,"cssClass","ppcp-button-applepay");const We=Ge;function Ne(t){return Ne="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},Ne(t)}function Ue(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Le(r.key),r)}}function Le(t){var e=function(t){if("object"!=Ne(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ne(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ne(e)?e:e+""}var Qe=function(){return t=function t(e,n,r,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=e,this.quantity=n,this.variations=r,this.extra=o},(e=[{key:"data",value:function(){return{id:this.id,quantity:this.quantity,variations:this.variations,extra:this.extra}}}])&&Ue(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();const ze=Qe;function Ve(t){return Ve="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},Ve(t)}function Je(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function $e(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Je(Object(n),!0).forEach(function(e){Ke(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Je(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Ke(t,e,n){return(e=Ye(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Xe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ye(r.key),r)}}function Ye(t){var e=function(t){if("object"!=Ve(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ve(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ve(e)?e:e+""}function Ze(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ze=function(){return!!t})()}function tn(){return tn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=en(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},tn.apply(null,arguments)}function en(t){return en=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},en(t)}function nn(t,e){return nn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},nn(t,e)}var rn=function(t){function e(t,n,r,o){var i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(i=function(t,e,n){return e=en(e),function(t,e){if(e&&("object"==Ve(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ze()?Reflect.construct(e,n||[],en(t).constructor):e.apply(t,n))}(this,e,[t,n,null,o])).booking=r,i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&nn(t,e)}(e,t),n=e,r=[{key:"data",value:function(){return $e($e({},(t=e,n=this,"function"==typeof(r=tn(en(1&3?t.prototype:t),"data",n))?function(t){return r.apply(n,t)}:r)([])),{},{booking:this.booking});var t,n,r}}],r&&Xe(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ze);const on=rn;function an(t){return an="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},an(t)}function un(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,cn(r.key),r)}}function cn(t){var e=function(t){if("object"!=an(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=an(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==an(e)?e:e+""}var ln=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"form.woocommerce-checkout";!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.target=e}return e=t,r=[{key:"fullPage",value:function(){return new t(window)}}],(n=[{key:"setTarget",value:function(t){this.target=t}},{key:"block",value:function(){jQuery(this.target).block({message:null,overlayCSS:{background:"#fff",opacity:.6},baseZ:1e4})}},{key:"unblock",value:function(){jQuery(this.target).unblock()}}])&&un(e.prototype,n),r&&un(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();const sn=ln,fn=function(t,e){return function(n,r){var o=sn.fullPage();o.block();var i=!t.config.vaultingEnabled||"venmo"!==n.paymentSource,a={nonce:t.config.ajax.approve_order.nonce,order_id:n.orderID,funding_source:window.ppcpFundingSource,should_create_wc_order:i};return i&&n.payer&&(a.payer=n.payer),i&&n.shippingAddress&&(a.shipping_address=n.shippingAddress),fetch(t.config.ajax.approve_order.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(a)}).then(function(t){return t.json()}).then(function(n){var o;if(!n.success)return e.genericError(),r.restart().catch(function(){e.genericError()});var i,a=null===(o=n.data)||void 0===o?void 0:o.order_received_url;i=a||t.config.redirect,setTimeout(function(){window.location.href=i},200)}).finally(function(){o.unblock()})}};function pn(t){return pn="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},pn(t)}function yn(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,l=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return dn(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dn(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 dn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var hn={"#billing_email":["email_address"],"#billing_last_name":["name","surname"],"#billing_first_name":["name","given_name"],"#billing_country":["address","country_code"],"#billing_address_1":["address","address_line_1"],"#billing_address_2":["address","address_line_2"],"#billing_state":["address","admin_area_1"],"#billing_city":["address","admin_area_2"],"#billing_postcode":["address","postal_code"],"#billing_phone":["phone"]};function bn(t){var e,n,r,o,i,a,u,c;return{email_address:t.email_address,phone:t.phone,name:{surname:null===(e=t.name)||void 0===e?void 0:e.surname,given_name:null===(n=t.name)||void 0===n?void 0:n.given_name},address:{country_code:null===(r=t.address)||void 0===r?void 0:r.country_code,address_line_1:null===(o=t.address)||void 0===o?void 0:o.address_line_1,address_line_2:null===(i=t.address)||void 0===i?void 0:i.address_line_2,admin_area_1:null===(a=t.address)||void 0===a?void 0:a.admin_area_1,admin_area_2:null===(u=t.address)||void 0===u?void 0:u.admin_area_2,postal_code:null===(c=t.address)||void 0===c?void 0:c.postal_code}}}function vn(){var t,e,n=null!==(t=null===(e=window)||void 0===e||null===(e=e.PayPalCommerceGateway)||void 0===e?void 0:e.payer)&&void 0!==t?t:window._PpcpPayerSessionDetails;if(!n)return null;var r,o,i,a=(i={},Object.entries(hn).forEach(function(t){var e=yn(t,2),n=e[0],r=e[1],o=function(t){var e;return null===(e=document.querySelector(t))||void 0===e?void 0:e.value}(n);o&&function(t,e,n){for(var r=t,o=0;o<e.length-1;o++)r=r[e[o]]=r[e[o]]||{};r[e[e.length-1]]=n}(i,r,o)}),i.phone&&"string"==typeof i.phone&&(i.phone={phone_type:"HOME",phone_number:{national_number:i.phone}}),i);return a?(r=a,(o=function(t,e){for(var n=0,r=Object.entries(e);n<r.length;n++){var i=yn(r[n],2),a=i[0],u=i[1];null!=u&&("object"===pn(u)?t[a]=o(t[a]||{},u):t[a]=u)}return t})(bn(n),bn(r))):bn(n)}function mn(t){return mn="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},mn(t)}function gn(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return wn(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wn(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}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 o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function wn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Sn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,jn(r.key),r)}}function jn(t){var e=function(t){if("object"!=mn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=mn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==mn(e)?e:e+""}var On=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.cartItemKeys=e},(e=[{key:"getEndpoint",value:function(){var t="/?wc-ajax=%%endpoint%%";return"undefined"!=typeof wc_cart_fragments_params&&wc_cart_fragments_params.wc_ajax_url&&(t=wc_cart_fragments_params.wc_ajax_url),t.toString().replace("%%endpoint%%","remove_from_cart")}},{key:"addFromPurchaseUnits",value:function(t){var e,n=gn(t||[]);try{for(n.s();!(e=n.n()).done;){var r,o=gn(e.value.items||[]);try{for(o.s();!(r=o.n()).done;){var i=r.value;i.cart_item_key&&this.cartItemKeys.push(i.cart_item_key)}}catch(t){o.e(t)}finally{o.f()}}}catch(t){n.e(t)}finally{n.f()}return this}},{key:"removeFromCart",value:function(){var t=this;return new Promise(function(e,n){if(t.cartItemKeys&&t.cartItemKeys.length){var r,o=t.cartItemKeys.length,i=0,a=function(){++i>=o&&e()},u=gn(t.cartItemKeys);try{for(u.s();!(r=u.n()).done;){var c=r.value,l=new URLSearchParams;l.append("cart_item_key",c),c?fetch(t.getEndpoint(),{method:"POST",credentials:"same-origin",body:l}).then(function(t){return t.json()}).then(function(){a()}).catch(function(){a()}):a()}}catch(t){u.e(t)}finally{u.f()}}else e()})}}])&&Sn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();const Pn=On;function kn(t){return kn="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},kn(t)}function En(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,l=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||An(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 Cn(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=An(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}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 o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function An(t,e){if(t){if("string"==typeof t)return Tn(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tn(t,e):void 0}}function Tn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function xn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,In(r.key),r)}}function In(t){var e=function(t){if("object"!=kn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=kn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==kn(e)?e:e+""}var Mn=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},e=[{key:"getPrefixedFields",value:function(t,e){var n,r={},o=Cn(new FormData(t).entries());try{for(o.s();!(n=o.n()).done;){var i=En(n.value,2),a=i[0],u=i[1];e&&!a.startsWith(e)||(r[a]=u)}}catch(t){o.e(t)}finally{o.f()}return r}},{key:"getFilteredFields",value:function(t,e,n){var r,o=new FormData(t),i={},a={},u=Cn(o.entries());try{var c=function(){var t=En(r.value,2),o=t[0],u=t[1];if(-1!==o.indexOf("[]")){var c=o;a[c]=a[c]||0,o=o.replace("[]","[".concat(a[c],"]")),a[c]++}return o?e&&-1!==e.indexOf(o)||n&&n.some(function(t){return o.startsWith(t)})?0:void(i[o]=u):0};for(u.s();!(r=u.n()).done;)c()}catch(t){u.e(t)}finally{u.f()}return i}}],null&&xn(t.prototype,null),e&&xn(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Bn(t){return Bn="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},Bn(t)}function Rn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Dn(r.key),r)}}function Dn(t){var e=function(t){if("object"!=Bn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Bn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Bn(e)?e:e+""}var Fn,qn,Gn,Hn=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},e=[{key:"cleanHashParams",value:function(){var t=this;if(window.location.hash){var e=window.location.hash.substring(1).split("&").filter(function(e){var n=e.split("=")[0];return!t.PAYPAL_PARAMS.includes(n)});if(e.length>0){var n="#"+e.join("&");window.history.replaceState(null,"",window.location.pathname+window.location.search+n)}else window.history.replaceState(null,"",window.location.pathname+window.location.search)}}},{key:"isResumeFlow",value:function(){return!!window.location.hash&&window.location.hash.substring(1).split("&").some(function(t){return"switch_initiated_time"===t.split("=")[0]})}},{key:"reloadButtonsIfRequired",value:function(t){this.isResumeFlow()&&(this.cleanHashParams(),jQuery(t).trigger("ppcp-reload-buttons"))}}],null&&Rn(t.prototype,null),e&&Rn(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();Fn=Hn,Gn=["onApprove","token","PayerID","payerID","button_session_id","billingToken","orderID","switch_initiated_time","onCancel","onError"],(qn=Dn(qn="PAYPAL_PARAMS"))in Fn?Object.defineProperty(Fn,qn,{value:Gn,enumerable:!0,configurable:!0,writable:!0}):Fn[qn]=Gn;const Wn=Hn;function Nn(t){return Nn="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},Nn(t)}function Un(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ln(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Qn(r.key),r)}}function Qn(t){var e=function(t){if("object"!=Nn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Nn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Nn(e)?e:e+""}var zn=function(){return function(t,e){return e&&Ln(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n,r,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e,this.cartUpdater=n,this.formElement=r,this.errorHandler=o,this.cartHelper=null},[{key:"subscriptionsConfiguration",value:function(t){var e=this;return{createSubscription:function(e,n){return n.subscription.create({plan_id:t})},onApprove:function(t,n){fetch(e.config.ajax.approve_subscription.endpoint,{method:"POST",credentials:"same-origin",body:JSON.stringify({nonce:e.config.ajax.approve_subscription.nonce,order_id:t.orderID,subscription_id:t.subscriptionID})}).then(function(t){return t.json()}).then(function(){var t=e.getSubscriptionProducts();fetch(e.config.ajax.change_cart.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:e.config.ajax.change_cart.nonce,products:t})}).then(function(t){return t.json()}).then(function(t){if(!t.success)throw console.log(t),Error(t.data.message);location.href=e.config.redirect})})},onError:function(t){console.error(t),Wn.reloadButtonsIfRequired(e.config.button.wrapper)}}}},{key:"getSubscriptionProducts",value:function(){var t=document.querySelector('[name="add-to-cart"]').value;return[new ze(t,1,this.variations(),this.extraFields())]}},{key:"configuration",value:function(){var t=this;return{createOrder:this.createOrder(),onApprove:fn(this,this.errorHandler),onError:function(e){t.refreshMiniCart(),t.isBookingProduct()&&e.message?(t.errorHandler.clear(),t.errorHandler.message(e.message)):t.errorHandler.genericError(),Wn.reloadButtonsIfRequired(t.config.button.wrapper)},onCancel:function(){t.isBookingProduct()?t.cleanCart():t.refreshMiniCart(),Wn.reloadButtonsIfRequired(t.config.button.wrapper)}}}},{key:"getProducts",value:function(){var t=this;if(this.isBookingProduct()){var e=document.querySelector('[name="add-to-cart"]').value;return[new on(e,1,Mn.getPrefixedFields(this.formElement,"wc_bookings_field"),this.extraFields())]}if(this.isGroupedProduct()){var n=[];return this.formElement.querySelectorAll('input[type="number"]').forEach(function(e){if(e.value){var r=e.getAttribute("name").match(/quantity\[([\d]*)\]/);if(2===r.length){var o=parseInt(r[1]),i=parseInt(e.value);n.push(new ze(o,i,null,t.extraFields()))}}}),n}var r=document.querySelector('[name="add-to-cart"]').value,o=document.querySelector('[name="quantity"]').value,i=this.variations();return[new ze(r,o,i,this.extraFields())]}},{key:"extraFields",value:function(){return Mn.getFilteredFields(this.formElement,["add-to-cart","quantity","product_id","variation_id"],["attribute_","wc_bookings_field"])}},{key:"createOrder",value:function(){var t=this;return this.cartHelper=null,function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.errorHandler.clear(),t.cartUpdater.update(function(e){t.cartHelper=(new Pn).addFromPurchaseUnits(e);var n=vn(),r=void 0!==t.config.bn_codes[t.config.context]?t.config.bn_codes[t.config.context]:"";return fetch(t.config.ajax.create_order.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:t.config.ajax.create_order.nonce,purchase_units:e,payer:n,bn_code:r,payment_method:vt,funding_source:window.ppcpFundingSource,context:t.config.context})}).then(function(t){return t.json()}).then(function(t){if(!t.success)throw console.error(t),Error(t.data.message);return t.data.id})},t.getProducts(),r.updateCartOptions||{})}}},{key:"updateCart",value:function(t){return this.cartUpdater.update(function(t){return t},this.getProducts(),t)}},{key:"variations",value:function(){return this.hasVariations()?function(t){return function(t){if(Array.isArray(t))return Un(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Un(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Un(t,e):void 0}}(t)||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.")}()}(this.formElement.querySelectorAll("[name^='attribute_']")).map(function(t){return{value:t.value,name:t.name}}):null}},{key:"hasVariations",value:function(){return this.formElement.classList.contains("variations_form")}},{key:"isGroupedProduct",value:function(){return this.formElement.classList.contains("grouped_form")}},{key:"isBookingProduct",value:function(){return!!this.formElement.querySelector(".wc-booking-product-id")}},{key:"cleanCart",value:function(){var t=this;this.cartHelper.removeFromCart().then(function(){t.refreshMiniCart()}).catch(function(e){t.refreshMiniCart()})}},{key:"refreshMiniCart",value:function(){jQuery(document.body).trigger("wc_fragment_refresh")}}])}();const Vn=zn;function Jn(t){return Jn="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},Jn(t)}function $n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Kn(r.key),r)}}function Kn(t){var e=function(t){if("object"!=Jn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Jn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Jn(e)?e:e+""}var Xn=function(){return function(t,e){return e&&$n(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.endpoint=e,this.nonce=n},[{key:"simulate",value:function(t,e){var n=this;return new Promise(function(r,o){fetch(n.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:n.nonce,products:e})}).then(function(t){return t.json()}).then(function(e){if(e.success){var n=t(e.data);r(n)}else o(e.data)})})}}])}();const Yn=Xn;function Zn(t){return Zn="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},Zn(t)}function tr(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function er(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?tr(Object(n),!0).forEach(function(e){nr(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tr(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function nr(t,e,n){return(e=or(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function rr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,or(r.key),r)}}function or(t){var e=function(t){if("object"!=Zn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Zn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Zn(e)?e:e+""}var ir=function(){return function(t,e){return e&&rr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.endpoint=e,this.nonce=n},[{key:"update",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(function(o,i){fetch(n.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(er({nonce:n.nonce,products:e},r))}).then(function(t){return t.json()}).then(function(e){if(e.success){var n=t(e.data);o(n)}else i(e.data)})})}}])}();const ar=ir;function ur(t){return ur="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},ur(t)}function cr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,lr(r.key),r)}}function lr(t){var e=function(t){if("object"!=ur(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ur(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ur(e)?e:e+""}var sr=function(){return function(t,e){return e&&cr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e,this.errorHandler=n},[{key:"subscriptionsConfiguration",value:function(t){var e=this;return{createSubscription:function(e,n){return n.subscription.create({plan_id:t})},onApprove:function(t){fetch(e.config.ajax.approve_subscription.endpoint,{method:"POST",credentials:"same-origin",body:JSON.stringify({nonce:e.config.ajax.approve_subscription.nonce,order_id:t.orderID,subscription_id:t.subscriptionID,should_create_wc_order:!e.config.vaultingEnabled||"venmo"!==t.paymentSource})}).then(function(t){return t.json()}).then(function(t){var n;if(!t.success)throw Error(t.data.message);var r=null===(n=t.data)||void 0===n?void 0:n.order_received_url;location.href=r||e.config.redirect})},onError:function(t){console.error(t)}}}},{key:"configuration",value:function(){var t=this;return{createOrder:function(){var e=vn(),n=void 0!==t.config.bn_codes[t.config.context]?t.config.bn_codes[t.config.context]:"";return fetch(t.config.ajax.create_order.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:t.config.ajax.create_order.nonce,purchase_units:[],payment_method:vt,funding_source:window.ppcpFundingSource,bn_code:n,payer:e,context:t.config.context})}).then(function(t){return t.json()}).then(function(t){if(!t.success)throw console.error(t),Error(t.data.message);return t.data.id})},onApprove:fn(this,this.errorHandler),onCancel:function(){Wn.reloadButtonsIfRequired(t.config.button.wrapper)},onError:function(){t.errorHandler.genericError(),Wn.reloadButtonsIfRequired(t.config.button.wrapper)}}}}])}();const fr=sr;function pr(t){return pr="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},pr(t)}function yr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,dr(r.key),r)}}function dr(t){var e=function(t){if("object"!=pr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=pr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==pr(e)?e:e+""}var hr=function(){return function(t,e){return e&&yr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.buttonConfig=e,this.ppcpConfig=n},[{key:"isVaultV3Mode",value:function(){var t,e,n;return(null===(t=this.ppcpConfig)||void 0===t||null===(t=t.save_payment_methods)||void 0===t?void 0:t.id_token)&&!(null!==(e=this.ppcpConfig)&&void 0!==e&&null!==(e=e.data_client_id)&&void 0!==e&&e.paypal_subscriptions_enabled)&&(null===(n=this.ppcpConfig)||void 0===n?void 0:n.can_save_vault_token)}},{key:"validateContext",value:function(){var t;return null===(t=this.ppcpConfig)||void 0===t||null===(t=t.locations_with_subscription_product)||void 0===t||!t.cart||this.isVaultV3Mode()}},{key:"shippingAllowed",value:function(){return this.buttonConfig.product.needShipping}},{key:"transactionInfo",value:function(){var t=this;return new Promise(function(e,n){var r=t.ppcpConfig.ajax.cart_script_params.endpoint,o=-1!==r.indexOf("?")?"&":"?";fetch(r+o+"shipping=1",{method:"GET",credentials:"same-origin"}).then(function(t){return t.json()}).then(function(t){if(t.success){var n=t.data;e({countryCode:n.country_code,currencyCode:n.currency_code,totalPriceStatus:"FINAL",totalPrice:n.total_str,chosenShippingMethods:n.chosen_shipping_methods||null,shippingPackages:n.shipping_packages||null})}})})}},{key:"createOrder",value:function(){return this.actionHandler().configuration().createOrder(null,null)}},{key:"approveOrder",value:function(t,e){return this.actionHandler().configuration().onApprove(t,e)}},{key:"actionHandler",value:function(){return new fr(this.ppcpConfig,this.errorHandler())}},{key:"errorHandler",value:function(){return new Z(this.ppcpConfig.labels.error.generic,document.querySelector(".woocommerce-notices-wrapper"))}}])}();const br=hr;function vr(t){return vr="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},vr(t)}function mr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,gr(r.key),r)}}function gr(t){var e=function(t){if("object"!=vr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=vr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==vr(e)?e:e+""}function wr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(wr=function(){return!!t})()}function Sr(t){return Sr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Sr(t)}function jr(t,e){return jr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jr(t,e)}var _r=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=Sr(e),function(t,e){if(e&&("object"==vr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,wr()?Reflect.construct(e,n||[],Sr(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jr(t,e)}(e,t),function(t,e){return e&&mr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"validateContext",value:function(){var t;return null===(t=this.ppcpConfig)||void 0===t||null===(t=t.locations_with_subscription_product)||void 0===t||!t.product||this.isVaultV3Mode()}},{key:"transactionInfo",value:function(){var t=this,e=new Z(this.ppcpConfig.labels.error.generic,document.querySelector(".woocommerce-notices-wrapper")),n=new Vn(null,null,document.querySelector("form.cart"),e),r=PayPalCommerceGateway.data_client_id.has_subscriptions&&PayPalCommerceGateway.data_client_id.paypal_subscriptions_enabled?n.getSubscriptionProducts():n.getProducts();return new Promise(function(e,n){new Yn(t.ppcpConfig.ajax.simulate_cart.endpoint,t.ppcpConfig.ajax.simulate_cart.nonce).simulate(function(t){e({countryCode:t.country_code,currencyCode:t.currency_code,totalPriceStatus:"FINAL",totalPrice:t.total})},r)})}},{key:"createOrder",value:function(){return this.actionHandler().configuration().createOrder(null,null,{updateCartOptions:{keepShipping:!0}})}},{key:"actionHandler",value:function(){return new Vn(this.ppcpConfig,new ar(this.ppcpConfig.ajax.change_cart.endpoint,this.ppcpConfig.ajax.change_cart.nonce),document.querySelector("form.cart"),this.errorHandler())}},{key:"products",value:function(){return this.actionHandler().getProducts()}}])}(br);const Or=_r;function Pr(t){return Pr="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},Pr(t)}function kr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(kr=function(){return!!t})()}function Er(t){return Er=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Er(t)}function Cr(t,e){return Cr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Cr(t,e)}var Ar=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=Er(e),function(t,e){if(e&&("object"==Pr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,kr()?Reflect.construct(e,n||[],Er(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Cr(t,e)}(e,t),function(t){return Object.defineProperty(t,"prototype",{writable:!1}),t}(e)}(br);const Tr=Ar;!function(){var t;function e(t){var e=0;return function(){return e<t.length?{done:!1,value:t[e++]}:{done:!0}}}var n,r="function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,n){return t==Array.prototype||t==Object.prototype||(t[e]=n.value),t},o=function(t){t=["object"==typeof globalThis&&globalThis,t,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof globalThis&&globalThis];for(var e=0;e<t.length;++e){var n=t[e];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);function i(t,e){if(e)t:{var n=o;t=t.split(".");for(var i=0;i<t.length-1;i++){var a=t[i];if(!(a in n))break t;n=n[a]}(e=e(i=n[t=t[t.length-1]]))!=i&&null!=e&&r(n,t,{configurable:!0,writable:!0,value:e})}}function a(t){return(t={next:t})[Symbol.iterator]=function(){return this},t}function u(t){var n="undefined"!=typeof Symbol&&Symbol.iterator&&t[Symbol.iterator];return n?n.call(t):{next:e(t)}}if(i("Symbol",function(t){function e(t,e){this.A=t,r(this,"description",{configurable:!0,writable:!0,value:e})}if(t)return t;e.prototype.toString=function(){return this.A};var n="jscomp_symbol_"+(1e9*Math.random()>>>0)+"_",o=0;return function t(r){if(this instanceof t)throw new TypeError("Symbol is not a constructor");return new e(n+(r||"")+"_"+o++,r)}}),i("Symbol.iterator",function(t){if(t)return t;t=Symbol("Symbol.iterator");for(var n="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),i=0;i<n.length;i++){var u=o[n[i]];"function"==typeof u&&"function"!=typeof u.prototype[t]&&r(u.prototype,t,{configurable:!0,writable:!0,value:function(){return a(e(this))}})}return t}),"function"==typeof Object.setPrototypeOf)n=Object.setPrototypeOf;else{var c;t:{var l={};try{l.__proto__={a:!0},c=l.a;break t}catch(t){}c=!1}n=c?function(t,e){if(t.__proto__=e,t.__proto__!==e)throw new TypeError(t+" is not extensible");return t}:null}var s=n;function f(){this.m=!1,this.j=null,this.v=void 0,this.h=1,this.u=this.C=0,this.l=null}function p(t){if(t.m)throw new TypeError("Generator is already running");t.m=!0}function y(t,e){return t.h=3,{value:e}}function d(t){this.g=new f,this.G=t}function h(t,e,n,r){try{var o=e.call(t.g.j,n);if(!(o instanceof Object))throw new TypeError("Iterator result "+o+" is not an object");if(!o.done)return t.g.m=!1,o;var i=o.value}catch(e){return t.g.j=null,t.g.s(e),b(t)}return t.g.j=null,r.call(t.g,i),b(t)}function b(t){for(;t.g.h;)try{var e=t.G(t.g);if(e)return t.g.m=!1,{value:e.value,done:!1}}catch(e){t.g.v=void 0,t.g.s(e)}if(t.g.m=!1,t.g.l){if(e=t.g.l,t.g.l=null,e.F)throw e.D;return{value:e.return,done:!0}}return{value:void 0,done:!0}}function v(t){this.next=function(e){return t.o(e)},this.throw=function(e){return t.s(e)},this.return=function(e){return function(t,e){p(t.g);var n=t.g.j;return n?h(t,"return"in n?n.return:function(t){return{value:t,done:!0}},e,t.g.return):(t.g.return(e),b(t))}(t,e)},this[Symbol.iterator]=function(){return this}}function m(t,e){return e=new v(new d(e)),s&&t.prototype&&s(e,t.prototype),e}if(f.prototype.o=function(t){this.v=t},f.prototype.s=function(t){this.l={D:t,F:!0},this.h=this.C||this.u},f.prototype.return=function(t){this.l={return:t},this.h=this.u},d.prototype.o=function(t){return p(this.g),this.g.j?h(this,this.g.j.next,t,this.g.o):(this.g.o(t),b(this))},d.prototype.s=function(t){return p(this.g),this.g.j?h(this,this.g.j.throw,t,this.g.o):(this.g.s(t),b(this))},i("Array.prototype.entries",function(t){return t||function(){return function(t,e){t instanceof String&&(t+="");var n=0,r=!1,o={next:function(){if(!r&&n<t.length){var o=n++;return{value:e(o,t[o]),done:!1}}return r=!0,{done:!0,value:void 0}}};return o[Symbol.iterator]=function(){return o},o}(this,function(t,e){return[t,e]})}}),"undefined"!=typeof Blob&&("undefined"==typeof FormData||!FormData.prototype.keys)){var g=function(t,e){for(var n=0;n<t.length;n++)e(t[n])},w=function(t){return t.replace(/\r?\n|\r/g,"\r\n")},S=function(t,e,n){return e instanceof Blob?(n=void 0!==n?String(n+""):"string"==typeof e.name?e.name:"blob",e.name===n&&"[object Blob]"!==Object.prototype.toString.call(e)||(e=new File([e],n)),[String(t),e]):[String(t),String(e)]},j=function(t,e){if(t.length<e)throw new TypeError(e+" argument required, but only "+t.length+" present.")},_="object"==typeof globalThis?globalThis:"object"==typeof window?window:"object"==typeof self?self:this,O=_.FormData,P=_.XMLHttpRequest&&_.XMLHttpRequest.prototype.send,k=_.Request&&_.fetch,E=_.navigator&&_.navigator.sendBeacon,C=_.Element&&_.Element.prototype,A=_.Symbol&&Symbol.toStringTag;A&&(Blob.prototype[A]||(Blob.prototype[A]="Blob"),"File"in _&&!File.prototype[A]&&(File.prototype[A]="File"));try{new File([],"")}catch(t){_.File=function(t,e,n){return t=new Blob(t,n||{}),Object.defineProperties(t,{name:{value:e},lastModified:{value:+(n&&void 0!==n.lastModified?new Date(n.lastModified):new Date)},toString:{value:function(){return"[object File]"}}}),A&&Object.defineProperty(t,A,{value:"File"}),t}}var T=function(t){return t.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22")},x=function(t){this.i=[];var e=this;t&&g(t.elements,function(t){if(t.name&&!t.disabled&&"submit"!==t.type&&"button"!==t.type&&!t.matches("form fieldset[disabled] *"))if("file"===t.type){var n=t.files&&t.files.length?t.files:[new File([],"",{type:"application/octet-stream"})];g(n,function(n){e.append(t.name,n)})}else"select-multiple"===t.type||"select-one"===t.type?g(t.options,function(n){!n.disabled&&n.selected&&e.append(t.name,n.value)}):"checkbox"===t.type||"radio"===t.type?t.checked&&e.append(t.name,t.value):(n="textarea"===t.type?w(t.value):t.value,e.append(t.name,n))})};if((t=x.prototype).append=function(t,e,n){j(arguments,2),this.i.push(S(t,e,n))},t.delete=function(t){j(arguments,1);var e=[];t=String(t),g(this.i,function(n){n[0]!==t&&e.push(n)}),this.i=e},t.entries=function t(){var e,n=this;return m(t,function(t){if(1==t.h&&(e=0),3!=t.h)return e<n.i.length?t=y(t,n.i[e]):(t.h=0,t=void 0),t;e++,t.h=2})},t.forEach=function(t,e){j(arguments,1);for(var n=u(this),r=n.next();!r.done;r=n.next()){var o=u(r.value);r=o.next().value,o=o.next().value,t.call(e,o,r,this)}},t.get=function(t){j(arguments,1);var e=this.i;t=String(t);for(var n=0;n<e.length;n++)if(e[n][0]===t)return e[n][1];return null},t.getAll=function(t){j(arguments,1);var e=[];return t=String(t),g(this.i,function(n){n[0]===t&&e.push(n[1])}),e},t.has=function(t){j(arguments,1),t=String(t);for(var e=0;e<this.i.length;e++)if(this.i[e][0]===t)return!0;return!1},t.keys=function t(){var e,n,r,o=this;return m(t,function(t){if(1==t.h&&(e=u(o),n=e.next()),3!=t.h)return n.done?void(t.h=0):(r=n.value,y(t,u(r).next().value));n=e.next(),t.h=2})},t.set=function(t,e,n){j(arguments,2),t=String(t);var r=[],o=S(t,e,n),i=!0;g(this.i,function(e){e[0]===t?i&&(i=!r.push(o)):r.push(e)}),i&&r.push(o),this.i=r},t.values=function t(){var e,n,r,o,i=this;return m(t,function(t){if(1==t.h&&(e=u(i),n=e.next()),3!=t.h)return n.done?void(t.h=0):(r=n.value,(o=u(r)).next(),y(t,o.next().value));n=e.next(),t.h=2})},x.prototype._asNative=function(){for(var t=new O,e=u(this),n=e.next();!n.done;n=e.next()){var r=u(n.value);n=r.next().value,r=r.next().value,t.append(n,r)}return t},x.prototype._blob=function(){var t="----formdata-polyfill-"+Math.random(),e=[],n="--"+t+'\r\nContent-Disposition: form-data; name="';return this.forEach(function(t,r){return"string"==typeof t?e.push(n+T(w(r))+'"\r\n\r\n'+w(t)+"\r\n"):e.push(n+T(w(r))+'"; filename="'+T(t.name)+'"\r\nContent-Type: '+(t.type||"application/octet-stream")+"\r\n\r\n",t,"\r\n")}),e.push("--"+t+"--"),new Blob(e,{type:"multipart/form-data; boundary="+t})},x.prototype[Symbol.iterator]=function(){return this.entries()},x.prototype.toString=function(){return"[object FormData]"},C&&!C.matches&&(C.matches=C.matchesSelector||C.mozMatchesSelector||C.msMatchesSelector||C.oMatchesSelector||C.webkitMatchesSelector||function(t){for(var e=(t=(this.document||this.ownerDocument).querySelectorAll(t)).length;0<=--e&&t.item(e)!==this;);return-1<e}),A&&(x.prototype[A]="FormData"),P){var I=_.XMLHttpRequest.prototype.setRequestHeader;_.XMLHttpRequest.prototype.setRequestHeader=function(t,e){I.call(this,t,e),"content-type"===t.toLowerCase()&&(this.B=!0)},_.XMLHttpRequest.prototype.send=function(t){t instanceof x?(t=t._blob(),this.B||this.setRequestHeader("Content-Type",t.type),P.call(this,t)):P.call(this,t)}}k&&(_.fetch=function(t,e){return e&&e.body&&e.body instanceof x&&(e.body=e.body._blob()),k.call(this,t,e)}),E&&(_.navigator.sendBeacon=function(t,e){return e instanceof x&&(e=e._asNative()),E.call(this,t,e)}),_.FormData=x}}();function xr(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return Ir(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Ir(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,Ir(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,Ir(f,"constructor",l),Ir(l,"constructor",c),c.displayName="GeneratorFunction",Ir(l,o,"GeneratorFunction"),Ir(f),Ir(f,o,"Generator"),Ir(f,r,function(){return this}),Ir(f,"toString",function(){return"[object Generator]"}),(xr=function(){return{w:i,m:p}})()}function Ir(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Ir=function(t,e,n,r){function i(e,n){Ir(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},Ir(t,e,n,r)}function Mr(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}const Br=function(t){return new Promise(function(){var e,n=(e=xr().m(function e(n,r){var o,i,a,u,c;return xr().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,o=new sn,i=new Z(t.labels.error.generic,document.querySelector(".woocommerce-notices-wrapper")),a="checkout"===t.context?"form.checkout":"form#order_review",u=t.early_checkout_validation_enabled?new J(t.ajax.validate_checkout.endpoint,t.ajax.validate_checkout.nonce):null){e.n=1;break}return n(),e.a(2);case 1:u.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()]),r()):n()}),e.n=3;break;case 2:e.p=2,c=e.v,console.error(c),r();case 3:return e.a(2)}},e,null,[[0,2]])}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(t){Mr(i,r,o,a,u,"next",t)}function u(t){Mr(i,r,o,a,u,"throw",t)}a(void 0)})});return function(_x,t){return n.apply(this,arguments)}}())};function Rr(t){return Rr="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},Rr(t)}function Dr(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return Fr(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Fr(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,Fr(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,Fr(f,"constructor",l),Fr(l,"constructor",c),c.displayName="GeneratorFunction",Fr(l,o,"GeneratorFunction"),Fr(f),Fr(f,o,"Generator"),Fr(f,r,function(){return this}),Fr(f,"toString",function(){return"[object Generator]"}),(Dr=function(){return{w:i,m:p}})()}function Fr(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Fr=function(t,e,n,r){function i(e,n){Fr(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},Fr(t,e,n,r)}function qr(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function Gr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Hr(r.key),r)}}function Hr(t){var e=function(t){if("object"!=Rr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Rr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Rr(e)?e:e+""}var Wr=function(){return function(t,e){return e&&Gr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e,this.errorHandler=n,this.spinner=r},[{key:"subscriptionsConfiguration",value:function(t){var e,n,r=this;return{createSubscription:(e=Dr().m(function e(n,o){return Dr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,Br(r.config);case 1:e.n=3;break;case 2:throw e.p=2,e.v,{type:"form-validation-error"};case 3:return e.a(2,o.subscription.create({plan_id:t}))}},e,null,[[0,2]])}),n=function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(t){qr(i,r,o,a,u,"next",t)}function u(t){qr(i,r,o,a,u,"throw",t)}a(void 0)})},function(_x,t){return n.apply(this,arguments)}),onApprove:function(t,e){fetch(r.config.ajax.approve_subscription.endpoint,{method:"POST",credentials:"same-origin",body:JSON.stringify({nonce:r.config.ajax.approve_subscription.nonce,order_id:t.orderID,subscription_id:t.subscriptionID})}).then(function(t){return t.json()}).then(function(t){document.querySelector("#place_order").click()})},onError:function(t){console.error(t)}}}},{key:"configuration",value:function(){var t,e,n=this,r=this.spinner;return{createOrder:function(t,e){var o,i=vn(),a=void 0!==n.config.bn_codes[n.config.context]?n.config.bn_codes[n.config.context]:"",u=n.errorHandler,c="checkout"===n.config.context?"form.checkout":"form#order_review",l=new FormData(document.querySelector(c)),s=!!jQuery("#createaccount").is(":checked"),f=gt(),p=window.ppcpFundingSource,y=!(null===(o=document.getElementById("wc-ppcp-credit-card-gateway-new-payment-method"))||void 0===o||!o.checked);return fetch(n.config.ajax.create_order.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:n.config.ajax.create_order.nonce,payer:i,bn_code:a,context:n.config.context,order_id:n.config.order_id,order_key:n.config.order_key,payment_method:f,funding_source:p,form_encoded:new URLSearchParams(l).toString(),createaccount:s,save_payment_method:y})}).then(function(t){return t.json()}).then(function(t){if(!t.success){if(r.unblock(),void 0!==t.messages){var e=new DOMParser;u.appendPreparedErrorMessageElement(e.parseFromString(t.messages,"text/html").querySelector("ul"))}else{var n,o;u.clear(),t.data.refresh&&jQuery(document.body).trigger("update_checkout"),(null===(n=t.data.errors)||void 0===n?void 0:n.length)>0?u.messages(t.data.errors):(null===(o=t.data.details)||void 0===o?void 0:o.length)>0?u.message(t.data.details.map(function(t){return"".concat(t.issue," ").concat(t.description)}).join("<br/>")):u.message(t.data.message),jQuery(document.body).trigger("checkout_error",[u.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(c).appendChild(i),t.data.id})},onApprove:(t=this,e=this.errorHandler,function(n,r){var o=sn.fullPage();return o.block(),e.clear(),Wn.isResumeFlow()&&Wn.cleanHashParams(),fetch(t.config.ajax.approve_order.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:t.config.ajax.approve_order.nonce,order_id:n.orderID,funding_source:window.ppcpFundingSource})}).then(function(t){return t.json()}).then(function(t){if(!t.success){if(100===t.data.code?e.message(t.data.message):e.genericError(),void 0!==r&&void 0!==r.restart)return r.restart();throw new Error(t.data.message)}gt().startsWith("ppcp-")||jQuery('input[name="payment_method"][value="'.concat(vt,'"]')).prop("checked",!0),document.querySelector("#place_order").click()}).finally(function(){o.unblock()})}),onCancel:function(){r.unblock(),Wn.reloadButtonsIfRequired(n.config.button.wrapper)},onError:function(t){console.error(t),r.unblock(),t&&"create-order-error"===t.type||(n.errorHandler.genericError(),Wn.reloadButtonsIfRequired(n.config.button.wrapper))}}}}])}();const Nr=Wr;function Ur(t){return Ur="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},Ur(t)}function Lr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Qr(r.key),r)}}function Qr(t){var e=function(t){if("object"!=Ur(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ur(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ur(e)?e:e+""}function zr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(zr=function(){return!!t})()}function Vr(t){return Vr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vr(t)}function Jr(t,e){return Jr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Jr(t,e)}var $r=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=Vr(e),function(t,e){if(e&&("object"==Ur(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,zr()?Reflect.construct(e,n||[],Vr(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Jr(t,e)}(e,t),function(t,e){return e&&Lr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"actionHandler",value:function(){return new Nr(this.ppcpConfig,this.errorHandler(),new sn)}}])}(br);const Kr=$r;function Xr(t){return Xr="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},Xr(t)}function Yr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Yr=function(){return!!t})()}function Zr(t){return Zr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zr(t)}function to(t,e){return to=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},to(t,e)}var eo=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=Zr(e),function(t,e){if(e&&("object"==Xr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Yr()?Reflect.construct(e,n||[],Zr(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&to(t,e)}(e,t),function(t){return Object.defineProperty(t,"prototype",{writable:!1}),t}(e)}(br);const no=eo;function ro(t){return ro="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},ro(t)}function oo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(oo=function(){return!!t})()}function io(t){return io=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},io(t)}function ao(t,e){return ao=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ao(t,e)}var uo=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=io(e),function(t,e){if(e&&("object"==ro(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,oo()?Reflect.construct(e,n||[],io(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ao(t,e)}(e,t),function(t){return Object.defineProperty(t,"prototype",{writable:!1}),t}(e)}(br);const co=uo;function lo(t){return lo="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},lo(t)}function so(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(so=function(){return!!t})()}function fo(t){return fo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fo(t)}function po(t,e){return po=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},po(t,e)}var yo=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=fo(e),function(t,e){if(e&&("object"==lo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,so()?Reflect.construct(e,n||[],fo(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&po(t,e)}(e,t),function(t){return Object.defineProperty(t,"prototype",{writable:!1}),t}(e)}(br);const ho=yo;function bo(t){return bo="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},bo(t)}function vo(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,mo(r.key),r)}}function mo(t){var e=function(t){if("object"!=bo(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=bo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==bo(e)?e:e+""}function go(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(go=function(){return!!t})()}function wo(t){return wo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wo(t)}function So(t,e){return So=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},So(t,e)}var jo=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=wo(e),function(t,e){if(e&&("object"==bo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,go()?Reflect.construct(e,n||[],wo(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&So(t,e)}(e,t),function(t,e){return e&&vo(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"transactionInfo",value:function(){return{countryCode:"US",currencyCode:"USD",totalPrice:"10.00",totalPriceStatus:"FINAL"}}},{key:"createOrder",value:function(){throw new Error("Create order fail. This is just a preview.")}},{key:"approveOrder",value:function(){throw new Error("Approve order fail. This is just a preview.")}},{key:"actionHandler",value:function(){throw new Error("Action handler fail. This is just a preview.")}},{key:"errorHandler",value:function(){throw new Error("Error handler fail. This is just a preview.")}}])}(br);const _o=jo;function Oo(t){return Oo="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},Oo(t)}function Po(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return ko(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(ko(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,ko(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,ko(f,"constructor",l),ko(l,"constructor",c),c.displayName="GeneratorFunction",ko(l,o,"GeneratorFunction"),ko(f),ko(f,o,"Generator"),ko(f,r,function(){return this}),ko(f,"toString",function(){return"[object Generator]"}),(Po=function(){return{w:i,m:p}})()}function ko(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}ko=function(t,e,n,r){function i(e,n){ko(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},ko(t,e,n,r)}function Eo(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function Co(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ao(r.key),r)}}function Ao(t){var e=function(t){if("object"!=Oo(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Oo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Oo(e)?e:e+""}function To(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(To=function(){return!!t})()}function xo(t){return xo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xo(t)}function Io(t,e){return Io=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Io(t,e)}var Mo=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=xo(e),function(t,e){if(e&&("object"==Oo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,To()?Reflect.construct(e,n||[],xo(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Io(t,e)}(e,t),function(t,e){return e&&Co(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"validateContext",value:function(){var t;return null===(t=this.ppcpConfig)||void 0===t||null===(t=t.locations_with_subscription_product)||void 0===t||!t.payorder||this.isVaultV3Mode()}},{key:"transactionInfo",value:function(){var t=this;return new Promise(function(){var e,n=(e=Po().m(function e(n,r){var o;return Po().w(function(e){for(;;)switch(e.n){case 0:o=t.ppcpConfig.pay_now,n({countryCode:o.country_code,currencyCode:o.currency_code,totalPriceStatus:"FINAL",totalPrice:o.total_str});case 1:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(t){Eo(i,r,o,a,u,"next",t)}function u(t){Eo(i,r,o,a,u,"throw",t)}a(void 0)})});return function(_x,t){return n.apply(this,arguments)}}())}},{key:"actionHandler",value:function(){return new Nr(this.ppcpConfig,this.errorHandler(),new sn)}}])}(br);const Bo=Mo;function Ro(t){return Ro="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},Ro(t)}function Do(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Fo(r.key),r)}}function Fo(t){var e=function(t){if("object"!=Ro(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ro(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ro(e)?e:e+""}var qo=function(){return function(t,e,n){return n&&Do(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},0,[{key:"create",value:function(t,e,n){switch(t){case"product":return new Or(e,n);case"cart":return new Tr(e,n);case"checkout":return new Kr(e,n);case"pay-now":return new Bo(e,n);case"mini-cart":return new ho(e,n);case"cart-block":return new no(e,n);case"checkout-block":return new co(e,n);case"preview":return new _o(e,n)}}}])}();const Go=qo;function Ho(t){return Ho="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},Ho(t)}function Wo(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return No(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?No(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}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 o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function No(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Uo(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return Lo(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Lo(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,Lo(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,Lo(f,"constructor",l),Lo(l,"constructor",c),c.displayName="GeneratorFunction",Lo(l,o,"GeneratorFunction"),Lo(f),Lo(f,o,"Generator"),Lo(f,r,function(){return this}),Lo(f,"toString",function(){return"[object Generator]"}),(Uo=function(){return{w:i,m:p}})()}function Lo(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Lo=function(t,e,n,r){function i(e,n){Lo(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},Lo(t,e,n,r)}function Qo(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function zo(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){Qo(i,r,o,a,u,"next",t)}function u(t){Qo(i,r,o,a,u,"throw",t)}a(void 0)})}}function Vo(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Jo(r.key),r)}}function Jo(t){var e=function(t){if("object"!=Ho(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ho(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ho(e)?e:e+""}var $o=function(){return function(t,e){return e&&Vo(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n,r){var o=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.namespace=e,this.buttonConfig=n,this.ppcpConfig=r,this.buttonAttributes=i,this.applePayConfig=null,this.transactionInfo=null,this.contextHandler=null,this.buttons=[],G.watchContextBootstrap(function(){var t=zo(Uo().m(function t(e){var i,a;return Uo().w(function(t){for(;;)switch(t.n){case 0:if(o.contextHandler=Go.create(e.context,n,r,e.handler),i=We.createButton(e.context,e.handler,n,r,o.contextHandler,o.buttonAttributes),o.buttons.push(i),a=function(){i.configure(o.applePayConfig,o.transactionInfo,o.buttonAttributes),i.init()},!o.applePayConfig||!o.transactionInfo){t.n=1;break}a(),t.n=3;break;case 1:return t.n=2,o.init();case 2:o.applePayConfig&&o.transactionInfo&&a();case 3:return t.a(2)}},t)}));return function(_x){return t.apply(this,arguments)}}())},[{key:"init",value:(e=zo(Uo().m(function t(){var e,n,r,o;return Uo().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,this.applePayConfig){t.n=2;break}return t.n=1,window[this.namespace].Applepay().config();case 1:this.applePayConfig=t.v;case 2:if(this.transactionInfo){t.n=4;break}return t.n=3,this.fetchTransactionInfo();case 3:this.transactionInfo=t.v;case 4:if(this.applePayConfig)if(this.transactionInfo){e=Wo(this.buttons);try{for(e.s();!(n=e.n()).done;)(r=n.value).configure(this.applePayConfig,this.transactionInfo,this.buttonAttributes),r.init()}catch(t){e.e(t)}finally{e.f()}}else console.error("No transactionInfo found during init");else console.error("No ApplePayConfig received during init");t.n=6;break;case 5:t.p=5,o=t.v,console.error("Error during initialization:",o);case 6:return t.a(2)}},t,this,[[0,5]])})),function(){return e.apply(this,arguments)})},{key:"fetchTransactionInfo",value:(t=zo(Uo().m(function t(){var e;return Uo().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,this.contextHandler){t.n=1;break}throw new Error("ContextHandler is not initialized");case 1:return t.n=2,this.contextHandler.transactionInfo();case 2:return t.a(2,t.v);case 3:throw t.p=3,e=t.v,console.error("Error fetching transaction info:",e),e;case 4:return t.a(2)}},t,this,[[0,3]])})),function(){return t.apply(this,arguments)})},{key:"reinit",value:function(){var t,e=Wo(this.buttons);try{for(e.s();!(t=e.n()).done;)t.value.reinit()}catch(t){e.e(t)}finally{e.f()}}}]);var t,e}();const Ko=$o;!function(t){var e=t.buttonConfig,n=t.ppcpConfig,r="ppcpPaypalApplepay";function o(){!function(){if(e&&n){var t=new Ko(r,e,n);o=function(){t.reinit()},i={timeoutId:null,args:null},u=function(){i.timeoutId&&(o.apply(null,i.args||[]),a())},c=function(){a();for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];i.args=e,i.timeoutId=window.setTimeout(u,50)},c.cancel=a=function(){i.timeoutId&&window.clearTimeout(i.timeoutId),i.timeoutId=null,i.args=null},c.flush=u,l=c,document.addEventListener("ppcp_refresh_payment_buttons",l),window.jQuery("body").on("updated_cart_totals",l).on("updated_checkout",l),setTimeout(function(){document.body.addEventListener("wc_fragments_loaded",l),document.body.addEventListener("wc_fragments_refreshed",l)},1e3)}var o,i,a,u,c,l}()}document.addEventListener("DOMContentLoaded",function(){if(e&&n){var t=n.mini_cart_buttons_enabled,a=null!==document.getElementById(e.button.wrapper);if(t||a){var u=!1,c=!1,l=!1,s=function(){!u&&c&&l&&(u=!0,o())};i({url:e.sdk_url}).then(function(){l=!0,s()}),M(r,n).then(function(){c=!0,s()}).catch(function(t){console.error("Failed to load PayPal script: ",t)})}}else o()})}({buttonConfig:window.wc_ppcp_applepay,ppcpConfig:window.PayPalCommerceGateway})})();
(()=>{"use strict";var t={4744:t=>{var e=function(t){return function(t){return!!t&&"object"==typeof t}(t)&&!function(t){var e=Object.prototype.toString.call(t);return"[object RegExp]"===e||"[object Date]"===e||function(t){return t.$$typeof===n}(t)}(t)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(t,e){return!1!==e.clone&&e.isMergeableObject(t)?u((n=t,Array.isArray(n)?[]:{}),t,e):t;var n}function o(t,e,n){return t.concat(e).map(function(t){return r(t,n)})}function i(t){return Object.keys(t).concat(function(t){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return Object.propertyIsEnumerable.call(t,e)}):[]}(t))}function a(t,e){try{return e in t}catch(t){return!1}}function u(t,n,c){(c=c||{}).arrayMerge=c.arrayMerge||o,c.isMergeableObject=c.isMergeableObject||e,c.cloneUnlessOtherwiseSpecified=r;var l=Array.isArray(n);return l===Array.isArray(t)?l?c.arrayMerge(t,n,c):function(t,e,n){var o={};return n.isMergeableObject(t)&&i(t).forEach(function(e){o[e]=r(t[e],n)}),i(e).forEach(function(i){(function(t,e){return a(t,e)&&!(Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))})(t,i)||(a(t,i)&&n.isMergeableObject(e[i])?o[i]=function(t,e){if(!e.customMerge)return u;var n=e.customMerge(t);return"function"==typeof n?n:u}(i,n)(t[i],e[i],n):o[i]=r(e[i],n))}),o}(t,n,c):r(n,c)}u.all=function(t,e){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(t,n){return u(t,n,e)},{})};var c=u;t.exports=c}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r](i,i.exports,n),i.exports}function r(t,e){void 0===e&&(e={});var n=document.createElement("script");return n.src=t,Object.keys(e).forEach(function(t){n.setAttribute(t,e[t]),"data-csp-nonce"===t&&n.setAttribute("nonce",e["data-csp-nonce"])}),n}function o(t,e){if(void 0===e&&(e=Promise),u(t,e),"undefined"==typeof document)return e.resolve(null);var n=function(t){var e,n,r=t.sdkBaseUrl,o=t.environment,i=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}(t,["sdkBaseUrl","environment"]),a=r||function(t){return"sandbox"===t?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js"}(o),u=i,c=Object.keys(u).filter(function(t){return void 0!==u[t]&&null!==u[t]&&""!==u[t]}).reduce(function(t,e){var n,r=u[e].toString();return n=function(t,e){return(e?"-":"")+t.toLowerCase()},"data"===(e=e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,n)).substring(0,4)||"crossorigin"===e?t.attributes[e]=r:t.queryParams[e]=r,t},{queryParams:{},attributes:{}}),l=c.queryParams,s=c.attributes;return l["merchant-id"]&&-1!==l["merchant-id"].indexOf(",")&&(s["data-merchant-id"]=l["merchant-id"],l["merchant-id"]="*"),{url:"".concat(a,"?").concat((e=l,n="",Object.keys(e).forEach(function(t){0!==n.length&&(n+="&"),n+=t+"="+e[t]}),n)),attributes:s}}(t),o=n.url,c=n.attributes,l=c["data-namespace"]||"paypal",s=a(l);return c["data-js-sdk-library"]||(c["data-js-sdk-library"]="paypal-js"),function(t,e){var n=document.querySelector('script[src="'.concat(t,'"]'));if(null===n)return null;var o=r(t,e),i=n.cloneNode();if(delete i.dataset.uidAuto,Object.keys(i.dataset).length!==Object.keys(o.dataset).length)return null;var a=!0;return Object.keys(i.dataset).forEach(function(t){i.dataset[t]!==o.dataset[t]&&(a=!1)}),a?n:null}(o,c)&&s?e.resolve(s):i({url:o,attributes:c},e).then(function(){var t=a(l);if(t)return t;throw new Error("The window.".concat(l," global variable is not available."))})}function i(t,e){void 0===e&&(e=Promise),u(t,e);var n=t.url,o=t.attributes;if("string"!=typeof n||0===n.length)throw new Error("Invalid url.");if(void 0!==o&&"object"!=typeof o)throw new Error("Expected attributes to be an object.");return new e(function(t,e){if("undefined"==typeof document)return t();var i,a,u,c;a=(i={url:n,attributes:o,onSuccess:function(){return t()},onError:function(){var t=new Error('The script "'.concat(n,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return e(t)}}).onSuccess,u=i.onError,(c=r(i.url,i.attributes)).onerror=u,c.onload=a,document.head.insertBefore(c,document.head.firstElementChild)})}function a(t){return window[t]}function u(t,e){if("object"!=typeof t||null===t)throw new Error("Expected an options object.");var n=t.environment;if(n&&"production"!==n&&"sandbox"!==n)throw new Error('The `environment` option must be either "production" or "sandbox".');if(void 0!==e&&"function"!=typeof e)throw new Error("Expected PromisePonyfill to be a function.")}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),"function"==typeof SuppressedError&&SuppressedError;const c=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;fetch(e.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:e.nonce})}).then(function(t){return t.json()}).then(function(i){var a;(function(t,e){return!(!t||t.user!==e||(new Date).getTime()>=1e3*t.expiration)})(i,e.user)&&(a=i,sessionStorage.setItem("ppcp-data-client-id",JSON.stringify(a)),t["data-client-token"]=i.token,o(t).then(function(t){"function"==typeof n&&n(t)}).catch(function(t){"function"==typeof r&&r(t)}))})};function l(t){return l="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},l(t)}function s(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,l=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||p(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 f(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=p(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}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 o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function p(t,e){if(t){if("string"==typeof t)return y(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(t,e):void 0}}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function d(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,h(r.key),r)}}function h(t){var e=function(t){if("object"!=l(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=l(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==l(e)?e:e+""}var v=function(){return t=function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.paypal=null,this.buttons=new Map,this.messages=new Map,this.renderEventName="ppcp-render",document.ppcpWidgetBuilderStatus=function(){console.log({buttons:e.buttons,messages:e.messages})},jQuery(document).off(this.renderEventName).on(this.renderEventName,function(){e.renderAll()})},(e=[{key:"setPaypal",value:function(t){this.paypal=t,jQuery(document).trigger("ppcp-paypal-loaded",t)}},{key:"registerButtons",value:function(t,e){t=this.sanitizeWrapper(t),this.buttons.set(this.toKey(t),{wrapper:t,options:e})}},{key:"renderButtons",value:function(t){t=this.sanitizeWrapper(t);var e=this.toKey(t);if(this.buttons.has(e)&&!this.hasRendered(t)){var n=this.buttons.get(e),r=this.paypal.Buttons(n.options);if(r.isEligible()){var o=this.buildWrapperTarget(t);o&&(r.hasReturned()?r.resume():r.render(o))}else this.buttons.delete(e)}}},{key:"renderAllButtons",value:function(){var t,e=f(this.buttons);try{for(e.s();!(t=e.n()).done;){var n=s(t.value,1)[0];this.renderButtons(n)}}catch(t){e.e(t)}finally{e.f()}}},{key:"registerMessages",value:function(t,e){this.messages.set(t,{wrapper:t,options:e})}},{key:"renderMessages",value:function(t){var e=this;if(this.messages.has(t)){var n=this.messages.get(t);if(this.hasRendered(t))document.querySelector(t).setAttribute("data-pp-amount",n.options.amount);else{var r=this.paypal.Messages(n.options);r.render(n.wrapper),setTimeout(function(){e.hasRendered(t)||r.render(n.wrapper)},100)}}}},{key:"renderAllMessages",value:function(){var t,e=f(this.messages);try{for(e.s();!(t=e.n()).done;){var n=s(t.value,2),r=n[0];n[1],this.renderMessages(r)}}catch(t){e.e(t)}finally{e.f()}}},{key:"renderAll",value:function(){this.renderAllButtons(),this.renderAllMessages()}},{key:"hasRendered",value:function(t){var e=t;if(Array.isArray(t)){e=t[0];var n,r=f(t.slice(1));try{for(r.s();!(n=r.n()).done;)e+=" .item-"+n.value}catch(t){r.e(t)}finally{r.f()}}var o=document.querySelector(e);return o&&o.hasChildNodes()}},{key:"sanitizeWrapper",value:function(t){return Array.isArray(t)&&1===(t=t.filter(function(t){return!!t})).length&&(t=t[0]),t}},{key:"buildWrapperTarget",value:function(t){var e=t;if(Array.isArray(t)){var n=jQuery(t[0]);if(!n.length)return;var r="item-"+t[1],o=n.find("."+r);o.length||(o=jQuery('<div class="'.concat(r,'"></div>')),n.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}}])&&d(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();window.widgetBuilder=window.widgetBuilder||new v;const b=window.widgetBuilder;var m=n(4744),g=n.n(m),w=function(t){return t.replace(/([-_]\w)/g,function(t){return t[1].toUpperCase()})},S=function(t){var e=function(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[w(n)]=t[n]);return e}(t.url_params);t.script_attributes&&(e=g()(e,t.script_attributes));var n=function(t){var e,n,r=null==t||null===(e=t.save_payment_methods)||void 0===e?void 0:e.id_token;return r&&!0===(null==t||null===(n=t.user)||void 0===n?void 0:n.is_logged)?{"data-user-id-token":r}:{}}(t);return g().all([e,n])};function j(t){return j="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},j(t)}function O(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function P(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?O(Object(n),!0).forEach(function(e){_(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function _(t,e,n){return(e=function(t){var e=function(t){if("object"!=j(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=j(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==j(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function k(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return E(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(E(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,E(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,E(f,"constructor",l),E(l,"constructor",c),c.displayName="GeneratorFunction",E(l,o,"GeneratorFunction"),E(f),E(f,o,"Generator"),E(f,r,function(){return this}),E(f,"toString",function(){return"[object Generator]"}),(k=function(){return{w:i,m:p}})()}function E(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}E=function(t,e,n,r){function i(e,n){E(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},E(t,e,n,r)}function C(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function T(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){C(i,r,o,a,u,"next",t)}function u(t){C(i,r,o,a,u,"throw",t)}a(void 0)})}}var A=new Map,x=new Map,I=function(){var t=T(k().m(function t(e,n){var r;return k().w(function(t){for(;;)switch(t.n){case 0:if(null===(r=n.data_client_id)||void 0===r||!r.set_attribute||!0===n.vault_v3_enabled){t.n=1;break}return t.a(2,new Promise(function(t,r){c(e,n.data_client_id,function(e){b.setPaypal(e),t(e)},r)}));case 1:return t.a(2,null)}},t)}));return function(_x,e){return t.apply(this,arguments)}}(),M=function(){var t=T(k().m(function t(e,n){var r,i,a;return k().w(function(t){for(;;)switch(t.n){case 0:if(e){t.n=1;break}throw new Error("Namespace is required");case 1:if(!A.has(e)){t.n=2;break}return console.log("Script already loaded for namespace: ".concat(e)),t.a(2,A.get(e));case 2:if(!x.has(e)){t.n=3;break}return console.log("Script loading in progress for namespace: ".concat(e)),t.a(2,x.get(e));case 3:return r=P(P({},S(n)),{},{"data-namespace":e}),t.n=4,I(r,n);case 4:if(!(i=t.v)){t.n=5;break}return t.a(2,i);case 5:return a=new Promise(function(t,n){o(r).then(function(n){b.setPaypal(n),A.set(e,n),console.log("Script loaded for namespace: ".concat(e)),t(n)}).catch(function(t){console.error("Failed to load script for namespace: ".concat(e),t),n(t)}).finally(function(){x.delete(e)})}),x.set(e,a),t.a(2,a)}},t)}));return function(e,n){return t.apply(this,arguments)}}();function R(t){return R="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},R(t)}function D(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function B(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,F(r.key),r)}}function F(t){var e=function(t){if("object"!=R(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=R(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==R(e)?e:e+""}var G=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.contextBootstrapRegistry={},this.contextBootstrapWatchers=[]},(e=[{key:"watchContextBootstrap",value:function(t){this.contextBootstrapWatchers.push(t),Object.values(this.contextBootstrapRegistry).forEach(t)}},{key:"registerContextBootstrap",value:function(t,e){this.contextBootstrapRegistry[t]={context:t,handler:e};var n,r=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return D(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?D(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}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 o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}(this.contextBootstrapWatchers);try{for(r.s();!(n=r.n()).done;)(0,n.value)(this.contextBootstrapRegistry[t])}catch(t){r.e(t)}finally{r.f()}}}])&&B(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();window.ppcpResources=window.ppcpResources||{};const H=window.ppcpResources.ButtonModuleWatcher=window.ppcpResources.ButtonModuleWatcher||new G;function q(t){return q="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},q(t)}function N(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function W(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?N(Object(n),!0).forEach(function(e){L(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function L(t,e,n){return(e=function(t){var e=function(t){if("object"!=q(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=q(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==q(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Q=Object.freeze({INVALIDATE:"ppcp_invalidate_methods",RENDER:"ppcp_render_method",REDRAW:"ppcp_redraw_method"});function U(t){return Object.values(Q).includes(t)}function z(t){var e=t.event,n=t.paymentMethod,r=void 0===n?"":n,o=t.callback;if(!U(e))throw new Error("Invalid event: ".concat(e));var i=r?"".concat(e,"-").concat(r):e;document.body.addEventListener(i,o)}function V(t){return V="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},V(t)}function J(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Y(r.key),r)}}function Y(t){var e=function(t){if("object"!=V(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=V(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==V(e)?e:e+""}function $(t,e,n){(function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")})(t,e),e.set(t,n)}function K(t,e){return t.get(Z(t,e))}function X(t,e,n){return t.set(Z(t,e),n),n}function Z(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var tt=new WeakMap,et=new WeakMap,nt=new WeakMap,rt=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),$(this,tt,""),$(this,et,!1),$(this,nt,null);for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];n.length&&X(tt,this,"[".concat(n.join(" | "),"]"))},e=[{key:"enabled",set:function(t){X(et,this,t)}},{key:"log",value:function(){if(K(et,this)){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];(t=console).log.apply(t,[K(tt,this)].concat(n))}}},{key:"error",value:function(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];(t=console).error.apply(t,[K(tt,this)].concat(n))}},{key:"group",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;K(et,this)&&(t&&!K(nt,this)||(console.groupEnd(),X(nt,this,null)),t&&(console.group(t),X(nt,this,t)))}}],e&&J(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function ot(t){return ot="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},ot(t)}function it(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return at(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?at(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}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 o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function at(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ut(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ct(r.key),r)}}function ct(t){var e=function(t){if("object"!=ot(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ot(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ot(e)?e:e+""}var lt=function(){return t=function t(e,n){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.selector=e,this.selectorInContainer=n,this.containers=[],this.reloadContainers(),jQuery(window).resize(function(){r.refresh()}).resize(),jQuery(document).on("ppcp-smart-buttons-init",function(){r.refresh()}),jQuery(document).on("ppcp-shown ppcp-hidden ppcp-enabled ppcp-disabled",function(t,e){r.refresh(),setTimeout(r.refresh.bind(r),200)}),new MutationObserver(this.observeElementsCallback.bind(this)).observe(document.body,{childList:!0,subtree:!0})},(e=[{key:"observeElementsCallback",value:function(t,e){var n,r=this.selector+", .widget_shopping_cart, .widget_shopping_cart_content",o=!1,i=it(t);try{for(i.s();!(n=i.n()).done;){var a=n.value;"childList"===a.type&&a.addedNodes.forEach(function(t){t.matches&&t.matches(r)&&(o=!0)})}}catch(t){i.e(t)}finally{i.f()}o&&(this.reloadContainers(),this.refresh())}},{key:"reloadContainers",value:function(){var t=this;jQuery(this.selector).each(function(e,n){var r=jQuery(n).parent();t.containers.some(function(t){return t.is(r)})||t.containers.push(r)})}},{key:"refresh",value:function(){var t,e=this,n=it(this.containers);try{var r=function(){var n=t.value,r=jQuery(n),o=r.width();r.removeClass("ppcp-width-500 ppcp-width-300 ppcp-width-min"),o>=500?r.addClass("ppcp-width-500"):o>=300?r.addClass("ppcp-width-300"):r.addClass("ppcp-width-min");var i=r.children(":visible").first();r.find(e.selectorInContainer).each(function(t,e){var n=jQuery(e);if(n.is(i))return n.css("margin-top","0px"),!0;var r=n.height(),o=Math.max(11,Math.round(.3*r));n.css("margin-top","".concat(o,"px"))})};for(n.s();!(t=n.n()).done;)r()}catch(t){n.e(t)}finally{n.f()}}}])&&ut(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}(),st="ppcp-gateway",ft={Cart:"cart",Checkout:"checkout",BlockCart:"cart-block",BlockCheckout:"checkout-block",Product:"product",MiniCart:"mini-cart",PayNow:"pay-now",Preview:"preview",Blocks:["cart-block","checkout-block"],Gateways:["checkout","pay-now"]},pt=function(){var t=document.querySelector('input[name="payment_method"]:checked');return t?t.value:null},yt=function(t){return"string"==typeof t?document.querySelector(t):t};function dt(t){return dt="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},dt(t)}function ht(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return vt(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}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 o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function vt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function bt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,St(r.key),r)}}function mt(t,e,n){gt(t,e),e.set(t,n)}function gt(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function wt(t,e,n){return(e=St(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function St(t){var e=function(t){if("object"!=dt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=dt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==dt(e)?e:e+""}function jt(t,e){return t.get(Pt(t,e))}function Ot(t,e,n){return t.set(Pt(t,e),n),n}function Pt(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var _t=new WeakMap,kt=new WeakMap,Et=new WeakMap,Ct=new WeakMap,Tt=new WeakMap,At=new WeakMap,xt=new WeakMap,It=new WeakMap,Mt=new WeakMap,Rt=new WeakMap,Dt=new WeakMap,Bt=new WeakMap,Ft=new WeakMap,Gt=new WeakMap,Ht=new WeakMap,qt=new WeakMap,Nt=new WeakMap,Wt=new WeakSet,Lt=function(){return t=function t(e){var n,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),gt(this,r=Wt),r.add(this),mt(this,_t,void 0),mt(this,kt,!1),mt(this,Et,!1),mt(this,Ct,void 0),mt(this,Tt,void 0),mt(this,At,void 0),mt(this,xt,[]),mt(this,It,void 0),mt(this,Mt,void 0),mt(this,Rt,void 0),mt(this,Dt,void 0),mt(this,Bt,void 0),mt(this,Ft,null),mt(this,Gt,!0),mt(this,Ht,!0),mt(this,qt,null),mt(this,Nt,[]),this.methodId===t.methodId)throw new Error("Cannot initialize the PaymentButton base class");i||(i={});var s=!(null===(n=i)||void 0===n||!n.is_debug),f=this.methodId.replace(/^ppcp?-/,"");Ot(Ct,this,e),Ot(It,this,i),Ot(Mt,this,a),Ot(Rt,this,o),Ot(Dt,this,u),Ot(Bt,this,c),this.onClick=l,Ot(_t,this,new rt(f,e)),s&&(jt(_t,this).enabled=!0,function(t,e){window.ppcpPaymentButtonList=window.ppcpPaymentButtonList||{};var n=window.ppcpPaymentButtonList;n[t]=n[t]||[],n[t].push(e)}(f,this)),Ot(Tt,this,this.constructor.getWrappers(jt(It,this),jt(Mt,this))),this.applyButtonStyles(jt(It,this)),this.registerValidationRules(Pt(Wt,this,Qt).bind(this),Pt(Wt,this,Ut).bind(this)),function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".ppcp-button-apm",n=e;if(!window.ppcpApmButtons){if(t&&t.button){var r=t.button.wrapper;jQuery(r).children('div[class^="item-"]').length>0&&(e+=", ".concat(r,' div[class^="item-"]'),n+=', div[class^="item-"]')}window.ppcpApmButtons=new lt(e,n)}}(jt(Mt,this)),this.initEventListeners()},e=[{key:"methodId",get:function(){return this.constructor.methodId}},{key:"cssClass",get:function(){return this.constructor.cssClass}},{key:"isInitialized",get:function(){return jt(kt,this)}},{key:"context",get:function(){return jt(Ct,this)}},{key:"buttonConfig",get:function(){return jt(It,this)}},{key:"ppcpConfig",get:function(){return jt(Mt,this)}},{key:"externalHandler",get:function(){return jt(Rt,this)||{}}},{key:"contextHandler",get:function(){return jt(Dt,this)||{}}},{key:"requiresShipping",get:function(){return"function"==typeof this.contextHandler.shippingAllowed&&this.contextHandler.shippingAllowed()}},{key:"wrappers",get:function(){return jt(Tt,this)}},{key:"style",get:function(){return ft.MiniCart===this.context?jt(At,this).MiniCart:jt(At,this).Default}},{key:"wrapperId",get:function(){return ft.MiniCart===this.context?this.wrappers.MiniCart:this.isSeparateGateway?this.wrappers.Gateway:ft.Blocks.includes(this.context)?this.wrappers.Block:this.wrappers.Default}},{key:"isInsideClassicGateway",get:function(){return ft.Gateways.includes(this.context)}},{key:"isSeparateGateway",get:function(){return jt(It,this).is_wc_gateway_enabled&&this.isInsideClassicGateway}},{key:"isCurrentGateway",get:function(){if(!this.isInsideClassicGateway)return!0;var t=pt();return this.isSeparateGateway?this.methodId===t:st===t}},{key:"isPreview",get:function(){return ft.Preview===this.context}},{key:"isEligible",get:function(){return jt(Ft,this)},set:function(t){t!==jt(Ft,this)&&(Ot(Ft,this,t),this.triggerRedraw())}},{key:"isVisible",get:function(){return jt(Gt,this)},set:function(t){jt(Gt,this)!==t&&(Ot(Gt,this,t),this.triggerRedraw())}},{key:"isEnabled",get:function(){return jt(Ht,this)},set:function(t){jt(Ht,this)!==t&&(Ot(Ht,this,t),this.triggerRedraw())}},{key:"wrapperElement",get:function(){return document.getElementById(this.wrapperId)}},{key:"ppcpButtonWrapperSelector",get:function(){var t,e;return ft.Blocks.includes(this.context)?null:this.context===ft.MiniCart?null===(e=this.ppcpConfig)||void 0===e||null===(e=e.button)||void 0===e?void 0:e.mini_cart_wrapper:null===(t=this.ppcpConfig)||void 0===t||null===(t=t.button)||void 0===t?void 0:t.wrapper}},{key:"isPresent",get:function(){return this.wrapperElement instanceof HTMLElement}},{key:"isButtonAttached",get:function(){if(!jt(qt,this))return!1;for(var t=jt(qt,this).parentElement;null!==(e=t)&&void 0!==e&&e.parentElement;){var e;if("BODY"===t.tagName)return!0;t=t.parentElement}return!1}},{key:"log",value:function(){var t;(t=jt(_t,this)).log.apply(t,arguments)}},{key:"error",value:function(){var t;(t=jt(_t,this)).error.apply(t,arguments)}},{key:"logGroup",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;jt(_t,this).group(t)}},{key:"registerValidationRules",value:function(t,e){}},{key:"validateConfiguration",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=ht(jt(Nt,this));try{for(n.s();!(t=n.n()).done;){var r=t.value,o=r.check();if(r.shouldPass&&o)return!0;if(!r.shouldPass&&o)return!e&&r.errorMessage&&this.error(r.errorMessage),!1}}catch(t){n.e(t)}finally{n.f()}return!0}},{key:"applyButtonStyles",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e||(e=this.ppcpConfig),Ot(At,this,this.constructor.getStyles(t,e)),this.isInitialized&&this.triggerRedraw()}},{key:"configure",value:function(){}},{key:"init",value:function(){Ot(kt,this,!0)}},{key:"reinit",value:function(){Ot(kt,this,!1),Ot(Ft,this,!1)}},{key:"triggerRedraw",value:function(){this.showPaymentGateway(),function(t){var e=t.event,n=t.paymentMethod,r=void 0===n?"":n;if(!U(e))throw new Error("Invalid event: ".concat(e));var o=r?"".concat(e,"-").concat(r):e;document.body.dispatchEvent(new Event(o))}({event:Q.REDRAW,paymentMethod:this.methodId})}},{key:"syncProductButtonsState",value:function(){var t,e=document.querySelector(this.ppcpButtonWrapperSelector);e&&(this.isVisible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}(e),this.isEnabled=!((t=yt(e))&&jQuery(t).hasClass("ppcp-disabled")))}},{key:"initEventListeners",value:function(){var t=this;if(z({event:Q.REDRAW,paymentMethod:this.methodId,callback:function(){return t.refresh()}}),this.isInsideClassicGateway){var e=this.isSeparateGateway?this.methodId:st;z({event:Q.INVALIDATE,callback:function(){return t.isVisible=!1}}),z({event:Q.RENDER,paymentMethod:e,callback:function(){return t.isVisible=!0}})}this.context===ft.Product&&(jQuery(document).on("ppcp-shown ppcp-hidden ppcp-enabled ppcp-disabled",function(e,n){jQuery(n.selector).is(t.ppcpButtonWrapperSelector)&&t.syncProductButtonsState()}),this.syncProductButtonsState())}},{key:"refresh",value:function(){this.isPresent&&(this.isEligible?(this.applyWrapperStyles(),this.isEligible&&this.isCurrentGateway&&this.isVisible&&(this.isButtonAttached||(this.log("refresh.addButton"),this.addButton()))):this.wrapperElement.style.display="none")}},{key:"showPaymentGateway",value:function(){if(!jt(Et,this)&&this.isSeparateGateway&&this.isEligible){var t='style[data-hide-gateway="'.concat(this.methodId,'"]'),e="#".concat(this.wrappers.Default),n=document.querySelector(".wc_payment_method.payment_method_".concat(this.methodId));document.querySelectorAll(t).forEach(function(t){return t.remove()}),"none"!==n.style.display&&""!==n.style.display||(n.style.display="block"),document.querySelectorAll(e).forEach(function(t){return t.remove()}),this.log("Show gateway"),Ot(Et,this,!0),this.isVisible=this.isCurrentGateway}}},{key:"applyWrapperStyles",value:function(){var t,e,n=this.wrapperElement;if(n){var r,o=this.style,i=o.shape,a=o.height,u=ht(jt(xt,this));try{for(u.s();!(r=u.n()).done;){var c=r.value;n.classList.remove(c)}}catch(t){u.e(t)}finally{u.f()}Ot(xt,this,[]);var l=["ppcp-button-".concat(i),"ppcp-button-apm",this.cssClass];(t=n.classList).add.apply(t,l),(e=jt(xt,this)).push.apply(e,l),a&&(n.style.height="".concat(a,"px")),n.style.display=this.isVisible?"block":"none";var s=this.context===ft.Product?"form.cart":null;!function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=yt(t);r&&(e?(jQuery(r).removeClass("ppcp-disabled").off("mouseup").find("> *").css("pointer-events",""),function(t,e){jQuery(document).trigger("ppcp-enabled",{handler:"ButtonsDisabler.setEnabled",action:"enable",selector:t,element:e})}(t,r)):(jQuery(r).addClass("ppcp-disabled").on("mouseup",function(t){if(t.stopImmediatePropagation(),n){var e=jQuery(n);e.find(".single_add_to_cart_button").hasClass("disabled")&&e.find(":submit").trigger("click")}}).find("> *").css("pointer-events","none"),function(t,e){jQuery(document).trigger("ppcp-disabled",{handler:"ButtonsDisabler.setEnabled",action:"disable",selector:t,element:e})}(t,r)))}(n,this.isEnabled,s)}}},{key:"addButton",value:function(){throw new Error("Must be implemented by the child class")}},{key:"insertButton",value:function(t){if(this.isPresent){var e=this.wrapperElement;jt(qt,this)&&this.removeButton(),this.log("insertButton",t),Ot(qt,this,t),e.appendChild(jt(qt,this))}}},{key:"removeButton",value:function(){if(this.isPresent&&jt(qt,this)){this.log("removeButton");try{this.wrapperElement.removeChild(jt(qt,this))}catch(t){}Ot(qt,this,null)}}}],n=[{key:"createButton",value:function(t,e,n,r,o,i){var a,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,c=(a="__ppcpPBInstances",document.body[a]||Object.defineProperty(document.body,a,{value:new Map,enumerable:!1,writable:!1,configurable:!1}),document.body[a]),l="".concat(this.methodId,".").concat(t);if(!c.has(l)){var s=new this(t,e,n,r,o,i,u);c.set(l,s)}return c.get(l)}},{key:"getWrappers",value:function(t,e){throw new Error("Must be implemented in the child class")}},{key:"getStyles",value:function(t,e){throw new Error("Must be implemented in the child class")}}],e&&bt(t.prototype,e),n&&bt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function Qt(t,e){jt(Nt,this).push({check:t,errorMessage:e,shouldPass:!1})}function Ut(t){jt(Nt,this).push({check:t,shouldPass:!0})}function zt(t){return zt="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},zt(t)}function Vt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Jt(r.key),r)}}function Jt(t){var e=function(t){if("object"!=zt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=zt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==zt(e)?e:e+""}wt(Lt,"methodId","generic"),wt(Lt,"cssClass","");var Yt=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e},(e=[{key:"update",value:function(t){var e=this;return new Promise(function(n,r){fetch(e.config.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:e.config.nonce,paymentData:t})}).then(function(t){return t.json()}).then(function(t){t.success&&n(t.data)})})}}])&&Vt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();const $t=Yt;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(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,l=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Zt(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Zt(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 Zt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var te={"#billing_email":["email_address"],"#billing_last_name":["name","surname"],"#billing_first_name":["name","given_name"],"#billing_country":["address","country_code"],"#billing_address_1":["address","address_line_1"],"#billing_address_2":["address","address_line_2"],"#billing_state":["address","admin_area_1"],"#billing_city":["address","admin_area_2"],"#billing_postcode":["address","postal_code"],"#billing_phone":["phone"]};function ee(t){var e,n,r,o,i,a,u,c;return{email_address:t.email_address,phone:t.phone,name:{surname:null===(e=t.name)||void 0===e?void 0:e.surname,given_name:null===(n=t.name)||void 0===n?void 0:n.given_name},address:{country_code:null===(r=t.address)||void 0===r?void 0:r.country_code,address_line_1:null===(o=t.address)||void 0===o?void 0:o.address_line_1,address_line_2:null===(i=t.address)||void 0===i?void 0:i.address_line_2,admin_area_1:null===(a=t.address)||void 0===a?void 0:a.admin_area_1,admin_area_2:null===(u=t.address)||void 0===u?void 0:u.admin_area_2,postal_code:null===(c=t.address)||void 0===c?void 0:c.postal_code}}}function ne(){var t;return null===(t=window)||void 0===t||null===(t=t.PayPalCommerceGateway)||void 0===t?void 0:t.payer}function re(){var t,e=null!==(t=ne())&&void 0!==t?t:window._PpcpPayerSessionDetails;if(!e)return null;var n,r,o,i=(o={},Object.entries(te).forEach(function(t){var e=Xt(t,2),n=e[0],r=e[1],i=function(t){var e;return null===(e=document.querySelector(t))||void 0===e?void 0:e.value}(n);i&&function(t,e,n){for(var r=t,o=0;o<e.length-1;o++)r=r[e[o]]=r[e[o]]||{};r[e[e.length-1]]=n}(o,r,i)}),o.phone&&"string"==typeof o.phone&&(o.phone={phone_type:"HOME",phone_number:{national_number:o.phone}}),o);return i?(n=i,(r=function(t,e){for(var n=0,o=Object.entries(e);n<o.length;n++){var i=Xt(o[n],2),a=i[0],u=i[1];null!=u&&("object"===Kt(u)?t[a]=r(t[a]||{},u):t[a]=u)}return t})(ee(e),ee(n))):ee(e)}function oe(t){var e,n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];(e=t)&&"object"===Kt(e)&&(window._PpcpPayerSessionDetails=ee(e)),r&&(n=t,Object.entries(te).forEach(function(t){var e=Xt(t,2),r=e[0],o=e[1],i=function(t,e){return e.reduce(function(t,e){return null==t?void 0:t[e]},t)}(n,o);!function(t,e,n){var r;null!=n&&e&&("phone"===t[0]&&"object"===Kt(n)&&(n=null===(r=n.phone_number)||void 0===r?void 0:r.national_number),e.value=n)}(o,document.querySelector(r),i)}))}function ie(t){return ie="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},ie(t)}function ae(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ue(r.key),r)}}function ue(t){var e=function(t){if("object"!=ie(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ie(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ie(e)?e:e+""}function ce(t,e,n){le(t,e),e.set(t,n)}function le(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function se(t,e){return t.get(pe(t,e))}function fe(t,e,n){return t.set(pe(t,e),n),n}function pe(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function ye(t){return t.toLowerCase().trim().replace(/[^a-z0-9_-]/g,"_")}function de(t){try{var e=JSON.parse(t);return{data:e.data,expires:e.expires||0}}catch(t){return null}}function he(t){return t?Date.now()+1e3*t:0}var ve=new WeakMap,be=new WeakMap,me=new WeakSet,ge=function(){return t=function t(e){var n;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),le(this,n=me),n.add(this),ce(this,ve,""),ce(this,be,null),fe(ve,this,ye(e)+":"),pe(me,this,we).call(this)},e=[{key:"canUseLocalStorage",get:function(){return null===se(be,this)&&fe(be,this,function(){try{var t="__ppcp_test__";return localStorage.setItem(t,"test"),localStorage.removeItem(t),!0}catch(t){return!1}}()),se(be,this)}},{key:"set",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!this.canUseLocalStorage)throw new Error("Local storage is not available");var r=function(t,e){var n={data:t,expires:he(e)};return JSON.stringify(n)}(e,n),o=pe(me,this,Se).call(this,t);localStorage.setItem(o,r)}},{key:"get",value:function(t){if(!this.canUseLocalStorage)throw new Error("Local storage is not available");var e=pe(me,this,Se).call(this,t),n=de(localStorage.getItem(e));return n?n.data:null}},{key:"clear",value:function(t){if(!this.canUseLocalStorage)throw new Error("Local storage is not available");var e=pe(me,this,Se).call(this,t);localStorage.removeItem(e)}}],e&&ae(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function we(){var t=this;this.canUseLocalStorage&&Object.keys(localStorage).forEach(function(e){if(e.startsWith(se(ve,t))){var n=de(localStorage.getItem(e));n&&n.expires>0&&n.expires<Date.now()&&localStorage.removeItem(e)}})}function Se(t){var e=ye(t);if(0===e.length)throw new Error("Name cannot be empty after sanitization");return"".concat(se(ve,this)).concat(e)}function je(t){return je="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},je(t)}function Oe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ce(r.key),r)}}function Pe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Pe=function(){return!!t})()}function _e(t){return _e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_e(t)}function ke(t,e){return ke=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ke(t,e)}function Ee(t,e,n){return(e=Ce(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ce(t){var e=function(t){if("object"!=je(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=je(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==je(e)?e:e+""}var Te=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=_e(e),function(t,e){if(e&&("object"==je(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Pe()?Reflect.construct(e,n||[],_e(t).constructor):e.apply(t,n))}(this,e,["ppcp-googlepay"])}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ke(t,e)}(e,t),n=e,(r=[{key:"getPayer",value:function(){return this.get(e.PAYER)}},{key:"setPayer",value:function(t){this.set(e.PAYER,t,e.PAYER_TTL)}},{key:"clearPayer",value:function(){this.clear(e.PAYER)}}])&&Oe(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ge);Ee(Te,"PAYER","payer"),Ee(Te,"PAYER_TTL",900);const Ae=new Te;function xe(t){return xe="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},xe(t)}function Ie(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return Me(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Me(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,Me(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,Me(f,"constructor",l),Me(l,"constructor",c),c.displayName="GeneratorFunction",Me(l,o,"GeneratorFunction"),Me(f),Me(f,o,"Generator"),Me(f,r,function(){return this}),Me(f,"toString",function(){return"[object Generator]"}),(Ie=function(){return{w:i,m:p}})()}function Me(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Me=function(t,e,n,r){function i(e,n){Me(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},Me(t,e,n,r)}function Re(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function De(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){Re(i,r,o,a,u,"next",t)}function u(t){Re(i,r,o,a,u,"throw",t)}a(void 0)})}}function Be(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Fe(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Be(Object(n),!0).forEach(function(e){Ue(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Be(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Ge(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ze(r.key),r)}}function He(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(He=function(){return!!t})()}function qe(t,e,n,r){var o=Ne(We(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Ne(){return Ne="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=We(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},Ne.apply(null,arguments)}function We(t){return We=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},We(t)}function Le(t,e){return Le=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Le(t,e)}function Qe(t,e,n){(function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")})(t,e),e.set(t,n)}function Ue(t,e,n){return(e=ze(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ze(t){var e=function(t){if("object"!=xe(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=xe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==xe(e)?e:e+""}function Ve(t,e,n){return t.set(Ye(t,e),n),n}function Je(t,e){return t.get(Ye(t,e))}function Ye(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var $e="failed",Ke="payerAction";function Xe(t){return{country_code:null==t?void 0:t.countryCode,address_line_1:null==t?void 0:t.address1,address_line_2:null==t?void 0:t.address2,admin_area_1:null==t?void 0:t.administrativeArea,admin_area_2:null==t?void 0:t.locality,postal_code:null==t?void 0:t.postalCode}}function Ze(t){var e,n=null==t||null===(e=t.paymentMethodData)||void 0===e||null===(e=e.info)||void 0===e?void 0:e.billingAddress;return{email_address:null==t?void 0:t.email,name:{given_name:n.name.split(" ")[0],surname:n.name.split(" ").slice(1).join(" ")},address:Xe(n)}}function tn(t){var e,n,r=null!==(e=null==t?void 0:t.shippingAddress)&&void 0!==e?e:null==t||null===(n=t.paymentMethodData)||void 0===n||null===(n=n.info)||void 0===n?void 0:n.billingAddress;return{name:{full_name:null==r?void 0:r.name},address:Xe(r)}}var en=new WeakMap,nn=new WeakMap,rn=new WeakMap,on=new WeakMap,an=new WeakMap,un=new WeakMap,cn=function(t){function e(t,n,r,o,i,a){var u,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Qe(u=function(t,e,n){return e=We(e),function(t,e){if(e&&("object"==xe(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,He()?Reflect.construct(e,n||[],We(t).constructor):e.apply(t,n))}(this,e,[t,n,r,o,i,a,c]),en,null),Qe(u,nn,null),Qe(u,rn,null),Ue(u,"googlePayConfig",null),Qe(u,on,0),Qe(u,an,1e3),Qe(u,un,null),u.init=u.init.bind(u),u.onPaymentDataChanged=u.onPaymentDataChanged.bind(u),u.onButtonClick=u.onButtonClick.bind(u),u.onClick=c,u.log("Create instance"),u}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Le(t,e)}(e,t),n=e,r=[{key:"requiresShipping",get:function(){var t;return qe(e,"requiresShipping",this,1)&&(null===(t=this.buttonConfig.shipping)||void 0===t?void 0:t.enabled)}},{key:"googlePayApi",get:function(){var t;return null===(t=window.google)||void 0===t||null===(t=t.payments)||void 0===t?void 0:t.api}},{key:"paymentsClient",get:function(){return Je(en,this)}},{key:"transactionInfo",get:function(){return Je(nn,this)},set:function(t){Ve(nn,this,t),this.refresh()}},{key:"registerValidationRules",value:function(t,e){var n=this;return t(function(){return!["TEST","PRODUCTION"].includes(n.buttonConfig.environment)},"Invalid environment: ".concat(this.buttonConfig.environment)),e(function(){return n.isPreview}),t(function(){return!n.googlePayConfig},"No API configuration - missing configure() call?"),t(function(){return!n.transactionInfo},"No transactionInfo - missing configure() call?"),t(function(){var t;return!(null!==(t=n.contextHandler)&&void 0!==t&&t.validateContext())},"Invalid context handler."),t(function(){var t;return(null===(t=n.buttonAttributes)||void 0===t?void 0:t.height)&&isNaN(parseInt(n.buttonAttributes.height))},"Invalid height in buttonAttributes"),t(function(){var t;return(null===(t=n.buttonAttributes)||void 0===t?void 0:t.borderRadius)&&isNaN(parseInt(n.buttonAttributes.borderRadius))},"Invalid borderRadius in buttonAttributes"),!0}},{key:"configure",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Je(on,this)||Ve(on,this,Date.now()),null!=r&&r.height&&null!=r&&r.borderRadius&&Ve(un,this,Fe({},r));var o=null!=r&&r.height?r:Je(un,this);if(Date.now()-Je(on,this)>Je(an,this))return this.log("GooglePay: Timeout waiting for buttonAttributes - proceeding with initialization"),this.googlePayConfig=t,Ve(nn,this,e),this.buttonAttributes=o||r,this.allowedPaymentMethods=this.googlePayConfig.allowedPaymentMethods,this.baseCardPaymentMethod=this.allowedPaymentMethods[0],void this.init();null!=o&&o.height&&null!=o&&o.borderRadius?(Ve(on,this,0),this.googlePayConfig=t,Ve(nn,this,e),this.buttonAttributes=o,this.allowedPaymentMethods=this.googlePayConfig.allowedPaymentMethods,this.baseCardPaymentMethod=this.allowedPaymentMethods[0],this.init()):setTimeout(function(){return n.configure(t,e,r)},100)}},{key:"init",value:function(){var t=this;this.isInitialized||this.validateConfiguration()&&(qe(e,"init",this,3)([]),Ve(en,this,this.createPaymentsClient()),this.paymentsClient.isReadyToPay(this.buildReadyToPayRequest(this.allowedPaymentMethods,this.googlePayConfig)).then(function(e){t.log("PaymentsClient.isReadyToPay response:",e),t.isEligible=!!e.result}).catch(function(e){t.error(e),t.isEligible=!1}))}},{key:"reinit",value:function(){this.validateConfiguration(!0)&&(qe(e,"reinit",this,3)([]),this.init())}},{key:"preparePaymentDataCallbacks",value:function(){var t={};return this.isPreview||this.requiresShipping&&(t.onPaymentDataChanged=this.onPaymentDataChanged),t}},{key:"createPaymentsClient",value:function(){if(!this.googlePayApi)return null;var t=this.preparePaymentDataCallbacks();return new this.googlePayApi.PaymentsClient({environment:this.buttonConfig.environment,paymentDataCallbacks:t})}},{key:"buildReadyToPayRequest",value:function(t,e){return this.log("Ready To Pay request",e,t),Object.assign({},e,{allowedPaymentMethods:t})}},{key:"addButton",value:function(){var t,n,r;if(this.paymentsClient){null!==(t=this.buttonAttributes)&&void 0!==t&&t.height||null===(n=Je(un,this))||void 0===n||!n.height||(this.buttonAttributes=Fe({},Je(un,this))),this.removeButton();var o=this.baseCardPaymentMethod,i=this.style,a=i.color,u=i.type,c={buttonColor:a||"black",buttonSizeMode:"fill",buttonLocale:i.language||"en",buttonType:u||"pay",buttonRadius:parseInt(null===(r=this.buttonAttributes)||void 0===r?void 0:r.borderRadius,10),onClick:this.onButtonClick,allowedPaymentMethods:[o]},l=this.paymentsClient.createButton(c);Ve(rn,this,l),qe(e,"insertButton",this,3)([l]),this.applyWrapperStyles()}}},{key:"applyWrapperStyles",value:function(){var t;qe(e,"applyWrapperStyles",this,3)([]);var n=this.wrapperElement;if(n){var r=null!==(t=this.buttonAttributes)&&void 0!==t&&t.height?this.buttonAttributes:Je(un,this);if(null!=r&&r.height){var o=parseInt(r.height,10);isNaN(o)||(n.style.height="".concat(o,"px"),n.style.minHeight="".concat(o,"px"))}}}},{key:"removeButton",value:function(){if(this.isPresent&&Je(rn,this)){this.log("removeButton");try{this.wrapperElement.removeChild(Je(rn,this))}catch(t){}Ve(rn,this,null)}}},{key:"onButtonClick",value:(a=De(Ie().m(function t(){var e,n,r,o,i=this;return Ie().w(function(t){for(;;)switch(t.n){case 0:return this.logGroup("onButtonClick"),e=function(){var t=De(Ie().m(function t(){var e,n;return Ie().w(function(t){for(;;)if(0===t.n)return window.ppcpFundingSource="googlepay",null===(e=i.onClick)||void 0===e||e.call(i),n=i.paymentDataRequest(),i.log("onButtonClick: paymentDataRequest",n,i.context),t.a(2,i.paymentsClient.loadPaymentData(n).then(function(t){return i.log("loadPaymentData response:",t),t}).catch(function(t){throw i.error("loadPaymentData failed:",t),t}))},t)}));return function(){return t.apply(this,arguments)}}(),n=function(){var t=De(Ie().m(function t(){return Ie().w(function(t){for(;;)switch(t.n){case 0:if("function"==typeof i.contextHandler.validateForm){t.n=1;break}return t.a(2,Promise.resolve());case 1:return t.a(2,i.contextHandler.validateForm().catch(function(t){throw i.error("Form validation failed:",t),t}))}},t)}));return function(){return t.apply(this,arguments)}}(),r=function(){var t=De(Ie().m(function t(){return Ie().w(function(t){for(;;)switch(t.n){case 0:if("function"==typeof i.contextHandler.transactionInfo){t.n=1;break}return t.a(2,Promise.resolve());case 1:return t.a(2,i.contextHandler.transactionInfo().then(function(t){i.transactionInfo=t}).catch(function(t){throw i.error("Failed to get transaction info:",t),t}))}},t)}));return function(){return t.apply(this,arguments)}}(),t.n=1,n().then(r).then(e);case 1:if(o=t.v,this.logGroup(),o){t.n=2;break}return t.a(2);case 2:return t.a(2,this.processPayment(o))}},t,this)})),function(){return a.apply(this,arguments)})},{key:"paymentDataRequest",value:function(){var t=this.requiresShipping,e=[];return t&&e.push("SHIPPING_ADDRESS","SHIPPING_OPTION"),Fe(Fe({},{apiVersion:2,apiVersionMinor:0}),{},{allowedPaymentMethods:this.googlePayConfig.allowedPaymentMethods,transactionInfo:this.transactionInfo.finalObject,merchantInfo:this.googlePayConfig.merchantInfo,callbackIntents:e,emailRequired:!0,shippingAddressRequired:t,shippingOptionRequired:t,shippingAddressParameters:this.shippingAddressParameters()})}},{key:"shippingAddressParameters",value:function(){return{allowedCountryCodes:this.buttonConfig.shipping.countries,phoneNumberRequired:!0}}},{key:"onPaymentDataChanged",value:function(t){var e=this;return this.log("onPaymentDataChanged",t),new Promise(function(){var n=De(Ie().m(function n(r,o){var i,a,u,c,l,s,f,p;return Ie().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,a={},n.n=1,new $t(e.buttonConfig.ajax.update_payment_data).update(t);case 1:if(u=n.v,c=e.transactionInfo,l=["checkout-block","checkout","cart-block","cart","mini-cart","pay-now"].includes(e.context),e.log("onPaymentDataChanged:updatedData",u),e.log("onPaymentDataChanged:transactionInfo",c),u.country_code=c.countryCode,u.currency_code=c.currencyCode,null!==(i=u.shipping_options)&&void 0!==i&&null!==(i=i.shippingOptions)&&void 0!==i&&i.length){n.n=2;break}return a.error=e.unserviceableShippingAddressError(),r(a),n.a(2);case 2:["INITIALIZE","SHIPPING_ADDRESS"].includes(t.callbackTrigger)&&(a.newShippingOptionParameters=e.sanitizeShippingOptions(u.shipping_options)),u.total&&l?(c.setTotal(u.total,u.shipping_fee),e.syncShippingOptionWithForm(null==t||null===(s=t.shippingOptionData)||void 0===s?void 0:s.id)):c.shippingFee=e.getShippingCosts(null==t||null===(f=t.shippingOptionData)||void 0===f?void 0:f.id,u.shipping_options),a.newTransactionInfo=e.calculateNewTransactionInfo(c),r(a),n.n=4;break;case 3:n.p=3,p=n.v,e.error("Error during onPaymentDataChanged:",p),o(p);case 4:return n.a(2)}},n,null,[[0,3]])}));return function(_x,t){return n.apply(this,arguments)}}())}},{key:"sanitizeShippingOptions",value:function(t){var e=t.shippingOptions.map(function(t){return{id:t.id,label:t.label,description:t.description}}),n=t.defaultSelectedOptionId;return e.some(function(t){return t.id===n})||(n=e[0].id),{defaultSelectedOptionId:n,shippingOptions:e}}},{key:"getShippingCosts",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.shippingOptions,r=void 0===n?[]:n,o=e.defaultSelectedOptionId,i=void 0===o?"":o;if(null==r||!r.length)return this.log("Cannot calculate shipping cost: No Shipping Options"),0;var a=function(t){return r.find(function(e){return e.id===t})},u=a("shipping_option_unselected"!==t&&a(t)?t:i);return Number(null==u?void 0:u.cost)||0}},{key:"unserviceableShippingAddressError",value:function(){return{reason:"SHIPPING_ADDRESS_UNSERVICEABLE",message:"Cannot ship to the selected address",intent:"SHIPPING_ADDRESS"}}},{key:"calculateNewTransactionInfo",value:function(t){return t.finalObject}},{key:"processPayment",value:(i=De(Ie().m(function t(e){var n,r,o,i,a,u,c,l,s,f,p,y,d,h=this;return Ie().w(function(t){for(;;)switch(t.p=t.n){case 0:return this.logGroup("processPayment"),r=Ze(e),o=tn(e),i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r={transactionState:t};return(e||n)&&(r.error={intent:e,message:n}),h.log("processPaymentResponse",r),r},a=function(t){return h.error(t),i("ERROR","PAYMENT_AUTHORIZATION",t)},u=function(){var t=De(Ie().m(function t(n){var r,o,i;return Ie().w(function(t){for(;;)switch(t.n){case 0:return r={orderId:n,paymentMethodData:e.paymentMethodData},t.n=1,b.paypal.Googlepay().confirmOrder(r);case 1:o=t.v,h.log("confirmOrder",o),i=null==o?void 0:o.status,t.n="APPROVED"===i?2:"PAYER_ACTION_REQUIRED"===i?3:4;break;case 2:return t.a(2,"approved");case 3:return t.a(2,Ke);case 4:return t.a(2,$e);case 5:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}(),c=function(t){return h.log("initiatePayerAction",t),b.paypal.Googlepay().initiatePayerAction({orderId:t})},l=function(){var t=De(Ie().m(function t(e){var n;return Ie().w(function(t){for(;;)switch(t.n){case 0:return n=!0,h.log("approveOrder",e),t.n=1,h.contextHandler.approveOrder({orderID:e,payer:r,shippingAddress:o},{restart:function(){return new Promise(function(t){n=!1,t()})},order:{get:function(){return new Promise(function(t){t(null)})}}});case 1:return t.a(2,n)}},t)}));return function(e){return t.apply(this,arguments)}}(),Ae.setPayer(r),oe(r),t.p=1,t.n=2,this.contextHandler.createOrder();case 2:return s=t.v,this.log("createOrder",s),t.n=3,u(s);case 3:if(f=t.v,$e!==f){t.n=4;break}n=a("TRANSACTION FAILED"),t.n=8;break;case 4:if(Ke!==f){t.n=6;break}return t.n=5,c(s);case 5:p=t.v,this.log("3DS verification completed",p);case 6:return t.n=7,l(s);case 7:y=t.v,n=y?i("SUCCESS"):a("FAILED TO APPROVE");case 8:t.n=10;break;case 9:t.p=9,d=t.v,n=a(d.message);case 10:return this.logGroup(),t.a(2,n)}},t,this,[[1,9]])})),function(t){return i.apply(this,arguments)})},{key:"syncShippingOptionWithForm",value:function(t){for(var e=[".woocommerce-shipping-methods",".wc-block-components-shipping-rates-control",".wc-block-components-totals-shipping"],n=t.replace(/"/g,""),r=0,o=e;r<o.length;r++){var i="".concat(o[r],' input[type="radio"][value="').concat(n,'"]'),a=document.querySelector(i);if(a)return a.click(),!0}for(var u=0,c=e;u<c.length;u++){var l="".concat(c[u],' select option[value="').concat(n,'"]'),s=document.querySelector(l);if(s){var f=s.closest("select");if(f)return f.value=n,f.dispatchEvent(new Event("change")),!0}}return!1}}],o=[{key:"getWrappers",value:function(t,e){var n,r,o;return function(){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=function(t){return t.replace(/^#/,"")};return{Default:o(arguments.length>0&&void 0!==arguments[0]?arguments[0]:""),SmartButton:o(e),Block:o(n),Gateway:o(r),MiniCart:o(t)}}((null==t||null===(n=t.button)||void 0===n?void 0:n.wrapper)||"",(null==t||null===(r=t.button)||void 0===r?void 0:r.mini_cart_wrapper)||"",(null==e||null===(o=e.button)||void 0===o?void 0:o.wrapper)||"","ppc-button-googlepay-container","ppc-button-ppcp-googlepay")}},{key:"getStyles",value:function(t,e){var n=function(t,e){return{Default:W(W({},t.style),e.style),MiniCart:W(W({},t.mini_cart_style),e.mini_cart_style)}}((null==e?void 0:e.button)||{},(null==t?void 0:t.button)||{});return"buy"===n.MiniCart.type&&(n.MiniCart.type="pay"),n}}],r&&Ge(n.prototype,r),o&&Ge(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i,a}(Lt);Ue(cn,"methodId","ppcp-googlepay"),Ue(cn,"cssClass","google-pay");const ln=cn;function sn(t){return sn="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},sn(t)}function fn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,pn(r.key),r)}}function pn(t){var e=function(t){if("object"!=sn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=sn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==sn(e)?e:e+""}var yn=function(){return t=function t(e,n,r,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=e,this.quantity=n,this.variations=r,this.extra=o},(e=[{key:"data",value:function(){return{id:this.id,quantity:this.quantity,variations:this.variations,extra:this.extra}}}])&&fn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();const dn=yn;function hn(t){return hn="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},hn(t)}function vn(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function bn(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?vn(Object(n),!0).forEach(function(e){mn(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vn(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function mn(t,e,n){return(e=wn(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function gn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,wn(r.key),r)}}function wn(t){var e=function(t){if("object"!=hn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=hn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==hn(e)?e:e+""}function Sn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Sn=function(){return!!t})()}function jn(){return jn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=On(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},jn.apply(null,arguments)}function On(t){return On=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},On(t)}function Pn(t,e){return Pn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Pn(t,e)}var kn=function(t){function e(t,n,r,o){var i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(i=function(t,e,n){return e=On(e),function(t,e){if(e&&("object"==hn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Sn()?Reflect.construct(e,n||[],On(t).constructor):e.apply(t,n))}(this,e,[t,n,null,o])).booking=r,i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pn(t,e)}(e,t),n=e,r=[{key:"data",value:function(){return bn(bn({},(t=e,n=this,"function"==typeof(r=jn(On(1&3?t.prototype:t),"data",n))?function(t){return r.apply(n,t)}:r)([])),{},{booking:this.booking});var t,n,r}}],r&&gn(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(dn);const En=kn;function Cn(t){return Cn="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},Cn(t)}function Tn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,An(r.key),r)}}function An(t){var e=function(t){if("object"!=Cn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Cn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Cn(e)?e:e+""}var xn=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"form.woocommerce-checkout";!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.target=e}return e=t,r=[{key:"fullPage",value:function(){return new t(window)}}],(n=[{key:"setTarget",value:function(t){this.target=t}},{key:"block",value:function(){jQuery(this.target).block({message:null,overlayCSS:{background:"#fff",opacity:.6},baseZ:1e4})}},{key:"unblock",value:function(){jQuery(this.target).unblock()}}])&&Tn(e.prototype,n),r&&Tn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();const In=xn,Mn=function(t,e){return function(n,r){var o=In.fullPage();o.block();var i=!t.config.vaultingEnabled||"venmo"!==n.paymentSource,a={nonce:t.config.ajax.approve_order.nonce,order_id:n.orderID,funding_source:window.ppcpFundingSource,should_create_wc_order:i};return i&&n.payer&&(a.payer=n.payer),i&&n.shippingAddress&&(a.shipping_address=n.shippingAddress),fetch(t.config.ajax.approve_order.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(a)}).then(function(t){return t.json()}).then(function(n){var o;if(!n.success)return e.genericError(),r.restart().catch(function(){e.genericError()});var i,a=null===(o=n.data)||void 0===o?void 0:o.order_received_url;i=a||t.config.redirect,setTimeout(function(){window.location.href=i},200)}).finally(function(){o.unblock()})}};function Rn(t){return Rn="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},Rn(t)}function Dn(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Bn(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bn(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}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 o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function Bn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Fn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Gn(r.key),r)}}function Gn(t){var e=function(t){if("object"!=Rn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Rn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Rn(e)?e:e+""}var Hn=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.cartItemKeys=e},(e=[{key:"getEndpoint",value:function(){var t="/?wc-ajax=%%endpoint%%";return"undefined"!=typeof wc_cart_fragments_params&&wc_cart_fragments_params.wc_ajax_url&&(t=wc_cart_fragments_params.wc_ajax_url),t.toString().replace("%%endpoint%%","remove_from_cart")}},{key:"addFromPurchaseUnits",value:function(t){var e,n=Dn(t||[]);try{for(n.s();!(e=n.n()).done;){var r,o=Dn(e.value.items||[]);try{for(o.s();!(r=o.n()).done;){var i=r.value;i.cart_item_key&&this.cartItemKeys.push(i.cart_item_key)}}catch(t){o.e(t)}finally{o.f()}}}catch(t){n.e(t)}finally{n.f()}return this}},{key:"removeFromCart",value:function(){var t=this;return new Promise(function(e,n){if(t.cartItemKeys&&t.cartItemKeys.length){var r,o=t.cartItemKeys.length,i=0,a=function(){++i>=o&&e()},u=Dn(t.cartItemKeys);try{for(u.s();!(r=u.n()).done;){var c=r.value,l=new URLSearchParams;l.append("cart_item_key",c),c?fetch(t.getEndpoint(),{method:"POST",credentials:"same-origin",body:l}).then(function(t){return t.json()}).then(function(){a()}).catch(function(){a()}):a()}}catch(t){u.e(t)}finally{u.f()}}else e()})}}])&&Fn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();const qn=Hn;function Nn(t){return Nn="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},Nn(t)}function Wn(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,l=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||Qn(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 Ln(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Qn(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}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 o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function Qn(t,e){if(t){if("string"==typeof t)return Un(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Un(t,e):void 0}}function Un(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function zn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Vn(r.key),r)}}function Vn(t){var e=function(t){if("object"!=Nn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Nn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Nn(e)?e:e+""}var Jn=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},e=[{key:"getPrefixedFields",value:function(t,e){var n,r={},o=Ln(new FormData(t).entries());try{for(o.s();!(n=o.n()).done;){var i=Wn(n.value,2),a=i[0],u=i[1];e&&!a.startsWith(e)||(r[a]=u)}}catch(t){o.e(t)}finally{o.f()}return r}},{key:"getFilteredFields",value:function(t,e,n){var r,o=new FormData(t),i={},a={},u=Ln(o.entries());try{var c=function(){var t=Wn(r.value,2),o=t[0],u=t[1];if(-1!==o.indexOf("[]")){var c=o;a[c]=a[c]||0,o=o.replace("[]","[".concat(a[c],"]")),a[c]++}return o?e&&-1!==e.indexOf(o)||n&&n.some(function(t){return o.startsWith(t)})?0:void(i[o]=u):0};for(u.s();!(r=u.n()).done;)c()}catch(t){u.e(t)}finally{u.f()}return i}}],null&&zn(t.prototype,null),e&&zn(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Yn(t){return Yn="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},Yn(t)}function $n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Kn(r.key),r)}}function Kn(t){var e=function(t){if("object"!=Yn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Yn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Yn(e)?e:e+""}var Xn,Zn,tr,er=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},e=[{key:"cleanHashParams",value:function(){var t=this;if(window.location.hash){var e=window.location.hash.substring(1).split("&").filter(function(e){var n=e.split("=")[0];return!t.PAYPAL_PARAMS.includes(n)});if(e.length>0){var n="#"+e.join("&");window.history.replaceState(null,"",window.location.pathname+window.location.search+n)}else window.history.replaceState(null,"",window.location.pathname+window.location.search)}}},{key:"isResumeFlow",value:function(){return!!window.location.hash&&window.location.hash.substring(1).split("&").some(function(t){return"switch_initiated_time"===t.split("=")[0]})}},{key:"reloadButtonsIfRequired",value:function(t){this.isResumeFlow()&&(this.cleanHashParams(),jQuery(t).trigger("ppcp-reload-buttons"))}}],null&&$n(t.prototype,null),e&&$n(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();Xn=er,tr=["onApprove","token","PayerID","payerID","button_session_id","billingToken","orderID","switch_initiated_time","onCancel","onError"],(Zn=Kn(Zn="PAYPAL_PARAMS"))in Xn?Object.defineProperty(Xn,Zn,{value:tr,enumerable:!0,configurable:!0,writable:!0}):Xn[Zn]=tr;const nr=er;function rr(t){return rr="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},rr(t)}function or(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ir(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ar(r.key),r)}}function ar(t){var e=function(t){if("object"!=rr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=rr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==rr(e)?e:e+""}var ur=function(){return function(t,e){return e&&ir(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n,r,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e,this.cartUpdater=n,this.formElement=r,this.errorHandler=o,this.cartHelper=null},[{key:"subscriptionsConfiguration",value:function(t){var e=this;return{createSubscription:function(e,n){return n.subscription.create({plan_id:t})},onApprove:function(t,n){fetch(e.config.ajax.approve_subscription.endpoint,{method:"POST",credentials:"same-origin",body:JSON.stringify({nonce:e.config.ajax.approve_subscription.nonce,order_id:t.orderID,subscription_id:t.subscriptionID})}).then(function(t){return t.json()}).then(function(){var t=e.getSubscriptionProducts();fetch(e.config.ajax.change_cart.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:e.config.ajax.change_cart.nonce,products:t})}).then(function(t){return t.json()}).then(function(t){if(!t.success)throw console.log(t),Error(t.data.message);location.href=e.config.redirect})})},onError:function(t){console.error(t),nr.reloadButtonsIfRequired(e.config.button.wrapper)}}}},{key:"getSubscriptionProducts",value:function(){var t=document.querySelector('[name="add-to-cart"]').value;return[new dn(t,1,this.variations(),this.extraFields())]}},{key:"configuration",value:function(){var t=this;return{createOrder:this.createOrder(),onApprove:Mn(this,this.errorHandler),onError:function(e){t.refreshMiniCart(),t.isBookingProduct()&&e.message?(t.errorHandler.clear(),t.errorHandler.message(e.message)):t.errorHandler.genericError(),nr.reloadButtonsIfRequired(t.config.button.wrapper)},onCancel:function(){t.isBookingProduct()?t.cleanCart():t.refreshMiniCart(),nr.reloadButtonsIfRequired(t.config.button.wrapper)}}}},{key:"getProducts",value:function(){var t=this;if(this.isBookingProduct()){var e=document.querySelector('[name="add-to-cart"]').value;return[new En(e,1,Jn.getPrefixedFields(this.formElement,"wc_bookings_field"),this.extraFields())]}if(this.isGroupedProduct()){var n=[];return this.formElement.querySelectorAll('input[type="number"]').forEach(function(e){if(e.value){var r=e.getAttribute("name").match(/quantity\[([\d]*)\]/);if(2===r.length){var o=parseInt(r[1]),i=parseInt(e.value);n.push(new dn(o,i,null,t.extraFields()))}}}),n}var r=document.querySelector('[name="add-to-cart"]').value,o=document.querySelector('[name="quantity"]').value,i=this.variations();return[new dn(r,o,i,this.extraFields())]}},{key:"extraFields",value:function(){return Jn.getFilteredFields(this.formElement,["add-to-cart","quantity","product_id","variation_id"],["attribute_","wc_bookings_field"])}},{key:"createOrder",value:function(){var t=this;return this.cartHelper=null,function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.errorHandler.clear(),t.cartUpdater.update(function(e){t.cartHelper=(new qn).addFromPurchaseUnits(e);var n=re(),r=void 0!==t.config.bn_codes[t.config.context]?t.config.bn_codes[t.config.context]:"";return fetch(t.config.ajax.create_order.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:t.config.ajax.create_order.nonce,purchase_units:e,payer:n,bn_code:r,payment_method:st,funding_source:window.ppcpFundingSource,context:t.config.context})}).then(function(t){return t.json()}).then(function(t){if(!t.success)throw console.error(t),Error(t.data.message);return t.data.id})},t.getProducts(),r.updateCartOptions||{})}}},{key:"updateCart",value:function(t){return this.cartUpdater.update(function(t){return t},this.getProducts(),t)}},{key:"variations",value:function(){return this.hasVariations()?function(t){return function(t){if(Array.isArray(t))return or(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return or(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?or(t,e):void 0}}(t)||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.")}()}(this.formElement.querySelectorAll("[name^='attribute_']")).map(function(t){return{value:t.value,name:t.name}}):null}},{key:"hasVariations",value:function(){return this.formElement.classList.contains("variations_form")}},{key:"isGroupedProduct",value:function(){return this.formElement.classList.contains("grouped_form")}},{key:"isBookingProduct",value:function(){return!!this.formElement.querySelector(".wc-booking-product-id")}},{key:"cleanCart",value:function(){var t=this;this.cartHelper.removeFromCart().then(function(){t.refreshMiniCart()}).catch(function(e){t.refreshMiniCart()})}},{key:"refreshMiniCart",value:function(){jQuery(document.body).trigger("wc_fragment_refresh")}}])}();const cr=ur;function lr(t){return lr="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},lr(t)}function sr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,fr(r.key),r)}}function fr(t){var e=function(t){if("object"!=lr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=lr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==lr(e)?e:e+""}var pr=function(){return function(t,e){return e&&sr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.endpoint=e,this.nonce=n},[{key:"simulate",value:function(t,e){var n=this;return new Promise(function(r,o){fetch(n.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:n.nonce,products:e})}).then(function(t){return t.json()}).then(function(e){if(e.success){var n=t(e.data);r(n)}else o(e.data)})})}}])}();const yr=pr;function dr(t){return dr="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},dr(t)}function hr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,vr(r.key),r)}}function vr(t){var e=function(t){if("object"!=dr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=dr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==dr(e)?e:e+""}var br=function(){return function(t,e){return e&&hr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.genericErrorText=e,this.wrapper=n},[{key:"genericError",value:function(){this.clear(),this.message(this.genericErrorText)}},{key:"appendPreparedErrorMessageElement",value:function(t){this._getMessageContainer().replaceWith(t)}},{key:"message",value:function(t){this._addMessage(t),this._scrollToMessages()}},{key:"messages",value:function(t){var e=this;t.forEach(function(t){return e._addMessage(t)}),this._scrollToMessages()}},{key:"currentHtml",value:function(){return this._getMessageContainer().outerHTML}},{key:"_addMessage",value:function(t){if("undefined"!=typeof String&&!dr(String)||0===t.length)throw new Error("A new message text must be a non-empty string.");var e=this._getMessageContainer(),n=this._prepareMessageElement(t);e.appendChild(n)}},{key:"_scrollToMessages",value:function(){jQuery.scroll_to_notices(jQuery(".woocommerce-error"))}},{key:"_getMessageContainer",value:function(){var t=document.querySelector("ul.woocommerce-error");return null===t&&((t=document.createElement("ul")).setAttribute("class","woocommerce-error"),t.setAttribute("role","alert"),jQuery(this.wrapper).prepend(t)),t}},{key:"_prepareMessageElement",value:function(t){var e=document.createElement("li");return e.innerHTML=t,e}},{key:"clear",value:function(){jQuery(".woocommerce-error, .woocommerce-message").remove()}}])}();const mr=br;function gr(t){return gr="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},gr(t)}function wr(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Sr(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?wr(Object(n),!0).forEach(function(e){jr(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wr(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function jr(t,e,n){return(e=Pr(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Or(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Pr(r.key),r)}}function Pr(t){var e=function(t){if("object"!=gr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=gr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==gr(e)?e:e+""}var _r=function(){return function(t,e){return e&&Or(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.endpoint=e,this.nonce=n},[{key:"update",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(function(o,i){fetch(n.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(Sr({nonce:n.nonce,products:e},r))}).then(function(t){return t.json()}).then(function(e){if(e.success){var n=t(e.data);o(n)}else i(e.data)})})}}])}();const kr=_r;function Er(t){return Er="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},Er(t)}function Cr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Tr(r.key),r)}}function Tr(t){var e=function(t){if("object"!=Er(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Er(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Er(e)?e:e+""}var Ar=function(){return function(t,e){return e&&Cr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e,this.errorHandler=n},[{key:"subscriptionsConfiguration",value:function(t){var e=this;return{createSubscription:function(e,n){return n.subscription.create({plan_id:t})},onApprove:function(t){fetch(e.config.ajax.approve_subscription.endpoint,{method:"POST",credentials:"same-origin",body:JSON.stringify({nonce:e.config.ajax.approve_subscription.nonce,order_id:t.orderID,subscription_id:t.subscriptionID,should_create_wc_order:!e.config.vaultingEnabled||"venmo"!==t.paymentSource})}).then(function(t){return t.json()}).then(function(t){var n;if(!t.success)throw Error(t.data.message);var r=null===(n=t.data)||void 0===n?void 0:n.order_received_url;location.href=r||e.config.redirect})},onError:function(t){console.error(t)}}}},{key:"configuration",value:function(){var t=this;return{createOrder:function(){var e=re(),n=void 0!==t.config.bn_codes[t.config.context]?t.config.bn_codes[t.config.context]:"";return fetch(t.config.ajax.create_order.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:t.config.ajax.create_order.nonce,purchase_units:[],payment_method:st,funding_source:window.ppcpFundingSource,bn_code:n,payer:e,context:t.config.context})}).then(function(t){return t.json()}).then(function(t){if(!t.success)throw console.error(t),Error(t.data.message);return t.data.id})},onApprove:Mn(this,this.errorHandler),onCancel:function(){nr.reloadButtonsIfRequired(t.config.button.wrapper)},onError:function(){t.errorHandler.genericError(),nr.reloadButtonsIfRequired(t.config.button.wrapper)}}}}])}();const xr=Ar;function Ir(t){return Ir="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},Ir(t)}function Mr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Rr(r.key),r)}}function Rr(t){var e=function(t){if("object"!=Ir(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ir(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ir(e)?e:e+""}function Dr(t,e,n){(function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")})(t,e),e.set(t,n)}function Br(t,e){return t.get(Gr(t,e))}function Fr(t,e,n){return t.set(Gr(t,e),n),n}function Gr(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var Hr=new WeakMap,qr=new WeakMap,Nr=new WeakMap,Wr=new WeakMap,Lr=function(){return function(t,e){return e&&Mr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n,r,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Dr(this,Hr,""),Dr(this,qr,""),Dr(this,Nr,0),Dr(this,Wr,0),Fr(Hr,this,o),Fr(qr,this,r),n=this.toAmount(n),e=this.toAmount(e),this.shippingFee=n,this.amount=e-n},[{key:"amount",get:function(){return Br(Nr,this)},set:function(t){Fr(Nr,this,this.toAmount(t))}},{key:"shippingFee",get:function(){return Br(Wr,this)},set:function(t){Fr(Wr,this,this.toAmount(t))}},{key:"currencyCode",get:function(){return Br(qr,this)}},{key:"countryCode",get:function(){return Br(Hr,this)}},{key:"totalPrice",get:function(){return(Br(Nr,this)+Br(Wr,this)).toFixed(2)}},{key:"finalObject",get:function(){return{countryCode:this.countryCode,currencyCode:this.currencyCode,totalPriceStatus:"FINAL",totalPrice:this.totalPrice}}},{key:"toAmount",value:function(t){return t=Number(t)||0,Math.round(100*t)/100}},{key:"setTotal",value:function(t,e){(t=this.toAmount(t))&&(this.shippingFee=e,this.amount=t-this.shippingFee)}}])}();function Qr(t){return Qr="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},Qr(t)}function Ur(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,zr(r.key),r)}}function zr(t){var e=function(t){if("object"!=Qr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Qr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Qr(e)?e:e+""}var Vr=function(){return function(t,e){return e&&Ur(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.buttonConfig=e,this.ppcpConfig=n,this.externalHandler=r},[{key:"validateContext",value:function(){var t;return null===(t=this.ppcpConfig)||void 0===t||null===(t=t.locations_with_subscription_product)||void 0===t||!t.cart}},{key:"shippingAllowed",value:function(){return this.buttonConfig.shipping.enabled&&this.buttonConfig.shipping.configured}},{key:"transactionInfo",value:function(){var t=this;return new Promise(function(e,n){fetch(t.ppcpConfig.ajax.cart_script_params.endpoint,{method:"GET",credentials:"same-origin"}).then(function(t){return t.json()}).then(function(t){if(t.success){var n=t.data,r=new Lr(n.total,n.shipping_fee,n.currency_code,n.country_code);e(r)}})})}},{key:"createOrder",value:function(){return this.actionHandler().configuration().createOrder(null,null)}},{key:"approveOrder",value:function(t,e){return this.actionHandler().configuration().onApprove(t,e)}},{key:"actionHandler",value:function(){return new xr(this.ppcpConfig,this.errorHandler())}},{key:"errorHandler",value:function(){return new mr(this.ppcpConfig.labels.error.generic,document.querySelector(".woocommerce-notices-wrapper"))}}])}();const Jr=Vr;function Yr(t){return Yr="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},Yr(t)}function $r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Kr(r.key),r)}}function Kr(t){var e=function(t){if("object"!=Yr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Yr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Yr(e)?e:e+""}function Xr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Xr=function(){return!!t})()}function Zr(t){return Zr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zr(t)}function to(t,e){return to=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},to(t,e)}var eo=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=Zr(e),function(t,e){if(e&&("object"==Yr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Xr()?Reflect.construct(e,n||[],Zr(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&to(t,e)}(e,t),function(t,e){return e&&$r(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"validateContext",value:function(){var t;return null===(t=this.ppcpConfig)||void 0===t||null===(t=t.locations_with_subscription_product)||void 0===t||!t.product}},{key:"transactionInfo",value:function(){var t=this,e=new mr(this.ppcpConfig.labels.error.generic,document.querySelector(".woocommerce-notices-wrapper")),n=new cr(null,null,document.querySelector("form.cart"),e),r=PayPalCommerceGateway.data_client_id.has_subscriptions&&PayPalCommerceGateway.data_client_id.paypal_subscriptions_enabled?n.getSubscriptionProducts():n.getProducts();return new Promise(function(e,n){new yr(t.ppcpConfig.ajax.simulate_cart.endpoint,t.ppcpConfig.ajax.simulate_cart.nonce).simulate(function(t){var n=new Lr(t.total,t.shipping_fee,t.currency_code,t.country_code);e(n)},r)})}},{key:"validateForm",value:function(){return this.actionHandler().updateCart({keepShipping:!0})}},{key:"createOrder",value:function(){return this.actionHandler().configuration().createOrder(null,null,{updateCartOptions:{keepShipping:!0}})}},{key:"actionHandler",value:function(){return new cr(this.ppcpConfig,new kr(this.ppcpConfig.ajax.change_cart.endpoint,this.ppcpConfig.ajax.change_cart.nonce),document.querySelector("form.cart"),this.errorHandler())}}])}(Jr);const no=eo;function ro(t){return ro="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},ro(t)}function oo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(oo=function(){return!!t})()}function io(t){return io=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},io(t)}function ao(t,e){return ao=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ao(t,e)}var uo=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=io(e),function(t,e){if(e&&("object"==ro(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,oo()?Reflect.construct(e,n||[],io(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ao(t,e)}(e,t),function(t){return Object.defineProperty(t,"prototype",{writable:!1}),t}(e)}(Jr);const co=uo;!function(){var t;function e(t){var e=0;return function(){return e<t.length?{done:!1,value:t[e++]}:{done:!0}}}var n,r="function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,n){return t==Array.prototype||t==Object.prototype||(t[e]=n.value),t},o=function(t){t=["object"==typeof globalThis&&globalThis,t,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof globalThis&&globalThis];for(var e=0;e<t.length;++e){var n=t[e];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);function i(t,e){if(e)t:{var n=o;t=t.split(".");for(var i=0;i<t.length-1;i++){var a=t[i];if(!(a in n))break t;n=n[a]}(e=e(i=n[t=t[t.length-1]]))!=i&&null!=e&&r(n,t,{configurable:!0,writable:!0,value:e})}}function a(t){return(t={next:t})[Symbol.iterator]=function(){return this},t}function u(t){var n="undefined"!=typeof Symbol&&Symbol.iterator&&t[Symbol.iterator];return n?n.call(t):{next:e(t)}}if(i("Symbol",function(t){function e(t,e){this.A=t,r(this,"description",{configurable:!0,writable:!0,value:e})}if(t)return t;e.prototype.toString=function(){return this.A};var n="jscomp_symbol_"+(1e9*Math.random()>>>0)+"_",o=0;return function t(r){if(this instanceof t)throw new TypeError("Symbol is not a constructor");return new e(n+(r||"")+"_"+o++,r)}}),i("Symbol.iterator",function(t){if(t)return t;t=Symbol("Symbol.iterator");for(var n="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),i=0;i<n.length;i++){var u=o[n[i]];"function"==typeof u&&"function"!=typeof u.prototype[t]&&r(u.prototype,t,{configurable:!0,writable:!0,value:function(){return a(e(this))}})}return t}),"function"==typeof Object.setPrototypeOf)n=Object.setPrototypeOf;else{var c;t:{var l={};try{l.__proto__={a:!0},c=l.a;break t}catch(t){}c=!1}n=c?function(t,e){if(t.__proto__=e,t.__proto__!==e)throw new TypeError(t+" is not extensible");return t}:null}var s=n;function f(){this.m=!1,this.j=null,this.v=void 0,this.h=1,this.u=this.C=0,this.l=null}function p(t){if(t.m)throw new TypeError("Generator is already running");t.m=!0}function y(t,e){return t.h=3,{value:e}}function d(t){this.g=new f,this.G=t}function h(t,e,n,r){try{var o=e.call(t.g.j,n);if(!(o instanceof Object))throw new TypeError("Iterator result "+o+" is not an object");if(!o.done)return t.g.m=!1,o;var i=o.value}catch(e){return t.g.j=null,t.g.s(e),v(t)}return t.g.j=null,r.call(t.g,i),v(t)}function v(t){for(;t.g.h;)try{var e=t.G(t.g);if(e)return t.g.m=!1,{value:e.value,done:!1}}catch(e){t.g.v=void 0,t.g.s(e)}if(t.g.m=!1,t.g.l){if(e=t.g.l,t.g.l=null,e.F)throw e.D;return{value:e.return,done:!0}}return{value:void 0,done:!0}}function b(t){this.next=function(e){return t.o(e)},this.throw=function(e){return t.s(e)},this.return=function(e){return function(t,e){p(t.g);var n=t.g.j;return n?h(t,"return"in n?n.return:function(t){return{value:t,done:!0}},e,t.g.return):(t.g.return(e),v(t))}(t,e)},this[Symbol.iterator]=function(){return this}}function m(t,e){return e=new b(new d(e)),s&&t.prototype&&s(e,t.prototype),e}if(f.prototype.o=function(t){this.v=t},f.prototype.s=function(t){this.l={D:t,F:!0},this.h=this.C||this.u},f.prototype.return=function(t){this.l={return:t},this.h=this.u},d.prototype.o=function(t){return p(this.g),this.g.j?h(this,this.g.j.next,t,this.g.o):(this.g.o(t),v(this))},d.prototype.s=function(t){return p(this.g),this.g.j?h(this,this.g.j.throw,t,this.g.o):(this.g.s(t),v(this))},i("Array.prototype.entries",function(t){return t||function(){return function(t,e){t instanceof String&&(t+="");var n=0,r=!1,o={next:function(){if(!r&&n<t.length){var o=n++;return{value:e(o,t[o]),done:!1}}return r=!0,{done:!0,value:void 0}}};return o[Symbol.iterator]=function(){return o},o}(this,function(t,e){return[t,e]})}}),"undefined"!=typeof Blob&&("undefined"==typeof FormData||!FormData.prototype.keys)){var g=function(t,e){for(var n=0;n<t.length;n++)e(t[n])},w=function(t){return t.replace(/\r?\n|\r/g,"\r\n")},S=function(t,e,n){return e instanceof Blob?(n=void 0!==n?String(n+""):"string"==typeof e.name?e.name:"blob",e.name===n&&"[object Blob]"!==Object.prototype.toString.call(e)||(e=new File([e],n)),[String(t),e]):[String(t),String(e)]},j=function(t,e){if(t.length<e)throw new TypeError(e+" argument required, but only "+t.length+" present.")},O="object"==typeof globalThis?globalThis:"object"==typeof window?window:"object"==typeof self?self:this,P=O.FormData,_=O.XMLHttpRequest&&O.XMLHttpRequest.prototype.send,k=O.Request&&O.fetch,E=O.navigator&&O.navigator.sendBeacon,C=O.Element&&O.Element.prototype,T=O.Symbol&&Symbol.toStringTag;T&&(Blob.prototype[T]||(Blob.prototype[T]="Blob"),"File"in O&&!File.prototype[T]&&(File.prototype[T]="File"));try{new File([],"")}catch(t){O.File=function(t,e,n){return t=new Blob(t,n||{}),Object.defineProperties(t,{name:{value:e},lastModified:{value:+(n&&void 0!==n.lastModified?new Date(n.lastModified):new Date)},toString:{value:function(){return"[object File]"}}}),T&&Object.defineProperty(t,T,{value:"File"}),t}}var A=function(t){return t.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22")},x=function(t){this.i=[];var e=this;t&&g(t.elements,function(t){if(t.name&&!t.disabled&&"submit"!==t.type&&"button"!==t.type&&!t.matches("form fieldset[disabled] *"))if("file"===t.type){var n=t.files&&t.files.length?t.files:[new File([],"",{type:"application/octet-stream"})];g(n,function(n){e.append(t.name,n)})}else"select-multiple"===t.type||"select-one"===t.type?g(t.options,function(n){!n.disabled&&n.selected&&e.append(t.name,n.value)}):"checkbox"===t.type||"radio"===t.type?t.checked&&e.append(t.name,t.value):(n="textarea"===t.type?w(t.value):t.value,e.append(t.name,n))})};if((t=x.prototype).append=function(t,e,n){j(arguments,2),this.i.push(S(t,e,n))},t.delete=function(t){j(arguments,1);var e=[];t=String(t),g(this.i,function(n){n[0]!==t&&e.push(n)}),this.i=e},t.entries=function t(){var e,n=this;return m(t,function(t){if(1==t.h&&(e=0),3!=t.h)return e<n.i.length?t=y(t,n.i[e]):(t.h=0,t=void 0),t;e++,t.h=2})},t.forEach=function(t,e){j(arguments,1);for(var n=u(this),r=n.next();!r.done;r=n.next()){var o=u(r.value);r=o.next().value,o=o.next().value,t.call(e,o,r,this)}},t.get=function(t){j(arguments,1);var e=this.i;t=String(t);for(var n=0;n<e.length;n++)if(e[n][0]===t)return e[n][1];return null},t.getAll=function(t){j(arguments,1);var e=[];return t=String(t),g(this.i,function(n){n[0]===t&&e.push(n[1])}),e},t.has=function(t){j(arguments,1),t=String(t);for(var e=0;e<this.i.length;e++)if(this.i[e][0]===t)return!0;return!1},t.keys=function t(){var e,n,r,o=this;return m(t,function(t){if(1==t.h&&(e=u(o),n=e.next()),3!=t.h)return n.done?void(t.h=0):(r=n.value,y(t,u(r).next().value));n=e.next(),t.h=2})},t.set=function(t,e,n){j(arguments,2),t=String(t);var r=[],o=S(t,e,n),i=!0;g(this.i,function(e){e[0]===t?i&&(i=!r.push(o)):r.push(e)}),i&&r.push(o),this.i=r},t.values=function t(){var e,n,r,o,i=this;return m(t,function(t){if(1==t.h&&(e=u(i),n=e.next()),3!=t.h)return n.done?void(t.h=0):(r=n.value,(o=u(r)).next(),y(t,o.next().value));n=e.next(),t.h=2})},x.prototype._asNative=function(){for(var t=new P,e=u(this),n=e.next();!n.done;n=e.next()){var r=u(n.value);n=r.next().value,r=r.next().value,t.append(n,r)}return t},x.prototype._blob=function(){var t="----formdata-polyfill-"+Math.random(),e=[],n="--"+t+'\r\nContent-Disposition: form-data; name="';return this.forEach(function(t,r){return"string"==typeof t?e.push(n+A(w(r))+'"\r\n\r\n'+w(t)+"\r\n"):e.push(n+A(w(r))+'"; filename="'+A(t.name)+'"\r\nContent-Type: '+(t.type||"application/octet-stream")+"\r\n\r\n",t,"\r\n")}),e.push("--"+t+"--"),new Blob(e,{type:"multipart/form-data; boundary="+t})},x.prototype[Symbol.iterator]=function(){return this.entries()},x.prototype.toString=function(){return"[object FormData]"},C&&!C.matches&&(C.matches=C.matchesSelector||C.mozMatchesSelector||C.msMatchesSelector||C.oMatchesSelector||C.webkitMatchesSelector||function(t){for(var e=(t=(this.document||this.ownerDocument).querySelectorAll(t)).length;0<=--e&&t.item(e)!==this;);return-1<e}),T&&(x.prototype[T]="FormData"),_){var I=O.XMLHttpRequest.prototype.setRequestHeader;O.XMLHttpRequest.prototype.setRequestHeader=function(t,e){I.call(this,t,e),"content-type"===t.toLowerCase()&&(this.B=!0)},O.XMLHttpRequest.prototype.send=function(t){t instanceof x?(t=t._blob(),this.B||this.setRequestHeader("Content-Type",t.type),_.call(this,t)):_.call(this,t)}}k&&(O.fetch=function(t,e){return e&&e.body&&e.body instanceof x&&(e.body=e.body._blob()),k.call(this,t,e)}),E&&(O.navigator.sendBeacon=function(t,e){return e instanceof x&&(e=e._asNative()),E.call(this,t,e)}),O.FormData=x}}();function lo(t){return lo="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},lo(t)}function so(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return fo(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(fo(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,fo(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,fo(f,"constructor",l),fo(l,"constructor",c),c.displayName="GeneratorFunction",fo(l,o,"GeneratorFunction"),fo(f),fo(f,o,"Generator"),fo(f,r,function(){return this}),fo(f,"toString",function(){return"[object Generator]"}),(so=function(){return{w:i,m:p}})()}function fo(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}fo=function(t,e,n,r){function i(e,n){fo(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},fo(t,e,n,r)}function po(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function yo(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ho(r.key),r)}}function ho(t){var e=function(t){if("object"!=lo(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=lo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==lo(e)?e:e+""}var vo=function(){return function(t,e){return e&&yo(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.url=e,this.nonce=n},[{key:"validate",value:(t=so().m(function t(e){var n,r,o;return so().w(function(t){for(;;)switch(t.n){case 0:return n=new FormData(e),t.n=1,fetch(this.url,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:this.nonce,form_encoded:new URLSearchParams(n).toString()})});case 1:return r=t.v,t.n=2,r.json();case 2:if((o=t.v).success){t.n=4;break}if(o.data.refresh&&jQuery(document.body).trigger("update_checkout"),!o.data.errors){t.n=3;break}return t.a(2,o.data.errors);case 3:throw Error(o.data.message);case 4:return t.a(2,[])}},t,this)}),e=function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){po(i,r,o,a,u,"next",t)}function u(t){po(i,r,o,a,u,"throw",t)}a(void 0)})},function(_x){return e.apply(this,arguments)})}]);var t,e}();function bo(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return mo(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(mo(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,mo(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,mo(f,"constructor",l),mo(l,"constructor",c),c.displayName="GeneratorFunction",mo(l,o,"GeneratorFunction"),mo(f),mo(f,o,"Generator"),mo(f,r,function(){return this}),mo(f,"toString",function(){return"[object Generator]"}),(bo=function(){return{w:i,m:p}})()}function mo(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}mo=function(t,e,n,r){function i(e,n){mo(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},mo(t,e,n,r)}function go(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}const wo=function(t){return new Promise(function(){var e,n=(e=bo().m(function e(n,r){var o,i,a,u,c;return bo().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,o=new In,i=new mr(t.labels.error.generic,document.querySelector(".woocommerce-notices-wrapper")),a="checkout"===t.context?"form.checkout":"form#order_review",u=t.early_checkout_validation_enabled?new vo(t.ajax.validate_checkout.endpoint,t.ajax.validate_checkout.nonce):null){e.n=1;break}return n(),e.a(2);case 1:u.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()]),r()):n()}),e.n=3;break;case 2:e.p=2,c=e.v,console.error(c),r();case 3:return e.a(2)}},e,null,[[0,2]])}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(t){go(i,r,o,a,u,"next",t)}function u(t){go(i,r,o,a,u,"throw",t)}a(void 0)})});return function(_x,t){return n.apply(this,arguments)}}())};function So(t){return So="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},So(t)}function jo(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return Oo(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Oo(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,Oo(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,Oo(f,"constructor",l),Oo(l,"constructor",c),c.displayName="GeneratorFunction",Oo(l,o,"GeneratorFunction"),Oo(f),Oo(f,o,"Generator"),Oo(f,r,function(){return this}),Oo(f,"toString",function(){return"[object Generator]"}),(jo=function(){return{w:i,m:p}})()}function Oo(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Oo=function(t,e,n,r){function i(e,n){Oo(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},Oo(t,e,n,r)}function Po(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function _o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ko(r.key),r)}}function ko(t){var e=function(t){if("object"!=So(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=So(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==So(e)?e:e+""}var Eo=function(){return function(t,e){return e&&_o(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e,this.errorHandler=n,this.spinner=r},[{key:"subscriptionsConfiguration",value:function(t){var e,n,r=this;return{createSubscription:(e=jo().m(function e(n,o){return jo().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,wo(r.config);case 1:e.n=3;break;case 2:throw e.p=2,e.v,{type:"form-validation-error"};case 3:return e.a(2,o.subscription.create({plan_id:t}))}},e,null,[[0,2]])}),n=function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(t){Po(i,r,o,a,u,"next",t)}function u(t){Po(i,r,o,a,u,"throw",t)}a(void 0)})},function(_x,t){return n.apply(this,arguments)}),onApprove:function(t,e){fetch(r.config.ajax.approve_subscription.endpoint,{method:"POST",credentials:"same-origin",body:JSON.stringify({nonce:r.config.ajax.approve_subscription.nonce,order_id:t.orderID,subscription_id:t.subscriptionID})}).then(function(t){return t.json()}).then(function(t){document.querySelector("#place_order").click()})},onError:function(t){console.error(t)}}}},{key:"configuration",value:function(){var t,e,n=this,r=this.spinner;return{createOrder:function(t,e){var o,i=re(),a=void 0!==n.config.bn_codes[n.config.context]?n.config.bn_codes[n.config.context]:"",u=n.errorHandler,c="checkout"===n.config.context?"form.checkout":"form#order_review",l=new FormData(document.querySelector(c)),s=!!jQuery("#createaccount").is(":checked"),f=pt(),p=window.ppcpFundingSource,y=!(null===(o=document.getElementById("wc-ppcp-credit-card-gateway-new-payment-method"))||void 0===o||!o.checked);return fetch(n.config.ajax.create_order.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:n.config.ajax.create_order.nonce,payer:i,bn_code:a,context:n.config.context,order_id:n.config.order_id,order_key:n.config.order_key,payment_method:f,funding_source:p,form_encoded:new URLSearchParams(l).toString(),createaccount:s,save_payment_method:y})}).then(function(t){return t.json()}).then(function(t){if(!t.success){if(r.unblock(),void 0!==t.messages){var e=new DOMParser;u.appendPreparedErrorMessageElement(e.parseFromString(t.messages,"text/html").querySelector("ul"))}else{var n,o;u.clear(),t.data.refresh&&jQuery(document.body).trigger("update_checkout"),(null===(n=t.data.errors)||void 0===n?void 0:n.length)>0?u.messages(t.data.errors):(null===(o=t.data.details)||void 0===o?void 0:o.length)>0?u.message(t.data.details.map(function(t){return"".concat(t.issue," ").concat(t.description)}).join("<br/>")):u.message(t.data.message),jQuery(document.body).trigger("checkout_error",[u.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(c).appendChild(i),t.data.id})},onApprove:(t=this,e=this.errorHandler,function(n,r){var o=In.fullPage();return o.block(),e.clear(),nr.isResumeFlow()&&nr.cleanHashParams(),fetch(t.config.ajax.approve_order.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:t.config.ajax.approve_order.nonce,order_id:n.orderID,funding_source:window.ppcpFundingSource})}).then(function(t){return t.json()}).then(function(t){if(!t.success){if(100===t.data.code?e.message(t.data.message):e.genericError(),void 0!==r&&void 0!==r.restart)return r.restart();throw new Error(t.data.message)}pt().startsWith("ppcp-")||jQuery('input[name="payment_method"][value="'.concat(st,'"]')).prop("checked",!0),document.querySelector("#place_order").click()}).finally(function(){o.unblock()})}),onCancel:function(){r.unblock(),nr.reloadButtonsIfRequired(n.config.button.wrapper)},onError:function(t){console.error(t),r.unblock(),t&&"create-order-error"===t.type||(n.errorHandler.genericError(),nr.reloadButtonsIfRequired(n.config.button.wrapper))}}}}])}();const Co=Eo;function To(t){return To="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},To(t)}function Ao(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return xo(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(xo(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,xo(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,xo(f,"constructor",l),xo(l,"constructor",c),c.displayName="GeneratorFunction",xo(l,o,"GeneratorFunction"),xo(f),xo(f,o,"Generator"),xo(f,r,function(){return this}),xo(f,"toString",function(){return"[object Generator]"}),(Ao=function(){return{w:i,m:p}})()}function xo(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}xo=function(t,e,n,r){function i(e,n){xo(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},xo(t,e,n,r)}function Io(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function Mo(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ro(r.key),r)}}function Ro(t){var e=function(t){if("object"!=To(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=To(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==To(e)?e:e+""}function Do(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Do=function(){return!!t})()}function Bo(t){return Bo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bo(t)}function Fo(t,e){return Fo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Fo(t,e)}var Go=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=Bo(e),function(t,e){if(e&&("object"==To(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Do()?Reflect.construct(e,n||[],Bo(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Fo(t,e)}(e,t),function(t,e){return e&&Mo(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"validateForm",value:function(){var t=this;return new Promise(function(){var e,n=(e=Ao().m(function e(n,r){var o,i,a,u,c;return Ao().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,o=new In,i=t.errorHandler(),a="checkout"===t.ppcpConfig.context?"form.checkout":"form#order_review",u=t.ppcpConfig.early_checkout_validation_enabled?new vo(t.ppcpConfig.ajax.validate_checkout.endpoint,t.ppcpConfig.ajax.validate_checkout.nonce):null){e.n=1;break}return n(),e.a(2);case 1:u.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()]),r()):n()}),e.n=3;break;case 2:e.p=2,c=e.v,console.error(c),r();case 3:return e.a(2)}},e,null,[[0,2]])}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(t){Io(i,r,o,a,u,"next",t)}function u(t){Io(i,r,o,a,u,"throw",t)}a(void 0)})});return function(_x,t){return n.apply(this,arguments)}}())}},{key:"actionHandler",value:function(){return new Co(this.ppcpConfig,this.errorHandler(),new In)}}])}(Jr);const Ho=Go;function qo(t){return qo="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},qo(t)}function No(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(No=function(){return!!t})()}function Wo(t){return Wo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wo(t)}function Lo(t,e){return Lo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Lo(t,e)}var Qo=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=Wo(e),function(t,e){if(e&&("object"==qo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,No()?Reflect.construct(e,n||[],Wo(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Lo(t,e)}(e,t),function(t){return Object.defineProperty(t,"prototype",{writable:!1}),t}(e)}(Jr);const Uo=Qo;function zo(t){return zo="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},zo(t)}function Vo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Vo=function(){return!!t})()}function Jo(t){return Jo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Jo(t)}function Yo(t,e){return Yo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Yo(t,e)}var $o=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=Jo(e),function(t,e){if(e&&("object"==zo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Vo()?Reflect.construct(e,n||[],Jo(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Yo(t,e)}(e,t),function(t){return Object.defineProperty(t,"prototype",{writable:!1}),t}(e)}(Jr);const Ko=$o;function Xo(t){return Xo="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},Xo(t)}function Zo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Zo=function(){return!!t})()}function ti(t){return ti=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ti(t)}function ei(t,e){return ei=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ei(t,e)}var ni=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=ti(e),function(t,e){if(e&&("object"==Xo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Zo()?Reflect.construct(e,n||[],ti(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ei(t,e)}(e,t),function(t){return Object.defineProperty(t,"prototype",{writable:!1}),t}(e)}(Jr);const ri=ni;function oi(t){return oi="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},oi(t)}function ii(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return ai(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(ai(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,ai(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,ai(f,"constructor",l),ai(l,"constructor",c),c.displayName="GeneratorFunction",ai(l,o,"GeneratorFunction"),ai(f),ai(f,o,"Generator"),ai(f,r,function(){return this}),ai(f,"toString",function(){return"[object Generator]"}),(ii=function(){return{w:i,m:p}})()}function ai(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}ai=function(t,e,n,r){function i(e,n){ai(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},ai(t,e,n,r)}function ui(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function ci(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,li(r.key),r)}}function li(t){var e=function(t){if("object"!=oi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=oi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==oi(e)?e:e+""}function si(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(si=function(){return!!t})()}function fi(t){return fi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fi(t)}function pi(t,e){return pi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},pi(t,e)}var yi=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=fi(e),function(t,e){if(e&&("object"==oi(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,si()?Reflect.construct(e,n||[],fi(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&pi(t,e)}(e,t),function(t,e){return e&&ci(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"validateContext",value:function(){var t;return null===(t=this.ppcpConfig)||void 0===t||null===(t=t.locations_with_subscription_product)||void 0===t||!t.payorder}},{key:"transactionInfo",value:function(){var t=this;return new Promise(function(){var e,n=(e=ii().m(function e(n,r){var o,i;return ii().w(function(e){for(;;)switch(e.n){case 0:o=t.ppcpConfig.pay_now,i=new Lr(o.total,o.shipping_fee,o.currency_code,o.country_code),n(i);case 1:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(t){ui(i,r,o,a,u,"next",t)}function u(t){ui(i,r,o,a,u,"throw",t)}a(void 0)})});return function(_x,t){return n.apply(this,arguments)}}())}},{key:"actionHandler",value:function(){return new Co(this.ppcpConfig,this.errorHandler(),new In)}}])}(Jr);const di=yi;function hi(t){return hi="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},hi(t)}function vi(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,bi(r.key),r)}}function bi(t){var e=function(t){if("object"!=hi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=hi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==hi(e)?e:e+""}function mi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(mi=function(){return!!t})()}function gi(t){return gi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},gi(t)}function wi(t,e){return wi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},wi(t,e)}var Si=function(t){function e(t,n,r){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=gi(e),function(t,e){if(e&&("object"==hi(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,mi()?Reflect.construct(e,n||[],gi(t).constructor):e.apply(t,n))}(this,e,[t,n,r])}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&wi(t,e)}(e,t),function(t,e){return e&&vi(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"transactionInfo",value:function(){throw new Error("Transaction info fail. This is just a preview.")}},{key:"createOrder",value:function(){throw new Error("Create order fail. This is just a preview.")}},{key:"approveOrder",value:function(t,e){throw new Error("Approve order fail. This is just a preview.")}},{key:"actionHandler",value:function(){throw new Error("Action handler fail. This is just a preview.")}},{key:"errorHandler",value:function(){throw new Error("Error handler fail. This is just a preview.")}}])}(Jr);const ji=Si;function Oi(t){return Oi="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},Oi(t)}function Pi(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,_i(r.key),r)}}function _i(t){var e=function(t){if("object"!=Oi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Oi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Oi(e)?e:e+""}var ki=function(){return function(t,e,n){return n&&Pi(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},0,[{key:"create",value:function(t,e,n,r){switch(t){case"product":return new no(e,n,r);case"cart":return new co(e,n,r);case"checkout":return new Ho(e,n,r);case"pay-now":return new di(e,n,r);case"mini-cart":return new ri(e,n,r);case"cart-block":return new Uo(e,n,r);case"checkout-block":return new Ko(e,n,r);case"preview":return new ji(e,n,r)}}}])}();const Ei=ki;function Ci(t){return Ci="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},Ci(t)}function Ti(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Ai(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ai(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}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 o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function Ai(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function xi(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return Ii(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Ii(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,Ii(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,Ii(f,"constructor",l),Ii(l,"constructor",c),c.displayName="GeneratorFunction",Ii(l,o,"GeneratorFunction"),Ii(f),Ii(f,o,"Generator"),Ii(f,r,function(){return this}),Ii(f,"toString",function(){return"[object Generator]"}),(xi=function(){return{w:i,m:p}})()}function Ii(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Ii=function(t,e,n,r){function i(e,n){Ii(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},Ii(t,e,n,r)}function Mi(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function Ri(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){Mi(i,r,o,a,u,"next",t)}function u(t){Mi(i,r,o,a,u,"throw",t)}a(void 0)})}}function Di(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Bi(r.key),r)}}function Bi(t){var e=function(t){if("object"!=Ci(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ci(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ci(e)?e:e+""}var Fi=function(){return function(t,e){return e&&Di(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n,r){var o=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.namespace=e,this.buttonConfig=n,this.ppcpConfig=r,this.buttonAttributes=i,this.onClick=a,this.googlePayConfig=null,this.transactionInfo=null,this.contextHandler=null,this.buttons=[],H.watchContextBootstrap(function(){var t=Ri(xi().m(function t(e){var i,a;return xi().w(function(t){for(;;)switch(t.n){case 0:if(o.contextHandler=Ei.create(e.context,n,r,e.handler),i=ln.createButton(e.context,e.handler,n,r,o.contextHandler,o.buttonAttributes,o.onClick),o.buttons.push(i),a=function(){i.configure(o.googlePayConfig,o.transactionInfo,o.buttonAttributes),i.init()},!o.googlePayConfig||!o.transactionInfo){t.n=1;break}a(),t.n=3;break;case 1:return t.n=2,o.init();case 2:o.googlePayConfig&&o.transactionInfo&&a();case 3:return t.a(2)}},t)}));return function(_x){return t.apply(this,arguments)}}())},[{key:"init",value:(e=Ri(xi().m(function t(){var e,n,r,o;return xi().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,this.googlePayConfig){t.n=2;break}return t.n=1,window[this.namespace].Googlepay().config();case 1:this.googlePayConfig=t.v;case 2:if(this.transactionInfo){t.n=4;break}return t.n=3,this.fetchTransactionInfo();case 3:this.transactionInfo=t.v;case 4:if(this.googlePayConfig)if(this.transactionInfo){e=Ti(this.buttons);try{for(e.s();!(n=e.n()).done;)(r=n.value).configure(this.googlePayConfig,this.transactionInfo,this.buttonAttributes),r.init()}catch(t){e.e(t)}finally{e.f()}}else console.error("No transactionInfo found during init");else console.error("No GooglePayConfig received during init");t.n=6;break;case 5:t.p=5,o=t.v,console.error("Error during initialization:",o);case 6:return t.a(2)}},t,this,[[0,5]])})),function(){return e.apply(this,arguments)})},{key:"fetchTransactionInfo",value:(t=Ri(xi().m(function t(){var e;return xi().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,this.contextHandler){t.n=1;break}throw new Error("ContextHandler is not initialized");case 1:return t.n=2,this.contextHandler.transactionInfo();case 2:return t.a(2,t.v);case 3:throw t.p=3,e=t.v,console.error("Error fetching transaction info:",e),e;case 4:return t.a(2)}},t,this,[[0,3]])})),function(){return t.apply(this,arguments)})},{key:"reinit",value:function(){var t,e=Ti(this.buttons);try{for(e.s();!(t=e.n()).done;)t.value.reinit()}catch(t){e.e(t)}finally{e.f()}}}]);var t,e}();const Gi=Fi;function Hi(t){return Hi="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},Hi(t)}function qi(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ni(r.key),r)}}function Ni(t){var e=function(t){if("object"!=Hi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Hi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Hi(e)?e:e+""}function Wi(t,e,n){Li(t,e),e.set(t,n)}function Li(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Qi(t,e){return t.get(zi(t,e))}function Ui(t,e,n){return t.set(zi(t,e),n),n}function zi(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var Vi=new WeakMap,Ji=new WeakMap,Yi=new WeakSet,$i=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),function(t,e){Li(t,e),e.add(t)}(this,Yi),Wi(this,Vi,void 0),Wi(this,Ji,void 0),Ui(Vi,this,e),Ui(Ji,this,t.getCheckoutForm())}return function(t,e,n){return e&&qi(t.prototype,e),n&&qi(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"checkoutForm",get:function(){return Qi(Ji,this)}},{key:"init",value:function(){if(!Qi(Ji,this))throw new Error("Checkout form not found. Cannot initialize CheckoutBootstrap.");zi(Yi,this,Ki).call(this)}}],[{key:"isPageWithCheckoutForm",value:function(){return null!==t.getCheckoutForm()}},{key:"getCheckoutForm",value:function(){return document.querySelector("form.woocommerce-checkout")}}])}();function Ki(){if(!ne()){var t=Qi(Vi,this).getPayer();t&&(oe(t,!0),this.checkoutForm.addEventListener("submit",zi(Yi,this,Xi).bind(this)))}}function Xi(){Qi(Vi,this).clearPayer()}!function(t){var e=t.buttonConfig,n=t.ppcpConfig,r=void 0===n?{}:n,o=r.context,a="ppcpPaypalGooglepay";function u(){!function(){if(e&&r){var t=new Gi(a,e,r);n=function(){t.reinit()},o={timeoutId:null,args:null},u=function(){o.timeoutId&&(n.apply(null,o.args||[]),i())},c=function(){i();for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];o.args=e,o.timeoutId=window.setTimeout(u,50)},c.cancel=i=function(){o.timeoutId&&window.clearTimeout(o.timeoutId),o.timeoutId=null,o.args=null},c.flush=u,l=c,document.addEventListener("ppcp_refresh_payment_buttons",l),window.jQuery("body").on("updated_cart_totals",l).on("updated_checkout",l),setTimeout(function(){document.body.addEventListener("wc_fragments_loaded",l),document.body.addEventListener("wc_fragments_refreshed",l)},1e3)}var n,o,i,u,c,l}(),(!o||["checkout"].includes(o)||"mini-cart"===o&&r.continuation)&&$i.isPageWithCheckoutForm()&&new $i(Ae).init()}document.addEventListener("DOMContentLoaded",function(){if(e&&r){var t=!1,n=!1,o=!1,c=function(){!t&&n&&o&&(t=!0,u())};i({url:e.sdk_url}).then(function(){o=!0,c()}),M(a,r).then(function(){n=!0,c()}).catch(function(t){console.error("Failed to load PayPal script: ",t)})}else u()})}({buttonConfig:window.wc_ppcp_googlepay,ppcpConfig:window.PayPalCommerceGateway})})();
jQuery(document).ready(function($){
var isCartPage=xoo_wsc_params.isCart=='1',
isCheckoutPage=xoo_wsc_params.isCheckout=='1';
var get_wcurl=function(endpoint){
return xoo_wsc_params.wc_ajax_url.toString().replace('%%endpoint%%',
endpoint
);
};
var markupTimeout=null;
class Notice{
constructor($modal){
this.$modal=$modal;
this.timeout=null;
}
add(notice, type='success', clearPrevious=true){
var $noticeCont=this.$modal.find('.xoo-wsc-notice-container');
if(clearPrevious){
$noticeCont.html('');
}
var noticeHTML=type==='success' ? xoo_wsc_params.html.successNotice.toString().replace('%s%', notice):xoo_wsc_params.html.errorNotice.toString().replace('%s%', notice);
$noticeCont.html(noticeHTML);
}
showNotification(){
Notice.showMarkupNotice();
var $noticeCont=this.$modal.find('.xoo-wsc-notice-container');
if(!$noticeCont.length||$noticeCont.children().length===0) return;
$noticeCont.slideDown();
clearTimeout(this.timeout);
this.timeout=setTimeout(function(){
$noticeCont.slideUp('slow',function(){
});
},xoo_wsc_params.notificationTime)
}
hideNotification(){
this.$modal.find('.xoo-wsc-notice-container').hide();
}
static hideMarkupNotice(){
Notice.$noticeContainer().removeClass('xoo-wsc-active');
}
static $noticeContainer(){
return $('.xoo-wsc-markup-notices')
}
static showMarkupNotice(){
if(cart.isOpen()) return;
var $markupNotice=Notice.$noticeContainer();
var $notices=$markupNotice.find('.xoo-wsc-notice-container .xoo-wsc-notices');
if(!$notices.length||$notices.children().length===0) return;
setTimeout(function(){$markupNotice.addClass('xoo-wsc-active')},10);
clearTimeout(markupTimeout);
markupTimeout=setTimeout(function(){
$markupNotice.removeClass('xoo-wsc-active');
},xoo_wsc_params.notificationTime)
}}
class Container{
constructor($modal, container){
this.$modal=$modal;
this.container=container||'cart';
this.notice=new Notice(this.$modal);
}
isOpen(){
return this.$modal.hasClass('xoo-wsc-'+this.container+'-active');
}
eventHandlers(){
$(document.body).on('wc_fragments_refreshed updated_checkout', this.onCartUpdate.bind(this));
}
onCartUpdate(){
this.unblock();
this.notice.showNotification();
}
setAjaxData(data, noticeSection){
var ajaxData={
container: this.container,
noticeSection: noticeSection||this.noticeSection||this.container,
isCheckout: isCheckoutPage,
isCart: isCartPage
}
if(typeof data==='object'){
$.extend(ajaxData, data);
}else{
var serializedData=data;
$.each(ajaxData, function(key, value){
serializedData +=('&'+key+'='+value);
})
ajaxData=serializedData;
}
return ajaxData;
}
toggle(type){
var $activeEls=this.$modal.add('body').add('html'),
activeClass='xoo-wsc-'+ this.container +'-active';
if(type==='show'){
$activeEls.addClass(activeClass);
}
else if(type==='hide'){
$activeEls.removeClass(activeClass);
}else{
$activeEls.toggleClass(activeClass);
}
$(document.body).trigger('xoo_wsc_' + this.container + '_toggled', [ type ]);
this.notice.hideNotification();
}
block(){
this.$modal.addClass('xoo-wsc-loading');
}
unblock(){
this.$modal.removeClass('xoo-wsc-loading');
}
refreshMyFragments(){
if(xoo_wsc_params.refreshCart==="yes"&&typeof wc_cart_fragments_params!=='undefined'){
$(document.body).trigger('wc_fragment_refresh');
return;
}
this.block();
$.ajax({
url: get_wcurl('xoo_wsc_refresh_fragments'),
type: 'POST',
context: this,
data: {},
success: function(response){
this.updateFragments(response);
},
complete: function(){
this.unblock();
}})
}
updateCartCheckoutPage(){
if(isCheckoutPage){
if($('form.checkout').length===0){
location.reload();
return;
}
$(document.body).trigger("update_checkout");
}
if(isCartPage){
$(document.body).trigger("wc_update_cart");
}}
updateFragments(response){
console.log('updated');
if(response.fragments){
$(document.body).trigger('xoo_wsc_before_loading_fragments', [ response ]);
this.block();
$.each(response.fragments, function(key, value){
$(key).replaceWith(value);
});
if(typeof wc_cart_fragments_params!=='undefined'&&('sessionStorage' in window&&window.sessionStorage!==null) ){
sessionStorage.setItem(wc_cart_fragments_params.fragment_name, JSON.stringify(response.fragments) );
localStorage.setItem(wc_cart_fragments_params.cart_hash_key, response.cart_hash);
sessionStorage.setItem(wc_cart_fragments_params.cart_hash_key, response.cart_hash);
if(response.cart_hash){
sessionStorage.setItem('wc_cart_created',(new Date()).getTime());
}}
$(document.body).trigger('wc_fragments_refreshed');
this.unblock();
}
if(xoo_wsc_params.refreshCart==="yes"&&typeof wc_cart_fragments_params!=='undefined'){
this.block();
$(document.body).trigger('wc_fragment_refresh');
return;
}}
}
class Cart extends Container{
constructor($modal){
super($modal, 'cart');
this.refreshFragmentsOnPageLoad();
this.eventHandlers();
}
refreshFragmentsOnPageLoad(){
setTimeout(function(){
this.refreshMyFragments();
}.bind(this), xoo_wsc_params.fetchDelay)
}
eventHandlers(){
super.eventHandlers();
this.$modal.on('click', '.xoo-wsc-smr-del', this.deleteIconClick.bind(this));
this.$modal.on('click', '.xoo-wsch-close, .xoo-wsc-opac, .xoo-wsc-cart-close', this.closeCartOnClick.bind(this));
this.$modal.on('click', '.xoo-wsc-basket', this.toggleCart.bind(this));
$(document.body).on('xoo_wsc_cart_updated', this.updateCartCheckoutPage.bind(this));
$(document.body).on('click', 'a.added_to_cart, .xoo-wsc-cart-trigger', this.openCart.bind(this));
$(document.body).on('added_to_cart', this.addedToCart.bind(this));
$(document.body).on('wc-blocks_added_to_cart', this.blockAddedToCart.bind(this));
if(xoo_wsc_params.autoOpenCart==='yes'&&xoo_wsc_params.addedToCart==='yes'){
this.openCart();
}
if(xoo_wsc_params.ajaxAddToCart==='yes'){
$(document.body).on('submit', 'form.cart', this.addToCartFormSubmit.bind(this));
}
if(typeof wc_cart_fragments_params==='undefined'){
$(window).on('pageshow' , this.onPageShow.bind(this));
}
if(xoo_wsc_params.triggerClass){
$(document.body).on('click', '.'+xoo_wsc_params.triggerClass, this.openCart.bind(this));
}
if(isCheckoutPage||isCartPage){
$(document.body).on('updated_shipping_method', this.refreshMyFragments.bind(this));
}
this.initMasonryLayout();
}
toggleCart(e){
if(this.isOpen()){
this.closeCartOnClick(e);
}else{
this.openCart(e);
}}
openCart(e){
if(e){
e.preventDefault();
e.stopImmediatePropagation();
}
this.toggle('show');
Notice.hideMarkupNotice();
}
addToCartFormSubmit(e){
var $form=$(e.currentTarget);
if($form.closest('.product').hasClass('product-type-external')||$form.siblings('.xoo-wsc-disable-atc').length) return;
var $button=e.originalEvent&&e.originalEvent.submitter ? $(e.originalEvent.submitter):$form.find('button[type="submit"]'),
formData=new FormData($form.get(0)),
productData=$form.serializeArray(),
hasProductId=false;
$.each(productData, function(key, form_item){
if(form_item.name==='productID'||form_item.name==='add-to-cart'){
if(form_item.value){
hasProductId=true;
return false;
}}
})
if(!hasProductId&&$form.attr('action')){
var is_url=$form.attr('action').match(/add-to-cart=([0-9]+)/),
productID=is_url ? is_url[1]:false;
}
if($button.attr('name')&&$button.attr('value')){
formData.append($button.attr('name'), $button.attr('value'));
}
if(productID){
formData.append('add-to-cart', productID);
}
formData.append('action', 'xoo_wsc_add_to_cart');
var doAjaxAddToCart=true;
$.each(xoo_wsc_params.skipAjaxForData, function(key, value){
if(formData.has(key)&&(!value||formData.get(key)==value) ){
doAjaxAddToCart=false;
return false;
}})
if(doAjaxAddToCart){
e.preventDefault();
this.addToCartAjax($button, formData);
}}
addToCartAjax($button, formData){
this.block();
$button.addClass('loading');
$(document.body).trigger('adding_to_cart', [ $button, formData ]);
$.ajax({
url: get_wcurl('xoo_wsc_add_to_cart'),
type: 'POST',
context: this,
cache: false,
contentType: false,
processData: false,
data: formData,
success: function(response){
if(response.fragments){
$(document.body).trigger('added_to_cart', [ response.fragments, response.cart_hash, $button ]);
}else if(response.error){
Notice.$noticeContainer().replaceWith(response.notice);
Notice.showMarkupNotice();
}else{
window.location.reload();
}},
complete: function(){
this.unblock();
$button
.removeClass('loading')
.addClass('added');
}})
}
addedToCart(e, response, hash, $button){
this.updateFragments({ fragments: response });
this.onCartUpdate();
var _this=this;
if(xoo_wsc_params.autoOpenCart==="yes"){
setTimeout(function(){
_this.openCart();
},20)
}}
blockAddedToCart(){
$(document.body).trigger('wc_fragment_refresh');
this.block();
var _this=this;
if(xoo_wsc_params.autoOpenCart==="yes"){
setTimeout(function(){
_this.openCart();
},20)
}}
closeCartOnClick(e){
e.preventDefault();
this.toggle('hide');
}
onPageShow(e){
if(e.originalEvent.persisted){
this.refreshMyFragments();
$(document.body).trigger('wc_fragment_refresh');
}}
deleteIconClick(e){
this.updateItemQty($(e.currentTarget).parents('.xoo-wsc-product').data('key'), 0);
}
updateItemQty(cart_key, qty){
if(!cart_key||qty===undefined) return;
this.block();
var formData={
cart_key: cart_key,
qty: qty
}
$.ajax({
url: get_wcurl('xoo_wsc_update_item_quantity'),
type: 'POST',
context: this,
data: this.setAjaxData(formData),
success: function(response){
this.updateFragments(response);
$(document.body).trigger('xoo_wsc_quantity_updated', [response]);
$(document.body).trigger('xoo_wsc_cart_updated', [response]);
this.unblock();
}})
}
onCartUpdate(){
super.onCartUpdate();
this.toggleBasket();
this.initMasonryLayout();
}
initMasonryLayout(){
if(xoo_wsc_params.productLayout!=='cards') return;
$('.xoo-wsc-products.xoo-wsc-pattern-card').masonry({
itemSelector: '.xoo-wsc-product-cont',
columnWidth: '.xoo-wsc-product-cont', 
percentPosition: true
});
}
toggleBasket(){
var $basket=$('.xoo-wsc-basket'),
show=xoo_wsc_params.showBasket,
hasProducts=this.$modal.find('.xoo-wsc-product').length;
if(show==="always_show"){
$basket.show();
}
else if(show==="hide_empty"){
if(hasProducts){
$basket.show();
}else{
$basket.hide();
}}else{
$basket.hide();
}
var $shortcode=$('.xoo-wsc-sc-cont');
if($shortcode.length&&xoo_wsc_params.menuCartHideOnEmpty.length){
var shortcodeEls=xoo_wsc_params.shortcodeEls;
$.each(xoo_wsc_params.menuCartHideOnEmpty, function(index, val){
if(shortcodeEls[val]){
if(hasProducts){
$(shortcodeEls[val]).show();
}else{
$(shortcodeEls[val]).hide();
}}
})
}}
}
var cart=new Cart($('.xoo-wsc-modal'));
var AnimateCard={
type: xoo_wsc_params.cardAnimate.type,
duration: xoo_wsc_params.cardAnimate.duration,
init: function(){
var onEvent=xoo_wsc_params.cardAnimate.event==='back_hover' ? 'mouseenter':'click';
$('body').on(onEvent, '.xoo-wsc-has-back', this.animate);
$('body').on('mouseleave', '.xoo-wsc-has-back', this.reverseAnimate);
},
animate: function(e){
if(e.target.classList.contains('xoo-wsc-smr-del')) return;
var $img=$(this).find('.xoo-wsc-img-col');
if(!$img.hasClass('xoo-wsc-caniming')){
e.preventDefault();
}else{
return;
}
$img.attr('data-exclasses', $img.attr('class'));
$img.removeClass()
$img.addClass($img.attr('data-exclasses'));
$img.addClass('xoo-wsc-caniming' + ' ' + AnimateCard.type);
},
reverseAnimate: function(){
var $img=$(this).find('.xoo-wsc-img-col');
if(!$img.hasClass('xoo-wsc-caniming') ) return;
$img.addClass(AnimateCard.type+'Return');
AnimateCard.clear=setTimeout(function(){
$img.removeClass().addClass($img.attr('data-exclasses'));
}, AnimateCard.duration * 1000);
}}
if(xoo_wsc_params.cardAnimate.enable==="yes"){
AnimateCard.init();
}});
jQuery(document).ready(function($){jQuery(document.body).on('updated_cart_totals wc_cart_emptied removed_from_cart added_to_cart',function(){$.ajax({method:'GET',url:seopressAjaxAnalytics.seopress_analytics,data:{action:'seopress_after_update_cart',_ajax_nonce:seopressAjaxAnalytics.seopress_nonce,},success:function(data){jQuery('body').append(data.data)},})})});
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=115)}({115:function(e,t,n){"use strict";n.r(t);var r=function(e){return"string"!=typeof e||""===e?(console.error("The namespace must be a non-empty string."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(e)||(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)};var o=function(e){return"string"!=typeof e||""===e?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(e)?(console.error("The hook name cannot begin with `__`."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(e)||(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)};var i=function(e,t){return function(n,i,a){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,l=e[t];if(o(n)&&r(i))if("function"==typeof a)if("number"==typeof s){var c={callback:a,priority:s,namespace:i};if(l[n]){var u,d=l[n].handlers;for(u=d.length;u>0&&!(s>=d[u-1].priority);u--);u===d.length?d[u]=c:d.splice(u,0,c),l.__current.forEach((function(e){e.name===n&&e.currentIndex>=u&&e.currentIndex++}))}else l[n]={handlers:[c],runs:0};"hookAdded"!==n&&e.doAction("hookAdded",n,i,a,s)}else console.error("If specified, the hook priority must be a number.");else console.error("The hook callback must be a function.")}};var a=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(i,a){var s=e[t];if(o(i)&&(n||r(a))){if(!s[i])return 0;var l=0;if(n)l=s[i].handlers.length,s[i]={runs:s[i].runs,handlers:[]};else for(var c=s[i].handlers,u=function(e){c[e].namespace===a&&(c.splice(e,1),l++,s.__current.forEach((function(t){t.name===i&&t.currentIndex>=e&&t.currentIndex--})))},d=c.length-1;d>=0;d--)u(d);return"hookRemoved"!==i&&e.doAction("hookRemoved",i,a),l}}};var s=function(e,t){return function(n,r){var o=e[t];return void 0!==r?n in o&&o[n].handlers.some((function(e){return e.namespace===r})):n in o}};var l=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(r){var o=e[t];o[r]||(o[r]={handlers:[],runs:0}),o[r].runs++;var i=o[r].handlers;for(var a=arguments.length,s=new Array(a>1?a-1:0),l=1;l<a;l++)s[l-1]=arguments[l];if(!i||!i.length)return n?s[0]:void 0;var c={name:r,currentIndex:0};for(o.__current.push(c);c.currentIndex<i.length;){var u=i[c.currentIndex],d=u.callback.apply(null,s);n&&(s[0]=d),c.currentIndex++}return o.__current.pop(),n?s[0]:void 0}};var c=function(e,t){return function(){var n,r,o=e[t];return null!==(n=null===(r=o.__current[o.__current.length-1])||void 0===r?void 0:r.name)&&void 0!==n?n:null}};var u=function(e,t){return function(n){var r=e[t];return void 0===n?void 0!==r.__current[0]:!!r.__current[0]&&n===r.__current[0].name}};var d=function(e,t){return function(n){var r=e[t];if(o(n))return r[n]&&r[n].runs?r[n].runs:0}},f=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.actions=Object.create(null),this.actions.__current=[],this.filters=Object.create(null),this.filters.__current=[],this.addAction=i(this,"actions"),this.addFilter=i(this,"filters"),this.removeAction=a(this,"actions"),this.removeFilter=a(this,"filters"),this.hasAction=s(this,"actions"),this.hasFilter=s(this,"filters"),this.removeAllActions=a(this,"actions",!0),this.removeAllFilters=a(this,"filters",!0),this.doAction=l(this,"actions"),this.applyFilters=l(this,"filters",!0),this.currentAction=c(this,"actions"),this.currentFilter=c(this,"filters"),this.doingAction=u(this,"actions"),this.doingFilter=u(this,"filters"),this.didAction=d(this,"actions"),this.didFilter=d(this,"filters")};var h=function(){return new f},p=h();p.addAction,p.addFilter,p.removeAction,p.removeFilter,p.hasAction,p.hasFilter,p.removeAllActions,p.removeAllFilters,p.doAction,p.applyFilters,p.currentAction,p.currentFilter,p.doingAction,p.doingFilter,p.didAction,p.didFilter,p.actions,p.filters;function v(e){return(v="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})(e)}function m(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 y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach((function(t){g(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function g(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=v(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=v(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==v(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}window.isEditMode=!1,window.eael=window.ea={hooks:h(),isEditMode:!1,elementStatusCheck:function(e){return!(!window.eaElementList||!(e in window.eaElementList))||(window.eaElementList=y(y({},window.eaElementList),{},g({},e,!0)),!1)},debounce:function(e,t){var n;return function(){var r=this,o=arguments;clearTimeout(n),n=setTimeout((function(){e.apply(r,o)}),t)}}},eael.hooks.addAction("widgets.reinit","ea",(function(e){var t=jQuery(".eael-filter-gallery-container",e),n=jQuery(".eael-post-grid:not(.eael-post-carousel)",e),r=jQuery(".eael-twitter-feed-masonry",e),o=jQuery(".eael-instafeed",e),i=jQuery(".premium-gallery-container",e),a=jQuery(".eael-event-calendar-cls",e),s=jQuery(".eael-testimonial-slider",e),l=jQuery(".eael-tm-carousel",e),c=jQuery(".eael-post-carousel:not(.eael-post-grid)",e),u=jQuery(".eael-logo-carousel",e),d=jQuery(".eael-twitter-feed-carousel",e);t.length&&t.isotope("layout"),n.length&&n.isotope("layout"),r.length&&r.isotope("layout"),o.length&&o.isotope("layout"),i.length&&i.isotope("layout"),a.length&&eael.hooks.doAction("eventCalendar.reinit"),s.length&&eael.hooks.doAction("testimonialSlider.reinit"),l.length&&eael.hooks.doAction("teamMemberCarousel.reinit"),c.length&&eael.hooks.doAction("postCarousel.reinit"),u.length&&eael.hooks.doAction("logoCarousel.reinit"),d.length&&eael.hooks.doAction("twitterCarousel.reinit")}));var w,b=function(e){void 0===window.eaelPreventResizeOnClick&&window.dispatchEvent(new Event("resize")),(e="object"===v(e)?e:jQuery(e)).find(".swiper-wrapper").each((function(){var e=jQuery(this).css("transform");jQuery(this).css("transform",e)}))};eael.hooks.addAction("ea-advanced-tabs-triggered","ea",b),eael.hooks.addAction("ea-advanced-accordion-triggered","ea",b),jQuery(window).on("elementor/frontend/init",(function(){window.isEditMode=elementorFrontend.isEditMode(),window.eael.isEditMode=elementorFrontend.isEditMode(),eael.hooks.doAction("init"),eael.isEditMode&&eael.hooks.doAction("editMode.init")})),function(e){eael.getToken=function(){localize.nonce&&!eael.noncegenerated&&e.ajax({url:localize.ajaxurl,type:"post",data:{action:"eael_get_token"},success:function(e){e.success&&(localize.nonce=e.data.nonce,eael.noncegenerated=!0)}})},eael.sanitizeURL=function(e){if(e.startsWith("/")||e.startsWith("#"))return e;try{var t=new URL(e);if(!["http:","https:","ftp:","ftps:","mailto:","news:","irc:","irc6:","ircs:","gopher:","nntp:","feed:","telnet:","mms:","rtsp:","sms:","svn:","tel:","fax:","xmpp:","webcal:","urn:"].includes(t.protocol))throw new Error("Invalid protocol");return t.toString()}catch(e){return console.error("Error sanitizing URL:",e.message),"#"}};var t=!0;window.addEventListener("hashchange",(function(){if(t){var n=window.location.hash.substr(1);"undefined"!==(n="safari"===n?"eael-safari":n)&&n&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(n)&&e("#"+n).trigger("click")}})),e("a").on("click",(function(n){var r,o=e(this).attr("href");(r=(o=void 0===o?"":o).startsWith("#"))||(r=(o=o.replace(localize.page_permalink,"")).startsWith("#")),r&&(t=!1,setTimeout((function(){t=!0}),100));try{if(o.startsWith("#!")){var i=o.replace("#!","#");e(i).trigger("click")}else if(r&&(e(o).hasClass("eael-tab-item-trigger")||e(o).hasClass("eael-accordion-header"))&&(e(o).trigger("click"),void 0!==o&&o)){var a=e(o).closest(".eael-advance-tabs");if(a.length>0){var s=a.data("custom-id-offset");s=s?parseFloat(s):0,e("html, body").animate({scrollTop:e(o).offset().top-s},300)}}}catch(e){}})),e(document).on("click",".e-n-tab-title",(function(){setTimeout((function(){window.dispatchEvent(new Event("resize"))}),100)}))}(jQuery),(w=jQuery)(document).on("click",".theme-savoy .eael-product-popup .nm-qty-minus, .theme-savoy .eael-product-popup .nm-qty-plus",(function(e){var t=w(this),n=t.closest(".quantity").find(".qty"),r=parseFloat(n.val()),o=parseFloat(n.attr("max")),i=parseFloat(n.attr("min")),a=n.attr("step");r&&""!==r&&"NaN"!==r||(r=0),""!==o&&"NaN"!==o||(o=""),""!==i&&"NaN"!==i||(i=0),"any"!==a&&""!==a&&void 0!==a&&"NaN"!==parseFloat(a)||(a=1),t.hasClass("nm-qty-plus")?o&&(o==r||r>o)?n.val(o):n.val(r+parseFloat(a)):i&&(i==r||r<i)?n.val(i):r>0&&n.val(r-parseFloat(a))})),function(e){e.fn.isInViewport=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2;if(e(this).length<1)return!1;var n=e(this).offset().top,r=n+e(this).outerHeight()/t,o=e(window).scrollTop(),i=o+e(window).height()/t;return r>o&&n<i},e(document).ready((function(){var e=new URLSearchParams(location.search);if(e.has("popup-selector")&&(e.has("eael-lostpassword")||e.has("eael-resetpassword"))){var t=e.get("popup-selector");t.length&&/^[A-Za-z.#][A-Za-z0-9_:.#\s-]*$/.test(t)&&(t=t.replace(/_/g," "),setTimeout((function(){jQuery(t).trigger("click")}),300))}})),e(document).on("click",".eael-onpage-edit-template",(function(){var t=e(this),n=t.data("eael-template-id"),r=t.data("page-id"),o=t.data("mode");"edit"===o?(parent.window.$e.internal("panel/state-loading"),parent.window.$e.run("editor/documents/switch",{id:parseInt(n)}).then((function(){t.data("mode","save"),t.find("span").text("Save & Back"),t.find("i").addClass("eicon-arrow-left").removeClass("eicon-edit"),t.closest(".eael-onpage-edit-template-wrapper").addClass("eael-onpage-edit-activate").parent().addClass("eael-widget-otea-active"),parent.window.$e.internal("panel/state-ready")}))):"save"===o&&(parent.window.$e.internal("panel/state-loading"),parent.window.$e.run("editor/documents/switch",{id:parseInt(r),mode:"save",shouldScroll:!1}).then((function(){parent.window.$e.internal("panel/state-ready"),t.data("mode","edit")})))}))}(jQuery)}});
jQuery(document).ready(function ($){
var variable_id=jQuery('[name="product_id"]').val();
var available_ids=[];
var variable_bulk_table="";
function get_table(product_id, updateBulkTable=false){
if(typeof jQuery('.wdp_bulk_table_content').attr('data-available-ids')!=='undefined'){
available_ids=JSON.parse(jQuery('.wdp_bulk_table_content').attr('data-available-ids'));
}
if(available_ids.indexOf(parseInt(product_id))===-1){
return;
}
if(product_id===variable_id&&variable_bulk_table&&!updateBulkTable){
jQuery('.wdp_bulk_table_content').html(variable_bulk_table)
return true;
}
let attributes={};
jQuery('form.variations_form[data-product_id=' + variable_id + '] select').each(function (index, item){
if(jQuery(item).attr("data-attribute_name")){
attributes[jQuery(item).attr("data-attribute_name")]=jQuery(this).val();
}});
var data={
action: 'get_table_with_product_bulk_table',
product_id: parseInt(product_id),
attributes: attributes,
...jQuery('form.cart').triggerHandler('wdp_get_custom_data')
};
return jQuery.ajax({
url: script_data.ajaxurl,
data: data,
dataType: 'json',
type: 'POST',
success: function (response){
if(response.success){
jQuery('.wdp_bulk_table_content').each(function (_, item){
let jQItem=jQuery(item);
let availableIds=JSON.parse(jQItem.attr('data-available-ids'));
if(availableIds.indexOf(parseInt(product_id))===-1){
return;
}
jQItem.html(jQuery(response.data).children()).trigger('update');
});
init_custom_event();
if(product_id===variable_id){
variable_bulk_table=response.data;
}}else{
get_table(variable_id);
}},
error: function (response){
get_table(variable_id);
}});
}
function init_custom_event(){
jQuery('.wdp_bulk_table_content').on('get_table', function (e, $obj_id){
if(typeof $obj_id==='undefined'||!$obj_id){
get_table(variable_id);
}else{
get_table($obj_id);
}});
}
function init_events(){
if(jQuery('.wdp_bulk_table_content').length > 0){
jQuery('.variations_form').on('found_variation', { variationForm: this },
function (event, variation){
if(typeof variation==='undefined'){
get_table(variable_id);
return true;
}
get_table(variation.variation_id);
return true;
})
.on('click', '.reset_variations',
{ variationForm: this },
function (event, variation){
get_table(variable_id);
return true;
})
.on('reset_data',
function (event){
get_table(variable_id);
return true;
});
jQuery('form.cart').on('adp_found_variation', function (e, { product_id, variation_id}){
get_table(variation_id||product_id, true);
return true;
});
init_custom_event();
}}
if(script_data.js_init_trigger){
$(document).on(script_data.js_init_trigger, function (){
init_events();
});
}
jQuery('form.cart').on('adp_variations_form', function(){
init_events();
});
setTimeout(function (){
jQuery('.variations_form').on("wc_variation_form", function (){
init_events();
})
}, 0);
function watchForQuickView(){
let observer=new MutationObserver(function (mutations){
mutations.forEach(function (mutation){
mutation.addedNodes.forEach(function (node){
if($(node).hasClass('product-lightbox-inner')||$(node).find('.product-lightbox-inner').length){
init_events();
}});
});
});
observer.observe(document.body, { childList: true, subtree: true });
}
watchForQuickView();
});