@nowramp/form 0.1.44 → 0.1.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -8,5 +8,5 @@
8
8
  }`;
9
9
  document.head.appendChild(s);
10
10
  })();
11
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),Te=require("@nowramp/sdk"),rt=require("react-dom");function dt(t,a){const[n,s]=l.useState(null),[r,m]=l.useState(!0),[d,u]=l.useState(null),o=l.useRef(null);(!o.current||o.current!==t)&&(o.current=new Te.RampApi({apiKey:"",...t}));const i=l.useCallback(async()=>{if(!t.projectId){u(new Error("projectId is required")),m(!1);return}m(!0),u(null);try{const h=await o.current.getSupported(a);s(h)}catch(h){u(h instanceof Error?h:new Error("Failed to fetch config"))}finally{m(!1)}},[t.projectId,a]);return l.useEffect(()=>{i()},[i]),{config:n,loading:r,error:d,refetch:i}}function ut(t,a){const[n,s]=l.useState(null),[r,m]=l.useState(!1),[d,u]=l.useState(null),o=l.useRef(null),i=l.useRef(""),h=`${t.apiUrl}|${t.projectId}`;(!o.current||i.current!==h)&&(o.current=new Te.RampApi({apiKey:"",...t}),i.current=h);const f=l.useRef(0);l.useEffect(()=>{const y=++f.current;if(!a||!t.projectId){s(null),m(!1);return}m(!0),u(null),o.current.getQuotes(a).then(p=>{f.current===y&&(s(p),m(!1))},p=>{f.current===y&&(u(p instanceof Error?p:new Error("Failed to fetch quotes")),s(null),m(!1))})},[t.projectId,a==null?void 0:a.fiatCurrency,a==null?void 0:a.fiatAmount,a==null?void 0:a.cryptoAmount,a==null?void 0:a.cryptoCurrency,a==null?void 0:a.network,a==null?void 0:a.paymentMethodId,a==null?void 0:a.country,a==null?void 0:a.orderType]);const C=l.useCallback(async()=>{if(!(!a||!t.projectId)){m(!0),u(null);try{const y=await o.current.getQuotes(a);s(y)}catch(y){u(y instanceof Error?y:new Error("Failed to fetch quotes"))}finally{m(!1)}}},[t.projectId,a]);return{quotes:n,loading:r,error:d,refetch:C}}function mt(t){const[a,n]=l.useState(null),[s,r]=l.useState(!1),[m,d]=l.useState(null),u=l.useRef(null),o=l.useRef(""),i=`${t.apiUrl}|${t.projectId}`;(!u.current||o.current!==i)&&(u.current=new Te.RampApi({apiKey:"",...t}),o.current=i);const h=l.useCallback(async C=>{r(!0),d(null);try{const y=await u.current.createCheckoutIntent(C);return n(y),y}catch(y){const p=y instanceof Error?y:new Error("Failed to create checkout intent");throw d(p),p}finally{r(!1)}},[]),f=l.useCallback(()=>{n(null),d(null)},[]);return{order:a,loading:s,error:m,createOrder:h,reset:f}}function pt(t,a,n){const[s,r]=l.useState(null),[m,d]=l.useState(!1),[u,o]=l.useState(null),i=l.useRef(null);i.current||(i.current=new Te.RampApi({apiKey:"",projectId:"",...t}));const h=l.useCallback(async()=>{if(a){d(!0),o(null);try{const f=await i.current.getTransaction(a);r(f)}catch(f){o(f instanceof Error?f:new Error("Failed to fetch status"))}finally{d(!1)}}},[a]);return l.useEffect(()=>{if(!a)return;const f=(n==null?void 0:n.initialDelay)??0;if(f>0){const C=setTimeout(h,f);return()=>clearTimeout(C)}h()},[h,a,n==null?void 0:n.initialDelay]),l.useEffect(()=>{if(!a||!(n!=null&&n.pollInterval)||!s||["completed","failed","cancelled","expired","refunded"].includes(s.status))return;const C=setInterval(h,n.pollInterval);return()=>clearInterval(C)},[a,n==null?void 0:n.pollInterval,s==null?void 0:s.status,h]),{status:s,loading:m,error:u,refetch:h}}function ot(t,a){if(!t)return t;const n=t.indexOf(".");if(n===-1)return t;let s=t;return s.length-n-1>a&&(s=s.slice(0,n+a+1)),s=s.replace(/0+$/,"").replace(/\.$/,""),s}const ht={step:"amount",flowType:"buy",fiatCurrency:"USD",fiatAmount:"",cryptoCurrency:"",cryptoAmount:"",network:"",paymentMethodId:"",walletAddress:"",walletError:null,selectedProvider:null,selectedQuote:null,customerId:"",email:"",country:"",errorMessage:null};function sa(t,a){switch(a.type){case"SET_STEP":return{...t,step:a.step,errorMessage:null};case"SET_FLOW_TYPE":return{...t,flowType:a.flowType,fiatAmount:"",cryptoAmount:"",paymentMethodId:"",selectedQuote:null,selectedProvider:null,errorMessage:null};case"SET_FIAT_CURRENCY":return{...t,fiatCurrency:a.currency};case"SET_FIAT_AMOUNT":return{...t,fiatAmount:a.amount};case"SET_CRYPTO_CURRENCY":return{...t,cryptoCurrency:a.currency,network:""};case"SET_CRYPTO_AMOUNT":return{...t,cryptoAmount:a.amount};case"SET_NETWORK":return{...t,network:a.network};case"SET_CRYPTO_CHAIN":return{...t,network:a.chain};case"SET_PAYMENT_METHOD":return{...t,paymentMethodId:a.methodId};case"SET_WALLET_ADDRESS":return{...t,walletAddress:a.address,walletError:null};case"SET_WALLET_ERROR":return{...t,walletError:a.message};case"SELECT_QUOTE":return{...t,selectedQuote:a.quote,selectedProvider:a.quote.gatewayId};case"SET_CUSTOMER_ID":return{...t,customerId:a.customerId};case"SET_EMAIL":return{...t,email:a.email};case"SET_COUNTRY":return{...t,country:a.country};case"SET_ERROR":return{...t,step:"error",errorMessage:a.message};case"CLEAR_ERROR":return{...t,errorMessage:null};case"RESET":return ht;default:return t}}const ft=l.createContext(null);function xt({projectId:t,apiUrl:a="https://api.nowramp.com",assetBaseUrl:n="",flowType:s="buy",customerId:r="",defaultFiatCurrency:m="USD",defaultCryptoCurrency:d="BTC",defaultNetwork:u="",defaultFiatAmount:o="",defaultCryptoAmount:i="",defaultWalletAddress:h="",defaultGateway:f,fieldLocks:C,statusPollInterval:y=5e3,onComplete:p,onError:v,children:R}){const B=l.useMemo(()=>({apiUrl:a,projectId:t}),[a,t]),S=u||(d?d.toLowerCase():""),K=s==="sell",$=K?!!i:!!o,W=(K?!!($&&d&&S):!!($&&d&&S&&h))&&f?"confirm":"amount",[c,M]=l.useReducer(sa,{...ht,step:W,flowType:s,fiatCurrency:m,cryptoCurrency:d,network:S,fiatAmount:ot(o,2),cryptoAmount:ot(i,6),walletAddress:h,customerId:r}),N=c.flowType==="sell",{config:k,loading:D,error:U}=dt(B,c.flowType);l.useEffect(()=>{var T,w,E;if(!k||!c.cryptoCurrency||c.network)return;const g=(T=k.cryptos)==null?void 0:T.find(O=>O.code===c.cryptoCurrency),j=((w=g==null?void 0:g.networks)==null?void 0:w.find(O=>O.isDefault))||((E=g==null?void 0:g.networks)==null?void 0:E[0]);j!=null&&j.id&&M({type:"SET_NETWORK",network:j.id})},[k,c.cryptoCurrency,c.network]),l.useEffect(()=>{var E,O;if(!((E=k==null?void 0:k.paymentMethods)!=null&&E.length))return;const g=c.fiatCurrency,j=k.paymentMethods;if(c.paymentMethodId&&j.some(G=>G.id===c.paymentMethodId&&G.supportedFiats.includes(g)))return;const w=j.find(P=>P.supportedFiats.includes(g)&&(P.id.includes("card")||P.id.includes("debit")))||j.find(P=>P.supportedFiats.includes(g));M({type:"SET_PAYMENT_METHOD",methodId:(w==null?void 0:w.id)||((O=j[0])==null?void 0:O.id)||""})},[k,c.fiatCurrency,c.paymentMethodId]);const F=l.useMemo(()=>{if(N){if(!c.cryptoAmount)return null;const E=parseFloat(c.cryptoAmount);return isNaN(E)||E<=0?"Enter a valid amount":null}if(!k||!c.fiatAmount)return null;const g=parseFloat(c.fiatAmount);if(isNaN(g))return null;const j=k.fiats.find(E=>E.code===c.fiatCurrency);if(!j)return null;const T=parseFloat(j.minAmount),w=parseFloat(j.maxAmount);return!isNaN(T)&&g<T?`Minimum amount is ${j.minAmount} ${c.fiatCurrency}`:!isNaN(w)&&g>w?`Maximum amount is ${j.maxAmount} ${c.fiatCurrency}`:null},[k,c.fiatAmount,c.fiatCurrency,c.cryptoAmount,N]),xe=l.useMemo(()=>{const g=N?!!c.cryptoAmount:!!c.fiatAmount;return!k||!g||!c.cryptoCurrency||!c.network||F?null:{fiatCurrency:c.fiatCurrency,...N?{cryptoAmount:c.cryptoAmount}:{fiatAmount:c.fiatAmount},cryptoCurrency:c.cryptoCurrency,network:c.network,paymentMethodId:c.paymentMethodId||void 0,country:c.country||void 0,orderType:c.flowType}},[k,c.fiatCurrency,c.fiatAmount,c.cryptoAmount,c.cryptoCurrency,c.network,c.paymentMethodId,c.country,F,N,c.flowType]),{quotes:ue,loading:ne,error:H,refetch:me}=ut(B,xe),{order:z,loading:ye,error:se,createOrder:re}=mt(B),ge=15e3,{status:X,loading:J}=pt({apiUrl:a},(z==null?void 0:z.orderId)??null,{pollInterval:y,initialDelay:ge});l.useEffect(()=>{(X==null?void 0:X.status)==="completed"&&p&&p(X)},[X==null?void 0:X.status,p]),l.useEffect(()=>{const g=U||se;g&&v&&v(g)},[U,se,v]);const q=f||(k==null?void 0:k.defaultGateway)||null,Ce=l.useRef(q);Ce.current=q;const ve=l.useRef(ue);ve.current=ue;const Ne=l.useCallback(async()=>{var j,T,w;const g=((j=c.selectedQuote)==null?void 0:j.gatewayId)||((w=(T=ve.current)==null?void 0:T.bestQuote)==null?void 0:w.gatewayId)||Ce.current;if(!g||!c.walletAddress){const E=[!g&&"gateway",!c.walletAddress&&"walletAddress"].filter(Boolean).join(", ");M({type:"SET_ERROR",message:`Missing required fields: ${E}`});return}try{await re({gateway:g,customerId:c.customerId||void 0,fiatCurrency:c.fiatCurrency,...N?{cryptoAmount:c.cryptoAmount}:{fiatAmount:c.fiatAmount},cryptoCurrency:c.cryptoCurrency,network:c.network,walletAddress:c.walletAddress,paymentMethodId:c.paymentMethodId||void 0,email:c.email||void 0,orderType:c.flowType}),M({type:"SET_STEP",step:"checkout"})}catch(E){const O=E instanceof Error?E.message:"Failed to create order";/wallet|address/i.test(O)?M({type:"SET_WALLET_ERROR",message:O.replace(/^Failed to create checkout intent:\s*/i,"")}):M({type:"SET_ERROR",message:O})}},[c,re,N]),V=l.useCallback(g=>{M({type:"SET_STEP",step:g})},[]),oe=l.useCallback(()=>{const g=["confirm","amount","quotes","wallet","checkout","processing","complete"],j=g.indexOf(c.step);j>0&&M({type:"SET_STEP",step:g[j-1]})},[c.step,N]),Ie=l.useMemo(()=>{const g=N?!!c.cryptoAmount:!!c.fiatAmount;switch(c.step){case"confirm":return!!(g&&c.cryptoCurrency&&c.network&&c.walletAddress&&!F);case"amount":return!!(g&&c.cryptoCurrency&&c.network&&!F);case"quotes":return!!c.selectedQuote;case"wallet":return!!c.walletAddress;default:return!1}},[c,F,N]),pe={apiConfig:B,assetBaseUrl:n,config:k,configLoading:D,configError:U,state:c,dispatch:M,quotes:ue,quotesLoading:ne,quotesError:H,fetchQuotes:me,order:z,orderLoading:ye,orderError:se,createOrder:Ne,orderStatus:X,orderStatusLoading:J,fieldLocks:C||null,defaultGateway:q,amountError:F,goToStep:V,goBack:oe,canProceed:Ie};return e.jsx(ft.Provider,{value:pe,children:R})}function ae(){const t=l.useContext(ft);if(!t)throw new Error("useRamp must be used within a RampProvider");return t}const Ee={ETH:{name:"Ethereum (ERC20)",shortName:"Ethereum",icon:"eth"},BSC:{name:"Binance Smart Chain (BEP20)",shortName:"Binance",icon:"bnb"},BTC:{name:"Bitcoin",icon:"btc"},SOL:{name:"Solana",icon:"sol"},MATIC:{name:"Polygon",icon:"pol"},ARB:{name:"Arbitrum",icon:"arb"},BASE:{name:"Base",icon:"base"},OPTIMISM:{name:"Optimism",icon:"op"},AVAX_C:{name:"Avalanche C-Chain",shortName:"Avalanche C",icon:"avax"},AVAX_X:{name:"Avalanche X-Chain",shortName:"Avalanche X",icon:"avax"},ADA:{name:"Cardano",icon:"ada"},DOT:{name:"Polkadot",icon:"dot"},TRON:{name:"Tron (TRC20)",shortName:"Tron",icon:"trx"},XRP:{name:"Ripple",icon:"xrp"},XLM:{name:"Stellar",icon:"xlm"},ALGO:{name:"Algorand",icon:"algo"},ATOM:{name:"Cosmos",icon:"atom"},NEAR:{name:"NEAR Protocol",shortName:"NEAR",icon:"near"},SUI:{name:"Sui",icon:"sui"},APT:{name:"Aptos",icon:"apt"},TON:{name:"Ton",icon:"ton"},FIL:{name:"Filecoin",icon:"fil"},FLOW:{name:"Flow",icon:"flow"},HBAR:{name:"Hedera Hashgraph",shortName:"Hedera",icon:"hbar"},INJ:{name:"Injective",icon:"inj"},SEI_EVM:{name:"SEI (EVM)",shortName:"SEI",icon:"sei"},ZKSYNC:{name:"zkSync",icon:"zksync"},LINEA:{name:"Linea",icon:"linea"},STARK:{name:"StarkNet",icon:"strk"},LN:{name:"Lightning",icon:"btc"},CELO:{name:"Celo",icon:"celo"},CRO:{name:"Cronos",icon:"cro"},FTM:{name:"Fantom",icon:"ftm"},GLMR:{name:"Moonbeam",icon:"glmr"},MOVR:{name:"Moonriver",icon:"movr"},KSM:{name:"Kusama",icon:"ksm"},EOS:{name:"EOS",icon:"eos"},ETC:{name:"Ethereum Classic",shortName:"ETH Classic",icon:"etc"},LTC:{name:"Litecoin",icon:"ltc"},BCH:{name:"Bitcoin Cash",shortName:"BTC Cash",icon:"bch"},DOGE:{name:"Dogecoin",icon:"doge"},BNB:{name:"Binance Chain (BEP2)",shortName:"Binance",icon:"bnb"},ONE:{name:"Harmony",icon:"one"},KLAY:{name:"Kaia",icon:"kaia"},RON:{name:"Ronin",icon:"ron"},LRC:{name:"Loopring",icon:"lrc"},ICP:{name:"Internet Computer",shortName:"ICP",icon:"icp"},EGLD:{name:"MultiversX",icon:"egld"},FLUX:{name:"Flux",icon:"flux"},KDA:{name:"Kadena",icon:"kda"},WAVES:{name:"Waves",icon:"waves"},XTZ:{name:"Tezos",icon:"xtz"},ACA:{name:"Acala",icon:"aca"},ALEO:{name:"Aleo",icon:"aleo"},ALPH:{name:"Alephium",icon:"alph"},APE:{name:"ApeChain",icon:"ape"},ASTR:{name:"Astar",icon:"astr"},AZERO:{name:"Aleph Zero",icon:"azero"},AZERO_EVM:{name:"Aleph Zero EVM",shortName:"Aleph Zero",icon:"azero"},BAJU:{name:"Bajun Network",shortName:"Bajun",icon:"baju"},BNCPOLKA:{name:"Bifrost Polkadot",shortName:"Bifrost",icon:"bnc"},BNC:{name:"Bifrost Kusama",shortName:"Bifrost",icon:"bnc"},BOBA:{name:"Boba Network",shortName:"Boba",icon:"boba"},BSX:{name:"Basilisk",icon:"bsx"},CHZ:{name:"Chiliz",icon:"chz"},VIC:{name:"Viction",icon:"vic"},CCD:{name:"Concordium",icon:"ccd"},COREUM:{name:"Coreum",icon:"coreum"},DINGO:{name:"Dingocoin",icon:"dingo"},HDX:{name:"Hydration",icon:"hdx"},PLMC:{name:"Polimec",icon:"plmc"},MNT:{name:"Mantle",icon:"mnt"},ERG:{name:"Ergo",icon:"erg"},ECLIPSE:{name:"Eclipse",icon:"eclipse"},FUEL:{name:"Fuel Ignition",shortName:"Fuel",icon:"fuel"},INK:{name:"Ink",icon:"ink"},SOPHON:{name:"Sophon",icon:"sophon"},UNICHAIN:{name:"Unichain",icon:"unichain"},WLD:{name:"Worldchain",icon:"wld"},ETHERLINK:{name:"Etherlink",icon:"etherlink"},MOB:{name:"MobileCoin",icon:"mob"},GALA:{name:"Gala",icon:"gala"},GUNZ:{name:"Gunz",icon:"gun"},HNT:{name:"Helium",icon:"hnt"},BITKUB:{name:"BitKub",icon:"kub"},IMMUTABLE_ZKEVM:{name:"Immutable-zkEVM",shortName:"Immutable",icon:"imx"},INIT:{name:"Initia",icon:"init"},INTR:{name:"Interlay",icon:"intr"},KINESIS:{name:"Kinesis",icon:"kag"},KAR:{name:"Karura",icon:"kar"},KCC:{name:"KuCoin Community Chain",shortName:"KuCoin",icon:"kcs"},KILT:{name:"KILT Spiritnet",shortName:"KILT",icon:"kilt"},KINT:{name:"Kintsugi",icon:"kint"},KMD:{name:"Komodo",icon:"kmd"},LSK:{name:"Lisk",icon:"lsk"},METIS:{name:"Metis Andromeda",shortName:"Metis",icon:"metis"},MYTH:{name:"Myth",icon:"myth"},OAS:{name:"Oasys",icon:"oas"},PEAQ_EVM:{name:"Peaq (EVM)",shortName:"Peaq",icon:"peaq"},PEN:{name:"Pendulum",icon:"pen"},PI:{name:"Pi",icon:"pi"},POLYX:{name:"Polymesh",icon:"polyx"},Q:{name:"QuantumCoin",icon:"q"},QRL:{name:"Quantum Resistant Ledger",shortName:"QRL",icon:"qrl"},QUBIC:{name:"Qubic",icon:"qubic"},RBX:{name:"ReserveBlock",icon:"rbx"},ROLLUX:{name:"Rollux",icon:"rollux"},THORCHAIN:{name:"Thorchain",icon:"rune"},S:{name:"Sonic",icon:"s"},SONIC:{name:"Sonic",icon:"s"},TERNOA:{name:"Ternoa",icon:"caps"},SX:{name:"SX Network",icon:"sol"},WAX:{name:"WAX",icon:"waxp"},XCH:{name:"Chia Chain",icon:"xch"},XPRT:{name:"Persistence",icon:"xprt"},ZETACHAIN:{name:"ZetaChain",icon:"zeta"},ZTG:{name:"Zeitgeist",icon:"ztg"},PLS:{name:"Pulsechain",icon:"pulsechain"},MEZO:{name:"Mezo",icon:"mezo"},BSV:{name:"Bitcoin SV",shortName:"BTC SV",icon:"btc"},MONAD:{name:"Monad",icon:"mon"},SUPRA:{name:"Supra",icon:"supra"},SOMI:{name:"Somnia",icon:"somi"},VERIFIEDX:{name:"VerifiedX",icon:"vfx"},MOVE:{name:"Movement",icon:"move"},FLR:{name:"Flare",icon:"flr"},ASSETHUB:{name:"Asset Hub Polkadot",shortName:"Asset Hub",icon:"dot"},BOB:{name:"BOB",icon:"btc"},GLUE:{name:"Glue",icon:"eth"},DYDX:{name:"StarkEx",icon:"stark"},OKC:{name:"OKX Chain",icon:"eth"},UNI_CHAIN:{name:"UNI",icon:"uni"},ZEC:{name:"ZCash",icon:"zec"}},yt=[{code:"BTC",name:"Bitcoin",chains:["BTC","LN"],popular:!0},{code:"ETH",name:"Ethereum",chains:["ETH","ARB","BASE","BSC","OPTIMISM","LINEA","ZKSYNC","LRC","STARK","APE","ECLIPSE","FUEL","INK","SOPHON","UNICHAIN","WLD"],popular:!0},{code:"USDC",name:"USD Coin",chains:["ETH","SOL","ARB","BASE","BSC","MATIC","OPTIMISM","AVAX_C","ALGO","APT","CELO","FLOW","HBAR","LINEA","LRC","ZKSYNC","STARK","SUI","XLM","ECLIPSE","HDX","INK","LSK","METIS","MONAD","SEI_EVM","SONIC","SOPHON","SX","UNICHAIN","APE","BNCPOLKA","GLMR","PEAQ_EVM","PLMC","RON","UNI_CHAIN","WLD","BITKUB","BOB","DYDX","ETHERLINK","GLUE","ASSETHUB"],popular:!0},{code:"USDT",name:"Tether",chains:["ETH","BSC","TRON","ARB","MATIC","AVAX_C","SOL","OPTIMISM","ZKSYNC","STARK","APT","CELO","KLAY","LRC","LSK","ECLIPSE","ETHERLINK","OKC","PEAQ_EVM","BNCPOLKA","GLMR","HDX","PLMC","VIC","ASSETHUB"],popular:!0},{code:"SOL",name:"Solana",chains:["SOL"],popular:!0},{code:"XRP",name:"Ripple",chains:["XRP"],popular:!0},{code:"ADA",name:"Cardano",chains:["ADA"],popular:!0},{code:"DOGE",name:"Dogecoin",chains:["DOGE"],popular:!0},{code:"DOT",name:"Polkadot",chains:["DOT","BSC","BNCPOLKA","GLMR","HDX","PLMC"],popular:!0},{code:"AVAX",name:"Avalanche",chains:["AVAX_C","AVAX_X","BSC"],popular:!0},{code:"LINK",name:"ChainLink",chains:["ETH","BSC"],popular:!0},{code:"LTC",name:"Litecoin",chains:["LTC"],popular:!0},{code:"AAVE",name:"Aave",chains:["ETH","BSC"],popular:!1},{code:"ACA",name:"Acala",chains:["ACA"],popular:!1},{code:"ALEO",name:"Aleo",chains:["ALEO"],popular:!1},{code:"ALGO",name:"Algorand",chains:["ALGO"],popular:!1},{code:"ALPH",name:"Alephium",chains:["ALPH"],popular:!1},{code:"APE",name:"ApeCoin",chains:["APE","ETH"],popular:!1},{code:"APT",name:"Aptos",chains:["APT"],popular:!1},{code:"ARB",name:"Arbitrum",chains:["ARB"],popular:!1},{code:"ASTR",name:"Astar",chains:["ASTR"],popular:!1},{code:"ATOM",name:"Cosmos",chains:["ATOM"],popular:!1},{code:"AUDD",name:"Novatti Australian Digital Dollar",chains:["ETH"],popular:!1},{code:"AVT",name:"Aventus",chains:["ETH"],popular:!1},{code:"AXS",name:"Axie Infinity",chains:["ETH","RON"],popular:!1},{code:"AZERO",name:"Aleph Zero",chains:["AZERO","AZERO_EVM"],popular:!1},{code:"BAJU",name:"Bajun Network",chains:["BAJU"],popular:!1},{code:"BARSIK",name:"Hasbulla's Cat",chains:["SOL"],popular:!1},{code:"BAT",name:"Basic Attention Token",chains:["ETH","BSC"],popular:!1},{code:"BCH",name:"Bitcoin Cash",chains:["BCH"],popular:!1},{code:"BNB",name:"Binance Coin",chains:["BNB","BSC"],popular:!1},{code:"BNC",name:"Bifrost Native Coin",chains:["BNC","BNCPOLKA"],popular:!1},{code:"BOBA",name:"Boba Network",chains:["BOBA","ETH"],popular:!1},{code:"BORA",name:"Bora",chains:["KLAY"],popular:!1},{code:"BRETT",name:"Brett",chains:["BASE"],popular:!1},{code:"BSX",name:"Basilisk",chains:["BSX"],popular:!1},{code:"BZR",name:"Bazaars",chains:["ETH"],popular:!1},{code:"CAGA",name:"Crypto Asset Governance Alliance",chains:["ETH"],popular:!1},{code:"CAKE",name:"PancakeSwap",chains:["BSC"],popular:!1},{code:"CAPS",name:"Caps",chains:["TERNOA"],popular:!1},{code:"CELO",name:"Celo",chains:["CELO"],popular:!1},{code:"CHZ",name:"Chiliz",chains:["CHZ","BNB","ETH"],popular:!1},{code:"C98",name:"Coin98",chains:["VIC"],popular:!1},{code:"CCD",name:"Concordium",chains:["CCD"],popular:!1},{code:"COMP",name:"Compound",chains:["ETH","BSC"],popular:!1},{code:"COREUM",name:"Coreum",chains:["COREUM","XRP"],popular:!1},{code:"CRO",name:"Cronos",chains:["CRO"],popular:!1},{code:"CUSD",name:"Celo Dollar",chains:["CELO"],popular:!1},{code:"CVC",name:"Civic",chains:["ETH"],popular:!1},{code:"DAI",name:"Dai",chains:["ETH","BASE","MATIC"],popular:!1},{code:"DINGO",name:"Dingocoin",chains:["DINGO"],popular:!1},{code:"EGLD",name:"MultiversX",chains:["EGLD"],popular:!1},{code:"EMBER",name:"Ember Sword",chains:["MNT"],popular:!1},{code:"EOS",name:"EOS",chains:["EOS"],popular:!1},{code:"ERG",name:"Ergo",chains:["ERG"],popular:!1},{code:"ETC",name:"Ethereum Classic",chains:["ETC","BSC"],popular:!1},{code:"EUR",name:"EURC",chains:["BASE"],popular:!1},{code:"EUROC",name:"Euro Coin",chains:["ETH"],popular:!1},{code:"EURQ",name:"Quantoz EURQ",chains:["ETH"],popular:!1},{code:"EURR",name:"StablR EUR",chains:["ETH"],popular:!1},{code:"EUSD",name:"Electronic USD",chains:["MOB"],popular:!1},{code:"EXIT",name:"EXIT - Designer Token",chains:["BSC"],popular:!1},{code:"FDUSD",name:"First Digital USD",chains:["SUI"],popular:!1},{code:"FIL",name:"Filecoin",chains:["FIL","BSC"],popular:!1},{code:"FLOW",name:"Flow",chains:["FLOW"],popular:!1},{code:"FLR",name:"Flare",chains:["FLR"],popular:!1},{code:"FLUX",name:"Flux",chains:["FLUX"],popular:!1},{code:"FTM",name:"Fantom",chains:["FTM","ETH","BSC"],popular:!1},{code:"GALA",name:"Gala",chains:["GALA"],popular:!1},{code:"GLMR",name:"Moonbeam",chains:["GLMR"],popular:!1},{code:"GMX",name:"GMX",chains:["ARB"],popular:!1},{code:"GNUS",name:"Genius AI",chains:["ETH"],popular:!1},{code:"GRT",name:"The Graph",chains:["ETH","ARB"],popular:!1},{code:"GUN",name:"Gunz",chains:["GUNZ"],popular:!1},{code:"HBAR",name:"Hedera",chains:["HBAR"],popular:!1},{code:"HDX",name:"HydraDX",chains:["HDX"],popular:!1},{code:"HNT",name:"Helium",chains:["HNT"],popular:!1},{code:"HTP",name:"HowToPay",chains:["BSC"],popular:!1},{code:"HVLO",name:"Hivello",chains:["SOL"],popular:!1},{code:"ICP",name:"Internet Computer",chains:["ICP"],popular:!1},{code:"IMX",name:"Immutable X",chains:["ETH"],popular:!1},{code:"INIT",name:"Initia",chains:["INIT"],popular:!1},{code:"INJ",name:"Injective",chains:["INJ"],popular:!1},{code:"INTR",name:"Interlay",chains:["INTR"],popular:!1},{code:"JAM",name:"Jam Tune.FM",chains:["HBAR"],popular:!1},{code:"KAG",name:"Silver",chains:["KINESIS"],popular:!1},{code:"KAIA",name:"Kaia",chains:["KLAY"],popular:!1},{code:"KAR",name:"Karura",chains:["KAR"],popular:!1},{code:"KAU",name:"Gold",chains:["KINESIS"],popular:!1},{code:"KCS",name:"KuCoin Token",chains:["ETH","KCC"],popular:!1},{code:"KDA",name:"Kadena",chains:["KDA"],popular:!1},{code:"KILT",name:"KILT",chains:["KILT"],popular:!1},{code:"KINT",name:"Kintsugi",chains:["KINT"],popular:!1},{code:"KLV",name:"Klever",chains:["TRON"],popular:!1},{code:"KMD",name:"Komodo",chains:["KMD"],popular:!1},{code:"KSM",name:"Kusama",chains:["KSM"],popular:!1},{code:"KUB",name:"Bitkub Coin",chains:["BITKUB"],popular:!1},{code:"LOOKS",name:"LooksRare",chains:["ETH"],popular:!1},{code:"LRC",name:"Loopring",chains:["ETH","LRC"],popular:!1},{code:"LSK",name:"Lisk",chains:["LSK"],popular:!1},{code:"MANA",name:"Decentraland",chains:["ETH"],popular:!1},{code:"MBX",name:"Marblex",chains:["IMMUTABLE_ZKEVM","KLAY"],popular:!1},{code:"MELANIA",name:"Melania",chains:["SOL"],popular:!1},{code:"METAMASKUSD",name:"Metamask USD",chains:["ETH","LINEA"],popular:!1},{code:"METIS",name:"Metis",chains:["METIS"],popular:!1},{code:"MEZOUSD",name:"MUSD",chains:["ETH","MEZO"],popular:!1},{code:"MKR",name:"Maker",chains:["ETH","BSC"],popular:!1},{code:"MNEE",name:"MNEE",chains:["BSV","ETH"],popular:!1},{code:"MNT",name:"Mantle",chains:["ETH","MNT"],popular:!1},{code:"MOB",name:"MobileCoin",chains:["MOB"],popular:!1},{code:"MON",name:"Monad",chains:["MONAD"],popular:!1},{code:"MOVE",name:"Movement",chains:["MOVE"],popular:!1},{code:"MOVR",name:"Moonriver",chains:["MOVR"],popular:!1},{code:"MYTH",name:"Myth",chains:["MYTH"],popular:!1},{code:"NEAR",name:"NEAR Protocol",chains:["NEAR","BSC"],popular:!1},{code:"NEIRO",name:"NEIRO Ethereum",chains:["ETH"],popular:!1},{code:"OAS",name:"Oasys",chains:["OAS"],popular:!1},{code:"OMG",name:"OmiseGo",chains:["ETH"],popular:!1},{code:"OMUSD",name:"Open Money USD",chains:["ETH"],popular:!1},{code:"ONE",name:"Harmony",chains:["ONE","BNB","ETH"],popular:!1},{code:"OP",name:"Optimism",chains:["OPTIMISM"],popular:!1},{code:"ORDER",name:"Orderly Network",chains:["ETH"],popular:!1},{code:"PEAQ",name:"Peaq",chains:["PEAQ_EVM"],popular:!1},{code:"PEN",name:"Pendulum",chains:["PEN"],popular:!1},{code:"PERC",name:"Perion",chains:["ETH"],popular:!1},{code:"PI",name:"Pi",chains:["PI"],popular:!1},{code:"PLMC",name:"Polimec",chains:["PLMC"],popular:!1},{code:"POL",name:"Polygon",chains:["ETH","MATIC"],popular:!1},{code:"POLYX",name:"Polymesh",chains:["POLYX"],popular:!1},{code:"PROPC",name:"Propchain",chains:["ETH"],popular:!1},{code:"PSTAKE",name:"pSTAKE Finance",chains:["ETH"],popular:!1},{code:"Q",name:"QuantumCoin",chains:["Q"],popular:!1},{code:"QRDO",name:"Qredo",chains:["ETH"],popular:!1},{code:"QRL",name:"Quantum Resistant Ledger",chains:["QRL"],popular:!1},{code:"QUBIC",name:"QUBIC",chains:["QUBIC"],popular:!1},{code:"RBX",name:"ReserveBlock",chains:["RBX"],popular:!1},{code:"REVU",name:"Revuto",chains:["ADA"],popular:!1},{code:"RITE",name:"Ritestream",chains:["BSC"],popular:!1},{code:"RLUSD",name:"Ripple USD",chains:["ETH"],popular:!1},{code:"RON",name:"Ronin",chains:["RON"],popular:!1},{code:"RUNE",name:"THORChain",chains:["THORCHAIN"],popular:!1},{code:"S",name:"Sonic",chains:["S"],popular:!1},{code:"SAND",name:"The Sandbox",chains:["ETH","BSC"],popular:!1},{code:"SEI",name:"SEI",chains:["SEI_EVM"],popular:!1},{code:"SNX",name:"Synthetix",chains:["ETH"],popular:!1},{code:"SOIL",name:"Sun Minimeal",chains:["PLS"],popular:!1},{code:"SOLO",name:"Sologenic",chains:["XRP"],popular:!1},{code:"SOMI",name:"Somnia",chains:["SOMI"],popular:!1},{code:"STRK",name:"Starknet",chains:["STARK"],popular:!1},{code:"SUI",name:"Sui",chains:["SUI"],popular:!1},{code:"SUPR",name:"SuperDapp",chains:["ROLLUX"],popular:!1},{code:"SUPRA",name:"Supra",chains:["SUPRA"],popular:!1},{code:"SUSHI",name:"SushiSwap",chains:["ETH","BSC"],popular:!1},{code:"SYS",name:"Syscoin",chains:["ROLLUX"],popular:!1},{code:"TBTC",name:"tBTC",chains:["SUI","STARK"],popular:!1},{code:"TON",name:"Toncoin",chains:["TON"],popular:!1},{code:"TRUMP",name:"TRUMP",chains:["SOL"],popular:!1},{code:"TRX",name:"Tron",chains:["TRON","BSC"],popular:!1},{code:"TWT",name:"Trust Wallet Token",chains:["BSC"],popular:!1},{code:"UNI",name:"Uniswap",chains:["ETH","BSC"],popular:!1},{code:"URANIUM",name:"Uranium",chains:["ETHERLINK"],popular:!1},{code:"USD0",name:"Usual USD",chains:["ETH"],popular:!1},{code:"USD1",name:"World Liberty Financial USD",chains:["SOL"],popular:!1},{code:"USDE",name:"Ethena USDe",chains:["ETH"],popular:!1},{code:"USDP",name:"Pax Dollar",chains:["ETH"],popular:!1},{code:"USDQ",name:"Quantoz USDQ",chains:["ETH"],popular:!1},{code:"USDR",name:"StablR USD",chains:["ETH"],popular:!1},{code:"USDT0",name:"USDT0",chains:["INK"],popular:!1},{code:"VFX",name:"VerifiedX",chains:["VERIFIEDX"],popular:!1},{code:"VERSE",name:"Verse",chains:["ETH","MATIC"],popular:!1},{code:"VIC",name:"Viction",chains:["VIC"],popular:!1},{code:"WAL",name:"Walrus",chains:["SUI"],popular:!1},{code:"WAVES",name:"Waves",chains:["WAVES"],popular:!1},{code:"WAXP",name:"WAX",chains:["WAX"],popular:!1},{code:"WBTC",name:"Wrapped Bitcoin",chains:["ETH","STARK"],popular:!1},{code:"WETH",name:"Wrapped Ether",chains:["ETHERLINK"],popular:!1},{code:"WLD",name:"Worldcoin",chains:["WLD"],popular:!1},{code:"WLFI",name:"World Liberty Financial",chains:["ETH"],popular:!1},{code:"WOLF",name:"LandWolf",chains:["ETH"],popular:!1},{code:"WOMBAT",name:"Wombat",chains:["MATIC"],popular:!1},{code:"XCH",name:"Chia",chains:["XCH"],popular:!1},{code:"XLM",name:"Stellar Lumens",chains:["XLM","BSC"],popular:!1},{code:"XPRT",name:"Persistence",chains:["XPRT"],popular:!1},{code:"XTZ",name:"Tezos",chains:["XTZ","ETHERLINK"],popular:!1},{code:"YFI",name:"yearn.finance",chains:["ETH"],popular:!1},{code:"ZBU",name:"Zeebu",chains:["BSC"],popular:!1},{code:"ZEC",name:"ZCash",chains:["ZEC"],popular:!1},{code:"ZCHF",name:"Frankencoin",chains:["ETH"],popular:!1},{code:"ZETA",name:"Zeta",chains:["ETH","ZETACHAIN"],popular:!1},{code:"ZTG",name:"Zeitgeist",chains:["ZTG"],popular:!1}],gt={AED:"ae",ALL:"al",ARS:"ar",AUD:"au",BRL:"br",CAD:"ca",CHF:"ch",CLP:"cl",CZK:"cz",DKK:"dk",EUR:"eu",GBP:"gb",HKD:"hk",IDR:"id",INR:"in",JPY:"jp",KRW:"kr",MXN:"mx",NGN:"ng",NOK:"no",NZD:"nz",PHP:"ph",PLN:"pl",QAR:"qa",SAR:"sa",SEK:"se",SGD:"sg",THB:"th",TRY:"tr",TWD:"tw",USD:"us",VND:"vn",ZAR:"za"};function _e(t,a=""){return`${a}/crypto-icons/${t.toLowerCase()}.svg`}function Ct(t,a=""){const n=gt[t]||"us";return`${a}/flags/${n}.svg`}function Ae(t){return Ee[t]||Ee[t.toUpperCase()]||Ee[t.toUpperCase().replace(/-/g,"_")]}function Re(t,a=""){const n=Ae(t);return n?`${a}/crypto-icons/${n.icon}.svg`:`${a}/crypto-icons/${t.toLowerCase()}.svg`}const He=[{code:"ALL",name:"Albania Lek"},{code:"ARS",name:"Argentina Peso"},{code:"AUD",name:"Australian Dollar"},{code:"BRL",name:"Brazilian Real"},{code:"CAD",name:"Canadian Dollar"},{code:"EUR",name:"Euro"},{code:"GBP",name:"British Pound"},{code:"JPY",name:"Japanese Yen"},{code:"USD",name:"US Dollar"},{code:"CHF",name:"Swiss Franc"},{code:"MXN",name:"Mexican Peso"},{code:"INR",name:"Indian Rupee"}],Ue=[{id:"blue",name:"Blue",accent:"#0077FF"},{id:"violet",name:"Violet",accent:"#7C3AED"},{id:"green",name:"Green",accent:"#10B981"},{id:"orange",name:"Orange",accent:"#F59E0B"},{id:"rose",name:"Rose",accent:"#F43F5E"},{id:"mono",name:"Mono",accent:null}],Fe={USDC:{USD:.9962,EUR:1.0814,GBP:1.2573,JPY:.00667,CAD:.7198,AUD:.6384,BRL:.1726,CHF:1.1306,MXN:.0487,INR:.01187,ARS:855e-6,ALL:.01058},USDT:{USD:.9958,EUR:1.081,GBP:1.2568,JPY:.00666,CAD:.7194,AUD:.638,BRL:.1724,CHF:1.1301,MXN:.0486,INR:.01186,ARS:854e-6,ALL:.01057},BTC:{USD:104e-7,EUR:1129e-8,GBP:1313e-8,JPY:696e-10,CAD:751e-8,AUD:666e-8,BRL:18e-7,CHF:118e-7,MXN:508e-9,INR:124e-9,ARS:892e-11,ALL:11e-8},ETH:{USD:316e-6,EUR:343e-6,GBP:399e-6,JPY:211e-8,CAD:228e-6,AUD:202e-6,BRL:547e-7,CHF:358e-6,MXN:154e-7,INR:376e-8,ARS:271e-9,ALL:335e-8},SOL:{USD:.00424,EUR:.004607,GBP:.005356,JPY:284e-7,CAD:.003063,AUD:.002716,BRL:734e-6,CHF:.004812,MXN:207e-6,INR:505e-7,ARS:364e-8,ALL:45e-6},XRP:{USD:.4081,EUR:.4432,GBP:.5153,JPY:.00273,CAD:.2948,AUD:.2614,BRL:.0707,CHF:.463,MXN:.01992,INR:.00486,ARS:35e-5,ALL:.00433},DOGE:{USD:3.896,EUR:4.232,GBP:4.92,JPY:.02607,CAD:2.815,AUD:2.496,BRL:.675,CHF:4.421,MXN:.1902,INR:.04641,ARS:.003345,ALL:.04134},ADA:{USD:1.333,EUR:1.448,GBP:1.683,JPY:.00892,CAD:.963,AUD:.854,BRL:.2309,CHF:1.512,MXN:.0651,INR:.01588,ARS:.001145,ALL:.01414}};function ra(t,a){var n,s;return((n=Fe[t])==null?void 0:n[a])??((s=Fe.USDC)==null?void 0:s[a])??1}function vt(t){return parseFloat(t.replace(/,/g,""))||0}function oa(t){if(t===0)return"0";if(t>=1e3)return t.toLocaleString("en-US",{maximumFractionDigits:2});if(t>=1)return t.toFixed(2);if(t>=.01)return t.toFixed(4);const a=t.toPrecision(4);return parseFloat(a).toString()}const De=t=>/^#([0-9A-Fa-f]{3}){1,2}$/.test(t),lt=10,ct=1e-4,Nt=(()=>{const t=[];for(const a of yt)for(const n of a.chains)t.push({code:a.code,name:a.name,chain:n,popular:a.popular});return t})();function Ke({ticker:t,size:a=32,baseUrl:n=""}){return e.jsx("img",{src:_e(t,n),alt:t,width:a,height:a,className:"rounded-full shrink-0",style:{width:a,height:a}})}function we({currencyCode:t,size:a=16,baseUrl:n=""}){return e.jsx("img",{src:Ct(t,n),alt:t,width:a,height:a,className:"rounded-full shrink-0",style:{width:a,height:a}})}function ke({size:t=32,color:a="#888"}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 32 32",fill:"none",children:[e.jsx("circle",{cx:"16",cy:"16",r:"16",fill:a}),e.jsx("circle",{cx:"16",cy:"16",r:"8",stroke:"white",strokeWidth:"1.5",fill:"none"})]})}function bt({size:t=24}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 32 32",fill:"none",children:[e.jsx("circle",{cx:"16",cy:"16",r:"16",fill:"#0077FF"}),e.jsx("path",{d:"M8 15l8-6 8 6H8z",fill:"white"}),e.jsx("rect",{x:"10",y:"16",width:"2",height:"6",fill:"white"}),e.jsx("rect",{x:"15",y:"16",width:"2",height:"6",fill:"white"}),e.jsx("rect",{x:"20",y:"16",width:"2",height:"6",fill:"white"}),e.jsx("rect",{x:"8",y:"22",width:"16",height:"2",rx:"0.5",fill:"white"})]})}function jt({size:t=32}){return e.jsx("div",{className:"rounded-full flex items-center justify-center text-white font-semibold shrink-0",style:{width:t,height:t,backgroundColor:"#333",fontSize:t*.45},children:"R"})}function St({size:t=32}){return e.jsx("div",{className:"rounded-full bg-black border border-white/20 flex items-center justify-center text-white shrink-0",style:{width:t,height:t,fontSize:t*.3},children:e.jsx("span",{style:{fontFamily:"-apple-system, system-ui, sans-serif",fontWeight:600},children:"Pay"})})}function Et({size:t=32}){return e.jsxs("div",{className:"rounded-full bg-white flex items-center justify-center shrink-0",style:{width:t,height:t,fontSize:t*.28,fontWeight:700,color:"#333"},children:["G",e.jsx("span",{style:{color:"#4285F4",fontSize:t*.2},children:"Pay"})]})}function At({size:t=32}){return e.jsx("div",{className:"rounded-full flex items-center justify-center shrink-0",style:{width:t,height:t,background:"#003087"},children:e.jsx("span",{className:"text-white font-bold",style:{fontSize:t*.38},children:"P"})})}function Rt({size:t=32}){return e.jsx("div",{className:"rounded-full flex items-center justify-center shrink-0",style:{width:t,height:t,background:"var(--t-card-icon-bg)"},children:e.jsxs("svg",{width:t*.55,height:t*.55,viewBox:"0 0 18 14",fill:"none",children:[e.jsx("rect",{x:"0.5",y:"0.5",width:"17",height:"13",rx:"2",stroke:"var(--t-card-icon-stroke)"}),e.jsx("rect",{y:"3",width:"18",height:"3",fill:"var(--t-card-icon-stroke)"})]})})}function la({size:t=18}){return e.jsx("div",{className:"rounded-full bg-white flex items-center justify-center shrink-0",style:{width:t,height:t},children:e.jsx("span",{className:"text-black font-bold",style:{fontSize:t*.55},children:"C"})})}function ie(){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"var(--t-text-secondary)",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function wt(){return e.jsx("svg",{width:"8",height:"14",viewBox:"0 0 8 14",fill:"none",children:e.jsx("path",{d:"M1 1L7 7L1 13",stroke:"var(--t-icon-stroke)",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Tt({onClick:t}){return e.jsx("button",{onClick:t,className:"hover:opacity-70 transition-opacity",children:e.jsx("svg",{width:"24",height:"16",viewBox:"0 0 24 16",fill:"none",children:e.jsx("path",{d:"M4 0.799805H20C21.7673 0.799805 23.2002 2.23269 23.2002 4V12C23.2002 13.7673 21.7673 15.2002 20 15.2002H4C2.23269 15.2002 0.799805 13.7673 0.799805 12V4C0.799805 2.23269 2.23269 0.799805 4 0.799805Z",stroke:"var(--t-icon-stroke)",strokeWidth:"1.6"})})})}function kt({size:t=40}){return e.jsx("div",{className:"rounded-full flex items-center justify-center shrink-0",style:{width:t,height:t,background:"var(--t-surface)"},children:e.jsxs("svg",{width:t*.5,height:t*.5,viewBox:"0 0 20 20",fill:"none",children:[e.jsx("circle",{cx:"10",cy:"10",r:"7.5",stroke:"var(--t-text)",strokeWidth:"1.5"}),e.jsx("path",{d:"M10 2.5A7.5 7.5 0 0 1 10 17.5",fill:"var(--t-text)"})]})})}function It(t,a=32){switch(t){case"revolut":return e.jsx(jt,{size:a});case"applepay":return e.jsx(St,{size:a});case"card":return e.jsx(Rt,{size:a});case"googlepay":return e.jsx(Et,{size:a});case"paypal":return e.jsx(At,{size:a});case"bank":return e.jsx(bt,{size:a});default:return e.jsx(ke,{size:a})}}const ca={"debit-credit-card":"card","bank-transfer":"bank","apple-pay":"applepay","google-pay":"googlepay",paypal:"paypal",revolut:"revolut"},ia={"debit-credit-card":"Card","bank-transfer":"Bank Transfer","ach-bank-transfer":"ACH","apple-pay":"Apple Pay","google-pay":"Google Pay","payid-bank-transfer":"PayID",paypal:"PayPal",revolut:"Revolut"};function Lt(t,a){return ia[t]||a}function Mt(t,a,n=24){const s=ca[t];return s?It(s,n):a?e.jsx("img",{src:a,alt:"",width:n,height:n,style:{borderRadius:"50%"}}):e.jsx(ke,{size:n})}function Bt({methods:t,selectedId:a,onOpenModal:n,fiatCurrency:s}){const r=l.useMemo(()=>t.filter(d=>d.supportedFiats.includes(s)),[t,s]),m=r.find(d=>d.id===a)||r[0];return r.length===0?e.jsx("div",{className:"flex items-center justify-between px-[18px] pt-[12px] pb-[14px]",style:{background:"var(--t-surface)",borderBottomLeftRadius:5,borderBottomRightRadius:5},children:e.jsxs("span",{className:"text-[12px]",style:{color:"var(--t-text-muted)"},children:["No payment methods available for ",s]})}):e.jsx(e.Fragment,{children:e.jsxs("div",{role:"button",tabIndex:0,onClick:n,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&n()},className:"flex items-center justify-between w-full px-[18px] transition-colors",style:{background:"var(--t-surface)",borderBottomLeftRadius:5,borderBottomRightRadius:5,cursor:"pointer",height:42},children:[e.jsx("span",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:"Payment method"}),e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex items-center justify-center",style:{width:20,height:20},children:m&&Mt(m.id,m.icon,20)}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:m?Lt(m.id,m.name):"Select"}),e.jsx(ie,{})]})]})})}function Ot({className:t="",autoRedirect:a=!1,redirectDelay:n=3e3}){var C;const{order:s,orderStatus:r,goToStep:m,goBack:d}=ae(),[u,o]=l.useState(!1),[i,h]=l.useState(null),f=s!=null&&s.checkout.expiresAt?Date.now()>s.checkout.expiresAt:!1;if(l.useEffect(()=>{if((s==null?void 0:s.checkout.method)==="redirect"&&a&&!f){h(Math.ceil(n/1e3));const y=setTimeout(()=>{window.location.href=s.checkout.url},n),p=setInterval(()=>{h(v=>v&&v>1?v-1:null)},1e3);return()=>{clearTimeout(y),clearInterval(p)}}},[s,a,n,f]),l.useEffect(()=>{r&&(r.status==="completed"?m("complete"):["failed","cancelled","expired"].includes(r.status)&&m("error"))},[r==null?void 0:r.status,m]),!s)return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("p",{className:"text-[15px] mb-4",children:"No order found"}),e.jsx("button",{className:"font-semibold text-[14px] transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)",paddingLeft:24,paddingRight:24},onClick:d,children:"Go Back"})]});if(f)return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 text-center ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("h3",{className:"text-[18px] font-semibold mb-2",children:"Checkout expired"}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:"The session has expired. Please try again."}),e.jsx("button",{className:"w-full font-semibold text-[16px] transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)"},onClick:d,children:"Start over"})]});if(s.checkout.method==="iframe"){const y=s.checkout.url,p=((C=s.checkout.allowedFeatures)==null?void 0:C.join("; "))||"payment; camera; microphone; geolocation; clipboard-read; clipboard-write; accelerometer; gyroscope; magnetometer; fullscreen; autoplay; encrypted-media; web-share";return rt.createPortal(e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",flexDirection:"column",background:"#000"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",height:48,paddingLeft:8,paddingRight:16,background:"#111",flexShrink:0},children:e.jsxs("button",{onClick:d,style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",color:"#fff",fontSize:14,fontWeight:500,cursor:"pointer",padding:"8px 12px",borderRadius:6},children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M10 12L6 8L10 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),"Cancel"]})}),e.jsxs("div",{style:{flex:1,position:"relative",overflow:"hidden"},children:[!u&&e.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:[e.jsx("div",{className:"nramp-spinner"}),e.jsx("p",{style:{color:"#888",fontSize:14,marginTop:16},children:"Loading checkout..."})]}),e.jsx("iframe",{src:y,style:{display:u?"block":"none",width:"100%",height:"100%",border:"none"},allow:p,onLoad:()=>o(!0),title:"Provider Checkout"})]})]}),document.body)}if(s.checkout.method==="redirect")return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 text-center ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("div",{className:"text-[48px] mb-4",children:"🔗"}),e.jsx("h3",{className:"text-[18px] font-semibold mb-2",children:"Complete Payment"}),e.jsxs("p",{className:"text-[14px] mb-4",style:{color:"var(--t-text-secondary)"},children:["You'll be redirected to ",s.gateway," to complete your payment."]}),i!==null&&e.jsxs("p",{className:"text-[13px] mb-4",style:{color:"var(--t-text-muted)"},children:["Redirecting in ",i,"..."]}),e.jsxs("a",{href:s.checkout.url,className:"w-full font-semibold text-[16px] flex items-center justify-center transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)",textDecoration:"none"},target:"_blank",rel:"noopener noreferrer",children:["Continue to ",s.gateway]}),e.jsx("button",{className:"w-full font-semibold text-[14px] mt-2 transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)"},onClick:d,children:"Cancel"})]});if(s.checkout.method==="widget"&&s.widgetConfig){const y=da(s.checkout.url,s.widgetConfig);return rt.createPortal(e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",flexDirection:"column",background:"#000"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",height:48,paddingLeft:8,paddingRight:16,background:"#111",flexShrink:0},children:e.jsxs("button",{onClick:d,style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",color:"#fff",fontSize:14,fontWeight:500,cursor:"pointer",padding:"8px 12px",borderRadius:6},children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M10 12L6 8L10 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),"Cancel"]})}),e.jsxs("div",{style:{flex:1,position:"relative",overflow:"hidden"},children:[!u&&e.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:[e.jsx("div",{className:"nramp-spinner"}),e.jsx("p",{style:{color:"#888",fontSize:14,marginTop:16},children:"Loading checkout..."})]}),e.jsx("iframe",{src:y,style:{display:u?"block":"none",width:"100%",height:"100%",border:"none"},allow:"payment; camera; microphone; geolocation; clipboard-read; clipboard-write; accelerometer; gyroscope; magnetometer; fullscreen; autoplay; encrypted-media; web-share",onLoad:()=>o(!0),title:"Payment Checkout"})]})]}),document.body)}return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("p",{className:"text-[15px] mb-4",children:"Unknown checkout method"}),e.jsx("button",{className:"font-semibold text-[14px] transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)",paddingLeft:24,paddingRight:24},onClick:d,children:"Go Back"})]})}function da(t,a){const n=new URL("/en/partner/widget",t);for(const[s,r]of Object.entries(a))r!=null&&r!==""&&n.searchParams.set(s,String(r));return n.toString()}function Pt({className:t=""}){const{orderStatus:a,orderStatusLoading:n,goToStep:s}=ae();l.useEffect(()=>{a&&(a.status==="completed"?s("complete"):["failed","cancelled","expired","refunded"].includes(a.status)&&s("error"))},[a==null?void 0:a.status,s]);const r=()=>{if(!a)return"Processing your order...";switch(a.status){case"pending":return"Waiting for payment confirmation...";case"processing":return"Processing your transaction...";default:return"Processing..."}};return e.jsxs("div",{className:`flex flex-col items-center justify-center px-8 py-12 text-center ${t}`,children:[e.jsx("div",{className:"mb-6",children:e.jsx("div",{className:"nramp-spinner-large nramp-spinner"})}),e.jsx("h2",{className:"text-[20px] font-semibold mb-3",style:{color:"var(--t-text)"},children:r()}),n&&e.jsx("p",{className:"text-[13px] mb-4",style:{color:"var(--t-text-muted)"},children:"Checking status..."}),a&&e.jsxs("div",{className:"w-full mt-6 text-left",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[e.jsx(ce,{label:"Order ID",value:a.orderId,mono:!0}),e.jsx(ce,{label:"Provider",value:a.gateway}),e.jsx(ce,{label:"Amount",value:`${a.fiatAmount} ${a.fiatCurrency}`}),e.jsx(ce,{label:"Receiving",value:`${a.cryptoAmount||"..."} ${a.cryptoCurrency}`}),e.jsx(ce,{label:"Network",value:a.network}),e.jsx(ce,{label:"To Address",value:`${a.walletAddress.slice(0,10)}...${a.walletAddress.slice(-8)}`,mono:!0})]}),e.jsxs("div",{className:"mt-6",children:[e.jsx("p",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:"This usually takes a few minutes."}),e.jsx("p",{className:"text-[12px] mt-1",style:{color:"var(--t-text-muted)"},children:"You can safely close this page - we'll send you an email when complete."})]})]})}function ce({label:t,value:a,mono:n}){return e.jsxs("div",{className:"flex justify-between items-center py-2",style:{borderBottom:"1px solid var(--t-divider)"},children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:t}),e.jsx("span",{className:`text-[13px] font-medium ${n?"font-mono":""}`,style:{color:"var(--t-text)"},children:a})]})}function Dt({className:t="",explorerUrl:a,onDone:n,doneButtonText:s="Done"}){const{orderStatus:r,state:m,dispatch:d}=ae(),u=m.flowType==="sell",o=()=>{if(!(r!=null&&r.transactionHash))return null;if(!a){const f={ethereum:"https://etherscan.io/tx/{txHash}",polygon:"https://polygonscan.com/tx/{txHash}",arbitrum:"https://arbiscan.io/tx/{txHash}",optimism:"https://optimistic.etherscan.io/tx/{txHash}",base:"https://basescan.org/tx/{txHash}",bitcoin:"https://mempool.space/tx/{txHash}",solana:"https://solscan.io/tx/{txHash}",avalanche:"https://snowtrace.io/tx/{txHash}",fantom:"https://ftmscan.com/tx/{txHash}"};return(f[m.network]||f.ethereum).replace("{txHash}",r.transactionHash)}return a.replace("{txHash}",r.transactionHash)},i=()=>{n?n():d({type:"RESET"})},h=o();return e.jsxs("div",{className:`flex flex-col items-center px-8 py-12 text-center ${t}`,children:[e.jsx("div",{className:"flex items-center justify-center mb-5",style:{width:64,height:64,borderRadius:"50%",background:"var(--t-success, #10b981)"},children:e.jsx("svg",{viewBox:"0 0 24 24",width:"32",height:"32",fill:"white",children:e.jsx("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"})})}),e.jsx("h2",{className:"text-[20px] font-semibold mb-2",style:{color:"var(--t-text)"},children:u?"Sale Complete!":"Purchase Complete!"}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:u?`Your ${(r==null?void 0:r.fiatCurrency)||m.fiatCurrency} payout is being processed.`:`Your ${(r==null?void 0:r.cryptoCurrency)||m.cryptoCurrency} has been sent to your wallet.`}),r&&e.jsxs("div",{className:"w-full text-left mb-6",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[e.jsx(Z,{label:u?"Amount Sold":"Amount Received",value:`${r.cryptoAmount} ${r.cryptoCurrency}`,highlight:!0}),e.jsx(Z,{label:u?"Payout Amount":"Amount Paid",value:`${r.fiatAmount} ${r.fiatCurrency}`}),e.jsx(Z,{label:"Network",value:r.network}),e.jsx(Z,{label:"Wallet",value:`${r.walletAddress.slice(0,10)}...${r.walletAddress.slice(-8)}`,mono:!0}),r.transactionHash&&e.jsx(Z,{label:"Transaction",value:`${r.transactionHash.slice(0,10)}...${r.transactionHash.slice(-8)}`,mono:!0}),e.jsx(Z,{label:"Provider",value:r.gateway}),e.jsx(Z,{label:"Order ID",value:r.orderId,mono:!0}),r.completedAt&&e.jsx(Z,{label:"Completed",value:new Date(r.completedAt).toLocaleString()})]}),e.jsxs("div",{className:"w-full flex flex-col gap-2",children:[h&&e.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"w-full font-semibold text-[14px] flex items-center justify-center transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)",textDecoration:"none"},children:"View on Explorer"}),e.jsx("button",{className:"w-full font-semibold text-[16px] transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)"},onClick:i,children:s})]})]})}function Z({label:t,value:a,mono:n,highlight:s}){return e.jsxs("div",{className:"flex justify-between items-center py-2",style:{borderBottom:"1px solid var(--t-divider)"},children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:t}),e.jsx("span",{className:`text-[13px] font-medium ${n?"font-mono":""}`,style:{color:s?"var(--t-success, #10b981)":"var(--t-text)"},children:a})]})}function Ht({className:t="",onRetry:a,supportEmail:n="support@nowramp.com"}){const{state:s,orderStatus:r,dispatch:m,goToStep:d}=ae(),u=s.flowType==="sell",o=()=>{if(r)switch(r.status){case"failed":return"Payment Failed";case"cancelled":return"Order Cancelled";case"expired":return"Order Expired";case"refunded":return"Order Refunded";default:return"Something Went Wrong"}return"Something Went Wrong"},i=()=>{if(s.errorMessage)return s.errorMessage;if(r)switch(r.status){case"failed":return u?"Your sale could not be processed. Please try again.":"Your payment could not be processed. Please try again or use a different payment method.";case"cancelled":return u?"Your sale was cancelled. No crypto was transferred.":"Your order was cancelled. No payment was processed.";case"expired":return u?"Your order has expired. Please start a new sale.":"Your order has expired. Please start a new purchase.";case"refunded":return u?"Your crypto has been returned. The funds should appear in your wallet shortly.":"Your payment has been refunded. The funds should appear in your account within 5-10 business days.";default:return"An unexpected error occurred. Please try again."}return"An unexpected error occurred. Please try again."},h=()=>{m({type:"CLEAR_ERROR"}),a?a():(m({type:"RESET"}),d("amount"))},f=()=>{m({type:"RESET"}),d("amount")};return e.jsxs("div",{className:`flex flex-col items-center px-8 py-12 text-center ${t}`,children:[e.jsx("div",{className:"flex items-center justify-center mb-5",style:{width:64,height:64,borderRadius:"50%",background:"var(--t-error, #EF4444)"},children:e.jsx("svg",{viewBox:"0 0 24 24",width:"32",height:"32",fill:"white",children:e.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})})}),e.jsx("h2",{className:"text-[20px] font-semibold mb-2",style:{color:"var(--t-text)"},children:o()}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:i()}),r&&e.jsxs("div",{className:"w-full text-left mb-6",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[e.jsxs("div",{className:"flex justify-between items-center py-2",style:{borderBottom:"1px solid var(--t-divider)"},children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:"Order ID"}),e.jsx("span",{className:"text-[13px] font-medium font-mono",style:{color:"var(--t-text)"},children:r.orderId})]}),e.jsxs("div",{className:"flex justify-between items-center py-2",children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:"Status"}),e.jsx("span",{className:"text-[12px] font-medium px-2 py-0.5",style:{background:"rgba(239,68,68,0.15)",color:"#EF4444",borderRadius:4},children:r.gatewayStatus})]})]}),e.jsxs("div",{className:"w-full flex flex-col gap-2",children:[e.jsx("button",{className:"w-full font-semibold text-[16px] transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)"},onClick:h,children:"Try Again"}),e.jsx("button",{className:"w-full font-semibold text-[14px] transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)"},onClick:f,children:"Start Over"})]}),e.jsxs("div",{className:"mt-6",children:[e.jsxs("p",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:["Need help? Contact"," ",e.jsx("a",{href:`mailto:${n}`,className:"underline",style:{color:"var(--t-accent)"},children:n})]}),r&&e.jsxs("p",{className:"text-[12px] mt-1",style:{color:"var(--t-text-muted)"},children:["Reference: ",r.orderId]})]})]})}function it(t){return t.length<=12?t:`${t.slice(0,6)}...${t.slice(-6)}`}function Ut({className:t=""}){const{config:a,configLoading:n,state:s,defaultGateway:r,fetchQuotes:m,createOrder:d,orderLoading:u}=ae(),o=s.flowType==="sell",[i,h]=l.useState(null),f=a==null?void 0:a.gateways.find(y=>y.id===r),C=async()=>{h(null);try{m(),await d()}catch(y){const p=y instanceof Error?y.message:"Failed to create order";h(p)}};return n?e.jsxs("div",{className:`flex flex-col items-center justify-center p-12 ${t}`,children:[e.jsx("div",{className:"nramp-spinner"}),e.jsx("p",{className:"text-[14px] mt-4",style:{color:"var(--t-text-secondary)"},children:"Loading..."})]}):e.jsxs("div",{className:`flex flex-col items-center px-8 py-12 ${t}`,children:[e.jsx("h2",{className:"text-[20px] font-semibold mb-6",style:{color:"var(--t-text)"},children:o?"Confirm Sale":"Confirm Purchase"}),e.jsxs("div",{className:"w-full text-left mb-6",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[f&&e.jsxs("div",{className:"flex justify-between items-center py-2",style:{borderBottom:"1px solid var(--t-divider)"},children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:"Provider"}),e.jsxs("span",{className:"flex items-center gap-2",children:[f.logo&&e.jsx("img",{src:f.logo,alt:f.name,width:20,height:20,style:{borderRadius:4}}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:f.name})]})]}),o?e.jsxs(e.Fragment,{children:[e.jsx(te,{label:"You sell",value:`${s.cryptoAmount} ${s.cryptoCurrency}`,highlight:!0}),e.jsx(te,{label:"You receive",value:`${s.fiatCurrency} payout`})]}):e.jsxs(e.Fragment,{children:[e.jsx(te,{label:"You pay",value:`${s.fiatAmount} ${s.fiatCurrency}`,highlight:!0}),e.jsx(te,{label:"You receive",value:`${s.cryptoCurrency} on ${s.network}`}),e.jsx(te,{label:"Wallet",value:it(s.walletAddress),mono:!0})]}),e.jsx(te,{label:"Network",value:s.network}),o&&s.walletAddress&&e.jsx(te,{label:"Refund address",value:it(s.walletAddress),mono:!0})]}),i&&e.jsx("p",{className:"text-[12px] mb-4",style:{color:"#EF4444"},children:i}),e.jsx("button",{className:"w-full font-semibold text-[16px] transition-all flex items-center justify-center gap-2",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)",opacity:u?.7:1},disabled:u,onClick:C,children:u?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"nramp-spinner-inline"}),"Processing..."]}):o?"Confirm & Sell":"Confirm & Pay"})]})}function te({label:t,value:a,mono:n,highlight:s}){return e.jsxs("div",{className:"flex justify-between items-center py-2",style:{borderBottom:"1px solid var(--t-divider)"},children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:t}),e.jsx("span",{className:`text-[13px] font-medium ${n?"font-mono":""}`,style:{color:s?"var(--t-success, #10b981)":"var(--t-text)"},children:a})]})}function he({isOpen:t,onClose:a,children:n}){const[s,r]=l.useState(!1),[m,d]=l.useState(!1);l.useEffect(()=>{if(t)r(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>d(!0)));else if(s){d(!1);const o=setTimeout(()=>r(!1),250);return()=>clearTimeout(o)}},[t]);const u=l.useCallback(()=>{d(!1),setTimeout(()=>a(),250)},[a]);return l.useEffect(()=>{if(!t)return;const o=i=>{i.key==="Escape"&&u()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t,u]),s?e.jsx("div",{className:"absolute inset-0 z-20 transition-opacity duration-250",style:{opacity:m?1:0},children:e.jsx("div",{className:"absolute inset-0 flex flex-col transition-transform duration-250 ease-out",style:{background:"var(--t-modal-bg)",transform:m?"translateY(0)":"translateY(24px)"},children:typeof n=="function"?n(u):n})}):null}function Ft({char:t,height:a=38}){const n="0123456789",s=n.indexOf(t);return s===-1?e.jsx("span",{children:t}):e.jsx("span",{className:"digit-slot",style:{height:a,lineHeight:`${a}px`},children:e.jsx("span",{className:"digit-slot-inner block",style:{transform:`translateY(-${s*a}px)`},children:n.split("").map(r=>e.jsx("span",{className:"block",style:{height:a,lineHeight:`${a}px`},children:r},r))})})}function Kt({value:t,height:a=38,className:n="",style:s={}}){return e.jsx("span",{className:n,style:{display:"inline-flex",...s},children:t.split("").map((r,m)=>e.jsx(Ft,{char:r,height:a},m))})}function I({w:t,h:a,className:n=""}){return e.jsx("div",{className:`skeleton ${n}`,style:{width:t,height:a}})}function _t(){return e.jsxs("div",{className:"flex-1 px-5 flex flex-col",children:[e.jsxs("div",{className:"px-[18px] pt-[14px] pb-[18px]",style:{background:"var(--t-surface)",borderRadius:5},children:[e.jsx(I,{w:70,h:14,className:"mb-3"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(I,{w:120,h:32}),e.jsx(I,{w:75,h:32})]})]}),e.jsxs("div",{className:"px-[18px] pt-[12px] pb-[18px]",style:{background:"var(--t-surface)",borderRadius:5,marginTop:4},children:[e.jsx(I,{w:50,h:14,className:"mb-3"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(I,{w:180,h:32}),e.jsx(I,{w:85,h:32})]})]}),e.jsxs("div",{className:"flex justify-between mt-3 px-[2px]",children:[e.jsx(I,{w:140,h:12}),e.jsx(I,{w:90,h:12})]}),e.jsxs("div",{className:"mt-8",children:[e.jsx(I,{w:65,h:14,className:"mb-2.5"}),e.jsx(I,{w:"100%",h:47})]}),e.jsx("div",{className:"flex-1"}),e.jsx(I,{w:"100%",h:60,className:"mb-2"}),e.jsx("div",{className:"text-center py-3",children:e.jsx("span",{className:"text-[11px]",style:{color:"var(--t-text-tertiary)"},children:"Powered by NowRamp"})})]})}function de({onClick:t}){return e.jsx("button",{onClick:t,className:"flex items-center justify-center transition-colors rounded-full shrink-0",style:{width:30,height:30,backgroundColor:"var(--t-close-bg)"},onMouseEnter:a=>a.currentTarget.style.backgroundColor="var(--t-close-hover)",onMouseLeave:a=>a.currentTarget.style.backgroundColor="var(--t-close-bg)",children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:e.jsx("path",{d:"M1 1L9 9M9 1L1 9",stroke:"var(--t-icon-close)",strokeWidth:"1.4",strokeLinecap:"round"})})})}function fe({value:t,onChange:a,placeholder:n=""}){return e.jsxs("div",{className:"relative mx-5 mb-5",children:[e.jsx("input",{type:"text",value:t,onChange:s=>a(s.target.value),placeholder:n,style:{height:47,borderRadius:4.5,borderColor:"var(--t-border)",color:"var(--t-text)",paddingLeft:14,paddingRight:t?40:14,fontSize:14},className:"w-full bg-transparent border outline-none transition-colors"}),t&&e.jsx("button",{onClick:()=>a(""),className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center justify-center transition-colors rounded",style:{width:22,height:22,backgroundColor:"var(--t-close-bg)",borderRadius:4},children:e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",children:e.jsx("path",{d:"M1 1L7 7M7 1L1 7",stroke:"var(--t-icon-close)",strokeWidth:"1.2",strokeLinecap:"round"})})})]})}function Xt({onClose:t,onSelect:a,currencies:n,assetBaseUrl:s=""}){const[r,m]=l.useState(""),d=l.useMemo(()=>{if(!n||n.length===0)return He;const o=new Map(He.map(i=>[i.code,i.name]));return n.map(i=>({code:i.code,name:i.name||o.get(i.code)||i.code}))},[n]),u=l.useMemo(()=>{const o=r.trim().toLowerCase();return o?d.filter(i=>i.code.toLowerCase().includes(o)||i.name.toLowerCase().includes(o)):d},[d,r]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(de,{onClick:t})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)"},children:"Select fiat currency"}),e.jsx(fe,{value:r,onChange:m}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[u.map(o=>e.jsxs("button",{onClick:()=>a(o.code),className:"flex items-center gap-3.5 w-full py-3.5 transition-colors",style:{color:"var(--t-text)"},children:[e.jsx(we,{currencyCode:o.code,size:32,baseUrl:s}),e.jsxs("div",{className:"text-left",children:[e.jsx("div",{className:"font-semibold text-[15px] leading-tight",children:o.code}),e.jsx("div",{className:"text-[13px] mt-0.5",style:{color:"var(--t-text-secondary)"},children:o.name})]})]},o.code)),u.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No currencies found"})]})]})}function $t({onClose:t,onSelect:a,cryptos:n,assetBaseUrl:s=""}){const[r,m]=l.useState(""),d=l.useMemo(()=>{if(!n||n.length===0)return Nt;const o=[];for(const i of n){const h=i.networks||[];if(h.length===0)o.push({code:i.code,name:i.name||i.code,chain:i.code,popular:!1});else for(const f of h){const C=f.code||f.id||f.name||i.code;o.push({code:i.code,name:i.name||i.code,chain:C,chainName:f.name,popular:!1})}}return o},[n]),u=l.useMemo(()=>{var f;const o=r.trim().toLowerCase();if(!o)return d;const i=o.split(/\s+/),h=[];for(const C of d){const y=Ae(C.chain),p=y?y.name.toLowerCase():"",v=((f=y==null?void 0:y.shortName)==null?void 0:f.toLowerCase())||"",R=C.chain.toLowerCase(),B=C.code.toLowerCase(),S=C.name.toLowerCase(),K=[B,S,p,v,R];if(!i.every(W=>K.some(c=>c.includes(W))))continue;let _=0;B===o?_+=100:B.startsWith(i[0])&&(_+=50),C.popular&&(_+=10),i.length>1&&(p.includes(i[1])||v.includes(i[1])||R.includes(i[1]))&&(_+=25),h.push({item:C,score:_})}return h.sort((C,y)=>y.score-C.score),h.map(C=>C.item)},[d,r]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(de,{onClick:t})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)"},children:"Select crypto currency"}),e.jsx(fe,{value:r,onChange:m}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[u.map(o=>{const i=Ae(o.chain),h=(i==null?void 0:i.name)||o.chainName||o.chain;return e.jsxs("button",{onClick:()=>a(o.code,o.chain),className:"flex items-center gap-3.5 w-full py-3.5 transition-colors",children:[e.jsxs("div",{className:"relative shrink-0",style:{width:40,height:40},children:[e.jsx("img",{src:_e(o.code,s),alt:o.code,width:32,height:32,className:"rounded-full absolute top-0 left-0",style:{width:32,height:32}}),e.jsx("img",{src:Re(o.chain,s),alt:o.chain,width:16,height:16,className:"rounded-full absolute",style:{width:16,height:16,bottom:0,right:0,border:"2px solid var(--t-chain-border)"}})]}),e.jsxs("div",{className:"text-left flex-1 min-w-0",children:[e.jsx("div",{className:"font-semibold text-[15px] leading-tight",style:{color:"var(--t-text)"},children:o.code}),e.jsx("div",{className:"text-[13px] mt-0.5",style:{color:"var(--t-text-secondary)"},children:o.name})]}),e.jsx("div",{className:"text-right shrink-0",children:e.jsx("div",{className:"text-[13px]",style:{color:"var(--t-text-muted)"},children:h})})]},`${o.code}-${o.chain}`)}),u.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No currencies found"})]})]})}function ua({methods:t,selectedId:a,onSelect:n,onClose:s}){const[r,m]=l.useState(""),d=l.useMemo(()=>{const u=r.trim().toLowerCase();return u?t.filter(o=>o.id.toLowerCase().includes(u)||o.name.toLowerCase().includes(u)||o.description&&o.description.toLowerCase().includes(u)):t},[t,r]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(de,{onClick:s})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)"},children:"Choose payment method"}),e.jsx(fe,{value:r,onChange:m}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[d.map((u,o)=>{const i=u.id===a,h=Lt(u.id,u.name);return e.jsxs("button",{onClick:()=>n(u.id),className:"flex items-start gap-3.5 w-full py-4 transition-colors",style:{color:"var(--t-text)",borderBottom:o<d.length-1?"1px solid var(--t-divider, rgba(128,128,128,0.12))":"none"},children:[e.jsx("span",{className:"flex items-center justify-center shrink-0 mt-0.5",style:{width:32,height:32},children:Mt(u.id,u.icon,32)}),e.jsxs("div",{className:"text-left flex-1",children:[e.jsx("div",{className:"font-semibold text-[15px] leading-tight",style:{color:i?"var(--t-accent)":"var(--t-text)"},children:h}),u.description&&e.jsx("div",{className:"text-[13px] leading-snug mt-1",style:{color:"var(--t-text-muted)"},children:u.description})]})]},u.id)}),d.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No payment methods found"})]})]})}function Gt({checked:t,onChange:a,accentColor:n="var(--t-accent)"}){return e.jsx("button",{onClick:()=>a(!t),className:"relative shrink-0 transition-colors duration-200",style:{width:48,height:28,borderRadius:14,backgroundColor:t?n:"var(--t-border)"},children:e.jsx("div",{className:"absolute top-[3px] rounded-full bg-white shadow transition-transform duration-200",style:{width:22,height:22,transform:t?"translateX(23px)":"translateX(3px)"}})})}const ma=[{label:"Privacy policy",href:"https://nowramp.com/privacy-policy"},{label:"Terms of use",href:"https://nowramp.com/terms-and-conditions"}];function Yt({onClose:t,darkMode:a,onToggleDarkMode:n,skinId:s,onSelectSkin:r}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end items-center px-5 pt-5",children:e.jsx(de,{onClick:t})}),e.jsxs("div",{className:"px-5 flex-1 pt-6 overflow-y-auto custom-scroll",children:[e.jsx("div",{style:{borderTop:"1px solid var(--t-divider)"},children:e.jsxs("div",{className:"flex items-center justify-between w-full py-5",children:[e.jsxs("div",{className:"flex items-center gap-3.5",children:[e.jsx(kt,{size:40}),e.jsx("span",{className:"font-medium text-[15px]",style:{color:"var(--t-text)"},children:"Dark Mode"})]}),e.jsx(Gt,{checked:a,onChange:n,accentColor:"#4CD964"})]})}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}}),ma.map(m=>e.jsxs("div",{children:[e.jsxs("a",{href:m.href,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between w-full py-5 transition-colors",children:[e.jsx("span",{className:"font-medium text-[15px]",style:{color:"var(--t-text)"},children:m.label}),e.jsx(wt,{})]}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}})]},m.label))]})]})}function pa({className:t="",theme:a="dark",skinId:n="mono",accentColor:s,bgColor:r,bgImage:m,borderColor:d,borderRadius:u,showFlowToggle:o=!0,autoRedirect:i=!1,explorerUrl:h,doneButtonText:f="Done",supportEmail:C,onDone:y}){var ze,Je,qe,et,tt,at,nt,st;const{state:p,dispatch:v,config:R,configLoading:B,quotes:S,quotesLoading:K,quotesError:$,fetchQuotes:_,createOrder:W,orderLoading:c,amountError:M,fieldLocks:N,apiConfig:k,assetBaseUrl:D}=ae(),[U,F]=l.useState(a==="dark"),[xe,ue]=l.useState(n),[ne,H]=l.useState(null),[me,z]=l.useState(!1),[ye,se]=l.useState(!1),[re,ge]=l.useState(!1),[X,J]=l.useState(null),[q,Ce]=l.useState(!0),[ve,Ne]=l.useState(!1),[V,oe]=l.useState(!1),Ie=l.useRef(null),pe=l.useRef(),g=l.useRef(p.flowType);l.useEffect(()=>{F(a==="dark")},[a]),l.useEffect(()=>{const x=setTimeout(()=>Ce(!1),B?0:800);return()=>clearTimeout(x)},[B]),l.useEffect(()=>{if(g.current!==p.flowType&&!q){g.current=p.flowType,Ne(!0),z(!1),se(!1);const x=setTimeout(()=>Ne(!1),350);return()=>clearTimeout(x)}g.current=p.flowType},[p.flowType,q]);const j=p.flowType,T=j==="buy",w=p.cryptoCurrency||"BTC",E=p.fiatCurrency||"USD",O=T?p.fiatAmount:p.cryptoAmount,P=vt(O),G=(ze=S==null?void 0:S.bestQuote)!=null&&ze.exchangeRate?parseFloat(S.bestQuote.exchangeRate):null,be=l.useRef(null);G&&w&&E&&(be.current={rate:G,crypto:w,fiat:E});const Vt=l.useMemo(()=>{if(S!=null&&S.bestQuote){const x=T?S.bestQuote.cryptoAmount:S.bestQuote.fiatAmount;if(x)return x}return"0"},[S,T]),Qt=l.useMemo(()=>{var L,Q,Be;const x=G||((L=be.current)==null?void 0:L.rate),b=G?w:(Q=be.current)==null?void 0:Q.crypto,A=G?E:(Be=be.current)==null?void 0:Be.fiat;return!x||!b||!A?"":`1 ${b} ≈ ${x.toFixed(2)} ${A}`},[w,E,G]);l.useEffect(()=>{const x=p.walletAddress.trim(),b=p.network;if(!x||x.length<10){J(null),v({type:"SET_WALLET_ERROR",message:""});return}return ge(!0),J(null),clearTimeout(pe.current),pe.current=setTimeout(async()=>{var A,L,Q;try{const Oe=await(await fetch(`${k.apiUrl}/public/validate/address`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:x,...b?{network:b}:{}})})).json(),Pe=((A=Oe.data)==null?void 0:A.attributes)||Oe.data||Oe;if(Pe.isValid)J(!0),v({type:"SET_WALLET_ERROR",message:""});else{J(!1);const na=((L=Pe.errors)==null?void 0:L[0])||((Q=Pe.details)==null?void 0:Q.formatMessage)||"Invalid wallet address";v({type:"SET_WALLET_ERROR",message:na})}}catch{J(null)}finally{ge(!1)}},500),()=>clearTimeout(pe.current)},[p.walletAddress,p.network,k.apiUrl]);const Xe=!O||P===0,$e=P>0&&(T?P<lt:P<ct),Ge=!!M||$e||me&&Xe,Zt=P>0&&!M&&!$e,Le=p.walletAddress.trim().length>=10&&X!==!1&&!re,je=Zt&&Le&&!!p.cryptoCurrency&&!!p.network,zt=x=>{let b=x.target.value.replace(/[^0-9.,]/g,"");const A=T?2:6,L=b.indexOf(".");L!==-1&&b.length-L-1>A&&(b=b.slice(0,L+A+1)),v(T?{type:"SET_FIAT_AMOUNT",amount:b}:{type:"SET_CRYPTO_AMOUNT",amount:b})},Ye=x=>{x!==j&&v({type:"SET_FLOW_TYPE",flowType:x})},Jt=l.useCallback(x=>{v({type:"SET_FIAT_CURRENCY",currency:x})},[v]),qt=l.useCallback((x,b)=>{v({type:"SET_CRYPTO_CURRENCY",currency:x}),v({type:"SET_CRYPTO_CHAIN",chain:b})},[v]),ea=l.useCallback(x=>{v({type:"SET_PAYMENT_METHOD",methodId:x})},[v]),ta=()=>{je&&(oe(!0),_())};l.useEffect(()=>{var x;if(!(!V||K)){if(S!=null&&S.bestQuote)oe(!1),v({type:"SELECT_QUOTE",quote:S.bestQuote}),W().catch(()=>{});else if($)oe(!1),v({type:"SET_ERROR",message:$.message||"No quotes available"});else if(S&&!S.bestQuote){oe(!1);const b=(x=S.unavailableGateways)==null?void 0:x.map(L=>L.reason).filter(Boolean),A=b!=null&&b.length?`No providers available: ${b.join("; ")}`:"No providers available for this currency/network combination";v({type:"SET_ERROR",message:A})}}},[V,S,K,$,v,W]);const We=U?"theme-dark":"theme-light",Me=Ue.find(x=>x.id===xe)||Ue[0],aa=Me.accent===null,Ve=(s?De(s):!1)?{"--t-accent":s,"--t-cta-bg":s,"--t-cta-text":"#ffffff"}:aa?{"--t-accent":U?"#ffffff":"#111111","--t-cta-bg":U?"#ffffff":"#111111","--t-cta-text":U?"#000000":"#ffffff"}:{"--t-accent":Me.accent,"--t-cta-bg":Me.accent,"--t-cta-text":"#ffffff"},ee={};r&&De(r)?ee.backgroundColor=r:ee.backgroundColor="var(--t-bg)",m&&(ee.backgroundImage=`url(${m})`,ee.backgroundSize="cover",ee.backgroundPosition="center");const Se={};d&&De(d)&&(Se.border=`1px solid ${d}`),u&&(Se.borderRadius=u);const Qe=p.step==="checkout"?e.jsx(Ot,{autoRedirect:i}):p.step==="processing"?e.jsx(Pt,{}):p.step==="complete"?e.jsx(Dt,{explorerUrl:h,doneButtonText:f,onDone:y}):p.step==="error"?e.jsx(Ht,{supportEmail:C}):p.step==="confirm"?e.jsx(Ut,{}):null;if(Qe)return e.jsx("div",{className:`${We} relative w-full max-w-[390px] h-[640px] overflow-hidden flex flex-col select-none transition-colors duration-300 ${t}`,style:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...ee,...Ve,...Se},children:Qe});const Y=p.network,le=Y?Ae(Y):null,Ze=(le==null?void 0:le.shortName)||(le==null?void 0:le.name)||Y;return e.jsxs("div",{className:`${We} relative w-full max-w-[390px] min-h-[640px] overflow-hidden flex flex-col select-none transition-colors duration-300 ${t}`,style:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...ee,...Ve,...Se},children:[e.jsx("div",{className:`flex justify-end items-center px-5 pt-3 ${o?"pb-1":"pb-5"}`,children:e.jsx(Tt,{onClick:()=>H("settings")})}),o?e.jsxs("div",{className:"flex flex-col items-center pt-3 pb-5",children:[e.jsxs("div",{className:"flex",style:{width:165},children:[e.jsx("button",{onClick:()=>Ye("buy"),className:"flex-1 pb-2.5 text-[16px] font-medium text-center transition-colors duration-200",style:{color:j==="buy"?"var(--t-text)":"var(--t-text-secondary)"},children:"Buy"}),e.jsx("button",{onClick:()=>Ye("sell"),className:"flex-1 pb-2.5 text-[16px] font-medium text-center transition-colors duration-200",style:{color:j==="sell"?"var(--t-text)":"var(--t-text-secondary)"},children:"Sell"})]}),e.jsxs("div",{className:"relative",style:{width:165,height:1},children:[e.jsx("div",{className:"absolute inset-0",style:{background:"var(--t-divider)"}}),e.jsx("div",{className:"absolute top-0 h-full transition-all duration-300 ease-in-out",style:{width:"50%",left:j==="buy"?"0%":"50%",background:"var(--t-accent)"}})]})]}):null,q||ve||B?e.jsx(_t,{}):e.jsxs("div",{className:"flex-1 overflow-hidden px-5 flex flex-col tab-fade-in",children:[e.jsxs("div",{className:"px-[18px] pt-[14px] pb-[18px]",style:{background:"var(--t-surface)",borderRadius:5,border:me&&Ge?"1px solid #EF4444":"1px solid transparent"},children:[e.jsx("div",{className:"text-[13px] mb-2.5",style:{color:"var(--t-text-secondary)"},children:"You spend"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("input",{ref:Ie,type:"text",value:O,onChange:zt,onBlur:()=>z(!0),placeholder:T?"250":"0.01",className:"bg-transparent outline-none w-0 flex-1 mr-3",style:{color:"var(--t-text)",fontSize:24,fontWeight:600,lineHeight:"32px"},inputMode:"decimal",disabled:!!((Je=N==null?void 0:N.sourceAmount)!=null&&Je.locked)}),T?e.jsxs("button",{onClick:()=>H("fiat"),className:"flex items-center gap-1.5 shrink-0 transition-colors",style:{background:"var(--t-pill-bg)",borderRadius:4,height:32,paddingLeft:10,paddingRight:10},disabled:!!((qe=N==null?void 0:N.sourceCurrency)!=null&&qe.locked),children:[e.jsx(we,{currencyCode:E,size:16,baseUrl:D}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:E}),e.jsx(ie,{})]}):e.jsxs("div",{className:"flex flex-col items-end shrink-0",children:[e.jsxs("button",{onClick:()=>H("crypto"),className:"flex items-center gap-1.5 transition-colors",style:{background:"var(--t-pill-bg)",borderRadius:4,height:32,paddingLeft:10,paddingRight:10},disabled:!!((et=N==null?void 0:N.destinationCurrency)!=null&&et.locked),children:[e.jsx(Ke,{ticker:w,size:16,baseUrl:D}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:w}),e.jsx(ie,{})]}),Y&&e.jsxs("div",{className:"flex items-center gap-1 mt-1.5 mr-0.5",children:[e.jsx("img",{src:Re(Y,D),alt:Y,width:14,height:14,className:"rounded-full",style:{width:14,height:14}}),e.jsx("span",{className:"text-[12px]",style:{color:"var(--t-text-muted)"},children:Ze})]})]})]})]}),me&&Ge&&e.jsx("div",{className:"text-[12px] mt-1.5 px-[2px]",style:{color:"#EF4444"},children:M||(Xe?"Amount should be more than 0":T?`Minimum amount is ${lt} ${E}`:`Minimum amount is ${ct} ${w}`)}),e.jsxs("div",{className:"px-[18px] pt-[12px] pb-[14px]",style:{background:"var(--t-surface)",borderTopLeftRadius:5,borderTopRightRadius:5,borderBottomLeftRadius:0,borderBottomRightRadius:0,marginTop:4},children:[e.jsx("div",{className:"text-[13px] mb-2.5",style:{color:"var(--t-text-secondary)"},children:"You get"}),e.jsxs("div",{className:"flex items-start justify-between",children:[K?e.jsx(I,{w:180,h:32}):e.jsx(Kt,{value:P>0?Vt:"0",height:32,className:"font-semibold",style:{color:P>0?"var(--t-text)":"var(--t-text-muted)",fontSize:24}}),T?e.jsxs("div",{className:"flex flex-col items-end shrink-0",children:[e.jsxs("button",{onClick:()=>H("crypto"),className:"flex items-center gap-1.5 transition-colors",style:{background:"var(--t-pill-bg)",borderRadius:4,height:32,paddingLeft:10,paddingRight:10},disabled:!!((tt=N==null?void 0:N.destinationCurrency)!=null&&tt.locked),children:[e.jsx(Ke,{ticker:w,size:16,baseUrl:D}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:w}),e.jsx(ie,{})]}),Y&&e.jsxs("div",{className:"flex items-center gap-1 mt-1.5 mr-0.5",children:[e.jsx("img",{src:Re(Y,D),alt:Y,width:14,height:14,className:"rounded-full",style:{width:14,height:14}}),e.jsx("span",{className:"text-[12px]",style:{color:"var(--t-text-muted)"},children:Ze})]})]}):e.jsxs("button",{onClick:()=>H("fiat"),className:"flex items-center gap-1.5 shrink-0 transition-colors",style:{background:"var(--t-pill-bg)",borderRadius:4,height:32,paddingLeft:10,paddingRight:10},disabled:!!((at=N==null?void 0:N.sourceCurrency)!=null&&at.locked),children:[e.jsx(we,{currencyCode:E,size:16,baseUrl:D}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:E}),e.jsx(ie,{})]})]})]}),e.jsx("div",{className:"flex items-center justify-between mt-[2px] px-[18px] pt-[12px] pb-[14px]",style:{background:"var(--t-surface)",...(nt=R==null?void 0:R.paymentMethods)!=null&&nt.length?{}:{borderBottomLeftRadius:5,borderBottomRightRadius:5}},children:e.jsx("span",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:Qt||" "})}),(R==null?void 0:R.paymentMethods)&&R.paymentMethods.length>0&&e.jsx("div",{className:"mt-[2px]",children:e.jsx(Bt,{methods:R.paymentMethods,selectedId:p.paymentMethodId,onOpenModal:()=>H("payment"),fiatCurrency:p.fiatCurrency})}),e.jsxs("div",{className:"mt-8",children:[e.jsx("div",{className:"text-[13px] mb-2.5",style:{color:"var(--t-text-secondary)"},children:T?"Receiving wallet address":"Sending wallet address"}),e.jsx("input",{type:"text",value:p.walletAddress,onChange:x=>v({type:"SET_WALLET_ADDRESS",address:x.target.value}),onBlur:()=>se(!0),placeholder:T?"Enter your receiving address":"Enter your sending address",spellCheck:!1,autoComplete:"off",className:"w-full bg-transparent text-[13px] outline-none transition-colors",style:{border:p.walletError||ye&&!Le?"1px solid #EF4444":"1px solid var(--t-border)",borderRadius:3.5,height:47,paddingLeft:14,paddingRight:14,color:"var(--t-text)"},disabled:!!((st=N==null?void 0:N.destinationAddress)!=null&&st.locked)}),p.walletError?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"#EF4444"},children:p.walletError}):ye&&!Le&&!re?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"#EF4444"},children:"Enter a valid wallet address"}):re&&p.walletAddress.trim().length>=10?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"var(--t-text-muted)"},children:"Validating address..."}):null]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{disabled:!je||c||V,onClick:ta,className:"w-full font-semibold text-[16px] transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)",opacity:je&&!c&&!V?1:.4,cursor:je&&!c&&!V?"pointer":"not-allowed"},children:V?"Getting best price...":c?"Processing...":T?`Buy ${w}`:`Sell ${w}`}),e.jsx("div",{className:"text-center py-3",children:e.jsx("span",{className:"text-[11px]",style:{color:"var(--t-text-tertiary)"},children:"Powered by NowRamp"})})]},j),e.jsx(he,{isOpen:ne==="fiat",onClose:()=>H(null),children:x=>{var b;return e.jsx(Xt,{onClose:x,onSelect:A=>{Jt(A),x()},currencies:(b=R==null?void 0:R.fiats)==null?void 0:b.map(A=>({code:A.code,name:A.code})),assetBaseUrl:D})}}),e.jsx(he,{isOpen:ne==="crypto",onClose:()=>H(null),children:x=>{var b;return e.jsx($t,{onClose:x,onSelect:(A,L)=>{qt(A,L),x()},cryptos:(b=R==null?void 0:R.cryptos)==null?void 0:b.map(A=>{var L;return{code:A.code,name:A.code,networks:(L=A.networks)==null?void 0:L.map(Q=>({code:Q.id,name:Q.name}))}}),assetBaseUrl:D})}}),e.jsx(he,{isOpen:ne==="payment",onClose:()=>H(null),children:x=>{var b;return e.jsx(ua,{methods:((b=R==null?void 0:R.paymentMethods)==null?void 0:b.filter(A=>A.supportedFiats.includes(p.fiatCurrency)))||[],selectedId:p.paymentMethodId,onSelect:A=>{ea(A),x()},onClose:x})}}),e.jsx(he,{isOpen:ne==="settings",onClose:()=>H(null),children:x=>e.jsx(Yt,{onClose:x,darkMode:U,onToggleDarkMode:F,skinId:xe,onSelectSkin:b=>{ue(b)}})})]})}function Wt({projectId:t,apiUrl:a,assetBaseUrl:n,flowType:s,customerId:r,defaultFiatCurrency:m,defaultCryptoCurrency:d,defaultNetwork:u,defaultFiatAmount:o,defaultCryptoAmount:i,defaultWalletAddress:h,defaultGateway:f,fieldLocks:C,statusPollInterval:y,onComplete:p,onError:v,className:R,theme:B,skinId:S,accentColor:K,bgColor:$,bgImage:_,borderColor:W,borderRadius:c,showFlowToggle:M,autoRedirect:N,explorerUrl:k,doneButtonText:D,supportEmail:U,onDone:F}){return e.jsx(xt,{projectId:t,apiUrl:a,assetBaseUrl:n,flowType:s,customerId:r,defaultFiatCurrency:m,defaultCryptoCurrency:d,defaultNetwork:u,defaultFiatAmount:o,defaultCryptoAmount:i,defaultWalletAddress:h,defaultGateway:f,fieldLocks:C,statusPollInterval:y,onComplete:p,onError:v,children:e.jsx(pa,{className:R,theme:B,skinId:S,accentColor:K,bgColor:$,bgImage:_,borderColor:W,borderRadius:c,showFlowToggle:M,autoRedirect:N,explorerUrl:k,doneButtonText:D,supportEmail:U,onDone:F})})}function ha({submitButtonText:t,rateRefreshInterval:a,...n}){return e.jsx(Wt,{...n})}function fa({skin:t,active:a,onClick:n,darkMode:s,dimmed:r}){const m=t.accent===null,d=32;return e.jsxs("button",{onClick:n,className:"relative shrink-0",style:{width:d,height:d,opacity:r?.4:1,transition:"opacity 0.2s"},children:[m?e.jsxs("svg",{width:d,height:d,viewBox:"0 0 32 32",children:[e.jsx("clipPath",{id:"mono-left",children:e.jsx("rect",{x:"0",y:"0",width:"16",height:"32"})}),e.jsx("clipPath",{id:"mono-right",children:e.jsx("rect",{x:"16",y:"0",width:"16",height:"32"})}),e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:"#111111",clipPath:"url(#mono-left)"}),e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:"#ffffff",clipPath:"url(#mono-right)"}),e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:"none",stroke:s?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.1)",strokeWidth:"1"})]}):e.jsx("svg",{width:d,height:d,viewBox:"0 0 32 32",children:e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:t.accent})}),a&&!r&&e.jsx("div",{className:"absolute inset-0 rounded-full",style:{boxShadow:"0 0 0 2px var(--t-bg), 0 0 0 4px var(--t-text)"}})]})}function xa({quote:t}){return t.isBestRate?e.jsx("div",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:"Best price"}):t.isRecommended?e.jsx("div",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:"Recommended"}):t.rank&&t.rank<=3?e.jsxs("div",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:["#",t.rank]}):null}function ya({quote:t}){return t.gatewayLogo?e.jsx("img",{src:t.gatewayLogo,alt:t.gatewayName,width:36,height:36,className:"rounded-full shrink-0",style:{width:36,height:36}}):e.jsx(ke,{size:36})}function ga(){return e.jsx("div",{className:"space-y-2",children:[0,1,2].map(t=>e.jsxs("div",{className:"w-full flex items-center gap-3.5",style:{borderRadius:5,height:64,paddingLeft:16,paddingRight:16,background:"var(--t-surface)"},children:[e.jsx(I,{w:36,h:36,className:"rounded-full shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx(I,{w:90,h:14,className:"mb-1.5"}),e.jsx(I,{w:60,h:12})]}),e.jsxs("div",{className:"text-right",children:[e.jsx(I,{w:40,h:10,className:"mb-1.5"}),e.jsx(I,{w:80,h:14})]})]},t))})}function Ca({onClose:t,onSelect:a,quotes:n,quotesLoading:s,cryptoCurrency:r}){const[m,d]=l.useState(""),u=l.useMemo(()=>{if(!(n!=null&&n.quotes))return[];const o=m.trim().toLowerCase();return o?n.quotes.filter(i=>i.gatewayName.toLowerCase().includes(o)):n.quotes},[n,m]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(de,{onClick:t})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)"},children:"Choose Ramp"}),e.jsx(fe,{value:m,onChange:d}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5 space-y-2",children:[s?e.jsx(ga,{}):u.length===0?e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:n&&n.quotes.length===0?"No quotes available for this request":"No providers found"}):u.map((o,i)=>{const h=i===0,f=parseFloat(o.cryptoAmount),C=f>=1?f.toFixed(4):f.toPrecision(6);return e.jsxs("button",{onClick:()=>a(o),className:"w-full flex items-center gap-3.5 transition-colors",style:{borderRadius:h?4.5:5,height:h?63:64,paddingLeft:16,paddingRight:16,border:h?"1px solid var(--t-border)":"1px solid transparent",background:h?"transparent":"var(--t-surface)"},children:[e.jsx(ya,{quote:o}),e.jsxs("div",{className:"text-left flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-[15px]",style:{color:"var(--t-text)"},children:o.gatewayName}),e.jsx(xa,{quote:o})]}),e.jsxs("div",{className:"text-right shrink-0",children:[e.jsx("div",{className:"text-[11px]",style:{color:"var(--t-text-secondary)"},children:"You get"}),e.jsxs("div",{className:"font-medium text-[14px]",style:{color:"var(--t-text)"},children:[r," ",C]})]})]},o.gatewayId)}),!s&&(n==null?void 0:n.unavailableGateways)&&n.unavailableGateways.length>0&&e.jsx("div",{className:"pt-3",children:n.unavailableGateways.map(o=>e.jsxs("div",{className:"flex items-center justify-between py-2 text-[12px]",style:{color:"var(--t-text-muted)"},children:[e.jsx("span",{children:o.gatewayName}),e.jsx("span",{children:o.reason})]},o.gatewayId))})]})]})}exports.AnimatedDigit=Ft;exports.AnimatedNumber=Kt;exports.ApplePayIcon=St;exports.BLOCKCHAINS=Ee;exports.BankIcon=bt;exports.CRYPTO_CHAIN_COMBOS=Nt;exports.CRYPTO_CURRENCIES=yt;exports.CardIcon=Rt;exports.CheckoutForm=ha;exports.CheckoutStep=Ot;exports.ChevronDown=ie;exports.ChevronRight=wt;exports.ChooseRampModal=Ca;exports.CloseButton=de;exports.CoinifyIcon=la;exports.CompleteStep=Dt;exports.ConfirmStep=Ut;exports.CryptoCurrencyModal=$t;exports.CryptoIcon=Ke;exports.DarkModeIcon=kt;exports.ErrorStep=Ht;exports.FIAT_CURRENCIES=He;exports.FIAT_TO_COUNTRY=gt;exports.FiatCurrencyModal=Xt;exports.FiatFlag=we;exports.FormSkeleton=_t;exports.GenericCoinIcon=ke;exports.GooglePayIcon=Et;exports.MOCK_RATES=Fe;exports.MenuIcon=Tt;exports.Modal=he;exports.PayPalIcon=At;exports.PaymentMethodSelector=Bt;exports.ProcessingStep=Pt;exports.RampForm=Wt;exports.RampProvider=xt;exports.RevolutIcon=jt;exports.SKINS=Ue;exports.SearchInput=fe;exports.SettingsScreen=Yt;exports.Skeleton=I;exports.SkinSwatch=fa;exports.ToggleSwitch=Gt;exports.formatOutput=oa;exports.getChainIconUrl=Re;exports.getCryptoIconUrl=_e;exports.getFiatFlagUrl=Ct;exports.getMockRate=ra;exports.getPaymentIcon=It;exports.parseAmount=vt;exports.useCheckoutIntent=mt;exports.useQuotes=ut;exports.useRamp=ae;exports.useRampConfig=dt;exports.useTransaction=pt;
11
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),Te=require("@nowramp/sdk"),rt=require("react-dom");function dt(t,a){const[n,s]=l.useState(null),[r,m]=l.useState(!0),[d,u]=l.useState(null),o=l.useRef(null);(!o.current||o.current!==t)&&(o.current=new Te.RampApi({apiKey:"",...t}));const i=l.useCallback(async()=>{if(!t.projectId){u(new Error("projectId is required")),m(!1);return}m(!0),u(null);try{const h=await o.current.getSupported(a);s(h)}catch(h){u(h instanceof Error?h:new Error("Failed to fetch config"))}finally{m(!1)}},[t.projectId,a]);return l.useEffect(()=>{i()},[i]),{config:n,loading:r,error:d,refetch:i}}function ut(t,a){const[n,s]=l.useState(null),[r,m]=l.useState(!1),[d,u]=l.useState(null),o=l.useRef(null),i=l.useRef(""),h=`${t.apiUrl}|${t.projectId}`;(!o.current||i.current!==h)&&(o.current=new Te.RampApi({apiKey:"",...t}),i.current=h);const f=l.useRef(0);l.useEffect(()=>{const y=++f.current;if(!a||!t.projectId){s(null),m(!1);return}m(!0),u(null),o.current.getQuotes(a).then(p=>{f.current===y&&(s(p),m(!1))},p=>{f.current===y&&(u(p instanceof Error?p:new Error("Failed to fetch quotes")),s(null),m(!1))})},[t.projectId,a==null?void 0:a.fiatCurrency,a==null?void 0:a.fiatAmount,a==null?void 0:a.cryptoAmount,a==null?void 0:a.cryptoCurrency,a==null?void 0:a.network,a==null?void 0:a.paymentMethodId,a==null?void 0:a.country,a==null?void 0:a.orderType]);const C=l.useCallback(async()=>{if(!(!a||!t.projectId)){m(!0),u(null);try{const y=await o.current.getQuotes(a);s(y)}catch(y){u(y instanceof Error?y:new Error("Failed to fetch quotes"))}finally{m(!1)}}},[t.projectId,a]);return{quotes:n,loading:r,error:d,refetch:C}}function mt(t){const[a,n]=l.useState(null),[s,r]=l.useState(!1),[m,d]=l.useState(null),u=l.useRef(null),o=l.useRef(""),i=`${t.apiUrl}|${t.projectId}`;(!u.current||o.current!==i)&&(u.current=new Te.RampApi({apiKey:"",...t}),o.current=i);const h=l.useCallback(async C=>{r(!0),d(null);try{const y=await u.current.createCheckoutIntent(C);return n(y),y}catch(y){const p=y instanceof Error?y:new Error("Failed to create checkout intent");throw d(p),p}finally{r(!1)}},[]),f=l.useCallback(()=>{n(null),d(null)},[]);return{order:a,loading:s,error:m,createOrder:h,reset:f}}function pt(t,a,n){const[s,r]=l.useState(null),[m,d]=l.useState(!1),[u,o]=l.useState(null),i=l.useRef(null);i.current||(i.current=new Te.RampApi({apiKey:"",projectId:"",...t}));const h=l.useCallback(async()=>{if(a){d(!0),o(null);try{const f=await i.current.getTransaction(a);r(f)}catch(f){o(f instanceof Error?f:new Error("Failed to fetch status"))}finally{d(!1)}}},[a]);return l.useEffect(()=>{if(!a)return;const f=(n==null?void 0:n.initialDelay)??0;if(f>0){const C=setTimeout(h,f);return()=>clearTimeout(C)}h()},[h,a,n==null?void 0:n.initialDelay]),l.useEffect(()=>{if(!a||!(n!=null&&n.pollInterval)||!s||["completed","failed","cancelled","expired","refunded"].includes(s.status))return;const C=setInterval(h,n.pollInterval);return()=>clearInterval(C)},[a,n==null?void 0:n.pollInterval,s==null?void 0:s.status,h]),{status:s,loading:m,error:u,refetch:h}}function ot(t,a){if(!t)return t;const n=t.indexOf(".");if(n===-1)return t;let s=t;return s.length-n-1>a&&(s=s.slice(0,n+a+1)),s=s.replace(/0+$/,"").replace(/\.$/,""),s}const ht={step:"amount",flowType:"buy",fiatCurrency:"USD",fiatAmount:"",cryptoCurrency:"",cryptoAmount:"",network:"",paymentMethodId:"",walletAddress:"",walletError:null,selectedProvider:null,selectedQuote:null,customerId:"",email:"",country:"",errorMessage:null};function sa(t,a){switch(a.type){case"SET_STEP":return{...t,step:a.step,errorMessage:null};case"SET_FLOW_TYPE":return{...t,flowType:a.flowType,fiatAmount:"",cryptoAmount:"",paymentMethodId:"",selectedQuote:null,selectedProvider:null,errorMessage:null};case"SET_FIAT_CURRENCY":return{...t,fiatCurrency:a.currency};case"SET_FIAT_AMOUNT":return{...t,fiatAmount:a.amount};case"SET_CRYPTO_CURRENCY":return{...t,cryptoCurrency:a.currency,network:""};case"SET_CRYPTO_AMOUNT":return{...t,cryptoAmount:a.amount};case"SET_NETWORK":return{...t,network:a.network};case"SET_CRYPTO_CHAIN":return{...t,network:a.chain};case"SET_PAYMENT_METHOD":return{...t,paymentMethodId:a.methodId};case"SET_WALLET_ADDRESS":return{...t,walletAddress:a.address,walletError:null};case"SET_WALLET_ERROR":return{...t,walletError:a.message};case"SELECT_QUOTE":return{...t,selectedQuote:a.quote,selectedProvider:a.quote.gatewayId};case"SET_CUSTOMER_ID":return{...t,customerId:a.customerId};case"SET_EMAIL":return{...t,email:a.email};case"SET_COUNTRY":return{...t,country:a.country};case"SET_ERROR":return{...t,step:"error",errorMessage:a.message};case"CLEAR_ERROR":return{...t,errorMessage:null};case"RESET":return ht;default:return t}}const ft=l.createContext(null);function xt({projectId:t,apiUrl:a="https://api.nowramp.com",assetBaseUrl:n="",flowType:s="buy",customerId:r="",defaultFiatCurrency:m="USD",defaultCryptoCurrency:d="BTC",defaultNetwork:u="",defaultFiatAmount:o="",defaultCryptoAmount:i="",defaultWalletAddress:h="",defaultGateway:f,fieldLocks:C,statusPollInterval:y=5e3,onComplete:p,onError:v,children:R}){const B=l.useMemo(()=>({apiUrl:a,projectId:t}),[a,t]),j=u||(d?d.toLowerCase():""),K=s==="sell",$=K?!!i:!!o,W=(K?!!($&&d&&j):!!($&&d&&j&&h))&&f?"confirm":"amount",[c,M]=l.useReducer(sa,{...ht,step:W,flowType:s,fiatCurrency:m,cryptoCurrency:d,network:j,fiatAmount:ot(o,2),cryptoAmount:ot(i,6),walletAddress:h,customerId:r}),N=c.flowType==="sell",{config:k,loading:D,error:U}=dt(B,c.flowType);l.useEffect(()=>{var T,w,E;if(!k||!c.cryptoCurrency||c.network)return;const g=(T=k.cryptos)==null?void 0:T.find(O=>O.code===c.cryptoCurrency),S=((w=g==null?void 0:g.networks)==null?void 0:w.find(O=>O.isDefault))||((E=g==null?void 0:g.networks)==null?void 0:E[0]);S!=null&&S.id&&M({type:"SET_NETWORK",network:S.id})},[k,c.cryptoCurrency,c.network]),l.useEffect(()=>{var E,O;if(!((E=k==null?void 0:k.paymentMethods)!=null&&E.length))return;const g=c.fiatCurrency,S=k.paymentMethods;if(c.paymentMethodId&&S.some(G=>G.id===c.paymentMethodId&&G.supportedFiats.includes(g)))return;const w=S.find(P=>P.supportedFiats.includes(g)&&(P.id.includes("card")||P.id.includes("debit")))||S.find(P=>P.supportedFiats.includes(g));M({type:"SET_PAYMENT_METHOD",methodId:(w==null?void 0:w.id)||((O=S[0])==null?void 0:O.id)||""})},[k,c.fiatCurrency,c.paymentMethodId]);const F=l.useMemo(()=>{if(N){if(!c.cryptoAmount)return null;const E=parseFloat(c.cryptoAmount);return isNaN(E)||E<=0?"Enter a valid amount":null}if(!k||!c.fiatAmount)return null;const g=parseFloat(c.fiatAmount);if(isNaN(g))return null;const S=k.fiats.find(E=>E.code===c.fiatCurrency);if(!S)return null;const T=parseFloat(S.minAmount),w=parseFloat(S.maxAmount);return!isNaN(T)&&g<T?`Minimum amount is ${S.minAmount} ${c.fiatCurrency}`:!isNaN(w)&&g>w?`Maximum amount is ${S.maxAmount} ${c.fiatCurrency}`:null},[k,c.fiatAmount,c.fiatCurrency,c.cryptoAmount,N]),xe=l.useMemo(()=>{const g=N?!!c.cryptoAmount:!!c.fiatAmount;return!k||!g||!c.cryptoCurrency||!c.network||F?null:{fiatCurrency:c.fiatCurrency,...N?{cryptoAmount:c.cryptoAmount}:{fiatAmount:c.fiatAmount},cryptoCurrency:c.cryptoCurrency,network:c.network,paymentMethodId:c.paymentMethodId||void 0,country:c.country||void 0,orderType:c.flowType}},[k,c.fiatCurrency,c.fiatAmount,c.cryptoAmount,c.cryptoCurrency,c.network,c.paymentMethodId,c.country,F,N,c.flowType]),{quotes:ue,loading:ne,error:H,refetch:me}=ut(B,xe),{order:z,loading:ye,error:se,createOrder:re}=mt(B),ge=15e3,{status:X,loading:J}=pt({apiUrl:a},(z==null?void 0:z.orderId)??null,{pollInterval:y,initialDelay:ge});l.useEffect(()=>{(X==null?void 0:X.status)==="completed"&&p&&p(X)},[X==null?void 0:X.status,p]),l.useEffect(()=>{const g=U||se;g&&v&&v(g)},[U,se,v]);const q=f||(k==null?void 0:k.defaultGateway)||null,Ce=l.useRef(q);Ce.current=q;const ve=l.useRef(ue);ve.current=ue;const Ne=l.useCallback(async()=>{var S,T,w;const g=((S=c.selectedQuote)==null?void 0:S.gatewayId)||((w=(T=ve.current)==null?void 0:T.bestQuote)==null?void 0:w.gatewayId)||Ce.current;if(!g||!c.walletAddress){const E=[!g&&"gateway",!c.walletAddress&&"walletAddress"].filter(Boolean).join(", ");M({type:"SET_ERROR",message:`Missing required fields: ${E}`});return}try{await re({gateway:g,customerId:c.customerId||void 0,fiatCurrency:c.fiatCurrency,...N?{cryptoAmount:c.cryptoAmount}:{fiatAmount:c.fiatAmount},cryptoCurrency:c.cryptoCurrency,network:c.network,walletAddress:c.walletAddress,paymentMethodId:c.paymentMethodId||void 0,email:c.email||void 0,orderType:c.flowType}),M({type:"SET_STEP",step:"checkout"})}catch(E){const O=E instanceof Error?E.message:"Failed to create order";/wallet|address/i.test(O)?M({type:"SET_WALLET_ERROR",message:O.replace(/^Failed to create checkout intent:\s*/i,"")}):M({type:"SET_ERROR",message:O})}},[c,re,N]),Y=l.useCallback(g=>{M({type:"SET_STEP",step:g})},[]),oe=l.useCallback(()=>{const g=["confirm","amount","quotes","wallet","checkout","processing","complete"],S=g.indexOf(c.step);S>0&&M({type:"SET_STEP",step:g[S-1]})},[c.step,N]),Ie=l.useMemo(()=>{const g=N?!!c.cryptoAmount:!!c.fiatAmount;switch(c.step){case"confirm":return!!(g&&c.cryptoCurrency&&c.network&&c.walletAddress&&!F);case"amount":return!!(g&&c.cryptoCurrency&&c.network&&!F);case"quotes":return!!c.selectedQuote;case"wallet":return!!c.walletAddress;default:return!1}},[c,F,N]),pe={apiConfig:B,assetBaseUrl:n,config:k,configLoading:D,configError:U,state:c,dispatch:M,quotes:ue,quotesLoading:ne,quotesError:H,fetchQuotes:me,order:z,orderLoading:ye,orderError:se,createOrder:Ne,orderStatus:X,orderStatusLoading:J,fieldLocks:C||null,defaultGateway:q,amountError:F,goToStep:Y,goBack:oe,canProceed:Ie};return e.jsx(ft.Provider,{value:pe,children:R})}function ae(){const t=l.useContext(ft);if(!t)throw new Error("useRamp must be used within a RampProvider");return t}const Ee={ETH:{name:"Ethereum (ERC20)",shortName:"Ethereum",icon:"eth"},BSC:{name:"Binance Smart Chain (BEP20)",shortName:"Binance",icon:"bnb"},BTC:{name:"Bitcoin",icon:"btc"},SOL:{name:"Solana",icon:"sol"},MATIC:{name:"Polygon",icon:"pol"},ARB:{name:"Arbitrum",icon:"arb"},BASE:{name:"Base",icon:"base"},OPTIMISM:{name:"Optimism",icon:"op"},AVAX_C:{name:"Avalanche C-Chain",shortName:"Avalanche C",icon:"avax"},AVAX_X:{name:"Avalanche X-Chain",shortName:"Avalanche X",icon:"avax"},ADA:{name:"Cardano",icon:"ada"},DOT:{name:"Polkadot",icon:"dot"},TRON:{name:"Tron (TRC20)",shortName:"Tron",icon:"trx"},XRP:{name:"Ripple",icon:"xrp"},XLM:{name:"Stellar",icon:"xlm"},ALGO:{name:"Algorand",icon:"algo"},ATOM:{name:"Cosmos",icon:"atom"},NEAR:{name:"NEAR Protocol",shortName:"NEAR",icon:"near"},SUI:{name:"Sui",icon:"sui"},APT:{name:"Aptos",icon:"apt"},TON:{name:"Ton",icon:"ton"},FIL:{name:"Filecoin",icon:"fil"},FLOW:{name:"Flow",icon:"flow"},HBAR:{name:"Hedera Hashgraph",shortName:"Hedera",icon:"hbar"},INJ:{name:"Injective",icon:"inj"},SEI_EVM:{name:"SEI (EVM)",shortName:"SEI",icon:"sei"},ZKSYNC:{name:"zkSync",icon:"zksync"},LINEA:{name:"Linea",icon:"linea"},STARK:{name:"StarkNet",icon:"strk"},LN:{name:"Lightning",icon:"btc"},CELO:{name:"Celo",icon:"celo"},CRO:{name:"Cronos",icon:"cro"},FTM:{name:"Fantom",icon:"ftm"},GLMR:{name:"Moonbeam",icon:"glmr"},MOVR:{name:"Moonriver",icon:"movr"},KSM:{name:"Kusama",icon:"ksm"},EOS:{name:"EOS",icon:"eos"},ETC:{name:"Ethereum Classic",shortName:"ETH Classic",icon:"etc"},LTC:{name:"Litecoin",icon:"ltc"},BCH:{name:"Bitcoin Cash",shortName:"BTC Cash",icon:"bch"},DOGE:{name:"Dogecoin",icon:"doge"},BNB:{name:"Binance Chain (BEP2)",shortName:"Binance",icon:"bnb"},ONE:{name:"Harmony",icon:"one"},KLAY:{name:"Kaia",icon:"kaia"},RON:{name:"Ronin",icon:"ron"},LRC:{name:"Loopring",icon:"lrc"},ICP:{name:"Internet Computer",shortName:"ICP",icon:"icp"},EGLD:{name:"MultiversX",icon:"egld"},FLUX:{name:"Flux",icon:"flux"},KDA:{name:"Kadena",icon:"kda"},WAVES:{name:"Waves",icon:"waves"},XTZ:{name:"Tezos",icon:"xtz"},ACA:{name:"Acala",icon:"aca"},ALEO:{name:"Aleo",icon:"aleo"},ALPH:{name:"Alephium",icon:"alph"},APE:{name:"ApeChain",icon:"ape"},ASTR:{name:"Astar",icon:"astr"},AZERO:{name:"Aleph Zero",icon:"azero"},AZERO_EVM:{name:"Aleph Zero EVM",shortName:"Aleph Zero",icon:"azero"},BAJU:{name:"Bajun Network",shortName:"Bajun",icon:"baju"},BNCPOLKA:{name:"Bifrost Polkadot",shortName:"Bifrost",icon:"bnc"},BNC:{name:"Bifrost Kusama",shortName:"Bifrost",icon:"bnc"},BOBA:{name:"Boba Network",shortName:"Boba",icon:"boba"},BSX:{name:"Basilisk",icon:"bsx"},CHZ:{name:"Chiliz",icon:"chz"},VIC:{name:"Viction",icon:"vic"},CCD:{name:"Concordium",icon:"ccd"},COREUM:{name:"Coreum",icon:"coreum"},DINGO:{name:"Dingocoin",icon:"dingo"},HDX:{name:"Hydration",icon:"hdx"},PLMC:{name:"Polimec",icon:"plmc"},MNT:{name:"Mantle",icon:"mnt"},ERG:{name:"Ergo",icon:"erg"},ECLIPSE:{name:"Eclipse",icon:"eclipse"},FUEL:{name:"Fuel Ignition",shortName:"Fuel",icon:"fuel"},INK:{name:"Ink",icon:"ink"},SOPHON:{name:"Sophon",icon:"sophon"},UNICHAIN:{name:"Unichain",icon:"unichain"},WLD:{name:"Worldchain",icon:"wld"},ETHERLINK:{name:"Etherlink",icon:"etherlink"},MOB:{name:"MobileCoin",icon:"mob"},GALA:{name:"Gala",icon:"gala"},GUNZ:{name:"Gunz",icon:"gun"},HNT:{name:"Helium",icon:"hnt"},BITKUB:{name:"BitKub",icon:"kub"},IMMUTABLE_ZKEVM:{name:"Immutable-zkEVM",shortName:"Immutable",icon:"imx"},INIT:{name:"Initia",icon:"init"},INTR:{name:"Interlay",icon:"intr"},KINESIS:{name:"Kinesis",icon:"kag"},KAR:{name:"Karura",icon:"kar"},KCC:{name:"KuCoin Community Chain",shortName:"KuCoin",icon:"kcs"},KILT:{name:"KILT Spiritnet",shortName:"KILT",icon:"kilt"},KINT:{name:"Kintsugi",icon:"kint"},KMD:{name:"Komodo",icon:"kmd"},LSK:{name:"Lisk",icon:"lsk"},METIS:{name:"Metis Andromeda",shortName:"Metis",icon:"metis"},MYTH:{name:"Myth",icon:"myth"},OAS:{name:"Oasys",icon:"oas"},PEAQ_EVM:{name:"Peaq (EVM)",shortName:"Peaq",icon:"peaq"},PEN:{name:"Pendulum",icon:"pen"},PI:{name:"Pi",icon:"pi"},POLYX:{name:"Polymesh",icon:"polyx"},Q:{name:"QuantumCoin",icon:"q"},QRL:{name:"Quantum Resistant Ledger",shortName:"QRL",icon:"qrl"},QUBIC:{name:"Qubic",icon:"qubic"},RBX:{name:"ReserveBlock",icon:"rbx"},ROLLUX:{name:"Rollux",icon:"rollux"},THORCHAIN:{name:"Thorchain",icon:"rune"},S:{name:"Sonic",icon:"s"},SONIC:{name:"Sonic",icon:"s"},TERNOA:{name:"Ternoa",icon:"caps"},SX:{name:"SX Network",icon:"sol"},WAX:{name:"WAX",icon:"waxp"},XCH:{name:"Chia Chain",icon:"xch"},XPRT:{name:"Persistence",icon:"xprt"},ZETACHAIN:{name:"ZetaChain",icon:"zeta"},ZTG:{name:"Zeitgeist",icon:"ztg"},PLS:{name:"Pulsechain",icon:"pulsechain"},MEZO:{name:"Mezo",icon:"mezo"},BSV:{name:"Bitcoin SV",shortName:"BTC SV",icon:"btc"},MONAD:{name:"Monad",icon:"mon"},SUPRA:{name:"Supra",icon:"supra"},SOMI:{name:"Somnia",icon:"somi"},VERIFIEDX:{name:"VerifiedX",icon:"vfx"},MOVE:{name:"Movement",icon:"move"},FLR:{name:"Flare",icon:"flr"},ASSETHUB:{name:"Asset Hub Polkadot",shortName:"Asset Hub",icon:"dot"},BOB:{name:"BOB",icon:"btc"},GLUE:{name:"Glue",icon:"eth"},DYDX:{name:"StarkEx",icon:"stark"},OKC:{name:"OKX Chain",icon:"eth"},UNI_CHAIN:{name:"UNI",icon:"uni"},ZEC:{name:"ZCash",icon:"zec"}},yt=[{code:"BTC",name:"Bitcoin",chains:["BTC","LN"],popular:!0},{code:"ETH",name:"Ethereum",chains:["ETH","ARB","BASE","BSC","OPTIMISM","LINEA","ZKSYNC","LRC","STARK","APE","ECLIPSE","FUEL","INK","SOPHON","UNICHAIN","WLD"],popular:!0},{code:"USDC",name:"USD Coin",chains:["ETH","SOL","ARB","BASE","BSC","MATIC","OPTIMISM","AVAX_C","ALGO","APT","CELO","FLOW","HBAR","LINEA","LRC","ZKSYNC","STARK","SUI","XLM","ECLIPSE","HDX","INK","LSK","METIS","MONAD","SEI_EVM","SONIC","SOPHON","SX","UNICHAIN","APE","BNCPOLKA","GLMR","PEAQ_EVM","PLMC","RON","UNI_CHAIN","WLD","BITKUB","BOB","DYDX","ETHERLINK","GLUE","ASSETHUB"],popular:!0},{code:"USDT",name:"Tether",chains:["ETH","BSC","TRON","ARB","MATIC","AVAX_C","SOL","OPTIMISM","ZKSYNC","STARK","APT","CELO","KLAY","LRC","LSK","ECLIPSE","ETHERLINK","OKC","PEAQ_EVM","BNCPOLKA","GLMR","HDX","PLMC","VIC","ASSETHUB"],popular:!0},{code:"SOL",name:"Solana",chains:["SOL"],popular:!0},{code:"XRP",name:"Ripple",chains:["XRP"],popular:!0},{code:"ADA",name:"Cardano",chains:["ADA"],popular:!0},{code:"DOGE",name:"Dogecoin",chains:["DOGE"],popular:!0},{code:"DOT",name:"Polkadot",chains:["DOT","BSC","BNCPOLKA","GLMR","HDX","PLMC"],popular:!0},{code:"AVAX",name:"Avalanche",chains:["AVAX_C","AVAX_X","BSC"],popular:!0},{code:"LINK",name:"ChainLink",chains:["ETH","BSC"],popular:!0},{code:"LTC",name:"Litecoin",chains:["LTC"],popular:!0},{code:"AAVE",name:"Aave",chains:["ETH","BSC"],popular:!1},{code:"ACA",name:"Acala",chains:["ACA"],popular:!1},{code:"ALEO",name:"Aleo",chains:["ALEO"],popular:!1},{code:"ALGO",name:"Algorand",chains:["ALGO"],popular:!1},{code:"ALPH",name:"Alephium",chains:["ALPH"],popular:!1},{code:"APE",name:"ApeCoin",chains:["APE","ETH"],popular:!1},{code:"APT",name:"Aptos",chains:["APT"],popular:!1},{code:"ARB",name:"Arbitrum",chains:["ARB"],popular:!1},{code:"ASTR",name:"Astar",chains:["ASTR"],popular:!1},{code:"ATOM",name:"Cosmos",chains:["ATOM"],popular:!1},{code:"AUDD",name:"Novatti Australian Digital Dollar",chains:["ETH"],popular:!1},{code:"AVT",name:"Aventus",chains:["ETH"],popular:!1},{code:"AXS",name:"Axie Infinity",chains:["ETH","RON"],popular:!1},{code:"AZERO",name:"Aleph Zero",chains:["AZERO","AZERO_EVM"],popular:!1},{code:"BAJU",name:"Bajun Network",chains:["BAJU"],popular:!1},{code:"BARSIK",name:"Hasbulla's Cat",chains:["SOL"],popular:!1},{code:"BAT",name:"Basic Attention Token",chains:["ETH","BSC"],popular:!1},{code:"BCH",name:"Bitcoin Cash",chains:["BCH"],popular:!1},{code:"BNB",name:"Binance Coin",chains:["BNB","BSC"],popular:!1},{code:"BNC",name:"Bifrost Native Coin",chains:["BNC","BNCPOLKA"],popular:!1},{code:"BOBA",name:"Boba Network",chains:["BOBA","ETH"],popular:!1},{code:"BORA",name:"Bora",chains:["KLAY"],popular:!1},{code:"BRETT",name:"Brett",chains:["BASE"],popular:!1},{code:"BSX",name:"Basilisk",chains:["BSX"],popular:!1},{code:"BZR",name:"Bazaars",chains:["ETH"],popular:!1},{code:"CAGA",name:"Crypto Asset Governance Alliance",chains:["ETH"],popular:!1},{code:"CAKE",name:"PancakeSwap",chains:["BSC"],popular:!1},{code:"CAPS",name:"Caps",chains:["TERNOA"],popular:!1},{code:"CELO",name:"Celo",chains:["CELO"],popular:!1},{code:"CHZ",name:"Chiliz",chains:["CHZ","BNB","ETH"],popular:!1},{code:"C98",name:"Coin98",chains:["VIC"],popular:!1},{code:"CCD",name:"Concordium",chains:["CCD"],popular:!1},{code:"COMP",name:"Compound",chains:["ETH","BSC"],popular:!1},{code:"COREUM",name:"Coreum",chains:["COREUM","XRP"],popular:!1},{code:"CRO",name:"Cronos",chains:["CRO"],popular:!1},{code:"CUSD",name:"Celo Dollar",chains:["CELO"],popular:!1},{code:"CVC",name:"Civic",chains:["ETH"],popular:!1},{code:"DAI",name:"Dai",chains:["ETH","BASE","MATIC"],popular:!1},{code:"DINGO",name:"Dingocoin",chains:["DINGO"],popular:!1},{code:"EGLD",name:"MultiversX",chains:["EGLD"],popular:!1},{code:"EMBER",name:"Ember Sword",chains:["MNT"],popular:!1},{code:"EOS",name:"EOS",chains:["EOS"],popular:!1},{code:"ERG",name:"Ergo",chains:["ERG"],popular:!1},{code:"ETC",name:"Ethereum Classic",chains:["ETC","BSC"],popular:!1},{code:"EUR",name:"EURC",chains:["BASE"],popular:!1},{code:"EUROC",name:"Euro Coin",chains:["ETH"],popular:!1},{code:"EURQ",name:"Quantoz EURQ",chains:["ETH"],popular:!1},{code:"EURR",name:"StablR EUR",chains:["ETH"],popular:!1},{code:"EUSD",name:"Electronic USD",chains:["MOB"],popular:!1},{code:"EXIT",name:"EXIT - Designer Token",chains:["BSC"],popular:!1},{code:"FDUSD",name:"First Digital USD",chains:["SUI"],popular:!1},{code:"FIL",name:"Filecoin",chains:["FIL","BSC"],popular:!1},{code:"FLOW",name:"Flow",chains:["FLOW"],popular:!1},{code:"FLR",name:"Flare",chains:["FLR"],popular:!1},{code:"FLUX",name:"Flux",chains:["FLUX"],popular:!1},{code:"FTM",name:"Fantom",chains:["FTM","ETH","BSC"],popular:!1},{code:"GALA",name:"Gala",chains:["GALA"],popular:!1},{code:"GLMR",name:"Moonbeam",chains:["GLMR"],popular:!1},{code:"GMX",name:"GMX",chains:["ARB"],popular:!1},{code:"GNUS",name:"Genius AI",chains:["ETH"],popular:!1},{code:"GRT",name:"The Graph",chains:["ETH","ARB"],popular:!1},{code:"GUN",name:"Gunz",chains:["GUNZ"],popular:!1},{code:"HBAR",name:"Hedera",chains:["HBAR"],popular:!1},{code:"HDX",name:"HydraDX",chains:["HDX"],popular:!1},{code:"HNT",name:"Helium",chains:["HNT"],popular:!1},{code:"HTP",name:"HowToPay",chains:["BSC"],popular:!1},{code:"HVLO",name:"Hivello",chains:["SOL"],popular:!1},{code:"ICP",name:"Internet Computer",chains:["ICP"],popular:!1},{code:"IMX",name:"Immutable X",chains:["ETH"],popular:!1},{code:"INIT",name:"Initia",chains:["INIT"],popular:!1},{code:"INJ",name:"Injective",chains:["INJ"],popular:!1},{code:"INTR",name:"Interlay",chains:["INTR"],popular:!1},{code:"JAM",name:"Jam Tune.FM",chains:["HBAR"],popular:!1},{code:"KAG",name:"Silver",chains:["KINESIS"],popular:!1},{code:"KAIA",name:"Kaia",chains:["KLAY"],popular:!1},{code:"KAR",name:"Karura",chains:["KAR"],popular:!1},{code:"KAU",name:"Gold",chains:["KINESIS"],popular:!1},{code:"KCS",name:"KuCoin Token",chains:["ETH","KCC"],popular:!1},{code:"KDA",name:"Kadena",chains:["KDA"],popular:!1},{code:"KILT",name:"KILT",chains:["KILT"],popular:!1},{code:"KINT",name:"Kintsugi",chains:["KINT"],popular:!1},{code:"KLV",name:"Klever",chains:["TRON"],popular:!1},{code:"KMD",name:"Komodo",chains:["KMD"],popular:!1},{code:"KSM",name:"Kusama",chains:["KSM"],popular:!1},{code:"KUB",name:"Bitkub Coin",chains:["BITKUB"],popular:!1},{code:"LOOKS",name:"LooksRare",chains:["ETH"],popular:!1},{code:"LRC",name:"Loopring",chains:["ETH","LRC"],popular:!1},{code:"LSK",name:"Lisk",chains:["LSK"],popular:!1},{code:"MANA",name:"Decentraland",chains:["ETH"],popular:!1},{code:"MBX",name:"Marblex",chains:["IMMUTABLE_ZKEVM","KLAY"],popular:!1},{code:"MELANIA",name:"Melania",chains:["SOL"],popular:!1},{code:"METAMASKUSD",name:"Metamask USD",chains:["ETH","LINEA"],popular:!1},{code:"METIS",name:"Metis",chains:["METIS"],popular:!1},{code:"MEZOUSD",name:"MUSD",chains:["ETH","MEZO"],popular:!1},{code:"MKR",name:"Maker",chains:["ETH","BSC"],popular:!1},{code:"MNEE",name:"MNEE",chains:["BSV","ETH"],popular:!1},{code:"MNT",name:"Mantle",chains:["ETH","MNT"],popular:!1},{code:"MOB",name:"MobileCoin",chains:["MOB"],popular:!1},{code:"MON",name:"Monad",chains:["MONAD"],popular:!1},{code:"MOVE",name:"Movement",chains:["MOVE"],popular:!1},{code:"MOVR",name:"Moonriver",chains:["MOVR"],popular:!1},{code:"MYTH",name:"Myth",chains:["MYTH"],popular:!1},{code:"NEAR",name:"NEAR Protocol",chains:["NEAR","BSC"],popular:!1},{code:"NEIRO",name:"NEIRO Ethereum",chains:["ETH"],popular:!1},{code:"OAS",name:"Oasys",chains:["OAS"],popular:!1},{code:"OMG",name:"OmiseGo",chains:["ETH"],popular:!1},{code:"OMUSD",name:"Open Money USD",chains:["ETH"],popular:!1},{code:"ONE",name:"Harmony",chains:["ONE","BNB","ETH"],popular:!1},{code:"OP",name:"Optimism",chains:["OPTIMISM"],popular:!1},{code:"ORDER",name:"Orderly Network",chains:["ETH"],popular:!1},{code:"PEAQ",name:"Peaq",chains:["PEAQ_EVM"],popular:!1},{code:"PEN",name:"Pendulum",chains:["PEN"],popular:!1},{code:"PERC",name:"Perion",chains:["ETH"],popular:!1},{code:"PI",name:"Pi",chains:["PI"],popular:!1},{code:"PLMC",name:"Polimec",chains:["PLMC"],popular:!1},{code:"POL",name:"Polygon",chains:["ETH","MATIC"],popular:!1},{code:"POLYX",name:"Polymesh",chains:["POLYX"],popular:!1},{code:"PROPC",name:"Propchain",chains:["ETH"],popular:!1},{code:"PSTAKE",name:"pSTAKE Finance",chains:["ETH"],popular:!1},{code:"Q",name:"QuantumCoin",chains:["Q"],popular:!1},{code:"QRDO",name:"Qredo",chains:["ETH"],popular:!1},{code:"QRL",name:"Quantum Resistant Ledger",chains:["QRL"],popular:!1},{code:"QUBIC",name:"QUBIC",chains:["QUBIC"],popular:!1},{code:"RBX",name:"ReserveBlock",chains:["RBX"],popular:!1},{code:"REVU",name:"Revuto",chains:["ADA"],popular:!1},{code:"RITE",name:"Ritestream",chains:["BSC"],popular:!1},{code:"RLUSD",name:"Ripple USD",chains:["ETH"],popular:!1},{code:"RON",name:"Ronin",chains:["RON"],popular:!1},{code:"RUNE",name:"THORChain",chains:["THORCHAIN"],popular:!1},{code:"S",name:"Sonic",chains:["S"],popular:!1},{code:"SAND",name:"The Sandbox",chains:["ETH","BSC"],popular:!1},{code:"SEI",name:"SEI",chains:["SEI_EVM"],popular:!1},{code:"SNX",name:"Synthetix",chains:["ETH"],popular:!1},{code:"SOIL",name:"Sun Minimeal",chains:["PLS"],popular:!1},{code:"SOLO",name:"Sologenic",chains:["XRP"],popular:!1},{code:"SOMI",name:"Somnia",chains:["SOMI"],popular:!1},{code:"STRK",name:"Starknet",chains:["STARK"],popular:!1},{code:"SUI",name:"Sui",chains:["SUI"],popular:!1},{code:"SUPR",name:"SuperDapp",chains:["ROLLUX"],popular:!1},{code:"SUPRA",name:"Supra",chains:["SUPRA"],popular:!1},{code:"SUSHI",name:"SushiSwap",chains:["ETH","BSC"],popular:!1},{code:"SYS",name:"Syscoin",chains:["ROLLUX"],popular:!1},{code:"TBTC",name:"tBTC",chains:["SUI","STARK"],popular:!1},{code:"TON",name:"Toncoin",chains:["TON"],popular:!1},{code:"TRUMP",name:"TRUMP",chains:["SOL"],popular:!1},{code:"TRX",name:"Tron",chains:["TRON","BSC"],popular:!1},{code:"TWT",name:"Trust Wallet Token",chains:["BSC"],popular:!1},{code:"UNI",name:"Uniswap",chains:["ETH","BSC"],popular:!1},{code:"URANIUM",name:"Uranium",chains:["ETHERLINK"],popular:!1},{code:"USD0",name:"Usual USD",chains:["ETH"],popular:!1},{code:"USD1",name:"World Liberty Financial USD",chains:["SOL"],popular:!1},{code:"USDE",name:"Ethena USDe",chains:["ETH"],popular:!1},{code:"USDP",name:"Pax Dollar",chains:["ETH"],popular:!1},{code:"USDQ",name:"Quantoz USDQ",chains:["ETH"],popular:!1},{code:"USDR",name:"StablR USD",chains:["ETH"],popular:!1},{code:"USDT0",name:"USDT0",chains:["INK"],popular:!1},{code:"VFX",name:"VerifiedX",chains:["VERIFIEDX"],popular:!1},{code:"VERSE",name:"Verse",chains:["ETH","MATIC"],popular:!1},{code:"VIC",name:"Viction",chains:["VIC"],popular:!1},{code:"WAL",name:"Walrus",chains:["SUI"],popular:!1},{code:"WAVES",name:"Waves",chains:["WAVES"],popular:!1},{code:"WAXP",name:"WAX",chains:["WAX"],popular:!1},{code:"WBTC",name:"Wrapped Bitcoin",chains:["ETH","STARK"],popular:!1},{code:"WETH",name:"Wrapped Ether",chains:["ETHERLINK"],popular:!1},{code:"WLD",name:"Worldcoin",chains:["WLD"],popular:!1},{code:"WLFI",name:"World Liberty Financial",chains:["ETH"],popular:!1},{code:"WOLF",name:"LandWolf",chains:["ETH"],popular:!1},{code:"WOMBAT",name:"Wombat",chains:["MATIC"],popular:!1},{code:"XCH",name:"Chia",chains:["XCH"],popular:!1},{code:"XLM",name:"Stellar Lumens",chains:["XLM","BSC"],popular:!1},{code:"XPRT",name:"Persistence",chains:["XPRT"],popular:!1},{code:"XTZ",name:"Tezos",chains:["XTZ","ETHERLINK"],popular:!1},{code:"YFI",name:"yearn.finance",chains:["ETH"],popular:!1},{code:"ZBU",name:"Zeebu",chains:["BSC"],popular:!1},{code:"ZEC",name:"ZCash",chains:["ZEC"],popular:!1},{code:"ZCHF",name:"Frankencoin",chains:["ETH"],popular:!1},{code:"ZETA",name:"Zeta",chains:["ETH","ZETACHAIN"],popular:!1},{code:"ZTG",name:"Zeitgeist",chains:["ZTG"],popular:!1}],gt={AED:"ae",ALL:"al",ARS:"ar",AUD:"au",BRL:"br",CAD:"ca",CHF:"ch",CLP:"cl",CZK:"cz",DKK:"dk",EUR:"eu",GBP:"gb",HKD:"hk",IDR:"id",INR:"in",JPY:"jp",KRW:"kr",MXN:"mx",NGN:"ng",NOK:"no",NZD:"nz",PHP:"ph",PLN:"pl",QAR:"qa",SAR:"sa",SEK:"se",SGD:"sg",THB:"th",TRY:"tr",TWD:"tw",USD:"us",VND:"vn",ZAR:"za"};function _e(t,a=""){return`${a}/crypto-icons/${t.toLowerCase()}.svg`}function Ct(t,a=""){const n=gt[t]||"us";return`${a}/flags/${n}.svg`}function Ae(t){return Ee[t]||Ee[t.toUpperCase()]||Ee[t.toUpperCase().replace(/-/g,"_")]}function Re(t,a=""){const n=Ae(t);return n?`${a}/crypto-icons/${n.icon}.svg`:`${a}/crypto-icons/${t.toLowerCase()}.svg`}const He=[{code:"ALL",name:"Albania Lek"},{code:"ARS",name:"Argentina Peso"},{code:"AUD",name:"Australian Dollar"},{code:"BRL",name:"Brazilian Real"},{code:"CAD",name:"Canadian Dollar"},{code:"EUR",name:"Euro"},{code:"GBP",name:"British Pound"},{code:"JPY",name:"Japanese Yen"},{code:"USD",name:"US Dollar"},{code:"CHF",name:"Swiss Franc"},{code:"MXN",name:"Mexican Peso"},{code:"INR",name:"Indian Rupee"}],Ue=[{id:"blue",name:"Blue",accent:"#0077FF"},{id:"violet",name:"Violet",accent:"#7C3AED"},{id:"green",name:"Green",accent:"#10B981"},{id:"orange",name:"Orange",accent:"#F59E0B"},{id:"rose",name:"Rose",accent:"#F43F5E"},{id:"mono",name:"Mono",accent:null}],Fe={USDC:{USD:.9962,EUR:1.0814,GBP:1.2573,JPY:.00667,CAD:.7198,AUD:.6384,BRL:.1726,CHF:1.1306,MXN:.0487,INR:.01187,ARS:855e-6,ALL:.01058},USDT:{USD:.9958,EUR:1.081,GBP:1.2568,JPY:.00666,CAD:.7194,AUD:.638,BRL:.1724,CHF:1.1301,MXN:.0486,INR:.01186,ARS:854e-6,ALL:.01057},BTC:{USD:104e-7,EUR:1129e-8,GBP:1313e-8,JPY:696e-10,CAD:751e-8,AUD:666e-8,BRL:18e-7,CHF:118e-7,MXN:508e-9,INR:124e-9,ARS:892e-11,ALL:11e-8},ETH:{USD:316e-6,EUR:343e-6,GBP:399e-6,JPY:211e-8,CAD:228e-6,AUD:202e-6,BRL:547e-7,CHF:358e-6,MXN:154e-7,INR:376e-8,ARS:271e-9,ALL:335e-8},SOL:{USD:.00424,EUR:.004607,GBP:.005356,JPY:284e-7,CAD:.003063,AUD:.002716,BRL:734e-6,CHF:.004812,MXN:207e-6,INR:505e-7,ARS:364e-8,ALL:45e-6},XRP:{USD:.4081,EUR:.4432,GBP:.5153,JPY:.00273,CAD:.2948,AUD:.2614,BRL:.0707,CHF:.463,MXN:.01992,INR:.00486,ARS:35e-5,ALL:.00433},DOGE:{USD:3.896,EUR:4.232,GBP:4.92,JPY:.02607,CAD:2.815,AUD:2.496,BRL:.675,CHF:4.421,MXN:.1902,INR:.04641,ARS:.003345,ALL:.04134},ADA:{USD:1.333,EUR:1.448,GBP:1.683,JPY:.00892,CAD:.963,AUD:.854,BRL:.2309,CHF:1.512,MXN:.0651,INR:.01588,ARS:.001145,ALL:.01414}};function ra(t,a){var n,s;return((n=Fe[t])==null?void 0:n[a])??((s=Fe.USDC)==null?void 0:s[a])??1}function vt(t){return parseFloat(t.replace(/,/g,""))||0}function oa(t){if(t===0)return"0";if(t>=1e3)return t.toLocaleString("en-US",{maximumFractionDigits:2});if(t>=1)return t.toFixed(2);if(t>=.01)return t.toFixed(4);const a=t.toPrecision(4);return parseFloat(a).toString()}const De=t=>/^#([0-9A-Fa-f]{3}){1,2}$/.test(t),lt=10,ct=1e-4,Nt=(()=>{const t=[];for(const a of yt)for(const n of a.chains)t.push({code:a.code,name:a.name,chain:n,popular:a.popular});return t})();function Ke({ticker:t,size:a=32,baseUrl:n=""}){return e.jsx("img",{src:_e(t,n),alt:t,width:a,height:a,className:"rounded-full shrink-0",style:{width:a,height:a}})}function we({currencyCode:t,size:a=16,baseUrl:n=""}){return e.jsx("img",{src:Ct(t,n),alt:t,width:a,height:a,className:"rounded-full shrink-0",style:{width:a,height:a}})}function ke({size:t=32,color:a="#888"}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 32 32",fill:"none",children:[e.jsx("circle",{cx:"16",cy:"16",r:"16",fill:a}),e.jsx("circle",{cx:"16",cy:"16",r:"8",stroke:"white",strokeWidth:"1.5",fill:"none"})]})}function bt({size:t=24}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 32 32",fill:"none",children:[e.jsx("circle",{cx:"16",cy:"16",r:"16",fill:"#0077FF"}),e.jsx("path",{d:"M8 15l8-6 8 6H8z",fill:"white"}),e.jsx("rect",{x:"10",y:"16",width:"2",height:"6",fill:"white"}),e.jsx("rect",{x:"15",y:"16",width:"2",height:"6",fill:"white"}),e.jsx("rect",{x:"20",y:"16",width:"2",height:"6",fill:"white"}),e.jsx("rect",{x:"8",y:"22",width:"16",height:"2",rx:"0.5",fill:"white"})]})}function St({size:t=32}){return e.jsx("div",{className:"rounded-full flex items-center justify-center text-white font-semibold shrink-0",style:{width:t,height:t,backgroundColor:"#333",fontSize:t*.45},children:"R"})}function jt({size:t=32}){return e.jsx("div",{className:"rounded-full bg-black border border-white/20 flex items-center justify-center text-white shrink-0",style:{width:t,height:t,fontSize:t*.3},children:e.jsx("span",{style:{fontFamily:"-apple-system, system-ui, sans-serif",fontWeight:600},children:"Pay"})})}function Et({size:t=32}){return e.jsxs("div",{className:"rounded-full bg-white flex items-center justify-center shrink-0",style:{width:t,height:t,fontSize:t*.28,fontWeight:700,color:"#333"},children:["G",e.jsx("span",{style:{color:"#4285F4",fontSize:t*.2},children:"Pay"})]})}function At({size:t=32}){return e.jsx("div",{className:"rounded-full flex items-center justify-center shrink-0",style:{width:t,height:t,background:"#003087"},children:e.jsx("span",{className:"text-white font-bold",style:{fontSize:t*.38},children:"P"})})}function Rt({size:t=32}){return e.jsx("div",{className:"rounded-full flex items-center justify-center shrink-0",style:{width:t,height:t,background:"var(--t-card-icon-bg)"},children:e.jsxs("svg",{width:t*.55,height:t*.55,viewBox:"0 0 18 14",fill:"none",children:[e.jsx("rect",{x:"0.5",y:"0.5",width:"17",height:"13",rx:"2",stroke:"var(--t-card-icon-stroke)"}),e.jsx("rect",{y:"3",width:"18",height:"3",fill:"var(--t-card-icon-stroke)"})]})})}function la({size:t=18}){return e.jsx("div",{className:"rounded-full bg-white flex items-center justify-center shrink-0",style:{width:t,height:t},children:e.jsx("span",{className:"text-black font-bold",style:{fontSize:t*.55},children:"C"})})}function ie(){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"var(--t-text-secondary)",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function wt(){return e.jsx("svg",{width:"8",height:"14",viewBox:"0 0 8 14",fill:"none",children:e.jsx("path",{d:"M1 1L7 7L1 13",stroke:"var(--t-icon-stroke)",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Tt({onClick:t}){return e.jsx("button",{onClick:t,className:"hover:opacity-70 transition-opacity",children:e.jsx("svg",{width:"24",height:"16",viewBox:"0 0 24 16",fill:"none",children:e.jsx("path",{d:"M22.4004 12V4C22.4004 2.67452 21.3255 1.59961 20 1.59961H6.7998V14.4004H20V16H4V14.4004H5.2002V1.59961H4C2.67452 1.59961 1.59961 2.67452 1.59961 4V12C1.59961 13.3255 2.67452 14.4004 4 14.4004V16L3.79395 15.9951C1.68056 15.8879 0 14.14 0 12V4C0 1.79086 1.79086 6.44266e-08 4 0H20C22.2091 0 24 1.79086 24 4V12L23.9951 12.2061C23.8913 14.2512 22.2512 15.8913 20.2061 15.9951L20 16V14.4004C21.3255 14.4004 22.4004 13.3255 22.4004 12Z",fill:"var(--t-icon-stroke)"})})})}function kt({size:t=40}){return e.jsx("div",{className:"rounded-full flex items-center justify-center shrink-0",style:{width:t,height:t,background:"var(--t-surface)"},children:e.jsxs("svg",{width:t*.5,height:t*.5,viewBox:"0 0 20 20",fill:"none",children:[e.jsx("circle",{cx:"10",cy:"10",r:"7.5",stroke:"var(--t-text)",strokeWidth:"1.5"}),e.jsx("path",{d:"M10 2.5A7.5 7.5 0 0 1 10 17.5",fill:"var(--t-text)"})]})})}function It(t,a=32){switch(t){case"revolut":return e.jsx(St,{size:a});case"applepay":return e.jsx(jt,{size:a});case"card":return e.jsx(Rt,{size:a});case"googlepay":return e.jsx(Et,{size:a});case"paypal":return e.jsx(At,{size:a});case"bank":return e.jsx(bt,{size:a});default:return e.jsx(ke,{size:a})}}const ca={"debit-credit-card":"card","bank-transfer":"bank","apple-pay":"applepay","google-pay":"googlepay",paypal:"paypal",revolut:"revolut"},ia={"debit-credit-card":"Card","bank-transfer":"Bank Transfer","ach-bank-transfer":"ACH","apple-pay":"Apple Pay","google-pay":"Google Pay","payid-bank-transfer":"PayID",paypal:"PayPal",revolut:"Revolut"};function Lt(t,a){return ia[t]||a}function Mt(t,a,n=24){const s=ca[t];return s?It(s,n):a?e.jsx("img",{src:a,alt:"",width:n,height:n,style:{borderRadius:"50%"}}):e.jsx(ke,{size:n})}function Bt({methods:t,selectedId:a,onOpenModal:n,fiatCurrency:s}){const r=l.useMemo(()=>t.filter(d=>d.supportedFiats.includes(s)),[t,s]),m=r.find(d=>d.id===a)||r[0];return r.length===0?e.jsx("div",{className:"flex items-center justify-between px-[18px] pt-[12px] pb-[14px]",style:{background:"var(--t-surface)",borderBottomLeftRadius:5,borderBottomRightRadius:5},children:e.jsxs("span",{className:"text-[12px]",style:{color:"var(--t-text-muted)"},children:["No payment methods available for ",s]})}):e.jsx(e.Fragment,{children:e.jsxs("div",{role:"button",tabIndex:0,onClick:n,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&n()},className:"flex items-center justify-between w-full px-[18px] transition-colors",style:{background:"var(--t-surface)",borderBottomLeftRadius:5,borderBottomRightRadius:5,cursor:"pointer",height:42},children:[e.jsx("span",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:"Payment method"}),e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex items-center justify-center",style:{width:20,height:20},children:m&&Mt(m.id,m.icon,20)}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:m?Lt(m.id,m.name):"Select"}),e.jsx(ie,{})]})]})})}function Ot({className:t="",autoRedirect:a=!1,redirectDelay:n=3e3}){var C;const{order:s,orderStatus:r,goToStep:m,goBack:d}=ae(),[u,o]=l.useState(!1),[i,h]=l.useState(null),f=s!=null&&s.checkout.expiresAt?Date.now()>s.checkout.expiresAt:!1;if(l.useEffect(()=>{if((s==null?void 0:s.checkout.method)==="redirect"&&a&&!f){h(Math.ceil(n/1e3));const y=setTimeout(()=>{window.location.href=s.checkout.url},n),p=setInterval(()=>{h(v=>v&&v>1?v-1:null)},1e3);return()=>{clearTimeout(y),clearInterval(p)}}},[s,a,n,f]),l.useEffect(()=>{r&&(r.status==="completed"?m("complete"):["failed","cancelled","expired"].includes(r.status)&&m("error"))},[r==null?void 0:r.status,m]),!s)return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("p",{className:"text-[15px] mb-4",children:"No order found"}),e.jsx("button",{className:"font-semibold text-[14px] transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)",paddingLeft:24,paddingRight:24},onClick:d,children:"Go Back"})]});if(f)return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 text-center ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("h3",{className:"text-[18px] font-semibold mb-2",children:"Checkout expired"}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:"The session has expired. Please try again."}),e.jsx("button",{className:"w-full font-semibold text-[16px] transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)"},onClick:d,children:"Start over"})]});if(s.checkout.method==="iframe"){const y=s.checkout.url,p=((C=s.checkout.allowedFeatures)==null?void 0:C.join("; "))||"payment; camera; microphone; geolocation; clipboard-read; clipboard-write; accelerometer; gyroscope; magnetometer; fullscreen; autoplay; encrypted-media; web-share";return rt.createPortal(e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",flexDirection:"column",background:"#000"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",height:48,paddingLeft:8,paddingRight:16,background:"#111",flexShrink:0},children:e.jsxs("button",{onClick:d,style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",color:"#fff",fontSize:14,fontWeight:500,cursor:"pointer",padding:"8px 12px",borderRadius:6},children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M10 12L6 8L10 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),"Cancel"]})}),e.jsxs("div",{style:{flex:1,position:"relative",overflow:"hidden"},children:[!u&&e.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:[e.jsx("div",{className:"nramp-spinner"}),e.jsx("p",{style:{color:"#888",fontSize:14,marginTop:16},children:"Loading checkout..."})]}),e.jsx("iframe",{src:y,style:{display:u?"block":"none",width:"100%",height:"100%",border:"none"},allow:p,onLoad:()=>o(!0),title:"Provider Checkout"})]})]}),document.body)}if(s.checkout.method==="redirect")return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 text-center ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("div",{className:"text-[48px] mb-4",children:"🔗"}),e.jsx("h3",{className:"text-[18px] font-semibold mb-2",children:"Complete Payment"}),e.jsxs("p",{className:"text-[14px] mb-4",style:{color:"var(--t-text-secondary)"},children:["You'll be redirected to ",s.gateway," to complete your payment."]}),i!==null&&e.jsxs("p",{className:"text-[13px] mb-4",style:{color:"var(--t-text-muted)"},children:["Redirecting in ",i,"..."]}),e.jsxs("a",{href:s.checkout.url,className:"w-full font-semibold text-[16px] flex items-center justify-center transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)",textDecoration:"none"},target:"_blank",rel:"noopener noreferrer",children:["Continue to ",s.gateway]}),e.jsx("button",{className:"w-full font-semibold text-[14px] mt-2 transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)"},onClick:d,children:"Cancel"})]});if(s.checkout.method==="widget"&&s.widgetConfig){const y=da(s.checkout.url,s.widgetConfig);return rt.createPortal(e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",flexDirection:"column",background:"#000"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",height:48,paddingLeft:8,paddingRight:16,background:"#111",flexShrink:0},children:e.jsxs("button",{onClick:d,style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",color:"#fff",fontSize:14,fontWeight:500,cursor:"pointer",padding:"8px 12px",borderRadius:6},children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M10 12L6 8L10 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),"Cancel"]})}),e.jsxs("div",{style:{flex:1,position:"relative",overflow:"hidden"},children:[!u&&e.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:[e.jsx("div",{className:"nramp-spinner"}),e.jsx("p",{style:{color:"#888",fontSize:14,marginTop:16},children:"Loading checkout..."})]}),e.jsx("iframe",{src:y,style:{display:u?"block":"none",width:"100%",height:"100%",border:"none"},allow:"payment; camera; microphone; geolocation; clipboard-read; clipboard-write; accelerometer; gyroscope; magnetometer; fullscreen; autoplay; encrypted-media; web-share",onLoad:()=>o(!0),title:"Payment Checkout"})]})]}),document.body)}return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("p",{className:"text-[15px] mb-4",children:"Unknown checkout method"}),e.jsx("button",{className:"font-semibold text-[14px] transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)",paddingLeft:24,paddingRight:24},onClick:d,children:"Go Back"})]})}function da(t,a){const n=new URL("/en/partner/widget",t);for(const[s,r]of Object.entries(a))r!=null&&r!==""&&n.searchParams.set(s,String(r));return n.toString()}function Pt({className:t=""}){const{orderStatus:a,orderStatusLoading:n,goToStep:s}=ae();l.useEffect(()=>{a&&(a.status==="completed"?s("complete"):["failed","cancelled","expired","refunded"].includes(a.status)&&s("error"))},[a==null?void 0:a.status,s]);const r=()=>{if(!a)return"Processing your order...";switch(a.status){case"pending":return"Waiting for payment confirmation...";case"processing":return"Processing your transaction...";default:return"Processing..."}};return e.jsxs("div",{className:`flex flex-col items-center justify-center px-8 py-12 text-center ${t}`,children:[e.jsx("div",{className:"mb-6",children:e.jsx("div",{className:"nramp-spinner-large nramp-spinner"})}),e.jsx("h2",{className:"text-[20px] font-semibold mb-3",style:{color:"var(--t-text)"},children:r()}),n&&e.jsx("p",{className:"text-[13px] mb-4",style:{color:"var(--t-text-muted)"},children:"Checking status..."}),a&&e.jsxs("div",{className:"w-full mt-6 text-left",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[e.jsx(ce,{label:"Order ID",value:a.orderId,mono:!0}),e.jsx(ce,{label:"Provider",value:a.gateway}),e.jsx(ce,{label:"Amount",value:`${a.fiatAmount} ${a.fiatCurrency}`}),e.jsx(ce,{label:"Receiving",value:`${a.cryptoAmount||"..."} ${a.cryptoCurrency}`}),e.jsx(ce,{label:"Network",value:a.network}),e.jsx(ce,{label:"To Address",value:`${a.walletAddress.slice(0,10)}...${a.walletAddress.slice(-8)}`,mono:!0})]}),e.jsxs("div",{className:"mt-6",children:[e.jsx("p",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:"This usually takes a few minutes."}),e.jsx("p",{className:"text-[12px] mt-1",style:{color:"var(--t-text-muted)"},children:"You can safely close this page - we'll send you an email when complete."})]})]})}function ce({label:t,value:a,mono:n}){return e.jsxs("div",{className:"flex justify-between items-center py-2",style:{borderBottom:"1px solid var(--t-divider)"},children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:t}),e.jsx("span",{className:`text-[13px] font-medium ${n?"font-mono":""}`,style:{color:"var(--t-text)"},children:a})]})}function Dt({className:t="",explorerUrl:a,onDone:n,doneButtonText:s="Done"}){const{orderStatus:r,state:m,dispatch:d}=ae(),u=m.flowType==="sell",o=()=>{if(!(r!=null&&r.transactionHash))return null;if(!a){const f={ethereum:"https://etherscan.io/tx/{txHash}",polygon:"https://polygonscan.com/tx/{txHash}",arbitrum:"https://arbiscan.io/tx/{txHash}",optimism:"https://optimistic.etherscan.io/tx/{txHash}",base:"https://basescan.org/tx/{txHash}",bitcoin:"https://mempool.space/tx/{txHash}",solana:"https://solscan.io/tx/{txHash}",avalanche:"https://snowtrace.io/tx/{txHash}",fantom:"https://ftmscan.com/tx/{txHash}"};return(f[m.network]||f.ethereum).replace("{txHash}",r.transactionHash)}return a.replace("{txHash}",r.transactionHash)},i=()=>{n?n():d({type:"RESET"})},h=o();return e.jsxs("div",{className:`flex flex-col items-center px-8 py-12 text-center ${t}`,children:[e.jsx("div",{className:"flex items-center justify-center mb-5",style:{width:64,height:64,borderRadius:"50%",background:"var(--t-success, #10b981)"},children:e.jsx("svg",{viewBox:"0 0 24 24",width:"32",height:"32",fill:"white",children:e.jsx("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"})})}),e.jsx("h2",{className:"text-[20px] font-semibold mb-2",style:{color:"var(--t-text)"},children:u?"Sale Complete!":"Purchase Complete!"}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:u?`Your ${(r==null?void 0:r.fiatCurrency)||m.fiatCurrency} payout is being processed.`:`Your ${(r==null?void 0:r.cryptoCurrency)||m.cryptoCurrency} has been sent to your wallet.`}),r&&e.jsxs("div",{className:"w-full text-left mb-6",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[e.jsx(Z,{label:u?"Amount Sold":"Amount Received",value:`${r.cryptoAmount} ${r.cryptoCurrency}`,highlight:!0}),e.jsx(Z,{label:u?"Payout Amount":"Amount Paid",value:`${r.fiatAmount} ${r.fiatCurrency}`}),e.jsx(Z,{label:"Network",value:r.network}),e.jsx(Z,{label:"Wallet",value:`${r.walletAddress.slice(0,10)}...${r.walletAddress.slice(-8)}`,mono:!0}),r.transactionHash&&e.jsx(Z,{label:"Transaction",value:`${r.transactionHash.slice(0,10)}...${r.transactionHash.slice(-8)}`,mono:!0}),e.jsx(Z,{label:"Provider",value:r.gateway}),e.jsx(Z,{label:"Order ID",value:r.orderId,mono:!0}),r.completedAt&&e.jsx(Z,{label:"Completed",value:new Date(r.completedAt).toLocaleString()})]}),e.jsxs("div",{className:"w-full flex flex-col gap-2",children:[h&&e.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"w-full font-semibold text-[14px] flex items-center justify-center transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)",textDecoration:"none"},children:"View on Explorer"}),e.jsx("button",{className:"w-full font-semibold text-[16px] transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)"},onClick:i,children:s})]})]})}function Z({label:t,value:a,mono:n,highlight:s}){return e.jsxs("div",{className:"flex justify-between items-center py-2",style:{borderBottom:"1px solid var(--t-divider)"},children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:t}),e.jsx("span",{className:`text-[13px] font-medium ${n?"font-mono":""}`,style:{color:s?"var(--t-success, #10b981)":"var(--t-text)"},children:a})]})}function Ht({className:t="",onRetry:a,supportEmail:n="support@nowramp.com"}){const{state:s,orderStatus:r,dispatch:m,goToStep:d}=ae(),u=s.flowType==="sell",o=()=>{if(r)switch(r.status){case"failed":return"Payment Failed";case"cancelled":return"Order Cancelled";case"expired":return"Order Expired";case"refunded":return"Order Refunded";default:return"Something Went Wrong"}return"Something Went Wrong"},i=()=>{if(s.errorMessage)return s.errorMessage;if(r)switch(r.status){case"failed":return u?"Your sale could not be processed. Please try again.":"Your payment could not be processed. Please try again or use a different payment method.";case"cancelled":return u?"Your sale was cancelled. No crypto was transferred.":"Your order was cancelled. No payment was processed.";case"expired":return u?"Your order has expired. Please start a new sale.":"Your order has expired. Please start a new purchase.";case"refunded":return u?"Your crypto has been returned. The funds should appear in your wallet shortly.":"Your payment has been refunded. The funds should appear in your account within 5-10 business days.";default:return"An unexpected error occurred. Please try again."}return"An unexpected error occurred. Please try again."},h=()=>{m({type:"CLEAR_ERROR"}),a?a():(m({type:"RESET"}),d("amount"))},f=()=>{m({type:"RESET"}),d("amount")};return e.jsxs("div",{className:`flex flex-col items-center px-8 py-12 text-center ${t}`,children:[e.jsx("div",{className:"flex items-center justify-center mb-5",style:{width:64,height:64,borderRadius:"50%",background:"var(--t-error, #EF4444)"},children:e.jsx("svg",{viewBox:"0 0 24 24",width:"32",height:"32",fill:"white",children:e.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})})}),e.jsx("h2",{className:"text-[20px] font-semibold mb-2",style:{color:"var(--t-text)"},children:o()}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:i()}),r&&e.jsxs("div",{className:"w-full text-left mb-6",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[e.jsxs("div",{className:"flex justify-between items-center py-2",style:{borderBottom:"1px solid var(--t-divider)"},children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:"Order ID"}),e.jsx("span",{className:"text-[13px] font-medium font-mono",style:{color:"var(--t-text)"},children:r.orderId})]}),e.jsxs("div",{className:"flex justify-between items-center py-2",children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:"Status"}),e.jsx("span",{className:"text-[12px] font-medium px-2 py-0.5",style:{background:"rgba(239,68,68,0.15)",color:"#EF4444",borderRadius:4},children:r.gatewayStatus})]})]}),e.jsxs("div",{className:"w-full flex flex-col gap-2",children:[e.jsx("button",{className:"w-full font-semibold text-[16px] transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)"},onClick:h,children:"Try Again"}),e.jsx("button",{className:"w-full font-semibold text-[14px] transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)"},onClick:f,children:"Start Over"})]}),e.jsxs("div",{className:"mt-6",children:[e.jsxs("p",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:["Need help? Contact"," ",e.jsx("a",{href:`mailto:${n}`,className:"underline",style:{color:"var(--t-accent)"},children:n})]}),r&&e.jsxs("p",{className:"text-[12px] mt-1",style:{color:"var(--t-text-muted)"},children:["Reference: ",r.orderId]})]})]})}function it(t){return t.length<=12?t:`${t.slice(0,6)}...${t.slice(-6)}`}function Ut({className:t=""}){const{config:a,configLoading:n,state:s,defaultGateway:r,fetchQuotes:m,createOrder:d,orderLoading:u}=ae(),o=s.flowType==="sell",[i,h]=l.useState(null),f=a==null?void 0:a.gateways.find(y=>y.id===r),C=async()=>{h(null);try{m(),await d()}catch(y){const p=y instanceof Error?y.message:"Failed to create order";h(p)}};return n?e.jsxs("div",{className:`flex flex-col items-center justify-center p-12 ${t}`,children:[e.jsx("div",{className:"nramp-spinner"}),e.jsx("p",{className:"text-[14px] mt-4",style:{color:"var(--t-text-secondary)"},children:"Loading..."})]}):e.jsxs("div",{className:`flex flex-col items-center px-8 py-12 ${t}`,children:[e.jsx("h2",{className:"text-[20px] font-semibold mb-6",style:{color:"var(--t-text)"},children:o?"Confirm Sale":"Confirm Purchase"}),e.jsxs("div",{className:"w-full text-left mb-6",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[f&&e.jsxs("div",{className:"flex justify-between items-center py-2",style:{borderBottom:"1px solid var(--t-divider)"},children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:"Provider"}),e.jsxs("span",{className:"flex items-center gap-2",children:[f.logo&&e.jsx("img",{src:f.logo,alt:f.name,width:20,height:20,style:{borderRadius:4}}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:f.name})]})]}),o?e.jsxs(e.Fragment,{children:[e.jsx(te,{label:"You sell",value:`${s.cryptoAmount} ${s.cryptoCurrency}`,highlight:!0}),e.jsx(te,{label:"You receive",value:`${s.fiatCurrency} payout`})]}):e.jsxs(e.Fragment,{children:[e.jsx(te,{label:"You pay",value:`${s.fiatAmount} ${s.fiatCurrency}`,highlight:!0}),e.jsx(te,{label:"You receive",value:`${s.cryptoCurrency} on ${s.network}`}),e.jsx(te,{label:"Wallet",value:it(s.walletAddress),mono:!0})]}),e.jsx(te,{label:"Network",value:s.network}),o&&s.walletAddress&&e.jsx(te,{label:"Refund address",value:it(s.walletAddress),mono:!0})]}),i&&e.jsx("p",{className:"text-[12px] mb-4",style:{color:"#EF4444"},children:i}),e.jsx("button",{className:"w-full font-semibold text-[16px] transition-all flex items-center justify-center gap-2",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)",opacity:u?.7:1},disabled:u,onClick:C,children:u?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"nramp-spinner-inline"}),"Processing..."]}):o?"Confirm & Sell":"Confirm & Pay"})]})}function te({label:t,value:a,mono:n,highlight:s}){return e.jsxs("div",{className:"flex justify-between items-center py-2",style:{borderBottom:"1px solid var(--t-divider)"},children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:t}),e.jsx("span",{className:`text-[13px] font-medium ${n?"font-mono":""}`,style:{color:s?"var(--t-success, #10b981)":"var(--t-text)"},children:a})]})}function he({isOpen:t,onClose:a,children:n}){const[s,r]=l.useState(!1),[m,d]=l.useState(!1);l.useEffect(()=>{if(t)r(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>d(!0)));else if(s){d(!1);const o=setTimeout(()=>r(!1),250);return()=>clearTimeout(o)}},[t]);const u=l.useCallback(()=>{d(!1),setTimeout(()=>a(),250)},[a]);return l.useEffect(()=>{if(!t)return;const o=i=>{i.key==="Escape"&&u()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t,u]),s?e.jsx("div",{className:"absolute inset-0 z-20 transition-opacity duration-250",style:{opacity:m?1:0},children:e.jsx("div",{className:"absolute inset-0 flex flex-col transition-transform duration-250 ease-out",style:{background:"var(--t-modal-bg)",transform:m?"translateY(0)":"translateY(24px)"},children:typeof n=="function"?n(u):n})}):null}function Ft({char:t,height:a=38}){const n="0123456789",s=n.indexOf(t);return s===-1?e.jsx("span",{children:t}):e.jsx("span",{className:"digit-slot",style:{height:a,lineHeight:`${a}px`},children:e.jsx("span",{className:"digit-slot-inner block",style:{transform:`translateY(-${s*a}px)`},children:n.split("").map(r=>e.jsx("span",{className:"block",style:{height:a,lineHeight:`${a}px`},children:r},r))})})}function Kt({value:t,height:a=38,className:n="",style:s={}}){return e.jsx("span",{className:n,style:{display:"inline-flex",...s},children:t.split("").map((r,m)=>e.jsx(Ft,{char:r,height:a},m))})}function I({w:t,h:a,className:n=""}){return e.jsx("div",{className:`skeleton ${n}`,style:{width:t,height:a}})}function _t(){return e.jsxs("div",{className:"flex-1 px-5 flex flex-col",children:[e.jsxs("div",{className:"px-[18px] pt-[14px] pb-[18px]",style:{background:"var(--t-surface)",borderRadius:5},children:[e.jsx(I,{w:70,h:14,className:"mb-3"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(I,{w:120,h:32}),e.jsx(I,{w:75,h:32})]})]}),e.jsxs("div",{className:"px-[18px] pt-[12px] pb-[18px]",style:{background:"var(--t-surface)",borderRadius:5,marginTop:4},children:[e.jsx(I,{w:50,h:14,className:"mb-3"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(I,{w:180,h:32}),e.jsx(I,{w:85,h:32})]})]}),e.jsxs("div",{className:"flex justify-between mt-3 px-[2px]",children:[e.jsx(I,{w:140,h:12}),e.jsx(I,{w:90,h:12})]}),e.jsxs("div",{className:"mt-8",children:[e.jsx(I,{w:65,h:14,className:"mb-2.5"}),e.jsx(I,{w:"100%",h:47})]}),e.jsx("div",{className:"flex-1"}),e.jsx(I,{w:"100%",h:60,className:"mb-2"}),e.jsx("div",{className:"text-center py-3",children:e.jsx("span",{className:"text-[11px]",style:{color:"var(--t-text-tertiary)"},children:"Powered by NowRamp"})})]})}function de({onClick:t}){return e.jsx("button",{onClick:t,className:"flex items-center justify-center transition-colors rounded-full shrink-0",style:{width:30,height:30,backgroundColor:"var(--t-close-bg)"},onMouseEnter:a=>a.currentTarget.style.backgroundColor="var(--t-close-hover)",onMouseLeave:a=>a.currentTarget.style.backgroundColor="var(--t-close-bg)",children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:e.jsx("path",{d:"M1 1L9 9M9 1L1 9",stroke:"var(--t-icon-close)",strokeWidth:"1.4",strokeLinecap:"round"})})})}function fe({value:t,onChange:a,placeholder:n=""}){return e.jsxs("div",{className:"relative mx-5 mb-5",children:[e.jsx("input",{type:"text",value:t,onChange:s=>a(s.target.value),placeholder:n,style:{height:47,borderRadius:4.5,border:"1px solid var(--t-border)",color:"var(--t-text)",padding:`0 ${t?40:14}px 0 14px`,fontSize:14,backgroundColor:"transparent"},className:"w-full outline-none transition-colors"}),t&&e.jsx("button",{onClick:()=>a(""),className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center justify-center transition-colors rounded",style:{width:22,height:22,backgroundColor:"var(--t-close-bg)",borderRadius:4},children:e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",children:e.jsx("path",{d:"M1 1L7 7M7 1L1 7",stroke:"var(--t-icon-close)",strokeWidth:"1.2",strokeLinecap:"round"})})})]})}function Xt({onClose:t,onSelect:a,currencies:n,assetBaseUrl:s=""}){const[r,m]=l.useState(""),d=l.useMemo(()=>{if(!n||n.length===0)return He;const o=new Map(He.map(i=>[i.code,i.name]));return n.map(i=>({code:i.code,name:i.name||o.get(i.code)||i.code}))},[n]),u=l.useMemo(()=>{const o=r.trim().toLowerCase();return o?d.filter(i=>i.code.toLowerCase().includes(o)||i.name.toLowerCase().includes(o)):d},[d,r]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(de,{onClick:t})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)",fontSize:17,fontWeight:500,marginTop:8,marginBottom:24},children:"Select fiat currency"}),e.jsx(fe,{value:r,onChange:m}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[u.map(o=>e.jsxs("button",{onClick:()=>a(o.code),className:"flex items-center gap-3.5 w-full py-3.5 transition-colors",style:{color:"var(--t-text)"},children:[e.jsx(we,{currencyCode:o.code,size:32,baseUrl:s}),e.jsxs("div",{className:"text-left",children:[e.jsx("div",{className:"font-semibold text-[15px] leading-tight",children:o.code}),e.jsx("div",{className:"text-[13px] mt-0.5",style:{color:"var(--t-text-secondary)"},children:o.name})]})]},o.code)),u.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No currencies found"})]})]})}function $t({onClose:t,onSelect:a,cryptos:n,assetBaseUrl:s=""}){const[r,m]=l.useState(""),d=l.useMemo(()=>{if(!n||n.length===0)return Nt;const o=[];for(const i of n){const h=i.networks||[];if(h.length===0)o.push({code:i.code,name:i.name||i.code,chain:i.code,popular:!1});else for(const f of h){const C=f.code||f.id||f.name||i.code;o.push({code:i.code,name:i.name||i.code,chain:C,chainName:f.name,popular:!1})}}return o},[n]),u=l.useMemo(()=>{var f;const o=r.trim().toLowerCase();if(!o)return d;const i=o.split(/\s+/),h=[];for(const C of d){const y=Ae(C.chain),p=y?y.name.toLowerCase():"",v=((f=y==null?void 0:y.shortName)==null?void 0:f.toLowerCase())||"",R=C.chain.toLowerCase(),B=C.code.toLowerCase(),j=C.name.toLowerCase(),K=[B,j,p,v,R];if(!i.every(W=>K.some(c=>c.includes(W))))continue;let _=0;B===o?_+=100:B.startsWith(i[0])&&(_+=50),C.popular&&(_+=10),i.length>1&&(p.includes(i[1])||v.includes(i[1])||R.includes(i[1]))&&(_+=25),h.push({item:C,score:_})}return h.sort((C,y)=>y.score-C.score),h.map(C=>C.item)},[d,r]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(de,{onClick:t})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)",fontSize:17,fontWeight:500,marginTop:8,marginBottom:24},children:"Select crypto currency"}),e.jsx(fe,{value:r,onChange:m}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[u.map(o=>{const i=Ae(o.chain),h=(i==null?void 0:i.name)||o.chainName||o.chain;return e.jsxs("button",{onClick:()=>a(o.code,o.chain),className:"flex items-center gap-3.5 w-full py-3.5 transition-colors",children:[e.jsxs("div",{className:"relative shrink-0",style:{width:40,height:40},children:[e.jsx("img",{src:_e(o.code,s),alt:o.code,width:32,height:32,className:"rounded-full absolute top-0 left-0",style:{width:32,height:32}}),e.jsx("img",{src:Re(o.chain,s),alt:o.chain,width:16,height:16,className:"rounded-full absolute",style:{width:16,height:16,bottom:0,right:0,border:"2px solid var(--t-chain-border)"}})]}),e.jsxs("div",{className:"text-left flex-1 min-w-0",children:[e.jsx("div",{className:"font-semibold text-[15px] leading-tight",style:{color:"var(--t-text)"},children:o.code}),e.jsx("div",{className:"text-[13px] mt-0.5",style:{color:"var(--t-text-secondary)"},children:o.name})]}),e.jsx("div",{className:"text-right shrink-0",children:e.jsx("div",{className:"text-[13px]",style:{color:"var(--t-text-muted)"},children:h})})]},`${o.code}-${o.chain}`)}),u.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No currencies found"})]})]})}function ua({methods:t,selectedId:a,onSelect:n,onClose:s}){const[r,m]=l.useState(""),d=l.useMemo(()=>{const u=r.trim().toLowerCase();return u?t.filter(o=>o.id.toLowerCase().includes(u)||o.name.toLowerCase().includes(u)||o.description&&o.description.toLowerCase().includes(u)):t},[t,r]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(de,{onClick:s})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)",fontSize:17,fontWeight:500,marginTop:8,marginBottom:24},children:"Choose payment method"}),e.jsx(fe,{value:r,onChange:m}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[d.map((u,o)=>{const i=u.id===a,h=Lt(u.id,u.name);return e.jsxs("button",{onClick:()=>n(u.id),className:"flex items-start gap-3.5 w-full py-4 transition-colors",style:{color:"var(--t-text)",borderBottom:o<d.length-1?"1px solid var(--t-divider, rgba(128,128,128,0.12))":"none"},children:[e.jsx("span",{className:"flex items-center justify-center shrink-0 mt-0.5",style:{width:32,height:32},children:Mt(u.id,u.icon,32)}),e.jsxs("div",{className:"text-left flex-1",children:[e.jsx("div",{className:"font-semibold text-[15px] leading-tight",style:{color:i?"var(--t-accent)":"var(--t-text)"},children:h}),u.description&&e.jsx("div",{className:"text-[13px] leading-snug mt-1",style:{color:"var(--t-text-muted)"},children:u.description})]})]},u.id)}),d.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No payment methods found"})]})]})}function Gt({checked:t,onChange:a,accentColor:n="var(--t-accent)"}){return e.jsx("button",{onClick:()=>a(!t),className:"relative shrink-0 transition-colors duration-200",style:{width:48,height:28,borderRadius:14,backgroundColor:t?n:"var(--t-border)"},children:e.jsx("div",{className:"absolute top-[3px] rounded-full bg-white shadow transition-transform duration-200",style:{width:22,height:22,transform:t?"translateX(23px)":"translateX(3px)"}})})}const ma=[{label:"Privacy policy",href:"https://nowramp.com/privacy-policy"},{label:"Terms of use",href:"https://nowramp.com/terms-and-conditions"}];function Vt({onClose:t,darkMode:a,onToggleDarkMode:n,skinId:s,onSelectSkin:r}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end items-center px-5 pt-5",children:e.jsx(de,{onClick:t})}),e.jsxs("div",{className:"px-5 flex-1 pt-6 overflow-y-auto custom-scroll",children:[e.jsx("div",{style:{borderTop:"1px solid var(--t-divider)"},children:e.jsxs("div",{className:"flex items-center justify-between w-full py-5",children:[e.jsxs("div",{className:"flex items-center gap-3.5",children:[e.jsx(kt,{size:40}),e.jsx("span",{className:"font-medium text-[15px]",style:{color:"var(--t-text)"},children:"Dark Mode"})]}),e.jsx(Gt,{checked:a,onChange:n,accentColor:"#4CD964"})]})}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}}),ma.map(m=>e.jsxs("div",{children:[e.jsxs("a",{href:m.href,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between w-full py-5 transition-colors",style:{color:"inherit",textDecoration:"none"},children:[e.jsx("span",{className:"font-medium text-[15px]",style:{color:"var(--t-text)"},children:m.label}),e.jsx(wt,{})]}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}})]},m.label))]})]})}function pa({className:t="",theme:a="dark",skinId:n="mono",accentColor:s,bgColor:r,bgImage:m,borderColor:d,borderRadius:u,showFlowToggle:o=!0,autoRedirect:i=!1,explorerUrl:h,doneButtonText:f="Done",supportEmail:C,onDone:y}){var ze,Je,qe,et,tt,at,nt,st;const{state:p,dispatch:v,config:R,configLoading:B,quotes:j,quotesLoading:K,quotesError:$,fetchQuotes:_,createOrder:W,orderLoading:c,amountError:M,fieldLocks:N,apiConfig:k,assetBaseUrl:D}=ae(),[U,F]=l.useState(a==="dark"),[xe,ue]=l.useState(n),[ne,H]=l.useState(null),[me,z]=l.useState(!1),[ye,se]=l.useState(!1),[re,ge]=l.useState(!1),[X,J]=l.useState(null),[q,Ce]=l.useState(!0),[ve,Ne]=l.useState(!1),[Y,oe]=l.useState(!1),Ie=l.useRef(null),pe=l.useRef(),g=l.useRef(p.flowType);l.useEffect(()=>{F(a==="dark")},[a]),l.useEffect(()=>{const x=setTimeout(()=>Ce(!1),B?0:800);return()=>clearTimeout(x)},[B]),l.useEffect(()=>{if(g.current!==p.flowType&&!q){g.current=p.flowType,Ne(!0),z(!1),se(!1);const x=setTimeout(()=>Ne(!1),350);return()=>clearTimeout(x)}g.current=p.flowType},[p.flowType,q]);const S=p.flowType,T=S==="buy",w=p.cryptoCurrency||"BTC",E=p.fiatCurrency||"USD",O=T?p.fiatAmount:p.cryptoAmount,P=vt(O),G=(ze=j==null?void 0:j.bestQuote)!=null&&ze.exchangeRate?parseFloat(j.bestQuote.exchangeRate):null,be=l.useRef(null);G&&w&&E&&(be.current={rate:G,crypto:w,fiat:E});const Yt=l.useMemo(()=>{if(j!=null&&j.bestQuote){const x=T?j.bestQuote.cryptoAmount:j.bestQuote.fiatAmount;if(x)return x}return"0"},[j,T]),Qt=l.useMemo(()=>{var L,Q,Be;const x=G||((L=be.current)==null?void 0:L.rate),b=G?w:(Q=be.current)==null?void 0:Q.crypto,A=G?E:(Be=be.current)==null?void 0:Be.fiat;return!x||!b||!A?"":`1 ${b} ≈ ${x.toFixed(2)} ${A}`},[w,E,G]);l.useEffect(()=>{const x=p.walletAddress.trim(),b=p.network;if(!x||x.length<10){J(null),v({type:"SET_WALLET_ERROR",message:""});return}return ge(!0),J(null),clearTimeout(pe.current),pe.current=setTimeout(async()=>{var A,L,Q;try{const Oe=await(await fetch(`${k.apiUrl}/public/validate/address`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:x,...b?{network:b}:{}})})).json(),Pe=((A=Oe.data)==null?void 0:A.attributes)||Oe.data||Oe;if(Pe.isValid)J(!0),v({type:"SET_WALLET_ERROR",message:""});else{J(!1);const na=((L=Pe.errors)==null?void 0:L[0])||((Q=Pe.details)==null?void 0:Q.formatMessage)||"Invalid wallet address";v({type:"SET_WALLET_ERROR",message:na})}}catch{J(null)}finally{ge(!1)}},500),()=>clearTimeout(pe.current)},[p.walletAddress,p.network,k.apiUrl]);const Xe=!O||P===0,$e=P>0&&(T?P<lt:P<ct),Ge=!!M||$e||me&&Xe,Zt=P>0&&!M&&!$e,Le=p.walletAddress.trim().length>=10&&X!==!1&&!re,Se=Zt&&Le&&!!p.cryptoCurrency&&!!p.network,zt=x=>{let b=x.target.value.replace(/[^0-9.,]/g,"");const A=T?2:6,L=b.indexOf(".");L!==-1&&b.length-L-1>A&&(b=b.slice(0,L+A+1)),v(T?{type:"SET_FIAT_AMOUNT",amount:b}:{type:"SET_CRYPTO_AMOUNT",amount:b})},Ve=x=>{x!==S&&v({type:"SET_FLOW_TYPE",flowType:x})},Jt=l.useCallback(x=>{v({type:"SET_FIAT_CURRENCY",currency:x})},[v]),qt=l.useCallback((x,b)=>{v({type:"SET_CRYPTO_CURRENCY",currency:x}),v({type:"SET_CRYPTO_CHAIN",chain:b})},[v]),ea=l.useCallback(x=>{v({type:"SET_PAYMENT_METHOD",methodId:x})},[v]),ta=()=>{Se&&(oe(!0),_())};l.useEffect(()=>{var x;if(!(!Y||K)){if(j!=null&&j.bestQuote)oe(!1),v({type:"SELECT_QUOTE",quote:j.bestQuote}),W().catch(()=>{});else if($)oe(!1),v({type:"SET_ERROR",message:$.message||"No quotes available"});else if(j&&!j.bestQuote){oe(!1);const b=(x=j.unavailableGateways)==null?void 0:x.map(L=>L.reason).filter(Boolean),A=b!=null&&b.length?`No providers available: ${b.join("; ")}`:"No providers available for this currency/network combination";v({type:"SET_ERROR",message:A})}}},[Y,j,K,$,v,W]);const We=U?"theme-dark":"theme-light",Me=Ue.find(x=>x.id===xe)||Ue[0],aa=Me.accent===null,Ye=(s?De(s):!1)?{"--t-accent":s,"--t-cta-bg":s,"--t-cta-text":"#ffffff"}:aa?{"--t-accent":U?"#ffffff":"#111111","--t-cta-bg":U?"#ffffff":"#111111","--t-cta-text":U?"#000000":"#ffffff"}:{"--t-accent":Me.accent,"--t-cta-bg":Me.accent,"--t-cta-text":"#ffffff"},ee={};r&&De(r)?ee.backgroundColor=r:ee.backgroundColor="var(--t-bg)",m&&(ee.backgroundImage=`url(${m})`,ee.backgroundSize="cover",ee.backgroundPosition="center");const je={};d&&De(d)&&(je.border=`1px solid ${d}`),u&&(je.borderRadius=u);const Qe=p.step==="checkout"?e.jsx(Ot,{autoRedirect:i}):p.step==="processing"?e.jsx(Pt,{}):p.step==="complete"?e.jsx(Dt,{explorerUrl:h,doneButtonText:f,onDone:y}):p.step==="error"?e.jsx(Ht,{supportEmail:C}):p.step==="confirm"?e.jsx(Ut,{}):null;if(Qe)return e.jsx("div",{className:`${We} relative w-full max-w-[390px] h-[640px] overflow-hidden flex flex-col select-none transition-colors duration-300 ${t}`,style:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...ee,...Ye,...je},children:Qe});const V=p.network,le=V?Ae(V):null,Ze=(le==null?void 0:le.shortName)||(le==null?void 0:le.name)||V;return e.jsxs("div",{className:`${We} relative w-full max-w-[390px] min-h-[640px] overflow-hidden flex flex-col select-none transition-colors duration-300 ${t}`,style:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...ee,...Ye,...je},children:[e.jsx("div",{className:`flex justify-end items-center px-5 pt-3 ${o?"pb-1":"pb-5"}`,children:e.jsx(Tt,{onClick:()=>H("settings")})}),o?e.jsxs("div",{className:"flex flex-col items-center pt-3 pb-5",children:[e.jsxs("div",{className:"flex",style:{width:165},children:[e.jsx("button",{onClick:()=>Ve("buy"),className:"flex-1 pb-2.5 text-[16px] font-medium text-center transition-colors duration-200",style:{color:S==="buy"?"var(--t-text)":"var(--t-text-secondary)"},children:"Buy"}),e.jsx("button",{onClick:()=>Ve("sell"),className:"flex-1 pb-2.5 text-[16px] font-medium text-center transition-colors duration-200",style:{color:S==="sell"?"var(--t-text)":"var(--t-text-secondary)"},children:"Sell"})]}),e.jsxs("div",{className:"relative",style:{width:165,height:1},children:[e.jsx("div",{className:"absolute inset-0",style:{background:"var(--t-divider)"}}),e.jsx("div",{className:"absolute top-0 h-full transition-all duration-300 ease-in-out",style:{width:"50%",left:S==="buy"?"0%":"50%",background:"var(--t-accent)"}})]})]}):null,q||ve||B?e.jsx(_t,{}):e.jsxs("div",{className:"flex-1 overflow-hidden px-5 flex flex-col tab-fade-in",children:[e.jsxs("div",{className:"px-[18px] pt-[14px] pb-[18px]",style:{background:"var(--t-surface)",borderRadius:5,border:me&&Ge?"1px solid #EF4444":"1px solid transparent",minHeight:102},children:[e.jsx("div",{className:"text-[13px] mb-2.5",style:{color:"var(--t-text-secondary)"},children:"You spend"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("input",{ref:Ie,type:"text",value:O,onChange:zt,onBlur:()=>z(!0),placeholder:T?"250":"0.01",className:"bg-transparent outline-none w-0 flex-1 mr-3",style:{color:"var(--t-text)",fontSize:24,fontWeight:600,lineHeight:"32px",padding:0,border:"none",borderRadius:0,backgroundColor:"transparent",height:"auto",width:0},inputMode:"decimal",disabled:!!((Je=N==null?void 0:N.sourceAmount)!=null&&Je.locked)}),T?e.jsxs("button",{onClick:()=>H("fiat"),className:"flex items-center gap-1.5 shrink-0 transition-colors",style:{background:"var(--t-pill-bg)",borderRadius:4,height:32,paddingLeft:10,paddingRight:10},disabled:!!((qe=N==null?void 0:N.sourceCurrency)!=null&&qe.locked),children:[e.jsx(we,{currencyCode:E,size:16,baseUrl:D}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:E}),e.jsx(ie,{})]}):e.jsxs("div",{className:"flex flex-col items-end shrink-0",children:[e.jsxs("button",{onClick:()=>H("crypto"),className:"flex items-center gap-1.5 transition-colors",style:{background:"var(--t-pill-bg)",borderRadius:4,height:32,paddingLeft:10,paddingRight:10},disabled:!!((et=N==null?void 0:N.destinationCurrency)!=null&&et.locked),children:[e.jsx(Ke,{ticker:w,size:16,baseUrl:D}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:w}),e.jsx(ie,{})]}),V&&e.jsxs("div",{className:"flex items-center gap-1 mt-1.5 mr-0.5",children:[e.jsx("img",{src:Re(V,D),alt:V,width:14,height:14,className:"rounded-full",style:{width:14,height:14}}),e.jsx("span",{className:"text-[12px]",style:{color:"var(--t-text-muted)"},children:Ze})]})]})]})]}),me&&Ge&&e.jsx("div",{className:"text-[12px] mt-1.5 px-[2px]",style:{color:"#EF4444"},children:M||(Xe?"Amount should be more than 0":T?`Minimum amount is ${lt} ${E}`:`Minimum amount is ${ct} ${w}`)}),e.jsxs("div",{className:"px-[18px] pt-[12px] pb-[14px]",style:{background:"var(--t-surface)",borderTopLeftRadius:5,borderTopRightRadius:5,borderBottomLeftRadius:0,borderBottomRightRadius:0,marginTop:4,minHeight:102},children:[e.jsx("div",{className:"text-[13px] mb-2.5",style:{color:"var(--t-text-secondary)"},children:"You get"}),e.jsxs("div",{className:"flex items-start justify-between",children:[K?e.jsx(I,{w:180,h:32}):e.jsx(Kt,{value:P>0?Yt:"0",height:32,className:"font-semibold",style:{color:P>0?"var(--t-text)":"var(--t-text-muted)",fontSize:24}}),T?e.jsxs("div",{className:"flex flex-col items-end shrink-0",children:[e.jsxs("button",{onClick:()=>H("crypto"),className:"flex items-center gap-1.5 transition-colors",style:{background:"var(--t-pill-bg)",borderRadius:4,height:32,paddingLeft:10,paddingRight:10},disabled:!!((tt=N==null?void 0:N.destinationCurrency)!=null&&tt.locked),children:[e.jsx(Ke,{ticker:w,size:16,baseUrl:D}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:w}),e.jsx(ie,{})]}),V&&e.jsxs("div",{className:"flex items-center gap-1 mt-1.5 mr-0.5",children:[e.jsx("img",{src:Re(V,D),alt:V,width:14,height:14,className:"rounded-full",style:{width:14,height:14}}),e.jsx("span",{className:"text-[12px]",style:{color:"var(--t-text-muted)"},children:Ze})]})]}):e.jsxs("button",{onClick:()=>H("fiat"),className:"flex items-center gap-1.5 shrink-0 transition-colors",style:{background:"var(--t-pill-bg)",borderRadius:4,height:32,paddingLeft:10,paddingRight:10},disabled:!!((at=N==null?void 0:N.sourceCurrency)!=null&&at.locked),children:[e.jsx(we,{currencyCode:E,size:16,baseUrl:D}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:E}),e.jsx(ie,{})]})]})]}),e.jsx("div",{className:"flex items-center justify-between mt-[2px] px-[18px] pt-[12px] pb-[14px]",style:{background:"var(--t-surface)",...(nt=R==null?void 0:R.paymentMethods)!=null&&nt.length?{}:{borderBottomLeftRadius:5,borderBottomRightRadius:5}},children:e.jsx("span",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:Qt||" "})}),(R==null?void 0:R.paymentMethods)&&R.paymentMethods.length>0&&e.jsx("div",{className:"mt-[2px]",children:e.jsx(Bt,{methods:R.paymentMethods,selectedId:p.paymentMethodId,onOpenModal:()=>H("payment"),fiatCurrency:p.fiatCurrency})}),e.jsxs("div",{className:"mt-8",children:[e.jsx("div",{className:"text-[13px] mb-2.5",style:{color:"var(--t-text-secondary)"},children:T?"Receiving wallet address":"Sending wallet address"}),e.jsx("input",{type:"text",value:p.walletAddress,onChange:x=>v({type:"SET_WALLET_ADDRESS",address:x.target.value}),onBlur:()=>se(!0),placeholder:T?"Enter your receiving address":"Enter your sending address",spellCheck:!1,autoComplete:"off",className:"w-full bg-transparent text-[13px] outline-none transition-colors",style:{border:p.walletError||ye&&!Le?"1px solid #EF4444":"1px solid var(--t-border)",borderRadius:3.5,height:47,padding:"0 14px",color:"var(--t-text)",fontSize:13,backgroundColor:"transparent"},disabled:!!((st=N==null?void 0:N.destinationAddress)!=null&&st.locked)}),p.walletError?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"#EF4444"},children:p.walletError}):ye&&!Le&&!re?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"#EF4444"},children:"Enter a valid wallet address"}):re&&p.walletAddress.trim().length>=10?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"var(--t-text-muted)"},children:"Validating address..."}):null]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{disabled:!Se||c||Y,onClick:ta,className:"w-full font-semibold text-[16px] transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)",opacity:Se&&!c&&!Y?1:.4,cursor:Se&&!c&&!Y?"pointer":"not-allowed"},children:Y?"Getting best price...":c?"Processing...":T?`Buy ${w}`:`Sell ${w}`}),e.jsx("div",{className:"text-center py-3",children:e.jsx("span",{className:"text-[11px]",style:{color:"var(--t-text-tertiary)"},children:"Powered by NowRamp"})})]},S),e.jsx(he,{isOpen:ne==="fiat",onClose:()=>H(null),children:x=>{var b;return e.jsx(Xt,{onClose:x,onSelect:A=>{Jt(A),x()},currencies:(b=R==null?void 0:R.fiats)==null?void 0:b.map(A=>({code:A.code,name:A.code})),assetBaseUrl:D})}}),e.jsx(he,{isOpen:ne==="crypto",onClose:()=>H(null),children:x=>{var b;return e.jsx($t,{onClose:x,onSelect:(A,L)=>{qt(A,L),x()},cryptos:(b=R==null?void 0:R.cryptos)==null?void 0:b.map(A=>{var L;return{code:A.code,name:A.code,networks:(L=A.networks)==null?void 0:L.map(Q=>({code:Q.id,name:Q.name}))}}),assetBaseUrl:D})}}),e.jsx(he,{isOpen:ne==="payment",onClose:()=>H(null),children:x=>{var b;return e.jsx(ua,{methods:((b=R==null?void 0:R.paymentMethods)==null?void 0:b.filter(A=>A.supportedFiats.includes(p.fiatCurrency)))||[],selectedId:p.paymentMethodId,onSelect:A=>{ea(A),x()},onClose:x})}}),e.jsx(he,{isOpen:ne==="settings",onClose:()=>H(null),children:x=>e.jsx(Vt,{onClose:x,darkMode:U,onToggleDarkMode:F,skinId:xe,onSelectSkin:b=>{ue(b)}})})]})}function Wt({projectId:t,apiUrl:a,assetBaseUrl:n,flowType:s,customerId:r,defaultFiatCurrency:m,defaultCryptoCurrency:d,defaultNetwork:u,defaultFiatAmount:o,defaultCryptoAmount:i,defaultWalletAddress:h,defaultGateway:f,fieldLocks:C,statusPollInterval:y,onComplete:p,onError:v,className:R,theme:B,skinId:j,accentColor:K,bgColor:$,bgImage:_,borderColor:W,borderRadius:c,showFlowToggle:M,autoRedirect:N,explorerUrl:k,doneButtonText:D,supportEmail:U,onDone:F}){return e.jsx(xt,{projectId:t,apiUrl:a,assetBaseUrl:n,flowType:s,customerId:r,defaultFiatCurrency:m,defaultCryptoCurrency:d,defaultNetwork:u,defaultFiatAmount:o,defaultCryptoAmount:i,defaultWalletAddress:h,defaultGateway:f,fieldLocks:C,statusPollInterval:y,onComplete:p,onError:v,children:e.jsx(pa,{className:R,theme:B,skinId:j,accentColor:K,bgColor:$,bgImage:_,borderColor:W,borderRadius:c,showFlowToggle:M,autoRedirect:N,explorerUrl:k,doneButtonText:D,supportEmail:U,onDone:F})})}function ha({submitButtonText:t,rateRefreshInterval:a,...n}){return e.jsx(Wt,{...n})}function fa({skin:t,active:a,onClick:n,darkMode:s,dimmed:r}){const m=t.accent===null,d=32;return e.jsxs("button",{onClick:n,className:"relative shrink-0",style:{width:d,height:d,opacity:r?.4:1,transition:"opacity 0.2s"},children:[m?e.jsxs("svg",{width:d,height:d,viewBox:"0 0 32 32",children:[e.jsx("clipPath",{id:"mono-left",children:e.jsx("rect",{x:"0",y:"0",width:"16",height:"32"})}),e.jsx("clipPath",{id:"mono-right",children:e.jsx("rect",{x:"16",y:"0",width:"16",height:"32"})}),e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:"#111111",clipPath:"url(#mono-left)"}),e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:"#ffffff",clipPath:"url(#mono-right)"}),e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:"none",stroke:s?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.1)",strokeWidth:"1"})]}):e.jsx("svg",{width:d,height:d,viewBox:"0 0 32 32",children:e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:t.accent})}),a&&!r&&e.jsx("div",{className:"absolute inset-0 rounded-full",style:{boxShadow:"0 0 0 2px var(--t-bg), 0 0 0 4px var(--t-text)"}})]})}function xa({quote:t}){return t.isBestRate?e.jsx("div",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:"Best price"}):t.isRecommended?e.jsx("div",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:"Recommended"}):t.rank&&t.rank<=3?e.jsxs("div",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:["#",t.rank]}):null}function ya({quote:t}){return t.gatewayLogo?e.jsx("img",{src:t.gatewayLogo,alt:t.gatewayName,width:36,height:36,className:"rounded-full shrink-0",style:{width:36,height:36}}):e.jsx(ke,{size:36})}function ga(){return e.jsx("div",{className:"space-y-2",children:[0,1,2].map(t=>e.jsxs("div",{className:"w-full flex items-center gap-3.5",style:{borderRadius:5,height:64,paddingLeft:16,paddingRight:16,background:"var(--t-surface)"},children:[e.jsx(I,{w:36,h:36,className:"rounded-full shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx(I,{w:90,h:14,className:"mb-1.5"}),e.jsx(I,{w:60,h:12})]}),e.jsxs("div",{className:"text-right",children:[e.jsx(I,{w:40,h:10,className:"mb-1.5"}),e.jsx(I,{w:80,h:14})]})]},t))})}function Ca({onClose:t,onSelect:a,quotes:n,quotesLoading:s,cryptoCurrency:r}){const[m,d]=l.useState(""),u=l.useMemo(()=>{if(!(n!=null&&n.quotes))return[];const o=m.trim().toLowerCase();return o?n.quotes.filter(i=>i.gatewayName.toLowerCase().includes(o)):n.quotes},[n,m]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(de,{onClick:t})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)",fontSize:17,fontWeight:500,marginTop:8,marginBottom:24},children:"Choose Ramp"}),e.jsx(fe,{value:m,onChange:d}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5 space-y-2",children:[s?e.jsx(ga,{}):u.length===0?e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:n&&n.quotes.length===0?"No quotes available for this request":"No providers found"}):u.map((o,i)=>{const h=i===0,f=parseFloat(o.cryptoAmount),C=f>=1?f.toFixed(4):f.toPrecision(6);return e.jsxs("button",{onClick:()=>a(o),className:"w-full flex items-center gap-3.5 transition-colors",style:{borderRadius:h?4.5:5,height:h?63:64,paddingLeft:16,paddingRight:16,border:h?"1px solid var(--t-border)":"1px solid transparent",background:h?"transparent":"var(--t-surface)"},children:[e.jsx(ya,{quote:o}),e.jsxs("div",{className:"text-left flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-[15px]",style:{color:"var(--t-text)"},children:o.gatewayName}),e.jsx(xa,{quote:o})]}),e.jsxs("div",{className:"text-right shrink-0",children:[e.jsx("div",{className:"text-[11px]",style:{color:"var(--t-text-secondary)"},children:"You get"}),e.jsxs("div",{className:"font-medium text-[14px]",style:{color:"var(--t-text)"},children:[r," ",C]})]})]},o.gatewayId)}),!s&&(n==null?void 0:n.unavailableGateways)&&n.unavailableGateways.length>0&&e.jsx("div",{className:"pt-3",children:n.unavailableGateways.map(o=>e.jsxs("div",{className:"flex items-center justify-between py-2 text-[12px]",style:{color:"var(--t-text-muted)"},children:[e.jsx("span",{children:o.gatewayName}),e.jsx("span",{children:o.reason})]},o.gatewayId))})]})]})}exports.AnimatedDigit=Ft;exports.AnimatedNumber=Kt;exports.ApplePayIcon=jt;exports.BLOCKCHAINS=Ee;exports.BankIcon=bt;exports.CRYPTO_CHAIN_COMBOS=Nt;exports.CRYPTO_CURRENCIES=yt;exports.CardIcon=Rt;exports.CheckoutForm=ha;exports.CheckoutStep=Ot;exports.ChevronDown=ie;exports.ChevronRight=wt;exports.ChooseRampModal=Ca;exports.CloseButton=de;exports.CoinifyIcon=la;exports.CompleteStep=Dt;exports.ConfirmStep=Ut;exports.CryptoCurrencyModal=$t;exports.CryptoIcon=Ke;exports.DarkModeIcon=kt;exports.ErrorStep=Ht;exports.FIAT_CURRENCIES=He;exports.FIAT_TO_COUNTRY=gt;exports.FiatCurrencyModal=Xt;exports.FiatFlag=we;exports.FormSkeleton=_t;exports.GenericCoinIcon=ke;exports.GooglePayIcon=Et;exports.MOCK_RATES=Fe;exports.MenuIcon=Tt;exports.Modal=he;exports.PayPalIcon=At;exports.PaymentMethodSelector=Bt;exports.ProcessingStep=Pt;exports.RampForm=Wt;exports.RampProvider=xt;exports.RevolutIcon=St;exports.SKINS=Ue;exports.SearchInput=fe;exports.SettingsScreen=Vt;exports.Skeleton=I;exports.SkinSwatch=fa;exports.ToggleSwitch=Gt;exports.formatOutput=oa;exports.getChainIconUrl=Re;exports.getCryptoIconUrl=_e;exports.getFiatFlagUrl=Ct;exports.getMockRate=ra;exports.getPaymentIcon=It;exports.parseAmount=vt;exports.useCheckoutIntent=mt;exports.useQuotes=ut;exports.useRamp=ae;exports.useRampConfig=dt;exports.useTransaction=pt;
12
12
  //# sourceMappingURL=index.cjs.map