"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5021],{75021:function(e,t,n){n.d(t,{ch:function(){return P},Vv:function(){return L}});var r,o,a,i=n(67294);!function(e){e.INITIAL="initial",e.PENDING="pending",e.REJECTED="rejected",e.RESOLVED="resolved"}(r||(r={})),function(e){e.LOADING_STATUS="setLoadingStatus",e.RESET_OPTIONS="resetOptions",e.SET_BRAINTREE_INSTANCE="braintreeInstance"}(o||(o={})),function(e){e.NUMBER="number",e.CVV="cvv",e.EXPIRATION_DATE="expirationDate",e.EXPIRATION_MONTH="expirationMonth",e.EXPIRATION_YEAR="expirationYear",e.POSTAL_CODE="postalCode"}(a||(a={}));var c="data-react-paypal-script-id",u="data-sdk-integration-source",s="react-paypal-js",l="data-namespace",d="Failed to load the PayPal JS SDK script.",f="3.84.0",p=("https://js.braintreegateway.com/web/".concat(f,"/js/client.min.js"),"https://js.braintreegateway.com/web/".concat(f,"/js/paypal-checkout.min.js"),"paypal"),v=function(){return(v=Object.assign||function(e){for(var t,n=1,r=arguments.length;n because window.").concat(i,".").concat(c," is undefined.");if(!o.includes(n)){var s=[o,n].filter(Boolean).join();u+="\nTo fix the issue, add '".concat(n,"' to the list of components passed to the parent PayPalScriptProvider:")+"\n``.")}return u}function N(e){return"react-paypal-js-".concat(function(e){for(var t="",n=0;n component. Failed to initialize: ".concat(t))}))}return!1===N.current.isEligible()?(C(!1),j):p.current?(N.current.render(p.current).catch((function(e){null!==p.current&&0!==p.current.children.length&&k((function(){throw new Error("Failed to render component. ".concat(e))}))})),j):j}),m(m([g],u,!0),[s.fundingSource],!1)),(0,i.useEffect)((function(){null!==I&&(!0===o?I.disable().catch((function(){})):I.enable().catch((function(){})))}),[o,I]),i.createElement(i.Fragment,null,T?i.createElement("div",{ref:p,style:d,className:f}):a)};function R(e){var t="https://www.paypal.com/sdk/js";e.sdkBaseURL&&(t=e.sdkBaseURL,delete e.sdkBaseURL),function(e){var t=e["merchant-id"],n=e["data-merchant-id"],r="",o="";Array.isArray(t)?t.length>1?(r="*",o=t.toString()):r=t.toString():"string"===typeof t&&t.length>0?r=t:"string"===typeof n&&n.length>0&&(r="*",o=n);e["merchant-id"]=r,e["data-merchant-id"]=o}(e);var n=Object.keys(e).filter((function(t){return"undefined"!==typeof e[t]&&null!==e[t]&&""!==e[t]})).reduce((function(t,n){var r=e[n].toString();return"data-"===n.substring(0,5)?t.dataAttributes[n]=r:t.queryParams[n]=r,t}),{queryParams:{},dataAttributes:{}}),r=n.queryParams,o=n.dataAttributes;return{url:"".concat(t,"?").concat(I(r)),dataAttributes:o}}function I(e){var t="";return Object.keys(e).forEach((function(n){0!==t.length&&(t+="&"),t+=n+"="+e[n]})),t}function A(e,t){void 0===t&&(t={});var n=document.createElement("script");return n.src=e,Object.keys(t).forEach((function(e){n.setAttribute(e,t[e]),"data-csp-nonce"===e&&n.setAttribute("nonce",t["data-csp-nonce"])})),n}function O(e,t){if(void 0===t&&(t=C()),j(e,t),"undefined"===typeof window)return t.resolve(null);var n=R(e),r=n.url,o=n.dataAttributes,a=o["data-namespace"]||"paypal",i=k(a);return function(e,t){var n=document.querySelector('script[src="'.concat(e,'"]'));if(null===n)return null;var r=A(e,t),o=n.cloneNode();if(delete o.dataset.uidAuto,Object.keys(o.dataset).length!==Object.keys(r.dataset).length)return null;var a=!0;return Object.keys(o.dataset).forEach((function(e){o.dataset[e]!==r.dataset[e]&&(a=!1)})),a?n:null}(r,o)&&i?t.resolve(i):T({url:r,attributes:o},t).then((function(){var e=k(a);if(e)return e;throw new Error("The window.".concat(a," global variable is not available."))}))}function T(e,t){void 0===t&&(t=C()),j(e,t);var n=e.url,r=e.attributes;if("string"!==typeof n||0===n.length)throw new Error("Invalid url.");if("undefined"!==typeof r&&"object"!==typeof r)throw new Error("Expected attributes to be an object.");return new t((function(e,t){if("undefined"===typeof window)return e();!function(e){var t=e.url,n=e.attributes,r=e.onSuccess,o=e.onError,a=A(t,n);a.onerror=o,a.onload=r,document.head.insertBefore(a,document.head.firstElementChild)}({url:n,attributes:r,onSuccess:function(){return e()},onError:function(){var e=new Error('The script "'.concat(n,'" failed to load.'));return window.fetch?fetch(n).then((function(n){return 200===n.status&&t(e),n.text()})).then((function(e){var n=function(e){var t=e.split("/* Original Error:")[1];return t?t.replace(/\n/g,"").replace("*/","").trim():e}(e);t(new Error(n))})).catch((function(e){t(e)})):t(e)}})}))}function C(){if("undefined"===typeof Promise)throw new Error("Promise is undefined. To resolve the issue, use a Promise polyfill.");return Promise}function k(e){return window[e]}function j(e,t){if("object"!==typeof e||null===e)throw new Error("Expected an options object.");if("undefined"!==typeof t&&"function"!==typeof t)throw new Error("Expected PromisePonyfill to be a function.")}P.displayName="PayPalButtons";var D=function(e){var t=e.className,n=void 0===t?"":t,r=e.children,o=h(e,["className","children"]),a=S()[0],c=a.isResolved,u=a.options,s=(0,i.useRef)(null),d=(0,i.useState)(!0),f=d[0],p=d[1],m=(0,i.useState)(null)[1];return(0,i.useEffect)((function(){if(!1!==c){var e=y(u[l]);if(void 0===e||void 0===e.Marks)return m((function(){throw new Error(E({reactComponentName:D.displayName,sdkComponentKey:"marks",sdkRequestedComponents:u.components,sdkDataNamespace:u[l]}))}));!function(e){var t=s.current;if(!t||!e.isEligible())return p(!1);t.firstChild&&t.removeChild(t.firstChild),e.render(t).catch((function(e){null!==t&&0!==t.children.length&&m((function(){throw new Error("Failed to render component. ".concat(e))}))}))}(e.Marks(v({},o)))}}),[c,o.fundingSource]),i.createElement(i.Fragment,null,f?i.createElement("div",{ref:s,className:n}):r)};D.displayName="PayPalMarks";var _=function(e){var t=e.className,n=void 0===t?"":t,r=e.forceReRender,o=void 0===r?[]:r,a=h(e,["className","forceReRender"]),c=S()[0],u=c.isResolved,s=c.options,d=(0,i.useRef)(null),f=(0,i.useRef)(null),p=(0,i.useState)(null)[1];return(0,i.useEffect)((function(){if(!1!==u){var e=y(s[l]);if(void 0===e||void 0===e.Messages)return p((function(){throw new Error(E({reactComponentName:_.displayName,sdkComponentKey:"messages",sdkRequestedComponents:s.components,sdkDataNamespace:s[l]}))}));f.current=e.Messages(v({},a)),f.current.render(d.current).catch((function(e){null!==d.current&&0!==d.current.children.length&&p((function(){throw new Error("Failed to render component. ".concat(e))}))}))}}),m([u],o,!0)),i.createElement("div",{ref:d,className:n})};_.displayName="PayPalMessages";var L=function(e){var t,n=e.options,a=void 0===n?{"client-id":"test"}:n,l=e.children,f=e.deferLoading,p=void 0!==f&&f,h=(0,i.useReducer)(b,{options:v(v({},a),(t={},t[c]="".concat(N(a)),t[u]=s,t)),loadingStatus:p?r.INITIAL:r.PENDING}),m=h[0],y=h[1];return(0,i.useEffect)((function(){if(!1===p&&m.loadingStatus===r.INITIAL)return y({type:o.LOADING_STATUS,value:r.PENDING});if(m.loadingStatus===r.PENDING){var e=!0;return O(m.options).then((function(){e&&y({type:o.LOADING_STATUS,value:r.RESOLVED})})).catch((function(t){console.error("".concat(d," ").concat(t)),e&&y({type:o.LOADING_STATUS,value:r.REJECTED})})),function(){e=!1}}}),[m.options,p,m.loadingStatus]),i.createElement(g.Provider,{value:v(v({},m),{dispatch:y})},l)}}}]);