(()=>{var e={n:t=>{var o=t&&t.__esModule?()=>t.default:()=>t;return e.d(o,{a:o}),o},d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};(()=>{var t;globalThis.importScripts&&(t=globalThis.location+"");var o=globalThis.document;if(!t&&o&&(o.currentScript&&"SCRIPT"===o.currentScript.tagName.toUpperCase()&&(t=o.currentScript.src),!t)){var r=o.getElementsByTagName("script");if(r.length)for(var a=r.length-1;a>-1&&(!t||!/^http(s?):/.test(t));)t=r[a--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),e.p=t})(),e.p=window.wcpayAssets.url,(()=>{"use strict";const t=window.wp.i18n,o=window.wp.hooks,r=e=>"undefined"!=typeof wcpayConfig&&void 0!==wcpayConfig[e]?wcpayConfig[e]:a(e),a=e=>{let t=null;if("undefined"!=typeof wcpay_upe_config)t=wcpay_upe_config;else{if("object"!=typeof wc||void 0===wc.wcSettings)return null;t=wc.wcSettings.getSetting("woocommerce_payments_data")||{}}return t[e]||null},n=e=>"object"==typeof wcpayExpressCheckoutParams&&wcpayExpressCheckoutParams.hasOwnProperty(e)?wcpayExpressCheckoutParams[e]:null,i=(e,t,o="wcpay_")=>e.toString().replace("%%endpoint%%",o+t);function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}var c=/^\s+/,l=/\s+$/;function u(e,t){if(t=t||{},(e=e||"")instanceof u)return e;if(!(this instanceof u))return new u(e,t);var o=function(e){var t,o,r,a={r:0,g:0,b:0},n=1,i=null,u=null,p=null,d=!1,h=!1;return"string"==typeof e&&(e=function(e){e=e.replace(c,"").replace(l,"").toLowerCase();var t,o=!1;if(I[e])e=I[e],o=!0;else if("transparent"==e)return{r:0,g:0,b:0,a:0,format:"name"};return(t=$.rgb.exec(e))?{r:t[1],g:t[2],b:t[3]}:(t=$.rgba.exec(e))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=$.hsl.exec(e))?{h:t[1],s:t[2],l:t[3]}:(t=$.hsla.exec(e))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=$.hsv.exec(e))?{h:t[1],s:t[2],v:t[3]}:(t=$.hsva.exec(e))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=$.hex8.exec(e))?{r:R(t[1]),g:R(t[2]),b:R(t[3]),a:j(t[4]),format:o?"name":"hex8"}:(t=$.hex6.exec(e))?{r:R(t[1]),g:R(t[2]),b:R(t[3]),format:o?"name":"hex"}:(t=$.hex4.exec(e))?{r:R(t[1]+""+t[1]),g:R(t[2]+""+t[2]),b:R(t[3]+""+t[3]),a:j(t[4]+""+t[4]),format:o?"name":"hex8"}:!!(t=$.hex3.exec(e))&&{r:R(t[1]+""+t[1]),g:R(t[2]+""+t[2]),b:R(t[3]+""+t[3]),format:o?"name":"hex"}}(e)),"object"==s(e)&&(z(e.r)&&z(e.g)&&z(e.b)?(t=e.r,o=e.g,r=e.b,a={r:255*P(t,255),g:255*P(o,255),b:255*P(r,255)},d=!0,h="%"===String(e.r).substr(-1)?"prgb":"rgb"):z(e.h)&&z(e.s)&&z(e.v)?(i=L(e.s),u=L(e.v),a=function(e,t,o){e=6*P(e,360),t=P(t,100),o=P(o,100);var r=Math.floor(e),a=e-r,n=o*(1-t),i=o*(1-a*t),s=o*(1-(1-a)*t),c=r%6;return{r:255*[o,i,n,n,s,o][c],g:255*[s,o,o,i,n,n][c],b:255*[n,n,s,o,o,i][c]}}(e.h,i,u),d=!0,h="hsv"):z(e.h)&&z(e.s)&&z(e.l)&&(i=L(e.s),p=L(e.l),a=function(e,t,o){var r,a,n;function i(e,t,o){return o<0&&(o+=1),o>1&&(o-=1),o<1/6?e+6*(t-e)*o:o<.5?t:o<2/3?e+(t-e)*(2/3-o)*6:e}if(e=P(e,360),t=P(t,100),o=P(o,100),0===t)r=a=n=o;else{var s=o<.5?o*(1+t):o+t-o*t,c=2*o-s;r=i(c,s,e+1/3),a=i(c,s,e),n=i(c,s,e-1/3)}return{r:255*r,g:255*a,b:255*n}}(e.h,i,p),d=!0,h="hsl"),e.hasOwnProperty("a")&&(n=e.a)),n=M(n),{ok:d,format:e.format||h,r:Math.min(255,Math.max(a.r,0)),g:Math.min(255,Math.max(a.g,0)),b:Math.min(255,Math.max(a.b,0)),a:n}}(e);this._originalInput=e,this._r=o.r,this._g=o.g,this._b=o.b,this._a=o.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||o.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=o.ok}function p(e,t,o){e=P(e,255),t=P(t,255),o=P(o,255);var r,a,n=Math.max(e,t,o),i=Math.min(e,t,o),s=(n+i)/2;if(n==i)r=a=0;else{var c=n-i;switch(a=s>.5?c/(2-n-i):c/(n+i),n){case e:r=(t-o)/c+(t<o?6:0);break;case t:r=(o-e)/c+2;break;case o:r=(e-t)/c+4}r/=6}return{h:r,s:a,l:s}}function d(e,t,o){e=P(e,255),t=P(t,255),o=P(o,255);var r,a,n=Math.max(e,t,o),i=Math.min(e,t,o),s=n,c=n-i;if(a=0===n?0:c/n,n==i)r=0;else{switch(n){case e:r=(t-o)/c+(t<o?6:0);break;case t:r=(o-e)/c+2;break;case o:r=(e-t)/c+4}r/=6}return{h:r,s:a,v:s}}function h(e,t,o,r){var a=[E(Math.round(e).toString(16)),E(Math.round(t).toString(16)),E(Math.round(o).toString(16))];return r&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0):a.join("")}function m(e,t,o,r){return[E(F(r)),E(Math.round(e).toString(16)),E(Math.round(t).toString(16)),E(Math.round(o).toString(16))].join("")}function f(e,t){t=0===t?0:t||10;var o=u(e).toHsl();return o.s-=t/100,o.s=q(o.s),u(o)}function b(e,t){t=0===t?0:t||10;var o=u(e).toHsl();return o.s+=t/100,o.s=q(o.s),u(o)}function y(e){return u(e).desaturate(100)}function g(e,t){t=0===t?0:t||10;var o=u(e).toHsl();return o.l+=t/100,o.l=q(o.l),u(o)}function _(e,t){t=0===t?0:t||10;var o=u(e).toRgb();return o.r=Math.max(0,Math.min(255,o.r-Math.round(-t/100*255))),o.g=Math.max(0,Math.min(255,o.g-Math.round(-t/100*255))),o.b=Math.max(0,Math.min(255,o.b-Math.round(-t/100*255))),u(o)}function w(e,t){t=0===t?0:t||10;var o=u(e).toHsl();return o.l-=t/100,o.l=q(o.l),u(o)}function k(e,t){var o=u(e).toHsl(),r=(o.h+t)%360;return o.h=r<0?360+r:r,u(o)}function S(e){var t=u(e).toHsl();return t.h=(t.h+180)%360,u(t)}function x(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var o=u(e).toHsl(),r=[u(e)],a=360/t,n=1;n<t;n++)r.push(u({h:(o.h+n*a)%360,s:o.s,l:o.l}));return r}function v(e){var t=u(e).toHsl(),o=t.h;return[u(e),u({h:(o+72)%360,s:t.s,l:t.l}),u({h:(o+216)%360,s:t.s,l:t.l})]}function C(e,t,o){t=t||6,o=o||30;var r=u(e).toHsl(),a=360/o,n=[u(e)];for(r.h=(r.h-(a*t>>1)+720)%360;--t;)r.h=(r.h+a)%360,n.push(u(r));return n}function T(e,t){t=t||6;for(var o=u(e).toHsv(),r=o.h,a=o.s,n=o.v,i=[],s=1/t;t--;)i.push(u({h:r,s:a,v:n})),n=(n+s)%1;return i}u.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var e,t,o,r=this.toRgb();return e=r.r/255,t=r.g/255,o=r.b/255,.2126*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.7152*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.0722*(o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4))},setAlpha:function(e){return this._a=M(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=d(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=d(this._r,this._g,this._b),t=Math.round(360*e.h),o=Math.round(100*e.s),r=Math.round(100*e.v);return 1==this._a?"hsv("+t+", "+o+"%, "+r+"%)":"hsva("+t+", "+o+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=p(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=p(this._r,this._g,this._b),t=Math.round(360*e.h),o=Math.round(100*e.s),r=Math.round(100*e.l);return 1==this._a?"hsl("+t+", "+o+"%, "+r+"%)":"hsla("+t+", "+o+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return h(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,o,r,a){var n=[E(Math.round(e).toString(16)),E(Math.round(t).toString(16)),E(Math.round(o).toString(16)),E(F(r))];return a&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)&&n[3].charAt(0)==n[3].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0)+n[3].charAt(0):n.join("")}(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*P(this._r,255))+"%",g:Math.round(100*P(this._g,255))+"%",b:Math.round(100*P(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*P(this._r,255))+"%, "+Math.round(100*P(this._g,255))+"%, "+Math.round(100*P(this._b,255))+"%)":"rgba("+Math.round(100*P(this._r,255))+"%, "+Math.round(100*P(this._g,255))+"%, "+Math.round(100*P(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(A[h(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+m(this._r,this._g,this._b,this._a),o=t,r=this._gradientType?"GradientType=1, ":"";if(e){var a=u(e);o="#"+m(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+o+")"},toString:function(e){var t=!!e;e=e||this._format;var o=!1,r=this._a<1&&this._a>=0;return t||!r||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(o=this.toRgbString()),"prgb"===e&&(o=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(o=this.toHexString()),"hex3"===e&&(o=this.toHexString(!0)),"hex4"===e&&(o=this.toHex8String(!0)),"hex8"===e&&(o=this.toHex8String()),"name"===e&&(o=this.toName()),"hsl"===e&&(o=this.toHslString()),"hsv"===e&&(o=this.toHsvString()),o||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return u(this.toString())},_applyModification:function(e,t){var o=e.apply(null,[this].concat([].slice.call(t)));return this._r=o._r,this._g=o._g,this._b=o._b,this.setAlpha(o._a),this},lighten:function(){return this._applyModification(g,arguments)},brighten:function(){return this._applyModification(_,arguments)},darken:function(){return this._applyModification(w,arguments)},desaturate:function(){return this._applyModification(f,arguments)},saturate:function(){return this._applyModification(b,arguments)},greyscale:function(){return this._applyModification(y,arguments)},spin:function(){return this._applyModification(k,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(C,arguments)},complement:function(){return this._applyCombination(S,arguments)},monochromatic:function(){return this._applyCombination(T,arguments)},splitcomplement:function(){return this._applyCombination(v,arguments)},triad:function(){return this._applyCombination(x,[3])},tetrad:function(){return this._applyCombination(x,[4])}},u.fromRatio=function(e,t){if("object"==s(e)){var o={};for(var r in e)e.hasOwnProperty(r)&&(o[r]="a"===r?e[r]:L(e[r]));e=o}return u(e,t)},u.equals=function(e,t){return!(!e||!t)&&u(e).toRgbString()==u(t).toRgbString()},u.random=function(){return u.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},u.mix=function(e,t,o){o=0===o?0:o||50;var r=u(e).toRgb(),a=u(t).toRgb(),n=o/100;return u({r:(a.r-r.r)*n+r.r,g:(a.g-r.g)*n+r.g,b:(a.b-r.b)*n+r.b,a:(a.a-r.a)*n+r.a})},u.readability=function(e,t){var o=u(e),r=u(t);return(Math.max(o.getLuminance(),r.getLuminance())+.05)/(Math.min(o.getLuminance(),r.getLuminance())+.05)},u.isReadable=function(e,t,o){var r,a,n,i,s,c=u.readability(e,t);switch(a=!1,(n=o,"AA"!==(i=((n=n||{level:"AA",size:"small"}).level||"AA").toUpperCase())&&"AAA"!==i&&(i="AA"),"small"!==(s=(n.size||"small").toLowerCase())&&"large"!==s&&(s="small"),r={level:i,size:s}).level+r.size){case"AAsmall":case"AAAlarge":a=c>=4.5;break;case"AAlarge":a=c>=3;break;case"AAAsmall":a=c>=7}return a},u.mostReadable=function(e,t,o){var r,a,n,i,s=null,c=0;a=(o=o||{}).includeFallbackColors,n=o.level,i=o.size;for(var l=0;l<t.length;l++)(r=u.readability(e,t[l]))>c&&(c=r,s=u(t[l]));return u.isReadable(e,s,{level:n,size:i})||!a?s:(o.includeFallbackColors=!1,u.mostReadable(e,["#fff","#000"],o))};var I=u.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},A=u.hexNames=function(e){var t={};for(var o in e)e.hasOwnProperty(o)&&(t[e[o]]=o);return t}(I);function M(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function P(e,t){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var o=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(e);return e=Math.min(t,Math.max(0,parseFloat(e))),o&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function q(e){return Math.min(1,Math.max(0,e))}function R(e){return parseInt(e,16)}function E(e){return 1==e.length?"0"+e:""+e}function L(e){return e<=1&&(e=100*e+"%"),e}function F(e){return Math.round(255*parseFloat(e)).toString(16)}function j(e){return R(e)/255}var B,H,N,$=(H="[\\s|\\(]+("+(B="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+B+")[,|\\s]+("+B+")\\s*\\)?",N="[\\s|\\(]+("+B+")[,|\\s]+("+B+")[,|\\s]+("+B+")[,|\\s]+("+B+")\\s*\\)?",{CSS_UNIT:new RegExp(B),rgb:new RegExp("rgb"+H),rgba:new RegExp("rgba"+N),hsl:new RegExp("hsl"+H),hsla:new RegExp("hsla"+N),hsv:new RegExp("hsv"+H),hsva:new RegExp("hsva"+N),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function z(e){return!!$.CSS_UNIT.exec(e)}const O=["color","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"],W=["fontFamily","fontSize","lineHeight","letterSpacing","fontWeight","fontVariation","textDecoration","textShadow","textTransform","-webkit-font-smoothing","-moz-osx-font-smoothing","transition"],Q=["backgroundColor","border","borderTop","borderRight","borderBottom","borderLeft","borderRadius","borderWidth","borderColor","borderStyle","borderTopWidth","borderTopColor","borderTopStyle","borderRightWidth","borderRightColor","borderRightStyle","borderBottomWidth","borderBottomColor","borderBottomStyle","borderLeftWidth","borderLeftColor","borderLeftStyle","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","outline","outlineOffset","boxShadow"],U={".Label":[...O,...W],".Text":[...O,...W],".Input":[...O,...W,...Q],".Error":[...O,...W,...Q],".Tab":[...O,...W,...Q],".TabIcon":[...O],".TabLabel":[...O,...W],".Block":[...O.slice(1),...Q.slice(1)],".Container":[...Q],".Header":[...O,...Q,...W],".Footer":[...O,...Q,...W]},D={".Label":U[".Label"],".Label--floating":[...U[".Label"],"transform"],".Input":[...U[".Input"],"outlineColor","outlineWidth","outlineStyle"],".Error":U[".Error"],".Tab":["backgroundColor","color","fontFamily"],".Tab--selected":["outlineColor","outlineWidth","outlineStyle","backgroundColor","color",...Q],".TabIcon":U[".TabIcon"],".TabIcon--selected":["color"],".TabLabel":U[".TabLabel"],".Block":U[".Block"],".Container":U[".Container"],".Header":U[".Header"],".Footer":U[".Footer"],".Footer--link":U[".Text"],".Text":U[".Text"],".Text--redirect":U[".Text"]},V=(e,t=document)=>{let o=null,r=0;for(;!o&&r<e.length;){let a;try{a=t.querySelector(e[r])}catch(e){r++;continue}if(!a){r++;continue}const n=(t.defaultView||window).getComputedStyle(a).backgroundColor;n&&u(n).getAlpha()>=.5&&(o=n),r++}return o||"#ffffff"},X=e=>{const t=u(e),o=t.getAlpha();if(o<1){const e=t.toRgb();return u({r:Math.round(e.r*o+255*(1-o)),g:Math.round(e.g*o+255*(1-o)),b:Math.round(e.b*o+255*(1-o))}).getBrightness()>125}return t.getBrightness()>125},G={default:{hiddenContainer:"#wcpay-hidden-div",hiddenInput:"#wcpay-hidden-input",hiddenInvalidInput:"#wcpay-hidden-invalid-input",hiddenValidActiveLabel:"#wcpay-hidden-valid-active-label"},classicCheckout:{appendTarget:".woocommerce-billing-fields__field-wrapper",upeThemeInputSelector:"#billing_first_name",upeThemeLabelSelector:".woocommerce-checkout .form-row label",upeThemeTextSelectors:["#payment .payment_methods li .payment_box fieldset",".woocommerce-checkout .form-row"],rowElement:"p",validClasses:["form-row"],invalidClasses:["form-row","woocommerce-invalid","woocommerce-invalid-required-field"],alternateSelectors:{appendTarget:"form.checkout",upeThemeInputSelector:'form.checkout input[type="text"]',upeThemeLabelSelector:"form.checkout label",upeThemeTextSelectors:["form.checkout",".woocommerce"]},backgroundSelectors:["li.wc_payment_method .wc-payment-form","li.wc_payment_method .payment_box","#payment","#order_review","form.checkout","body"],headingSelectors:["h1","h2","h3","h4","h5","h6"],buttonSelectors:["#place_order"],pmmeRelativeTextSizeSelector:".wc_payment_method > label"},blocksCheckout:{appendTarget:".wc-block-checkout__contact-fields",upeThemeInputSelector:".wc-block-components-text-input #email",upeThemeLabelSelector:".wc-block-components-text-input label",upeThemeTextSelectors:[".wc-block-components-checkout-step__description",".wc-block-components-text-input",".wc-block-components-radio-control__label",".wc-block-checkout__terms"],rowElement:"div",validClasses:["wc-block-components-text-input","is-active"],invalidClasses:["wc-block-components-text-input","has-error"],alternateSelectors:{appendTarget:"#billing.wc-block-components-address-form",upeThemeInputSelector:"#billing-first_name",upeThemeLabelSelector:".wc-block-components-checkout-step__description"},backgroundSelectors:["#payment-method .wc-block-components-radio-control-accordion-option","#payment-method","form.wc-block-checkout__form",".wc-block-checkout","body"],headingSelectors:["h1","h2","h3","h4","h5","h6"],buttonSelectors:[".wc-block-components-checkout-place-order-button"],containerSelectors:[".wp-block-woocommerce-checkout-order-summary-block"],pmmeRelativeTextSizeSelector:".wc-block-components-radio-control__label-group"},bnplProductPage:{appendTarget:".product .cart .quantity",upeThemeInputSelector:".product .cart .quantity .qty",upeThemeLabelSelector:".product .cart .quantity label",upeThemeTextSelectors:[".product .cart .quantity"],rowElement:"div",validClasses:["input-text"],invalidClasses:["input-text","has-error"],backgroundSelectors:["#payment-method-message","#main > .product > div.summary.entry-summary","#main > .product","#main","body"],headingSelectors:["h1","h2","h3","h4","h5","h6"],buttonSelectors:[".single_add_to_cart_button"]},bnplClassicCart:{appendTarget:".cart .quantity",upeThemeInputSelector:".cart .quantity .qty",upeThemeLabelSelector:".cart .quantity label",upeThemeTextSelectors:[".cart .quantity"],rowElement:"div",validClasses:["input-text"],invalidClasses:["input-text","has-error"],backgroundSelectors:["#payment-method-message","#main .entry-content .cart_totals","#main .entry-content","#main","body"],headingSelectors:["h1","h2","h3","h4","h5","h6"],buttonSelectors:[".checkout-button"],containerSelectors:[".shop_table"]},bnplCartBlock:{appendTarget:".wc-block-cart .wc-block-components-quantity-selector",upeThemeInputSelector:".wc-block-cart .wc-block-components-quantity-selector .wc-block-components-quantity-selector__input",upeThemeLabelSelector:".wc-block-components-text-input",upeThemeTextSelectors:[".wc-block-components-text-input"],rowElement:"div",validClasses:["wc-block-components-text-input"],invalidClasses:["wc-block-components-text-input","has-error"],backgroundSelectors:[".wc-block-components-bnpl-wrapper",".wc-block-components-order-meta",".wc-block-components-totals-wrapper",".wp-block-woocommerce-cart-order-summary-block",".wp-block-woocommerce-cart-totals-block",".wp-block-woocommerce-cart .wc-block-cart",".wp-block-woocommerce-cart","body"],headingSelectors:["h1","h2","h3","h4","h5","h6"],buttonSelectors:[".wc-block-cart__submit-button"],containerSelectors:[".wp-block-woocommerce-cart-line-items-block"]},wooPayClassicCheckout:{appendTarget:".woocommerce-billing-fields__field-wrapper",upeThemeInputSelector:"#billing_first_name",upeThemeLabelSelector:".woocommerce-checkout .form-row label",upeThemeTextSelectors:[".woocommerce-checkout .form-row"],rowElement:"p",validClasses:["form-row"],invalidClasses:["form-row","woocommerce-invalid","woocommerce-invalid-required-field"],alternateSelectors:{appendTarget:"form.checkout",upeThemeInputSelector:'form.checkout input[type="text"]',upeThemeLabelSelector:"form.checkout label",upeThemeTextSelectors:["form.checkout",".woocommerce"]},backgroundSelectors:["#customer_details","#order_review","form.checkout","body"],headingSelectors:["h1","h2","h3","h4","h5","h6"],buttonSelectors:["#place_order"],linkSelectors:["form.checkout a",".woocommerce a","main a",".entry-content a",".site-content a","#content a","#primary a","a"],containerSelectors:[".woocommerce-checkout-review-order-table"],headerSelectors:["header > div:has(nav)","header > div:has(.site-logo)","header > div:has(.custom-logo)",".site-header","#masthead","header > div:last-of-type","header"],footerSelectors:[".site-footer","#colophon","footer > div","footer"],footerLink:[".site-footer a","footer a"]},wooPayBlocksCheckout:{appendTarget:".wc-block-checkout__contact-fields",upeThemeInputSelector:".wc-block-components-text-input #email",upeThemeLabelSelector:".wc-block-components-text-input label",upeThemeTextSelectors:[".wc-block-components-checkout-step__description",".wc-block-components-text-input",".wc-block-components-radio-control__label",".wc-block-checkout__terms"],rowElement:"div",validClasses:["wc-block-components-text-input","is-active"],invalidClasses:["wc-block-components-text-input","has-error"],alternateSelectors:{appendTarget:"#billing.wc-block-components-address-form",upeThemeInputSelector:"#billing-first_name",upeThemeLabelSelector:".wc-block-components-checkout-step__description"},backgroundSelectors:["#payment-method .wc-block-components-radio-control-accordion-option","#payment-method","form.wc-block-checkout__form",".wc-block-checkout","body"],headingSelectors:["h1","h2","h3","h4","h5","h6"],buttonSelectors:[".wc-block-components-checkout-place-order-button"],linkSelectors:[".wc-block-checkout a",".wc-block-components-main a","main a",".entry-content a",".site-content a","#content a","#primary a","a"],containerSelectors:[".wp-block-woocommerce-checkout-order-summary-block"],headerSelectors:["header > div:has(nav)","header > div:has(.site-logo)","header > div:has(.custom-logo)",".site-header","#masthead","header > div:last-of-type","header"],footerSelectors:[".site-footer","#colophon","footer > div","footer"],footerLink:[".site-footer a","footer a"]},updateSelectors:function(e,t){return e.hasOwnProperty("alternateSelectors")&&(Object.entries(e.alternateSelectors).forEach(o=>{const[r,a]=o,n=e[r];if(Array.isArray(n))n.some(e=>{try{return t.querySelector(e)}catch(e){return!1}})||(e[r]=a);else try{t.querySelector(e[r])||(e[r]=a)}catch(t){e[r]=a}}),delete e.alternateSelectors),e},getSelectors:function(e,t){let o=this.blocksCheckout;switch(e){case"blocks_checkout":o=this.blocksCheckout;break;case"shortcode_checkout":o=this.classicCheckout;break;case"bnpl_product_page":o=this.bnplProductPage;break;case"bnpl_classic_cart":o=this.bnplClassicCart;break;case"bnpl_cart_block":o=this.bnplCartBlock;break;case"woopay_shortcode_checkout":o=this.wooPayClassicCheckout;break;case"woopay_blocks_checkout":o=this.wooPayBlocksCheckout}return{...this.default,...this.updateSelectors(o,t)}}},J={getHiddenContainer:function(e,t){const o=t.createElement("div");return o.setAttribute("id",this.getIDFromSelector(e)),o.style.border=0,o.style.clip="rect(0 0 0 0)",o.style.height="1px",o.style.margin="-1px",o.style.overflow="hidden",o.style.padding="0",o.style.position="absolute",o.style.width="1px",o},createRow:function(e,t=[],o){const r=o.createElement(e);return t.length&&r.classList.add(...t),r},appendClone:function(e,t,o,r){const a=r.querySelector(t);if(a){const t=a.cloneNode(!0);t.id=this.getIDFromSelector(o),t.value="",e.appendChild(t)}},getIDFromSelector:function(e){return e.startsWith("#")||e.startsWith(".")?e.slice(1):e},init:function(e,t){const o=G.getSelectors(e),r=t.querySelector(o.appendTarget),a=t.querySelector(o.upeThemeInputSelector);if(!r||!a)return;t.querySelector(o.hiddenContainer)&&this.cleanup(t);const n=this.getHiddenContainer(o.hiddenContainer,t);r.appendChild(n);const i=this.createRow(o.rowElement,o.validClasses,t);n.appendChild(i);const s=this.createRow(o.rowElement,o.invalidClasses,t);n.appendChild(s),this.appendClone(i,o.upeThemeInputSelector,o.hiddenInput,t),this.appendClone(i,o.upeThemeLabelSelector,o.hiddenValidActiveLabel,t),this.appendClone(s,o.upeThemeInputSelector,o.hiddenInvalidInput,t),this.appendClone(s,o.upeThemeLabelSelector,o.hiddenInvalidInput,t),t.querySelector(o.hiddenInput).style.transition="none"},cleanup:function(e){const t=e.querySelector(G.default.hiddenContainer);t&&t.remove()}},K=(e,t,o=null,r)=>{const a=(Array.isArray(e)?e:[e]).map(e=>{try{return r.querySelector(e)}catch(e){return null}}).filter(Boolean);if(!a.length)return{};const n=r.defaultView||window,i=D[t],s=a[0],c=n.getComputedStyle(s),l={};if(i.forEach(e=>{const t=e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),o=c.getPropertyValue(t);if(o)if("color"!==e)if("lineHeight"!==e||"0"!==o&&"0px"!==o)l[e]=o;else for(let t=1;t<a.length;t++){const o=n.getComputedStyle(a[t]).getPropertyValue("line-height");if("0"!==o&&"0px"!==o){l[e]=o;break}}else l[e]=(e=>{const t=e.match(/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0?(\.\d+)?|1?(\.0+)?)\s*\)$/);if(t){const o=t[4]||1;e=`rgb(${t.slice(1,4).map(e=>Math.round(e*o+255*(1-o))).join(", ")})`}return e})(o)}),".Input"===t||".Tab--selected"===t){const e=((e,t="solid",o)=>e&&o?[e,t,o].join(" "):"")(l.outlineWidth,l.outlineStyle,l.outlineColor);""!==e&&(l.outline=e),delete l.outlineWidth,delete l.outlineColor,delete l.outlineStyle}const u=c.getPropertyValue("text-indent");return"0px"!==u&&"0px"===l.paddingLeft&&"0px"===l.paddingRight&&(l.paddingLeft=u,l.paddingRight=u),".Block"===t&&(l.backgroundColor=o),l},Z={blocks_checkout:"woopay_blocks_checkout",shortcode_checkout:"woopay_shortcode_checkout"},Y=(e,t=!1,o=document)=>{const r=t?Z[e]??e:e,a=G.getSelectors(r,o);J.init(r,o);const n=K(a.hiddenInput,".Input",null,o),i=K(a.hiddenInvalidInput,".Input",null,o),s=K(a.upeThemeLabelSelector,".Label",null,o),c={fontSize:s.fontSize},l=K(a.upeThemeTextSelectors,".Text",null,o),p=K(a.upeThemeInputSelector,".Tab",null,o),d=K(a.hiddenInput,".Tab--selected",null,o),h=(e=>{const t=Object.assign({},e);if(!e.backgroundColor||!e.color)return e;const o=((e,t)=>{const o={backgroundColor:e,color:t},r=u(e),a=u(t);if(!r.isValid()||!a.isValid())return{backgroundColor:"",color:""};const n=r.getBrightness()>50?u(r).darken(7):u(r).lighten(7),i=u.mostReadable(n,[a],{includeFallbackColors:!0});return o.backgroundColor=n.toRgbString(),o.color=i.toRgbString(),o})(e.backgroundColor,e.color);return t.backgroundColor=o.backgroundColor,t.color=o.color,t})(p),m={color:h.color},f={color:d.color},b=V(a.backgroundSelectors,o),y=K(a.upeThemeLabelSelector,".Block",b,o),g={colorBackground:b,colorText:l.color,fontFamily:l.fontFamily,fontSizeBase:l.fontSize};a.pmmeRelativeTextSizeSelector&&g.fontSizeBase&&(g.fontSizeBase=function(e,t,o=.875,r){const a=parseFloat(t);if(isNaN(a))return t;const n=r.querySelector(e);if(!n)return a*o+"px";const i=window.getComputedStyle(n).getPropertyValue("font-size"),s=parseFloat(i)*o;return isNaN(s)?t:a>s?`${s}px`:`${a}px`}(a.pmmeRelativeTextSizeSelector,l.fontSize,.875,o));const _="blocks_checkout"===e||"woopay_blocks_checkout"===r;let w={variables:g,theme:X(b)?"stripe":"night",labels:_?"floating":"above",rules:JSON.parse(JSON.stringify({".Input":n,".Input--invalid":i,".Label":s,".Label--resting":c,".Block":y,".Tab":p,".Tab:hover":h,".Tab--selected":d,".TabIcon:hover":m,".TabIcon--selected":f,".Text":l,".Text--redirect":l}))};if(_&&(w=((e,t)=>{if(e.rules[".Label--floating"]=t,e.rules[".Label--floating"].transform&&"none"!==e.rules[".Label--floating"].transform){const t=e.rules[".Label--floating"].transform.match(/matrix\((.+)\)/);if(t&&t[1]){const o=t[1].split(", "),r=(parseFloat(o[0])+parseFloat(o[3]))/2,a=parseFloat(e.rules[".Label--floating"].lineHeight),n=Math.floor(a*r);e.rules[".Label--floating"].lineHeight=`${n}px`,e.rules[".Label--floating"].fontSize=`${n}px`}delete e.rules[".Label--floating"].transform}if(e.rules[".Input"].paddingTop&&(e.rules[".Input"].paddingTop=`calc(${e.rules[".Input"].paddingTop} - ${e.rules[".Label--floating"].lineHeight} - 4px - 1px)`),e.rules[".Input"].paddingBottom){const t=parseFloat(e.rules[".Input"].paddingBottom);e.rules[".Input"].paddingBottom=t-1+"px";const o=e.rules[".Label"].marginTop??"0";e.rules[".Label"].marginTop=`${Math.floor((t-1)/3)}px`,e.rules[".Label--floating"].marginTop=o}return e})(w,K(a.hiddenValidActiveLabel,".Label--floating",null,o))),t){const e=K(a.headerSelectors,".Header",null,o),t=K(a.footerSelectors,".Footer",null,o);(!e.backgroundColor||u(e.backgroundColor).getAlpha()<.5)&&(e.backgroundColor=V([...a.headerSelectors??[],"body"],o)),(!t.backgroundColor||u(t.backgroundColor).getAlpha()<.5)&&(t.backgroundColor=V([...a.footerSelectors??[],"body"],o)),w.rules={...w.rules,".Heading":K(a.headingSelectors,".Label",null,o),".Header":e,".Footer":t,".Footer-link":K(a.footerLink,".Footer--link",null,o),".Button":K(a.buttonSelectors,".Input",null,o),".Link":K(a.linkSelectors,".Label",null,o),".Container":K(a.containerSelectors,".Container",null,o)}}return J.cleanup(o),w};class ee{constructor(e,t){this.options=e,this.stripe=null,this.stripePlatform=null,this.request=t,this.isWooPayRequesting=!1}createStripe(e,t,o="",r=[]){const a={locale:t};return o&&(a.stripeAccount=o),r&&(a.betas=r),new Stripe(e,a)}async getStripeForUPE(e){return this.options.forceNetworkSavedCards=a("paymentMethodsConfig")[e].forceNetworkSavedCards,this.getStripe()}async getStripe(e=!1){let t=0;for(;!window.Stripe;)if(await new Promise(e=>setTimeout(e,100)),t+=100,t>6e5)throw new Error("Stripe object not found");return this.__getStripe(e)}__getStripe(e=!1){const{publishableKey:t,accountId:o,forceNetworkSavedCards:r,locale:a,isStripeLinkEnabled:n}=this.options;if(r&&!e)return this.stripePlatform||(this.stripePlatform=this.createStripe(t,a)),this.stripePlatform;if(!this.stripe){let e=["card_country_event_beta_1"];n&&(e=e.concat(["link_autofill_modal_beta_1"])),this.stripe=this.createStripe(t,a,o,e)}return this.stripe}async loadStripeForExpressCheckout(){try{return this.getStripe(!0)}catch(e){return{error:e}}}confirmIntent(e,t=!1){const o=e.match(/#wcpay-confirm-(pi|si):([^:]+):([^:]+):([^:]+)(?::(.+))?$/);if(!o)return!0;const a="si"===o[1];let i=o[2];const s=o[3],c=o[4],l=o[5]||null,u=e.indexOf("order-pay"),p=u>-1&&e.substring(u).match(/\d+/);return p&&(i=p[0]),(async()=>{const{locale:e,publishableKey:t}=this.options,o=r("accountIdForIntentConfirmation");if(a){const e=await this.getStripe(!0);return l?e.confirmSetup({clientSecret:s,confirmParams:{confirmation_token:l},redirect:"if_required"}):e.handleNextAction({clientSecret:s})}return o?this.createStripe(t,e,o).confirmCardPayment(s):(await this.getStripe(!0)).handleNextAction({clientSecret:s})})().then(e=>{let o=null;e.paymentIntent?.last_payment_error&&(o={message:e.paymentIntent.last_payment_error.message}),"requires_action"===e.paymentIntent?.status&&(o={message:"Payment requires additional action."});const a=e.paymentIntent&&e.paymentIntent.id||e.setupIntent&&e.setupIntent.id||e.error&&e.error.payment_intent&&e.error.payment_intent.id||e.error.setup_intent&&e.error.setup_intent.id,s=n("ajax_url")??r("ajaxUrl"),l=r("isChangingPayment");return[this.request(s,{action:"update_order_status",order_id:i,_ajax_nonce:c,intent_id:a,should_save_payment_method:t?"true":"false",is_changing_payment:l?"true":"false"}),o,e.error]}).then(([e,t,o])=>{if(o)throw o;return e.then(e=>{const o="string"==typeof e?JSON.parse(e):e;if(o.error)throw o.error;if(t)throw t;return o.return_url})})}async setupIntent(e){const t=await this.request(r("ajaxUrl"),{action:"create_setup_intent","wcpay-payment-method":e,_ajax_nonce:r("createSetupIntentNonce")});if(!t.success)throw t.data.error;if("succeeded"===t.data.status)return t.data;const o=await this.getStripe(),a=await o.confirmCardSetup(t.data.client_secret),{setupIntent:n,error:i}=a;if(i)throw i;return n}initWooPay(e,t){if(!this.isWooPayRequesting){this.isWooPayRequesting=!0;const o=r("wcAjaxUrl"),a=r("initWooPayNonce");let n=null,s=null;if(r("isWooPayGlobalThemeSupportEnabled"))if(r("isShortcodeCheckout")){const e=document.querySelector(".wp-block-woocommerce-checkout")?"blocks_checkout":document.querySelector(".woocommerce-billing-fields")?"woopay_shortcode_checkout":document.querySelector(".wp-block-woocommerce-cart")?"bnpl_cart_block":document.querySelector(".woocommerce-cart-form")?"bnpl_classic_cart":document.querySelector(".single-product")?"bnpl_product_page":void 0;n=Y(e,!0),s=((e=document)=>{const t=[],o=e.styleSheets,r=["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","fonts.bunny.net","fonts.wp.com"];for(let e=0;e<o.length;e++){if(!o[e].href)continue;const a=new URL(o[e].href);-1!==r.indexOf(a.hostname)&&t.push({cssSrc:o[e].href})}return t})()}else n=r("woopayAppearance"),s=r("woopayFontRules");return this.request(i(o,"init_woopay"),{_wpnonce:a,appearance:n,font_rules:s,email:e,user_session:t,order_id:r("order_id"),key:r("key"),billing_email:r("billing_email")}).finally(()=>{this.isWooPayRequesting=!1})}}expressCheckoutAddToCart(e){const t=r("wcAjaxUrl"),o=r("addToCartNonce");return this.request(i(t,"add_to_cart"),{security:o,...e})}}jQuery(e=>{e("input[name=wc_deposit_option],input[name=wc_deposit_payment_plan]").on("change",()=>{(0,o.doAction)("wcpay.express-checkout.update-button-data")})}),(0,o.addFilter)("wcpay.express-checkout.cart-add-item","automattic/wcpay/express-checkout",e=>{const t={};return jQuery("input[name=wc_deposit_option]").length&&(t.wc_deposit_option=jQuery("input[name=wc_deposit_option]:checked").val()),jQuery("input[name=wc_deposit_payment_plan]").length&&(t.wc_deposit_payment_plan=jQuery("input[name=wc_deposit_payment_plan]:checked").val()),{...e,...t}});const te="wcpay-express-checkout__order-attribution-inputs",oe=()=>{(()=>{if(document.getElementById(te))return;const e=document.createElement("wc-order-attribution-inputs");e.id=te,document.body.appendChild(e)})(),window?.wc_order_attribution?.setOrderTracking(window?.wc_order_attribution?.params?.allowTracking)};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",oe):oe(),(0,o.addFilter)("wcpay.express-checkout.cart-place-order-extension-data","automattic/wcpay/express-checkout",e=>{const t=jQuery("#wcpay-express-checkout__order-attribution-inputs input");if(!t.length)return e;const o={};return t.each(function(){const e=jQuery(this).attr("name").replace("wc_order_attribution_",""),t=jQuery(this).val();e&&t&&(o[e]=t)}),{...e,"woocommerce/order-attribution":o}});let re=null,ae=null;const ne=()=>jQuery(ae),ie={init:({elementId:e,$separator:t})=>{ae=e,re=t},getButtonSeparator:()=>re,blockButton:()=>{ne().data("blockUI.isBlocked")||ne().block({message:null})},unblockButton:()=>{ie.showContainer(),ne().unblock()},renderButton:e=>{ne()?.length&&e.mount(ae)},hideContainer:()=>{ne().removeClass("is-ready").hide()},showContainer:()=>{ne().addClass("is-ready").show()}},se=ie,ce=(e,t,o=!1)=>{let r;return function(){const a=this,n=arguments,i=o&&!r;clearTimeout(r),r=setTimeout(()=>{r=null,o||t.apply(a,n)},e),i&&t.apply(a,n)}},le=e=>void 0!==window.wcpayExpressCheckoutParams?window.wcpayExpressCheckoutParams[e]??null:void 0!==window.wc?.wcSettings?window.wc.wcSettings.getSetting("ece_data")?.[e]??null:null;jQuery(e=>{e(document.body).on("woocommerce_variation_has_changed",async()=>{(0,o.doAction)("wcpay.express-checkout.update-button-data")})}),jQuery(e=>{if("product"!==le("button_context"))return;const t=e(".quantity");t.on("input",".qty",()=>{se.blockButton()}),t.on("input",".qty",ce(250,async()=>{(0,o.doAction)("wcpay.express-checkout.update-button-data")}))}),(0,o.addFilter)("wcpay.express-checkout.cart-add-item","automattic/wcpay/express-checkout",e=>{const t=document.querySelector(".single_variation_wrap");if(!t)return e;const o=t.querySelector('input[name="product_id"]').value;return{...e,id:parseInt(o,10)}}),(0,o.addFilter)("wcpay.express-checkout.cart-add-item","automattic/wcpay/express-checkout",e=>{const t=document.querySelector(".variations_form");if(!t)return e;const o=[],r=t.querySelectorAll(".variations select");return Array.from(r).forEach(function(e){const t=e.dataset.attribute_name||e.dataset.name;o.push({attribute:Array.from(document.querySelector(`label[for="${t.replace("attribute_","")}"]`).childNodes)[0].textContent,value:e.value||""}),o.push({attribute:t,value:e.value||""})}),{...e,variation:[...e.variation,...o]}}),(0,o.addFilter)("wcpay.express-checkout.map-line-items","automattic/wcpay/express-checkout",e=>({...e,items:e.items.filter(e=>!e.extensions?.bundles?.bundled_by)}));const ue=window.wp.htmlEntities,pe=(e,t)=>{const o=le("checkout")?.stripe_minor_unit??2,r=e*10**(o-t.currency_minor_unit);return o<t.currency_minor_unit?Math.round(r):r},de=e=>{const r=le("checkout").display_prices_with_tax,a=(0,o.applyFilters)("wcpay.express-checkout.map-line-items",e),n=a.items.map(e=>({amount:pe(r&&e.totals?parseInt(e.totals.line_subtotal,10)+parseInt(e.totals.line_subtotal_tax,10):parseInt(e.totals?.line_subtotal||e.prices.price,10),e.totals||e.prices),name:[e.name,e.quantity>1&&`(x${e.quantity})`,e.variation&&e.variation.length>0&&"-",e.variation&&e.variation.map(e=>`${e.attribute}: ${e.value}`).join(", "),e.item_data&&e.item_data.length>0&&"-",e.item_data&&e.item_data.map(e=>`${e.name||e.key}: ${e.value}`).join(", ")].filter(Boolean).map(ue.decodeEntities).join(" ")})),i=parseInt(a.totals.total_shipping||"0",10);i&&n.push({amount:pe(r?i+parseInt(a.totals.total_shipping_tax||"0",10):i,a.totals),name:(0,t.__)("Shipping","woocommerce-payments")});const s=parseInt(a.totals.total_discount||"0",10);s&&n.push({amount:-pe(r?s+parseInt(a.totals.total_discount_tax||"0",10):s,a.totals),name:(0,t.__)("Discount","woocommerce-payments")});const c=parseInt(a.totals.total_fees||"0",10);c&&n.push({amount:pe(r?c+parseInt(a.totals.total_fees_tax||"0",10):c,a.totals),name:(0,t.__)("Fees","woocommerce-payments")});const l=parseInt(a.totals.total_tax||"0",10);l&&!r&&n.push({amount:pe(l,a.totals),name:(0,t.__)("Tax","woocommerce-payments")});const u=parseInt(a.totals.total_refund||"0",10);return u&&n.push({amount:-pe(u,a.totals),name:(0,t.__)("Refund","woocommerce-payments")}),pe(parseInt(a.totals.total_price,10)-parseInt(a.totals.total_refund||0,10),a.totals)<n.reduce((e,{amount:t})=>e+t,0)?[]:n},he=e=>{const t=le("checkout").display_prices_with_tax,r=e.shipping_rates?.[0]?.shipping_rates||[],a=(0,o.applyFilters)("wcpay.express-checkout.shipping-rates",r,e);return a&&0!==a.length?a.sort((e,t)=>e.selected===t.selected?0:e.selected?-1:1).slice(0,9).map(e=>({id:e.rate_id,displayName:(0,ue.decodeEntities)(e.name),amount:pe(t?parseInt(e.price,10)+parseInt(e.taxes,10):parseInt(e.price,10),e),deliveryEstimate:[e.meta_data.find(e=>"pickup_address"===e.key)?.value,e.meta_data.find(e=>"pickup_details"===e.key)?.value].filter(Boolean).map(ue.decodeEntities).join(" - ")})):[]},me=e=>{const t=e?.extensions?.subscriptions;return!!t&&t.trial_length>0},fe=e=>{const t=e?.extensions?.subscriptions;if(!t||!Array.isArray(t))return null;for(const e of t){const t=e.shipping_rates?.[0]?.shipping_rates;if(t?.length>0)return t}return null},be=e=>!(!e?.items||!e?.extensions?.subscriptions)&&(!!e.items.some(me)&&(!(e.shipping_rates?.[0]?.shipping_rates?.length>0)&&null!==fe(e))),ye=e=>!(!e?.items||!e?.extensions?.subscriptions)&&e.items.some(me),ge=e=>!!ye(e)&&0===parseInt(e.totals?.total_price||"0",10),_e=e=>{const t=e?.extensions?.subscriptions;if(!t||!Array.isArray(t))return null;let o=0,r=0,a=0,n=0,i=0,s=2;const c=[];if(t.forEach(e=>{if(!e.totals?.total_price)return;o+=parseInt(e.totals.total_price,10),r+=parseInt(e.totals.total_items||"0",10),a+=parseInt(e.totals.total_tax||"0",10);const t=e.shipping_rates?.[0]?.shipping_rates?.find(e=>e.selected);t?(n+=parseInt(t.price||"0",10),i+=parseInt(t.taxes||"0",10)):(n+=parseInt(e.totals.total_shipping||"0",10),i+=parseInt(e.totals.total_shipping_tax||"0",10)),s=e.totals.currency_minor_unit??s,e.totals.tax_lines&&c.push(...e.totals.tax_lines)}),0===o)return null;const l=t[0]?.totals||e.totals;return{amount:o,currencyMinorUnit:s,totals:{...l,total_price:String(o),total_items:String(r),total_tax:String(a),total_shipping:String(n),total_shipping_tax:String(i),tax_lines:c}}},we=e=>{const o=e.totals,r=parseInt(o.total_price,10),a=o.currency_minor_unit??2,n=o.currency_prefix??"",i=o.currency_suffix??"",s=o.currency_decimal_separator??".",c=o.currency_thousand_separator??",",l=(r/Math.pow(10,a)).toFixed(a).split("."),u=l[0].replace(/\B(?=(\d{3})+(?!\d))/g,c),p=`${n}${l[1]?`${u}${s}${l[1]}`:u}${i}`,d=(h=e.billing_period,(m=e.billing_interval??1)>1?{day:(0,t.sprintf)((0,t._n)("%d day","%d days",m,"woocommerce-payments"),m),week:(0,t.sprintf)((0,t._n)("%d week","%d weeks",m,"woocommerce-payments"),m),month:(0,t.sprintf)((0,t._n)("%d month","%d months",m,"woocommerce-payments"),m),year:(0,t.sprintf)((0,t._n)("%d year","%d years",m,"woocommerce-payments"),m)}[h]||`${m} ${h}s`:{day:(0,t.__)("day","woocommerce-payments"),week:(0,t.__)("week","woocommerce-payments"),month:(0,t.__)("month","woocommerce-payments"),year:(0,t.__)("year","woocommerce-payments")}[h]||h);var h,m;return(0,t.sprintf)((0,t.__)("%1$s / %2$s","woocommerce-payments"),p,d)};(0,o.addFilter)("wcpay.express-checkout.total-amount","automattic/wcpay/express-checkout/wc-subscriptions",(e,t)=>{if(!ge(t))return e;const o=_e(t);return o?pe(o.amount,o.totals):e}),(0,o.addFilter)("wcpay.express-checkout.is-cart-eligible","automattic/wcpay/express-checkout/wc-subscriptions",(e,t)=>{if(e)return!0;if(ge(t)){const e=_e(t);return null!==e&&e.amount>0}return e}),(0,o.addFilter)("wcpay.express-checkout.shipping-rates","automattic/wcpay/express-checkout/wc-subscriptions",(e,t)=>e&&e.length>0?e:be(t)&&fe(t)||e),(0,o.addFilter)("wcpay.express-checkout.shipping-package-id","automattic/wcpay/express-checkout/wc-subscriptions",(e,t,o)=>{if(!be(t))return e;const r=t?.extensions?.subscriptions;if(!r||!Array.isArray(r))return e;for(const e of r){const t=e.shipping_rates;if(t&&Array.isArray(t))for(const e of t){const t=e?.shipping_rates?.some(e=>e.rate_id===o);if(t&&e.package_id)return e.package_id}}return e}),(0,o.addFilter)("wcpay.express-checkout.map-line-items","automattic/wcpay/express-checkout/wc-subscriptions",e=>{if(!ye(e))return e;const o=e?.extensions?.subscriptions;if(!o||!Array.isArray(o))return e;const r=0===parseInt(e.totals?.total_price||"0",10),a=[...e.items],n=(0,t.__)("Recurring total","woocommerce-payments");if(o.forEach(o=>{const i=e.items.filter(e=>e.extensions?.subscriptions?.billing_period===o.billing_period).length;if(0===i)return;const s=Math.round(parseInt(o.totals?.total_items||"0",10)/i);a.forEach((e,i)=>{const c=e.extensions?.subscriptions;c&&c.trial_length>0&&c.billing_period===o.billing_period&&((e.item_data||[]).some(e=>e.name===n)||(a[i]={...e,name:`${e.name} (${(0,t.__)("recurring","woocommerce-payments")})`,...r&&{totals:{...e.totals,line_subtotal:String(s),line_total:String(s)}},item_data:[...e.item_data||[],{name:(0,t.__)("Recurring total","woocommerce-payments"),value:(0,t.sprintf)((0,t.__)("%1$s on %2$s","woocommerce-payments"),we(o),o.next_payment_date)}]}))})}),!r)return{...e,items:a};const i=_e(e);return i?{...e,items:a,totals:{...e.totals,total_price:String(i.amount),total_items:i.totals.total_items||"0",total_tax:i.totals.total_tax||"0",total_shipping:i.totals.total_shipping||"0",total_shipping_tax:i.totals.total_shipping_tax||"0",tax_lines:i.totals.tax_lines||[]}}:{...e,items:a}});const ke=e=>{let t="undefined"==typeof wcpaySettings?4:parseInt(window?.wcpaySettings?.defaultExpressCheckoutBorderRadius||4,10);const o=le("button");return t=o?.radius??t,void 0!==e&&(t=Number(e?.borderRadius)??t),{variables:{borderRadius:`${t}px`,spacingUnit:"6px"}}},Se=e=>{if(!e)return"";const t=document.createElement("div");return t.innerHTML=e.trim(),t.firstChild?t.firstChild.textContent:""},xe=(e,t,o)=>{const r=document.querySelector(`${e} [name="${t}"]`);if(r)if("SELECT"===r.tagName&&/country|state/.test(t)){const e=Array.from(r.options).find(e=>e.value===o||e.textContent.trim().toLowerCase()===o.toLowerCase());e&&(r.value=e.value,jQuery(r).trigger("change").trigger("close"))}else r.value=o,jQuery(r).trigger("change")},ve=window.lodash;window.wp.domReady;const Ce=(e,t={})=>{if(!1===(r("isShopperTrackingEnabled")??n("is_shopper_tracking_enabled")))return;const o=r("platformTrackerNonce")??n("nonce")?.platform_tracker,a=r("ajaxUrl")??n("ajax_url"),i=new FormData;i.append("tracksNonce",o),i.append("action","platform_tracks"),i.append("tracksEventName",e),i.append("tracksEventProp",JSON.stringify(t)),fetch(a,{method:"post",body:i}).then(e=>e.json())},Te=(0,ve.debounce)(({source:e})=>{Ce("applepay_button_load",{source:e})},1e3),Ie=(0,ve.debounce)(({source:e})=>{Ce("gpay_button_load",{source:e})},1e3),Ae=window.wp.apiFetch;var Me=e.n(Ae);const Pe=window.wp.url,qe=()=>document.querySelector(".single_add_to_cart_button")||document.querySelector('.wp-block-add-to-cart-with-options button[type="submit"]'),Re=()=>{const e=document.querySelector(".single_add_to_cart_button");if(e)return e.value;const t=document.querySelector('.wp-block-add-to-cart-with-options input[name="add-to-cart"]');return t?.value},Ee=()=>{const e=document.querySelector(".quantity .qty");return e&&parseInt(e.value,10)||1};class Le{cartRequestHeaders={};async _request(e){const t=await Me()({...e,parse:!1,path:(0,Pe.addQueryArgs)(e.path,{currency:le("checkout").currency_code.toUpperCase()}),headers:(0,ve.omitBy)({Nonce:le("nonce").store_api_nonce,"X-WooPayments-Tokenized-Cart-Nonce":le("nonce").tokenized_cart_nonce,"X-WooPayments-Tokenized-Cart-Session-Nonce":"product"===le("button_context")?le("nonce").tokenized_cart_session_nonce:void 0,...this.cartRequestHeaders,...e.headers},ve.isNil)});return this.cartRequestHeaders=(0,ve.omitBy)({Nonce:t.headers.get("Nonce"),"X-WooPayments-Tokenized-Cart-Session":t.headers.get("X-WooPayments-Tokenized-Cart-Session")},ve.isNil),t.json()}async placeOrder(e){return await this._request({method:"POST",path:"/wc/store/v1/checkout",headers:{"X-WooPayments-Tokenized-Cart":!0,...this.cartRequestHeaders},data:e})}async getCart(){return await this._request({method:"GET",path:"/wc/store/v1/cart"})}useSeparateCart(){this.cartRequestHeaders={"X-WooPayments-Tokenized-Cart-Session":""}}deleteAfterRequest(){this.cartRequestHeaders={"X-WooPayments-Tokenized-Cart-Is-Ephemeral-Cart":"1"}}async updateCustomer(e){return await this._request({method:"POST",path:"/wc/store/v1/cart/update-customer",headers:{"X-WooPayments-Tokenized-Cart":!0,...this.cartRequestHeaders},data:e})}async selectShippingRate(e){return await this._request({method:"POST",path:"/wc/store/v1/cart/select-shipping-rate",data:e})}async addProductToCart(){const e={id:Re(),quantity:Ee(),variation:[]};return await this._request({method:"POST",path:"/wc/store/v1/cart/add-item",data:(0,o.applyFilters)("wcpay.express-checkout.cart-add-item",e)})}async emptyCart(){try{let e=await this._request({method:"GET",path:"/wc/store/v1/cart"});for(;e.items.length>0;)e=await this._request({method:"POST",path:"/wc/store/v1/cart/remove-item",data:{key:e.items[0].key}})}catch(e){}}}const Fe=(e,t)=>({first_name:e?.split(" ")?.slice(0,1)?.join(" ")??"",last_name:e?.split(" ")?.slice(1)?.join(" ")??"",company:t.organization??"",address_1:t.line1??"",address_2:t.line2??"",city:t.city??"",state:t.state??"",postcode:t.postal_code?.replace(" ","")??"",country:t.country??""}),je=(e,t,o=!0,r=[])=>{const a=e.billingDetails?.name||"",n=e.billingDetails?.address??{},i=e.billingDetails?.phone?.replace(/[() -]/g,"")??e.payerPhone?.replace(/[() -]/g,"")??"";return{customer_note:e.order_comments,billing_address:{first_name:a.split(" ")?.slice(0,1)?.join(" ")??"",last_name:a.split(" ")?.slice(1)?.join(" ")||"-",company:n.organization??"",address_1:n.line1??"",address_2:n.line2??"",city:n.city??"",state:n.state??"",postcode:n.postal_code??"",country:n.country??"",email:e.billingDetails?.email??"",phone:i},shipping_address:e.shippingAddress?{...Fe(e.shippingAddress.name||"",e.shippingAddress.address),phone:i}:void 0,payment_method:"woocommerce_payments",payment_data:[{key:"payment_method",value:"card"},{key:"wcpay-fraud-prevention-token",value:window.wcpayFraudPreventionToken??""},{key:o?"wcpay-confirmation-token":"wcpay-payment-method",value:t},{key:"express_payment_type",value:e.expressPaymentType},{key:"wcpay-express-payment-method-types",value:JSON.stringify(r)}]}};let Be=null,He=null,Ne=new Le;const $e=()=>Ne,ze=()=>{jQuery.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},Oe=()=>{jQuery.unblockUI()};class We{orderId;key;billingEmail="";cachedCartData={};constructor({orderId:e,key:t,billingEmail:o=""}){this.orderId=e,this.key=t,this.billingEmail=o}async placeOrder(e){return await Me()({method:"POST",path:`/wc/store/v1/checkout/${this.orderId}`,headers:{Nonce:le("nonce").store_api_nonce},data:{...e,key:this.key,billing_email:this.billingEmail,billing_address:this.cachedCartData.billing_address,shipping_address:this.cachedCartData.shipping_address}})}async getCart(){return this.cachedCartData=await Me()({method:"GET",path:(0,Pe.addQueryArgs)(`/wc/store/v1/order/${this.orderId}`,{key:this.key,billing_email:this.billingEmail})})}}let Qe=null;const Ue=async()=>{if("product"!==le("button_context"))return await $e().getCart();const e=new Le;return e.useSeparateCart(),e.deleteAfterRequest(),await e.addProductToCart()},De=()=>Qe?(0,o.applyFilters)("wcpay.express-checkout.total-amount",pe(parseInt(Qe.totals.total_price,10)-parseInt(Qe.totals.total_refund||0,10),Qe.totals),Qe):"product"===le("button_context")&&le("product")?le("product")?.total.amount:void 0;let Ve;jQuery(e=>{if(le("has_block")&&"pay_for_order"!==le("button_context"))return;const a=le("stripe").publishableKey;if(!a)return;const n=new ee({publishableKey:a,accountId:le("stripe").accountId,locale:le("stripe").locale},(e,t)=>new Promise((o,r)=>{jQuery.post(e,t).then(o).fail(r)}));var i;"pay_for_order"===le("button_context")&&(i=new We({orderId:r("order_id"),key:r("key"),billingEmail:r("billing_email")}),Ne=i),se.init({elementId:"#wcpay-express-checkout-element",$separator:jQuery("#wcpay-express-checkout-button-separator")});const s={abortPayment:t=>{Oe(),e(".woocommerce-error").remove();const o=e(".woocommerce-notices-wrapper").first();o.length&&(o.append(e('<div class="woocommerce-error" />').text(t)),e("html, body").animate({scrollTop:o.find(".woocommerce-error").offset().top},600))},completePayment:e=>{ze(),window.location=e},startExpressCheckoutElement:async e=>{let r="",a=Promise.resolve();const i=await n.getStripe(),c=le("flags")?.isEceUsingConfirmationTokens??!0,l=le("is_manual_capture")??!1,u=le("has_subscription")??!1,p=le("enabled_methods")??[],d=[p.includes("payment_request")&&"card",p.includes("amazon_pay")&&"amazon_pay"].filter(Boolean);Ve=i.elements({mode:"payment",amount:e.total,currency:e.currency,...c?{paymentMethodTypes:d}:{paymentMethodCreation:"manual"},...c&&l?{captureMethod:"manual"}:{},...c&&u?{setupFutureUsage:"off_session"}:{},appearance:ke(),locale:le("stripe")?.locale??"en"});const h=Ve.create("expressCheckout",(()=>{const e=le("button"),t=le("enabled_methods")??[],o=(e,t)=>{switch(t){case"dark":default:return"black";case"light":return"white";case"light-outline":return"googlePay"===e?"white":"white-outline"}},r="default"===e?.type?"plain":e?.type??"buy",a="default"===e?.type?"plain":e?.type??"plain",n=t.includes("payment_request");return{paymentMethods:{applePay:n?"always":"never",googlePay:n?"always":"never",amazonPay:t.includes("amazon_pay")?"auto":"never",link:"never",paypal:"never",klarna:"never"},layout:{overflow:"never"},buttonTheme:{googlePay:o("googlePay",e?.theme??"black"),applePay:o("applePay",e?.theme??"black")},buttonType:{googlePay:r,applePay:a},buttonHeight:Math.min(Math.max(parseInt(e?.height??"48",10),40),55)}})());se.renderButton(h),h.on("loaderror",()=>{document.getElementById("wcpay-woopay-button")||se.getButtonSeparator().hide()}),h.on("click",function(e){if(r="",le("login_confirmation"))return void(e=>{const t=le("login_confirmation");if(!t)return;let o=t.message;o=o.replace(/\*\*.*?\*\*/,{apple_pay:"Apple Pay",google_pay:"Google Pay",amazon_pay:"Amazon Pay",paypal:"PayPal",link:"Link"}[e]),o=o.replace(/\*\*/g,""),confirm(o)&&(window.location.href=t.redirect_url)})(e.expressPaymentType);if("product"===le("button_context")){const e=jQuery(qe());if(e.is(".disabled"))return void(e.is(".wc-variation-is-unavailable")?window.alert(window?.wc_add_to_cart_variation_params?.i18n_unavailable_text||(0,t.__)("Sorry, this product is unavailable. Please choose a different combination.","woocommerce-payments")):window.alert((0,t.__)("Please select your product options before proceeding.","woocommerce-payments")));$e().useSeparateCart(),a=$e().addProductToCart(),a.catch(()=>{r=(0,t.__)("There was an error processing the product with this payment method. Please add the product to the cart, instead.","woocommerce-payments"),$e().emptyCart(),h.unmount(),Ve=null,s.abortPayment(r),se.hideContainer(),se.getButtonSeparator().hide()}).finally(()=>{a=Promise.resolve()})}const o=Qe?{shippingAddressRequired:"pay_for_order"!==le("button_context")&&Qe.needs_shipping,shippingRates:he(Qe),phoneNumberRequired:le("checkout")?.needs_payer_phone??!1,lineItems:de(Qe)}:"product"===le("button_context")&&le("product")?{shippingAddressRequired:le("product")?.needs_shipping??!1,phoneNumberRequired:le("checkout")?.needs_payer_phone??!1,lineItems:(le("product")?.displayItems??[]).map(({label:e,amount:t})=>({name:e,amount:t}))}:void 0,n=o.shippingRates&&0!==o.shippingRates.length?o.shippingRates:[{id:"pending",displayName:(0,t.__)("Pending","woocommerce-payments"),amount:0}];(async function({expressPaymentType:e}){ze(),((e,t)=>{const o={google_pay:"gpay_button_click",apple_pay:"applepay_button_click"}[e];o&&Ce(o,{source:t})})(e,le("button_context"))})(e),e.resolve({business:{name:le("store_name")},emailRequired:!0,...o,shippingRates:o.shippingAddressRequired?n:void 0,allowedShippingCountries:le("checkout").allowed_shipping_countries})}),h.on("shippingaddresschange",async e=>(await a,r?e.resolve():(async(e,t)=>{Be=e.address;try{const r=await Ne.updateCustomer({shipping_address:Fe(e.name,e.address)}),a=he(r);if(0===a.length)return void e.reject();await t.update({amount:(0,o.applyFilters)("wcpay.express-checkout.total-amount",pe(parseInt(r.totals.total_price,10)-parseInt(r.totals.total_refund||0,10),r.totals),r)}),He=r,e.resolve({shippingRates:a,lineItems:de(r)})}catch(t){e.reject()}})(e,Ve))),h.on("shippingratechange",async e=>(async(e,t,r=null)=>{const a=He||r;try{const r=await Ne.selectShippingRate({package_id:(0,o.applyFilters)("wcpay.express-checkout.shipping-package-id",0,a,e.shippingRate.id),rate_id:e.shippingRate.id});He=r,await t.update({amount:(0,o.applyFilters)("wcpay.express-checkout.total-amount",pe(parseInt(r.totals.total_price,10)-parseInt(r.totals.total_refund||0,10),r.totals),r)}),e.resolve({lineItems:de(r)})}catch(t){e.reject()}})(e,Ve,Qe)),h.on("confirm",async e=>{if(!r)return(async(e,r,a,n,i,s,c=[])=>{const{error:l}=await a.submit();if(l)return i(l.message);const u=le("flags")?.isEceUsingConfirmationTokens??!0;let p;try{p=await async function(e,t,o){if(o){const{confirmationToken:o,error:r}=await e.createConfirmationToken({elements:t});if(r)throw r;return o.id}const{paymentMethod:r,error:a}=await e.createPaymentMethod({elements:t});if(a)throw a;return r.id}(r,a,u)}catch(e){return i(e.message)}try{const t=await Ne.placeOrder({...je(s,p,u,c),extensions:(0,o.applyFilters)("wcpay.express-checkout.cart-place-order-extension-data",{})});if("success"!==t.payment_result.payment_status)return i(Se(t.message??t.payment_result?.payment_details.find(e=>"errorMessage"===e.key)?.value??""));let r=t.payment_result.redirect_url;if(!r){const e=t.payment_result.payment_details?.find(e=>"redirect"===e.key);r=e?.value||""}const a=e.confirmIntent(r);n(!0===a?r:await a)}catch(e){return e.json&&(e=await Promise.resolve(e.json())),i(Se(e.message||e.payment_result?.payment_details.find(e=>"errorMessage"===e.key)?.value||(0,t.__)("There was a problem processing the order.","woocommerce-payments")))}})(n,i,Ve,s.completePayment,s.abortPayment,e,d);s.abortPayment(r)}),h.on("cancel",()=>{"product"===le("button_context")&&a.finally(()=>{$e().emptyCart()}),Be&&(e=>{const t=le("button_context"),o=le("has_block");var r;["cart","checkout"].includes(t)&&(o?wc?.blocksCheckout?.extensionCartUpdate({namespace:"woopayments/express-checkout/refresh-ui",data:{}}):(r=e.country,["CA","GB"].includes(r)||(e=>{const t=le("button_context"),o=(r=e,{first_name:r?.recipient?.split(" ")?.slice(0,1)?.join(" ")??"",last_name:r?.recipient?.split(" ")?.slice(1)?.join(" ")??"",company:"",address_1:r?.addressLine?.[0]??"",address_2:r?.addressLine?.[1]??"",city:r?.city??"",state:r?.state??"",country:r?.country??"",postcode:r?.postal_code??""});var r;const a=["country","state","city","postcode"];"cart"===t?(a.forEach(e=>{o[e]&&xe("form.woocommerce-shipping-calculator",`calc_shipping_${e}`,o[e])}),document.querySelector('form.woocommerce-shipping-calculator [name="calc_shipping"]')?.click()):"checkout"===t&&a.forEach(e=>{o[e]&&xe("form.woocommerce-checkout",`billing_${e}`,o[e])})})(e)))})(Be),Be=null,Oe()}),h.on("ready",e=>{(async function({availablePaymentMethods:e}){e&&(({paymentMethods:e,source:t})=>{const o={googlePay:Ie,applePay:Te};for(const r of e){const e=o[r];e&&e({source:t})}})({paymentMethods:Object.entries(e).filter(([e,t])=>t).map(([e,t])=>e),source:le("button_context")})})(e),e?.availablePaymentMethods&&Object.values(e.availablePaymentMethods).filter(Boolean).length&&(se.showContainer(),se.getButtonSeparator().show())})},init:async()=>{if((0,o.removeAction)("wcpay.express-checkout.update-button-data","automattic/wcpay/express-checkout"),"product"===le("button_context")&&"bundle"===le("product")?.product_type&&(wcpayExpressCheckoutParams.product=void 0),!le("product")&&!Qe)try{Qe=await Ue()}catch(e){}Qe&&(wcpayExpressCheckoutParams.product=void 0);const t=De();(0,o.applyFilters)("wcpay.express-checkout.is-cart-eligible",t>0,Qe)?Qe?await s.startExpressCheckoutElement({total:t,currency:Qe.totals.currency_code.toLowerCase()}):"product"===le("button_context")&&le("product")?await s.startExpressCheckoutElement({total:t,currency:le("product")?.currency}):(se.hideContainer(),se.getButtonSeparator().hide()):(se.hideContainer(),se.getButtonSeparator().hide()),(0,o.addAction)("wcpay.express-checkout.update-button-data","automattic/wcpay/express-checkout",async()=>{if("product"===le("button_context")&&jQuery(qe()).is(".disabled"))se.unblockButton();else{e(".woocommerce-error").remove();try{se.blockButton();const e=De();Qe=await Ue(),wcpayExpressCheckoutParams.product=null,se.unblockButton();const t=De();Ve?t!==e&&t>0&&await Ve.update({amount:t}):s.init(),(0,o.applyFilters)("wcpay.express-checkout.is-cart-eligible",t>0,Qe)?(se.showContainer(),se.getButtonSeparator().show()):(se.hideContainer(),se.getButtonSeparator().hide())}catch(e){se.hideContainer()}}})}};"checkout"===le("button_context")&&"pay_for_order"!==le("button_context")||s.init(),e(document.body).on("updated_cart_totals",()=>{Qe=null,s.init()}),e(document.body).on("updated_checkout",()=>{Qe=null,s.init()})})})()})();