@nowramp/form 0.1.34 → 0.1.35

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