UNPKG

@clerk/clerk-js

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