@unifold/connect-react-native 0.1.23 → 0.1.25
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.d.mts +400 -391
- package/dist/index.d.ts +400 -391
- package/dist/index.js +2 -1
- package/dist/index.mjs +2 -1
- package/dist/stripe.d.mts +250 -29
- package/dist/stripe.d.ts +250 -29
- package/dist/stripe.js +2 -1
- package/dist/stripe.mjs +2 -1
- package/package.json +10 -15
package/dist/index.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import {createContext,useState,useRef,useMemo,useEffect,useCallback,useContext}from'react';import {useColorScheme}from'react-native';import {QueryClientProvider,QueryClient}from'@tanstack/react-query';import {setApiConfig,ThemeProvider,DepositModal}from'@unifold/ui-react-native';export{setDevApiUrl,useAllowedCountry}from'@unifold/ui-react-native';import {jsx,jsxs}from'react/jsx-runtime';var T="__unifold_stripe_onramp__";function y(s){globalThis[T]=s;}function D(){return globalThis[T]}var Q=()=>new QueryClient({defaultOptions:{queries:{staleTime:6e4,retry:1}}}),k=createContext(null);function j({children:s,publishableKey:r,config:t}){let[x]=useState(()=>Q()),[S,f]=useState(false),[e,m]=useState(null),C=useColorScheme(),h=useRef(false);h.current||(setApiConfig({publishableKey:r}),h.current=true);let l=useMemo(()=>{let n=t?.appearance||"dark";return n==="auto"?C==="dark"?"dark":"light":n},[t?.appearance,C]);useEffect(()=>{if(!r||r.trim()===""){console.error("Unifold: publishableKey is required. Please provide a valid publishable key.");return}!r.startsWith("pk_test_")&&!r.startsWith("pk_live_")&&console.warn('Unifold: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),setApiConfig({publishableKey:r});},[r]),useEffect(()=>()=>{i.current&&clearTimeout(i.current);},[]);let o=useRef(null),i=useRef(null),g=useCallback(n=>{i.current&&(clearTimeout(i.current),i.current=null),o.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),o.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),o.current=null);let U=new Promise((_,O)=>{o.current={resolve:_,reject:O};});return m(n),f(true),U},[]),p=useCallback(()=>{o.current&&(o.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),o.current=null),f(false),i.current=setTimeout(()=>{m(null),i.current=null;},200);},[]),E=useCallback(n=>{e?.onSuccess&&e.onSuccess(n),o.current&&(o.current.resolve(n),o.current=null);},[e]),b=useCallback(n=>{console.error("[UnifoldProvider] Deposit error:",n),e?.onError&&e.onError(n),o.current&&(o.current.reject(n),o.current=null);},[e]),I=useMemo(()=>({publishableKey:r,beginDeposit:g,closeDeposit:p}),[r,g,p]);return jsx(QueryClientProvider,{client:x,children:jsx(k.Provider,{value:I,children:jsxs(ThemeProvider,{mode:l,accentColor:t?.accentColor,theme:t?.theme,fontFamily:t?.fontFamily,fonts:t?.fonts,components:t?.components,children:[s,e&&jsx(DepositModal,{visible:S,onClose:p,publishableKey:r,modalTitle:t?.modalTitle,externalUserId:e.externalUserId,destinationChainType:e.destinationChainType,destinationChainId:e.destinationChainId,destinationTokenSymbol:e.destinationTokenSymbol,recipientAddress:e.recipientAddress,destinationTokenAddress:e.destinationTokenAddress,defaultChainType:e.defaultChainType,defaultChainId:e.defaultChainId,defaultTokenAddress:e.defaultTokenAddress,showBalance:e.showBalance,stripeOnrampEmail:e.stripeOnrampEmail,stripeOnrampPhone:e.stripeOnrampPhone,stripeTheme:{mode:l,accentColor:t?.accentColor,theme:t?.theme,fontFamily:t?.fontFamily,fonts:t?.fonts,components:t?.components},depositConfirmationMode:e.depositConfirmationMode??"auto_ui",hideDepositTracker:t?.hideDepositTracker,transferInputVariant:t?.transferInputVariant,enableStripeLinkPay:t?.enableStripeLinkPay,StripeOnrampComponent:t?.enableStripeLinkPay?D():void 0,onDepositSuccess:E,onDepositError:b,theme:l,sheetBorderRadius:t?.sheetBorderRadius})]})})})}function q(){let s=useContext(k);if(!s)throw new Error("useUnifold must be used within UnifoldProvider");return s}export{j as UnifoldProvider,y as registerStripeOnramp,q as useUnifold};
|
|
1
|
+
import {createContext,useState,useEffect,useRef,useMemo,useCallback,useContext,useId}from'react';import {StyleSheet,Platform,useColorScheme,View,Text,ScrollView,Image,useWindowDimensions,Animated,Modal,StatusBar,TouchableWithoutFeedback,TouchableOpacity,ActivityIndicator,Linking,TextInput,Clipboard,Easing}from'react-native';import {QueryClientProvider,QueryClient}from'@tanstack/react-query';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {GestureHandlerRootView,TouchableOpacity as TouchableOpacity$1}from'react-native-gesture-handler';import _e,{Path,Line,Polyline,SvgXml,SvgUri,Rect,Circle,Defs,LinearGradient,Stop}from'react-native-svg';import hs from'react-native-qrcode-svg';import {WebView}from'react-native-webview';import Ln from'@react-native-async-storage/async-storage';var Ar={light:{background:"#FFFFFF",card:"#F8FAFC",cardHover:"#F1F5F9",foreground:"#0F172A",foregroundMuted:"#64748B",foregroundSubtle:"#94A3B8",border:"#E2E8F0",borderSecondary:"#CBD5E1",primary:"#3B82F6",primaryForeground:"#FFFFFF",success:"#22C55E",successBackground:"#DCFCE7",warning:"#F59E0B",warningBackground:"#FEF3C7",error:"#EF4444",errorBackground:"#FEE2E2",overlay:"rgba(0, 0, 0, 0.5)"},dark:{background:"#2D2C2F",card:"#3A393C",cardHover:"#48474A",foreground:"#F8FAFC",foregroundMuted:"#94A3B8",foregroundSubtle:"#64748B",border:"#38383A",borderSecondary:"#48484A",primary:"#3B82F6",primaryForeground:"#FFFFFF",success:"#22C55E",successBackground:"rgba(34, 197, 94, 0.1)",warning:"#F59E0B",warningBackground:"rgba(245, 158, 11, 0.1)",error:"#EF4444",errorBackground:"rgba(239, 68, 68, 0.1)",overlay:"rgba(0, 0, 0, 0.7)"}},zr=Ar;function er(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function Eo(e,t,o){let n=o?t?.[o]:void 0,r=(l,h,x)=>{let P=n?.[l]?.[h];if(P!==void 0)return P;let I=t?.[l]?.[h];return I!==void 0?I:x},s={backgroundColor:r("card","backgroundColor",e.card),titleColor:r("card","titleColor",e.foreground),subtitleColor:r("card","subtitleColor",e.foregroundMuted),labelColor:r("card","labelColor",e.foregroundMuted),headerColor:r("card","headerColor",e.foregroundMuted),labelRightColor:r("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:r("card","labelHighlightRightColor",e.warning),textRightColor:r("card","textRightColor",e.foreground),subtextRightColor:r("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:r("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:r("card","rowRightLabel",e.foreground),iconColor:r("card","iconColor",e.primary),iconBackgroundColor:r("card","iconBackgroundColor",e.primary+"26"),actionColor:r("card","actionColor",e.foregroundMuted),actionIcon:r("card","actionIcon",e.foregroundMuted),descriptionColor:r("card","descriptionColor",e.foregroundMuted),borderRadius:r("card","borderRadius",12),borderWidth:r("card","borderWidth",0),borderColor:r("card","borderColor",e.border),shadowColor:r("card","shadowColor","#000"),shadowOffset:r("card","shadowOffset",{width:0,height:-4}),shadowOpacity:r("card","shadowOpacity",0),shadowRadius:r("card","shadowRadius",12),elevation:r("card","elevation",0),iconContainerBorderRadius:r("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},a=(n?.depositMenu??t?.depositMenu)?.card,d=(n?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,f=(n?.depositCard??t?.depositCard)?.quoteProvider?.card,p=(n?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:r("header","titleColor",e.foreground),buttonColor:r("header","buttonColor",e.foreground)},card:s,input:{backgroundColor:r("input","backgroundColor",r("search","backgroundColor",e.card)),textColor:r("input","textColor",r("search","inputColor",e.foreground)),placeholderColor:r("input","placeholderColor",r("search","placeholderColor",e.foregroundMuted)),borderColor:r("input","borderColor",e.border),borderRadius:r("input","borderRadius",r("search","borderRadius",8)),borderWidth:r("input","borderWidth",1)},button:{primaryBackground:r("button","primaryBackground",e.primary),primaryText:r("button","primaryText",e.primaryForeground),secondaryBackground:r("button","secondaryBackground",e.card),secondaryText:r("button","secondaryText",e.foreground),borderRadius:r("button","borderRadius",12),borderWidth:r("button","borderWidth",0),borderColor:r("button","borderColor",e.border)},container:{titleColor:r("container","titleColor",e.foreground),subtitleColor:r("container","subtitleColor",e.foregroundMuted),actionColor:r("container","actionColor",e.foregroundMuted),actionTitle:r("container","actionTitle",e.foregroundMuted),buttonColor:r("container","buttonColor",e.primary),buttonTitleColor:r("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:r("container","iconBackgroundColor",e.success),iconColor:r("container","iconColor",e.foreground)},search:{backgroundColor:r("search","backgroundColor",e.card),inputColor:r("search","inputColor",e.foreground),placeholderColor:r("search","placeholderColor",e.foregroundMuted),borderRadius:r("search","borderRadius",8)},list:{titleSectionColor:r("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:r("list","rowBorderRadius",12)},badge:{borderRadius:r("badge","borderRadius",8)},sheet:{shadowColor:r("sheet","shadowColor","#000"),shadowOffset:r("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:r("sheet","shadowOpacity",.1),shadowRadius:r("sheet","shadowRadius",12),elevation:r("sheet","elevation",16)},depositMenu:{card:er(s,a)},transferCrypto:{depositAddress:{card:er(s,d)}},depositCard:{quoteProvider:{card:er(s,f)}},depositTracker:{executionRow:{card:er(s,p)}}}}function Mr(e,t,o){let r={...Ar[e]};return o&&(r.primary=o),t&&(r={...r,...t}),r}var Ur=createContext(null);function W(){let e=useContext(Ur);if(!e){let t=zr.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:Eo(t,void 0,"dark"),isDark:true}}return e}function mo({children:e,mode:t="auto",accentColor:o,theme:n,fontFamily:r,fonts:s,components:a}){let d=useColorScheme(),f=useMemo(()=>t==="auto"?d==="dark"?"dark":"light":t,[t,d]),p=useMemo(()=>{let P=n?.[f];return Mr(f,P,o)},[f,n,o]),l=useMemo(()=>Eo(p,a,f),[p,a,f]),h=useMemo(()=>s?{regular:s.regular||r,medium:s.medium||r,semibold:s.semibold||r,bold:s.bold||r}:r?{regular:r,medium:r,semibold:r,bold:r}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[r,s]),x=useMemo(()=>({mode:f,colors:p,fonts:h,components:l,isDark:f==="dark"}),[f,p,h,l]);return jsx(Ur.Provider,{value:x,children:e})}var Ki="https://api.unifold.io",or,tt="pk_test_123",tr={};function Oe(){return typeof __DEV__<"u"&&__DEV__&&or?or:Ki}function rr(e){if(e.publishableKey!==void 0){if(!e.publishableKey||e.publishableKey.trim()==="")throw new Error("Unifold SDK: publishableKey cannot be empty. Please provide a valid publishable key.");!e.publishableKey.startsWith("pk_test_")&&!e.publishableKey.startsWith("pk_live_")&&console.warn('Unifold SDK: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),tt=e.publishableKey;}e.baseUrl&&typeof __DEV__<"u"&&__DEV__&&(or=e.baseUrl),e.defaultConfig&&(tr=e.defaultConfig);}function An(e){typeof __DEV__<"u"&&__DEV__?or=e:console.warn("[Unifold] setDevApiUrl() is only available in development mode");}function at(e){if(!e||e.trim()==="")throw new Error("Unifold SDK: No publishable key configured. Please provide a valid publishable key via setApiConfig() or pass it directly to the API function.");e==="pk_test_123"&&console.warn('Unifold SDK: Using default test key "pk_test_123". This should only be used for local development. Please use a real publishable key in production.');}function He(e){let t=e.startsWith("/")?e:`/${e}`;return `${Oe()}/api/public${t}`}function $(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,Oe()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${Oe()}${e}`:`${Oe()}/api/public${e}`:""}async function Xt(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let o=e?.recipient_address||tr.recipientAddress;if(!o)throw new Error("[Unifold] recipient_address is required for createDepositAddress. Pass recipientAddress in your beginDeposit() config.");let n={external_user_id:e.external_user_id,destination_chain_type:e?.destination_chain_type||"ethereum",destination_chain_id:e?.destination_chain_id||tr.destinationChainId||"8453",destination_token_address:e?.destination_token_address||tr.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:o,client_metadata:e?.client_metadata||{}},r=t||tt;at(r);let s=await fetch(`${Oe()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(n)});if(!s.ok)throw new Error(`Failed to create deposit address: ${s.statusText}`);return await s.json()}function Zt(e,t){return e.find(o=>o.chain_type===t)}async function Ao(e,t){let o=t||tt;at(o);let n=await fetch(`${Oe()}/v1/public/direct_executions/query`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify({external_user_id:e})});if(!n.ok)throw new Error(`Failed to query executions: ${n.statusText}`);return n.json()}async function Hr(e,t){let o=t||tt;at(o);let n=await fetch(`${Oe()}/v1/public/direct_executions/poll`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify({deposit_wallet_id:e})});if(!n.ok)throw new Error(`Failed to poll executions: ${n.statusText}`);return n.json()}function de(e,t="svg"){if(!e)return "";if(t==="svg"||!e.icon_urls||e.icon_urls.length===0)return e.icon_url;let o=e.icon_urls.find(n=>n.format===t);return o?o.url:e.icon_url}async function zo(e,t){let o=e||tt;at(o);let n=`${Oe()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let s=new URLSearchParams({destination_token_address:t.destination_token_address,destination_chain_id:t.destination_chain_id,destination_chain_type:t.destination_chain_type});n=`${n}?${s.toString()}`;}let r=await fetch(n,{method:"GET",headers:{accept:"application/json","x-publishable-key":o}});if(!r.ok)throw new Error(`Failed to fetch supported deposit tokens: ${r.statusText}`);return r.json()}async function jr(e,t){let o=t||tt;at(o);let n=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),r=await fetch(`${Oe()}/v1/public/tokens/token?${n.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":o}});if(!r.ok)throw new Error(`Failed to fetch token metadata: ${r.statusText}`);return r.json()}function nr(e,t,o){return !e||e.length===0?o||"":e.find(r=>r.format===t)?.url||o||e[0]?.url||""}async function Nr(e,t){let o=t||tt;at(o);let n=await fetch(`${Oe()}/v1/public/onramps/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(`Failed to fetch onramp quotes: ${n.statusText}`);return n.json()}async function $r(e,t){let o=t||tt;at(o);let n=await fetch(`${Oe()}/v1/public/onramps/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(`Failed to create onramp session: ${n.statusText}`);return n.json()}async function qr(e,t){let o=t||tt;at(o);let n=new URLSearchParams;e.country_code&&n.append("country_code",e.country_code),e.subdivision_code&&n.append("subdivision_code",e.subdivision_code),n.append("token_address",e.token_address),n.append("chain_id",e.chain_id),n.append("chain_type",e.chain_type);let r=await fetch(`${Oe()}/v1/public/onramps/default_token?${n.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":o}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.statusText}`);return r.json()}async function Qr(e){let t=e||tt;at(t);let o=await fetch(`${Oe()}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch fiat currencies: ${o.statusText}`);return o.json()}function ho(e,t="png"){if(!e||e.length===0)return;let o=e.find(n=>n.format===t);return o?o.url:e[0]?.url}async function Mo(e){let t=e||tt;at(t);let o=await fetch(`${Oe()}/v1/public/projects/config`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch project config: ${o.statusText}`);return o.json()}async function Uo(){let e=await fetch(`${Oe()}/v1/public/ip_address`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch IP address information: ${e.statusText}`);return e.json()}async function zn(e,t,o,n,r){let s=r||tt;at(s);let a=await fetch(`${Oe()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":s},body:JSON.stringify({address:e,chain_type:t,chain_id:o,token_address:n})});if(!a.ok)throw new Error(`Failed to fetch address balance: ${a.statusText}`);return a.json()}function pe({visible:e,onClose:t,children:o,closeOnBackdropPress:n=true,showHandle:r=true,heightPercent:s,noPadding:a=false,borderTopLeftRadius:d=24,borderTopRightRadius:f=24}){let{colors:p,components:l}=W(),{height:h}=useWindowDimensions(),x=useRef(h);x.current=h;let P=useRef(new Animated.Value(h)).current,I=useRef(new Animated.Value(0)).current,C=s!=null&&s>=1;useEffect(()=>{let m=x.current;e?(P.setValue(m),I.setValue(0),Animated.parallel([Animated.spring(P,{toValue:0,useNativeDriver:true,tension:65,friction:11}),Animated.timing(I,{toValue:.5,duration:200,useNativeDriver:true})]).start()):Animated.parallel([Animated.spring(P,{toValue:m,useNativeDriver:true,tension:65,friction:11}),Animated.timing(I,{toValue:0,duration:200,useNativeDriver:true})]).start();},[e,P,I]);let u=()=>{n&&t();};return jsx(Modal,{visible:e,transparent:true,animationType:"none",statusBarTranslucent:true,onRequestClose:t,children:jsxs(GestureHandlerRootView,{style:[Mt.container,Platform.OS==="android"&&{paddingTop:StatusBar.currentHeight}],children:[jsx(Animated.View,{style:[Mt.backdrop,{backgroundColor:"#000000",opacity:I}],pointerEvents:"none"}),!C&&jsx(TouchableWithoutFeedback,{onPress:u,children:jsx(View,{style:Mt.backdropTouchArea})}),jsxs(Animated.View,{style:[Mt.sheet,{maxHeight:h*.9,backgroundColor:p.background,borderTopLeftRadius:d,borderTopRightRadius:f,transform:[{translateY:P}],shadowColor:l.sheet.shadowColor,shadowOffset:l.sheet.shadowOffset,shadowOpacity:l.sheet.shadowOpacity,shadowRadius:l.sheet.shadowRadius,elevation:l.sheet.elevation,...s&&{height:h*s,maxHeight:h*s},...C&&{paddingBottom:0},...a&&{paddingBottom:0}}],children:[r&&jsx(View,{style:Mt.handleContainer,children:jsx(View,{style:[Mt.handle,{backgroundColor:p.border}]})}),jsx(View,{style:[Mt.content,s&&Mt.contentFlex],children:o})]})]})})}var Mt=StyleSheet.create({container:{flex:1},backdrop:{...StyleSheet.absoluteFillObject},backdropTouchArea:{flex:1},sheet:{paddingBottom:Platform.OS==="ios"?34:24},handleContainer:{alignItems:"center",paddingTop:12,paddingBottom:4},handle:{width:36,height:4,borderRadius:2},content:{},contentFlex:{flex:1}});var Co=new Map;function jn({width:e,height:t,borderRadius:o,color:n}){let r=useRef(new Animated.Value(.3)).current;return useEffect(()=>{let s=Animated.loop(Animated.sequence([Animated.timing(r,{toValue:.7,duration:800,useNativeDriver:true}),Animated.timing(r,{toValue:.3,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[r]),jsx(Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:o,backgroundColor:n,opacity:r}})}function Ht({uri:e,width:t,height:o,borderRadius:n=0,borderWidth:r=0,borderColor:s="transparent",backgroundColor:a="transparent",style:d}){let{colors:f}=W(),[p,l]=useState(false),[h,x]=useState(false),[P,I]=useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let R=Co.get(e);return R?{uri:e,xml:R}:null}),C=e?.toLowerCase().endsWith(".svg"),u=C&&e&&P?.uri===e?P.xml:null;useEffect(()=>{l(false),x(false);},[e]),useEffect(()=>{if(!C||!e)return;if(Co.has(e)){I({uri:e,xml:Co.get(e)});return}let R=false;return fetch(e).then(b=>{if(!b.ok)throw new Error(`HTTP ${b.status}`);return b.text()}).then(b=>{R||(Co.set(e,b),I({uri:e,xml:b}));}).catch(()=>{R||l(true);}),()=>{R=true;}},[e,C]);let m=f.card;if(!e)return jsx(View,{style:[{width:t,height:o,borderRadius:n,backgroundColor:m},d]});let g={width:t,height:o,borderRadius:n,borderWidth:r,borderColor:s,backgroundColor:a,overflow:"hidden",alignItems:"center",justifyContent:"center",...d},i=t-r*2,c=o-r*2;return p?jsx(View,{style:[g,{backgroundColor:a||m}]}):C?jsxs(View,{style:g,children:[!!!u&&jsx(jn,{width:i,height:c,borderRadius:n,color:m}),u?jsx(SvgXml,{xml:u,width:i,height:c,onError:()=>l(true)}):jsx(SvgUri,{uri:e,width:i,height:c,onError:()=>l(true)})]}):jsxs(View,{style:g,children:[!h&&jsx(jn,{width:i,height:c,borderRadius:n,color:m}),jsx(Image,{source:{uri:e,cache:"force-cache"},style:{width:i,height:c},resizeMode:"contain",onLoad:()=>x(true),onError:()=>l(true)})]})}function Kr(e){let t=[];for(let o of e)if(o)if(o.toLowerCase().endsWith(".svg")){if(Co.has(o))continue;t.push(fetch(o).then(n=>{if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.text()}).then(n=>{Co.set(o,n);}).catch(()=>{}));}else t.push(Image.prefetch(o).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function Xr({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(_e,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Zr({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(_e,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function to({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(_e,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function en({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(_e,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ge({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(_e,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function St({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(_e,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ye({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(_e,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ho({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(_e,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function We({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(_e,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function tn({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(_e,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function oo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(_e,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Path,{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function bo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(_e,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ar({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(_e,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Path,{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function jt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(_e,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Gn({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(_e,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ko({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(_e,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function wo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(_e,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function lr({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(_e,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Path,{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function dr({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(_e,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Path,{d:"M5.43 5.43A8.06 8.06 0 0 0 4 10c0 6 8 12 8 12a29.94 29.94 0 0 0 5-5",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M19.18 13.52A8.66 8.66 0 0 0 20 10a8 8 0 0 0-8-8 7.88 7.88 0 0 0-3.52.82",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M9.13 9.13A2.78 2.78 0 0 0 9 10a3 3 0 0 0 3 3 2.78 2.78 0 0 0 .87-.13",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function rt({title:e,showBack:t=false,showClose:o=true,onBack:n,onClose:r,badge:s,showBalance:a=false,balanceAddress:d,balanceChainType:f,balanceChainId:p,balanceTokenAddress:l,publishableKey:h,projectName:x}){let{colors:P,fonts:I,components:C}=W(),[u,m]=useState(null),[g,i]=useState(false),c=useState(()=>new Animated.Value(0))[0];useEffect(()=>{if(!g)return;let b=Animated.loop(Animated.sequence([Animated.timing(c,{toValue:1,duration:700,useNativeDriver:true}),Animated.timing(c,{toValue:0,duration:700,useNativeDriver:true})]));return b.start(),()=>b.stop()},[g,c]),useEffect(()=>{if(!a||!d||!f||!p||!l||!h){m(null),i(false);return}let b=false;return i(true),zn(d,f,p,l,h).then(M=>{if(b)return;let _=M.balance,w=null;_&&(_.amount_usd!=null&&_.amount_usd!==""?w=`$${_.amount_usd}`:w="$0.00"),m(w);}).catch(()=>{b||m(null);}).finally(()=>{b||i(false);}),()=>{b=true;}},[a,d,f,p,l,h]);let R=c.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxs(View,{style:Ke.header,children:[jsx(View,{style:Ke.leftContainer,children:t&&n?jsx(TouchableOpacity,{onPress:n,style:[Ke.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(en,{size:20,color:C.header.buttonColor,strokeWidth:2})}):jsx(View,{style:Ke.spacer})}),jsxs(View,{style:Ke.titleContainer,children:[jsxs(View,{style:Ke.titleRow,children:[jsx(Text,{style:[Ke.title,{color:C.header.titleColor,fontFamily:I.medium}],children:e}),s&&s.count>0&&jsx(View,{style:[Ke.titleBadge,{backgroundColor:P.card}],children:jsx(Text,{style:[Ke.titleBadgeText,{color:P.foregroundMuted,fontFamily:I.regular}],children:s.count})})]}),a&&(g?jsx(Animated.View,{style:[Ke.balanceSkeleton,{backgroundColor:P.cardHover,opacity:R}]}):u!=null?jsxs(Text,{style:[Ke.balanceText,{color:P.foregroundMuted,fontFamily:I.regular}],children:[x?`${x} `:"","Balance: ",u]}):null)]}),jsx(View,{style:Ke.rightContainer,children:o?jsx(TouchableOpacity,{onPress:r,style:[Ke.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Ge,{size:20,color:C.header.buttonColor,strokeWidth:2})}):jsx(View,{style:Ke.spacer})})]})}var Ke=StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},leftContainer:{width:40,alignItems:"flex-start"},rightContainer:{width:40,alignItems:"flex-end"},titleContainer:{flex:1,alignItems:"center"},titleRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},title:{fontSize:16,textAlign:"center"},titleBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:12},titleBadgeText:{fontSize:10,fontWeight:"400"},balanceSkeleton:{height:10,width:120,borderRadius:5,marginTop:4},balanceText:{fontSize:14,marginTop:3,textAlign:"center"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function Le({children:e,style:t,contentStyle:o,onPress:n,activeOpacity:r=.7,cardTokens:s}){let{components:a}=W(),d=s??a.card,f=d.backShadowColor!=="transparent",p={backgroundColor:d.backgroundColor,borderRadius:d.borderRadius,borderWidth:d.borderWidth,borderColor:d.borderColor},l=[Kn.wrapper,t,f&&{marginBottom:d.backShadowSpacing}],h=[p,o];return jsxs(View,{style:l,children:[f&&jsx(View,{style:[Kn.backShadow,{top:d.backShadowOffset.top,left:d.backShadowOffset.left,right:d.backShadowOffset.right,bottom:d.backShadowOffset.bottom,backgroundColor:d.backShadowColor,borderRadius:d.borderRadius}]}),n!=null?jsx(TouchableOpacity$1,{onPress:n,activeOpacity:r,style:h,children:e}):jsx(View,{style:h,children:e})]})}var Kn=StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function jo({onPress:e,title:t,subtitle:o,featuredTokens:n}){let{fonts:r,components:s}=W(),a=s.depositMenu.card,d=n?[...n].sort((f,p)=>f.position-p.position):[];return jsxs(Le,{cardTokens:a,onPress:e,style:Ct.wrapper,contentStyle:Ct.container,children:[jsxs(View,{style:Ct.leftContent,children:[jsx(View,{style:[Ct.iconContainer,{borderRadius:a.iconContainerBorderRadius}],children:jsx(Xr,{size:20,color:a.iconColor,strokeWidth:2})}),jsxs(View,{style:Ct.textContainer,children:[jsx(Text,{style:[Ct.title,{color:a.titleColor,fontFamily:r.regular}],children:t}),jsx(Text,{style:[Ct.subtitle,{color:a.subtitleColor,fontFamily:r.regular}],children:o})]})]}),jsx(View,{style:Ct.rightContent,children:jsx(View,{style:Ct.networkIcons,children:d.map((f,p)=>{let l=f.icon_urls.find(h=>h.format==="png")?.url||f.icon_urls.find(h=>h.format==="svg")?.url;return jsx(View,{style:[Ct.networkIconWrapper,{marginLeft:p===0?0:-6,zIndex:d.length-p}],children:jsx(Ht,{uri:$(l),width:20,height:20})},f.name)})})})]})}var Ct=StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},networkIcons:{flexDirection:"row",alignItems:"center"},networkIconWrapper:{}});function $o({onPress:e,title:t,subtitle:o,paymentNetworks:n}){let{fonts:r,components:s}=W(),a=s.depositMenu.card;return jsxs(Le,{cardTokens:a,onPress:e,style:_t.wrapper,contentStyle:_t.container,children:[jsxs(View,{style:_t.leftContent,children:[jsx(View,{style:[_t.iconContainer,{borderRadius:a.iconContainerBorderRadius}],children:jsx(Zr,{size:20,color:a.iconColor,strokeWidth:2})}),jsxs(View,{style:_t.textContainer,children:[jsx(Text,{style:[_t.title,{color:a.titleColor,fontFamily:r.regular}],children:t}),jsx(Text,{style:[_t.subtitle,{color:a.subtitleColor,fontFamily:r.regular}],children:o})]})]}),jsx(View,{style:_t.rightContent,children:jsx(View,{style:_t.paymentIcons,children:n?.map(d=>{let f=d.icon_urls.find(p=>p.format==="png")?.url||d.icon_urls.find(p=>p.format==="svg")?.url;return jsx(Ht,{uri:$(f),width:32,height:20,borderRadius:4},d.name)})})})]})}var _t=StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},paymentIcons:{flexDirection:"row",alignItems:"center",gap:6}});function qo({onPress:e,title:t,subtitle:o,badge:n}){let{fonts:r,components:s}=W(),a=s.depositMenu.card;return jsx(Le,{cardTokens:a,onPress:e,style:Rt.wrapper,contentStyle:Rt.container,children:jsxs(View,{style:Rt.leftContent,children:[jsxs(View,{style:[Rt.iconContainer,{borderRadius:a.iconContainerBorderRadius}],children:[jsx(to,{size:20,color:a.iconColor,strokeWidth:2}),n!==void 0&&n>0&&jsx(View,{style:[Rt.badge,{backgroundColor:a.iconColor,borderRadius:s.badge.borderRadius}],children:jsx(Text,{style:[Rt.badgeText,{fontFamily:r.semibold}],children:n>99?"99+":n})})]}),jsxs(View,{style:Rt.textContainer,children:[jsx(Text,{style:[Rt.title,{color:a.titleColor,fontFamily:r.regular}],children:t}),jsx(Text,{style:[Rt.subtitle,{color:a.subtitleColor,fontFamily:r.regular}],children:o})]})]})})}var Rt=StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center",position:"relative"},badge:{position:"absolute",top:-4,right:-4,minWidth:18,height:18,alignItems:"center",justifyContent:"center",paddingHorizontal:4},badgeText:{color:"#FFFFFF",fontSize:10,fontWeight:"600"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});function Go({onPress:e,title:t,subtitle:o}){let{fonts:n,components:r}=W(),s=r.depositMenu.card;return jsxs(Le,{cardTokens:s,onPress:e,style:bt.wrapper,contentStyle:bt.container,children:[jsxs(View,{style:bt.leftContent,children:[jsx(View,{style:[bt.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsx(lr,{size:20,color:s.iconColor,strokeWidth:2})}),jsxs(View,{style:bt.textContainer,children:[jsx(Text,{style:[bt.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsx(Text,{style:[bt.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:o})]})]}),jsx(View,{style:bt.rightContent,children:jsx(View,{style:bt.badge,children:jsx(Text,{style:[bt.badgeText,{fontFamily:n.regular}],children:"Stripe"})})})]})}var bt=StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},badge:{paddingHorizontal:10,paddingVertical:4,borderRadius:6,backgroundColor:"#635BFF"},badgeText:{fontSize:12,fontWeight:"600",color:"#FFFFFF"}});var ti=1e4,oi=2500,ri=3e3,ni=6e4;function Yo(e){let{depositConfirmationMode:t,depositAddress:o,chain:n,externalUserId:r,publishableKey:s,modalOpenedAt:a,depositWalletId:d,depositExecutions:f,trackedExecutions:p,setDepositExecutions:l,setTrackedExecutions:h,setLatestExecution:x,setShowStatusSheet:P,onDepositSuccess:I,onExecutionsChange:C,onDepositError:u}=e,[m,g]=useState(false),[i,c]=useState(false);return useEffect(()=>{if(t!=="auto_ui"&&t!=="auto_silent"||!o)return;g(false),t==="auto_ui"&&c(false);let b=setTimeout(()=>{g(true),t==="auto_ui"&&c(true);},ti);return ()=>clearTimeout(b)},[t,o,n]),useEffect(()=>{if(!r||!a)return;let b=new Date(a.getTime()-ni),M=setInterval(async()=>{try{let Y=[...(await Ao(r,s)).data??[]].sort((A,U)=>{let K=A.created_at?new Date(A.created_at).getTime():0;return (U.created_at?new Date(U.created_at).getTime():0)-K}),J=null;for(let A of Y){let U=A.created_at?new Date(A.created_at):null;if(!U||U<=b)continue;let K=p.get(A.id);if(!K){J=A;break}if(["pending","waiting","delayed"].includes(K)&&A.status==="succeeded"){J=A;break}}if(J){let A=J;l(U=>{let K=U.findIndex(ee=>ee.id===A.id);if(K>=0){let ee=[...U];return ee[K]=A,ee}return [...U,A]}),h(U=>{let K=new Map(U);return K.set(A.id,A.status),K}),x(A),P(!0),A.status==="succeeded"&&I?.({message:"Deposit completed successfully",executionId:A.id}),C?.([...f,A]);}}catch(_){u?.({message:"Failed to check deposit status",error:_});}},oi);return ()=>clearInterval(M)},[r,s,a,p,f,C,I,u]),useEffect(()=>{if(!m||!d)return;let b=async()=>{try{await Hr(d,s);}catch{}};b();let M=setInterval(b,ri);return ()=>clearInterval(M)},[m,d,s]),{pollingEnabled:m,showWaitingUi:i,handleIveDeposited:()=>{g(true),c(true);}}}function _o({value:e,size:t=180,logoUri:o,logoSize:n=40,logoBackgroundColor:r}){let{colors:s,isDark:a}=W(),d=a?"#1a1a1a":"#ffffff",f=a?"#ffffff":"#000000",p=r||d;return jsxs(View,{style:[si.container,{width:t,height:t}],children:[jsx(hs,{value:e||"placeholder",size:t,backgroundColor:d,color:f,ecl:"H",quietZone:4}),o&&jsx(View,{style:[si.logoContainer,{width:n+12,height:n+12,backgroundColor:p,borderRadius:(n+12)/2}],children:jsx(Ht,{uri:o,width:n,height:n,borderRadius:n/2})})]})}var si=StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function gr({size:e=56,strokeWidth:t=3,children:o,iconSize:n,style:r,gradientFrom:s,gradientTo:a}){let{colors:d}=W(),f=s??d.warning,p=a??"#FBBF24",l=useRef(new Animated.Value(0)).current,h=useId(),x=useMemo(()=>`circularProgressGrad_${h.replace(/[^a-zA-Z0-9_-]/g,"")}`,[h]),P=(e-t)/2,I=2*Math.PI*P,C=e/2,u=n??Math.max(0,Math.round(e-t*2-8)),m=(e-u)/2;useEffect(()=>{let i=Animated.loop(Animated.timing(l,{toValue:1,duration:1500,easing:Easing.linear,useNativeDriver:true}));return i.start(),()=>i.stop()},[l]);let g=l.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxs(View,{style:[{width:e,height:e},r],children:[jsx(Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:g}]},children:jsxs(_e,{width:e,height:e,children:[jsx(Defs,{children:jsxs(LinearGradient,{id:x,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsx(Stop,{offset:"0%",stopColor:f}),jsx(Stop,{offset:"100%",stopColor:p})]})}),jsx(Circle,{cx:C,cy:C,r:P,stroke:`url(#${x})`,strokeWidth:t,fill:"none",strokeDasharray:`${I*.75} ${I*.25}`,strokeLinecap:"round",rotation:-90,origin:`${C}, ${C}`})]})}),o!=null?jsx(View,{style:{position:"absolute",top:m+1.5,left:m,width:u,height:u},children:o}):null]})}function ui(e){let t=e.split("/"),o=t[t.length-1];return o&&o.length>10?`${o.slice(0,6)}...${o.slice(-3)}`:o||""}function Ls(e){let o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],n=e.getDate(),r=e.getFullYear(),s=e.getHours(),a=e.getMinutes(),d=s>=12?"pm":"am";s=s%12,s=s||12;let f=a<10?`0${a}`:a;return `${o} ${n}, ${r} at ${s}:${f}${d}`}function Io({visible:e,status:t,tokenIconUrl:o,explorerUrl:n,completionExplorerUrl:r,date:s,amountUsd:a,onClose:d,borderTopLeftRadius:f,borderTopRightRadius:p}){let{colors:l,fonts:h,components:x}=W(),[P,I]=useState(false),C=t==="pending"||t==="waiting"||t==="delayed",u=t==="succeeded",m=()=>{n&&Linking.openURL(n);},g=()=>{r&&Linking.openURL(r);};return jsx(pe,{visible:e,onClose:d,closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:f,borderTopRightRadius:p,children:jsxs(View,{style:he.container,children:[jsx(TouchableOpacity,{style:he.closeButton,onPress:d,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Ge,{size:20,color:x.header.buttonColor,strokeWidth:2})}),jsx(View,{style:he.iconContainer,children:C?jsx(gr,{size:80,strokeWidth:4,iconSize:68,children:o?jsx(Image,{source:{uri:$(o)},style:he.tokenIconFill}):jsx(View,{style:[he.tokenIconFill,{backgroundColor:l.cardHover}]})}):jsxs(Fragment,{children:[o?jsx(Image,{source:{uri:$(o)},style:he.tokenIconLarge}):jsx(View,{style:[he.tokenIconLarge,{backgroundColor:l.cardHover}]}),jsx(View,{style:[he.statusBadge,{backgroundColor:x.container.iconBackgroundColor}],children:jsx(We,{size:16,color:x.container.iconColor,strokeWidth:3})})]})}),jsx(Text,{style:[he.title,{color:x.container.titleColor,fontFamily:h.semibold}],children:C?"Deposit Processing":"Deposit Complete"}),a!==void 0&&jsxs(Text,{style:[he.amount,{color:x.container.titleColor,fontFamily:h.bold}],children:["$",a.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),s&&jsx(Text,{style:[he.date,{color:x.container.subtitleColor,fontFamily:h.regular}],children:Ls(s)}),jsx(Text,{style:[he.subtitle,{color:x.container.subtitleColor,fontFamily:h.regular}],children:C?"This usually takes less than a minute.":"Your account has been credited successfully!"}),u&&(n||r)&&jsxs(View,{style:he.detailsSection,children:[jsx(View,{style:[he.divider,{backgroundColor:l.border}]}),jsxs(TouchableOpacity,{style:he.detailsToggle,onPress:()=>I(!P),children:[jsx(Text,{style:[he.detailsToggleText,{color:x.container.actionTitle,fontFamily:h.medium}],children:P?"See less":"See more details"}),P?jsx(jt,{size:18,color:x.container.actionColor,strokeWidth:2}):jsx(Ye,{size:18,color:x.container.actionColor,strokeWidth:2})]}),P&&jsxs(View,{style:he.txButtonsContainer,children:[n&&jsxs(TouchableOpacity,{style:[he.txButton,{backgroundColor:x.card.backgroundColor,borderColor:l.border}],onPress:m,children:[jsx(Text,{style:[he.txLabel,{color:x.card.titleColor,fontFamily:h.medium}],children:"Deposit tx"}),jsx(Text,{style:[he.txHash,{color:x.card.subtitleColor,fontFamily:h.regular}],children:ui(n)}),jsx(oo,{size:16,color:x.card.actionColor,strokeWidth:2})]}),r&&jsxs(TouchableOpacity,{style:[he.txButton,{backgroundColor:x.card.backgroundColor,borderColor:l.border}],onPress:g,children:[jsx(Text,{style:[he.txLabel,{color:x.card.titleColor,fontFamily:h.medium}],children:"Completion tx"}),jsx(Text,{style:[he.txHash,{color:x.card.subtitleColor,fontFamily:h.regular}],children:ui(r)}),jsx(oo,{size:16,color:x.card.actionColor,strokeWidth:2})]})]})]})]})})}var he=StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:40},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});function hr({depositConfirmationMode:e,depositAddress:t,showWaitingUi:o,latestExecution:n,onIveDeposited:r}){let{colors:s,fonts:a,components:d}=W();return jsxs(Fragment,{children:[e==="manual"&&t&&!o&&jsx(TouchableOpacity,{onPress:r,activeOpacity:.8,style:[io.iveDepositedButton,{backgroundColor:s.primary,borderRadius:d.button.borderRadius,borderWidth:d.button.borderWidth,borderColor:d.button.borderColor}],children:jsx(Text,{style:[io.iveDepositedButtonText,{color:s.primaryForeground??"#FFF",fontFamily:a.semibold}],children:"I've made the deposit"})}),o&&!n&&jsxs(View,{style:[io.processingCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor,shadowColor:d.card.shadowOpacity>0?d.card.shadowColor:void 0,shadowOffset:d.card.shadowOpacity>0?d.card.shadowOffset:void 0,shadowOpacity:d.card.shadowOpacity,shadowRadius:d.card.shadowRadius,elevation:d.card.elevation}],children:[jsx(View,{style:[io.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsx(tn,{size:14,color:d.card.iconColor,strokeWidth:2})}),jsxs(View,{style:io.processingCardText,children:[jsx(Text,{style:[io.processingCardTitle,{color:d.card.titleColor,fontFamily:a.semibold}],children:"Processing deposit transactions."}),jsx(Text,{style:[io.processingCardSubtitle,{color:d.card.subtitleColor,fontFamily:a.regular}],children:"We're checking if your deposit has landed."})]})]})]})}var io=StyleSheet.create({iveDepositedButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",padding:12,marginBottom:12,gap:12},processingCardText:{flex:1,gap:4},processingCardTitle:{fontSize:14},processingCardSubtitle:{fontSize:12,lineHeight:18},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"}});var Jo=(e,t)=>`${t}:${e}`,As=e=>{let[t,o]=e.split(":");return {chainType:t,chainId:o}};function Cr({externalUserId:e,publishableKey:t,recipientAddress:o,destinationChainType:n,destinationChainId:r,destinationTokenAddress:s,destinationTokenSymbol:a,defaultChainType:d,defaultChainId:f,defaultTokenAddress:p,depositConfirmationMode:l="auto_ui",onExecutionsChange:h,onDepositSuccess:x,onDepositError:P,borderTopLeftRadius:I,borderTopRightRadius:C,sheetBorderRadius:u}){let{colors:m,fonts:g,components:i}=W(),c=d&&f?`${d}:${f}`:"solana:mainnet",[R,b]=useState("USDC"),[M,_]=useState(c),[w,Y]=useState([]),[J,A]=useState(true),[U,K]=useState([]),[ee,je]=useState(true),[ut,Xe]=useState(false),[ne,Ie]=useState(false),[et,De]=useState(false),[Te,ze]=useState(false),[Ne,it]=useState([]),[Wt,Et]=useState(new Map),[Ot]=useState(()=>new Date),[pt,$e]=useState(null),[Tt,st]=useState(false),[ie,ve]=useState(null),[Pe,Me]=useState(false),qe=new Map;U.forEach(v=>{v.chains.forEach(F=>{let q=`${F.chain_type}:${F.chain_id}`;qe.has(q)||qe.set(q,F);});});let Ue=Array.from(qe.values()),Ze=As(M),Po=Ue.find(v=>v.chain_type===Ze.chainType&&v.chain_id===Ze.chainId)?.chain_type||"ethereum",At=Zt(w,Po),xe=At?.address||"",Be=useRef(false);useEffect(()=>{async function v(){try{je(!0),$e(null);let q=await zo(t,s&&r&&n?{destination_token_address:s,destination_chain_id:r,destination_chain_type:n}:void 0);if(K(q.data),q.data.length>0&&!Be.current){Be.current=!0;let H,we;if(d&&f)if(p)for(let ge of q.data){let gt=ge.chains.find(mt=>mt.chain_type===d&&mt.chain_id===f&&mt.token_address.toLowerCase()===p.toLowerCase());if(gt){H=ge,we=gt;break}}else for(let ge of q.data){let gt=ge.chains.find(mt=>mt.chain_type===d&&mt.chain_id===f);if(gt){H=ge,we=gt;break}}if(!H&&s)for(let ge of q.data){let gt=ge.chains.find(mt=>mt.token_address.toLowerCase()===s.toLowerCase());if(gt){H=ge,we=gt;break}}H||(H=q.data.find(ge=>ge.symbol==="USDC"),H&&H.chains.length>0&&(we=H.chains[0])),H||(H=q.data.find(ge=>ge.symbol==="USDT"),H&&H.chains.length>0&&(we=H.chains[0])),H||(H=q.data[0],H.chains.length>0&&(we=H.chains[0])),H&&b(H.symbol),we&&_(Jo(we.chain_id,we.chain_type));}}catch(F){console.error("Error fetching supported tokens:",F),$e("Failed to load supported tokens"),P?.({message:"Failed to load supported tokens",error:F});}finally{je(false);}}v();},[t,P,d,f,p,s,r,n]),useEffect(()=>{async function v(){try{A(!0),$e(null);let F=await Xt({external_user_id:e,recipient_address:o,destination_chain_type:n,destination_chain_id:r,destination_token_address:s},t);Y(F.data);}catch(F){console.error("Error fetching wallets:",F),$e("Failed to load wallets"),P?.({message:"Failed to load wallets",error:F});}finally{A(false);}}v();},[e,o,n,r,s,t,P]);let Bo=At?.id??"",{showWaitingUi:uo,handleIveDeposited:po}=Yo({depositConfirmationMode:l,depositAddress:xe,chain:M,externalUserId:e,publishableKey:t,modalOpenedAt:Ot,depositWalletId:Bo,depositExecutions:Ne,trackedExecutions:Wt,setDepositExecutions:it,setTrackedExecutions:Et,setLatestExecution:ve,setShowStatusSheet:st,onDepositSuccess:x,onExecutionsChange:h,onDepositError:P});useEffect(()=>{if(!U.length)return;let v=U.find(q=>q.symbol===R);if(!v||v.chains.length===0)return;if(!v.chains.some(q=>Jo(q.chain_id,q.chain_type)===M)){let q=v.chains[0];_(Jo(q.chain_id,q.chain_type));}},[R,U,M]);let Ve=U.find(v=>v.symbol===R),Vo=Ve?.chains||[],Fe=Vo.find(v=>Jo(v.chain_id,v.chain_type)===M),fo=async()=>{if(xe)try{Clipboard.setString(xe),Xe(!0),setTimeout(()=>Xe(!1),2e3);}catch(v){console.error("Failed to copy:",v);}},Kt=Fe?.estimated_price_impact_percent??0,ft=Fe?.max_slippage_percent??.25,Fo=Fe?.minimum_deposit_amount_usd??3;if(ee)return jsxs(View,{style:y.loadingContainer,children:[jsx(ActivityIndicator,{size:"large",color:m.primary}),jsx(Text,{style:[y.loadingText,{color:m.foregroundMuted,fontFamily:g.regular}],children:"Loading currencies..."})]});if(pt&&U.length===0)return jsxs(View,{style:y.errorContainer,children:[jsx(Text,{style:[y.errorText,{color:m.error,fontFamily:g.regular}],children:pt}),jsx(Text,{style:[y.errorHint,{color:m.foregroundMuted,fontFamily:g.regular}],children:"Please check your network connection and try again."})]});let te=()=>jsxs(pe,{visible:et,onClose:()=>De(false),closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:u?.tokenSelector?.borderTopLeftRadius??I,borderTopRightRadius:u?.tokenSelector?.borderTopRightRadius??C,children:[jsxs(View,{style:[y.sheetHeader,{borderBottomColor:m.border}],children:[jsx(View,{style:y.sheetHeaderSpacer}),jsx(Text,{style:[y.sheetTitle,{color:i.header.titleColor,fontFamily:g.medium}],children:"Select Token"}),jsx(TouchableOpacity$1,{onPress:()=>De(false),style:y.sheetCloseButton,children:jsx(Ge,{size:20,color:i.header.buttonColor,strokeWidth:2})})]}),jsx(ScrollView,{style:y.sheetList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:U.map(v=>jsxs(TouchableOpacity$1,{onPress:()=>{b(v.symbol),De(false);},activeOpacity:.7,style:[y.sheetItem,{backgroundColor:R===v.symbol?i.card.backgroundColor:"transparent"}],children:[jsx(Image,{source:{uri:$(de(v,"png"))},style:y.sheetItemIcon}),jsxs(View,{style:y.sheetItemText,children:[jsx(Text,{style:[y.sheetItemTitle,{color:i.card.titleColor,fontFamily:g.medium}],children:v.symbol}),jsxs(Text,{style:[y.sheetItemSubtitle,{color:i.card.subtitleColor,fontFamily:g.regular}],children:[v.chains.length," network",v.chains.length!==1?"s":""," available"]})]}),R===v.symbol&&jsx(We,{size:20,color:m.primary,strokeWidth:2})]},v.symbol))})]}),ke=()=>jsxs(pe,{visible:Te,onClose:()=>ze(false),closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:u?.chainSelector?.borderTopLeftRadius??I,borderTopRightRadius:u?.chainSelector?.borderTopRightRadius??C,children:[jsxs(View,{style:[y.sheetHeader,{borderBottomColor:m.border}],children:[jsx(View,{style:y.sheetHeaderSpacer}),jsx(Text,{style:[y.sheetTitle,{color:i.header.titleColor,fontFamily:g.medium}],children:"Select Network"}),jsx(TouchableOpacity$1,{onPress:()=>ze(false),style:y.sheetCloseButton,children:jsx(Ge,{size:20,color:i.header.buttonColor,strokeWidth:2})})]}),jsx(ScrollView,{style:y.sheetList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:Vo.map(v=>{let F=Jo(v.chain_id,v.chain_type),q=M===F;return jsxs(TouchableOpacity$1,{onPress:()=>{_(F),ze(false);},activeOpacity:.7,style:[y.sheetItem,{backgroundColor:q?i.card.backgroundColor:"transparent"}],children:[jsx(Image,{source:{uri:$(de(v,"png"))},style:y.sheetItemIcon}),jsxs(View,{style:y.sheetItemText,children:[jsx(Text,{style:[y.sheetItemTitle,{color:i.card.titleColor,fontFamily:g.medium}],children:v.chain_name}),jsxs(Text,{style:[y.sheetItemSubtitle,{color:i.card.subtitleColor,fontFamily:g.regular}],children:["Min deposit: $",v.minimum_deposit_amount_usd]})]}),q&&jsx(We,{size:20,color:m.primary,strokeWidth:2})]},F)})})]});return jsxs(View,{style:y.container,children:[jsxs(View,{style:y.selectorSection,children:[jsx(Text,{style:[y.selectorLabel,{color:i.card.labelColor,fontFamily:g.regular}],children:"Token"}),jsxs(TouchableOpacity$1,{onPress:()=>De(true),style:[y.selector,{backgroundColor:i.card.backgroundColor,borderRadius:i.card.borderRadius,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[Ve&&jsx(Image,{source:{uri:$(de(Ve,"png"))},style:y.selectorIcon}),jsx(Text,{style:[y.selectorText,{color:i.card.titleColor,fontFamily:g.medium}],children:R}),jsx(Ye,{size:16,color:i.card.actionColor,strokeWidth:2})]})]}),jsxs(View,{style:y.selectorSection,children:[jsxs(Text,{style:[y.selectorLabel,{color:i.card.labelColor,fontFamily:g.regular}],children:["Network"," ",jsxs(Text,{style:[y.minDeposit,{fontFamily:g.regular}],children:["($",Fo," min)"]})]}),jsxs(TouchableOpacity$1,{onPress:()=>ze(true),style:[y.selector,{backgroundColor:i.card.backgroundColor,borderRadius:i.card.borderRadius,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[Fe&&jsx(Image,{source:{uri:$(de(Fe,"png"))},style:y.selectorIcon}),jsx(Text,{style:[y.selectorText,{color:i.card.titleColor,fontFamily:g.medium}],numberOfLines:1,children:Fe?.chain_name||"Select network"}),jsx(Ye,{size:16,color:i.card.actionColor,strokeWidth:2})]})]}),jsx(View,{style:y.qrContainer,children:jsx(View,{style:[y.qrWrapper,{backgroundColor:m.background,borderRadius:i.card.borderRadius,borderWidth:i.card.borderWidth>0?i.card.borderWidth:1,borderColor:i.card.borderColor}],children:J?jsxs(View,{style:y.qrLoading,children:[jsx(ActivityIndicator,{size:"small",color:m.primary}),jsx(Text,{style:[y.loadingText,{color:m.foregroundMuted,fontFamily:g.regular}],children:"Loading..."})]}):xe?jsx(_o,{value:xe,size:160,logoUri:$(de(Fe,"png")||He("/icons/networks/png/ethereum.png")),logoSize:40}):jsx(View,{style:y.qrLoading,children:jsx(Text,{style:[y.errorText,{color:m.error,fontFamily:g.regular}],children:"No address available"})})})}),jsxs(View,{style:y.addressSection,children:[jsxs(View,{style:y.addressHeader,children:[jsx(Text,{style:[y.addressLabel,{color:i.card.labelColor,fontFamily:g.medium}],children:"Deposit Address"}),ut&&jsxs(View,{style:y.copiedIndicator,children:[jsx(We,{size:14,color:m.success,strokeWidth:2}),jsx(Text,{style:[y.copiedText,{color:m.success,fontFamily:g.regular}],children:"Copied"})]})]}),jsxs(Le,{cardTokens:i.transferCrypto.depositAddress.card,onPress:!J&&xe?fo:void 0,contentStyle:y.addressBox,children:[jsx(Text,{style:[y.addressText,{color:i.card.titleColor,fontFamily:g.regular}],numberOfLines:2,children:J?"Loading...":xe||"No address available"}),jsx(View,{style:y.addressCopyIcon,children:jsx(Ho,{size:16,color:i.card.actionColor,strokeWidth:1})})]})]}),jsxs(View,{style:[y.detailsCard,{backgroundColor:i.card.backgroundColor,borderRadius:i.card.borderRadius,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxs(TouchableOpacity$1,{onPress:()=>Ie(!ne),style:y.detailsHeader,children:[jsxs(View,{style:y.detailsRow,children:[jsx(View,{style:[y.detailIcon,{backgroundColor:i.card.iconBackgroundColor,borderRadius:i.card.iconContainerBorderRadius}],children:jsx(to,{size:12,color:i.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[y.detailsLabel,{color:i.card.titleColor,fontFamily:g.regular}],children:"Processing time: < 1 min"})]}),jsx(View,{style:y.chevronContainer,children:ne?jsx(jt,{size:16,color:i.card.actionColor,strokeWidth:2}):jsx(Ye,{size:16,color:i.card.actionColor,strokeWidth:2})})]}),ne&&jsxs(View,{style:y.detailsContent,children:[jsxs(View,{style:y.detailsRow,children:[jsx(View,{style:[y.detailIcon,{backgroundColor:i.card.iconBackgroundColor,borderRadius:i.card.iconContainerBorderRadius}],children:jsx(bo,{size:12,color:i.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[y.detailsLabel,{color:i.card.titleColor,fontFamily:g.regular}],children:["Price impact: ",Kt.toFixed(2),"%"]}),jsx(TouchableOpacity$1,{onPress:()=>Me(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(ko,{size:14,color:i.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:y.detailsRow,children:[jsx(View,{style:[y.detailIcon,{backgroundColor:i.card.iconBackgroundColor,borderRadius:i.card.iconContainerBorderRadius}],children:jsx(wo,{size:12,color:i.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[y.detailsLabel,{color:i.card.titleColor,fontFamily:g.regular}],children:["Slippage: Auto \u2022 ",ft.toFixed(2),"%"]}),jsx(TouchableOpacity$1,{onPress:()=>Me(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(ko,{size:14,color:i.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:y.detailsRow,children:[jsx(View,{style:[y.detailIcon,{backgroundColor:i.card.iconBackgroundColor,borderRadius:i.card.iconContainerBorderRadius}],children:jsx(ar,{size:12,color:i.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[y.detailsLabel,{color:i.card.titleColor,fontFamily:g.regular}],children:["Need help?"," ",jsx(Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsx(hr,{depositConfirmationMode:l,depositAddress:xe,showWaitingUi:uo,latestExecution:ie,onIveDeposited:po}),jsx(TouchableOpacity$1,{style:y.termsContainer,onPress:()=>Linking.openURL("https://unifold.io/terms"),children:jsx(Text,{style:[y.termsText,{color:m.primary,fontFamily:g.regular}],children:"Terms apply"})}),te(),ke(),jsxs(pe,{visible:Pe,onClose:()=>Me(false),closeOnBackdropPress:true,showHandle:true,borderTopLeftRadius:u?.infoSheet?.borderTopLeftRadius??I,borderTopRightRadius:u?.infoSheet?.borderTopRightRadius??C,children:[jsxs(View,{style:[y.sheetHeader,{borderBottomColor:m.border}],children:[jsx(View,{style:y.sheetHeaderSpacer}),jsx(Text,{style:[y.sheetTitle,{color:i.header.titleColor,fontFamily:g.medium}],children:"Price Impact & Slippage"}),jsx(TouchableOpacity$1,{onPress:()=>Me(false),style:y.sheetCloseButton,children:jsx(Ge,{size:20,color:i.header.buttonColor,strokeWidth:2})})]}),jsxs(View,{style:y.infoSheetContent,children:[jsxs(View,{style:[y.infoCard,{backgroundColor:i.card.backgroundColor,borderRadius:i.card.borderRadius,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxs(View,{style:y.infoCardHeader,children:[jsx(View,{style:[y.infoCardIcon,{backgroundColor:i.card.iconBackgroundColor,borderRadius:i.card.iconContainerBorderRadius}],children:jsx(bo,{size:16,color:i.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[y.infoCardTitle,{color:i.card.titleColor,fontFamily:g.medium}],children:"Price Impact"}),jsxs(Text,{style:[y.infoCardValue,{color:i.card.titleColor,fontFamily:g.medium}],children:[Kt.toFixed(2),"%"]})]}),jsx(Text,{style:[y.infoCardDescription,{color:i.card.descriptionColor,fontFamily:g.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxs(View,{style:[y.infoCard,{backgroundColor:i.card.backgroundColor,borderRadius:i.card.borderRadius,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxs(View,{style:y.infoCardHeader,children:[jsx(View,{style:[y.infoCardIcon,{backgroundColor:i.card.iconBackgroundColor,borderRadius:i.card.iconContainerBorderRadius}],children:jsx(wo,{size:16,color:i.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[y.infoCardTitle,{color:i.card.titleColor,fontFamily:g.medium}],children:"Max Slippage"}),jsxs(Text,{style:[y.infoCardValue,{color:i.card.titleColor,fontFamily:g.medium}],children:[ft.toFixed(2),"%"]})]}),jsx(Text,{style:[y.infoCardDescription,{color:i.card.descriptionColor,fontFamily:g.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),ie&&jsx(Io,{visible:Tt,status:ie.status,tokenIconUrl:ie.destination_token_metadata?.icon_urls?.find(v=>v.format==="png")?.url||ie.destination_token_metadata?.icon_url||de(Ve,"png"),explorerUrl:ie.explorer_url,completionExplorerUrl:ie.destination_explorer_url,date:ie.created_at?new Date(ie.created_at):void 0,amountUsd:ie.source_amount_usd?parseFloat(ie.source_amount_usd):void 0,onClose:()=>st(false),borderTopLeftRadius:u?.depositStatus?.borderTopLeftRadius??I,borderTopRightRadius:u?.depositStatus?.borderTopRightRadius??C})]})}var y=StyleSheet.create({container:{flex:1,padding:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:13,marginBottom:8},minDeposit:{fontSize:10},selector:{flexDirection:"row",alignItems:"center",gap:10,padding:12,borderRadius:12},selectorIcon:{width:24,height:24,borderRadius:12},selectorText:{flex:1,fontSize:14,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:16},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:13},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},spacer:{flex:1},termsContainer:{alignItems:"center"},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},sheetList:{maxHeight:400,paddingTop:8},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:8,borderRadius:12,gap:12},sheetItemIcon:{width:40,height:40,borderRadius:20},sheetItemText:{flex:1},sheetItemTitle:{fontSize:16,fontWeight:"500"},sheetItemSubtitle:{fontSize:12,marginTop:2},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});function br({currency:e,isSelected:t,onSelect:o}){let{colors:n,fonts:r,components:s}=W();return jsxs(TouchableOpacity$1,{onPress:()=>o(e.currency_code),activeOpacity:.7,style:[so.container,{backgroundColor:s.card.backgroundColor,borderRadius:s.list.rowBorderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxs(View,{style:so.leftContent,children:[jsx(View,{style:[so.iconContainer,{backgroundColor:n.background}],children:jsx(Image,{source:{uri:$(de(e,"png"))},style:so.icon})}),jsxs(View,{style:so.textContainer,children:[jsx(Text,{style:[so.name,{color:s.card.titleColor,fontFamily:r.medium}],children:e.name}),jsx(Text,{style:[so.code,{color:s.card.subtitleColor,fontFamily:r.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsx(We,{size:16,color:n.primary,strokeWidth:2})]})}var so=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,marginHorizontal:8,marginVertical:4},leftContent:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:40,height:40,borderRadius:20,overflow:"hidden",alignItems:"center",justifyContent:"center"},icon:{width:40,height:40,borderRadius:20},textContainer:{gap:2},name:{fontSize:14,fontWeight:"400"},code:{fontSize:12,fontWeight:"300"}});function Xo({title:e,currencies:t,selectedCurrency:o,onSelect:n}){let{fonts:r,components:s}=W();return t.length===0?null:jsxs(View,{children:[jsx(View,{style:hi.headerContainer,children:jsx(Text,{style:[hi.title,{color:s.list.titleSectionColor,fontFamily:r.medium}],children:e})}),t.map(a=>jsx(br,{currency:a,isSelected:o.toLowerCase()===a.currency_code.toLowerCase(),onSelect:n},a.currency_code))]})}var hi=StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function wr({open:e,onOpenChange:t,currencies:o,preferredCurrencyCodes:n,selectedCurrency:r,onSelectCurrency:s,borderTopLeftRadius:a,borderTopRightRadius:d}){let{colors:f,fonts:p,components:l}=W(),[h,x]=useState(""),P=n.map(c=>o.find(R=>R.currency_code.toLowerCase()===c.toLowerCase())).filter(c=>c!==void 0),I=o.filter(c=>!n.includes(c.currency_code.toLowerCase())),C=c=>{if(!h)return c;let R=h.toLowerCase();return c.filter(b=>b.name.toLowerCase().includes(R)||b.currency_code.toLowerCase().includes(R))},u=C(P),m=C(I),g=c=>{s(c),t(false),x("");},i=()=>{t(false),x("");};return jsxs(pe,{visible:e,onClose:i,closeOnBackdropPress:true,showHandle:false,heightPercent:.9,borderTopLeftRadius:a,borderTopRightRadius:d,children:[jsx(rt,{title:"Currency",showBack:false,onClose:i}),jsx(View,{style:ao.searchContainer,children:jsx(TextInput,{style:[ao.searchInput,{backgroundColor:l.search.backgroundColor,color:l.search.inputColor,fontFamily:p.regular,borderRadius:l.input.borderRadius,borderWidth:l.input.borderWidth,borderColor:l.input.borderColor}],value:h,onChangeText:x,placeholder:"Search",placeholderTextColor:l.search.placeholderColor})}),jsx(ScrollView,{style:ao.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxs(View,{style:ao.listContent,children:[jsx(Xo,{title:"Popular currencies",currencies:u,selectedCurrency:r,onSelect:g}),u.length>0&&m.length>0&&jsx(View,{style:ao.sectionSpacer}),jsx(Xo,{title:"All currencies",currencies:m,selectedCurrency:r,onSelect:g}),u.length===0&&m.length===0&&jsx(View,{style:ao.noResultsContainer,children:jsx(Text,{style:[ao.noResultsText,{color:l.container.subtitleColor,fontFamily:p.regular}],children:"No currencies found"})})]})})]})}var ao=StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:18,paddingBottom:12},searchInput:{padding:16,fontSize:14},listContainer:{flex:1,paddingHorizontal:12},listContent:{paddingBottom:24},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});function Sn(e){try{return new Intl.NumberFormat("en",{style:"currency",currency:e.toUpperCase(),minimumFractionDigits:0,maximumFractionDigits:0}).format(0).replace(/\d/g,"").trim()}catch{return e.toUpperCase()}}function Sr({externalUserId:e,publishableKey:t,view:o,onViewChange:n,destinationTokenSymbol:r,recipientAddress:s,destinationChainType:a,destinationChainId:d,destinationTokenAddress:f,onDepositSuccess:p,onDepositError:l,borderTopLeftRadius:h,borderTopRightRadius:x,sheetBorderRadius:P}){let{colors:I,fonts:C,components:u}=W(),[m,g]=useState(""),[i,c]=useState("usd"),[R,b]=useState(false),[M,_]=useState(false),[w,Y]=useState([]),[J,A]=useState(false),[U,K]=useState(null),[ee,je]=useState(null),[ut,Xe]=useState("amount"),[ne,Ie]=useState(null),[et,De]=useState(true),[Te,ze]=useState(null),[Ne,it]=useState(false),Wt=useRef(null),Et=useRef(false);useEffect(()=>{Wt.current=ne;},[ne]),useEffect(()=>{Et.current=Ne;},[Ne]);let[Ot,pt]=useState([]),[$e,Tt]=useState(true),[st,ie]=useState(60),[ve,Pe]=useState([]),[Me,qe]=useState([]),[Ue,Ze]=useState(null),[ue,Po]=useState(null),[At,xe]=useState(true),[Be,Bo]=useState(null),[uo,po]=useState(false),[Ve,Vo]=useState(null),[Fe,fo]=useState(false),[Kt,ft]=useState(false),[Fo,te]=useState(false),[ke,v]=useState(null),F=o??ut,q=useRef(null),H=ve.find(L=>L.currency_code.toLowerCase()===i.toLowerCase()),we=useCallback(L=>{Xe(L),L==="quotes"?n?.(L,w.length):n?.(L);},[w.length,n]);useEffect(()=>{async function L(){try{let O=await Uo();Po(O);}catch(O){console.error("Error fetching user IP:",O);}finally{xe(false);}}L();},[]),useEffect(()=>{async function L(){try{let O=await Xt({external_user_id:e,recipient_address:s,destination_chain_type:a,destination_chain_id:d,destination_token_address:f},t);pt(O.data);}catch(O){console.error("Error fetching wallets:",O),K("Failed to load wallet addresses");}finally{Tt(false);}}L();},[e,s,a,d,f,t]);let ge=r||Ue?.symbol.toUpperCase()||"USDC",gt=ho(Ue?.icon_urls,"png")||Ue?.icon_url,mt=ho(Ue?.chain_icon_urls,"png")||Ue?.chain_icon_url;useEffect(()=>{async function L(){try{let O=await Qr(t);Pe(O.data),qe(O.preferred||[]);}catch(O){console.error("Error fetching fiat currencies:",O);}}L();},[t]),useEffect(()=>{if(R||ve.length===0||!ue?.alpha2)return;let L=ue.alpha2.toUpperCase(),O=ve.find(me=>me.country_codes.includes(L));if(O)c(O.currency_code.toLowerCase()),!m&&!M&&g(String(O.default_amount??100));else if(!m&&!M){let me=ve.find(ht=>ht.currency_code.toLowerCase()==="usd");me&&g(String(me.default_amount??100));}},[ve,ue,R,m,M]),useEffect(()=>{if(ve.length!==0){if(q.current!==null&&q.current!==i){let L=ve.find(O=>O.currency_code.toLowerCase()===i.toLowerCase());L&&g(String(L.default_amount??100));}q.current=i;}},[i,ve]),useEffect(()=>{async function L(){try{let O=await jr({chain_type:a||"",chain_id:d||"",token_address:f||""},t);Ze(O);}catch(O){console.error("Error fetching supported tokens:",O);}}L();},[a,d,f,t]),useEffect(()=>{async function L(){if(!(!f||!d||!a)&&!At){po(true);try{let O=await qr({country_code:ue?.alpha2?.toUpperCase()||"US",subdivision_code:ue?.state||void 0,token_address:f,chain_id:d,chain_type:a},t);Bo(O);}catch(O){console.error("Error fetching default onramp token:",O);}finally{po(false);}}}L();},[f,d,a,ue,At,t]),useEffect(()=>{let L=parseFloat(m);if(isNaN(L)||L<=0){Y([]),je(null);return}if(!Be||uo){Y([]),Ie(null);return}let O=ve.find(ht=>ht.currency_code.toLowerCase()===i.toLowerCase());if(O){if(L<O.minimum_amount){Y([]),Ie(null),je(`Minimum amount is ${Sn(i)}${O.minimum_amount.toLocaleString()}`);return}if(L>O.maximum_amount){Y([]),Ie(null),je(`Maximum amount is ${Sn(i)}${O.maximum_amount.toLocaleString()}`);return}}je(null);let me=setTimeout(()=>{En(L);},500);return ()=>clearTimeout(me)},[m,i,t,Be,uo,ve]);let En=async L=>{if(!Be){K("Loading token information...");return}A(true),K(null);try{let O={country_code:ue?.alpha2?.toUpperCase()||"US",source_amount:L.toString(),source_currency:i.toLowerCase(),destination_currency:Be.destination_currency,destination_network:Be.destination_network,subdivision_code:ue?.state||void 0},me=await Nr(O,t);Y(me.data);let ht=Et.current,On=Wt.current;if(ht&&On){let go=me.data.find(xt=>xt.service_provider===On.service_provider);if(go){if(Ie(go),me.data.length>0){let xt=me.data.reduce((zt,Wo)=>Wo.destination_amount>zt.destination_amount?Wo:zt);Te||ze(xt.service_provider),De(go.service_provider===Te);}}else if(me.data.length>0){let xt=me.data.reduce((zt,Wo)=>Wo.destination_amount>zt.destination_amount?Wo:zt);Ie(xt),ze(xt.service_provider),De(!0),it(!1);}}else if(me.data.length>0){let go=me.data.reduce((xt,zt)=>zt.destination_amount>xt.destination_amount?zt:xt);Ie(go),ze(go.service_provider),De(!0);}ie(60);}catch(O){console.error("Failed to fetch quotes:",O),K("Failed to fetch quotes. Please try again."),Y([]);}finally{A(false);}};useEffect(()=>{if(w.length===0)return;let L=setInterval(()=>{ie(O=>{if(O<=1){let me=parseFloat(m);return !isNaN(me)&&me>0&&En(me),60}return O-1});},1e3);return ()=>clearInterval(L)},[w.length,m]);let Hi=L=>{(/^\d*\.?\d{0,2}$/.test(L)||L==="")&&(g(L),_(true));},ji=L=>{g(L.toString()),_(true);},Ni=async()=>{if(ne&&Be)try{let L=Be.destination_token_metadata.chain_type,O=Zt(Ot,L);if(!O?.address){K("Wallet address not available");return}let me={service_provider:ne.service_provider,country_code:ne.country_code?.toUpperCase()||ue?.alpha2?.toUpperCase()||"US",source_currency:ne.source_currency,source_amount:m,destination_currency:ne.destination_currency,destination_network:ne.destination_network,wallet_address:O.address,subdivision_code:ue?.state||void 0},ht=await $r(me,t);Vo({provider:ne,sourceCurrency:i,sourceAmount:m,sessionUrl:ht.url}),v(ht.url),te(!0);}catch(L){console.error("Failed to create session:",L),K("Failed to start payment flow"),l?.({message:"Failed to start payment flow",error:L});}},Or=Sn(i),$i=()=>{te(false),we("onramp"),p?.({message:"Payment flow completed"});},qi=()=>jsx(Zs,{visible:Fo,onClose:$i,url:ke,providerName:ne?.service_provider_display_name||"Complete Payment",colors:I,fonts:C,borderTopLeftRadius:P?.webView?.borderTopLeftRadius??h,borderTopRightRadius:P?.webView?.borderTopRightRadius??x});return F==="amount"?jsxs(Fragment,{children:[jsxs(View,{style:S.amountViewContainer,children:[jsxs(ScrollView,{style:S.scrollContainer,contentContainerStyle:S.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsx(View,{style:S.currencySelector,children:jsxs(TouchableOpacity$1,{onPress:()=>fo(true),style:[S.currencyButton,{backgroundColor:u.card.backgroundColor,borderRadius:u.input.borderRadius,borderWidth:u.input.borderWidth,borderColor:u.input.borderColor}],children:[H&&jsx(Image,{source:{uri:$(de(H,"png"))},style:S.currencyIcon}),jsx(Text,{style:[S.currencyText,{color:u.card.titleColor,fontFamily:C.medium}],children:i.toUpperCase()}),jsx(Ye,{size:16,color:u.card.actionColor,strokeWidth:2})]})}),jsx(wr,{open:Fe,onOpenChange:fo,currencies:ve,preferredCurrencyCodes:Me,selectedCurrency:i,onSelectCurrency:L=>{c(L.toLowerCase()),b(true);},borderTopLeftRadius:P?.currencyModal?.borderTopLeftRadius??h,borderTopRightRadius:P?.currencyModal?.borderTopRightRadius??x}),jsx(View,{style:S.amountContainer,children:jsxs(View,{style:S.amountInputRow,children:[jsx(Text,{style:[S.currencySymbol,{color:u.container.titleColor,fontFamily:C.medium}],children:Or}),jsx(TextInput,{style:[S.amountInput,{color:u.container.titleColor,fontFamily:C.medium}],value:m,onChangeText:Hi,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:I.foregroundMuted})]})}),H?.suggested_amounts&&H.suggested_amounts.length>0&&jsx(View,{style:S.quickAmounts,children:H.suggested_amounts.map(L=>jsx(TouchableOpacity$1,{onPress:()=>ji(L),style:[S.quickAmountButton,{backgroundColor:u.card.backgroundColor,borderRadius:u.button.borderRadius,borderWidth:parseFloat(m)===L?2:u.button.borderWidth,borderColor:parseFloat(m)===L?I.primary:u.button.borderColor}],children:jsxs(Text,{style:[S.quickAmountText,{color:u.card.titleColor,fontFamily:C.medium}],children:[Or,L.toLocaleString()]})},L))}),ee&&jsx(Text,{style:[S.validationError,{color:I.error,fontFamily:C.regular}],children:ee}),jsxs(View,{style:S.providerSection,children:[jsxs(View,{style:S.providerHeader,children:[jsx(Text,{style:[S.providerLabel,{color:u.card.labelColor,fontFamily:C.medium}],children:"Provider"}),w.length>0&&!J&&jsxs(Text,{style:[S.refreshText,{color:u.card.labelRightColor,fontFamily:C.regular}],children:["Refreshing in ",st,"s"]})]}),jsx(Le,{cardTokens:u.depositCard.quoteProvider.card,onPress:J||w.length===0?void 0:()=>ft(true),contentStyle:StyleSheet.flatten([S.providerButton,(J||w.length===0)&&S.disabled]),children:J?jsxs(View,{style:S.providerLoading,children:[jsx(ActivityIndicator,{size:"small",color:u.container.subtitleColor}),jsx(Text,{style:[S.loadingText,{color:u.container.subtitleColor,fontFamily:C.regular}],children:"Finding best rates..."})]}):ne?jsxs(View,{style:S.providerContent,children:[jsxs(View,{style:S.providerInfo,children:[et&&jsx(Text,{style:[S.autoPickedText,{color:u.container.subtitleColor,fontFamily:C.regular}],children:"Auto-picked for you"}),jsxs(View,{style:S.providerRow,children:[jsx(Image,{source:{uri:$(nr(ne.icon_urls,"png",ne.icon_url))},style:S.providerIconImage},`provider-${ne.service_provider}`),jsxs(View,{children:[jsx(Text,{style:[S.providerName,{color:u.card.titleColor,fontFamily:C.medium}],children:ne.service_provider_display_name}),jsxs(Text,{style:[S.bestPriceText,{color:I.success,fontFamily:C.regular}],children:["Best price \u2022 ",ne.destination_amount.toFixed(2)," ","USDC"]})]})]})]}),jsx(St,{size:20,color:u.card.actionColor,strokeWidth:2})]}):jsx(Text,{style:[S.noProviderText,{color:u.container.subtitleColor,fontFamily:C.regular}],children:parseFloat(m)>0?"No providers available":"Enter an amount to see providers"})}),U&&jsx(Text,{style:[S.errorText,{color:I.error,fontFamily:C.regular}],children:U})]}),jsxs(pe,{visible:Kt,onClose:()=>ft(false),closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:P?.providerModal?.borderTopLeftRadius??h,borderTopRightRadius:P?.providerModal?.borderTopRightRadius??x,children:[jsx(rt,{title:"Select Provider",showBack:false,onClose:()=>ft(false)}),jsx(ScrollView,{style:S.providerModalList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsx(View,{style:S.quotesList,children:[...w].sort((L,O)=>O.destination_amount-L.destination_amount).map((L,O)=>{let me=ne?.service_provider===L.service_provider,ht=O===0;return jsxs(Le,{cardTokens:u.depositCard.quoteProvider.card,onPress:()=>{Ie(L),it(true),De(L.service_provider===Te),ft(false);},contentStyle:StyleSheet.flatten([S.quoteItem,me&&{borderWidth:2,borderColor:I.primary}]),children:[jsxs(View,{style:S.quoteLeft,children:[jsx(Image,{source:{uri:$(nr(L.icon_urls,"png",L.icon_url))},style:S.providerIconImage}),jsxs(View,{children:[jsx(Text,{style:[S.quoteName,{color:u.card.titleColor,fontFamily:C.medium}],children:L.service_provider_display_name}),ht&&jsx(Text,{style:[S.bestPriceLabel,{color:I.success,fontFamily:C.regular}],children:"\u2713 Best price"})]})]}),jsxs(View,{style:S.quoteRight,children:[jsxs(Text,{style:[S.quoteAmount,{color:u.card.textRightColor,fontFamily:C.medium}],children:[L.destination_amount.toFixed(2)," USDC"]}),jsxs(Text,{style:[S.quoteSource,{color:u.card.subtextRightColor,fontFamily:C.regular}],children:["Fee: ",Or,L.total_fee.toFixed(2)]})]})]},L.service_provider)})})})]})]}),jsx(View,{style:[S.continueButtonContainer,{backgroundColor:I.background}],children:jsx(TouchableOpacity$1,{onPress:Ni,disabled:J||$e||!ne||parseFloat(m)<=0,style:[S.continueButton,{backgroundColor:u.container.buttonColor,borderRadius:u.button.borderRadius,borderWidth:u.button.borderWidth,borderColor:u.button.borderColor},(J||$e||!ne)&&S.disabledButton],children:jsx(Text,{style:[S.continueButtonText,{color:u.container.buttonTitleColor,fontFamily:C.medium}],children:$e?"Loading...":"Continue"})})})]}),qi()]}):F==="onramp"&&Ve?jsxs(View,{style:S.onrampContainer,children:[jsx(Image,{source:{uri:$(nr(Ve.provider.icon_urls,"png",Ve.provider.icon_url))},style:S.onrampProviderIcon}),jsxs(Text,{style:[S.onrampTitle,{color:u.container.titleColor,fontFamily:C.medium}],children:["Complete transaction with ",Ve.provider.service_provider_display_name]}),jsx(Text,{style:[S.onrampSubtitle,{color:u.container.subtitleColor,fontFamily:C.regular}],children:"You can close this modal."}),jsxs(View,{style:[S.flowDiagram,{backgroundColor:u.card.backgroundColor}],children:[jsxs(View,{style:S.flowStep,children:[jsx(Image,{source:{uri:He(`/icons/currencies/png/${Ve.sourceCurrency.toLowerCase()}.png`)},style:S.flowIconImage}),jsx(Text,{style:[S.flowLabel,{color:u.card.subtitleColor,fontFamily:C.regular}],children:"You use"}),jsx(Text,{style:[S.flowValue,{color:u.card.titleColor,fontFamily:C.medium}],children:Ve.sourceCurrency.toUpperCase()})]}),jsx(St,{size:16,color:u.card.actionColor,strokeWidth:2}),jsxs(View,{style:S.flowStep,children:[jsxs(View,{style:S.flowIconWithBadge,children:[jsx(Image,{source:{uri:ho(Be?.destination_token_metadata?.icon_urls,"png")||Be?.destination_token_metadata?.icon_url||He("/icons/tokens/png/usdc.png")},style:S.flowIconImageNoBadge}),jsx(Image,{source:{uri:ho(Be?.destination_token_metadata?.chain?.icon_urls,"png")||Be?.destination_token_metadata?.chain?.icon_url||He("/icons/networks/png/polygon.png")},style:[S.flowNetworkBadge,{borderColor:I.background,borderRadius:u.badge.borderRadius}]})]}),jsx(Text,{style:[S.flowLabel,{color:u.card.subtitleColor,fontFamily:C.regular}],children:"You buy"}),jsx(Text,{style:[S.flowValue,{color:u.card.titleColor,fontFamily:C.medium}],children:"USDC"})]}),jsx(St,{size:16,color:u.card.actionColor,strokeWidth:2}),jsxs(View,{style:S.flowStep,children:[jsxs(View,{style:S.flowIconWithBadge,children:[jsx(Image,{source:{uri:gt||He("/icons/tokens/png/usdc.png")},style:S.flowIconImageNoBadge}),jsx(Image,{source:{uri:mt||He("/icons/networks/png/polygon.png")},style:[S.flowNetworkBadge,{borderColor:I.background,borderRadius:u.badge.borderRadius}]})]}),jsx(Text,{style:[S.flowLabel,{color:u.card.subtitleColor,fontFamily:C.regular}],children:"You receive"}),jsx(Text,{style:[S.flowValue,{color:u.card.titleColor,fontFamily:C.medium}],children:ge})]})]}),jsx(View,{style:[S.onrampInfoBox,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:jsx(Text,{style:[S.onrampInfoText,{color:u.card.descriptionColor,fontFamily:C.regular}],children:"The wallet address displayed in the payment provider is a temporary deposit address. Your funds will be automatically converted and deposited into your account."})})]}):null}function Zs({visible:e,onClose:t,url:o,providerName:n,colors:r,fonts:s,borderTopLeftRadius:a,borderTopRightRadius:d}){return jsxs(pe,{visible:e,onClose:t,closeOnBackdropPress:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:a,borderTopRightRadius:d,children:[jsxs(View,{style:lo.header,children:[jsx(TouchableOpacity$1,{onPress:t,style:lo.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(We,{size:20,color:r.foregroundMuted,strokeWidth:2})}),jsx(Text,{style:[lo.headerTitle,{color:r.foreground,fontFamily:s.medium}],children:n}),jsx(View,{style:lo.headerSpacer})]}),o&&jsx(View,{style:lo.container,children:jsx(WebView,{source:{uri:o},style:lo.webView,startInLoadingState:true,renderLoading:()=>jsx(View,{style:lo.loading,children:jsx(ActivityIndicator,{size:"large",color:r.primary})})})})]})}var lo=StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},headerButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},headerSpacer:{width:28,height:28},container:{flex:1},webView:{flex:1},loading:{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center"}}),S=StyleSheet.create({amountViewContainer:{flex:1},scrollContainer:{flex:1},scrollContent:{padding:16,paddingBottom:16},currencySelector:{alignItems:"center",marginBottom:16},currencyButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:12,paddingVertical:8},currencyText:{fontSize:14,fontWeight:"500"},currencyIcon:{width:24,height:24,borderRadius:12},amountContainer:{alignItems:"center",marginBottom:24},amountInputRow:{flexDirection:"row",alignItems:"center",marginBottom:8},currencySymbol:{fontSize:48,fontWeight:"300"},amountInput:{fontSize:48,fontWeight:"300",minWidth:50},usdcPreview:{fontSize:14},quickAmounts:{flexDirection:"row",justifyContent:"center",gap:12,marginBottom:24},quickAmountButton:{paddingHorizontal:20,paddingVertical:10},quickAmountText:{fontSize:14,fontWeight:"500"},validationError:{fontSize:12,textAlign:"center",marginTop:12,paddingHorizontal:16},providerSection:{marginBottom:24},providerHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},providerLabel:{fontSize:12,fontWeight:"500"},refreshText:{fontSize:10},providerButton:{padding:16},disabled:{opacity:.5},providerLoading:{flexDirection:"row",alignItems:"center",gap:12},loadingText:{fontSize:14},providerContent:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},providerInfo:{flex:1},autoPickedText:{fontSize:12,marginBottom:6},providerRow:{flexDirection:"row",alignItems:"center",gap:12},providerIcon:{width:32,height:32,borderRadius:16},providerIconPlaceholder:{width:32,height:32,borderRadius:8},providerIconImage:{width:32,height:32,borderRadius:8},providerName:{fontSize:14,fontWeight:"500"},bestPriceText:{fontSize:11,marginTop:2},noProviderText:{fontSize:14,textAlign:"center"},errorText:{fontSize:12,marginTop:8},continueButtonContainer:{padding:16,paddingBottom:24},continueButton:{paddingVertical:16,alignItems:"center"},disabledButton:{opacity:.5},continueButtonText:{fontSize:16,fontWeight:"600"},webViewHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},webViewHeaderButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},webViewHeaderTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},webViewHeaderSpacer:{width:28,height:28},webViewContainer:{flex:1},webView:{flex:1},webViewLoading:{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center"},providerModalList:{height:468,paddingHorizontal:12,marginTop:8},quotesList:{gap:8,paddingBottom:24,minHeight:468},quoteItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:12},quoteLeft:{flexDirection:"row",alignItems:"center",gap:12},quoteIcon:{width:40,height:40,borderRadius:20},quoteName:{fontSize:14,fontWeight:"500"},bestPriceLabel:{fontSize:11,marginTop:2},quoteRight:{alignItems:"flex-end"},quoteAmount:{fontSize:14,fontWeight:"500"},quoteSource:{fontSize:12},onrampContainer:{flex:1,padding:16,alignItems:"center",paddingTop:24},onrampProviderIcon:{width:64,height:64,borderRadius:16},onrampTitle:{fontSize:18,fontWeight:"600",textAlign:"center",marginTop:20,marginBottom:8,paddingHorizontal:16},onrampSubtitle:{fontSize:14,textAlign:"center",marginBottom:24},flowDiagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:20,paddingHorizontal:24,borderRadius:12,width:"100%"},flowIconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},flowIconImageNoBadge:{width:24,height:24,borderRadius:12},flowNetworkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,borderWidth:2},onrampInfoBox:{marginTop:16,padding:16,width:"100%"},onrampInfoText:{fontSize:13,lineHeight:20},flowStep:{alignItems:"center"},flowIcon:{width:28,height:28,borderRadius:14,marginBottom:4},flowIconImage:{width:24,height:24,borderRadius:12,marginBottom:4},flowLabel:{fontSize:10},flowValue:{fontSize:14,fontWeight:"500"}});function ra(e){try{let t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}catch{return e}}function na(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Ir({execution:e,onPress:t}){let {colors:o,fonts:n,components:r}=W(),s=r.depositTracker.executionRow.card,a=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let f=$(de(e.destination_token_metadata,"png")||He("/icons/tokens/png/usdc.png")),p=a?"Deposit Processing":"Deposit Completed",l=ra(e.created_at||new Date().toISOString()),h=na(e.source_amount_usd);return jsxs(Le,{cardTokens:s,onPress:t,contentStyle:Dt.container,children:[jsxs(View,{style:Dt.iconContainer,children:[jsx(Image,{source:{uri:f},style:Dt.tokenIcon}),jsx(View,{style:[Dt.statusBadge,{backgroundColor:a?o.warning:o.success,borderColor:s.backgroundColor}],children:a?jsx(Gn,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsx(We,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxs(View,{style:Dt.textContainer,children:[jsx(Text,{style:[Dt.title,{color:s.titleColor,fontFamily:n.medium}],children:p}),jsx(Text,{style:[Dt.dateTime,{color:s.subtitleColor,fontFamily:n.regular}],children:l})]}),jsxs(View,{style:Dt.rightContainer,children:[jsx(Text,{style:[Dt.amount,{color:s.textRightColor,fontFamily:n.medium}],children:h}),jsx(St,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var Dt=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-4,right:-4,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2},textContainer:{flex:1,gap:2},title:{fontSize:16,fontWeight:"500"},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16,fontWeight:"500"}});function Ti(e,t){let o={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||o[e]||e:o[e]||e}function xi(e,t=6){if(!e)return "\u2014";try{let o=Number(e)/Math.pow(10,t);return o===0?"0.00":o>=1?o.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):o.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:8,minimumSignificantDigits:2,maximumSignificantDigits:6})}catch{return "0.00"}}function da(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var Si=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function _i(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function ca(e){try{let t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}catch{return e}}function Lr({visible:e,onClose:t,executions:o,externalUserId:n,publishableKey:r,borderTopLeftRadius:s,borderTopRightRadius:a}){let{height:d}=useWindowDimensions(),{colors:f,fonts:p,components:l}=W(),[h,x]=useState(o),[P,I]=useState(false),[C,u]=useState(null),[m,g]=useState(false),i=useRef(null);useEffect(()=>{if(!e||!n)return;let w=async()=>{I(true);try{let A=[...(await Ao(n,r)).data].sort((U,K)=>{let ee=U.created_at?new Date(U.created_at).getTime():0;return (K.created_at?new Date(K.created_at).getTime():0)-ee});x(A);}catch(J){console.error("Failed to fetch executions:",J),x(o);}finally{I(false);}};w();let Y=setInterval(w,1e4);return ()=>clearInterval(Y)},[e,n,r,o]),useEffect(()=>{o.length>0&&x(w=>{let Y=new Set(w.map(A=>A.id)),J=o.filter(A=>!Y.has(A.id));return J.length>0?[...J,...w]:w});},[o]),useEffect(()=>{e||u(null);},[e]);let c=w=>{u(w);},R=()=>{u(null),g(false);},b=()=>{u(null),t();};return jsxs(pe,{visible:e,onClose:b,closeOnBackdropPress:true,showHandle:false,heightPercent:.6,borderTopLeftRadius:s,borderTopRightRadius:a,children:[jsx(rt,{title:C?"Deposit Details":"Deposit Tracker",onClose:b,showClose:!C,showBack:!!C,onBack:R}),C?(()=>{if(!C)return null;let w=C,Y=w.status==="pending"||w.status==="waiting"||w.status==="delayed",J=w.status==="succeeded",A=$(de(w.destination_token_metadata,"png")||He("/icons/tokens/png/usdc.png")),U=w.provider_metadata?.details,K=U?.currencyIn,ee=U?.currencyOut;K?.currency?.symbol||"USDC";ee?.currency?.symbol||"USDC";let Xe=xi(w.source_amount_base_unit,w.source_token_metadata?.decimals),ne=xi(w.destination_amount_base_unit,w.destination_token_metadata?.decimals),Ie=da(w.source_amount_usd),et=Ti(w.source_chain_type,w.source_chain_id),De=Ti(w.destination_chain_type,w.destination_chain_id),Te=()=>{w.explorer_url&&Linking.openURL(w.explorer_url);},ze=()=>{w.destination_explorer_url&&Linking.openURL(w.destination_explorer_url);};return jsxs(ScrollView,{ref:i,style:[E.scrollContainer,{maxHeight:d*.7}],contentContainerStyle:E.detailsContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:E.iconSection,children:[jsxs(View,{style:E.iconWrapper,children:[jsx(Image,{source:{uri:A},style:E.tokenIcon}),jsx(View,{style:[E.statusBadge,{backgroundColor:Y?f.warning:f.success,borderColor:f.background}],children:Y?jsx(Ye,{size:14,color:"#FFFFFF",strokeWidth:2}):jsx(We,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxs(View,{style:E.statusRow,children:[jsx(View,{style:[E.statusDot,{backgroundColor:Y?f.warning:f.success}]}),jsx(Text,{style:[E.statusText,{color:l.container.titleColor,fontFamily:p.semibold}],children:Y?"Processing":"Completed"})]}),jsx(Text,{style:[E.dateText,{color:l.container.subtitleColor,fontFamily:p.regular}],children:ca(w.created_at||new Date().toISOString())})]}),jsxs(View,{style:[E.card,{backgroundColor:l.card.backgroundColor,borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor}],children:[jsxs(View,{style:E.cardRow,children:[jsx(Text,{style:[E.cardLabel,{color:l.card.rowLeftLabel,fontFamily:p.regular}],children:"Amount Sent"}),jsxs(Text,{style:[E.cardValue,{color:l.card.rowRightLabel,fontFamily:p.medium}],children:[Xe," ",_i(w.source_currency)]})]}),jsx(View,{style:[E.cardDivider,{backgroundColor:f.border}]}),jsxs(View,{style:E.cardRow,children:[jsx(Text,{style:[E.cardLabel,{color:l.card.rowLeftLabel,fontFamily:p.regular}],children:"Amount Received"}),jsxs(Text,{style:[E.cardValue,{color:l.card.rowRightLabel,fontFamily:p.medium}],children:[ne," ",_i(w.destination_currency)]})]}),jsx(View,{style:[E.cardDivider,{backgroundColor:f.border}]}),jsxs(View,{style:E.cardRow,children:[jsx(Text,{style:[E.cardLabel,{color:l.card.rowLeftLabel,fontFamily:p.regular}],children:"USD Value"}),jsx(Text,{style:[E.cardValue,{color:l.card.rowRightLabel,fontFamily:p.medium}],children:Ie})]}),jsx(View,{style:[E.cardDivider,{backgroundColor:f.border}]}),jsxs(View,{style:E.cardRow,children:[jsx(Text,{style:[E.cardLabel,{color:l.card.rowLeftLabel,fontFamily:p.regular}],children:"Source Network"}),jsx(Text,{style:[E.cardValue,{color:l.card.rowRightLabel,fontFamily:p.medium}],children:et})]}),jsx(View,{style:[E.cardDivider,{backgroundColor:f.border}]}),jsxs(View,{style:E.cardRow,children:[jsx(Text,{style:[E.cardLabel,{color:l.card.rowLeftLabel,fontFamily:p.regular}],children:"Destination Network"}),jsx(Text,{style:[E.cardValue,{color:l.card.rowRightLabel,fontFamily:p.medium}],children:De})]})]}),jsxs(TouchableOpacity,{onPress:()=>{let Ne=!m;g(Ne),Ne?setTimeout(()=>{i.current?.scrollToEnd({animated:true});},100):i.current?.scrollTo({y:0,animated:true});},style:E.toggleButton,activeOpacity:.7,children:[jsx(Text,{style:[E.toggleText,{color:l.container.actionTitle,fontFamily:p.regular}],children:m?"See less":"See more details"}),m?jsx(jt,{size:14,color:l.container.actionColor,strokeWidth:2}):jsx(Ye,{size:14,color:l.container.actionColor,strokeWidth:2})]}),m&&jsxs(View,{style:[E.card,{backgroundColor:l.card.backgroundColor,borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor}],children:[w.explorer_url&&jsxs(View,{children:[jsxs(TouchableOpacity,{onPress:Te,style:E.cardRow,children:[jsx(Text,{style:[E.cardLabel,{color:l.card.rowLeftLabel,fontFamily:p.regular}],children:"Deposit Tx"}),jsxs(View,{style:E.cardRowRight,children:[jsx(Text,{style:[E.cardValue,{color:l.card.rowRightLabel,fontFamily:p.medium}],children:Si(w.transaction_hash)}),jsx(oo,{size:14,color:l.card.actionIcon,strokeWidth:2})]})]}),jsx(View,{style:[E.cardDivider,{backgroundColor:f.border}]})]}),w.destination_explorer_url&&J&&jsxs(TouchableOpacity,{onPress:ze,style:E.cardRow,children:[jsx(Text,{style:[E.cardLabel,{color:l.card.rowLeftLabel,fontFamily:p.regular}],children:"Completion Tx"}),jsxs(View,{style:E.cardRowRight,children:[jsx(Text,{style:[E.cardValue,{color:l.card.rowRightLabel,fontFamily:p.medium}],children:Si(w.destination_transaction_hashes[0])}),jsx(oo,{size:14,color:l.card.actionIcon,strokeWidth:2})]})]})]})]})})():jsx(ScrollView,{style:[E.scrollContainer,{maxHeight:d*.7}],contentContainerStyle:E.scrollContent,showsVerticalScrollIndicator:false,children:h.length===0?jsxs(View,{style:E.emptyContainer,children:[jsx(Text,{style:[E.emptyText,{color:l.container.titleColor,fontFamily:p.medium}],children:"No deposits yet"}),jsx(Text,{style:[E.emptySubtext,{color:l.container.subtitleColor,fontFamily:p.regular}],children:"Your deposit history will appear here"})]}):jsx(View,{style:E.executionsList,children:h.map(w=>jsx(Ir,{execution:w,onPress:()=>c(w)},w.id))})})]})}var E=StyleSheet.create({scrollContainer:{paddingTop:16},scrollContent:{paddingHorizontal:16,paddingBottom:16},emptyContainer:{paddingVertical:40,paddingHorizontal:16,alignItems:"center"},emptyText:{fontSize:14,marginBottom:4},emptySubtext:{fontSize:12},executionsList:{paddingTop:8,gap:12},detailsContent:{paddingHorizontal:16,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},iconWrapper:{position:"relative",marginBottom:12},tokenIcon:{width:72,height:72,borderRadius:36},statusBadge:{position:"absolute",bottom:0,right:0,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center",borderWidth:3},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardRowRight:{flexDirection:"row",alignItems:"center",gap:8},cardDivider:{height:1,marginHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"},toggleButton:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12,paddingHorizontal:4},toggleText:{fontSize:14},buttonSection:{marginTop:12,gap:10},actionButton:{flexDirection:"row",alignItems:"center",paddingVertical:16,paddingHorizontal:16,borderRadius:12},buttonIconLeft:{marginRight:12},buttonIconRight:{marginLeft:12},buttonText:{color:"#FFFFFF",fontSize:14,fontWeight:"600",flex:1,textAlign:"left"},hintText:{fontSize:12,textAlign:"center",marginTop:8}});function Zo(e,t=true){let[o,n]=useState(null),[r,s]=useState(null),[a,d]=useState(false),[f,p]=useState(false),[l,h]=useState(null),[x,P]=useState(null);useEffect(()=>{!t||o||(d(true),Uo().then(m=>{n(m),h(null);}).catch(m=>{h(m instanceof Error?m:new Error(String(m)));}).finally(()=>{d(false);}));},[t,o]),useEffect(()=>{!t||!e||r||(p(true),Mo(e).then(m=>{s(m),P(null);}).catch(m=>{P(m instanceof Error?m:new Error(String(m)));}).finally(()=>{p(false);}));},[t,e,r]);let I=a||f,C=l||x||null,u=null;if(o&&r){let m=r.blocked_country_codes||[],g=o.alpha2.toUpperCase();u=!m.some(i=>i.toUpperCase()===g);}return {isAllowed:u,alpha2:o?.alpha2?.toLowerCase()??null,country:o?.country??null,isLoading:I,error:C}}var Dn="unifold_recent_tokens",fa=5,Di=[{symbol:"ETH",chainType:"ethereum",chainId:"1"},{symbol:"SOL",chainType:"solana",chainId:"mainnet"},{symbol:"USDC",chainType:"solana",chainId:"mainnet"},{symbol:"POL",chainType:"ethereum",chainId:"137"},{symbol:"BNB",chainType:"ethereum",chainId:"56"},{symbol:"BTC",chainType:"bitcoin",chainId:"mainnet"}];async function Br(){try{let e=await Ln.getItem(Dn);return e?JSON.parse(e):[]}catch{return []}}async function ga(e){try{let o=(await Br()).filter(r=>!(r.symbol===e.symbol&&r.chainType===e.chainType&&r.chainId===e.chainId));o.unshift(e);let n=o.slice(0,fa);await Ln.setItem(Dn,JSON.stringify(n));}catch{}}async function ma(e){try{let o=(await Br()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));return await Ln.setItem(Dn,JSON.stringify(o)),o}catch{return []}}function Pn({visible:e,onClose:t,tokens:o,selectedToken:n,selectedChainKey:r,onSelect:s,borderTopLeftRadius:a,borderTopRightRadius:d}){let{colors:f,fonts:p,components:l}=W(),[h,x]=useState(""),[P,I]=useState([]);useEffect(()=>{e&&Br().then(I);},[e]),useEffect(()=>{e||x("");},[e]);let C=useMemo(()=>{let R=[];return o.forEach(b=>{b.chains.forEach(M=>{R.push({token:b,chain:M});});}),R},[o]),u=useMemo(()=>{let R=[],b=new Set,M=(_,w,Y,J)=>{let A=`${_}-${w}:${Y}`;if(b.has(A))return;let U=o.find(ee=>ee.symbol===_);if(!U)return;let K=U.chains.find(ee=>ee.chain_type===w&&ee.chain_id===Y);K&&(b.add(A),R.push({token:U,chain:K,isRecent:J}));};return P.forEach(_=>{M(_.symbol,_.chainType,_.chainId,true);}),Di.forEach(_=>{M(_.symbol,_.chainType,_.chainId,false);}),R},[o,P]),m=useMemo(()=>{if(!h.trim())return C;let R=h.toLowerCase();return C.filter(({token:b,chain:M})=>b.symbol.toLowerCase().includes(R)||b.name.toLowerCase().includes(R)||M.chain_name.toLowerCase().includes(R))},[C,h]),g=(R,b,M)=>Di.some(_=>_.symbol===R&&_.chainType===b&&_.chainId===M),i=async(R,b)=>{let M=`${b.chain_type}:${b.chain_id}`;if(!g(R.symbol,b.chain_type,b.chain_id)){await ga({symbol:R.symbol,chainType:b.chain_type,chainId:b.chain_id});let _=await Br();I(_);}x(""),s(R.symbol,M),t();},c=async(R,b)=>{let M=await ma({symbol:R.symbol,chainType:b.chain_type,chainId:b.chain_id});I(M);};return jsxs(pe,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:false,heightPercent:.9,borderTopLeftRadius:a,borderTopRightRadius:d,children:[jsxs(View,{style:re.header,children:[jsx(View,{style:re.headerSpacer}),jsx(Text,{style:[re.headerTitle,{color:l.header.titleColor,fontFamily:p.medium}],children:"Select token to deposit"}),jsx(TouchableOpacity$1,{onPress:t,style:re.closeButton,children:jsx(Ge,{size:20,color:l.header.buttonColor,strokeWidth:2})})]}),jsx(View,{style:re.searchContainer,children:jsx(TextInput,{style:[re.searchInput,{backgroundColor:l.search.backgroundColor,color:l.search.inputColor,fontFamily:p.regular,borderRadius:l.input.borderRadius,borderWidth:l.input.borderWidth,borderColor:l.input.borderColor}],placeholder:"Search",placeholderTextColor:l.search.placeholderColor,value:h,onChangeText:x,autoCapitalize:"none",autoCorrect:false})}),u.length>0&&!h&&jsxs(View,{style:re.quickSelectSection,children:[jsx(Text,{style:[re.sectionLabel,{color:l.list.titleSectionColor,fontFamily:p.regular}],children:"Quick select"}),jsx(ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:re.quickSelectScroll,children:u.map(({token:R,chain:b,isRecent:M})=>{let _=`${b.chain_type}:${b.chain_id}`;R.symbol===n&&_===r;return jsxs(View,{children:[M&&jsx(TouchableOpacity$1,{onPress:()=>c(R,b),style:re.removeButton,children:jsx(Ge,{size:12,color:f.foregroundMuted,strokeWidth:2})}),jsxs(TouchableOpacity$1,{onPress:()=>i(R,b),activeOpacity:.7,style:[re.quickSelectItem,{backgroundColor:l.card.backgroundColor,borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor}],children:[jsxs(View,{style:re.tokenIconContainer,children:[jsx(Image,{source:{uri:$(de(R,"png"))},style:re.quickSelectIcon}),jsx(Image,{source:{uri:$(de(b,"png"))},style:[re.quickSelectChainBadge,{borderColor:l.card.backgroundColor,borderRadius:l.badge.borderRadius}]})]}),jsxs(View,{style:re.quickSelectText,children:[jsx(Text,{style:[re.quickSelectSymbol,{color:l.card.titleColor,fontFamily:p.medium}],children:R.symbol}),jsx(Text,{style:[re.quickSelectChain,{color:l.card.subtitleColor,fontFamily:p.regular}],children:b.chain_name})]})]})]},`quick-${R.symbol}-${_}`)})})]}),jsx(Text,{style:[re.sectionLabel,{color:l.list.titleSectionColor,fontFamily:p.regular}],children:"All supported tokens"}),jsx(ScrollView,{style:re.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:re.tokenListContent,children:m.length===0?jsx(View,{style:re.emptyState,children:jsx(Text,{style:[re.emptyText,{color:f.foregroundMuted,fontFamily:p.regular}],children:"No tokens found"})}):m.map(({token:R,chain:b})=>{let M=`${b.chain_type}:${b.chain_id}`,_=R.symbol===n&&M===r;return jsxs(TouchableOpacity$1,{onPress:()=>i(R,b),activeOpacity:.7,style:[re.tokenItem,{backgroundColor:_?l.card.backgroundColor:"transparent"}],children:[jsxs(View,{style:re.tokenIconContainerLarge,children:[jsx(Image,{source:{uri:$(de(R,"png"))},style:re.tokenIcon}),jsx(Image,{source:{uri:$(de(b,"png"))},style:[re.tokenChainBadge,{borderColor:l.card.backgroundColor,borderRadius:l.badge.borderRadius}]})]}),jsxs(View,{style:re.tokenInfo,children:[jsx(Text,{style:[re.tokenSymbol,{color:l.card.titleColor,fontFamily:p.medium}],children:R.symbol}),jsx(Text,{style:[re.tokenChainName,{color:l.card.subtitleColor,fontFamily:p.regular}],children:b.chain_name})]}),jsxs(Text,{style:[re.minDeposit,{color:l.card.labelColor,fontFamily:p.regular}],children:["Minimum:"," ",jsxs(Text,{style:{color:l.card.labelHighlightRightColor,fontFamily:p.regular},children:["$",b.minimum_deposit_amount_usd]})]})]},`${R.symbol}-${M}`)})})]})}var re=StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:28},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:40,paddingHorizontal:16,fontSize:14},quickSelectSection:{marginBottom:12},sectionLabel:{fontSize:12,paddingHorizontal:16,marginBottom:8},quickSelectScroll:{paddingHorizontal:16,gap:8},quickSelectItem:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:8,paddingHorizontal:12},removeButton:{position:"absolute",top:-2,right:-6,zIndex:1,padding:2},tokenIconContainer:{position:"relative"},quickSelectIcon:{width:28,height:28,borderRadius:14},quickSelectChainBadge:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,borderWidth:2},quickSelectText:{alignItems:"flex-start"},quickSelectSymbol:{fontSize:12,fontWeight:"500"},quickSelectChain:{fontSize:10},tokenList:{flex:1},tokenListContent:{paddingHorizontal:16,paddingBottom:24,gap:4},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},tokenItem:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:12},tokenIconContainerLarge:{position:"relative"},tokenIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenInfo:{flex:1},tokenSymbol:{fontSize:14,fontWeight:"500"},tokenChainName:{fontSize:12},minDeposit:{fontSize:12}});var Fr=(e,t)=>`${t}:${e}`,ka=e=>{let[t,o]=e.split(":");return {chainType:t,chainId:o}};function Bn({externalUserId:e,publishableKey:t,recipientAddress:o,destinationChainType:n,destinationChainId:r,destinationTokenAddress:s,destinationTokenSymbol:a,defaultChainType:d,defaultChainId:f,defaultTokenAddress:p,depositConfirmationMode:l="auto_ui",onExecutionsChange:h,onDepositSuccess:x,onDepositError:P,wallets:I,borderTopLeftRadius:C,borderTopRightRadius:u,sheetBorderRadius:m}){let{colors:g,fonts:i,components:c}=W(),R=d&&f?`${d}:${f}`:"solana:mainnet",[b,M]=useState("USDC"),[_,w]=useState(R),[Y,J]=useState([]),[A,U]=useState(!I?.length),K=I?.length?I:Y,[ee,je]=useState([]),[ut,Xe]=useState(true),[ne,Ie]=useState(false),[et,De]=useState(false),[Te,ze]=useState(false),[Ne,it]=useState([]),[Wt,Et]=useState(new Map),[Ot]=useState(()=>new Date),[pt,$e]=useState(null),[Tt,st]=useState(false),[ie,ve]=useState(null),[Pe,Me]=useState(false),qe=new Map;ee.forEach(te=>{te.chains.forEach(ke=>{let v=`${ke.chain_type}:${ke.chain_id}`;qe.has(v)||qe.set(v,ke);});});let Ue=Array.from(qe.values()),Ze=ka(_),ue=Ue.find(te=>te.chain_type===Ze.chainType&&te.chain_id===Ze.chainId),Po=ue?.chain_type||"ethereum",At=Zt(K,Po),xe=At?.address||"",Be=useRef(false);useEffect(()=>{async function te(){try{Xe(!0),$e(null);let v=await zo(t,s&&r&&n?{destination_token_address:s,destination_chain_id:r,destination_chain_type:n}:void 0);if(je(v.data),v.data.length>0&&!Be.current){Be.current=!0;let F,q;if(d&&f)if(p)for(let H of v.data){let we=H.chains.find(ge=>ge.chain_type===d&&ge.chain_id===f&&ge.token_address.toLowerCase()===p.toLowerCase());if(we){F=H,q=we;break}}else for(let H of v.data){let we=H.chains.find(ge=>ge.chain_type===d&&ge.chain_id===f);if(we){F=H,q=we;break}}if(!F&&s)for(let H of v.data){let we=H.chains.find(ge=>ge.token_address.toLowerCase()===s.toLowerCase());if(we){F=H,q=we;break}}F||(F=v.data.find(H=>H.symbol==="USDC"),F&&F.chains.length>0&&(q=F.chains[0])),F||(F=v.data.find(H=>H.symbol==="USDT"),F&&F.chains.length>0&&(q=F.chains[0])),F||(F=v.data[0],F.chains.length>0&&(q=F.chains[0])),F&&M(F.symbol),q&&w(Fr(q.chain_id,q.chain_type));}}catch(ke){console.error("Error fetching supported tokens:",ke),$e("Failed to load supported tokens"),P?.({message:"Failed to load supported tokens",error:ke});}finally{Xe(false);}}te();},[t,s,r,n,d,f,p,P]),useEffect(()=>{h&&h(Ne);},[Ne,h]),useEffect(()=>{if(I?.length){U(false);return}if(Y.length>0){U(false);return}let te=null,ke=false,v=async()=>{if(!ke){U(true);try{let F=await Xt({external_user_id:e,recipient_address:o,destination_chain_type:n,destination_chain_id:r,destination_token_address:s},t);ke||(J(F.data),$e(null),U(!1));}catch(F){console.error("Error fetching wallets, retrying in 5s:",F),ke||($e(F instanceof Error?F.message:"Failed to load wallets"),U(false),te=setTimeout(v,5e3));}}};return v(),()=>{ke=true,te&&clearTimeout(te);}},[e,o,n,r,s,t,I,Y.length]);let Bo=At?.id??"",{showWaitingUi:uo,handleIveDeposited:po}=Yo({depositConfirmationMode:l,depositAddress:xe,chain:_,externalUserId:e,publishableKey:t,modalOpenedAt:Ot,depositWalletId:Bo,depositExecutions:Ne,trackedExecutions:Wt,setDepositExecutions:it,setTrackedExecutions:Et,setLatestExecution:ve,setShowStatusSheet:st,onDepositSuccess:x,onExecutionsChange:h,onDepositError:P});useEffect(()=>{if(!ee.length)return;let te=ee.find(v=>v.symbol===b);if(!te||te.chains.length===0)return;if(!te.chains.some(v=>Fr(v.chain_id,v.chain_type)===_)){let v=te.chains[0];w(Fr(v.chain_id,v.chain_type));}},[b,ee,_]);let Ve=ee.find(te=>te.symbol===b),Fe=(Ve?.chains||[]).find(te=>Fr(te.chain_id,te.chain_type)===_),fo=async()=>{if(xe)try{Clipboard.setString(xe),Ie(!0),setTimeout(()=>Ie(!1),2e3);}catch(te){console.error("Failed to copy:",te);}},Kt=Fe?.estimated_price_impact_percent??0,ft=Fe?.max_slippage_percent??.25,Fo=Fe?.minimum_deposit_amount_usd??3;return ut?jsxs(View,{style:T.loadingContainer,children:[jsx(ActivityIndicator,{size:"large",color:g.primary}),jsx(Text,{style:[T.loadingText,{color:g.foregroundMuted,fontFamily:i.regular}],children:"Loading currencies..."})]}):pt&&ee.length===0?jsxs(View,{style:T.errorContainer,children:[jsx(Text,{style:[T.errorText,{color:g.error,fontFamily:i.regular}],children:pt}),jsx(Text,{style:[T.errorHint,{color:g.foregroundMuted,fontFamily:i.regular}],children:"Please check your network connection and try again."})]}):jsxs(View,{style:T.container,children:[jsxs(View,{style:T.selectorSection,children:[jsx(Text,{style:[T.selectorLabel,{color:c.card.labelColor,fontFamily:i.medium}],children:"Select token to deposit"}),jsx(TouchableOpacity$1,{onPress:()=>ze(true),disabled:ut||ee.length===0,style:[T.tokenSelectorButton,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],activeOpacity:.7,children:ut?jsxs(View,{style:T.tokenSelectorLoading,children:[jsx(View,{style:[T.loadingIcon,{backgroundColor:g.cardHover}]}),jsxs(View,{style:T.loadingTextContainer,children:[jsx(View,{style:[T.loadingLine,{backgroundColor:g.cardHover,width:60}]}),jsx(View,{style:[T.loadingLine,{backgroundColor:g.cardHover,width:100,marginTop:4}]})]})]}):jsxs(Fragment,{children:[jsxs(View,{style:T.tokenIconWrapper,children:[Ve&&jsx(Image,{source:{uri:$(de(Ve,"png"))},style:T.tokenMainIcon}),(Fe||ue)&&jsx(Image,{source:{uri:$(de(Fe||ue,"png"))},style:[T.tokenChainBadge,{borderColor:c.card.backgroundColor,borderRadius:c.badge.borderRadius}]})]}),jsxs(View,{style:T.tokenSelectorInfo,children:[jsx(Text,{style:[T.tokenSelectorSymbol,{color:c.card.titleColor,fontFamily:i.semibold}],children:Ve?.symbol||b}),jsx(Text,{style:[T.tokenSelectorNetwork,{color:c.card.subtitleColor,fontFamily:i.regular}],numberOfLines:1,children:Fe?.chain_name||ue?.chain_name||"Select network"})]}),jsxs(View,{style:T.tokenSelectorRight,children:[jsxs(Text,{style:[T.minDepositText,{color:c.card.labelHighlightRightColor,fontFamily:i.medium}],children:["$",Fo," min"]}),jsx(St,{size:16,color:c.card.actionColor,strokeWidth:2})]})]})})]}),jsx(Pn,{visible:Te,onClose:()=>ze(false),tokens:ee,selectedToken:b,selectedChainKey:_,onSelect:(te,ke)=>{M(te),w(ke);},borderTopLeftRadius:m?.tokenSelector?.borderTopLeftRadius??C,borderTopRightRadius:m?.tokenSelector?.borderTopRightRadius??u}),jsx(View,{style:T.qrContainer,children:jsx(View,{style:[T.qrWrapper,{backgroundColor:g.background,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth>0?c.card.borderWidth:1,borderColor:c.card.borderColor}],children:A?jsxs(View,{style:T.qrLoading,children:[jsx(ActivityIndicator,{size:"small",color:g.primary}),jsx(Text,{style:[T.loadingText,{color:g.foregroundMuted,fontFamily:i.regular}],children:"Loading..."})]}):xe?jsx(_o,{value:xe,size:180,logoUri:$(de(Fe,"png")||He("/icons/networks/png/ethereum.png")),logoSize:45}):jsx(View,{style:T.qrLoading,children:jsx(Text,{style:[T.errorText,{color:g.error,fontFamily:i.regular}],children:"No address available"})})})}),jsxs(View,{style:T.addressSection,children:[jsxs(View,{style:T.addressHeader,children:[jsx(Text,{style:[T.addressLabel,{color:c.card.labelColor,fontFamily:i.medium}],children:"Deposit Address"}),ne&&jsxs(View,{style:T.copiedIndicator,children:[jsx(We,{size:14,color:g.success,strokeWidth:2}),jsx(Text,{style:[T.copiedText,{color:g.success,fontFamily:i.regular}],children:"Copied"})]})]}),jsxs(Le,{cardTokens:c.transferCrypto.depositAddress.card,onPress:!A&&xe?fo:void 0,contentStyle:T.addressBox,children:[jsx(Text,{style:[T.addressText,{color:c.card.titleColor,fontFamily:i.regular}],numberOfLines:2,children:A?"Loading...":xe||"No address available"}),jsx(View,{style:T.addressCopyIcon,children:jsx(Ho,{size:16,color:c.card.actionColor,strokeWidth:1})})]})]}),jsxs(View,{style:[T.detailsCard,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxs(TouchableOpacity$1,{onPress:()=>De(!et),style:T.detailsHeader,children:[jsxs(View,{style:T.detailsRow,children:[jsx(View,{style:[T.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsx(to,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[T.detailsLabel,{color:c.card.titleColor,fontFamily:i.regular}],children:"Processing time: < 1 min"})]}),jsx(View,{style:T.chevronContainer,children:et?jsx(jt,{size:16,color:c.card.actionColor,strokeWidth:2}):jsx(Ye,{size:16,color:c.card.actionColor,strokeWidth:2})})]}),et&&jsxs(View,{style:T.detailsContent,children:[jsxs(View,{style:T.detailsRow,children:[jsx(View,{style:[T.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsx(bo,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[T.detailsLabel,{color:c.card.titleColor,fontFamily:i.regular}],children:["Price impact: ",Kt.toFixed(2),"%"]}),jsx(TouchableOpacity$1,{onPress:()=>Me(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(ko,{size:14,color:c.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:T.detailsRow,children:[jsx(View,{style:[T.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsx(wo,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[T.detailsLabel,{color:c.card.titleColor,fontFamily:i.regular}],children:["Slippage: Auto \u2022 ",ft.toFixed(2),"%"]}),jsx(TouchableOpacity$1,{onPress:()=>Me(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(ko,{size:14,color:c.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:T.detailsRow,children:[jsx(View,{style:[T.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsx(ar,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[T.detailsLabel,{color:c.card.titleColor,fontFamily:i.regular}],children:["Need help?"," ",jsx(Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsx(hr,{depositConfirmationMode:l,depositAddress:xe,showWaitingUi:uo,latestExecution:ie,onIveDeposited:po}),jsx(TouchableOpacity$1,{style:T.termsContainer,onPress:()=>Linking.openURL("https://unifold.io/terms"),children:jsx(Text,{style:[T.termsText,{color:g.primary,fontFamily:i.regular}],children:"Terms apply"})}),jsxs(pe,{visible:Pe,onClose:()=>Me(false),closeOnBackdropPress:true,showHandle:true,borderTopLeftRadius:m?.infoSheet?.borderTopLeftRadius??C,borderTopRightRadius:m?.infoSheet?.borderTopRightRadius??u,children:[jsxs(View,{style:[T.sheetHeader,{borderBottomColor:g.border}],children:[jsx(View,{style:T.sheetHeaderSpacer}),jsx(Text,{style:[T.sheetTitle,{color:c.header.titleColor,fontFamily:i.medium}],children:"Price Impact & Slippage"}),jsx(TouchableOpacity$1,{onPress:()=>Me(false),style:T.sheetCloseButton,children:jsx(Ge,{size:20,color:c.header.buttonColor,strokeWidth:2})})]}),jsxs(View,{style:T.infoSheetContent,children:[jsxs(View,{style:[T.infoCard,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxs(View,{style:T.infoCardHeader,children:[jsx(View,{style:[T.infoCardIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsx(bo,{size:16,color:c.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[T.infoCardTitle,{color:c.card.titleColor,fontFamily:i.medium}],children:"Price Impact"}),jsxs(Text,{style:[T.infoCardValue,{color:c.card.titleColor,fontFamily:i.medium}],children:[Kt.toFixed(2),"%"]})]}),jsx(Text,{style:[T.infoCardDescription,{color:c.card.descriptionColor,fontFamily:i.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxs(View,{style:[T.infoCard,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxs(View,{style:T.infoCardHeader,children:[jsx(View,{style:[T.infoCardIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsx(wo,{size:16,color:c.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[T.infoCardTitle,{color:c.card.titleColor,fontFamily:i.medium}],children:"Max Slippage"}),jsxs(Text,{style:[T.infoCardValue,{color:c.card.titleColor,fontFamily:i.medium}],children:[ft.toFixed(2),"%"]})]}),jsx(Text,{style:[T.infoCardDescription,{color:c.card.descriptionColor,fontFamily:i.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),ie&&jsx(Io,{visible:Tt,status:ie.status,tokenIconUrl:ie.destination_token_metadata?.icon_urls?.find(te=>te.format==="png")?.url||ie.destination_token_metadata?.icon_url||de(Ve,"png"),explorerUrl:ie.explorer_url,completionExplorerUrl:ie.destination_explorer_url,date:ie.created_at?new Date(ie.created_at):void 0,amountUsd:ie.source_amount_usd?parseFloat(ie.source_amount_usd):void 0,onClose:()=>st(false),borderTopLeftRadius:m?.depositStatus?.borderTopLeftRadius??C,borderTopRightRadius:m?.depositStatus?.borderTopRightRadius??u})]})}var T=StyleSheet.create({container:{flex:1,paddingHorizontal:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:12,marginBottom:8},tokenSelectorButton:{flexDirection:"row",alignItems:"center",gap:12,padding:12},tokenSelectorLoading:{flexDirection:"row",alignItems:"center",gap:12,flex:1},loadingIcon:{width:40,height:40,borderRadius:20},loadingTextContainer:{flex:1},loadingLine:{height:12,borderRadius:6},tokenIconWrapper:{position:"relative"},tokenMainIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenSelectorInfo:{flex:1},tokenSelectorSymbol:{fontSize:14,fontWeight:"500"},tokenSelectorNetwork:{fontSize:12,marginTop:2},tokenSelectorRight:{flexDirection:"row",alignItems:"center",gap:8},minDepositText:{fontSize:12,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:8},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:12},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},termsContainer:{alignItems:"center",paddingVertical:8},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});var Bt={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},stripeLinkPay:{title:"Pay with Stripe Link",subtitle:"Apple Pay or Card"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"}};function Sa(){let{colors:e,components:t}=W(),o=useRef(new Animated.Value(.5)).current,n=t.depositMenu.card.backgroundColor,r=e.cardHover;useEffect(()=>{let a=Animated.loop(Animated.sequence([Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return a.start(),()=>a.stop()},[o]);let s=({rightIcons:a=2})=>jsxs(View,{style:[Yt.card,{backgroundColor:n,borderRadius:t.depositMenu.card.borderRadius}],children:[jsx(Animated.View,{style:[Yt.leftIcon,{backgroundColor:r,opacity:o,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxs(View,{style:Yt.textBlock,children:[jsx(Animated.View,{style:[Yt.titleBar,{backgroundColor:r,opacity:o}]}),jsx(Animated.View,{style:[Yt.subtitleBar,{backgroundColor:r,opacity:o}]})]}),jsx(View,{style:Yt.rightIcons,children:Array.from({length:a}).map((d,f)=>jsx(Animated.View,{style:[Yt.rightIcon,{backgroundColor:r,opacity:o}]},f))})]});return jsxs(View,{style:Yt.container,children:[jsx(s,{rightIcons:3}),jsx(s,{rightIcons:2}),jsx(s,{rightIcons:0})]})}var Yt=StyleSheet.create({container:{paddingTop:8,paddingBottom:24,gap:8},card:{marginHorizontal:16,flexDirection:"row",alignItems:"center",paddingVertical:16,paddingHorizontal:12,gap:12},leftIcon:{width:36,height:36},textBlock:{flex:1,gap:6},titleBar:{height:12,width:"70%",borderRadius:6},subtitleBar:{height:10,width:"50%",borderRadius:5},rightIcons:{flexDirection:"row",alignItems:"center",gap:4},rightIcon:{width:20,height:20,borderRadius:10}});function _a({visible:e,onClose:t,externalUserId:o,publishableKey:n,modalTitle:r="Deposit",destinationTokenSymbol:s,recipientAddress:a,destinationChainType:d,destinationChainId:f,destinationTokenAddress:p,defaultChainType:l,defaultChainId:h,defaultTokenAddress:x,showBalance:P=false,hideDepositTracker:I=false,enableStripeLinkPay:C=false,StripeOnrampComponent:u,stripeOnrampEmail:m,stripeOnrampPhone:g,stripeTheme:i,depositConfirmationMode:c="auto_ui",transferInputVariant:R="double_input",onDepositSuccess:b,onDepositError:M,sheetBorderRadius:_}){let w=_?.globalBorderTopLeftRadius,Y=_?.globalBorderTopRightRadius,{colors:J,fonts:A}=W(),[U,K]=useState([]),[ee,je]=useState(false),[ut,Xe]=useState(false),[ne,Ie]=useState(false),[et,De]=useState(false),[Te,ze]=useState(null),[Ne,it]=useState("amount"),{isAllowed:Wt,isLoading:Et}=Zo(n,e);useEffect(()=>{if(!e||Te)return;let Pe=false;return Mo(n).then(async Me=>{if(Pe)return;let qe=[];for(let Ue of Me?.transfer_crypto?.networks??[]){let Ze=Ue.icon_urls.find(ue=>ue.format==="png")?.url||Ue.icon_urls.find(ue=>ue.format==="svg")?.url;Ze&&qe.push($(Ze));}for(let Ue of Me?.payment_networks?.networks??[]){let Ze=Ue.icon_urls.find(ue=>ue.format==="png")?.url||Ue.icon_urls.find(ue=>ue.format==="svg")?.url;Ze&&qe.push($(Ze));}qe.length>0&&await Kr(qe),Pe||ze(Me);}).catch(console.error),()=>{Pe=true;}},[e,Te,n]);let Ot=()=>{t();},pt=U.filter(Pe=>Pe.status==="pending"||Pe.status==="waiting").length,Tt=!!(a&&d&&f&&p&&n)&&P!==false&&!!Te,st=Et||e&&!Te,ie=Wt===false,ve=null;if(et&&u){let Pe=jsx(u,{publishableKey:n,email:m,phone:g,externalUserId:o,recipientAddress:a??"",destinationChainType:d,destinationChainId:f,destinationTokenAddress:p,onClose:()=>De(false)});ve=i?jsx(mo,{...i,children:Pe}):Pe;}return jsxs(pe,{visible:e,onClose:Ot,closeOnBackdropPress:false,showHandle:false,borderTopLeftRadius:_?.main?.borderTopLeftRadius??w,borderTopRightRadius:_?.main?.borderTopRightRadius??Y,children:[jsx(rt,{title:r,showBack:false,onClose:Ot,showBalance:Tt,balanceAddress:a,balanceChainType:d,balanceChainId:f,balanceTokenAddress:p,publishableKey:n,projectName:Te?.project_name}),st&&jsx(Sa,{}),!st&&ie&&jsxs(View,{style:Vt.centeredContainer,children:[jsx(View,{style:[Vt.iconContainer,{backgroundColor:J.cardHover}],children:jsx(dr,{size:32,color:J.foreground,strokeWidth:1.5})}),jsx(Text,{style:[Vt.blockedTitle,{color:J.foreground,fontFamily:A.semibold}],children:"No Tokens Available"}),jsx(Text,{style:[Vt.blockedDescription,{color:J.foreground,opacity:.7,fontFamily:A.regular}],children:"There are no supported tokens available from your current location."})]}),!st&&!ie&&jsxs(View,{style:Vt.optionsContainer,children:[jsx(jo,{onPress:()=>Xe(true),title:Bt.transferCrypto.title,subtitle:Bt.transferCrypto.subtitle,featuredTokens:Te?.transfer_crypto?.networks}),jsx($o,{onPress:()=>Ie(true),title:Bt.depositWithCard.title,subtitle:Bt.depositWithCard.subtitle,paymentNetworks:Te?.payment_networks?.networks}),C&&u&&jsx(Go,{onPress:()=>De(true),title:Bt.stripeLinkPay.title,subtitle:Bt.stripeLinkPay.subtitle}),!I&&jsx(qo,{onPress:()=>je(true),title:Bt.depositTracker.title,subtitle:Bt.depositTracker.subtitle,badge:pt>0?pt:void 0})]}),jsx(Lr,{visible:ee,onClose:()=>je(false),executions:U,externalUserId:o,publishableKey:n,borderTopLeftRadius:_?.depositsTracker?.borderTopLeftRadius??w,borderTopRightRadius:_?.depositsTracker?.borderTopRightRadius??Y}),jsxs(pe,{visible:ut,onClose:()=>Xe(false),closeOnBackdropPress:false,showHandle:false,heightPercent:.9,borderTopLeftRadius:_?.transferCrypto?.borderTopLeftRadius??w,borderTopRightRadius:_?.transferCrypto?.borderTopRightRadius??Y,children:[jsx(rt,{title:Bt.transferCrypto.title,showBack:false,onClose:()=>Xe(false),showBalance:Tt,balanceAddress:a,balanceChainType:d,balanceChainId:f,balanceTokenAddress:p,publishableKey:n,projectName:Te?.project_name}),jsx(ScrollView,{style:Vt.transferScrollContainer,contentContainerStyle:Vt.scrollContent,showsVerticalScrollIndicator:false,children:R==="single_input"?jsx(Bn,{externalUserId:o,publishableKey:n,recipientAddress:a,destinationChainType:d,destinationChainId:f,destinationTokenAddress:p,destinationTokenSymbol:s,defaultChainType:l,defaultChainId:h,defaultTokenAddress:x,depositConfirmationMode:c,onExecutionsChange:K,onDepositSuccess:b,onDepositError:M,borderTopLeftRadius:w,borderTopRightRadius:Y,sheetBorderRadius:{tokenSelector:_?.tokenSelector,infoSheet:_?.infoSheet,depositStatus:_?.depositStatus}}):jsx(Cr,{externalUserId:o,publishableKey:n,recipientAddress:a,destinationChainType:d,destinationChainId:f,destinationTokenAddress:p,destinationTokenSymbol:s,defaultChainType:l,defaultChainId:h,defaultTokenAddress:x,depositConfirmationMode:c,onExecutionsChange:K,onDepositSuccess:b,onDepositError:M,borderTopLeftRadius:w,borderTopRightRadius:Y,sheetBorderRadius:{tokenSelector:_?.tokenSelector,chainSelector:_?.chainSelector,infoSheet:_?.infoSheet,depositStatus:_?.depositStatus}})})]}),jsxs(pe,{visible:ne,onClose:()=>{Ie(false),it("amount");},closeOnBackdropPress:false,showHandle:false,heightPercent:.9,borderTopLeftRadius:_?.buyWithCard?.borderTopLeftRadius??w,borderTopRightRadius:_?.buyWithCard?.borderTopRightRadius??Y,children:[jsx(rt,{title:`Deposit ${s||"USDC"}`,showBack:Ne==="onramp",onBack:()=>it("amount"),onClose:()=>{Ie(false),it("amount");},showBalance:Tt,balanceAddress:a,balanceChainType:d,balanceChainId:f,balanceTokenAddress:p,publishableKey:n,projectName:Te?.project_name}),jsx(View,{style:Vt.buyWithCardContainer,children:jsx(Sr,{externalUserId:o,publishableKey:n,destinationTokenSymbol:s,recipientAddress:a,destinationChainType:d,destinationChainId:f,destinationTokenAddress:p,onDepositSuccess:b,onDepositError:M,view:Ne,onViewChange:Pe=>it(Pe),borderTopLeftRadius:w,borderTopRightRadius:Y,sheetBorderRadius:{providerModal:_?.providerModal,webView:_?.webView,currencyModal:_?.currencyModal}})})]}),C&&u&&jsx(pe,{visible:et,onClose:()=>De(false),closeOnBackdropPress:false,showHandle:false,heightPercent:1,borderTopLeftRadius:0,borderTopRightRadius:0,children:jsx(View,{style:Vt.stripeLinkPayContainer,children:ve})})]})}function Wr({theme:e="auto",...t}){return jsx(_a,{...t})}var Vt=StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},centeredContainer:{alignItems:"center",justifyContent:"center",paddingVertical:48,paddingHorizontal:16,minHeight:200},iconContainer:{width:64,height:64,borderRadius:32,alignItems:"center",justifyContent:"center",marginBottom:16},blockedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},blockedDescription:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20}});StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},text:{fontWeight:"600",textAlign:"center"},fullWidth:{width:"100%"},disabled:{opacity:.5}});StyleSheet.create({icon:{backgroundColor:"transparent"}});var Ei="__unifold_stripe_onramp__";function Oi(e){globalThis[Ei]=e;}function Ai(){return globalThis[Ei]}var Fa=()=>new QueryClient({defaultOptions:{queries:{staleTime:6e4,retry:1}}}),Ui=createContext(null);function Wa({children:e,publishableKey:t,config:o}){let[n]=useState(()=>Fa()),[r,s]=useState(false),[a,d]=useState(null),f=useColorScheme(),p=useRef(false);p.current||(rr({publishableKey:t}),p.current=true);let l=useMemo(()=>{let g=o?.appearance||"dark";return g==="auto"?f==="dark"?"dark":"light":g},[o?.appearance,f]);useEffect(()=>{if(!t||t.trim()===""){console.error("Unifold: publishableKey is required. Please provide a valid publishable key.");return}!t.startsWith("pk_test_")&&!t.startsWith("pk_live_")&&console.warn('Unifold: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),rr({publishableKey:t});},[t]),useEffect(()=>()=>{x.current&&clearTimeout(x.current);},[]);let h=useRef(null),x=useRef(null),P=useCallback(g=>{x.current&&(clearTimeout(x.current),x.current=null),h.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),h.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),h.current=null);let i=new Promise((c,R)=>{h.current={resolve:c,reject:R};});return d(g),s(true),i},[]),I=useCallback(()=>{h.current&&(h.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),h.current=null),s(false),x.current=setTimeout(()=>{d(null),x.current=null;},200);},[]),C=useCallback(g=>{a?.onSuccess&&a.onSuccess(g),h.current&&(h.current.resolve(g),h.current=null);},[a]),u=useCallback(g=>{console.error("[UnifoldProvider] Deposit error:",g),a?.onError&&a.onError(g),h.current&&(h.current.reject(g),h.current=null);},[a]),m=useMemo(()=>({publishableKey:t,beginDeposit:P,closeDeposit:I}),[t,P,I]);return jsx(QueryClientProvider,{client:n,children:jsx(Ui.Provider,{value:m,children:jsxs(mo,{mode:l,accentColor:o?.accentColor,theme:o?.theme,fontFamily:o?.fontFamily,fonts:o?.fonts,components:o?.components,children:[e,a&&jsx(Wr,{visible:r,onClose:I,publishableKey:t,modalTitle:o?.modalTitle,externalUserId:a.externalUserId,destinationChainType:a.destinationChainType,destinationChainId:a.destinationChainId,destinationTokenSymbol:a.destinationTokenSymbol,recipientAddress:a.recipientAddress,destinationTokenAddress:a.destinationTokenAddress,defaultChainType:a.defaultChainType,defaultChainId:a.defaultChainId,defaultTokenAddress:a.defaultTokenAddress,showBalance:a.showBalance,stripeOnrampEmail:a.stripeOnrampEmail,stripeOnrampPhone:a.stripeOnrampPhone,stripeTheme:{mode:l,accentColor:o?.accentColor,theme:o?.theme,fontFamily:o?.fontFamily,fonts:o?.fonts,components:o?.components},depositConfirmationMode:a.depositConfirmationMode??"auto_ui",hideDepositTracker:o?.hideDepositTracker,transferInputVariant:o?.transferInputVariant,enableStripeLinkPay:o?.enableStripeLinkPay,StripeOnrampComponent:o?.enableStripeLinkPay?Ai():void 0,onDepositSuccess:C,onDepositError:u,theme:l,sheetBorderRadius:o?.sheetBorderRadius})]})})})}function Ea(){let e=useContext(Ui);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
|
|
2
|
+
export{Wa as UnifoldProvider,Oi as registerStripeOnramp,An as setDevApiUrl,Zo as useAllowedCountry,Ea as useUnifold};
|