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}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);const r=window.wp.element,o=window.wc.wcBlocksRegistry,i=window.wp.i18n;function a(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 u(t,e){if(void 0===e&&(e=Promise),s(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);o3&&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(o){var i;(function(t,e){return!(!t||t.user!==e||(new Date).getTime()>=1e3*t.expiration)})(o,e.user)&&(i=o,sessionStorage.setItem("ppcp-data-client-id",JSON.stringify(i)),t["data-client-token"]=o.token,u(t).then(function(t){"function"==typeof n&&n(t)}).catch(function(t){"function"==typeof r&&r(t)}))})};function p(t){return p="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},p(t)}function y(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)||h(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 d(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=h(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 h(t,e){if(t){if("string"==typeof t)return b(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)?b(t,e):void 0}}function b(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}}])&&v(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();window.widgetBuilder=window.widgetBuilder||new g;const w=window.widgetBuilder;var S=n(4744),j=n.n(S),_=function(t){return t.replace(/([-_]\w)/g,function(t){return t[1].toUpperCase()})},O=function(t){var e=function(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[_(n)]=t[n]);return e}(t.url_params);t.script_attributes&&(e=j()(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 j().all([e,n])};function P(t){return P="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},P(t)}function k(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;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]())):(T(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,T(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,T(f,"constructor",l),T(l,"constructor",c),c.displayName="GeneratorFunction",T(l,o,"GeneratorFunction"),T(f),T(f,o,"Generator"),T(f,r,function(){return this}),T(f,"toString",function(){return"[object Generator]"}),(A=function(){return{w:i,m:p}})()}function T(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}T=function(t,e,n,r){function i(e,n){T(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))},T(t,e,n,r)}function x(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 I(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){x(i,r,o,a,u,"next",t)}function u(t){x(i,r,o,a,u,"throw",t)}a(void 0)})}}var M=new Map,R=new Map,B=function(){var t=I(A().m(function t(e,n){var r;return A().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){f(e,n.data_client_id,function(e){w.setPaypal(e),t(e)},r)}));case 1:return t.a(2,null)}},t)}));return function(_x,e){return t.apply(this,arguments)}}(),D=function(){var t=I(A().m(function t(e,n){var r,o,i;return A().w(function(t){for(;;)switch(t.n){case 0:if(e){t.n=1;break}throw new Error("Namespace is required");case 1:if(!M.has(e)){t.n=2;break}return console.log("Script already loaded for namespace: ".concat(e)),t.a(2,M.get(e));case 2:if(!R.has(e)){t.n=3;break}return console.log("Script loading in progress for namespace: ".concat(e)),t.a(2,R.get(e));case 3:return r=E(E({},O(n)),{},{"data-namespace":e}),t.n=4,B(r,n);case 4:if(!(o=t.v)){t.n=5;break}return t.a(2,o);case 5:return i=new Promise(function(t,n){u(r).then(function(n){w.setPaypal(n),M.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(){R.delete(e)})}),R.set(e,i),t.a(2,i)}},t)}));return function(e,n){return t.apply(this,arguments)}}();function F(t){return F="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},F(t)}function G(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()}}])&&G(e.prototype,n),r&&G(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();const W=H;!function(){var t;function e(t){var e=0;return function(){return e>>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;i0){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&&V(t.prototype,null),e&&V(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();$=X,K=["onApprove","token","PayerID","payerID","button_session_id","billingToken","orderID","switch_initiated_time","onCancel","onError"],(J=z(J="PAYPAL_PARAMS"))in $?Object.defineProperty($,J,{value:K,enumerable:!0,configurable:!0,writable:!0}):$[J]=K;const Y=X;function Z(t){return Z="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},Z(t)}function tt(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 et(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)?et(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 et(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]())):(ut(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,ut(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,ut(f,"constructor",l),ut(l,"constructor",c),c.displayName="GeneratorFunction",ut(l,o,"GeneratorFunction"),ut(f),ut(f,o,"Generator"),ut(f,r,function(){return this}),ut(f,"toString",function(){return"[object Generator]"}),(at=function(){return{w:i,m:p}})()}function ut(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}ut=function(t,e,n,r){function i(e,n){ut(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))},ut(t,e,n,r)}function ct(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 lt(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]())):(mt(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,mt(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,mt(f,"constructor",l),mt(l,"constructor",c),c.displayName="GeneratorFunction",mt(l,o,"GeneratorFunction"),mt(f),mt(f,o,"Generator"),mt(f,r,function(){return this}),mt(f,"toString",function(){return"[object Generator]"}),(vt=function(){return{w:i,m:p}})()}function mt(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}mt=function(t,e,n,r){function i(e,n){mt(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))},mt(t,e,n,r)}function gt(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 wt=function(t){return new Promise(function(){var e,n=(e=vt().m(function e(n,r){var o,i,a,u,c;return vt().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,o=new W,i=new bt(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 ft(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){gt(i,r,o,a,u,"next",t)}function u(t){gt(i,r,o,a,u,"throw",t)}a(void 0)})});return function(_x,t){return n.apply(this,arguments)}}())};function St(t){return St="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},St(t)}function jt(){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 _t(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]())):(_t(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,_t(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,_t(f,"constructor",l),_t(l,"constructor",c),c.displayName="GeneratorFunction",_t(l,o,"GeneratorFunction"),_t(f),_t(f,o,"Generator"),_t(f,r,function(){return this}),_t(f,"toString",function(){return"[object Generator]"}),(jt=function(){return{w:i,m:p}})()}function _t(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}_t=function(t,e,n,r){function i(e,n){_t(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))},_t(t,e,n,r)}function Ot(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 Pt(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=W.fullPage();return o.block(),e.clear(),Y.isResumeFlow()&&Y.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)}L().startsWith("ppcp-")||jQuery('input[name="payment_method"][value="'.concat(N,'"]')).prop("checked",!0),document.querySelector("#place_order").click()}).finally(function(){o.unblock()})}),onCancel:function(){r.unblock(),Y.reloadButtonsIfRequired(n.config.button.wrapper)},onError:function(t){console.error(t),r.unblock(),t&&"create-order-error"===t.type||(n.errorHandler.genericError(),Y.reloadButtonsIfRequired(n.config.button.wrapper))}}}}])}();const Ct=Et,At=function(t,e){return function(n,r){var o=W.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 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 xt(t,e){for(var n=0;nt.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()}}}])}();window.ppcpResources=window.ppcpResources||{};const Zt=window.ppcpResources.ButtonModuleWatcher=window.ppcpResources.ButtonModuleWatcher||new Yt;function te(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}}}}(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 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 re(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:null;ae(se,this)&&(t&&!ae(fe,this)||(console.groupEnd(),ue(fe,this,null)),t&&(console.group(t),ue(fe,this,t)))}}])}();function ye(t){return ye="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},ye(t)}function de(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 he(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)?he(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 he(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()}}}])}();function ge(t){return ge="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},ge(t)}function we(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 Se(t){for(var e=1;e=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 Te(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,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},c=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),function(t,e){Me(t,e),e.add(t)}(this,nn),Ie(this,qe,void 0),Ie(this,He,!1),Ie(this,We,!1),Ie(this,Ne,void 0),Ie(this,Ue,void 0),Ie(this,Le,void 0),Ie(this,Qe,[]),Ie(this,Ve,void 0),Ie(this,ze,void 0),Ie(this,$e,void 0),Ie(this,Je,void 0),Ie(this,Ke,void 0),Ie(this,Xe,null),Ie(this,Ye,!0),Ie(this,Ze,!0),Ie(this,tn,null),Ie(this,en,[]),this.methodId===t.methodId)throw new Error("Cannot initialize the PaymentButton base class");o||(o={});var l=!(null===(n=o)||void 0===n||!n.is_debug),s=this.methodId.replace(/^ppcp?-/,"");Fe(Ne,this,e),Fe(Ve,this,o),Fe(ze,this,i),Fe($e,this,r),Fe(Je,this,a),Fe(Ke,this,u),this.onClick=c,Fe(qe,this,new pe(s,e)),l&&(De(qe,this).enabled=!0,function(t,e){window.ppcpPaymentButtonList=window.ppcpPaymentButtonList||{};var n=window.ppcpPaymentButtonList;n[t]=n[t]||[],n[t].push(e)}(s,this)),Fe(Ue,this,this.constructor.getWrappers(De(Ve,this),De(ze,this))),this.applyButtonStyles(De(Ve,this)),this.registerValidationRules(Ge(nn,this,on).bind(this),Ge(nn,this,an).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 me(e,n)}}(De(ze,this)),this.initEventListeners()},[{key:"methodId",get:function(){return this.constructor.methodId}},{key:"cssClass",get:function(){return this.constructor.cssClass}},{key:"isInitialized",get:function(){return De(He,this)}},{key:"context",get:function(){return De(Ne,this)}},{key:"buttonConfig",get:function(){return De(Ve,this)}},{key:"ppcpConfig",get:function(){return De(ze,this)}},{key:"externalHandler",get:function(){return De($e,this)||{}}},{key:"contextHandler",get:function(){return De(Je,this)||{}}},{key:"requiresShipping",get:function(){return"function"==typeof this.contextHandler.shippingAllowed&&this.contextHandler.shippingAllowed()}},{key:"wrappers",get:function(){return De(Ue,this)}},{key:"style",get:function(){return U.MiniCart===this.context?De(Le,this).MiniCart:De(Le,this).Default}},{key:"wrapperId",get:function(){return U.MiniCart===this.context?this.wrappers.MiniCart:this.isSeparateGateway?this.wrappers.Gateway:U.Blocks.includes(this.context)?this.wrappers.Block:this.wrappers.Default}},{key:"isInsideClassicGateway",get:function(){return U.Gateways.includes(this.context)}},{key:"isSeparateGateway",get:function(){return De(Ve,this).is_wc_gateway_enabled&&this.isInsideClassicGateway}},{key:"isCurrentGateway",get:function(){if(!this.isInsideClassicGateway)return!0;var t=L();return this.isSeparateGateway?this.methodId===t:N===t}},{key:"isPreview",get:function(){return U.Preview===this.context}},{key:"isEligible",get:function(){return De(Xe,this)},set:function(t){t!==De(Xe,this)&&(Fe(Xe,this,t),this.triggerRedraw())}},{key:"isVisible",get:function(){return De(Ye,this)},set:function(t){De(Ye,this)!==t&&(Fe(Ye,this,t),this.triggerRedraw())}},{key:"isEnabled",get:function(){return De(Ze,this)},set:function(t){De(Ze,this)!==t&&(Fe(Ze,this,t),this.triggerRedraw())}},{key:"wrapperElement",get:function(){return document.getElementById(this.wrapperId)}},{key:"ppcpButtonWrapperSelector",get:function(){var t,e;return U.Blocks.includes(this.context)?null:this.context===U.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(!De(tn,this))return!1;for(var t=De(tn,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=De(qe,this)).log.apply(t,arguments)}},{key:"error",value:function(){var t;(t=De(qe,this)).error.apply(t,arguments)}},{key:"logGroup",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;De(qe,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=Ae(De(en,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),Fe(Le,this,this.constructor.getStyles(t,e)),this.isInitialized&&this.triggerRedraw()}},{key:"configure",value:function(){}},{key:"init",value:function(){Fe(He,this,!0)}},{key:"reinit",value:function(){Fe(He,this,!1),Fe(Xe,this,!1)}},{key:"triggerRedraw",value:function(){this.showPaymentGateway(),function(t){var e=t.event,n=t.paymentMethod,r=void 0===n?"":n;if(!Pe(e))throw new Error("Invalid event: ".concat(e));var o=r?"".concat(e,"-").concat(r):e;document.body.dispatchEvent(new Event(o))}({event:_e.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=Ee(e))&&jQuery(t).hasClass("ppcp-disabled")))}},{key:"initEventListeners",value:function(){var t=this;if(ke({event:_e.REDRAW,paymentMethod:this.methodId,callback:function(){return t.refresh()}}),this.isInsideClassicGateway){var e=this.isSeparateGateway?this.methodId:N;ke({event:_e.INVALIDATE,callback:function(){return t.isVisible=!1}}),ke({event:_e.RENDER,paymentMethod:e,callback:function(){return t.isVisible=!0}})}this.context===U.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(!De(We,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"),Fe(We,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=Ae(De(Qe,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()}Fe(Qe,this,[]);var l=["ppcp-button-".concat(i),"ppcp-button-apm",this.cssClass];(t=n.classList).add.apply(t,l),(e=De(Qe,this)).push.apply(e,l),a&&(n.style.height="".concat(a,"px")),n.style.display=this.isVisible?"block":"none";var s=this.context===U.Product?"form.cart":null;!function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=Ee(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;De(tn,this)&&this.removeButton(),this.log("insertButton",t),Fe(tn,this,t),e.appendChild(De(tn,this))}}},{key:"removeButton",value:function(){if(this.isPresent&&De(tn,this)){this.log("removeButton");try{this.wrapperElement.removeChild(De(tn,this))}catch(t){}Fe(tn,this,null)}}}],[{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")}}])}();function on(t,e){De(en,this).push({check:t,errorMessage:e,shouldPass:!1})}function an(t){De(en,this).push({check:t,shouldPass:!0})}function un(t){return un="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},un(t)}function cn(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 ln(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)?ln(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 ln(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]())):(fn(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,fn(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,fn(f,"constructor",l),fn(l,"constructor",c),c.displayName="GeneratorFunction",fn(l,o,"GeneratorFunction"),fn(f),fn(f,o,"Generator"),fn(f,r,function(){return this}),fn(f,"toString",function(){return"[object Generator]"}),(sn=function(){return{w:i,m:p}})()}function fn(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}fn=function(t,e,n,r){function i(e,n){fn(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))},fn(t,e,n,r)}function pn(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 yn(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){pn(i,r,o,a,u,"next",t)}function u(t){pn(i,r,o,a,u,"throw",t)}a(void 0)})}}function dn(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 hn(t){for(var e=1;e2&&void 0!==arguments[2]?arguments[2]:{};En(Fn,this)||Cn(Fn,this,Date.now()),null!=r&&r.height&&null!=r&&r.borderRadius&&Cn(qn,this,hn({},r));var o=null!=r&&r.height?r:En(qn,this);if(Date.now()-En(Fn,this)>En(Gn,this))return this.log("ApplePay: Timeout waiting for buttonAttributes - proceeding with initialization"),Cn(Bn,this,t),Cn(Rn,this,e),this.buttonAttributes=o||r,void this.init();null!=o&&o.height&&null!=o&&o.borderRadius?(Cn(Fn,this,0),Cn(Bn,this,t),Cn(Rn,this,e),this.buttonAttributes=o,this.init()):setTimeout(function(){return n.configure(t,e,r)},100)}},{key:"init",value:function(){this.isInitialized||this.validateConfiguration()&&(mn(e,"init",this,3)([]),this.checkEligibility())}},{key:"reinit",value:(r=yn(sn().m(function t(){var n=this;return sn().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:mn(e,"reinit",this,3)([]),this.init();case 3:return t.a(2)}},t,this)})),function(){return r.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=!!En(Bn,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;mn(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:En(qn,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=En(qn,this))||void 0===e||!e.height||(this.buttonAttributes=hn({},En(qn,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:(n=yn(sn().m(function t(){var e,n,r,o,i,a,u,c;return sn().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.log("onButtonClick"),e=this.paymentRequest(),window.ppcpFundingSource="apple_pay",U.Checkout!==this.context){t.n=6;break}n="form.woocommerce-checkout",r=new bt(PayPalCommerceGateway.labels.error.generic,document.querySelector(".woocommerce-notices-wrapper"));try{o=new FormData(document.querySelector(n)),Cn(Tn,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 ft(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 n.apply(this,arguments)})},{key:"shouldUpdateButtonWithFormData",get:function(){var t;return U.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()||U.Checkout===this.context&&!this.shouldUpdateButtonWithFormData}},{key:"updateRequestDataWithForm",value:function(t){if(this.shouldUpdateButtonWithFormData&&(t.billingContact=this.fillBillingContact(En(Tn,this)),this.requiresShipping)){t.shippingContact=this.fillShippingContact(En(Tn,this));var e=this.transactionInfo.chosenShippingMethods[0];t.shippingMethods=[];var n,r=cn(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};Cn(In,this,i),t.shippingMethods.push(i);break}}}catch(t){r.e(t)}finally{r.f()}var a,u=cn(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()}Cn(Mn,this,t),this.log("=== paymentRequest.shippingMethods",t.shippingMethods)}}},{key:"paymentRequest",value:function(){var t=En(Bn,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;U.Product===this.context&&(En(Dn,this).quantity=null===(t=document.querySelector("input.qty"))||void 0===t?void 0:t.value,En(Dn,this).items=this.contextHandler.products(),this.log("Products updated",En(Dn,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"),w.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=ee(o.errors)),Cn(In,e,r.shippingMethod),o.newShippingMethods=o.newShippingMethods.sort(function(t){return t.label===En(In,e).label?-1:1}),!1===n.success&&(o.errors=ee(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;Cn(xn,e,r.shippingContact),!1===n.success&&(o.errors=ee(o.errors)),o.newShippingMethods&&Cn(In,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 U.Product:return{action:"ppcp_update_shipping_contact",product_id:e,products:JSON.stringify(En(Dn,this).items),caller_page:"productDetail",product_quantity:En(Dn,this).quantity,simplified_contact:t.shippingContact,need_shipping:this.requiresShipping,"woocommerce-process-checkout-nonce":this.nonce};case U.Cart:case U.Checkout:case U.BlockCart:case U.BlockCheckout:case U.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 U.Product:return{action:"ppcp_update_shipping_method",shipping_method:t.shippingMethod,simplified_contact:this.hasValidContactInfo(En(xn,this))?En(xn,this):null!==(e=null===(n=En(Mn,this))||void 0===n?void 0:n.shippingContact)&&void 0!==e?e:null===(r=En(Mn,this))||void 0===r?void 0:r.billingContact,product_id:u,products:JSON.stringify(En(Dn,this).items),caller_page:"productDetail",product_quantity:En(Dn,this).quantity,"woocommerce-process-checkout-nonce":this.nonce};case U.Cart:case U.Checkout:case U.BlockCart:case U.BlockCheckout:case U.MiniCart:return{action:"ppcp_update_shipping_method",shipping_method:t.shippingMethod,simplified_contact:this.hasValidContactInfo(En(xn,this))?En(xn,this):null!==(o=null===(i=En(Mn,this))||void 0===i?void 0:i.shippingContact)&&void 0!==o?o:null===(a=En(Mn,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=yn(sn().m(function n(r){var o,i,a,u,c,l,s,f;return sn().w(function(n){for(;;)switch(n.p=n.n){case 0:return e.log("onpaymentauthorized call"),o=function(){var t=yn(sn().m(function t(n){return sn().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,o){try{var i,a=n.billing_contact||En(Mn,e).billingContact,u=n.shipping_contact||En(Mn,e).shippingContact,c=En(In,e)||(En(Mn,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(En(Dn,e).items),product_quantity:En(Dn,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,w.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 An(Hn,this,Nn).call(this,t,"billing","")}},{key:"fillShippingContact",value:function(t){return null!=t&&t.shipping_first_name?An(Hn,this,Nn).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}}],[{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 Oe((null==e?void 0:e.button)||{},o)}}]);var n,r}(rn);function Nn(t,e,n){t&&"object"===un(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")}}Pn(Wn,"methodId","ppcp-applepay"),Pn(Wn,"cssClass","ppcp-button-applepay");const Un=Wn;function Ln(t){return Ln="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},Ln(t)}function Qn(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 lr(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},[{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=cr(t||[]);try{for(n.s();!(e=n.n()).done;){var r,o=cr(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=cr(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()})}}])}();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){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)||vr(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 br(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=vr(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 vr(t,e){if(t){if("string"==typeof t)return mr(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)?mr(t,e):void 0}}function mr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nt.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 yr).addFromPurchaseUnits(e);var n=ot(),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:N,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 _r(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 _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)||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 Er=kr;function Cr(t){return Cr="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},Cr(t)}function Ar(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(Br({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 Hr=qr;function Wr(t){return Wr="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},Wr(t)}function Nr(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]())):(To(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,To(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,To(f,"constructor",l),To(l,"constructor",c),c.displayName="GeneratorFunction",To(l,o,"GeneratorFunction"),To(f),To(f,o,"Generator"),To(f,r,function(){return this}),To(f,"toString",function(){return"[object Generator]"}),(Ao=function(){return{w:i,m:p}})()}function To(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}To=function(t,e,n,r){function i(e,n){To(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))},To(t,e,n,r)}function xo(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 Io(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 Vo(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]())):($o(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,$o(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,$o(f,"constructor",l),$o(l,"constructor",c),c.displayName="GeneratorFunction",$o(l,o,"GeneratorFunction"),$o(f),$o(f,o,"Generator"),$o(f,r,function(){return this}),$o(f,"toString",function(){return"[object Generator]"}),(zo=function(){return{w:i,m:p}})()}function $o(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}$o=function(t,e,n,r){function i(e,n){$o(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))},$o(t,e,n,r)}function Jo(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 Ko(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){Jo(i,r,o,a,u,"next",t)}function u(t){Jo(i,r,o,a,u,"throw",t)}a(void 0)})}}function Xo(t,e){for(var n=0;n3&&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=[],Zt.watchContextBootstrap(function(){var t=Ko(zo().m(function t(e){var i,a;return zo().w(function(t){for(;;)switch(t.n){case 0:if(o.contextHandler=Uo.create(e.context,n,r,e.handler),i=Un.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=Ko(zo().m(function t(){var e,n,r,o;return zo().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=Qo(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=Ko(zo().m(function t(){var e;return zo().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=Qo(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 ti=Zo;function ei(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]())):(oi(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,oi(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,oi(f,"constructor",l),oi(l,"constructor",c),c.displayName="GeneratorFunction",oi(l,o,"GeneratorFunction"),oi(f),oi(f,o,"Generator"),oi(f,r,function(){return this}),oi(f,"toString",function(){return"[object Generator]"}),(ri=function(){return{w:i,m:p}})()}function oi(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}oi=function(t,e,n,r){function i(e,n){oi(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))},oi(t,e,n,r)}function ii(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 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]())):(li(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,li(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,li(f,"constructor",l),li(l,"constructor",c),c.displayName="GeneratorFunction",li(l,o,"GeneratorFunction"),li(f),li(f,o,"Generator"),li(f,r,function(){return this}),li(f,"toString",function(){return"[object Generator]"}),(ci=function(){return{w:i,m:p}})()}function li(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}li=function(t,e,n,r){function i(e,n){li(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))},li(t,e,n,r)}function si(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 fi(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]())):(di(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,di(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,di(f,"constructor",l),di(l,"constructor",c),c.displayName="GeneratorFunction",di(l,o,"GeneratorFunction"),di(f),di(f,o,"Generator"),di(f,r,function(){return this}),di(f,"toString",function(){return"[object Generator]"}),(yi=function(){return{w:i,m:p}})()}function di(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}di=function(t,e,n,r){function i(e,n){di(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))},di(t,e,n,r)}function hi(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 bi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nt.length)&&(e=t.length);for(var n=0,r=Array(e);nt.length)&&(e=t.length);for(var n=0,r=Array(e);n