UNPKG

@clerk/clerk-js

Version:
1 lines 1.85 kB
"use strict";(globalThis.webpackChunk_clerk_clerk_js=globalThis.webpackChunk_clerk_clerk_js||[]).push([["553"],{823:function(e,r,n){n.d(r,{loadStripe:()=>h});var t,o="https://js.stripe.com/v3",i=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,l=function(){for(var e=document.querySelectorAll('script[src^="'.concat(o,'"]')),r=0;r<e.length;r++){var n=e[r];if(i.test(n.src))return n}return null},u=function(e){var r=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(o).concat(r);var t=document.head||document.body;if(!t)throw Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return t.appendChild(n),n},c=function(e,r){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"5.6.0",startTime:r})},a=null,d=null,s=null,p=function(e,r,n){if(null===e)return null;var t=e.apply(void 0,r);return c(t,n),t},f=!1,v=function(){return t?t:t=(null!==a?a:(a=new Promise(function(e,r){if("undefined"==typeof window||"undefined"==typeof document)return void e(null);if(window.Stripe,window.Stripe)return void e(window.Stripe);try{var n,t=l();t?t&&null!==s&&null!==d&&(t.removeEventListener("load",s),t.removeEventListener("error",d),null==(n=t.parentNode)||n.removeChild(t),t=u(null)):t=u(null),s=function(){window.Stripe?e(window.Stripe):r(Error("Stripe.js not available"))},d=function(){r(Error("Failed to load Stripe.js"))},t.addEventListener("load",s),t.addEventListener("error",d)}catch(e){r(e);return}})).catch(function(e){return a=null,Promise.reject(e)})).catch(function(e){return t=null,Promise.reject(e)})};Promise.resolve().then(function(){return v()}).catch(function(e){f||console.warn(e)});var h=function(){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];f=!0;var t=Date.now();return v().then(function(e){return p(e,r,t)})}}}]);