@nowramp/form 0.1.40 → 0.1.41
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 +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +170 -149
- package/dist/index.js.map +1 -1
- package/dist/nowramp-form.iife.js +6 -6
- package/dist/nowramp-form.iife.js.map +1 -1
- package/package.json +2 -2
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"),we=require("@nowramp/sdk");function ct(t,a){const[n,o]=l.useState(null),[s,u]=l.useState(!0),[m,i]=l.useState(null),r=l.useRef(null);(!r.current||r.current!==t)&&(r.current=new we.RampApi({apiKey:"",...t}));const d=l.useCallback(async()=>{if(!t.projectId){i(new Error("projectId is required")),u(!1);return}u(!0),i(null);try{const h=await r.current.getSupported(a);o(h)}catch(h){i(h instanceof Error?h:new Error("Failed to fetch config"))}finally{u(!1)}},[t.projectId,a]);return l.useEffect(()=>{d()},[d]),{config:n,loading:s,error:m,refetch:d}}function it(t,a){const[n,o]=l.useState(null),[s,u]=l.useState(!1),[m,i]=l.useState(null),r=l.useRef(null),d=l.useRef(""),h=`${t.apiUrl}|${t.projectId}`;(!r.current||d.current!==h)&&(r.current=new we.RampApi({apiKey:"",...t}),d.current=h);const f=l.useRef(0);l.useEffect(()=>{const g=++f.current;if(!a||!t.projectId){o(null),u(!1);return}u(!0),i(null),r.current.getQuotes(a).then(p=>{f.current===g&&(o(p),u(!1))},p=>{f.current===g&&(i(p instanceof Error?p:new Error("Failed to fetch quotes")),o(null),u(!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 y=l.useCallback(async()=>{if(!(!a||!t.projectId)){u(!0),i(null);try{const g=await r.current.getQuotes(a);o(g)}catch(g){i(g instanceof Error?g:new Error("Failed to fetch quotes"))}finally{u(!1)}}},[t.projectId,a]);return{quotes:n,loading:s,error:m,refetch:y}}function dt(t){const[a,n]=l.useState(null),[o,s]=l.useState(!1),[u,m]=l.useState(null),i=l.useRef(null),r=l.useRef(""),d=`${t.apiUrl}|${t.projectId}`;(!i.current||r.current!==d)&&(i.current=new we.RampApi({apiKey:"",...t}),r.current=d);const h=l.useCallback(async y=>{s(!0),m(null);try{const g=await i.current.createCheckoutIntent(y);return n(g),g}catch(g){const p=g instanceof Error?g:new Error("Failed to create checkout intent");throw m(p),p}finally{s(!1)}},[]),f=l.useCallback(()=>{n(null),m(null)},[]);return{order:a,loading:o,error:u,createOrder:h,reset:f}}function ut(t,a,n){const[o,s]=l.useState(null),[u,m]=l.useState(!1),[i,r]=l.useState(null),d=l.useRef(null);d.current||(d.current=new we.RampApi({apiKey:"",projectId:"",...t}));const h=l.useCallback(async()=>{if(a){m(!0),r(null);try{const f=await d.current.getTransaction(a);s(f)}catch(f){r(f instanceof Error?f:new Error("Failed to fetch status"))}finally{m(!1)}}},[a]);return l.useEffect(()=>{if(!a)return;const f=(n==null?void 0:n.initialDelay)??0;if(f>0){const y=setTimeout(h,f);return()=>clearTimeout(y)}h()},[h,a,n==null?void 0:n.initialDelay]),l.useEffect(()=>{if(!a||!(n!=null&&n.pollInterval)||!o||["completed","failed","cancelled","expired","refunded"].includes(o.status))return;const y=setInterval(h,n.pollInterval);return()=>clearInterval(y)},[a,n==null?void 0:n.pollInterval,o==null?void 0:o.status,h]),{status:o,loading:u,error:i,refetch:h}}function st(t,a){if(!t)return t;const n=t.indexOf(".");if(n===-1)return t;let o=t;return o.length-n-1>a&&(o=o.slice(0,n+a+1)),o=o.replace(/0+$/,"").replace(/\.$/,""),o}const mt={step:"amount",flowType:"buy",fiatCurrency:"USD",fiatAmount:"",cryptoCurrency:"",cryptoAmount:"",network:"",paymentMethodId:"",walletAddress:"",walletError:null,selectedProvider:null,selectedQuote:null,customerId:"",email:"",country:"",errorMessage:null};function ta(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 mt;default:return t}}const pt=l.createContext(null);function ht({projectId:t,apiUrl:a="https://api.nowramp.com",assetBaseUrl:n="",flowType:o="buy",customerId:s="",defaultFiatCurrency:u="USD",defaultCryptoCurrency:m="BTC",defaultNetwork:i="",defaultFiatAmount:r="",defaultCryptoAmount:d="",defaultWalletAddress:h="",defaultGateway:f,fieldLocks:y,statusPollInterval:g=5e3,onComplete:p,onError:N,children:A}){const O=l.useMemo(()=>({apiUrl:a,projectId:t}),[a,t]),j=i||(m?m.toLowerCase():""),D=o==="sell",$=D?!!d:!!r,Y=(D?!!($&&m&&j):!!($&&m&&j&&h))&&f?"confirm":"amount",[c,M]=l.useReducer(ta,{...mt,step:Y,flowType:o,fiatCurrency:u,cryptoCurrency:m,network:j,fiatAmount:st(r,2),cryptoAmount:st(d,6),walletAddress:h,customerId:s}),v=c.flowType==="sell",{config:T,loading:P,error:H}=ct(O,c.flowType);l.useEffect(()=>{var E,w,R;if(!T||!c.cryptoCurrency||c.network)return;const C=(E=T.cryptos)==null?void 0:E.find(B=>B.code===c.cryptoCurrency),S=((w=C==null?void 0:C.networks)==null?void 0:w.find(B=>B.isDefault))||((R=C==null?void 0:C.networks)==null?void 0:R[0]);S!=null&&S.id&&M({type:"SET_NETWORK",network:S.id})},[T,c.cryptoCurrency,c.network]),l.useEffect(()=>{var w,R;if(!((w=T==null?void 0:T.paymentMethods)!=null&&w.length))return;const C=c.fiatCurrency,S=T.paymentMethods;if(c.paymentMethodId&&S.some(X=>X.id===c.paymentMethodId&&X.supportedFiats.includes(C)))return;const E=S.find(B=>B.supportedFiats.includes(C));M({type:"SET_PAYMENT_METHOD",methodId:(E==null?void 0:E.id)||((R=S[0])==null?void 0:R.id)||""})},[T,c.fiatCurrency,c.paymentMethodId]);const U=l.useMemo(()=>{if(v){if(!c.cryptoAmount)return null;const R=parseFloat(c.cryptoAmount);return isNaN(R)||R<=0?"Enter a valid amount":null}if(!T||!c.fiatAmount)return null;const C=parseFloat(c.fiatAmount);if(isNaN(C))return null;const S=T.fiats.find(R=>R.code===c.fiatCurrency);if(!S)return null;const E=parseFloat(S.minAmount),w=parseFloat(S.maxAmount);return!isNaN(E)&&C<E?`Minimum amount is ${S.minAmount} ${c.fiatCurrency}`:!isNaN(w)&&C>w?`Maximum amount is ${S.maxAmount} ${c.fiatCurrency}`:null},[T,c.fiatAmount,c.fiatCurrency,c.cryptoAmount,v]),ye=l.useMemo(()=>{const C=v?!!c.cryptoAmount:!!c.fiatAmount;return!T||!C||!c.cryptoCurrency||!c.network||U?null:{fiatCurrency:c.fiatCurrency,...v?{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}},[T,c.fiatCurrency,c.fiatAmount,c.cryptoAmount,c.cryptoCurrency,c.network,c.paymentMethodId,c.country,U,v,c.flowType]),{quotes:de,loading:ue,error:K,refetch:me}=it(O,ye),{order:Z,loading:ge,error:ae,createOrder:ne}=dt(O),Ce=15e3,{status:_,loading:J}=ut({apiUrl:a},(Z==null?void 0:Z.orderId)??null,{pollInterval:g,initialDelay:Ce});l.useEffect(()=>{(_==null?void 0:_.status)==="completed"&&p&&p(_)},[_==null?void 0:_.status,p]),l.useEffect(()=>{const C=H||ae;C&&N&&N(C)},[H,ae,N]);const z=f||(T==null?void 0:T.defaultGateway)||null,ve=l.useRef(z);ve.current=z;const Ne=l.useRef(de);Ne.current=de;const Se=l.useCallback(async()=>{var S,E,w;const C=((S=c.selectedQuote)==null?void 0:S.gatewayId)||((w=(E=Ne.current)==null?void 0:E.bestQuote)==null?void 0:w.gatewayId)||ve.current;if(!C||!c.walletAddress){const R=[!C&&"gateway",!c.walletAddress&&"walletAddress"].filter(Boolean).join(", ");M({type:"SET_ERROR",message:`Missing required fields: ${R}`});return}try{await ne({gateway:C,customerId:c.customerId||void 0,fiatCurrency:c.fiatCurrency,...v?{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(R){const B=R instanceof Error?R.message:"Failed to create order";/wallet|address/i.test(B)?M({type:"SET_WALLET_ERROR",message:B.replace(/^Failed to create checkout intent:\s*/i,"")}):M({type:"SET_ERROR",message:B})}},[c,ne,v]),V=l.useCallback(C=>{M({type:"SET_STEP",step:C})},[]),se=l.useCallback(()=>{const C=["confirm","amount","quotes","wallet","checkout","processing","complete"],S=C.indexOf(c.step);S>0&&M({type:"SET_STEP",step:C[S-1]})},[c.step,v]),ke=l.useMemo(()=>{const C=v?!!c.cryptoAmount:!!c.fiatAmount;switch(c.step){case"confirm":return!!(C&&c.cryptoCurrency&&c.network&&c.walletAddress&&!U);case"amount":return!!(C&&c.cryptoCurrency&&c.network&&!U);case"quotes":return!!c.selectedQuote;case"wallet":return!!c.walletAddress;default:return!1}},[c,U,v]),pe={apiConfig:O,assetBaseUrl:n,config:T,configLoading:P,configError:H,state:c,dispatch:M,quotes:de,quotesLoading:ue,quotesError:K,fetchQuotes:me,order:Z,orderLoading:ge,orderError:ae,createOrder:Se,orderStatus:_,orderStatusLoading:J,fieldLocks:y||null,defaultGateway:z,amountError:U,goToStep:V,goBack:se,canProceed:ke};return e.jsx(pt.Provider,{value:pe,children:A})}function te(){const t=l.useContext(pt);if(!t)throw new Error("useRamp must be used within a RampProvider");return t}const fe={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"}},ft=[{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}],xt={USD:"us",EUR:"eu",GBP:"gb",JPY:"jp",CAD:"ca",AUD:"au",BRL:"br",CHF:"ch",MXN:"mx",INR:"in",ARS:"ar",ALL:"al"};function Ke(t,a=""){return`${a}/crypto-icons/${t.toLowerCase()}.svg`}function yt(t,a=""){const n=xt[t]||"us";return`${a}/flags/${n}.svg`}function Ae(t,a=""){const n=fe[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}],De={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 aa(t,a){var n,o;return((n=De[t])==null?void 0:n[a])??((o=De.USDC)==null?void 0:o[a])??1}function gt(t){return parseFloat(t.replace(/,/g,""))||0}function na(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 Pe=t=>/^#([0-9A-Fa-f]{3}){1,2}$/.test(t),rt=10,ot=1e-4,Ct=(()=>{const t=[];for(const a of ft)for(const n of a.chains)t.push({code:a.code,name:a.name,chain:n,popular:a.popular});return t})();function Fe({ticker:t,size:a=32,baseUrl:n=""}){return e.jsx("img",{src:Ke(t,n),alt:t,width:a,height:a,className:"rounded-full shrink-0",style:{width:a,height:a}})}function Re({currencyCode:t,size:a=16,baseUrl:n=""}){return e.jsx("img",{src:yt(t,n),alt:t,width:a,height:a,className:"rounded-full shrink-0",style:{width:a,height:a}})}function Te({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 vt({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 Nt({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 bt({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 jt({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 Et({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 sa({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 ce(){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 At(){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 Rt({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 wt({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 Tt(t,a=32){switch(t){case"revolut":return e.jsx(Nt,{size:a});case"applepay":return e.jsx(St,{size:a});case"card":return e.jsx(Et,{size:a});case"googlepay":return e.jsx(bt,{size:a});case"paypal":return e.jsx(jt,{size:a});case"bank":return e.jsx(vt,{size:a});default:return e.jsx(Te,{size:a})}}function he({isOpen:t,onClose:a,children:n}){const[o,s]=l.useState(!1),[u,m]=l.useState(!1);l.useEffect(()=>{if(t)s(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>m(!0)));else if(o){m(!1);const r=setTimeout(()=>s(!1),250);return()=>clearTimeout(r)}},[t]);const i=l.useCallback(()=>{m(!1),setTimeout(()=>a(),250)},[a]);return o?e.jsx("div",{className:"absolute inset-0 z-20 transition-opacity duration-250",style:{opacity:u?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:u?"translateY(0)":"translateY(24px)"},children:typeof n=="function"?n(i):n})}):null}function ie({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 xe({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:o=>a(o.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 ra({methods:t,selectedId:a,onSelect:n,onClose:o}){const[s,u]=l.useState(""),m=l.useMemo(()=>{const i=s.trim().toLowerCase();return i?t.filter(r=>r.id.toLowerCase().includes(i)||r.name.toLowerCase().includes(i)||r.description&&r.description.toLowerCase().includes(i)):t},[t,s]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(ie,{onClick:o})}),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(xe,{value:s,onChange:u}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[m.map(i=>{const r=i.id===a;return e.jsxs("button",{onClick:()=>n(i.id),className:"flex items-center gap-4 w-full transition-colors",style:{color:"var(--t-text)",paddingTop:18,paddingBottom:18},children:[e.jsx("span",{className:"flex items-center justify-center shrink-0",style:{width:32,height:32},children:kt(i.id,i.icon,32)}),e.jsx("span",{className:"text-left flex-1",children:e.jsx("span",{className:"font-semibold text-[15px] leading-tight",style:{color:r?"var(--t-accent)":"var(--t-text)"},children:i.name})})]},i.id)}),m.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No payment methods found"})]})]})}const oa={"debit-credit-card":"card","bank-transfer":"bank","apple-pay":"applepay","google-pay":"googlepay",paypal:"paypal",revolut:"revolut"};function kt(t,a,n=24){const o=oa[t];return o?Tt(o,n):a?e.jsx("img",{src:a,alt:"",width:n,height:n,style:{borderRadius:"50%"}}):e.jsx(Te,{size:n})}function It({methods:t,selectedId:a,onSelect:n,fiatCurrency:o}){const[s,u]=l.useState(!1),m=l.useMemo(()=>t.filter(r=>r.supportedFiats.includes(o)),[t,o]),i=m.find(r=>r.id===a)||m[0];return m.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 ",o]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>u(!0),onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&u(!0)},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:i&&kt(i.id,i.icon,20)}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:(i==null?void 0:i.name)||"Select"}),e.jsx(ce,{})]})]}),e.jsx(he,{isOpen:s,onClose:()=>u(!1),children:r=>e.jsx(ra,{methods:m,selectedId:a,onSelect:d=>{n(d),r()},onClose:r})})]})}function Lt({className:t="",iframeHeight:a=600,autoRedirect:n=!1,redirectDelay:o=3e3}){var g;const{order:s,orderStatus:u,goToStep:m,goBack:i}=te(),[r,d]=l.useState(!1),[h,f]=l.useState(null),y=s!=null&&s.checkout.expiresAt?Date.now()>s.checkout.expiresAt:!1;if(l.useEffect(()=>{if((s==null?void 0:s.checkout.method)==="redirect"&&n&&!y){f(Math.ceil(o/1e3));const p=setTimeout(()=>{window.location.href=s.checkout.url},o),N=setInterval(()=>{f(A=>A&&A>1?A-1:null)},1e3);return()=>{clearTimeout(p),clearInterval(N)}}},[s,n,o,y]),l.useEffect(()=>{u&&(u.status==="completed"?m("complete"):["failed","cancelled","expired"].includes(u.status)&&m("error"))},[u==null?void 0:u.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:i,children:"Go Back"})]});if(y)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:i,children:"Start over"})]});if(s.checkout.method==="iframe")return e.jsx("div",{className:`flex flex-col flex-1 ${t}`,children:e.jsxs("div",{className:"relative flex-1",style:{height:a,borderRadius:5,overflow:"hidden",background:"var(--t-surface)"},children:[!r&&e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsx("div",{className:"nramp-spinner"}),e.jsx("p",{className:"text-[14px] mt-4",style:{color:"var(--t-text-secondary)"},children:"Loading checkout..."})]}),e.jsx("iframe",{src:s.checkout.url,style:{display:r?"block":"none",width:"100%",height:"100%",border:"none"},allow:((g=s.checkout.allowedFeatures)==null?void 0:g.join("; "))||"payment; camera; microphone; geolocation; clipboard-read; clipboard-write; accelerometer; gyroscope; magnetometer; fullscreen; autoplay; encrypted-media; web-share",onLoad:()=>d(!0),title:"Provider Checkout"})]})});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."]}),h!==null&&e.jsxs("p",{className:"text-[13px] mb-4",style:{color:"var(--t-text-muted)"},children:["Redirecting in ",h,"..."]}),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:i,children:"Cancel"})]});if(s.checkout.method==="widget"&&s.widgetConfig){const p=la(s.checkout.url,s.widgetConfig);return e.jsx("div",{className:`flex flex-col flex-1 ${t}`,children:e.jsxs("div",{className:"relative flex-1",style:{height:a,borderRadius:5,overflow:"hidden",background:"var(--t-surface)"},children:[!r&&e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsx("div",{className:"nramp-spinner"}),e.jsx("p",{className:"text-[14px] mt-4",style:{color:"var(--t-text-secondary)"},children:"Loading checkout..."})]}),e.jsx("iframe",{src:p,style:{display:r?"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:()=>d(!0),title:"Payment Checkout"})]})})}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:i,children:"Go Back"})]})}function la(t,a){const n=new URL("/en/partner/widget",t);for(const[o,s]of Object.entries(a))s!=null&&s!==""&&n.searchParams.set(o,String(s));return n.toString()}function Mt({className:t=""}){const{orderStatus:a,orderStatusLoading:n,goToStep:o}=te();l.useEffect(()=>{a&&(a.status==="completed"?o("complete"):["failed","cancelled","expired","refunded"].includes(a.status)&&o("error"))},[a==null?void 0:a.status,o]);const s=()=>{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:s()}),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(le,{label:"Order ID",value:a.orderId,mono:!0}),e.jsx(le,{label:"Provider",value:a.gateway}),e.jsx(le,{label:"Amount",value:`${a.fiatAmount} ${a.fiatCurrency}`}),e.jsx(le,{label:"Receiving",value:`${a.cryptoAmount||"..."} ${a.cryptoCurrency}`}),e.jsx(le,{label:"Network",value:a.network}),e.jsx(le,{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 le({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 Ot({className:t="",explorerUrl:a,onDone:n,doneButtonText:o="Done"}){const{orderStatus:s,state:u,dispatch:m}=te(),i=u.flowType==="sell",r=()=>{if(!(s!=null&&s.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[u.network]||f.ethereum).replace("{txHash}",s.transactionHash)}return a.replace("{txHash}",s.transactionHash)},d=()=>{n?n():m({type:"RESET"})},h=r();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:i?"Sale Complete!":"Purchase Complete!"}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:i?`Your ${(s==null?void 0:s.fiatCurrency)||u.fiatCurrency} payout is being processed.`:`Your ${(s==null?void 0:s.cryptoCurrency)||u.cryptoCurrency} has been sent to your wallet.`}),s&&e.jsxs("div",{className:"w-full text-left mb-6",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[e.jsx(Q,{label:i?"Amount Sold":"Amount Received",value:`${s.cryptoAmount} ${s.cryptoCurrency}`,highlight:!0}),e.jsx(Q,{label:i?"Payout Amount":"Amount Paid",value:`${s.fiatAmount} ${s.fiatCurrency}`}),e.jsx(Q,{label:"Network",value:s.network}),e.jsx(Q,{label:"Wallet",value:`${s.walletAddress.slice(0,10)}...${s.walletAddress.slice(-8)}`,mono:!0}),s.transactionHash&&e.jsx(Q,{label:"Transaction",value:`${s.transactionHash.slice(0,10)}...${s.transactionHash.slice(-8)}`,mono:!0}),e.jsx(Q,{label:"Provider",value:s.gateway}),e.jsx(Q,{label:"Order ID",value:s.orderId,mono:!0}),s.completedAt&&e.jsx(Q,{label:"Completed",value:new Date(s.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:d,children:o})]})]})}function Q({label:t,value:a,mono:n,highlight:o}){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:o?"var(--t-success, #10b981)":"var(--t-text)"},children:a})]})}function Bt({className:t="",onRetry:a,supportEmail:n="support@nowramp.com"}){const{state:o,orderStatus:s,dispatch:u,goToStep:m}=te(),i=o.flowType==="sell",r=()=>{if(s)switch(s.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"},d=()=>{if(o.errorMessage)return o.errorMessage;if(s)switch(s.status){case"failed":return i?"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 i?"Your sale was cancelled. No crypto was transferred.":"Your order was cancelled. No payment was processed.";case"expired":return i?"Your order has expired. Please start a new sale.":"Your order has expired. Please start a new purchase.";case"refunded":return i?"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=()=>{u({type:"CLEAR_ERROR"}),a?a():(u({type:"RESET"}),m("amount"))},f=()=>{u({type:"RESET"}),m("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:r()}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:d()}),s&&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:s.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:s.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})]}),s&&e.jsxs("p",{className:"text-[12px] mt-1",style:{color:"var(--t-text-muted)"},children:["Reference: ",s.orderId]})]})]})}function lt(t){return t.length<=12?t:`${t.slice(0,6)}...${t.slice(-6)}`}function Pt({className:t=""}){const{config:a,configLoading:n,state:o,defaultGateway:s,fetchQuotes:u,createOrder:m,orderLoading:i}=te(),r=o.flowType==="sell",[d,h]=l.useState(null),f=a==null?void 0:a.gateways.find(g=>g.id===s),y=async()=>{h(null);try{u(),await m()}catch(g){const p=g instanceof Error?g.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:r?"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})]})]}),r?e.jsxs(e.Fragment,{children:[e.jsx(ee,{label:"You sell",value:`${o.cryptoAmount} ${o.cryptoCurrency}`,highlight:!0}),e.jsx(ee,{label:"You receive",value:`${o.fiatCurrency} payout`})]}):e.jsxs(e.Fragment,{children:[e.jsx(ee,{label:"You pay",value:`${o.fiatAmount} ${o.fiatCurrency}`,highlight:!0}),e.jsx(ee,{label:"You receive",value:`${o.cryptoCurrency} on ${o.network}`}),e.jsx(ee,{label:"Wallet",value:lt(o.walletAddress),mono:!0})]}),e.jsx(ee,{label:"Network",value:o.network}),r&&o.walletAddress&&e.jsx(ee,{label:"Refund address",value:lt(o.walletAddress),mono:!0})]}),d&&e.jsx("p",{className:"text-[12px] mb-4",style:{color:"#EF4444"},children:d}),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:i?.7:1},disabled:i,onClick:y,children:i?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"nramp-spinner-inline"}),"Processing..."]}):r?"Confirm & Sell":"Confirm & Pay"})]})}function ee({label:t,value:a,mono:n,highlight:o}){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:o?"var(--t-success, #10b981)":"var(--t-text)"},children:a})]})}function Ht({char:t,height:a=38}){const n="0123456789",o=n.indexOf(t);return o===-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(-${o*a}px)`},children:n.split("").map(s=>e.jsx("span",{className:"block",style:{height:a,lineHeight:`${a}px`},children:s},s))})})}function Ut({value:t,height:a=38,className:n="",style:o={}}){return e.jsx("span",{className:n,style:{display:"inline-flex",...o},children:t.split("").map((s,u)=>e.jsx(Ht,{char:s,height:a},u))})}function I({w:t,h:a,className:n=""}){return e.jsx("div",{className:`skeleton ${n}`,style:{width:t,height:a}})}function Dt(){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 Ft({onClose:t,onSelect:a,currencies:n,assetBaseUrl:o=""}){const[s,u]=l.useState(""),m=l.useMemo(()=>{if(!n||n.length===0)return He;const r=new Map(He.map(d=>[d.code,d.name]));return n.map(d=>({code:d.code,name:d.name||r.get(d.code)||d.code}))},[n]),i=l.useMemo(()=>{const r=s.trim().toLowerCase();return r?m.filter(d=>d.code.toLowerCase().includes(r)||d.name.toLowerCase().includes(r)):m},[m,s]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(ie,{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(xe,{value:s,onChange:u}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[i.map(r=>e.jsxs("button",{onClick:()=>a(r.code),className:"flex items-center gap-3.5 w-full py-3.5 transition-colors",style:{color:"var(--t-text)"},children:[e.jsx(Re,{currencyCode:r.code,size:32,baseUrl:o}),e.jsxs("div",{className:"text-left",children:[e.jsx("div",{className:"font-semibold text-[15px] leading-tight",children:r.code}),e.jsx("div",{className:"text-[13px] mt-0.5",style:{color:"var(--t-text-secondary)"},children:r.name})]})]},r.code)),i.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No currencies found"})]})]})}function Kt({onClose:t,onSelect:a,cryptos:n,assetBaseUrl:o=""}){const[s,u]=l.useState(""),m=l.useMemo(()=>{if(!n||n.length===0)return Ct;const r=[];for(const d of n){const h=d.networks||[];if(h.length===0)r.push({code:d.code,name:d.name||d.code,chain:d.code,popular:!1});else for(const f of h){const y=f.code||f.id||f.name||d.code;r.push({code:d.code,name:d.name||d.code,chain:y,chainName:f.name,popular:!1})}}return r},[n]),i=l.useMemo(()=>{var f;const r=s.trim().toLowerCase();if(!r)return m;const d=r.split(/\s+/),h=[];for(const y of m){const g=fe[y.chain],p=g?g.name.toLowerCase():"",N=((f=g==null?void 0:g.shortName)==null?void 0:f.toLowerCase())||"",A=y.chain.toLowerCase(),O=y.code.toLowerCase(),j=y.name.toLowerCase(),D=[O,j,p,N,A];if(!d.every(Y=>D.some(c=>c.includes(Y))))continue;let F=0;O===r?F+=100:O.startsWith(d[0])&&(F+=50),y.popular&&(F+=10),d.length>1&&(p.includes(d[1])||N.includes(d[1])||A.includes(d[1]))&&(F+=25),h.push({item:y,score:F})}return h.sort((y,g)=>g.score-y.score),h.map(y=>y.item)},[m,s]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(ie,{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(xe,{value:s,onChange:u}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[i.map(r=>{const d=fe[r.chain],h=(d==null?void 0:d.name)||r.chainName||r.chain;return e.jsxs("button",{onClick:()=>a(r.code,r.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:Ke(r.code,o),alt:r.code,width:32,height:32,className:"rounded-full absolute top-0 left-0",style:{width:32,height:32}}),e.jsx("img",{src:Ae(r.chain,o),alt:r.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:r.code}),e.jsx("div",{className:"text-[13px] mt-0.5",style:{color:"var(--t-text-secondary)"},children:r.name})]}),e.jsx("div",{className:"text-right shrink-0",children:e.jsx("div",{className:"text-[13px]",style:{color:"var(--t-text-muted)"},children:h})})]},`${r.code}-${r.chain}`)}),i.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No currencies found"})]})]})}function _t({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 ca=[{label:"Privacy policy",href:"https://nowramp.com/privacy-policy"},{label:"Terms of use",href:"https://nowramp.com/terms-and-conditions"}];function Xt({onClose:t,darkMode:a,onToggleDarkMode:n,skinId:o,onSelectSkin:s}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end items-center px-5 pt-5",children:e.jsx(ie,{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(wt,{size:40}),e.jsx("span",{className:"font-medium text-[15px]",style:{color:"var(--t-text)"},children:"Dark Mode"})]}),e.jsx(_t,{checked:a,onChange:n,accentColor:"#4CD964"})]})}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}}),ca.map(u=>e.jsxs("div",{children:[e.jsxs("a",{href:u.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:u.label}),e.jsx(At,{})]}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}})]},u.label))]})]})}function ia({className:t="",theme:a="dark",skinId:n="mono",accentColor:o,bgColor:s,bgImage:u,borderColor:m,borderRadius:i,showFlowToggle:r=!0,autoRedirect:d=!1,explorerUrl:h,doneButtonText:f="Done",supportEmail:y,onDone:g}){var Ze,Je,ze,qe,et,tt,at,nt;const{state:p,dispatch:N,config:A,configLoading:O,quotes:j,quotesLoading:D,quotesError:$,fetchQuotes:F,createOrder:Y,orderLoading:c,amountError:M,fieldLocks:v,apiConfig:T,assetBaseUrl:P}=te(),[H,U]=l.useState(a==="dark"),[ye,de]=l.useState(n),[ue,K]=l.useState(null),[me,Z]=l.useState(!1),[ge,ae]=l.useState(!1),[ne,Ce]=l.useState(!1),[_,J]=l.useState(null),[z,ve]=l.useState(!0),[Ne,Se]=l.useState(!1),[V,se]=l.useState(!1),ke=l.useRef(null),pe=l.useRef(),C=l.useRef(p.flowType);l.useEffect(()=>{U(a==="dark")},[a]),l.useEffect(()=>{const x=setTimeout(()=>ve(!1),O?0:800);return()=>clearTimeout(x)},[O]),l.useEffect(()=>{if(C.current!==p.flowType&&!z){C.current=p.flowType,Se(!0),Z(!1),ae(!1);const x=setTimeout(()=>Se(!1),350);return()=>clearTimeout(x)}C.current=p.flowType},[p.flowType,z]);const S=p.flowType,E=S==="buy",w=p.cryptoCurrency||"BTC",R=p.fiatCurrency||"USD",B=E?p.fiatAmount:p.cryptoAmount,X=gt(B),re=(Ze=j==null?void 0:j.bestQuote)!=null&&Ze.exchangeRate?parseFloat(j.bestQuote.exchangeRate):null,be=l.useRef(null);re&&w&&R&&(be.current={rate:re,crypto:w,fiat:R});const Gt=l.useMemo(()=>{if(j!=null&&j.bestQuote){const x=E?j.bestQuote.cryptoAmount:j.bestQuote.fiatAmount;if(x)return x}return"0"},[j,E]),Yt=l.useMemo(()=>{var L,W,Me;const x=re||((L=be.current)==null?void 0:L.rate),b=re?w:(W=be.current)==null?void 0:W.crypto,k=re?R:(Me=be.current)==null?void 0:Me.fiat;return!x||!b||!k?"":`1 ${b} ≈ ${x.toFixed(2)} ${k}`},[w,R,re]);l.useEffect(()=>{const x=p.walletAddress.trim(),b=p.network;if(!x||x.length<10){J(null),N({type:"SET_WALLET_ERROR",message:""});return}return Ce(!0),J(null),clearTimeout(pe.current),pe.current=setTimeout(async()=>{var k,L,W;try{const Oe=await(await fetch(`${T.apiUrl}/public/validate/address`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:x,...b?{network:b}:{}})})).json(),Be=((k=Oe.data)==null?void 0:k.attributes)||Oe.data||Oe;if(Be.isValid)J(!0),N({type:"SET_WALLET_ERROR",message:""});else{J(!1);const ea=((L=Be.errors)==null?void 0:L[0])||((W=Be.details)==null?void 0:W.formatMessage)||"Invalid wallet address";N({type:"SET_WALLET_ERROR",message:ea})}}catch{J(null)}finally{Ce(!1)}},500),()=>clearTimeout(pe.current)},[p.walletAddress,p.network,T.apiUrl]);const _e=!B||X===0,Xe=X>0&&(E?X<rt:X<ot),$e=!!M||Xe||me&&_e,Vt=X>0&&!M&&!Xe,Ie=p.walletAddress.trim().length>=10&&_!==!1&&!ne,je=Vt&&Ie&&!!p.cryptoCurrency&&!!p.network,Wt=x=>{let b=x.target.value.replace(/[^0-9.,]/g,"");const k=E?2:6,L=b.indexOf(".");L!==-1&&b.length-L-1>k&&(b=b.slice(0,L+k+1)),N(E?{type:"SET_FIAT_AMOUNT",amount:b}:{type:"SET_CRYPTO_AMOUNT",amount:b})},Ge=x=>{x!==S&&N({type:"SET_FLOW_TYPE",flowType:x})},Qt=l.useCallback(x=>{N({type:"SET_FIAT_CURRENCY",currency:x})},[N]),Zt=l.useCallback((x,b)=>{N({type:"SET_CRYPTO_CURRENCY",currency:x}),N({type:"SET_CRYPTO_CHAIN",chain:b})},[N]),Jt=l.useCallback(x=>{N({type:"SET_PAYMENT_METHOD",methodId:x})},[N]),zt=()=>{je&&(se(!0),F())};l.useEffect(()=>{var x;if(!(!V||D)){if(j!=null&&j.bestQuote)se(!1),N({type:"SELECT_QUOTE",quote:j.bestQuote}),Y().catch(()=>{});else if($)se(!1),N({type:"SET_ERROR",message:$.message||"No quotes available"});else if(j&&!j.bestQuote){se(!1);const b=(x=j.unavailableGateways)==null?void 0:x.map(L=>L.reason).filter(Boolean),k=b!=null&&b.length?`No providers available: ${b.join("; ")}`:"No providers available for this currency/network combination";N({type:"SET_ERROR",message:k})}}},[V,j,D,$,N,Y]);const Ye=H?"theme-dark":"theme-light",Le=Ue.find(x=>x.id===ye)||Ue[0],qt=Le.accent===null,Ve=(o?Pe(o):!1)?{"--t-accent":o,"--t-cta-bg":o,"--t-cta-text":"#ffffff"}:qt?{"--t-accent":H?"#ffffff":"#111111","--t-cta-bg":H?"#ffffff":"#111111","--t-cta-text":H?"#000000":"#ffffff"}:{"--t-accent":Le.accent,"--t-cta-bg":Le.accent,"--t-cta-text":"#ffffff"},q={};s&&Pe(s)?q.backgroundColor=s:q.backgroundColor="var(--t-bg)",u&&(q.backgroundImage=`url(${u})`,q.backgroundSize="cover",q.backgroundPosition="center");const Ee={};m&&Pe(m)&&(Ee.border=`1px solid ${m}`),i&&(Ee.borderRadius=i);const We=p.step==="checkout"?e.jsx(Lt,{autoRedirect:d}):p.step==="processing"?e.jsx(Mt,{}):p.step==="complete"?e.jsx(Ot,{explorerUrl:h,doneButtonText:f,onDone:g}):p.step==="error"?e.jsx(Bt,{supportEmail:y}):p.step==="confirm"?e.jsx(Pt,{}):null;if(We)return e.jsx("div",{className:`${Ye} 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',...q,...Ve,...Ee},children:We});const G=p.network,oe=G?fe[G]:null,Qe=(oe==null?void 0:oe.shortName)||(oe==null?void 0:oe.name)||G;return e.jsxs("div",{className:`${Ye} 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',...q,...Ve,...Ee},children:[e.jsx("div",{className:`flex justify-end items-center px-5 pt-3 ${r?"pb-1":"pb-5"}`,children:e.jsx(Rt,{onClick:()=>K("settings")})}),r?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:()=>Ge("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:()=>Ge("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,z||Ne||O?e.jsx(Dt,{}):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&&$e?"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:ke,type:"text",value:B,onChange:Wt,onBlur:()=>Z(!0),placeholder:E?"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=v==null?void 0:v.sourceAmount)!=null&&Je.locked)}),E?e.jsxs("button",{onClick:()=>K("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:!!((ze=v==null?void 0:v.sourceCurrency)!=null&&ze.locked),children:[e.jsx(Re,{currencyCode:R,size:16,baseUrl:P}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:R}),e.jsx(ce,{})]}):e.jsxs("div",{className:"flex flex-col items-end shrink-0",children:[e.jsxs("button",{onClick:()=>K("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:!!((qe=v==null?void 0:v.destinationCurrency)!=null&&qe.locked),children:[e.jsx(Fe,{ticker:w,size:16,baseUrl:P}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:w}),e.jsx(ce,{})]}),G&&e.jsxs("div",{className:"flex items-center gap-1 mt-1.5 mr-0.5",children:[e.jsx("img",{src:Ae(G,P),alt:G,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:Qe})]})]})]})]}),me&&$e&&e.jsx("div",{className:"text-[12px] mt-1.5 px-[2px]",style:{color:"#EF4444"},children:M||(_e?"Amount should be more than 0":E?`Minimum amount is ${rt} ${R}`:`Minimum amount is ${ot} ${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:[D?e.jsx(I,{w:180,h:32}):e.jsx(Ut,{value:X>0?Gt:"0",height:32,className:"font-semibold",style:{color:X>0?"var(--t-text)":"var(--t-text-muted)",fontSize:24}}),E?e.jsxs("div",{className:"flex flex-col items-end shrink-0",children:[e.jsxs("button",{onClick:()=>K("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=v==null?void 0:v.destinationCurrency)!=null&&et.locked),children:[e.jsx(Fe,{ticker:w,size:16,baseUrl:P}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:w}),e.jsx(ce,{})]}),G&&e.jsxs("div",{className:"flex items-center gap-1 mt-1.5 mr-0.5",children:[e.jsx("img",{src:Ae(G,P),alt:G,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:Qe})]})]}):e.jsxs("button",{onClick:()=>K("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:!!((tt=v==null?void 0:v.sourceCurrency)!=null&&tt.locked),children:[e.jsx(Re,{currencyCode:R,size:16,baseUrl:P}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:R}),e.jsx(ce,{})]})]})]}),e.jsx("div",{className:"flex items-center justify-between mt-[2px] px-[18px] pt-[12px] pb-[14px]",style:{background:"var(--t-surface)",...(at=A==null?void 0:A.paymentMethods)!=null&&at.length?{}:{borderBottomLeftRadius:5,borderBottomRightRadius:5}},children:e.jsx("span",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:Yt||" "})}),(A==null?void 0:A.paymentMethods)&&A.paymentMethods.length>0&&e.jsx("div",{className:"mt-[2px]",children:e.jsx(It,{methods:A.paymentMethods,selectedId:p.paymentMethodId,onSelect:Jt,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:E?"Receiving wallet address":"Sending wallet address"}),e.jsx("input",{type:"text",value:p.walletAddress,onChange:x=>N({type:"SET_WALLET_ADDRESS",address:x.target.value}),onBlur:()=>ae(!0),placeholder:E?"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||ge&&!Ie?"1px solid #EF4444":"1px solid var(--t-border)",borderRadius:3.5,height:47,paddingLeft:14,paddingRight:14,color:"var(--t-text)"},disabled:!!((nt=v==null?void 0:v.destinationAddress)!=null&&nt.locked)}),p.walletError?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"#EF4444"},children:p.walletError}):ge&&!Ie&&!ne?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"#EF4444"},children:"Enter a valid wallet address"}):ne&&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:zt,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...":E?`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:ue==="fiat",onClose:()=>K(null),children:x=>{var b;return e.jsx(Ft,{onClose:x,onSelect:k=>{Qt(k),x()},currencies:(b=A==null?void 0:A.fiats)==null?void 0:b.map(k=>({code:k.code,name:k.code})),assetBaseUrl:P})}}),e.jsx(he,{isOpen:ue==="crypto",onClose:()=>K(null),children:x=>{var b;return e.jsx(Kt,{onClose:x,onSelect:(k,L)=>{Zt(k,L),x()},cryptos:(b=A==null?void 0:A.cryptos)==null?void 0:b.map(k=>{var L;return{code:k.code,name:k.code,networks:(L=k.networks)==null?void 0:L.map(W=>({code:W.id,name:W.name}))}}),assetBaseUrl:P})}}),e.jsx(he,{isOpen:ue==="settings",onClose:()=>K(null),children:x=>e.jsx(Xt,{onClose:x,darkMode:H,onToggleDarkMode:U,skinId:ye,onSelectSkin:b=>{de(b)}})})]})}function $t({projectId:t,apiUrl:a,assetBaseUrl:n,flowType:o,customerId:s,defaultFiatCurrency:u,defaultCryptoCurrency:m,defaultNetwork:i,defaultFiatAmount:r,defaultCryptoAmount:d,defaultWalletAddress:h,defaultGateway:f,fieldLocks:y,statusPollInterval:g,onComplete:p,onError:N,className:A,theme:O,skinId:j,accentColor:D,bgColor:$,bgImage:F,borderColor:Y,borderRadius:c,showFlowToggle:M,autoRedirect:v,explorerUrl:T,doneButtonText:P,supportEmail:H,onDone:U}){return e.jsx(ht,{projectId:t,apiUrl:a,assetBaseUrl:n,flowType:o,customerId:s,defaultFiatCurrency:u,defaultCryptoCurrency:m,defaultNetwork:i,defaultFiatAmount:r,defaultCryptoAmount:d,defaultWalletAddress:h,defaultGateway:f,fieldLocks:y,statusPollInterval:g,onComplete:p,onError:N,children:e.jsx(ia,{className:A,theme:O,skinId:j,accentColor:D,bgColor:$,bgImage:F,borderColor:Y,borderRadius:c,showFlowToggle:M,autoRedirect:v,explorerUrl:T,doneButtonText:P,supportEmail:H,onDone:U})})}function da({submitButtonText:t,rateRefreshInterval:a,...n}){return e.jsx($t,{...n})}function ua({skin:t,active:a,onClick:n,darkMode:o,dimmed:s}){const u=t.accent===null,m=32;return e.jsxs("button",{onClick:n,className:"relative shrink-0",style:{width:m,height:m,opacity:s?.4:1,transition:"opacity 0.2s"},children:[u?e.jsxs("svg",{width:m,height:m,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:o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.1)",strokeWidth:"1"})]}):e.jsx("svg",{width:m,height:m,viewBox:"0 0 32 32",children:e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:t.accent})}),a&&!s&&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 ma({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 pa({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(Te,{size:36})}function ha(){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 fa({onClose:t,onSelect:a,quotes:n,quotesLoading:o,cryptoCurrency:s}){const[u,m]=l.useState(""),i=l.useMemo(()=>{if(!(n!=null&&n.quotes))return[];const r=u.trim().toLowerCase();return r?n.quotes.filter(d=>d.gatewayName.toLowerCase().includes(r)):n.quotes},[n,u]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(ie,{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(xe,{value:u,onChange:m}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5 space-y-2",children:[o?e.jsx(ha,{}):i.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"}):i.map((r,d)=>{const h=d===0,f=parseFloat(r.cryptoAmount),y=f>=1?f.toFixed(4):f.toPrecision(6);return e.jsxs("button",{onClick:()=>a(r),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(pa,{quote:r}),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:r.gatewayName}),e.jsx(ma,{quote:r})]}),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:[s," ",y]})]})]},r.gatewayId)}),!o&&(n==null?void 0:n.unavailableGateways)&&n.unavailableGateways.length>0&&e.jsx("div",{className:"pt-3",children:n.unavailableGateways.map(r=>e.jsxs("div",{className:"flex items-center justify-between py-2 text-[12px]",style:{color:"var(--t-text-muted)"},children:[e.jsx("span",{children:r.gatewayName}),e.jsx("span",{children:r.reason})]},r.gatewayId))})]})]})}exports.AnimatedDigit=Ht;exports.AnimatedNumber=Ut;exports.ApplePayIcon=St;exports.BLOCKCHAINS=fe;exports.BankIcon=vt;exports.CRYPTO_CHAIN_COMBOS=Ct;exports.CRYPTO_CURRENCIES=ft;exports.CardIcon=Et;exports.CheckoutForm=da;exports.CheckoutStep=Lt;exports.ChevronDown=ce;exports.ChevronRight=At;exports.ChooseRampModal=fa;exports.CloseButton=ie;exports.CoinifyIcon=sa;exports.CompleteStep=Ot;exports.ConfirmStep=Pt;exports.CryptoCurrencyModal=Kt;exports.CryptoIcon=Fe;exports.DarkModeIcon=wt;exports.ErrorStep=Bt;exports.FIAT_CURRENCIES=He;exports.FIAT_TO_COUNTRY=xt;exports.FiatCurrencyModal=Ft;exports.FiatFlag=Re;exports.FormSkeleton=Dt;exports.GenericCoinIcon=Te;exports.GooglePayIcon=bt;exports.MOCK_RATES=De;exports.MenuIcon=Rt;exports.Modal=he;exports.PayPalIcon=jt;exports.PaymentMethodSelector=It;exports.ProcessingStep=Mt;exports.RampForm=$t;exports.RampProvider=ht;exports.RevolutIcon=Nt;exports.SKINS=Ue;exports.SearchInput=xe;exports.SettingsScreen=Xt;exports.Skeleton=I;exports.SkinSwatch=ua;exports.ToggleSwitch=_t;exports.formatOutput=na;exports.getChainIconUrl=Ae;exports.getCryptoIconUrl=Ke;exports.getFiatFlagUrl=yt;exports.getMockRate=aa;exports.getPaymentIcon=Tt;exports.parseAmount=gt;exports.useCheckoutIntent=dt;exports.useQuotes=it;exports.useRamp=te;exports.useRampConfig=ct;exports.useTransaction=ut;
|
|
11
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),we=require("@nowramp/sdk");function ct(t,a){const[n,o]=l.useState(null),[s,u]=l.useState(!0),[m,i]=l.useState(null),r=l.useRef(null);(!r.current||r.current!==t)&&(r.current=new we.RampApi({apiKey:"",...t}));const d=l.useCallback(async()=>{if(!t.projectId){i(new Error("projectId is required")),u(!1);return}u(!0),i(null);try{const h=await r.current.getSupported(a);o(h)}catch(h){i(h instanceof Error?h:new Error("Failed to fetch config"))}finally{u(!1)}},[t.projectId,a]);return l.useEffect(()=>{d()},[d]),{config:n,loading:s,error:m,refetch:d}}function it(t,a){const[n,o]=l.useState(null),[s,u]=l.useState(!1),[m,i]=l.useState(null),r=l.useRef(null),d=l.useRef(""),h=`${t.apiUrl}|${t.projectId}`;(!r.current||d.current!==h)&&(r.current=new we.RampApi({apiKey:"",...t}),d.current=h);const f=l.useRef(0);l.useEffect(()=>{const g=++f.current;if(!a||!t.projectId){o(null),u(!1);return}u(!0),i(null),r.current.getQuotes(a).then(p=>{f.current===g&&(o(p),u(!1))},p=>{f.current===g&&(i(p instanceof Error?p:new Error("Failed to fetch quotes")),o(null),u(!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 y=l.useCallback(async()=>{if(!(!a||!t.projectId)){u(!0),i(null);try{const g=await r.current.getQuotes(a);o(g)}catch(g){i(g instanceof Error?g:new Error("Failed to fetch quotes"))}finally{u(!1)}}},[t.projectId,a]);return{quotes:n,loading:s,error:m,refetch:y}}function dt(t){const[a,n]=l.useState(null),[o,s]=l.useState(!1),[u,m]=l.useState(null),i=l.useRef(null),r=l.useRef(""),d=`${t.apiUrl}|${t.projectId}`;(!i.current||r.current!==d)&&(i.current=new we.RampApi({apiKey:"",...t}),r.current=d);const h=l.useCallback(async y=>{s(!0),m(null);try{const g=await i.current.createCheckoutIntent(y);return n(g),g}catch(g){const p=g instanceof Error?g:new Error("Failed to create checkout intent");throw m(p),p}finally{s(!1)}},[]),f=l.useCallback(()=>{n(null),m(null)},[]);return{order:a,loading:o,error:u,createOrder:h,reset:f}}function ut(t,a,n){const[o,s]=l.useState(null),[u,m]=l.useState(!1),[i,r]=l.useState(null),d=l.useRef(null);d.current||(d.current=new we.RampApi({apiKey:"",projectId:"",...t}));const h=l.useCallback(async()=>{if(a){m(!0),r(null);try{const f=await d.current.getTransaction(a);s(f)}catch(f){r(f instanceof Error?f:new Error("Failed to fetch status"))}finally{m(!1)}}},[a]);return l.useEffect(()=>{if(!a)return;const f=(n==null?void 0:n.initialDelay)??0;if(f>0){const y=setTimeout(h,f);return()=>clearTimeout(y)}h()},[h,a,n==null?void 0:n.initialDelay]),l.useEffect(()=>{if(!a||!(n!=null&&n.pollInterval)||!o||["completed","failed","cancelled","expired","refunded"].includes(o.status))return;const y=setInterval(h,n.pollInterval);return()=>clearInterval(y)},[a,n==null?void 0:n.pollInterval,o==null?void 0:o.status,h]),{status:o,loading:u,error:i,refetch:h}}function st(t,a){if(!t)return t;const n=t.indexOf(".");if(n===-1)return t;let o=t;return o.length-n-1>a&&(o=o.slice(0,n+a+1)),o=o.replace(/0+$/,"").replace(/\.$/,""),o}const mt={step:"amount",flowType:"buy",fiatCurrency:"USD",fiatAmount:"",cryptoCurrency:"",cryptoAmount:"",network:"",paymentMethodId:"",walletAddress:"",walletError:null,selectedProvider:null,selectedQuote:null,customerId:"",email:"",country:"",errorMessage:null};function ta(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 mt;default:return t}}const pt=l.createContext(null);function ht({projectId:t,apiUrl:a="https://api.nowramp.com",assetBaseUrl:n="",flowType:o="buy",customerId:s="",defaultFiatCurrency:u="USD",defaultCryptoCurrency:m="BTC",defaultNetwork:i="",defaultFiatAmount:r="",defaultCryptoAmount:d="",defaultWalletAddress:h="",defaultGateway:f,fieldLocks:y,statusPollInterval:g=5e3,onComplete:p,onError:N,children:A}){const O=l.useMemo(()=>({apiUrl:a,projectId:t}),[a,t]),j=i||(m?m.toLowerCase():""),U=o==="sell",$=U?!!d:!!r,Y=(U?!!($&&m&&j):!!($&&m&&j&&h))&&f?"confirm":"amount",[c,M]=l.useReducer(ta,{...mt,step:Y,flowType:o,fiatCurrency:u,cryptoCurrency:m,network:j,fiatAmount:st(r,2),cryptoAmount:st(d,6),walletAddress:h,customerId:s}),v=c.flowType==="sell",{config:T,loading:P,error:D}=ct(O,c.flowType);l.useEffect(()=>{var E,w,R;if(!T||!c.cryptoCurrency||c.network)return;const C=(E=T.cryptos)==null?void 0:E.find(B=>B.code===c.cryptoCurrency),S=((w=C==null?void 0:C.networks)==null?void 0:w.find(B=>B.isDefault))||((R=C==null?void 0:C.networks)==null?void 0:R[0]);S!=null&&S.id&&M({type:"SET_NETWORK",network:S.id})},[T,c.cryptoCurrency,c.network]),l.useEffect(()=>{var w,R;if(!((w=T==null?void 0:T.paymentMethods)!=null&&w.length))return;const C=c.fiatCurrency,S=T.paymentMethods;if(c.paymentMethodId&&S.some(X=>X.id===c.paymentMethodId&&X.supportedFiats.includes(C)))return;const E=S.find(B=>B.supportedFiats.includes(C));M({type:"SET_PAYMENT_METHOD",methodId:(E==null?void 0:E.id)||((R=S[0])==null?void 0:R.id)||""})},[T,c.fiatCurrency,c.paymentMethodId]);const H=l.useMemo(()=>{if(v){if(!c.cryptoAmount)return null;const R=parseFloat(c.cryptoAmount);return isNaN(R)||R<=0?"Enter a valid amount":null}if(!T||!c.fiatAmount)return null;const C=parseFloat(c.fiatAmount);if(isNaN(C))return null;const S=T.fiats.find(R=>R.code===c.fiatCurrency);if(!S)return null;const E=parseFloat(S.minAmount),w=parseFloat(S.maxAmount);return!isNaN(E)&&C<E?`Minimum amount is ${S.minAmount} ${c.fiatCurrency}`:!isNaN(w)&&C>w?`Maximum amount is ${S.maxAmount} ${c.fiatCurrency}`:null},[T,c.fiatAmount,c.fiatCurrency,c.cryptoAmount,v]),ye=l.useMemo(()=>{const C=v?!!c.cryptoAmount:!!c.fiatAmount;return!T||!C||!c.cryptoCurrency||!c.network||H?null:{fiatCurrency:c.fiatCurrency,...v?{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}},[T,c.fiatCurrency,c.fiatAmount,c.cryptoAmount,c.cryptoCurrency,c.network,c.paymentMethodId,c.country,H,v,c.flowType]),{quotes:de,loading:ue,error:K,refetch:me}=it(O,ye),{order:Z,loading:ge,error:ae,createOrder:ne}=dt(O),Ce=15e3,{status:_,loading:J}=ut({apiUrl:a},(Z==null?void 0:Z.orderId)??null,{pollInterval:g,initialDelay:Ce});l.useEffect(()=>{(_==null?void 0:_.status)==="completed"&&p&&p(_)},[_==null?void 0:_.status,p]),l.useEffect(()=>{const C=D||ae;C&&N&&N(C)},[D,ae,N]);const z=f||(T==null?void 0:T.defaultGateway)||null,ve=l.useRef(z);ve.current=z;const Ne=l.useRef(de);Ne.current=de;const Se=l.useCallback(async()=>{var S,E,w;const C=((S=c.selectedQuote)==null?void 0:S.gatewayId)||((w=(E=Ne.current)==null?void 0:E.bestQuote)==null?void 0:w.gatewayId)||ve.current;if(!C||!c.walletAddress){const R=[!C&&"gateway",!c.walletAddress&&"walletAddress"].filter(Boolean).join(", ");M({type:"SET_ERROR",message:`Missing required fields: ${R}`});return}try{await ne({gateway:C,customerId:c.customerId||void 0,fiatCurrency:c.fiatCurrency,...v?{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(R){const B=R instanceof Error?R.message:"Failed to create order";/wallet|address/i.test(B)?M({type:"SET_WALLET_ERROR",message:B.replace(/^Failed to create checkout intent:\s*/i,"")}):M({type:"SET_ERROR",message:B})}},[c,ne,v]),V=l.useCallback(C=>{M({type:"SET_STEP",step:C})},[]),se=l.useCallback(()=>{const C=["confirm","amount","quotes","wallet","checkout","processing","complete"],S=C.indexOf(c.step);S>0&&M({type:"SET_STEP",step:C[S-1]})},[c.step,v]),ke=l.useMemo(()=>{const C=v?!!c.cryptoAmount:!!c.fiatAmount;switch(c.step){case"confirm":return!!(C&&c.cryptoCurrency&&c.network&&c.walletAddress&&!H);case"amount":return!!(C&&c.cryptoCurrency&&c.network&&!H);case"quotes":return!!c.selectedQuote;case"wallet":return!!c.walletAddress;default:return!1}},[c,H,v]),pe={apiConfig:O,assetBaseUrl:n,config:T,configLoading:P,configError:D,state:c,dispatch:M,quotes:de,quotesLoading:ue,quotesError:K,fetchQuotes:me,order:Z,orderLoading:ge,orderError:ae,createOrder:Se,orderStatus:_,orderStatusLoading:J,fieldLocks:y||null,defaultGateway:z,amountError:H,goToStep:V,goBack:se,canProceed:ke};return e.jsx(pt.Provider,{value:pe,children:A})}function te(){const t=l.useContext(pt);if(!t)throw new Error("useRamp must be used within a RampProvider");return t}const fe={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"}},ft=[{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}],xt={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 Ke(t,a=""){return`${a}/crypto-icons/${t.toLowerCase()}.svg`}function yt(t,a=""){const n=xt[t]||"us";return`${a}/flags/${n}.svg`}function Ae(t,a=""){const n=fe[t];return n?`${a}/crypto-icons/${n.icon}.svg`:`${a}/crypto-icons/${t.toLowerCase()}.svg`}const De=[{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"}],He=[{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}],Ue={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 aa(t,a){var n,o;return((n=Ue[t])==null?void 0:n[a])??((o=Ue.USDC)==null?void 0:o[a])??1}function gt(t){return parseFloat(t.replace(/,/g,""))||0}function na(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 Pe=t=>/^#([0-9A-Fa-f]{3}){1,2}$/.test(t),rt=10,ot=1e-4,Ct=(()=>{const t=[];for(const a of ft)for(const n of a.chains)t.push({code:a.code,name:a.name,chain:n,popular:a.popular});return t})();function Fe({ticker:t,size:a=32,baseUrl:n=""}){return e.jsx("img",{src:Ke(t,n),alt:t,width:a,height:a,className:"rounded-full shrink-0",style:{width:a,height:a}})}function Re({currencyCode:t,size:a=16,baseUrl:n=""}){return e.jsx("img",{src:yt(t,n),alt:t,width:a,height:a,className:"rounded-full shrink-0",style:{width:a,height:a}})}function Te({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 vt({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 Nt({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 bt({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 jt({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 Et({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 sa({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 ce(){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 At(){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 Rt({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 wt({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 Tt(t,a=32){switch(t){case"revolut":return e.jsx(Nt,{size:a});case"applepay":return e.jsx(St,{size:a});case"card":return e.jsx(Et,{size:a});case"googlepay":return e.jsx(bt,{size:a});case"paypal":return e.jsx(jt,{size:a});case"bank":return e.jsx(vt,{size:a});default:return e.jsx(Te,{size:a})}}function he({isOpen:t,onClose:a,children:n}){const[o,s]=l.useState(!1),[u,m]=l.useState(!1);l.useEffect(()=>{if(t)s(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>m(!0)));else if(o){m(!1);const r=setTimeout(()=>s(!1),250);return()=>clearTimeout(r)}},[t]);const i=l.useCallback(()=>{m(!1),setTimeout(()=>a(),250)},[a]);return o?e.jsx("div",{className:"absolute inset-0 z-20 transition-opacity duration-250",style:{opacity:u?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:u?"translateY(0)":"translateY(24px)"},children:typeof n=="function"?n(i):n})}):null}function ie({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 xe({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:o=>a(o.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 ra({methods:t,selectedId:a,onSelect:n,onClose:o}){const[s,u]=l.useState(""),m=l.useMemo(()=>{const i=s.trim().toLowerCase();return i?t.filter(r=>r.id.toLowerCase().includes(i)||r.name.toLowerCase().includes(i)||r.description&&r.description.toLowerCase().includes(i)):t},[t,s]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(ie,{onClick:o})}),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(xe,{value:s,onChange:u}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[m.map(i=>{const r=i.id===a;return e.jsxs("button",{onClick:()=>n(i.id),className:"flex items-center gap-4 w-full transition-colors",style:{color:"var(--t-text)",paddingTop:18,paddingBottom:18},children:[e.jsx("span",{className:"flex items-center justify-center shrink-0",style:{width:32,height:32},children:kt(i.id,i.icon,32)}),e.jsx("span",{className:"text-left flex-1",children:e.jsx("span",{className:"font-semibold text-[15px] leading-tight",style:{color:r?"var(--t-accent)":"var(--t-text)"},children:i.name})})]},i.id)}),m.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No payment methods found"})]})]})}const oa={"debit-credit-card":"card","bank-transfer":"bank","apple-pay":"applepay","google-pay":"googlepay",paypal:"paypal",revolut:"revolut"};function kt(t,a,n=24){const o=oa[t];return o?Tt(o,n):a?e.jsx("img",{src:a,alt:"",width:n,height:n,style:{borderRadius:"50%"}}):e.jsx(Te,{size:n})}function It({methods:t,selectedId:a,onSelect:n,fiatCurrency:o}){const[s,u]=l.useState(!1),m=l.useMemo(()=>t.filter(r=>r.supportedFiats.includes(o)),[t,o]),i=m.find(r=>r.id===a)||m[0];return m.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 ",o]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>u(!0),onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&u(!0)},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:i&&kt(i.id,i.icon,20)}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:(i==null?void 0:i.name)||"Select"}),e.jsx(ce,{})]})]}),e.jsx(he,{isOpen:s,onClose:()=>u(!1),children:r=>e.jsx(ra,{methods:m,selectedId:a,onSelect:d=>{n(d),r()},onClose:r})})]})}function Lt({className:t="",iframeHeight:a=600,autoRedirect:n=!1,redirectDelay:o=3e3}){var g;const{order:s,orderStatus:u,goToStep:m,goBack:i}=te(),[r,d]=l.useState(!1),[h,f]=l.useState(null),y=s!=null&&s.checkout.expiresAt?Date.now()>s.checkout.expiresAt:!1;if(l.useEffect(()=>{if((s==null?void 0:s.checkout.method)==="redirect"&&n&&!y){f(Math.ceil(o/1e3));const p=setTimeout(()=>{window.location.href=s.checkout.url},o),N=setInterval(()=>{f(A=>A&&A>1?A-1:null)},1e3);return()=>{clearTimeout(p),clearInterval(N)}}},[s,n,o,y]),l.useEffect(()=>{u&&(u.status==="completed"?m("complete"):["failed","cancelled","expired"].includes(u.status)&&m("error"))},[u==null?void 0:u.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:i,children:"Go Back"})]});if(y)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:i,children:"Start over"})]});if(s.checkout.method==="iframe")return e.jsx("div",{className:`flex flex-col flex-1 ${t}`,children:e.jsxs("div",{className:"relative flex-1",style:{height:a,borderRadius:5,overflow:"hidden",background:"var(--t-surface)"},children:[!r&&e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsx("div",{className:"nramp-spinner"}),e.jsx("p",{className:"text-[14px] mt-4",style:{color:"var(--t-text-secondary)"},children:"Loading checkout..."})]}),e.jsx("iframe",{src:s.checkout.url,style:{display:r?"block":"none",width:"100%",height:"100%",border:"none"},allow:((g=s.checkout.allowedFeatures)==null?void 0:g.join("; "))||"payment; camera; microphone; geolocation; clipboard-read; clipboard-write; accelerometer; gyroscope; magnetometer; fullscreen; autoplay; encrypted-media; web-share",onLoad:()=>d(!0),title:"Provider Checkout"})]})});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."]}),h!==null&&e.jsxs("p",{className:"text-[13px] mb-4",style:{color:"var(--t-text-muted)"},children:["Redirecting in ",h,"..."]}),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:i,children:"Cancel"})]});if(s.checkout.method==="widget"&&s.widgetConfig){const p=la(s.checkout.url,s.widgetConfig);return e.jsx("div",{className:`flex flex-col flex-1 ${t}`,children:e.jsxs("div",{className:"relative flex-1",style:{height:a,borderRadius:5,overflow:"hidden",background:"var(--t-surface)"},children:[!r&&e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsx("div",{className:"nramp-spinner"}),e.jsx("p",{className:"text-[14px] mt-4",style:{color:"var(--t-text-secondary)"},children:"Loading checkout..."})]}),e.jsx("iframe",{src:p,style:{display:r?"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:()=>d(!0),title:"Payment Checkout"})]})})}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:i,children:"Go Back"})]})}function la(t,a){const n=new URL("/en/partner/widget",t);for(const[o,s]of Object.entries(a))s!=null&&s!==""&&n.searchParams.set(o,String(s));return n.toString()}function Mt({className:t=""}){const{orderStatus:a,orderStatusLoading:n,goToStep:o}=te();l.useEffect(()=>{a&&(a.status==="completed"?o("complete"):["failed","cancelled","expired","refunded"].includes(a.status)&&o("error"))},[a==null?void 0:a.status,o]);const s=()=>{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:s()}),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(le,{label:"Order ID",value:a.orderId,mono:!0}),e.jsx(le,{label:"Provider",value:a.gateway}),e.jsx(le,{label:"Amount",value:`${a.fiatAmount} ${a.fiatCurrency}`}),e.jsx(le,{label:"Receiving",value:`${a.cryptoAmount||"..."} ${a.cryptoCurrency}`}),e.jsx(le,{label:"Network",value:a.network}),e.jsx(le,{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 le({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 Ot({className:t="",explorerUrl:a,onDone:n,doneButtonText:o="Done"}){const{orderStatus:s,state:u,dispatch:m}=te(),i=u.flowType==="sell",r=()=>{if(!(s!=null&&s.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[u.network]||f.ethereum).replace("{txHash}",s.transactionHash)}return a.replace("{txHash}",s.transactionHash)},d=()=>{n?n():m({type:"RESET"})},h=r();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:i?"Sale Complete!":"Purchase Complete!"}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:i?`Your ${(s==null?void 0:s.fiatCurrency)||u.fiatCurrency} payout is being processed.`:`Your ${(s==null?void 0:s.cryptoCurrency)||u.cryptoCurrency} has been sent to your wallet.`}),s&&e.jsxs("div",{className:"w-full text-left mb-6",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[e.jsx(Q,{label:i?"Amount Sold":"Amount Received",value:`${s.cryptoAmount} ${s.cryptoCurrency}`,highlight:!0}),e.jsx(Q,{label:i?"Payout Amount":"Amount Paid",value:`${s.fiatAmount} ${s.fiatCurrency}`}),e.jsx(Q,{label:"Network",value:s.network}),e.jsx(Q,{label:"Wallet",value:`${s.walletAddress.slice(0,10)}...${s.walletAddress.slice(-8)}`,mono:!0}),s.transactionHash&&e.jsx(Q,{label:"Transaction",value:`${s.transactionHash.slice(0,10)}...${s.transactionHash.slice(-8)}`,mono:!0}),e.jsx(Q,{label:"Provider",value:s.gateway}),e.jsx(Q,{label:"Order ID",value:s.orderId,mono:!0}),s.completedAt&&e.jsx(Q,{label:"Completed",value:new Date(s.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:d,children:o})]})]})}function Q({label:t,value:a,mono:n,highlight:o}){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:o?"var(--t-success, #10b981)":"var(--t-text)"},children:a})]})}function Bt({className:t="",onRetry:a,supportEmail:n="support@nowramp.com"}){const{state:o,orderStatus:s,dispatch:u,goToStep:m}=te(),i=o.flowType==="sell",r=()=>{if(s)switch(s.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"},d=()=>{if(o.errorMessage)return o.errorMessage;if(s)switch(s.status){case"failed":return i?"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 i?"Your sale was cancelled. No crypto was transferred.":"Your order was cancelled. No payment was processed.";case"expired":return i?"Your order has expired. Please start a new sale.":"Your order has expired. Please start a new purchase.";case"refunded":return i?"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=()=>{u({type:"CLEAR_ERROR"}),a?a():(u({type:"RESET"}),m("amount"))},f=()=>{u({type:"RESET"}),m("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:r()}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:d()}),s&&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:s.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:s.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})]}),s&&e.jsxs("p",{className:"text-[12px] mt-1",style:{color:"var(--t-text-muted)"},children:["Reference: ",s.orderId]})]})]})}function lt(t){return t.length<=12?t:`${t.slice(0,6)}...${t.slice(-6)}`}function Pt({className:t=""}){const{config:a,configLoading:n,state:o,defaultGateway:s,fetchQuotes:u,createOrder:m,orderLoading:i}=te(),r=o.flowType==="sell",[d,h]=l.useState(null),f=a==null?void 0:a.gateways.find(g=>g.id===s),y=async()=>{h(null);try{u(),await m()}catch(g){const p=g instanceof Error?g.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:r?"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})]})]}),r?e.jsxs(e.Fragment,{children:[e.jsx(ee,{label:"You sell",value:`${o.cryptoAmount} ${o.cryptoCurrency}`,highlight:!0}),e.jsx(ee,{label:"You receive",value:`${o.fiatCurrency} payout`})]}):e.jsxs(e.Fragment,{children:[e.jsx(ee,{label:"You pay",value:`${o.fiatAmount} ${o.fiatCurrency}`,highlight:!0}),e.jsx(ee,{label:"You receive",value:`${o.cryptoCurrency} on ${o.network}`}),e.jsx(ee,{label:"Wallet",value:lt(o.walletAddress),mono:!0})]}),e.jsx(ee,{label:"Network",value:o.network}),r&&o.walletAddress&&e.jsx(ee,{label:"Refund address",value:lt(o.walletAddress),mono:!0})]}),d&&e.jsx("p",{className:"text-[12px] mb-4",style:{color:"#EF4444"},children:d}),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:i?.7:1},disabled:i,onClick:y,children:i?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"nramp-spinner-inline"}),"Processing..."]}):r?"Confirm & Sell":"Confirm & Pay"})]})}function ee({label:t,value:a,mono:n,highlight:o}){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:o?"var(--t-success, #10b981)":"var(--t-text)"},children:a})]})}function Dt({char:t,height:a=38}){const n="0123456789",o=n.indexOf(t);return o===-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(-${o*a}px)`},children:n.split("").map(s=>e.jsx("span",{className:"block",style:{height:a,lineHeight:`${a}px`},children:s},s))})})}function Ht({value:t,height:a=38,className:n="",style:o={}}){return e.jsx("span",{className:n,style:{display:"inline-flex",...o},children:t.split("").map((s,u)=>e.jsx(Dt,{char:s,height:a},u))})}function I({w:t,h:a,className:n=""}){return e.jsx("div",{className:`skeleton ${n}`,style:{width:t,height:a}})}function Ut(){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 Ft({onClose:t,onSelect:a,currencies:n,assetBaseUrl:o=""}){const[s,u]=l.useState(""),m=l.useMemo(()=>{if(!n||n.length===0)return De;const r=new Map(De.map(d=>[d.code,d.name]));return n.map(d=>({code:d.code,name:d.name||r.get(d.code)||d.code}))},[n]),i=l.useMemo(()=>{const r=s.trim().toLowerCase();return r?m.filter(d=>d.code.toLowerCase().includes(r)||d.name.toLowerCase().includes(r)):m},[m,s]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(ie,{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(xe,{value:s,onChange:u}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[i.map(r=>e.jsxs("button",{onClick:()=>a(r.code),className:"flex items-center gap-3.5 w-full py-3.5 transition-colors",style:{color:"var(--t-text)"},children:[e.jsx(Re,{currencyCode:r.code,size:32,baseUrl:o}),e.jsxs("div",{className:"text-left",children:[e.jsx("div",{className:"font-semibold text-[15px] leading-tight",children:r.code}),e.jsx("div",{className:"text-[13px] mt-0.5",style:{color:"var(--t-text-secondary)"},children:r.name})]})]},r.code)),i.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No currencies found"})]})]})}function Kt({onClose:t,onSelect:a,cryptos:n,assetBaseUrl:o=""}){const[s,u]=l.useState(""),m=l.useMemo(()=>{if(!n||n.length===0)return Ct;const r=[];for(const d of n){const h=d.networks||[];if(h.length===0)r.push({code:d.code,name:d.name||d.code,chain:d.code,popular:!1});else for(const f of h){const y=f.code||f.id||f.name||d.code;r.push({code:d.code,name:d.name||d.code,chain:y,chainName:f.name,popular:!1})}}return r},[n]),i=l.useMemo(()=>{var f;const r=s.trim().toLowerCase();if(!r)return m;const d=r.split(/\s+/),h=[];for(const y of m){const g=fe[y.chain],p=g?g.name.toLowerCase():"",N=((f=g==null?void 0:g.shortName)==null?void 0:f.toLowerCase())||"",A=y.chain.toLowerCase(),O=y.code.toLowerCase(),j=y.name.toLowerCase(),U=[O,j,p,N,A];if(!d.every(Y=>U.some(c=>c.includes(Y))))continue;let F=0;O===r?F+=100:O.startsWith(d[0])&&(F+=50),y.popular&&(F+=10),d.length>1&&(p.includes(d[1])||N.includes(d[1])||A.includes(d[1]))&&(F+=25),h.push({item:y,score:F})}return h.sort((y,g)=>g.score-y.score),h.map(y=>y.item)},[m,s]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(ie,{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(xe,{value:s,onChange:u}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[i.map(r=>{const d=fe[r.chain],h=(d==null?void 0:d.name)||r.chainName||r.chain;return e.jsxs("button",{onClick:()=>a(r.code,r.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:Ke(r.code,o),alt:r.code,width:32,height:32,className:"rounded-full absolute top-0 left-0",style:{width:32,height:32}}),e.jsx("img",{src:Ae(r.chain,o),alt:r.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:r.code}),e.jsx("div",{className:"text-[13px] mt-0.5",style:{color:"var(--t-text-secondary)"},children:r.name})]}),e.jsx("div",{className:"text-right shrink-0",children:e.jsx("div",{className:"text-[13px]",style:{color:"var(--t-text-muted)"},children:h})})]},`${r.code}-${r.chain}`)}),i.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No currencies found"})]})]})}function _t({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 ca=[{label:"Privacy policy",href:"https://nowramp.com/privacy-policy"},{label:"Terms of use",href:"https://nowramp.com/terms-and-conditions"}];function Xt({onClose:t,darkMode:a,onToggleDarkMode:n,skinId:o,onSelectSkin:s}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end items-center px-5 pt-5",children:e.jsx(ie,{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(wt,{size:40}),e.jsx("span",{className:"font-medium text-[15px]",style:{color:"var(--t-text)"},children:"Dark Mode"})]}),e.jsx(_t,{checked:a,onChange:n,accentColor:"#4CD964"})]})}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}}),ca.map(u=>e.jsxs("div",{children:[e.jsxs("a",{href:u.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:u.label}),e.jsx(At,{})]}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}})]},u.label))]})]})}function ia({className:t="",theme:a="dark",skinId:n="mono",accentColor:o,bgColor:s,bgImage:u,borderColor:m,borderRadius:i,showFlowToggle:r=!0,autoRedirect:d=!1,explorerUrl:h,doneButtonText:f="Done",supportEmail:y,onDone:g}){var Ze,Je,ze,qe,et,tt,at,nt;const{state:p,dispatch:N,config:A,configLoading:O,quotes:j,quotesLoading:U,quotesError:$,fetchQuotes:F,createOrder:Y,orderLoading:c,amountError:M,fieldLocks:v,apiConfig:T,assetBaseUrl:P}=te(),[D,H]=l.useState(a==="dark"),[ye,de]=l.useState(n),[ue,K]=l.useState(null),[me,Z]=l.useState(!1),[ge,ae]=l.useState(!1),[ne,Ce]=l.useState(!1),[_,J]=l.useState(null),[z,ve]=l.useState(!0),[Ne,Se]=l.useState(!1),[V,se]=l.useState(!1),ke=l.useRef(null),pe=l.useRef(),C=l.useRef(p.flowType);l.useEffect(()=>{H(a==="dark")},[a]),l.useEffect(()=>{const x=setTimeout(()=>ve(!1),O?0:800);return()=>clearTimeout(x)},[O]),l.useEffect(()=>{if(C.current!==p.flowType&&!z){C.current=p.flowType,Se(!0),Z(!1),ae(!1);const x=setTimeout(()=>Se(!1),350);return()=>clearTimeout(x)}C.current=p.flowType},[p.flowType,z]);const S=p.flowType,E=S==="buy",w=p.cryptoCurrency||"BTC",R=p.fiatCurrency||"USD",B=E?p.fiatAmount:p.cryptoAmount,X=gt(B),re=(Ze=j==null?void 0:j.bestQuote)!=null&&Ze.exchangeRate?parseFloat(j.bestQuote.exchangeRate):null,be=l.useRef(null);re&&w&&R&&(be.current={rate:re,crypto:w,fiat:R});const Gt=l.useMemo(()=>{if(j!=null&&j.bestQuote){const x=E?j.bestQuote.cryptoAmount:j.bestQuote.fiatAmount;if(x)return x}return"0"},[j,E]),Yt=l.useMemo(()=>{var L,W,Me;const x=re||((L=be.current)==null?void 0:L.rate),b=re?w:(W=be.current)==null?void 0:W.crypto,k=re?R:(Me=be.current)==null?void 0:Me.fiat;return!x||!b||!k?"":`1 ${b} ≈ ${x.toFixed(2)} ${k}`},[w,R,re]);l.useEffect(()=>{const x=p.walletAddress.trim(),b=p.network;if(!x||x.length<10){J(null),N({type:"SET_WALLET_ERROR",message:""});return}return Ce(!0),J(null),clearTimeout(pe.current),pe.current=setTimeout(async()=>{var k,L,W;try{const Oe=await(await fetch(`${T.apiUrl}/public/validate/address`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:x,...b?{network:b}:{}})})).json(),Be=((k=Oe.data)==null?void 0:k.attributes)||Oe.data||Oe;if(Be.isValid)J(!0),N({type:"SET_WALLET_ERROR",message:""});else{J(!1);const ea=((L=Be.errors)==null?void 0:L[0])||((W=Be.details)==null?void 0:W.formatMessage)||"Invalid wallet address";N({type:"SET_WALLET_ERROR",message:ea})}}catch{J(null)}finally{Ce(!1)}},500),()=>clearTimeout(pe.current)},[p.walletAddress,p.network,T.apiUrl]);const _e=!B||X===0,Xe=X>0&&(E?X<rt:X<ot),$e=!!M||Xe||me&&_e,Vt=X>0&&!M&&!Xe,Ie=p.walletAddress.trim().length>=10&&_!==!1&&!ne,je=Vt&&Ie&&!!p.cryptoCurrency&&!!p.network,Wt=x=>{let b=x.target.value.replace(/[^0-9.,]/g,"");const k=E?2:6,L=b.indexOf(".");L!==-1&&b.length-L-1>k&&(b=b.slice(0,L+k+1)),N(E?{type:"SET_FIAT_AMOUNT",amount:b}:{type:"SET_CRYPTO_AMOUNT",amount:b})},Ge=x=>{x!==S&&N({type:"SET_FLOW_TYPE",flowType:x})},Qt=l.useCallback(x=>{N({type:"SET_FIAT_CURRENCY",currency:x})},[N]),Zt=l.useCallback((x,b)=>{N({type:"SET_CRYPTO_CURRENCY",currency:x}),N({type:"SET_CRYPTO_CHAIN",chain:b})},[N]),Jt=l.useCallback(x=>{N({type:"SET_PAYMENT_METHOD",methodId:x})},[N]),zt=()=>{je&&(se(!0),F())};l.useEffect(()=>{var x;if(!(!V||U)){if(j!=null&&j.bestQuote)se(!1),N({type:"SELECT_QUOTE",quote:j.bestQuote}),Y().catch(()=>{});else if($)se(!1),N({type:"SET_ERROR",message:$.message||"No quotes available"});else if(j&&!j.bestQuote){se(!1);const b=(x=j.unavailableGateways)==null?void 0:x.map(L=>L.reason).filter(Boolean),k=b!=null&&b.length?`No providers available: ${b.join("; ")}`:"No providers available for this currency/network combination";N({type:"SET_ERROR",message:k})}}},[V,j,U,$,N,Y]);const Ye=D?"theme-dark":"theme-light",Le=He.find(x=>x.id===ye)||He[0],qt=Le.accent===null,Ve=(o?Pe(o):!1)?{"--t-accent":o,"--t-cta-bg":o,"--t-cta-text":"#ffffff"}:qt?{"--t-accent":D?"#ffffff":"#111111","--t-cta-bg":D?"#ffffff":"#111111","--t-cta-text":D?"#000000":"#ffffff"}:{"--t-accent":Le.accent,"--t-cta-bg":Le.accent,"--t-cta-text":"#ffffff"},q={};s&&Pe(s)?q.backgroundColor=s:q.backgroundColor="var(--t-bg)",u&&(q.backgroundImage=`url(${u})`,q.backgroundSize="cover",q.backgroundPosition="center");const Ee={};m&&Pe(m)&&(Ee.border=`1px solid ${m}`),i&&(Ee.borderRadius=i);const We=p.step==="checkout"?e.jsx(Lt,{autoRedirect:d}):p.step==="processing"?e.jsx(Mt,{}):p.step==="complete"?e.jsx(Ot,{explorerUrl:h,doneButtonText:f,onDone:g}):p.step==="error"?e.jsx(Bt,{supportEmail:y}):p.step==="confirm"?e.jsx(Pt,{}):null;if(We)return e.jsx("div",{className:`${Ye} 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',...q,...Ve,...Ee},children:We});const G=p.network,oe=G?fe[G]:null,Qe=(oe==null?void 0:oe.shortName)||(oe==null?void 0:oe.name)||G;return e.jsxs("div",{className:`${Ye} 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',...q,...Ve,...Ee},children:[e.jsx("div",{className:`flex justify-end items-center px-5 pt-3 ${r?"pb-1":"pb-5"}`,children:e.jsx(Rt,{onClick:()=>K("settings")})}),r?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:()=>Ge("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:()=>Ge("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,z||Ne||O?e.jsx(Ut,{}):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&&$e?"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:ke,type:"text",value:B,onChange:Wt,onBlur:()=>Z(!0),placeholder:E?"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=v==null?void 0:v.sourceAmount)!=null&&Je.locked)}),E?e.jsxs("button",{onClick:()=>K("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:!!((ze=v==null?void 0:v.sourceCurrency)!=null&&ze.locked),children:[e.jsx(Re,{currencyCode:R,size:16,baseUrl:P}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:R}),e.jsx(ce,{})]}):e.jsxs("div",{className:"flex flex-col items-end shrink-0",children:[e.jsxs("button",{onClick:()=>K("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:!!((qe=v==null?void 0:v.destinationCurrency)!=null&&qe.locked),children:[e.jsx(Fe,{ticker:w,size:16,baseUrl:P}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:w}),e.jsx(ce,{})]}),G&&e.jsxs("div",{className:"flex items-center gap-1 mt-1.5 mr-0.5",children:[e.jsx("img",{src:Ae(G,P),alt:G,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:Qe})]})]})]})]}),me&&$e&&e.jsx("div",{className:"text-[12px] mt-1.5 px-[2px]",style:{color:"#EF4444"},children:M||(_e?"Amount should be more than 0":E?`Minimum amount is ${rt} ${R}`:`Minimum amount is ${ot} ${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:[U?e.jsx(I,{w:180,h:32}):e.jsx(Ht,{value:X>0?Gt:"0",height:32,className:"font-semibold",style:{color:X>0?"var(--t-text)":"var(--t-text-muted)",fontSize:24}}),E?e.jsxs("div",{className:"flex flex-col items-end shrink-0",children:[e.jsxs("button",{onClick:()=>K("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=v==null?void 0:v.destinationCurrency)!=null&&et.locked),children:[e.jsx(Fe,{ticker:w,size:16,baseUrl:P}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:w}),e.jsx(ce,{})]}),G&&e.jsxs("div",{className:"flex items-center gap-1 mt-1.5 mr-0.5",children:[e.jsx("img",{src:Ae(G,P),alt:G,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:Qe})]})]}):e.jsxs("button",{onClick:()=>K("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:!!((tt=v==null?void 0:v.sourceCurrency)!=null&&tt.locked),children:[e.jsx(Re,{currencyCode:R,size:16,baseUrl:P}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:R}),e.jsx(ce,{})]})]})]}),e.jsx("div",{className:"flex items-center justify-between mt-[2px] px-[18px] pt-[12px] pb-[14px]",style:{background:"var(--t-surface)",...(at=A==null?void 0:A.paymentMethods)!=null&&at.length?{}:{borderBottomLeftRadius:5,borderBottomRightRadius:5}},children:e.jsx("span",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:Yt||" "})}),(A==null?void 0:A.paymentMethods)&&A.paymentMethods.length>0&&e.jsx("div",{className:"mt-[2px]",children:e.jsx(It,{methods:A.paymentMethods,selectedId:p.paymentMethodId,onSelect:Jt,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:E?"Receiving wallet address":"Sending wallet address"}),e.jsx("input",{type:"text",value:p.walletAddress,onChange:x=>N({type:"SET_WALLET_ADDRESS",address:x.target.value}),onBlur:()=>ae(!0),placeholder:E?"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||ge&&!Ie?"1px solid #EF4444":"1px solid var(--t-border)",borderRadius:3.5,height:47,paddingLeft:14,paddingRight:14,color:"var(--t-text)"},disabled:!!((nt=v==null?void 0:v.destinationAddress)!=null&&nt.locked)}),p.walletError?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"#EF4444"},children:p.walletError}):ge&&!Ie&&!ne?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"#EF4444"},children:"Enter a valid wallet address"}):ne&&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:zt,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...":E?`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:ue==="fiat",onClose:()=>K(null),children:x=>{var b;return e.jsx(Ft,{onClose:x,onSelect:k=>{Qt(k),x()},currencies:(b=A==null?void 0:A.fiats)==null?void 0:b.map(k=>({code:k.code,name:k.code})),assetBaseUrl:P})}}),e.jsx(he,{isOpen:ue==="crypto",onClose:()=>K(null),children:x=>{var b;return e.jsx(Kt,{onClose:x,onSelect:(k,L)=>{Zt(k,L),x()},cryptos:(b=A==null?void 0:A.cryptos)==null?void 0:b.map(k=>{var L;return{code:k.code,name:k.code,networks:(L=k.networks)==null?void 0:L.map(W=>({code:W.id,name:W.name}))}}),assetBaseUrl:P})}}),e.jsx(he,{isOpen:ue==="settings",onClose:()=>K(null),children:x=>e.jsx(Xt,{onClose:x,darkMode:D,onToggleDarkMode:H,skinId:ye,onSelectSkin:b=>{de(b)}})})]})}function $t({projectId:t,apiUrl:a,assetBaseUrl:n,flowType:o,customerId:s,defaultFiatCurrency:u,defaultCryptoCurrency:m,defaultNetwork:i,defaultFiatAmount:r,defaultCryptoAmount:d,defaultWalletAddress:h,defaultGateway:f,fieldLocks:y,statusPollInterval:g,onComplete:p,onError:N,className:A,theme:O,skinId:j,accentColor:U,bgColor:$,bgImage:F,borderColor:Y,borderRadius:c,showFlowToggle:M,autoRedirect:v,explorerUrl:T,doneButtonText:P,supportEmail:D,onDone:H}){return e.jsx(ht,{projectId:t,apiUrl:a,assetBaseUrl:n,flowType:o,customerId:s,defaultFiatCurrency:u,defaultCryptoCurrency:m,defaultNetwork:i,defaultFiatAmount:r,defaultCryptoAmount:d,defaultWalletAddress:h,defaultGateway:f,fieldLocks:y,statusPollInterval:g,onComplete:p,onError:N,children:e.jsx(ia,{className:A,theme:O,skinId:j,accentColor:U,bgColor:$,bgImage:F,borderColor:Y,borderRadius:c,showFlowToggle:M,autoRedirect:v,explorerUrl:T,doneButtonText:P,supportEmail:D,onDone:H})})}function da({submitButtonText:t,rateRefreshInterval:a,...n}){return e.jsx($t,{...n})}function ua({skin:t,active:a,onClick:n,darkMode:o,dimmed:s}){const u=t.accent===null,m=32;return e.jsxs("button",{onClick:n,className:"relative shrink-0",style:{width:m,height:m,opacity:s?.4:1,transition:"opacity 0.2s"},children:[u?e.jsxs("svg",{width:m,height:m,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:o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.1)",strokeWidth:"1"})]}):e.jsx("svg",{width:m,height:m,viewBox:"0 0 32 32",children:e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:t.accent})}),a&&!s&&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 ma({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 pa({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(Te,{size:36})}function ha(){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 fa({onClose:t,onSelect:a,quotes:n,quotesLoading:o,cryptoCurrency:s}){const[u,m]=l.useState(""),i=l.useMemo(()=>{if(!(n!=null&&n.quotes))return[];const r=u.trim().toLowerCase();return r?n.quotes.filter(d=>d.gatewayName.toLowerCase().includes(r)):n.quotes},[n,u]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(ie,{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(xe,{value:u,onChange:m}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5 space-y-2",children:[o?e.jsx(ha,{}):i.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"}):i.map((r,d)=>{const h=d===0,f=parseFloat(r.cryptoAmount),y=f>=1?f.toFixed(4):f.toPrecision(6);return e.jsxs("button",{onClick:()=>a(r),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(pa,{quote:r}),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:r.gatewayName}),e.jsx(ma,{quote:r})]}),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:[s," ",y]})]})]},r.gatewayId)}),!o&&(n==null?void 0:n.unavailableGateways)&&n.unavailableGateways.length>0&&e.jsx("div",{className:"pt-3",children:n.unavailableGateways.map(r=>e.jsxs("div",{className:"flex items-center justify-between py-2 text-[12px]",style:{color:"var(--t-text-muted)"},children:[e.jsx("span",{children:r.gatewayName}),e.jsx("span",{children:r.reason})]},r.gatewayId))})]})]})}exports.AnimatedDigit=Dt;exports.AnimatedNumber=Ht;exports.ApplePayIcon=St;exports.BLOCKCHAINS=fe;exports.BankIcon=vt;exports.CRYPTO_CHAIN_COMBOS=Ct;exports.CRYPTO_CURRENCIES=ft;exports.CardIcon=Et;exports.CheckoutForm=da;exports.CheckoutStep=Lt;exports.ChevronDown=ce;exports.ChevronRight=At;exports.ChooseRampModal=fa;exports.CloseButton=ie;exports.CoinifyIcon=sa;exports.CompleteStep=Ot;exports.ConfirmStep=Pt;exports.CryptoCurrencyModal=Kt;exports.CryptoIcon=Fe;exports.DarkModeIcon=wt;exports.ErrorStep=Bt;exports.FIAT_CURRENCIES=De;exports.FIAT_TO_COUNTRY=xt;exports.FiatCurrencyModal=Ft;exports.FiatFlag=Re;exports.FormSkeleton=Ut;exports.GenericCoinIcon=Te;exports.GooglePayIcon=bt;exports.MOCK_RATES=Ue;exports.MenuIcon=Rt;exports.Modal=he;exports.PayPalIcon=jt;exports.PaymentMethodSelector=It;exports.ProcessingStep=Mt;exports.RampForm=$t;exports.RampProvider=ht;exports.RevolutIcon=Nt;exports.SKINS=He;exports.SearchInput=xe;exports.SettingsScreen=Xt;exports.Skeleton=I;exports.SkinSwatch=ua;exports.ToggleSwitch=_t;exports.formatOutput=na;exports.getChainIconUrl=Ae;exports.getCryptoIconUrl=Ke;exports.getFiatFlagUrl=yt;exports.getMockRate=aa;exports.getPaymentIcon=Tt;exports.parseAmount=gt;exports.useCheckoutIntent=dt;exports.useQuotes=it;exports.useRamp=te;exports.useRampConfig=ct;exports.useTransaction=ut;
|
|
12
12
|
//# sourceMappingURL=index.cjs.map
|