Ubuntu
(()=>{"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{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')),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;e3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&yr||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=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;e0&&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=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);n1&&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;nt.length)&&(e=t.length);for(var n=0,r=Array(e);n1&&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;n2&&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.expires3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&yr||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;e6&&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;r1&&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;n0&&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);n0&&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);n0){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);n2&&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;n2&&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>>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;i3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&yr||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;n3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&yr||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&&e3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&yr||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;n0?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("
")):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&&e3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&yr||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;n0?(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&&e3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&yr||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=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);n3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&yr||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;n3&&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