var E="v3",h=function(r){return r===3?"v3":r},f="https://js.stripe.com",w="".concat(f,"/v3"),L=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,j=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/;var g=function(r){return L.test(r)||j.test(r)},R=function(){for(var r=document.querySelectorAll('script[src^="'.concat(f,'"]')),e=0;e<r.length;e++){var t=r[e];if(g(t.src))return t}return null},p=function(r){var e="",t=document.createElement("script");t.src="".concat(w).concat(e);var n=document.head||document.body;if(!n)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return n.appendChild(t),t},P=function(r,e){!r||!r._registerWrapper||r._registerWrapper({name:"stripe-js",version:"5.10.0",startTime:e})},a=null,c=null,l=null,T=function(r){return function(e){r(new Error("Failed to load Stripe.js",{cause:e}))}},y=function(r,e){return function(){window.Stripe?r(window.Stripe):e(new Error("Stripe.js not available"))}},x=function(r){return a!==null?a:(a=new Promise(function(e,t){if(typeof window>"u"||typeof document>"u"){e(null);return}if(window.Stripe){e(window.Stripe);return}try{var n=R();if(!(n&&r)){if(!n)n=p(r);else if(n&&l!==null&&c!==null){var o;n.removeEventListener("load",l),n.removeEventListener("error",c),(o=n.parentNode)===null||o===void 0||o.removeChild(n),n=p(r)}}l=y(e,t),c=T(t),n.addEventListener("load",l),n.addEventListener("error",c)}catch(u){t(u);return}}),a.catch(function(e){return a=null,Promise.reject(e)}))},I=function(r,e,t){if(r===null)return null;var n=e[0],o=n.match(/^pk_test/),u=h(r.version),d=E;o&&u!==d&&console.warn("Stripe.js@".concat(u," was loaded on the page, but @stripe/stripe-js@").concat("5.10.0"," expected Stripe.js@").concat(d,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var v=r.apply(void 0,e);return P(v,t),v},s,S=!1,m=function(){return s||(s=x(null).catch(function(r){return s=null,Promise.reject(r)}),s)};Promise.resolve().then(function(){return m()}).catch(function(i){S||console.warn(i)});var b=function(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];S=!0;var n=Date.now();return m().then(function(o){return I(o,e,n)})};export{b as loadStripe};
//# sourceMappingURL=index-DRRlztD0.js.map
