var e=`https://js.stripe.com/v3`,t=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,n=`loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used`,r=function(){for(var n=document.querySelectorAll(`script[src^="${e}"]`),r=0;r<n.length;r++){var i=n[r];if(t.test(i.src))return i}return null},i=function(t){var n=t&&!t.advancedFraudSignals?`?advancedFraudSignals=false`:``,r=document.createElement(`script`);r.src=`${e}${n}`;var i=document.head||document.body;if(!i)throw Error(`Expected document.body not to be null. Stripe.js requires a <body> element.`);return i.appendChild(r),r},a=function(e,t){!e||!e._registerWrapper||e._registerWrapper({name:`stripe-js`,version:`1.54.2`,startTime:t})},o=null,s=function(e){return o===null&&(o=new Promise(function(t,a){if(typeof window>`u`||typeof document>`u`){t(null);return}if(window.Stripe&&e&&console.warn(n),window.Stripe){t(window.Stripe);return}try{var o=r();o&&e?console.warn(n):o||=i(e),o.addEventListener(`load`,function(){window.Stripe?t(window.Stripe):a(Error(`Stripe.js not available`))}),o.addEventListener(`error`,function(){a(Error(`Failed to load Stripe.js`))})}catch(e){a(e);return}})),o},c=function(e,t,n){if(e===null)return null;var r=e.apply(void 0,t);return a(r,n),r},l=Promise.resolve().then(function(){return s(null)}),u=!1;l.catch(function(e){u||console.warn(e)});var d=function(){var e=[...arguments];u=!0;var t=Date.now();return l.then(function(n){return c(n,e,t)})};function f(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function p(e,t){return m(e)||f(e,t)||h(e,t)||_()}function m(e){if(Array.isArray(e))return e}function h(e,t){if(e){if(typeof e==`string`)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return g(e,t)}}function g(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function _(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var v=`https://crypto-js.stripe.com/crypto-onramp-outer.js`,y=function(){for(var e=document.querySelectorAll(`script[src^="${v}"]`),t=0;t<e.length;t++){var n=e[t];if(v===n.src)return n}return null},b=function(){var e=document.createElement(`script`);e.src=v;var t=document.head||document.body;if(!t)throw Error(`Expected document.body not to be null. Stripe Crypto requires a <body> element.`);return t.appendChild(e),e},x=function(e,t){!e||!e._registerWrapper||e._registerWrapper({name:`crypto-js`,version:`1.1.3`,startTime:t})},S=null,C=function(){return S===null&&(S=new Promise(function(e,t){if(typeof window>`u`){e(null);return}if(window.StripeOnramp){e(window.StripeOnramp);return}try{var n=y();n||=b(),n.addEventListener(`load`,function(){window.StripeOnramp?e(window.StripeOnramp):t(Error(`StripeOnramp not available`))}),n.addEventListener(`error`,function(){t(Error(`Failed to load StripeOnramp`))})}catch(e){t(e);return}})),S},w=function(e,t,n){if(e===null)return null;var r=e.apply(void 0,t);return x(r,n),r},T=`https://js.stripe.com/crypto-onramp/v1/crypto-onramp.js`,E=function(){for(var e=document.querySelectorAll(`script[src^="${T}"]`),t=0;t<e.length;t++){var n=e[t];if(T===n.src)return n}return null},D=function(){var e=document.createElement(`script`);e.src=T,e.async=!0,e.type=`module`;var t=document.head||document.body;if(!t)throw Error(`Expected document.body not to be null. loadCryptoOnrampAndInitialize requires a <body> element.`);return t.appendChild(e),e},O=null,k=function(){return O===null&&(O=new Promise(function(e,t){if(typeof window>`u`){e(null);return}if(window.loadCryptoOnrampAndInitialize){e(window.loadCryptoOnrampAndInitialize);return}try{var n=E();n||=D(),n.addEventListener(`load`,function(){window.loadCryptoOnrampAndInitialize?e(window.loadCryptoOnrampAndInitialize):t(Error(`loadCryptoOnrampAndInitialize not available`))}),n.addEventListener(`error`,function(){t(Error(`Failed to load loadCryptoOnrampAndInitialize`))})}catch(e){t(e);return}})),O},A=function(e,t){return k().then(function(n){return n===null?null:n(e,t)})},j=Promise.resolve().then(function(){return C()}),M=!1;j.catch(function(e){M||console.warn(e)});var N=function(){var e=[...arguments];M=!0;var t=Date.now();return Promise.all([d.apply(void 0,e),j]).then(function(n){var r=p(n,2)[1];return w(r,e,t)})},P=function(e){return j.then(function(t){return t===null?null:t.Standalone(e).getUrl()}).catch(function(){return null})};export{P as getStandaloneOnrampUrl,A as loadCryptoOnrampAndInitialize,N as loadStripeOnramp};