@unifold/connect-react-native 0.1.9 → 0.1.11

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.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import {createContext,useState,useEffect,useRef,useMemo,useCallback,useContext}from'react';import {Dimensions,StyleSheet,Platform,useColorScheme,View,ActivityIndicator,Text,ScrollView,Animated,Modal,TouchableWithoutFeedback,TouchableOpacity,Image,TextInput,Linking,Clipboard,Easing}from'react-native';import {QueryClient,QueryClientProvider}from'@tanstack/react-query';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import K,{Path,Line,Polyline,SvgUri,Rect,Circle}from'react-native-svg';import on from'react-native-qrcode-svg';import {WebView}from'react-native-webview';var Qo={background:"#ffffff",foreground:"#0f0f0f",foregroundMuted:"#737373",card:"#f5f5f5",cardHover:"#e5e5e5",border:"#e5e5e5",overlay:"rgba(0, 0, 0, 0.5)",primary:"#3b82f6",primaryForeground:"#ffffff",success:"#22c55e",error:"#ef4444",warning:"#f59e0b"},Ar={background:"#0f0f0f",foreground:"#fafafa",foregroundMuted:"#a3a3a3",card:"#262626",cardHover:"#404040",border:"#333333",overlay:"rgba(0, 0, 0, 0.7)",primary:"#3b82f6",primaryForeground:"#ffffff",success:"#22c55e",error:"#ef4444",warning:"#f59e0b"},Go=createContext({colors:Qo,isDark:false,mode:"auto"});function wt({children:e,mode:t="auto"}){let o=useColorScheme(),n=useMemo(()=>{let l;return t==="auto"?l=o==="dark":l=t==="dark",{colors:l?Ar:Qo,isDark:l,mode:t}},[t,o]);return jsx(Go.Provider,{value:n,children:e})}function R(){let e=useContext(Go);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}var zr="https://api.unifold.io",Ut,Ee="pk_test_123",jt={};function ae(){return typeof __DEV__<"u"&&__DEV__&&Ut?Ut:zr}function Ot(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.'),Ee=e.publishableKey;}e.baseUrl&&typeof __DEV__<"u"&&__DEV__&&(Ut=e.baseUrl),e.defaultConfig&&(jt=e.defaultConfig);}function Yo(e){typeof __DEV__<"u"&&__DEV__?(Ut=e,console.log(`[Unifold DEV] API URL set to: ${e}`)):console.warn("[Unifold] setDevApiUrl() is only available in development mode");}function $e(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 ie(e){let t=e.startsWith("/")?e:`/${e}`;return `${ae()}/api/public${t}`}function z(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,ae()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${ae()}${e}`:`${ae()}/api/public${e}`:""}async function Jo(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let o={external_user_id:e.external_user_id,destination_chain_type:e?.destination_chain_type||"ethereum",destination_chain_id:e?.destination_chain_id||jt.destinationChainId||"8453",destination_token_address:e?.destination_token_address||jt.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:e?.recipient_address||jt.recipientAddress||"0x309a4154a2CD4153Da886E780890C9cb5161553C",client_metadata:e?.client_metadata||{}},n=t||Ee;$e(n);let l=await fetch(`${ae()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!l.ok)throw new Error(`Failed to create deposit address: ${l.statusText}`);return l.json()}async function Ct(e,t){return Jo(e?{...e,external_user_id:e.external_user_id}:void 0,t)}function xt(e,t){return e.find(o=>o.chain_type===t)}async function kt(e,t){let o=t||Ee;$e(o);let n=await fetch(`${ae()}/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()}function ee(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 ko(e){let t=e||Ee;$e(t);let o=await fetch(`${ae()}/v1/public/tokens/supported_deposit_tokens`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch supported deposit tokens: ${o.statusText}`);return o.json()}async function bo(e,t){let o=t||Ee;$e(o);let n=await fetch(`${ae()}/v1/public/onramps/meld/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 Meld quotes: ${n.statusText}`);return n.json()}async function To(e,t){let o=t||Ee;$e(o);let n=await fetch(`${ae()}/v1/public/onramps/meld/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 Meld session: ${n.statusText}`);return n.json()}async function So(e){let t=e||Ee;$e(t);let o=await fetch(`${ae()}/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()}async function bt(e){let t=e||Ee;$e(t);let o=await fetch(`${ae()}/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 _o(){let e=await fetch(`${ae()}/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()}var{height:at}=Dimensions.get("window");function Q({visible:e,onClose:t,children:o,closeOnBackdropPress:n=true,showHandle:l=true,heightPercent:s,noPadding:p=false}){let{colors:w}=R(),f=useRef(new Animated.Value(at)).current,r=useRef(new Animated.Value(0)).current;useEffect(()=>{e?(f.setValue(at),r.setValue(0),Animated.parallel([Animated.spring(f,{toValue:0,useNativeDriver:true,tension:65,friction:11}),Animated.timing(r,{toValue:.5,duration:200,useNativeDriver:true})]).start()):Animated.parallel([Animated.spring(f,{toValue:at,useNativeDriver:true,tension:65,friction:11}),Animated.timing(r,{toValue:0,duration:200,useNativeDriver:true})]).start();},[e,f,r]);let P=()=>{n&&t();};return jsx(Modal,{visible:e,transparent:true,animationType:"none",statusBarTranslucent:true,onRequestClose:t,children:jsxs(View,{style:Qe.container,children:[jsx(TouchableWithoutFeedback,{onPress:P,children:jsx(Animated.View,{style:[Qe.backdrop,{backgroundColor:"#000000",opacity:r}]})}),jsxs(Animated.View,{style:[Qe.sheet,{backgroundColor:w.background,borderTopLeftRadius:24,borderTopRightRadius:24,transform:[{translateY:f}],...s&&{height:at*s,maxHeight:at*s},...p&&{paddingBottom:0}}],children:[l&&jsx(View,{style:Qe.handleContainer,children:jsx(View,{style:[Qe.handle,{backgroundColor:w.border}]})}),jsx(View,{style:[Qe.content,s&&Qe.contentFlex],children:o})]})]})})}var Qe=StyleSheet.create({container:{flex:1,justifyContent:"flex-end"},backdrop:{...StyleSheet.absoluteFillObject},sheet:{maxHeight:at*.9,paddingBottom:Platform.OS==="ios"?34:24,shadowColor:"#000",shadowOffset:{width:0,height:-4},shadowOpacity:.1,shadowRadius:12,elevation:16},handleContainer:{alignItems:"center",paddingTop:12,paddingBottom:4},handle:{width:36,height:4,borderRadius:2},content:{},contentFlex:{flex:1}});function Io({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(K,{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 vo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(K,{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 Tt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(K,{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 Do({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(K,{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 Ie({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(K,{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 Ge({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(K,{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 ce({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(K,{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 te({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(K,{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 Ye({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(K,{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 Vo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(K,{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 tr({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(K,{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"})})}function or({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(K,{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 lt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(K,{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 qt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(K,{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 Po({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(K,{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 rr({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(K,{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 $t({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(K,{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 de({title:e,showBack:t=false,showClose:o=true,onBack:n,onClose:l,badge:s}){let{colors:p}=R();return jsxs(View,{style:ye.header,children:[jsx(View,{style:ye.leftContainer,children:t&&n?jsx(TouchableOpacity,{onPress:n,style:[ye.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Do,{size:20,color:p.foreground,strokeWidth:2})}):jsx(View,{style:ye.spacer})}),jsxs(View,{style:ye.titleContainer,children:[jsx(Text,{style:[ye.title,{color:p.foreground}],children:e}),s&&s.count>0&&jsx(View,{style:[ye.titleBadge,{backgroundColor:p.card}],children:jsx(Text,{style:[ye.titleBadgeText,{color:p.foregroundMuted}],children:s.count})})]}),jsx(View,{style:ye.rightContainer,children:o?jsx(TouchableOpacity,{onPress:l,style:[ye.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Ie,{size:20,color:p.foreground,strokeWidth:2})}):jsx(View,{style:ye.spacer})})]})}var ye=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,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},title:{fontSize:16,fontWeight:"500",textAlign:"center"},titleBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:12},titleBadgeText:{fontSize:10,fontWeight:"400"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function ue({uri:e,width:t,height:o,borderRadius:n=0,borderWidth:l=0,borderColor:s="transparent",backgroundColor:p="transparent",style:w}){let[f,r]=useState(false),P=e?.toLowerCase().endsWith(".svg");if(!e)return jsx(View,{style:[{width:t,height:o,borderRadius:n,backgroundColor:"#374151"},w]});let b={width:t,height:o,borderRadius:n,borderWidth:l,borderColor:s,backgroundColor:p,overflow:"hidden",alignItems:"center",justifyContent:"center",...w},a=t-l*2,T=o-l*2;return f?jsx(View,{style:[b,{backgroundColor:p||"#374151"}]}):P?jsx(View,{style:b,children:jsx(SvgUri,{uri:e,width:a,height:T,onError:A=>{console.log(`[RemoteIcon] SVG load error for ${e}:`,A),r(true);}})}):jsx(View,{style:b,children:jsx(Image,{source:{uri:e},style:{width:a,height:T},resizeMode:"contain",onError:A=>{console.log(`[RemoteIcon] Image load error for ${e}:`,A.nativeEvent.error),r(true);}})})}function St({onPress:e,title:t,subtitle:o,featuredTokens:n}){let{colors:l}=R(),s=n?[...n].sort((p,w)=>p.position-w.position):[];return jsxs(TouchableOpacity,{onPress:e,activeOpacity:.7,style:[ve.container,{backgroundColor:l.card}],children:[jsxs(View,{style:ve.leftContent,children:[jsx(View,{style:[ve.iconContainer,{backgroundColor:l.cardHover}],children:jsx(Io,{size:20,color:l.foreground,strokeWidth:2})}),jsxs(View,{style:ve.textContainer,children:[jsx(Text,{style:[ve.title,{color:l.foreground}],children:t}),jsx(Text,{style:[ve.subtitle,{color:l.foregroundMuted}],children:o})]})]}),jsx(View,{style:ve.rightContent,children:jsx(View,{style:ve.networkIcons,children:s.map((p,w)=>{let f=p.icon_urls.find(r=>r.format==="png")?.url||p.icon_urls.find(r=>r.format==="svg")?.url;return jsx(View,{style:[ve.networkIconWrapper,{marginLeft:w===0?0:-6,zIndex:s.length-w}],children:jsx(ue,{uri:z(f),width:20,height:20,borderRadius:10,borderWidth:2,borderColor:l.card})},p.name)})})})]})}var ve=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,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 It({onPress:e,title:t,subtitle:o,paymentNetworks:n}){let{colors:l}=R();return jsxs(TouchableOpacity,{onPress:e,activeOpacity:.7,style:[Fe.container,{backgroundColor:l.card}],children:[jsxs(View,{style:Fe.leftContent,children:[jsx(View,{style:[Fe.iconContainer,{backgroundColor:l.cardHover}],children:jsx(vo,{size:20,color:l.foreground,strokeWidth:2})}),jsxs(View,{style:Fe.textContainer,children:[jsx(Text,{style:[Fe.title,{color:l.foreground}],children:t}),jsx(Text,{style:[Fe.subtitle,{color:l.foregroundMuted}],children:o})]})]}),jsx(View,{style:Fe.rightContent,children:jsx(View,{style:Fe.paymentIcons,children:n?.map(s=>{let p=s.icon_urls.find(w=>w.format==="png")?.url||s.icon_urls.find(w=>w.format==="svg")?.url;return jsx(ue,{uri:z(p),width:32,height:20,borderRadius:4},s.name)})})})]})}var Fe=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,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 vt({onPress:e,title:t,subtitle:o,badge:n}){let{colors:l}=R();return jsx(TouchableOpacity,{onPress:e,activeOpacity:.7,style:[He.container,{backgroundColor:l.card}],children:jsxs(View,{style:He.leftContent,children:[jsxs(View,{style:[He.iconContainer,{backgroundColor:l.cardHover}],children:[jsx(Tt,{size:20,color:l.foreground,strokeWidth:2}),n!==void 0&&n>0&&jsx(View,{style:[He.badge,{backgroundColor:l.primary}],children:jsx(Text,{style:He.badgeText,children:n>99?"99+":n})})]}),jsxs(View,{style:He.textContainer,children:[jsx(Text,{style:[He.title,{color:l.foreground}],children:t}),jsx(Text,{style:[He.subtitle,{color:l.foregroundMuted}],children:o})]})]})})}var He=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,alignItems:"center",justifyContent:"center",position:"relative"},badge:{position:"absolute",top:-4,right:-4,minWidth:18,height:18,borderRadius:9,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 Yt({value:e,size:t=180,logoUri:o,logoSize:n=40,logoBackgroundColor:l}){let{colors:s,isDark:p}=R(),w=p?"#1a1a1a":"#ffffff",f=p?"#ffffff":"#000000",r=l||w;return jsxs(View,{style:[dr.container,{width:t,height:t}],children:[jsx(on,{value:e||"placeholder",size:t,backgroundColor:w,color:f,ecl:"H",quietZone:4}),o&&jsx(View,{style:[dr.logoContainer,{width:n+12,height:n+12,backgroundColor:r,borderRadius:(n+12)/2}],children:jsx(ue,{uri:o,width:n,height:n,borderRadius:n/2})})]})}var dr=StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function pr(e){let t=e.split("/"),o=t[t.length-1];return o&&o.length>10?`${o.slice(0,6)}...${o.slice(-3)}`:o||""}function un(e){let o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],n=e.getDate(),l=e.getFullYear(),s=e.getHours(),p=e.getMinutes(),w=s>=12?"pm":"am";s=s%12,s=s||12;let f=p<10?`0${p}`:p;return `${o} ${n}, ${l} at ${s}:${f}${w}`}function Zt({visible:e,status:t,tokenIconUrl:o,explorerUrl:n,completionExplorerUrl:l,date:s,amountUsd:p,onClose:w}){let{colors:f}=R(),r=useRef(new Animated.Value(0)).current,[P,b]=useState(false),a=t==="pending"||t==="waiting"||t==="delayed",T=t==="succeeded";useEffect(()=>{if(a&&e){let x=Animated.loop(Animated.timing(r,{toValue:1,duration:1e3,easing:Easing.linear,useNativeDriver:true}));return x.start(),()=>x.stop()}else r.setValue(0);},[a,e,r]);let A=r.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]}),F=()=>{n&&Linking.openURL(n);},W=()=>{l&&Linking.openURL(l);};return jsx(Q,{visible:e,onClose:w,closeOnBackdropPress:true,showHandle:false,children:jsxs(View,{style:N.container,children:[jsx(TouchableOpacity,{style:N.closeButton,onPress:w,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Ie,{size:20,color:f.foregroundMuted,strokeWidth:2})}),jsxs(View,{style:N.iconContainer,children:[o?jsx(Image,{source:{uri:z(o)},style:N.tokenIcon}):jsx(View,{style:[N.tokenIcon,{backgroundColor:f.cardHover}]}),jsx(View,{style:[N.statusBadge,{backgroundColor:a?"#F97316":"#22C55E"}],children:a?jsx(Animated.View,{style:{transform:[{rotate:A}]},children:jsx(qt,{size:16,color:"#fff",strokeWidth:2.5})}):jsx(te,{size:16,color:"#fff",strokeWidth:3})})]}),jsx(Text,{style:[N.title,{color:f.foreground}],children:a?"Deposit Processing":"Deposit Complete"}),p!==void 0&&jsxs(Text,{style:[N.amount,{color:f.foreground}],children:["$",p.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),s&&jsx(Text,{style:[N.date,{color:f.foregroundMuted}],children:un(s)}),jsx(Text,{style:[N.subtitle,{color:f.foregroundMuted}],children:a?"This usually takes less than a minute.":"Your account has been credited successfully!"}),T&&(n||l)&&jsxs(View,{style:N.detailsSection,children:[jsx(View,{style:[N.divider,{backgroundColor:f.border}]}),jsxs(TouchableOpacity,{style:N.detailsToggle,onPress:()=>b(!P),children:[jsx(Text,{style:[N.detailsToggleText,{color:f.foregroundMuted}],children:P?"See less":"See more details"}),P?jsx(lt,{size:18,color:f.foregroundMuted,strokeWidth:2}):jsx(ce,{size:18,color:f.foregroundMuted,strokeWidth:2})]}),P&&jsxs(View,{style:N.txButtonsContainer,children:[n&&jsxs(TouchableOpacity,{style:[N.txButton,{backgroundColor:f.card,borderColor:f.border}],onPress:F,children:[jsx(Text,{style:[N.txLabel,{color:f.foreground}],children:"Deposit tx"}),jsx(Text,{style:[N.txHash,{color:f.foregroundMuted}],children:pr(n)}),jsx(Ye,{size:16,color:f.foregroundMuted,strokeWidth:2})]}),l&&jsxs(TouchableOpacity,{style:[N.txButton,{backgroundColor:f.card,borderColor:f.border}],onPress:W,children:[jsx(Text,{style:[N.txLabel,{color:f.foreground}],children:"Completion tx"}),jsx(Text,{style:[N.txHash,{color:f.foregroundMuted}],children:pr(l)}),jsx(Ye,{size:16,color:f.foregroundMuted,strokeWidth:2})]})]})]})]})})}var N=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},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"}});var Dt=(e,t)=>`${t}:${e}`,gn=e=>{let[t,o]=e.split(":");return {chainType:t,chainId:o}};function oo({externalUserId:e,publishableKey:t,recipientAddress:o,destinationChainType:n,destinationChainId:l,destinationTokenAddress:s,onExecutionsChange:p,onDepositSuccess:w,onDepositError:f}){let{colors:r}=R(),[P,b]=useState("USDC"),[a,T]=useState("solana:mainnet"),[A,F]=useState([]),[W,x]=useState(true),[D,J]=useState([]),[m,$]=useState(true),[j,oe]=useState(false),[re,B]=useState(false),[Ce,xe]=useState(false),[Oe,ne]=useState(false),[ke,Le]=useState([]),[se,rt]=useState(new Map),[Ne]=useState(()=>new Date),[nt,Te]=useState(null),[Be,Wt]=useState(false),[We,Mt]=useState(null),[mo,Se]=useState(false),mt=new Map;D.forEach(u=>{u.chains.forEach(S=>{let E=`${S.chain_type}:${S.chain_id}`;mt.has(E)||mt.set(E,S);});});let At=Array.from(mt.values()),Et=gn(a),zt=At.find(u=>u.chain_type===Et.chainType&&u.chain_id===Et.chainId)?.chain_type||"ethereum",Me=xt(A,zt)?.address||"";useEffect(()=>{async function u(){try{$(!0),Te(null);let S=await ko(t);if(J(S.data),S.data.length>0){let E=S.data[0];if(b(E.symbol),E.chains.length>0){let H=E.chains[0];T(Dt(H.chain_id,H.chain_type));}}}catch(S){console.error("Error fetching supported tokens:",S),Te("Failed to load supported tokens"),f?.({message:"Failed to load supported tokens",error:S});}finally{$(false);}}u();},[t,f]),useEffect(()=>{async function u(){try{x(!0),Te(null);let S=await Ct({external_user_id:e,recipient_address:o,destination_chain_type:n,destination_chain_id:l,destination_token_address:s},t);F(S.data);}catch(S){console.error("Error fetching wallets:",S),Te("Failed to load wallets"),f?.({message:"Failed to load wallets",error:S});}finally{x(false);}}u();},[e,o,n,l,s,t,f]),useEffect(()=>{if(!e||!Ne)return;let u=setInterval(async()=>{try{let S=await kt(e,t),E=null;for(let H of S.data){let fe=H.created_at?new Date(H.created_at):null;if(!fe||fe<=Ne)continue;let Ae=se.get(H.id);if(!Ae){E=H;break}if(["pending","waiting","delayed"].includes(Ae)&&H.status==="succeeded"){E=H;break}}if(E){let H=E;Le(fe=>{let Ae=fe.findIndex(yt=>yt.id===H.id);if(Ae>=0){let yt=[...fe];return yt[Ae]=H,yt}else return [...fe,H]}),rt(fe=>{let Ae=new Map(fe);return Ae.set(H.id,H.status),Ae}),Mt(H),Wt(!0),H.status==="succeeded"&&w?.({message:"Deposit completed successfully",executionId:H.id}),p?.([...ke,H]);}}catch(S){console.error("Error polling executions:",S),f?.({message:"Failed to check deposit status",error:S});}},5e3);return ()=>clearInterval(u)},[e,t,Ne,se,ke,p,w,f]),useEffect(()=>{if(!D.length)return;let u=D.find(E=>E.symbol===P);if(!u||u.chains.length===0)return;if(!u.chains.some(E=>Dt(E.chain_id,E.chain_type)===a)){let E=u.chains[0];T(Dt(E.chain_id,E.chain_type));}},[P,D,a]);let qe=D.find(u=>u.symbol===P),Ft=qe?.chains||[],_e=Ft.find(u=>Dt(u.chain_id,u.chain_type)===a),wo=async()=>{if(Me)try{Clipboard.setString(Me),oe(!0),setTimeout(()=>oe(!1),2e3);}catch(u){console.error("Failed to copy:",u);}},Ht=_e?.estimated_price_impact_percent??0,it=_e?.max_slippage_percent??.25,Co=_e?.minimum_deposit_amount_usd??3;if(m)return jsxs(View,{style:i.loadingContainer,children:[jsx(ActivityIndicator,{size:"large",color:r.primary}),jsx(Text,{style:[i.loadingText,{color:r.foregroundMuted}],children:"Loading currencies..."})]});if(nt&&D.length===0)return jsxs(View,{style:i.errorContainer,children:[jsx(Text,{style:[i.errorText,{color:r.error}],children:nt}),jsx(Text,{style:[i.errorHint,{color:r.foregroundMuted}],children:"Please check your network connection and try again."})]});let xo=()=>jsxs(Q,{visible:Ce,onClose:()=>xe(false),closeOnBackdropPress:true,showHandle:false,children:[jsxs(View,{style:[i.sheetHeader,{borderBottomColor:r.border}],children:[jsx(View,{style:i.sheetHeaderSpacer}),jsx(Text,{style:[i.sheetTitle,{color:r.foreground}],children:"Select Token"}),jsx(TouchableOpacity,{onPress:()=>xe(false),style:i.sheetCloseButton,children:jsx(Ie,{size:20,color:r.foreground,strokeWidth:2})})]}),jsx(ScrollView,{style:i.sheetList,showsVerticalScrollIndicator:false,children:D.map(u=>jsxs(TouchableOpacity,{onPress:()=>{b(u.symbol),xe(false);},style:[i.sheetItem,{backgroundColor:P===u.symbol?r.card:"transparent"}],children:[jsx(Image,{source:{uri:z(ee(u,"png"))},style:i.sheetItemIcon}),jsxs(View,{style:i.sheetItemText,children:[jsx(Text,{style:[i.sheetItemTitle,{color:r.foreground}],children:u.symbol}),jsxs(Text,{style:[i.sheetItemSubtitle,{color:r.foregroundMuted}],children:[u.chains.length," network",u.chains.length!==1?"s":""," available"]})]}),P===u.symbol&&jsx(te,{size:20,color:r.primary,strokeWidth:2})]},u.symbol))})]}),h=()=>jsxs(Q,{visible:Oe,onClose:()=>ne(false),closeOnBackdropPress:true,showHandle:false,children:[jsxs(View,{style:[i.sheetHeader,{borderBottomColor:r.border}],children:[jsx(View,{style:i.sheetHeaderSpacer}),jsx(Text,{style:[i.sheetTitle,{color:r.foreground}],children:"Select Network"}),jsx(TouchableOpacity,{onPress:()=>ne(false),style:i.sheetCloseButton,children:jsx(Ie,{size:20,color:r.foreground,strokeWidth:2})})]}),jsx(ScrollView,{style:i.sheetList,showsVerticalScrollIndicator:false,children:Ft.map(u=>{let S=Dt(u.chain_id,u.chain_type),E=a===S;return jsxs(TouchableOpacity,{onPress:()=>{T(S),ne(false);},style:[i.sheetItem,{backgroundColor:E?r.card:"transparent"}],children:[jsx(Image,{source:{uri:z(ee(u,"png"))},style:i.sheetItemIcon}),jsxs(View,{style:i.sheetItemText,children:[jsx(Text,{style:[i.sheetItemTitle,{color:r.foreground}],children:u.chain_name}),jsxs(Text,{style:[i.sheetItemSubtitle,{color:r.foregroundMuted}],children:["Min deposit: $",u.minimum_deposit_amount_usd]})]}),E&&jsx(te,{size:20,color:r.primary,strokeWidth:2})]},S)})})]});return jsxs(View,{style:i.container,children:[jsxs(View,{style:i.selectorSection,children:[jsx(Text,{style:[i.selectorLabel,{color:r.foregroundMuted}],children:"Token"}),jsxs(TouchableOpacity,{onPress:()=>xe(true),style:[i.selector,{backgroundColor:r.card}],children:[qe&&jsx(Image,{source:{uri:z(ee(qe,"png"))},style:i.selectorIcon}),jsx(Text,{style:[i.selectorText,{color:r.foreground}],children:P}),jsx(ce,{size:16,color:r.foregroundMuted,strokeWidth:2})]})]}),jsxs(View,{style:i.selectorSection,children:[jsxs(Text,{style:[i.selectorLabel,{color:r.foregroundMuted}],children:["Network"," ",jsxs(Text,{style:i.minDeposit,children:["($",Co," min)"]})]}),jsxs(TouchableOpacity,{onPress:()=>ne(true),style:[i.selector,{backgroundColor:r.card}],children:[_e&&jsx(Image,{source:{uri:z(ee(_e,"png"))},style:i.selectorIcon}),jsx(Text,{style:[i.selectorText,{color:r.foreground}],numberOfLines:1,children:_e?.chain_name||"Select network"}),jsx(ce,{size:16,color:r.foregroundMuted,strokeWidth:2})]})]}),jsx(View,{style:i.qrContainer,children:jsx(View,{style:[i.qrWrapper,{backgroundColor:r.background,borderColor:r.border}],children:W?jsxs(View,{style:i.qrLoading,children:[jsx(ActivityIndicator,{size:"small",color:r.primary}),jsx(Text,{style:[i.loadingText,{color:r.foregroundMuted}],children:"Loading..."})]}):Me?jsx(Yt,{value:Me,size:160,logoUri:z(ee(_e,"png")||ie("/icons/networks/png/ethereum.png")),logoSize:40}):jsx(View,{style:i.qrLoading,children:jsx(Text,{style:[i.errorText,{color:r.error}],children:"No address available"})})})}),jsxs(View,{style:i.addressSection,children:[jsxs(View,{style:i.addressHeader,children:[jsx(Text,{style:[i.addressLabel,{color:r.foregroundMuted}],children:"Deposit Address"}),j&&jsxs(View,{style:i.copiedIndicator,children:[jsx(te,{size:14,color:r.success,strokeWidth:2}),jsx(Text,{style:[i.copiedText,{color:r.success}],children:"Copied"})]})]}),jsx(TouchableOpacity,{onPress:wo,disabled:!Me||W,activeOpacity:.7,style:[i.addressBox,{backgroundColor:r.card}],children:jsx(Text,{style:[i.addressText,{color:r.foreground}],numberOfLines:2,children:W?"Loading...":Me||"No address available"})})]}),jsxs(View,{style:[i.detailsCard,{backgroundColor:r.card}],children:[jsxs(TouchableOpacity,{onPress:()=>B(!re),style:i.detailsHeader,children:[jsxs(View,{style:i.detailsRow,children:[jsx(View,{style:[i.detailIcon,{backgroundColor:r.cardHover}],children:jsx(Tt,{size:12,color:r.foreground,strokeWidth:2})}),jsxs(Text,{style:[i.detailsLabel,{color:r.foregroundMuted}],children:["Processing time:"," ",jsx(Text,{style:{color:r.foreground},children:"< 1 min"})]})]}),jsx(View,{style:i.chevronContainer,children:re?jsx(lt,{size:16,color:r.foregroundMuted,strokeWidth:2}):jsx(ce,{size:16,color:r.foregroundMuted,strokeWidth:2})})]}),re&&jsxs(View,{style:i.detailsContent,children:[jsxs(View,{style:i.detailsRow,children:[jsx(View,{style:[i.detailIcon,{backgroundColor:r.cardHover}],children:jsx(Vo,{size:12,color:r.foreground,strokeWidth:2})}),jsxs(Text,{style:[i.detailsLabel,{color:r.foregroundMuted}],children:["Price impact:"," ",jsxs(Text,{style:{color:r.foreground},children:[Ht.toFixed(2),"%"]})]}),jsx(TouchableOpacity,{onPress:()=>Se(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(Po,{size:14,color:r.foregroundMuted,strokeWidth:2})})]}),jsxs(View,{style:i.detailsRow,children:[jsx(View,{style:[i.detailIcon,{backgroundColor:r.cardHover}],children:jsx(tr,{size:12,color:r.foreground,strokeWidth:2})}),jsxs(Text,{style:[i.detailsLabel,{color:r.foregroundMuted}],children:["Max slippage:"," ",jsxs(Text,{style:{color:r.foreground},children:[it.toFixed(2),"%"]})]}),jsx(TouchableOpacity,{onPress:()=>Se(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(Po,{size:14,color:r.foregroundMuted,strokeWidth:2})})]}),jsxs(View,{style:i.detailsRow,children:[jsx(View,{style:[i.detailIcon,{backgroundColor:r.cardHover}],children:jsx(or,{size:12,color:r.foreground,strokeWidth:2})}),jsxs(Text,{style:[i.detailsLabel,{color:r.foregroundMuted}],children:["Need help?"," ",jsx(Text,{style:{color:r.foreground,textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsx(TouchableOpacity,{style:i.termsContainer,children:jsx(Text,{style:[i.termsText,{color:r.foregroundMuted}],children:"Terms apply"})}),xo(),h(),jsxs(Q,{visible:mo,onClose:()=>Se(false),closeOnBackdropPress:true,showHandle:true,children:[jsxs(View,{style:[i.sheetHeader,{borderBottomColor:r.border}],children:[jsx(View,{style:i.sheetHeaderSpacer}),jsx(Text,{style:[i.sheetTitle,{color:r.foreground}],children:"Price Impact & Slippage"}),jsx(TouchableOpacity,{onPress:()=>Se(false),style:i.sheetCloseButton,children:jsx(Ie,{size:20,color:r.foreground,strokeWidth:2})})]}),jsxs(View,{style:i.infoSheetContent,children:[jsxs(View,{style:[i.infoCard,{backgroundColor:r.card}],children:[jsxs(View,{style:i.infoCardHeader,children:[jsx(View,{style:[i.infoCardIcon,{backgroundColor:r.cardHover}],children:jsx(Vo,{size:16,color:r.foreground,strokeWidth:2})}),jsx(Text,{style:[i.infoCardTitle,{color:r.foreground}],children:"Price Impact"}),jsxs(Text,{style:[i.infoCardValue,{color:r.foreground}],children:[Ht.toFixed(2),"%"]})]}),jsx(Text,{style:[i.infoCardDescription,{color:r.foregroundMuted}],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:[i.infoCard,{backgroundColor:r.card}],children:[jsxs(View,{style:i.infoCardHeader,children:[jsx(View,{style:[i.infoCardIcon,{backgroundColor:r.cardHover}],children:jsx(rr,{size:16,color:r.foreground,strokeWidth:2})}),jsx(Text,{style:[i.infoCardTitle,{color:r.foreground}],children:"Max Slippage"}),jsxs(Text,{style:[i.infoCardValue,{color:r.foreground}],children:[it.toFixed(2),"%"]})]}),jsx(Text,{style:[i.infoCardDescription,{color:r.foregroundMuted}],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."})]})]})]}),We&&jsx(Zt,{visible:Be,status:We.status,tokenIconUrl:We.destination_token_metadata?.icon_urls?.find(u=>u.format==="png")?.url||We.destination_token_metadata?.icon_url||ee(qe,"png"),explorerUrl:We.explorer_url,completionExplorerUrl:We.destination_explorer_url,onClose:()=>Wt(false)})]})}var i=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,borderRadius:16,borderWidth:1},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:{paddingHorizontal:12,paddingVertical:16,borderRadius:8},addressText:{fontSize:12,fontFamily:"monospace"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,paddingLeft:8,paddingRight:24},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 ro({currency:e,isSelected:t,onSelect:o}){let{colors:n}=R();return jsxs(TouchableOpacity,{onPress:()=>o(e.currency_code),activeOpacity:.7,style:[Ze.container,{backgroundColor:n.card}],children:[jsxs(View,{style:Ze.leftContent,children:[jsx(View,{style:[Ze.iconContainer,{backgroundColor:n.background}],children:jsx(Image,{source:{uri:z(ee(e,"png"))},style:Ze.icon})}),jsxs(View,{style:Ze.textContainer,children:[jsx(Text,{style:[Ze.name,{color:n.foreground}],children:e.name}),jsx(Text,{style:[Ze.code,{color:n.foregroundMuted}],children:e.currency_code.toUpperCase()})]})]}),t&&jsx(te,{size:16,color:n.foreground,strokeWidth:2})]})}var Ze=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,borderRadius: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 Pt({title:e,currencies:t,selectedCurrency:o,onSelect:n}){let{colors:l}=R();return t.length===0?null:jsxs(View,{children:[jsx(View,{style:yr.headerContainer,children:jsx(Text,{style:[yr.title,{color:l.foregroundMuted}],children:e})}),t.map(s=>jsx(ro,{currency:s,isSelected:o.toLowerCase()===s.currency_code.toLowerCase(),onSelect:n},s.currency_code))]})}var yr=StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function io({open:e,onOpenChange:t,currencies:o,preferredCurrencyCodes:n,selectedCurrency:l,onSelectCurrency:s}){let{colors:p}=R(),[w,f]=useState(""),r=n.map(W=>o.find(x=>x.currency_code.toLowerCase()===W.toLowerCase())).filter(W=>W!==void 0),P=o.filter(W=>!n.includes(W.currency_code.toLowerCase())),b=W=>{if(!w)return W;let x=w.toLowerCase();return W.filter(D=>D.name.toLowerCase().includes(x)||D.currency_code.toLowerCase().includes(x))},a=b(r),T=b(P),A=W=>{s(W),t(false),f("");},F=()=>{t(false),f("");};return jsxs(Q,{visible:e,onClose:F,closeOnBackdropPress:true,showHandle:false,children:[jsx(de,{title:"Currency",showBack:false,onClose:F}),jsx(View,{style:et.searchContainer,children:jsx(TextInput,{style:[et.searchInput,{backgroundColor:p.card,color:p.foreground}],value:w,onChangeText:f,placeholder:"Search",placeholderTextColor:p.foregroundMuted})}),jsx(ScrollView,{style:et.listContainer,showsVerticalScrollIndicator:false,children:jsxs(View,{style:et.listContent,children:[jsx(Pt,{title:"Popular currencies",currencies:a,selectedCurrency:l,onSelect:A}),a.length>0&&T.length>0&&jsx(View,{style:et.sectionSpacer}),jsx(Pt,{title:"All currencies",currencies:T,selectedCurrency:l,onSelect:A}),a.length===0&&T.length===0&&jsx(View,{style:et.noResultsContainer,children:jsx(Text,{style:[et.noResultsText,{color:p.foregroundMuted}],children:"No currencies found"})})]})})]})}var et=StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:16,paddingBottom:12},searchInput:{padding:16,borderRadius:12,fontSize:14},listContainer:{height:400,paddingHorizontal:12},listContent:{paddingBottom:24,minHeight:400},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});var Vn=[100,500,1e3];function xr(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 ao({externalUserId:e,publishableKey:t,view:o,onViewChange:n,maxAmountUsd:l=5e4,destinationTokenSymbol:s="USDC",recipientAddress:p,destinationChainType:w,destinationChainId:f,destinationTokenAddress:r,onDepositSuccess:P,onDepositError:b}){let{colors:a}=R(),[T,A]=useState("500.00"),[F,W]=useState("usd"),[x,D]=useState([]),[J,m]=useState(false),[$,j]=useState(null),[oe,re]=useState("amount"),[B,Ce]=useState(null),[xe,Oe]=useState([]),[ne,ke]=useState(true),[Le,se]=useState(60),[rt,Ne]=useState([]),[nt,Te]=useState([]),[Be,Wt]=useState(null),[We,Mt]=useState(false),[mo,Se]=useState(false),[mt,At]=useState(false),[Et,$o]=useState(null),zt=o??oe,yo=rt.find(h=>h.currency_code.toLowerCase()===F.toLowerCase()),Me=useCallback(h=>{re(h),h==="quotes"?n?.(h,x.length):n?.(h);},[x.length,n]);useEffect(()=>{async function h(){try{let u=await Ct({external_user_id:e,recipient_address:p,destination_chain_type:w,destination_chain_id:f,destination_token_address:r},t);Oe(u.data);}catch(u){console.error("Error fetching wallets:",u),j("Failed to load wallet addresses");}finally{ke(false);}}h();},[e,p,w,f,r,t]),useEffect(()=>{async function h(){try{let u=await So(t);Ne(u.data),Te(u.preferred||[]);}catch(u){console.error("Error fetching fiat currencies:",u);}}h();},[t]),useEffect(()=>{let h=parseFloat(T);if(isNaN(h)||h<=0){D([]);return}if(F.toLowerCase()==="usd"&&h>l){D([]),j(`Maximum amount is ${xr("usd")}${l.toLocaleString()}`);return}let u=setTimeout(()=>{qe(h);},500);return ()=>clearTimeout(u)},[T,F,l,t]);let qe=async h=>{m(true),j(null);try{let u={country_code:"US",destination_currency_code:"usdc_polygon",source_amount:h.toString(),source_currency_code:F.toLowerCase()},S=await bo(u,t);if(D(S.data),S.data.length>0){let E=S.data.reduce((H,fe)=>fe.destination_amount>H.destination_amount?fe:H);Ce(E);}se(60);}catch(u){console.error("Failed to fetch quotes:",u),j("Failed to fetch quotes. Please try again."),D([]);}finally{m(false);}};useEffect(()=>{if(x.length===0)return;let h=setInterval(()=>{se(u=>{if(u<=1){let S=parseFloat(T);return !isNaN(S)&&S>0&&qe(S),60}return u-1});},1e3);return ()=>clearInterval(h)},[x.length,T]);let Ft=h=>{(/^\d*\.?\d{0,2}$/.test(h)||h==="")&&A(h);},_e=h=>{A(h.toFixed(2));},wo=()=>B?B.destination_amount.toFixed(2):"0.00",Ht=async()=>{if(B)try{let h=xt(xe,"ethereum");if(!h?.address){j("Wallet address not available");return}let u={service_provider:B.service_provider,country_code:B.country_code.toUpperCase(),destination_currency_code:B.destination_currency_code,source_currency_code:B.source_currency_code,wallet_address:h.address,source_amount:T},S=await To(u,t);Wt({provider:B,sourceCurrency:F,sourceAmount:T}),$o(S.widget_url),At(!0);}catch(h){console.error("Failed to create session:",h),j("Failed to start payment flow"),b?.({message:"Failed to start payment flow",error:h});}},it=xr(F),Co=()=>{At(false),Me("onramp"),P?.({message:"Payment flow completed",executionId:Be?.sessionId});},xo=()=>jsx(Pn,{visible:mt,onClose:Co,url:Et,providerName:B?.service_provider_display_name||"Complete Payment",colors:a});return zt==="amount"?jsxs(Fragment,{children:[jsxs(View,{style:d.amountViewContainer,children:[jsxs(ScrollView,{style:d.scrollContainer,contentContainerStyle:d.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsx(View,{style:d.currencySelector,children:jsxs(TouchableOpacity,{onPress:()=>Mt(true),style:[d.currencyButton,{backgroundColor:a.card}],children:[yo&&jsx(Image,{source:{uri:z(ee(yo,"png"))},style:d.currencyIcon}),jsx(Text,{style:[d.currencyText,{color:a.foreground}],children:F.toUpperCase()}),jsx(ce,{size:16,color:a.foregroundMuted,strokeWidth:2})]})}),jsx(io,{open:We,onOpenChange:Mt,currencies:rt,preferredCurrencyCodes:nt,selectedCurrency:F,onSelectCurrency:h=>{W(h.toLowerCase());}}),jsxs(View,{style:d.amountContainer,children:[jsxs(View,{style:d.amountInputRow,children:[jsx(Text,{style:[d.currencySymbol,{color:a.foreground}],children:it}),jsx(TextInput,{style:[d.amountInput,{color:a.foreground}],value:T,onChangeText:Ft,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:a.foregroundMuted})]}),J?jsx(ActivityIndicator,{size:"small",color:a.primary}):jsxs(Text,{style:[d.usdcPreview,{color:a.foregroundMuted}],children:["\u2248 ",wo()," ",s]})]}),jsx(View,{style:d.quickAmounts,children:Vn.map(h=>jsx(TouchableOpacity,{onPress:()=>_e(h),style:[d.quickAmountButton,{backgroundColor:a.card},parseFloat(T)===h&&{borderColor:a.primary,borderWidth:2}],children:jsxs(Text,{style:[d.quickAmountText,{color:a.foreground}],children:[it,h.toLocaleString()]})},h))}),jsxs(View,{style:d.providerSection,children:[jsxs(View,{style:d.providerHeader,children:[jsx(Text,{style:[d.providerLabel,{color:a.foreground}],children:"Provider"}),x.length>0&&!J&&jsxs(Text,{style:[d.refreshText,{color:a.foregroundMuted}],children:["Refreshing in ",Le,"s"]})]}),jsx(TouchableOpacity,{onPress:()=>Se(true),disabled:J||x.length===0,style:[d.providerButton,{backgroundColor:a.card},(J||x.length===0)&&d.disabled],children:J?jsxs(View,{style:d.providerLoading,children:[jsx(ActivityIndicator,{size:"small",color:a.foregroundMuted}),jsx(Text,{style:[d.loadingText,{color:a.foregroundMuted}],children:"Finding best rates..."})]}):B?jsxs(View,{style:d.providerContent,children:[jsxs(View,{style:d.providerInfo,children:[jsx(Text,{style:[d.autoPickedText,{color:a.foregroundMuted}],children:"Auto-picked for you"}),jsxs(View,{style:d.providerRow,children:[jsx(ue,{uri:z(B.icon_url),width:32,height:32,borderRadius:8}),jsxs(View,{children:[jsx(Text,{style:[d.providerName,{color:a.foreground}],children:B.service_provider_display_name}),jsxs(Text,{style:[d.bestPriceText,{color:a.success}],children:["Best price \u2022 ",B.destination_amount.toFixed(2)," ","USDC"]})]})]})]}),jsx(Ge,{size:20,color:a.foregroundMuted,strokeWidth:2})]}):jsx(Text,{style:[d.noProviderText,{color:a.foregroundMuted}],children:parseFloat(T)>0?"No providers available":"Enter an amount to see providers"})}),$&&jsx(Text,{style:[d.errorText,{color:a.error}],children:$})]}),jsxs(Q,{visible:mo,onClose:()=>Se(false),closeOnBackdropPress:true,showHandle:false,children:[jsx(de,{title:"Select Provider",showBack:false,onClose:()=>Se(false),badge:x.length>0?{count:x.length}:void 0}),jsx(ScrollView,{style:d.providerModalList,showsVerticalScrollIndicator:false,children:jsx(View,{style:d.quotesList,children:[...x].sort((h,u)=>u.destination_amount-h.destination_amount).map((h,u)=>{let S=B?.service_provider===h.service_provider,E=u===0;return jsxs(TouchableOpacity,{onPress:()=>{Ce(h),Se(false);},style:[d.quoteItem,{backgroundColor:a.card},S&&{borderColor:a.primary,borderWidth:2}],children:[jsxs(View,{style:d.quoteLeft,children:[jsx(ue,{uri:z(h.icon_url),width:32,height:32,borderRadius:8}),jsxs(View,{children:[jsx(Text,{style:[d.quoteName,{color:a.foreground}],children:h.service_provider_display_name}),E&&jsx(Text,{style:[d.bestPriceLabel,{color:a.success}],children:"\u2713 Best price"})]})]}),jsxs(View,{style:d.quoteRight,children:[jsxs(Text,{style:[d.quoteAmount,{color:a.foreground}],children:[h.destination_amount.toFixed(2)," USDC"]}),jsxs(Text,{style:[d.quoteSource,{color:a.foregroundMuted}],children:["Fee: ",it,h.total_fee.toFixed(2)]})]})]},h.service_provider)})})})]})]}),jsx(View,{style:[d.continueButtonContainer,{backgroundColor:a.background}],children:jsx(TouchableOpacity,{onPress:Ht,disabled:J||ne||!B||parseFloat(T)<=0,style:[d.continueButton,{backgroundColor:a.primary},(J||ne||!B)&&d.disabledButton],children:jsx(Text,{style:d.continueButtonText,children:ne?"Loading...":"Continue"})})})]}),xo()]}):zt==="onramp"&&Be?jsxs(View,{style:d.onrampContainer,children:[jsx(ue,{uri:z(Be.provider.icon_url),width:64,height:64,borderRadius:16}),jsxs(Text,{style:[d.onrampTitle,{color:a.foreground}],children:["Complete transaction with ",Be.provider.service_provider_display_name]}),jsx(Text,{style:[d.onrampSubtitle,{color:a.foregroundMuted}],children:"You can close this modal."}),jsxs(View,{style:[d.flowDiagram,{backgroundColor:a.card}],children:[jsxs(View,{style:d.flowStep,children:[jsx(Image,{source:{uri:ie(`/icons/currencies/png/${Be.sourceCurrency.toLowerCase()}.png`)},style:d.flowIconImage}),jsx(Text,{style:[d.flowLabel,{color:a.foregroundMuted}],children:"You use"}),jsx(Text,{style:[d.flowValue,{color:a.foreground}],children:Be.sourceCurrency.toUpperCase()})]}),jsx(Ge,{size:16,color:a.foregroundMuted,strokeWidth:2}),jsxs(View,{style:d.flowStep,children:[jsxs(View,{style:d.flowIconWithBadge,children:[jsx(Image,{source:{uri:ie("/icons/tokens/png/usdc.png")},style:d.flowIconImageNoBadge}),jsx(Image,{source:{uri:ie("/icons/networks/png/polygon.png")},style:[d.flowNetworkBadge,{borderColor:a.background}]})]}),jsx(Text,{style:[d.flowLabel,{color:a.foregroundMuted}],children:"You buy"}),jsx(Text,{style:[d.flowValue,{color:a.foreground}],children:"USDC"})]}),jsx(Ge,{size:16,color:a.foregroundMuted,strokeWidth:2}),jsxs(View,{style:d.flowStep,children:[jsxs(View,{style:d.flowIconWithBadge,children:[jsx(Image,{source:{uri:ie("/icons/tokens/png/usdc.png")},style:d.flowIconImageNoBadge}),jsx(Image,{source:{uri:ie("/icons/networks/png/polygon.png")},style:[d.flowNetworkBadge,{borderColor:a.background}]})]}),jsx(Text,{style:[d.flowLabel,{color:a.foregroundMuted}],children:"You receive"}),jsx(Text,{style:[d.flowValue,{color:a.foreground}],children:s})]})]}),jsx(View,{style:[d.onrampInfoBox,{backgroundColor:a.card}],children:jsx(Text,{style:[d.onrampInfoText,{color:a.foregroundMuted}],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 Pn({visible:e,onClose:t,url:o,providerName:n,colors:l}){return jsxs(Q,{visible:e,onClose:t,closeOnBackdropPress:false,showHandle:false,heightPercent:.92,noPadding:true,children:[jsxs(View,{style:tt.header,children:[jsx(TouchableOpacity,{onPress:t,style:tt.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(te,{size:20,color:l.foregroundMuted,strokeWidth:2})}),jsx(Text,{style:[tt.headerTitle,{color:l.foreground}],children:n}),jsx(View,{style:tt.headerSpacer})]}),o&&jsx(View,{style:tt.container,children:jsx(WebView,{source:{uri:o},style:tt.webView,startInLoadingState:true,renderLoading:()=>jsx(View,{style:tt.loading,children:jsx(ActivityIndicator,{size:"large",color:l.primary})})})})]})}var tt=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"}}),d=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,borderRadius: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,borderRadius:8},quickAmountText:{fontSize:14,fontWeight:"500"},providerSection:{marginBottom:24},providerHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},providerLabel:{fontSize:12,fontWeight:"500"},refreshText:{fontSize:10},providerButton:{padding:16,borderRadius:12},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},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,borderRadius:12,alignItems:"center"},disabledButton:{opacity:.5},continueButtonText:{color:"#FFFFFF",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,borderRadius: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},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,borderRadius:7,borderWidth:2},onrampInfoBox:{marginTop:16,padding:16,borderRadius:12,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 Mn(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 An(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function uo({execution:e,onPress:t}){let {colors:o}=R(),n=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let s=z(ee(e.destination_token_metadata,"png")||ie("/icons/tokens/png/usdc.png")),p=n?"Deposit Processing":"Deposit Completed",w=Mn(e.created_at||new Date().toISOString()),f=An(e.source_amount_usd);return jsxs(TouchableOpacity,{onPress:t,activeOpacity:.7,style:[Pe.container,{backgroundColor:o.card}],children:[jsxs(View,{style:Pe.iconContainer,children:[jsx(Image,{source:{uri:s},style:Pe.tokenIcon}),jsx(View,{style:[Pe.statusBadge,{backgroundColor:n?"#EAB308":"#22C55E",borderColor:o.card}],children:n?jsx(qt,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsx(te,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxs(View,{style:Pe.textContainer,children:[jsx(Text,{style:[Pe.title,{color:o.foreground}],children:p}),jsx(Text,{style:[Pe.dateTime,{color:o.foregroundMuted}],children:w})]}),jsxs(View,{style:Pe.rightContainer,children:[jsx(Text,{style:[Pe.amount,{color:o.foreground}],children:f}),jsx(Ge,{size:20,color:o.foregroundMuted,strokeWidth:2})]})]})}var Pe=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12,borderRadius:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-2,right:-2,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"}});var{height:jn}=Dimensions.get("window");function Sr(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 _r(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 Un(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var Ir=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function vr(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function On(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 fo({visible:e,onClose:t,executions:o,externalUserId:n,publishableKey:l}){let{colors:s}=R(),[p,w]=useState(o),[f,r]=useState(false),[P,b]=useState(null),[a,T]=useState(false),A=useRef(null);useEffect(()=>{if(!e||!n)return;let m=async()=>{r(true);try{let oe=[...(await kt(n,l)).data].sort((re,B)=>{let Ce=re.created_at?new Date(re.created_at).getTime():0;return (B.created_at?new Date(B.created_at).getTime():0)-Ce});w(oe);}catch(j){console.error("Failed to fetch executions:",j),w(o);}finally{r(false);}};m();let $=setInterval(m,1e4);return ()=>clearInterval($)},[e,n,l,o]),useEffect(()=>{o.length>0&&w(m=>{let $=new Set(m.map(oe=>oe.id)),j=o.filter(oe=>!$.has(oe.id));return j.length>0?[...j,...m]:m});},[o]),useEffect(()=>{e||b(null);},[e]);let F=m=>{b(m);},W=()=>{b(null),T(false);},x=()=>{b(null),t();};return jsxs(Q,{visible:e,onClose:x,closeOnBackdropPress:true,showHandle:false,heightPercent:.6,children:[jsx(de,{title:P?"Deposit Details":"Deposit Tracker",onClose:x,showClose:!P,showBack:!!P,onBack:W}),P?(()=>{if(!P)return null;let m=P,$=m.status==="pending"||m.status==="waiting"||m.status==="delayed",j=m.status==="succeeded",oe=z(ee(m.destination_token_metadata,"png")||ie("/icons/tokens/png/usdc.png")),re=m.provider_metadata?.details,B=re?.currencyIn,Ce=re?.currencyOut;B?.currency?.symbol||"USDC";Ce?.currency?.symbol||"USDC";let ne=_r(m.source_amount_base_unit,m.source_token_metadata?.decimals),ke=_r(m.destination_amount_base_unit,m.destination_token_metadata?.decimals),Le=Un(m.source_amount_usd),se=Sr(m.source_chain_type,m.source_chain_id),rt=Sr(m.destination_chain_type,m.destination_chain_id),Ne=()=>{m.explorer_url&&Linking.openURL(m.explorer_url);},nt=()=>{m.destination_explorer_url&&Linking.openURL(m.destination_explorer_url);};return jsxs(ScrollView,{ref:A,style:y.scrollContainer,contentContainerStyle:y.detailsContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:y.iconSection,children:[jsxs(View,{style:y.iconWrapper,children:[jsx(Image,{source:{uri:oe},style:y.tokenIcon}),jsx(View,{style:[y.statusBadge,{backgroundColor:$?"#EAB308":"#22C55E",borderColor:s.background}],children:$?jsx(ce,{size:14,color:"#FFFFFF",strokeWidth:2}):jsx(te,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxs(View,{style:y.statusRow,children:[jsx(View,{style:[y.statusDot,{backgroundColor:$?"#EAB308":"#22C55E"}]}),jsx(Text,{style:[y.statusText,{color:s.foreground}],children:$?"Processing":"Completed"})]}),jsx(Text,{style:[y.dateText,{color:s.foregroundMuted}],children:On(m.created_at||new Date().toISOString())})]}),jsxs(View,{style:[y.card,{backgroundColor:s.card}],children:[jsxs(View,{style:y.cardRow,children:[jsx(Text,{style:[y.cardLabel,{color:s.foregroundMuted}],children:"Amount Sent"}),jsxs(Text,{style:[y.cardValue,{color:s.foreground}],children:[ne," ",vr(m.source_currency)]})]}),jsx(View,{style:[y.cardDivider,{backgroundColor:s.border}]}),jsxs(View,{style:y.cardRow,children:[jsx(Text,{style:[y.cardLabel,{color:s.foregroundMuted}],children:"Amount Received"}),jsxs(Text,{style:[y.cardValue,{color:s.foreground}],children:[ke," ",vr(m.destination_currency)]})]}),jsx(View,{style:[y.cardDivider,{backgroundColor:s.border}]}),jsxs(View,{style:y.cardRow,children:[jsx(Text,{style:[y.cardLabel,{color:s.foregroundMuted}],children:"USD Value"}),jsx(Text,{style:[y.cardValue,{color:s.foreground}],children:Le})]}),jsx(View,{style:[y.cardDivider,{backgroundColor:s.border}]}),jsxs(View,{style:y.cardRow,children:[jsx(Text,{style:[y.cardLabel,{color:s.foregroundMuted}],children:"Source Network"}),jsx(Text,{style:[y.cardValue,{color:s.foreground}],children:se})]}),jsx(View,{style:[y.cardDivider,{backgroundColor:s.border}]}),jsxs(View,{style:y.cardRow,children:[jsx(Text,{style:[y.cardLabel,{color:s.foregroundMuted}],children:"Destination Network"}),jsx(Text,{style:[y.cardValue,{color:s.foreground}],children:rt})]})]}),jsxs(TouchableOpacity,{onPress:()=>{let Te=!a;T(Te),Te?setTimeout(()=>{A.current?.scrollToEnd({animated:true});},100):A.current?.scrollTo({y:0,animated:true});},style:y.toggleButton,activeOpacity:.7,children:[jsx(Text,{style:[y.toggleText,{color:s.foregroundMuted}],children:a?"See less":"See more details"}),a?jsx(lt,{size:14,color:s.foregroundMuted,strokeWidth:2}):jsx(ce,{size:14,color:s.foregroundMuted,strokeWidth:2})]}),a&&jsxs(View,{style:[y.card,{backgroundColor:s.card}],children:[m.explorer_url&&jsxs(View,{children:[jsxs(TouchableOpacity,{onPress:Ne,style:y.cardRow,children:[jsx(Text,{style:[y.cardLabel,{color:s.foregroundMuted}],children:"Deposit Tx"}),jsxs(View,{style:y.cardRowRight,children:[jsx(Text,{style:[y.cardValue,{color:s.foreground}],children:Ir(m.transaction_hash)}),jsx(Ye,{size:14,color:s.foregroundMuted,strokeWidth:2})]})]}),jsx(View,{style:[y.cardDivider,{backgroundColor:s.border}]})]}),m.destination_explorer_url&&j&&jsxs(TouchableOpacity,{onPress:nt,style:y.cardRow,children:[jsx(Text,{style:[y.cardLabel,{color:s.foregroundMuted}],children:"Completion Tx"}),jsxs(View,{style:y.cardRowRight,children:[jsx(Text,{style:[y.cardValue,{color:s.foreground}],children:Ir(m.destination_transaction_hashes[0])}),jsx(Ye,{size:14,color:s.foregroundMuted,strokeWidth:2})]})]})]})]})})():jsx(ScrollView,{style:y.scrollContainer,contentContainerStyle:y.scrollContent,showsVerticalScrollIndicator:false,children:p.length===0?jsxs(View,{style:y.emptyContainer,children:[jsx(Text,{style:[y.emptyText,{color:s.foregroundMuted}],children:"No deposits yet"}),jsx(Text,{style:[y.emptySubtext,{color:s.foregroundMuted}],children:"Your deposit history will appear here"})]}):jsx(View,{style:y.executionsList,children:p.map(m=>jsx(uo,{execution:m,onPress:()=>F(m)},m.id))})})]})}var y=StyleSheet.create({scrollContainer:{maxHeight:jn*.7,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 Rt(e,t=true){let[o,n]=useState(null),[l,s]=useState(null),[p,w]=useState(false),[f,r]=useState(false),[P,b]=useState(null),[a,T]=useState(null);useEffect(()=>{!t||o||(w(true),_o().then(x=>{n(x),b(null);}).catch(x=>{b(x instanceof Error?x:new Error(String(x)));}).finally(()=>{w(false);}));},[t,o]),useEffect(()=>{!t||!e||l||(r(true),bt(e).then(x=>{s(x),T(null);}).catch(x=>{T(x instanceof Error?x:new Error(String(x)));}).finally(()=>{r(false);}));},[t,e,l]);let A=p||f,F=P||a||null,W=null;if(o&&l){let x=l.blocked_country_codes||[],D=o.alpha2.toUpperCase();W=!x.some(J=>J.toUpperCase()===D);}return {isAllowed:W,alpha2:o?.alpha2?.toLowerCase()??null,country:o?.country??null,isLoading:A,error:F}}var ot={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"}};function Gn({visible:e,onClose:t,externalUserId:o,publishableKey:n,modalTitle:l="Deposit",destinationTokenSymbol:s,recipientAddress:p,destinationChainType:w,destinationChainId:f,destinationTokenAddress:r,hideDepositTracker:P=false,onDepositSuccess:b,onDepositError:a}){let{colors:T}=R(),[A,F]=useState([]),[W,x]=useState(false),[D,J]=useState(false),[m,$]=useState(false),[j,oe]=useState(null),[re,B]=useState("amount"),{isAllowed:Ce,isLoading:xe}=Rt(n,e);useEffect(()=>{e&&!j&&bt(n).then(oe).catch(console.error);},[e,j,n]);let Oe=()=>{t();},ne=A.filter(se=>se.status==="pending"||se.status==="waiting").length,ke=xe||e&&!j,Le=Ce===false;return jsxs(Q,{visible:e,onClose:Oe,closeOnBackdropPress:false,showHandle:false,children:[jsx(de,{title:l,showBack:false,onClose:Oe}),ke&&jsx(View,{style:Re.centeredContainer,children:jsx(ActivityIndicator,{size:"large",color:T.primary})}),!ke&&Le&&jsxs(View,{style:Re.centeredContainer,children:[jsx(View,{style:[Re.iconContainer,{backgroundColor:T.cardHover}],children:jsx($t,{size:32,color:T.foreground,strokeWidth:1.5})}),jsx(Text,{style:[Re.blockedTitle,{color:T.foreground}],children:"No Tokens Available"}),jsx(Text,{style:[Re.blockedDescription,{color:T.foreground,opacity:.7}],children:"There are no supported tokens available from your current location."})]}),!ke&&!Le&&jsxs(View,{style:Re.optionsContainer,children:[jsx(St,{onPress:()=>J(true),title:ot.transferCrypto.title,subtitle:ot.transferCrypto.subtitle,featuredTokens:j?.transfer_crypto?.networks}),jsx(It,{onPress:()=>$(true),title:ot.depositWithCard.title,subtitle:ot.depositWithCard.subtitle,paymentNetworks:j?.payment_networks?.networks}),!P&&jsx(vt,{onPress:()=>x(true),title:ot.depositTracker.title,subtitle:ot.depositTracker.subtitle,badge:ne>0?ne:void 0})]}),jsx(fo,{visible:W,onClose:()=>x(false),executions:A,externalUserId:o,publishableKey:n}),jsxs(Q,{visible:D,onClose:()=>J(false),closeOnBackdropPress:false,showHandle:false,heightPercent:.9,children:[jsx(de,{title:ot.transferCrypto.title,showBack:false,onClose:()=>J(false)}),jsx(ScrollView,{style:Re.transferScrollContainer,contentContainerStyle:Re.scrollContent,showsVerticalScrollIndicator:false,children:jsx(oo,{externalUserId:o,publishableKey:n,recipientAddress:p,destinationChainType:w,destinationChainId:f,destinationTokenAddress:r,onExecutionsChange:F,onDepositSuccess:b,onDepositError:a})})]}),jsxs(Q,{visible:m,onClose:()=>{$(false),B("amount");},closeOnBackdropPress:false,showHandle:false,heightPercent:.9,children:[jsx(de,{title:`Deposit ${s||"USDC"}`,showBack:re==="onramp",onBack:()=>B("amount"),onClose:()=>{$(false),B("amount");}}),jsx(View,{style:Re.buyWithCardContainer,children:jsx(ao,{externalUserId:o,publishableKey:n,destinationTokenSymbol:s,recipientAddress:p,destinationChainType:w,destinationChainId:f,destinationTokenAddress:r,onDepositSuccess:b,onDepositError:a,view:re,onViewChange:se=>B(se)})})]})]})}function go({theme:e="auto",...t}){return jsx(wt,{mode:e,children:jsx(Gn,{...t})})}var Re=StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{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",borderRadius:12,gap:8},text:{fontWeight:"600",textAlign:"center"},fullWidth:{width:"100%"},disabled:{opacity:.5}});StyleSheet.create({icon:{backgroundColor:"transparent"}});var ni=()=>new QueryClient({defaultOptions:{queries:{staleTime:6e4,retry:1}}}),Rr=createContext(null);function ii({children:e,publishableKey:t,config:o}){let[n]=useState(()=>ni()),[l,s]=useState(false),[p,w]=useState(null),f=useColorScheme(),r=useRef(false);r.current||(Ot({publishableKey:t}),r.current=true);let P=useMemo(()=>{let D=o?.appearance||"dark";return D==="auto"?f==="dark"?"dark":"light":D},[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.'),Ot({publishableKey:t});},[t]);let b=useRef(null),a=useRef(null),T=useCallback(D=>{console.log("[UnifoldProvider] beginDeposit called with:",D),a.current&&(clearTimeout(a.current),a.current=null),b.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),b.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),b.current=null);let J=new Promise((m,$)=>{b.current={resolve:m,reject:$};});return w(D),s(true),J},[]),A=useCallback(()=>{b.current&&(b.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),b.current=null),s(false),a.current=setTimeout(()=>{w(null),a.current=null;},200);},[]),F=useCallback(D=>{console.log("[UnifoldProvider] Deposit success:",D),p?.onSuccess&&p.onSuccess(D),b.current&&(b.current.resolve(D),b.current=null);},[p]),W=useCallback(D=>{console.error("[UnifoldProvider] Deposit error:",D),p?.onError&&p.onError(D),b.current&&(b.current.reject(D),b.current=null);},[p]),x=useMemo(()=>({publishableKey:t,beginDeposit:T,closeDeposit:A}),[t,T,A]);return jsx(QueryClientProvider,{client:n,children:jsx(Rr.Provider,{value:x,children:jsxs(wt,{mode:P,children:[e,p&&jsx(go,{visible:l,onClose:A,externalUserId:p.externalUserId,publishableKey:t,modalTitle:o?.modalTitle,destinationTokenSymbol:p.destinationTokenSymbol,recipientAddress:p.recipientAddress,destinationChainId:p.destinationChainId,destinationTokenAddress:p.destinationTokenAddress,hideDepositTracker:o?.hideDepositTracker,onDepositSuccess:F,onDepositError:W,theme:P})]})})})}function si(){let e=useContext(Rr);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
2
- export{ii as UnifoldProvider,Yo as setDevApiUrl,Rt as useAllowedCountry,si as useUnifold};
1
+ import {createContext,useState,useEffect,useRef,useMemo,useCallback,useContext}from'react';import {Dimensions,StyleSheet,Platform,useColorScheme,View,ActivityIndicator,Text,ScrollView,Animated,Modal,TouchableWithoutFeedback,TouchableOpacity,Image,Linking,TextInput,Clipboard,Easing}from'react-native';import {QueryClientProvider,QueryClient}from'@tanstack/react-query';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import ke,{Path,Line,Polyline,SvgUri,Rect,Circle,Defs,LinearGradient,Stop}from'react-native-svg';import qn from'react-native-qrcode-svg';import {WebView}from'react-native-webview';import Sr from'@react-native-async-storage/async-storage';var tr={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)"}},or=tr;function xo(e,t,o){let i=o?t?.[o]:void 0,r=(a,d,l)=>{let c=i?.[a]?.[d];if(c!==void 0)return c;let h=t?.[a]?.[d];return h!==void 0?h:l};return {header:{titleColor:r("header","titleColor",e.foreground),buttonColor:r("header","buttonColor",e.foreground)},card:{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)},input:{backgroundColor:r("input","backgroundColor",e.card),textColor:r("input","textColor",e.foreground),placeholderColor:r("input","placeholderColor",e.foregroundMuted),borderColor:r("input","borderColor",e.border)},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)},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)},list:{titleSectionColor:r("list","titleSectionColor",e.foregroundMuted)}}}function rr(e,t,o){let r={...tr[e]};return o&&(r.primary=o),t&&(r={...r,...t}),r}var Vr=createContext(null);function To({children:e,mode:t="auto",accentColor:o,theme:i,fontFamily:r,fonts:a,components:d}){let l=useColorScheme(),c=useMemo(()=>t==="auto"?l==="dark"?"dark":"light":t,[t,l]),h=useMemo(()=>{let p=i?.[c];return rr(c,p,o)},[c,i,o]),x=useMemo(()=>xo(h,d,c),[h,d,c]),L=useMemo(()=>a?{regular:a.regular||r,medium:a.medium||r,semibold:a.semibold||r,bold:a.bold||r}:r?{regular:r,medium:r,semibold:r,bold:r}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[r,a]),D=useMemo(()=>({mode:c,colors:h,fonts:L,components:x,isDark:c==="dark"}),[c,h,L,x]);return jsx(Vr.Provider,{value:D,children:e})}function A(){let e=useContext(Vr);if(!e){let t=or.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:xo(t,void 0,"dark"),isDark:true}}return e}var vn="https://api.unifold.io",Io,pt="pk_test_123",So={};function ze(){return typeof __DEV__<"u"&&__DEV__&&Io?Io:vn}function _o(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.'),pt=e.publishableKey;}e.baseUrl&&typeof __DEV__<"u"&&__DEV__&&(Io=e.baseUrl),e.defaultConfig&&(So=e.defaultConfig);}function Fr(e){typeof __DEV__<"u"&&__DEV__?Io=e:console.warn("[Unifold] setDevApiUrl() is only available in development mode");}function It(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 De(e){let t=e.startsWith("/")?e:`/${e}`;return `${ze()}/api/public${t}`}function q(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,ze()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${ze()}${e}`:`${ze()}/api/public${e}`:""}async function Pr(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let o={external_user_id:e.external_user_id,destination_chain_type:e?.destination_chain_type||"ethereum",destination_chain_id:e?.destination_chain_id||So.destinationChainId||"8453",destination_token_address:e?.destination_token_address||So.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:e?.recipient_address||So.recipientAddress||"0x309a4154a2CD4153Da886E780890C9cb5161553C",client_metadata:e?.client_metadata||{}},i=t||pt;It(i);let r=await fetch(`${ze()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":i,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!r.ok)throw new Error(`Failed to create deposit address: ${r.statusText}`);return r.json()}async function _t(e,t){return Pr(e?{...e,external_user_id:e.external_user_id}:void 0,t)}function vt(e,t){return e.find(o=>o.chain_type===t)}async function Dt(e,t){let o=t||pt;It(o);let i=await fetch(`${ze()}/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(!i.ok)throw new Error(`Failed to query executions: ${i.statusText}`);return i.json()}function ne(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(i=>i.format===t);return o?o.url:e.icon_url}async function so(e){let t=e||pt;It(t);let o=await fetch(`${ze()}/v1/public/tokens/supported_deposit_tokens`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch supported deposit tokens: ${o.statusText}`);return o.json()}function vo(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||pt;It(o);let i=await fetch(`${ze()}/v1/public/onramps/meld/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!i.ok)throw new Error(`Failed to fetch Meld quotes: ${i.statusText}`);return i.json()}async function ir(e,t){let o=t||pt;It(o);let i=await fetch(`${ze()}/v1/public/onramps/meld/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!i.ok)throw new Error(`Failed to create Meld session: ${i.statusText}`);return i.json()}async function sr(e){let t=e||pt;It(t);let o=await fetch(`${ze()}/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()}async function ao(e){let t=e||pt;It(t);let o=await fetch(`${ze()}/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 ar(){let e=await fetch(`${ze()}/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()}var{height:Nt}=Dimensions.get("window");function ae({visible:e,onClose:t,children:o,closeOnBackdropPress:i=true,showHandle:r=true,heightPercent:a,noPadding:d=false}){let{colors:l}=A(),c=useRef(new Animated.Value(Nt)).current,h=useRef(new Animated.Value(0)).current;useEffect(()=>{e?(c.setValue(Nt),h.setValue(0),Animated.parallel([Animated.spring(c,{toValue:0,useNativeDriver:true,tension:65,friction:11}),Animated.timing(h,{toValue:.5,duration:200,useNativeDriver:true})]).start()):Animated.parallel([Animated.spring(c,{toValue:Nt,useNativeDriver:true,tension:65,friction:11}),Animated.timing(h,{toValue:0,duration:200,useNativeDriver:true})]).start();},[e,c,h]);let x=()=>{i&&t();};return jsx(Modal,{visible:e,transparent:true,animationType:"none",statusBarTranslucent:true,onRequestClose:t,children:jsxs(View,{style:Lt.container,children:[jsx(TouchableWithoutFeedback,{onPress:x,children:jsx(Animated.View,{style:[Lt.backdrop,{backgroundColor:"#000000",opacity:h}]})}),jsxs(Animated.View,{style:[Lt.sheet,{backgroundColor:l.background,borderTopLeftRadius:24,borderTopRightRadius:24,transform:[{translateY:c}],...a&&{height:Nt*a,maxHeight:Nt*a},...d&&{paddingBottom:0}}],children:[r&&jsx(View,{style:Lt.handleContainer,children:jsx(View,{style:[Lt.handle,{backgroundColor:l.border}]})}),jsx(View,{style:[Lt.content,a&&Lt.contentFlex],children:o})]})]})})}var Lt=StyleSheet.create({container:{flex:1,justifyContent:"flex-end"},backdrop:{...StyleSheet.absoluteFillObject},sheet:{maxHeight:Nt*.9,paddingBottom:Platform.OS==="ios"?34:24,shadowColor:"#000",shadowOffset:{width:0,height:-4},shadowOpacity:.1,shadowRadius:12,elevation:16},handleContainer:{alignItems:"center",paddingTop:12,paddingBottom:4},handle:{width:36,height:4,borderRadius:2},content:{},contentFlex:{flex:1}});function lr({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(ke,{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 cr({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ke,{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 Rt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ke,{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 dr({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ke,{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 Ve({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ke,{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 rt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(ke,{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 Fe({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(ke,{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 lo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ke,{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(ke,{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 Vt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ke,{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 qt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ke,{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 Lo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ke,{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 gt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(ke,{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 Mr({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ke,{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 $t({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ke,{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 Qt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ke,{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 Ro({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ke,{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 Me({title:e,showBack:t=false,showClose:o=true,onBack:i,onClose:r,badge:a}){let{colors:d,fonts:l,components:c}=A();return jsxs(View,{style:Ge.header,children:[jsx(View,{style:Ge.leftContainer,children:t&&i?jsx(TouchableOpacity,{onPress:i,style:[Ge.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(dr,{size:20,color:c.header.buttonColor,strokeWidth:2})}):jsx(View,{style:Ge.spacer})}),jsxs(View,{style:Ge.titleContainer,children:[jsx(Text,{style:[Ge.title,{color:c.header.titleColor,fontFamily:l.medium}],children:e}),a&&a.count>0&&jsx(View,{style:[Ge.titleBadge,{backgroundColor:d.card}],children:jsx(Text,{style:[Ge.titleBadgeText,{color:d.foregroundMuted,fontFamily:l.regular}],children:a.count})})]}),jsx(View,{style:Ge.rightContainer,children:o?jsx(TouchableOpacity,{onPress:r,style:[Ge.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Ve,{size:20,color:c.header.buttonColor,strokeWidth:2})}):jsx(View,{style:Ge.spacer})})]})}var Ge=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,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"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function ft({uri:e,width:t,height:o,borderRadius:i=0,borderWidth:r=0,borderColor:a="transparent",backgroundColor:d="transparent",style:l}){let{colors:c}=A(),[h,x]=useState(false),L=e?.toLowerCase().endsWith(".svg");useEffect(()=>{x(false);},[e]);let D=c.card;if(!e)return jsx(View,{style:[{width:t,height:o,borderRadius:i,backgroundColor:D},l]});let p={width:t,height:o,borderRadius:i,borderWidth:r,borderColor:a,backgroundColor:d,overflow:"hidden",alignItems:"center",justifyContent:"center",...l},s=t-r*2,n=o-r*2;return h?jsx(View,{style:[p,{backgroundColor:d||D}]}):L?jsx(View,{style:p,children:jsx(SvgUri,{uri:e,width:s,height:n,onError:k=>{x(true);}})}):jsx(View,{style:p,children:jsx(Image,{source:{uri:e},style:{width:s,height:n},resizeMode:"contain",onError:k=>{x(true);}})})}function co({onPress:e,title:t,subtitle:o,featuredTokens:i}){let{colors:r,fonts:a,components:d}=A(),l=i?[...i].sort((c,h)=>c.position-h.position):[];return jsxs(TouchableOpacity,{onPress:e,activeOpacity:.7,style:[nt.container,{backgroundColor:d.card.backgroundColor}],children:[jsxs(View,{style:nt.leftContent,children:[jsx(View,{style:nt.iconContainer,children:jsx(lr,{size:20,color:d.card.iconColor,strokeWidth:2})}),jsxs(View,{style:nt.textContainer,children:[jsx(Text,{style:[nt.title,{color:d.card.titleColor,fontFamily:a.regular}],children:t}),jsx(Text,{style:[nt.subtitle,{color:d.card.subtitleColor,fontFamily:a.regular}],children:o})]})]}),jsx(View,{style:nt.rightContent,children:jsx(View,{style:nt.networkIcons,children:l.map((c,h)=>{let x=c.icon_urls.find(L=>L.format==="png")?.url||c.icon_urls.find(L=>L.format==="svg")?.url;return jsx(View,{style:[nt.networkIconWrapper,{marginLeft:h===0?0:-6,zIndex:l.length-h}],children:jsx(ft,{uri:q(x),width:20,height:20,borderRadius:10,borderWidth:2,borderColor:d.card.backgroundColor})},c.name)})})})]})}var nt=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,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 po({onPress:e,title:t,subtitle:o,paymentNetworks:i}){let{fonts:r,components:a}=A();return jsxs(TouchableOpacity,{onPress:e,activeOpacity:.7,style:[ht.container,{backgroundColor:a.card.backgroundColor}],children:[jsxs(View,{style:ht.leftContent,children:[jsx(View,{style:ht.iconContainer,children:jsx(cr,{size:20,color:a.card.iconColor,strokeWidth:2})}),jsxs(View,{style:ht.textContainer,children:[jsx(Text,{style:[ht.title,{color:a.card.titleColor,fontFamily:r.regular}],children:t}),jsx(Text,{style:[ht.subtitle,{color:a.card.subtitleColor,fontFamily:r.regular}],children:o})]})]}),jsx(View,{style:ht.rightContent,children:jsx(View,{style:ht.paymentIcons,children:i?.map(d=>{let l=d.icon_urls.find(c=>c.format==="png")?.url||d.icon_urls.find(c=>c.format==="svg")?.url;return jsx(ft,{uri:q(l),width:32,height:20,borderRadius:4},d.name)})})})]})}var ht=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,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 go({onPress:e,title:t,subtitle:o,badge:i}){let{fonts:r,components:a}=A();return jsx(TouchableOpacity,{onPress:e,activeOpacity:.7,style:[yt.container,{backgroundColor:a.card.backgroundColor}],children:jsxs(View,{style:yt.leftContent,children:[jsxs(View,{style:yt.iconContainer,children:[jsx(Rt,{size:20,color:a.card.iconColor,strokeWidth:2}),i!==void 0&&i>0&&jsx(View,{style:[yt.badge,{backgroundColor:a.card.iconColor}],children:jsx(Text,{style:[yt.badgeText,{fontFamily:r.semibold}],children:i>99?"99+":i})})]}),jsxs(View,{style:yt.textContainer,children:[jsx(Text,{style:[yt.title,{color:a.card.titleColor,fontFamily:r.regular}],children:t}),jsx(Text,{style:[yt.subtitle,{color:a.card.subtitleColor,fontFamily:r.regular}],children:o})]})]})})}var yt=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,alignItems:"center",justifyContent:"center",position:"relative"},badge:{position:"absolute",top:-4,right:-4,minWidth:18,height:18,borderRadius:9,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 Jt({value:e,size:t=180,logoUri:o,logoSize:i=40,logoBackgroundColor:r}){let{colors:a,isDark:d}=A(),l=d?"#1a1a1a":"#ffffff",c=d?"#ffffff":"#000000",h=r||l;return jsxs(View,{style:[$r.container,{width:t,height:t}],children:[jsx(qn,{value:e||"placeholder",size:t,backgroundColor:l,color:c,ecl:"H",quietZone:4}),o&&jsx(View,{style:[$r.logoContainer,{width:i+12,height:i+12,backgroundColor:h,borderRadius:(i+12)/2}],children:jsx(ft,{uri:o,width:i,height:i,borderRadius:i/2})})]})}var $r=StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function oi({size:e,strokeWidth:t,iconSize:o,children:i}){let r=useRef(new Animated.Value(0)).current,a=(e-t)/2,d=2*Math.PI*a,l=e/2,c=(e-o)/2;useEffect(()=>{let x=Animated.loop(Animated.timing(r,{toValue:1,duration:1500,easing:Easing.linear,useNativeDriver:true}));return x.start(),()=>x.stop()},[r]);let h=r.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxs(View,{style:{width:e,height:e},children:[jsx(Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:h}]},children:jsxs(ke,{width:e,height:e,children:[jsx(Defs,{children:jsxs(LinearGradient,{id:"progressGradient",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsx(Stop,{offset:"0%",stopColor:"#F59E0B"}),jsx(Stop,{offset:"100%",stopColor:"#FBBF24"})]})}),jsx(Circle,{cx:l,cy:l,r:a,stroke:"url(#progressGradient)",strokeWidth:t,fill:"none",strokeDasharray:`${d*.75} ${d*.25}`,strokeLinecap:"round",rotation:-90,origin:`${l}, ${l}`})]})}),jsx(View,{style:{position:"absolute",top:c+1.5,left:c,width:o,height:o},children:i})]})}function Kr(e){let t=e.split("/"),o=t[t.length-1];return o&&o.length>10?`${o.slice(0,6)}...${o.slice(-3)}`:o||""}function ri(e){let o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],i=e.getDate(),r=e.getFullYear(),a=e.getHours(),d=e.getMinutes(),l=a>=12?"pm":"am";a=a%12,a=a||12;let c=d<10?`0${d}`:d;return `${o} ${i}, ${r} at ${a}:${c}${l}`}function Xt({visible:e,status:t,tokenIconUrl:o,explorerUrl:i,completionExplorerUrl:r,date:a,amountUsd:d,onClose:l}){let{colors:c,fonts:h,components:x}=A(),[L,D]=useState(false),p=t==="pending"||t==="waiting"||t==="delayed",s=t==="succeeded",n=()=>{i&&Linking.openURL(i);},k=()=>{r&&Linking.openURL(r);};return jsx(ae,{visible:e,onClose:l,closeOnBackdropPress:true,showHandle:false,children:jsxs(View,{style:le.container,children:[jsx(TouchableOpacity,{style:le.closeButton,onPress:l,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Ve,{size:20,color:x.header.buttonColor,strokeWidth:2})}),jsx(View,{style:le.iconContainer,children:p?jsx(oi,{size:80,strokeWidth:4,iconSize:68,children:o?jsx(Image,{source:{uri:q(o)},style:le.tokenIconFill}):jsx(View,{style:[le.tokenIconFill,{backgroundColor:c.cardHover}]})}):jsxs(Fragment,{children:[o?jsx(Image,{source:{uri:q(o)},style:le.tokenIconLarge}):jsx(View,{style:[le.tokenIconLarge,{backgroundColor:c.cardHover}]}),jsx(View,{style:[le.statusBadge,{backgroundColor:x.container.iconBackgroundColor}],children:jsx(we,{size:16,color:x.container.iconColor,strokeWidth:3})})]})}),jsx(Text,{style:[le.title,{color:x.container.titleColor,fontFamily:h.semibold}],children:p?"Deposit Processing":"Deposit Complete"}),d!==void 0&&jsxs(Text,{style:[le.amount,{color:x.container.titleColor,fontFamily:h.bold}],children:["$",d.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),a&&jsx(Text,{style:[le.date,{color:x.container.subtitleColor,fontFamily:h.regular}],children:ri(a)}),jsx(Text,{style:[le.subtitle,{color:x.container.subtitleColor,fontFamily:h.regular}],children:p?"This usually takes less than a minute.":"Your account has been credited successfully!"}),s&&(i||r)&&jsxs(View,{style:le.detailsSection,children:[jsx(View,{style:[le.divider,{backgroundColor:c.border}]}),jsxs(TouchableOpacity,{style:le.detailsToggle,onPress:()=>D(!L),children:[jsx(Text,{style:[le.detailsToggleText,{color:x.container.actionTitle,fontFamily:h.medium}],children:L?"See less":"See more details"}),L?jsx(gt,{size:18,color:x.container.actionColor,strokeWidth:2}):jsx(Fe,{size:18,color:x.container.actionColor,strokeWidth:2})]}),L&&jsxs(View,{style:le.txButtonsContainer,children:[i&&jsxs(TouchableOpacity,{style:[le.txButton,{backgroundColor:x.card.backgroundColor,borderColor:c.border}],onPress:n,children:[jsx(Text,{style:[le.txLabel,{color:x.card.titleColor,fontFamily:h.medium}],children:"Deposit tx"}),jsx(Text,{style:[le.txHash,{color:x.card.subtitleColor,fontFamily:h.regular}],children:Kr(i)}),jsx(Vt,{size:16,color:x.card.actionColor,strokeWidth:2})]}),r&&jsxs(TouchableOpacity,{style:[le.txButton,{backgroundColor:x.card.backgroundColor,borderColor:c.border}],onPress:k,children:[jsx(Text,{style:[le.txLabel,{color:x.card.titleColor,fontFamily:h.medium}],children:"Completion tx"}),jsx(Text,{style:[le.txHash,{color:x.card.subtitleColor,fontFamily:h.regular}],children:Kr(r)}),jsx(Vt,{size:16,color:x.card.actionColor,strokeWidth:2})]})]})]})]})})}var le=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"}});var mo=(e,t)=>`${t}:${e}`,ci=e=>{let[t,o]=e.split(":");return {chainType:t,chainId:o}};function Eo({externalUserId:e,publishableKey:t,recipientAddress:o,destinationChainType:i,destinationChainId:r,destinationTokenAddress:a,destinationTokenSymbol:d,defaultChainType:l,defaultChainId:c,defaultTokenAddress:h,onExecutionsChange:x,onDepositSuccess:L,onDepositError:D}){let{colors:p,fonts:s,components:n}=A(),k=l&&c?`${l}:${c}`:"solana:mainnet",[F,z]=useState("USDC"),[b,S]=useState(k),[O,f]=useState([]),[se,X]=useState(true),[Z,fe]=useState([]),[P,xe]=useState(true),[he,Pe]=useState(false),[Ue,Je]=useState(false),[Le,Be]=useState(false),[je,Se]=useState(false),[ye,dt]=useState([]),[kt,oo]=useState(new Map),[Ie]=useState(()=>new Date),[wt,Ne]=useState(null),[Mt,bt]=useState(false),[te,ro]=useState(null),[Ot,qe]=useState(false),ot=new Map;Z.forEach(C=>{C.chains.forEach(g=>{let I=`${g.chain_type}:${g.chain_id}`;ot.has(I)||ot.set(I,g);});});let Ht=Array.from(ot.values()),ut=ci(b),Ut=Ht.find(C=>C.chain_type===ut.chainType&&C.chain_id===ut.chainId)?.chain_type||"ethereum",_e=vt(O,Ut)?.address||"",Tt=useRef(false);useEffect(()=>{async function C(){try{xe(!0),Ne(null);let g=await so(t);if(fe(g.data),g.data.length>0&&!Tt.current){Tt.current=!0;let I,R;if(l&&c)if(h)for(let H of g.data){let re=H.chains.find(Re=>Re.chain_type===l&&Re.chain_id===c&&Re.token_address.toLowerCase()===h.toLowerCase());if(re){I=H,R=re;break}}else for(let H of g.data){let re=H.chains.find(Re=>Re.chain_type===l&&Re.chain_id===c);if(re){I=H,R=re;break}}if(!I&&a)for(let H of g.data){let re=H.chains.find(Re=>Re.token_address.toLowerCase()===a.toLowerCase());if(re){I=H,R=re;break}}I||(I=g.data.find(H=>H.symbol==="USDC"),I&&I.chains.length>0&&(R=I.chains[0])),I||(I=g.data.find(H=>H.symbol==="USDT"),I&&I.chains.length>0&&(R=I.chains[0])),I||(I=g.data[0],I.chains.length>0&&(R=I.chains[0])),I&&z(I.symbol),R&&S(mo(R.chain_id,R.chain_type));}}catch(g){console.error("Error fetching supported tokens:",g),Ne("Failed to load supported tokens"),D?.({message:"Failed to load supported tokens",error:g});}finally{xe(false);}}C();},[t,D,l,c,h,a]),useEffect(()=>{async function C(){try{X(!0),Ne(null);let g=await _t({external_user_id:e,recipient_address:o,destination_chain_type:i,destination_chain_id:r,destination_token_address:a},t);f(g.data);}catch(g){console.error("Error fetching wallets:",g),Ne("Failed to load wallets"),D?.({message:"Failed to load wallets",error:g});}finally{X(false);}}C();},[e,o,i,r,a,t,D]),useEffect(()=>{if(!e||!Ie)return;let C=setInterval(async()=>{try{let g=await Dt(e,t),I=null;for(let R of g.data){let H=R.created_at?new Date(R.created_at):null;if(!H||H<=Ie)continue;let re=kt.get(R.id);if(!re){I=R;break}if(["pending","waiting","delayed"].includes(re)&&R.status==="succeeded"){I=R;break}}if(I){let R=I;dt(H=>{let re=H.findIndex(Re=>Re.id===R.id);if(re>=0){let Re=[...H];return Re[re]=R,Re}else return [...H,R]}),oo(H=>{let re=new Map(H);return re.set(R.id,R.status),re}),ro(R),bt(!0),R.status==="succeeded"&&L?.({message:"Deposit completed successfully",executionId:R.id}),x?.([...ye,R]);}}catch(g){console.error("Error polling executions:",g),D?.({message:"Failed to check deposit status",error:g});}},5e3);return ()=>clearInterval(C)},[e,t,Ie,kt,ye,x,L,D]),useEffect(()=>{if(!Z.length)return;let C=Z.find(I=>I.symbol===F);if(!C||C.chains.length===0)return;if(!C.chains.some(I=>mo(I.chain_id,I.chain_type)===b)){let I=C.chains[0];S(mo(I.chain_id,I.chain_type));}},[F,Z,b]);let We=Z.find(C=>C.symbol===F),St=We?.chains||[],Ce=St.find(C=>mo(C.chain_id,C.chain_type)===b),no=async()=>{if(_e)try{Clipboard.setString(_e),Pe(!0),setTimeout(()=>Pe(!1),2e3);}catch(C){console.error("Failed to copy:",C);}},_=Ce?.estimated_price_impact_percent??0,G=Ce?.max_slippage_percent??.25,ve=Ce?.minimum_deposit_amount_usd??3;if(P)return jsxs(View,{style:u.loadingContainer,children:[jsx(ActivityIndicator,{size:"large",color:p.primary}),jsx(Text,{style:[u.loadingText,{color:p.foregroundMuted,fontFamily:s.regular}],children:"Loading currencies..."})]});if(wt&&Z.length===0)return jsxs(View,{style:u.errorContainer,children:[jsx(Text,{style:[u.errorText,{color:p.error,fontFamily:s.regular}],children:wt}),jsx(Text,{style:[u.errorHint,{color:p.foregroundMuted,fontFamily:s.regular}],children:"Please check your network connection and try again."})]});let N=()=>jsxs(ae,{visible:Le,onClose:()=>Be(false),closeOnBackdropPress:true,showHandle:false,children:[jsxs(View,{style:[u.sheetHeader,{borderBottomColor:p.border}],children:[jsx(View,{style:u.sheetHeaderSpacer}),jsx(Text,{style:[u.sheetTitle,{color:n.header.titleColor,fontFamily:s.medium}],children:"Select Token"}),jsx(TouchableOpacity,{onPress:()=>Be(false),style:u.sheetCloseButton,children:jsx(Ve,{size:20,color:n.header.buttonColor,strokeWidth:2})})]}),jsx(ScrollView,{style:u.sheetList,showsVerticalScrollIndicator:false,children:Z.map(C=>jsxs(TouchableOpacity,{onPress:()=>{z(C.symbol),Be(false);},style:[u.sheetItem,{backgroundColor:F===C.symbol?n.card.backgroundColor:"transparent"}],children:[jsx(Image,{source:{uri:q(ne(C,"png"))},style:u.sheetItemIcon}),jsxs(View,{style:u.sheetItemText,children:[jsx(Text,{style:[u.sheetItemTitle,{color:n.card.titleColor,fontFamily:s.medium}],children:C.symbol}),jsxs(Text,{style:[u.sheetItemSubtitle,{color:n.card.subtitleColor,fontFamily:s.regular}],children:[C.chains.length," network",C.chains.length!==1?"s":""," available"]})]}),F===C.symbol&&jsx(we,{size:20,color:p.primary,strokeWidth:2})]},C.symbol))})]}),oe=()=>jsxs(ae,{visible:je,onClose:()=>Se(false),closeOnBackdropPress:true,showHandle:false,children:[jsxs(View,{style:[u.sheetHeader,{borderBottomColor:p.border}],children:[jsx(View,{style:u.sheetHeaderSpacer}),jsx(Text,{style:[u.sheetTitle,{color:n.header.titleColor,fontFamily:s.medium}],children:"Select Network"}),jsx(TouchableOpacity,{onPress:()=>Se(false),style:u.sheetCloseButton,children:jsx(Ve,{size:20,color:n.header.buttonColor,strokeWidth:2})})]}),jsx(ScrollView,{style:u.sheetList,showsVerticalScrollIndicator:false,children:St.map(C=>{let g=mo(C.chain_id,C.chain_type),I=b===g;return jsxs(TouchableOpacity,{onPress:()=>{S(g),Se(false);},style:[u.sheetItem,{backgroundColor:I?n.card.backgroundColor:"transparent"}],children:[jsx(Image,{source:{uri:q(ne(C,"png"))},style:u.sheetItemIcon}),jsxs(View,{style:u.sheetItemText,children:[jsx(Text,{style:[u.sheetItemTitle,{color:n.card.titleColor,fontFamily:s.medium}],children:C.chain_name}),jsxs(Text,{style:[u.sheetItemSubtitle,{color:n.card.subtitleColor,fontFamily:s.regular}],children:["Min deposit: $",C.minimum_deposit_amount_usd]})]}),I&&jsx(we,{size:20,color:p.primary,strokeWidth:2})]},g)})})]});return jsxs(View,{style:u.container,children:[jsxs(View,{style:u.selectorSection,children:[jsx(Text,{style:[u.selectorLabel,{color:n.card.labelColor,fontFamily:s.regular}],children:"Token"}),jsxs(TouchableOpacity,{onPress:()=>Be(true),style:[u.selector,{backgroundColor:n.card.backgroundColor}],children:[We&&jsx(Image,{source:{uri:q(ne(We,"png"))},style:u.selectorIcon}),jsx(Text,{style:[u.selectorText,{color:n.card.titleColor,fontFamily:s.medium}],children:F}),jsx(Fe,{size:16,color:n.card.actionColor,strokeWidth:2})]})]}),jsxs(View,{style:u.selectorSection,children:[jsxs(Text,{style:[u.selectorLabel,{color:n.card.labelColor,fontFamily:s.regular}],children:["Network"," ",jsxs(Text,{style:[u.minDeposit,{fontFamily:s.regular}],children:["($",ve," min)"]})]}),jsxs(TouchableOpacity,{onPress:()=>Se(true),style:[u.selector,{backgroundColor:n.card.backgroundColor}],children:[Ce&&jsx(Image,{source:{uri:q(ne(Ce,"png"))},style:u.selectorIcon}),jsx(Text,{style:[u.selectorText,{color:n.card.titleColor,fontFamily:s.medium}],numberOfLines:1,children:Ce?.chain_name||"Select network"}),jsx(Fe,{size:16,color:n.card.actionColor,strokeWidth:2})]})]}),jsx(View,{style:u.qrContainer,children:jsx(View,{style:[u.qrWrapper,{backgroundColor:p.background,borderColor:p.border}],children:se?jsxs(View,{style:u.qrLoading,children:[jsx(ActivityIndicator,{size:"small",color:p.primary}),jsx(Text,{style:[u.loadingText,{color:p.foregroundMuted,fontFamily:s.regular}],children:"Loading..."})]}):_e?jsx(Jt,{value:_e,size:160,logoUri:q(ne(Ce,"png")||De("/icons/networks/png/ethereum.png")),logoSize:40}):jsx(View,{style:u.qrLoading,children:jsx(Text,{style:[u.errorText,{color:p.error,fontFamily:s.regular}],children:"No address available"})})})}),jsxs(View,{style:u.addressSection,children:[jsxs(View,{style:u.addressHeader,children:[jsx(Text,{style:[u.addressLabel,{color:n.card.labelColor,fontFamily:s.medium}],children:"Deposit Address"}),he&&jsxs(View,{style:u.copiedIndicator,children:[jsx(we,{size:14,color:p.success,strokeWidth:2}),jsx(Text,{style:[u.copiedText,{color:p.success,fontFamily:s.regular}],children:"Copied"})]})]}),jsxs(TouchableOpacity,{onPress:no,disabled:!_e||se,activeOpacity:.7,style:[u.addressBox,{backgroundColor:n.card.backgroundColor}],children:[jsx(Text,{style:[u.addressText,{color:n.card.titleColor,fontFamily:s.regular}],numberOfLines:2,children:se?"Loading...":_e||"No address available"}),jsx(View,{style:u.addressCopyIcon,children:jsx(lo,{size:16,color:n.card.actionColor,strokeWidth:1})})]})]}),jsxs(View,{style:[u.detailsCard,{backgroundColor:n.card.backgroundColor}],children:[jsxs(TouchableOpacity,{onPress:()=>Je(!Ue),style:u.detailsHeader,children:[jsxs(View,{style:u.detailsRow,children:[jsx(View,{style:[u.detailIcon,{backgroundColor:n.card.iconBackgroundColor}],children:jsx(Rt,{size:12,color:n.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[u.detailsLabel,{color:n.card.titleColor,fontFamily:s.regular}],children:"Processing time: < 1 min"})]}),jsx(View,{style:u.chevronContainer,children:Ue?jsx(gt,{size:16,color:n.card.actionColor,strokeWidth:2}):jsx(Fe,{size:16,color:n.card.actionColor,strokeWidth:2})})]}),Ue&&jsxs(View,{style:u.detailsContent,children:[jsxs(View,{style:u.detailsRow,children:[jsx(View,{style:[u.detailIcon,{backgroundColor:n.card.iconBackgroundColor}],children:jsx(qt,{size:12,color:n.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[u.detailsLabel,{color:n.card.titleColor,fontFamily:s.regular}],children:["Price impact: ",_.toFixed(2),"%"]}),jsx(TouchableOpacity,{onPress:()=>qe(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx($t,{size:14,color:n.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:u.detailsRow,children:[jsx(View,{style:[u.detailIcon,{backgroundColor:n.card.iconBackgroundColor}],children:jsx(Qt,{size:12,color:n.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[u.detailsLabel,{color:n.card.titleColor,fontFamily:s.regular}],children:["Slippage: Auto \u2022 ",G.toFixed(2),"%"]}),jsx(TouchableOpacity,{onPress:()=>qe(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx($t,{size:14,color:n.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:u.detailsRow,children:[jsx(View,{style:[u.detailIcon,{backgroundColor:n.card.iconBackgroundColor}],children:jsx(Lo,{size:12,color:n.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[u.detailsLabel,{color:n.card.titleColor,fontFamily:s.regular}],children:["Need help?"," ",jsx(Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsx(TouchableOpacity,{style:u.termsContainer,onPress:()=>Linking.openURL("https://unifold.io/terms"),children:jsx(Text,{style:[u.termsText,{color:p.primary,fontFamily:s.regular}],children:"Terms apply"})}),N(),oe(),jsxs(ae,{visible:Ot,onClose:()=>qe(false),closeOnBackdropPress:true,showHandle:true,children:[jsxs(View,{style:[u.sheetHeader,{borderBottomColor:p.border}],children:[jsx(View,{style:u.sheetHeaderSpacer}),jsx(Text,{style:[u.sheetTitle,{color:n.header.titleColor,fontFamily:s.medium}],children:"Price Impact & Slippage"}),jsx(TouchableOpacity,{onPress:()=>qe(false),style:u.sheetCloseButton,children:jsx(Ve,{size:20,color:n.header.buttonColor,strokeWidth:2})})]}),jsxs(View,{style:u.infoSheetContent,children:[jsxs(View,{style:[u.infoCard,{backgroundColor:n.card.backgroundColor}],children:[jsxs(View,{style:u.infoCardHeader,children:[jsx(View,{style:[u.infoCardIcon,{backgroundColor:n.card.iconBackgroundColor}],children:jsx(qt,{size:16,color:n.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[u.infoCardTitle,{color:n.card.titleColor,fontFamily:s.medium}],children:"Price Impact"}),jsxs(Text,{style:[u.infoCardValue,{color:n.card.titleColor,fontFamily:s.medium}],children:[_.toFixed(2),"%"]})]}),jsx(Text,{style:[u.infoCardDescription,{color:n.card.descriptionColor,fontFamily:s.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:[u.infoCard,{backgroundColor:n.card.backgroundColor}],children:[jsxs(View,{style:u.infoCardHeader,children:[jsx(View,{style:[u.infoCardIcon,{backgroundColor:n.card.iconBackgroundColor}],children:jsx(Qt,{size:16,color:n.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[u.infoCardTitle,{color:n.card.titleColor,fontFamily:s.medium}],children:"Max Slippage"}),jsxs(Text,{style:[u.infoCardValue,{color:n.card.titleColor,fontFamily:s.medium}],children:[G.toFixed(2),"%"]})]}),jsx(Text,{style:[u.infoCardDescription,{color:n.card.descriptionColor,fontFamily:s.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."})]})]})]}),te&&jsx(Xt,{visible:Mt,status:te.status,tokenIconUrl:te.destination_token_metadata?.icon_urls?.find(C=>C.format==="png")?.url||te.destination_token_metadata?.icon_url||ne(We,"png"),explorerUrl:te.explorer_url,completionExplorerUrl:te.destination_explorer_url,date:te.created_at?new Date(te.created_at):void 0,amountUsd:te.source_amount_usd?parseFloat(te.source_amount_usd):void 0,onClose:()=>bt(false)})]})}var u=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,borderRadius:16,borderWidth:1},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,borderRadius:8},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 Ao({currency:e,isSelected:t,onSelect:o}){let{colors:i,fonts:r,components:a}=A();return jsxs(TouchableOpacity,{onPress:()=>o(e.currency_code),activeOpacity:.7,style:[Bt.container,{backgroundColor:a.card.backgroundColor}],children:[jsxs(View,{style:Bt.leftContent,children:[jsx(View,{style:[Bt.iconContainer,{backgroundColor:i.background}],children:jsx(Image,{source:{uri:q(ne(e,"png"))},style:Bt.icon})}),jsxs(View,{style:Bt.textContainer,children:[jsx(Text,{style:[Bt.name,{color:a.card.titleColor,fontFamily:r.medium}],children:e.name}),jsx(Text,{style:[Bt.code,{color:a.card.subtitleColor,fontFamily:r.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsx(we,{size:16,color:i.primary,strokeWidth:2})]})}var Bt=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,borderRadius: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 yo({title:e,currencies:t,selectedCurrency:o,onSelect:i}){let{fonts:r,components:a}=A();return t.length===0?null:jsxs(View,{children:[jsx(View,{style:tn.headerContainer,children:jsx(Text,{style:[tn.title,{color:a.list.titleSectionColor,fontFamily:r.medium}],children:e})}),t.map(d=>jsx(Ao,{currency:d,isSelected:o.toLowerCase()===d.currency_code.toLowerCase(),onSelect:i},d.currency_code))]})}var tn=StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function Oo({open:e,onOpenChange:t,currencies:o,preferredCurrencyCodes:i,selectedCurrency:r,onSelectCurrency:a}){let{colors:d,fonts:l,components:c}=A(),[h,x]=useState(""),L=i.map(z=>o.find(b=>b.currency_code.toLowerCase()===z.toLowerCase())).filter(z=>z!==void 0),D=o.filter(z=>!i.includes(z.currency_code.toLowerCase())),p=z=>{if(!h)return z;let b=h.toLowerCase();return z.filter(S=>S.name.toLowerCase().includes(b)||S.currency_code.toLowerCase().includes(b))},s=p(L),n=p(D),k=z=>{a(z),t(false),x("");},F=()=>{t(false),x("");};return jsxs(ae,{visible:e,onClose:F,closeOnBackdropPress:true,showHandle:false,children:[jsx(Me,{title:"Currency",showBack:false,onClose:F}),jsx(View,{style:Wt.searchContainer,children:jsx(TextInput,{style:[Wt.searchInput,{backgroundColor:c.search.backgroundColor,color:c.search.inputColor,fontFamily:l.regular}],value:h,onChangeText:x,placeholder:"Search",placeholderTextColor:c.search.placeholderColor})}),jsx(ScrollView,{style:Wt.listContainer,showsVerticalScrollIndicator:false,children:jsxs(View,{style:Wt.listContent,children:[jsx(yo,{title:"Popular currencies",currencies:s,selectedCurrency:r,onSelect:k}),s.length>0&&n.length>0&&jsx(View,{style:Wt.sectionSpacer}),jsx(yo,{title:"All currencies",currencies:n,selectedCurrency:r,onSelect:k}),s.length===0&&n.length===0&&jsx(View,{style:Wt.noResultsContainer,children:jsx(Text,{style:[Wt.noResultsText,{color:c.container.subtitleColor,fontFamily:l.regular}],children:"No currencies found"})})]})})]})}var Wt=StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:16,paddingBottom:12},searchInput:{padding:16,borderRadius:12,fontSize:14},listContainer:{height:400,paddingHorizontal:12},listContent:{paddingBottom:24,minHeight:400},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});var Si=[100,500,1e3];function nn(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 Uo({externalUserId:e,publishableKey:t,view:o,onViewChange:i,maxAmountUsd:r=5e4,destinationTokenSymbol:a="USDC",recipientAddress:d,destinationChainType:l,destinationChainId:c,destinationTokenAddress:h,onDepositSuccess:x,onDepositError:L}){let{colors:D,fonts:p,components:s}=A(),[n,k]=useState("500.00"),[F,z]=useState("usd"),[b,S]=useState([]),[O,f]=useState(false),[se,X]=useState(null),[Z,fe]=useState("amount"),[P,xe]=useState(null),[he,Pe]=useState(false),[Ue,Je]=useState([]),[Le,Be]=useState(true),[je,Se]=useState(60),[ye,dt]=useState([]),[kt,oo]=useState([]),[Ie,wt]=useState(null),[Ne,Mt]=useState(false),[bt,te]=useState(false),[ro,Ot]=useState(false),[qe,ot]=useState(null),Ht=o??Z,ut=ye.find(_=>_.currency_code.toLowerCase()===F.toLowerCase()),xt=useCallback(_=>{fe(_),_==="quotes"?i?.(_,b.length):i?.(_);},[b.length,i]);useEffect(()=>{async function _(){try{let G=await _t({external_user_id:e,recipient_address:d,destination_chain_type:l,destination_chain_id:c,destination_token_address:h},t);Je(G.data);}catch(G){console.error("Error fetching wallets:",G),X("Failed to load wallet addresses");}finally{Be(false);}}_();},[e,d,l,c,h,t]),useEffect(()=>{async function _(){try{let G=await sr(t);dt(G.data),oo(G.preferred||[]);}catch(G){console.error("Error fetching fiat currencies:",G);}}_();},[t]),useEffect(()=>{let _=parseFloat(n);if(isNaN(_)||_<=0){S([]);return}if(F.toLowerCase()==="usd"&&_>r){S([]),X(`Maximum amount is ${nn("usd")}${r.toLocaleString()}`);return}let G=setTimeout(()=>{Ut(_);},500);return ()=>clearTimeout(G)},[n,F,r,t]);let Ut=async _=>{f(true),X(null);try{let G={country_code:"US",destination_currency_code:"usdc_polygon",source_amount:_.toString(),source_currency_code:F.toLowerCase()},ve=await nr(G,t);if(S(ve.data),ve.data.length>0){let N=ve.data.reduce((oe,C)=>C.destination_amount>oe.destination_amount?C:oe);xe(N);}Se(60);}catch(G){console.error("Failed to fetch quotes:",G),X("Failed to fetch quotes. Please try again."),S([]);}finally{f(false);}};useEffect(()=>{if(b.length===0)return;let _=setInterval(()=>{Se(G=>{if(G<=1){let ve=parseFloat(n);return !isNaN(ve)&&ve>0&&Ut(ve),60}return G-1});},1e3);return ()=>clearInterval(_)},[b.length,n]);let er=_=>{(/^\d*\.?\d{0,2}$/.test(_)||_==="")&&k(_);},_e=_=>{k(_.toFixed(2));},Tt=()=>P?P.destination_amount.toFixed(2):"0.00",We=async()=>{if(P)try{let _=vt(Ue,"ethereum");if(!_?.address){X("Wallet address not available");return}let G={service_provider:P.service_provider,country_code:P.country_code.toUpperCase(),destination_currency_code:P.destination_currency_code,source_currency_code:P.source_currency_code,wallet_address:_.address,source_amount:n},ve=await ir(G,t);wt({provider:P,sourceCurrency:F,sourceAmount:n}),ot(ve.widget_url),Ot(!0);}catch(_){console.error("Failed to create session:",_),X("Failed to start payment flow"),L?.({message:"Failed to start payment flow",error:_});}},St=nn(F),Ce=()=>{Ot(false),xt("onramp"),x?.({message:"Payment flow completed",executionId:Ie?.sessionId});},no=()=>jsx(Ii,{visible:ro,onClose:Ce,url:qe,providerName:P?.service_provider_display_name||"Complete Payment",colors:D,fonts:p});return Ht==="amount"?jsxs(Fragment,{children:[jsxs(View,{style:w.amountViewContainer,children:[jsxs(ScrollView,{style:w.scrollContainer,contentContainerStyle:w.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsx(View,{style:w.currencySelector,children:jsxs(TouchableOpacity,{onPress:()=>Mt(true),style:[w.currencyButton,{backgroundColor:s.card.backgroundColor}],children:[ut&&jsx(Image,{source:{uri:q(ne(ut,"png"))},style:w.currencyIcon}),jsx(Text,{style:[w.currencyText,{color:s.card.titleColor,fontFamily:p.medium}],children:F.toUpperCase()}),jsx(Fe,{size:16,color:s.card.actionColor,strokeWidth:2})]})}),jsx(Oo,{open:Ne,onOpenChange:Mt,currencies:ye,preferredCurrencyCodes:kt,selectedCurrency:F,onSelectCurrency:_=>{z(_.toLowerCase());}}),jsxs(View,{style:w.amountContainer,children:[jsxs(View,{style:w.amountInputRow,children:[jsx(Text,{style:[w.currencySymbol,{color:s.container.titleColor,fontFamily:p.medium}],children:St}),jsx(TextInput,{style:[w.amountInput,{color:s.container.titleColor,fontFamily:p.medium}],value:n,onChangeText:er,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:D.foregroundMuted})]}),O?jsx(ActivityIndicator,{size:"small",color:D.primary}):jsxs(Text,{style:[w.usdcPreview,{color:s.container.subtitleColor,fontFamily:p.regular}],children:["\u2248 ",Tt()," ",a]})]}),jsx(View,{style:w.quickAmounts,children:Si.map(_=>jsx(TouchableOpacity,{onPress:()=>_e(_),style:[w.quickAmountButton,{backgroundColor:s.card.backgroundColor},parseFloat(n)===_&&{borderColor:D.primary,borderWidth:2}],children:jsxs(Text,{style:[w.quickAmountText,{color:s.card.titleColor,fontFamily:p.medium}],children:[St,_.toLocaleString()]})},_))}),jsxs(View,{style:w.providerSection,children:[jsxs(View,{style:w.providerHeader,children:[jsx(Text,{style:[w.providerLabel,{color:s.card.labelColor,fontFamily:p.medium}],children:"Provider"}),b.length>0&&!O&&jsxs(Text,{style:[w.refreshText,{color:s.card.labelRightColor,fontFamily:p.regular}],children:["Refreshing in ",je,"s"]})]}),jsx(TouchableOpacity,{onPress:()=>te(true),disabled:O||b.length===0,style:[w.providerButton,{backgroundColor:s.card.backgroundColor},(O||b.length===0)&&w.disabled],children:O?jsxs(View,{style:w.providerLoading,children:[jsx(ActivityIndicator,{size:"small",color:s.container.subtitleColor}),jsx(Text,{style:[w.loadingText,{color:s.container.subtitleColor,fontFamily:p.regular}],children:"Finding best rates..."})]}):P?jsxs(View,{style:w.providerContent,children:[jsxs(View,{style:w.providerInfo,children:[!he&&jsx(Text,{style:[w.autoPickedText,{color:s.container.subtitleColor,fontFamily:p.regular}],children:"Auto-picked for you"}),jsxs(View,{style:w.providerRow,children:[jsx(Image,{source:{uri:q(vo(P.icon_urls,"png",P.icon_url))},style:w.providerIconImage},`provider-${P.service_provider}`),jsxs(View,{children:[jsx(Text,{style:[w.providerName,{color:s.card.titleColor,fontFamily:p.medium}],children:P.service_provider_display_name}),jsxs(Text,{style:[w.bestPriceText,{color:D.success,fontFamily:p.regular}],children:["Best price \u2022 ",P.destination_amount.toFixed(2)," ","USDC"]})]})]})]}),jsx(rt,{size:20,color:s.card.actionColor,strokeWidth:2})]}):jsx(Text,{style:[w.noProviderText,{color:s.container.subtitleColor,fontFamily:p.regular}],children:parseFloat(n)>0?"No providers available":"Enter an amount to see providers"})}),se&&jsx(Text,{style:[w.errorText,{color:D.error,fontFamily:p.regular}],children:se})]}),jsxs(ae,{visible:bt,onClose:()=>te(false),closeOnBackdropPress:true,showHandle:false,children:[jsx(Me,{title:"Select Provider",showBack:false,onClose:()=>te(false)}),jsx(ScrollView,{style:w.providerModalList,showsVerticalScrollIndicator:false,children:jsx(View,{style:w.quotesList,children:[...b].sort((_,G)=>G.destination_amount-_.destination_amount).map((_,G)=>{let ve=P?.service_provider===_.service_provider,N=G===0;return jsxs(TouchableOpacity,{onPress:()=>{xe(_),Pe(true),te(false);},style:[w.quoteItem,{backgroundColor:s.card.backgroundColor},ve&&{borderColor:D.primary,borderWidth:2}],children:[jsxs(View,{style:w.quoteLeft,children:[jsx(Image,{source:{uri:q(vo(_.icon_urls,"png",_.icon_url))},style:w.providerIconImage}),jsxs(View,{children:[jsx(Text,{style:[w.quoteName,{color:s.card.titleColor,fontFamily:p.medium}],children:_.service_provider_display_name}),N&&jsx(Text,{style:[w.bestPriceLabel,{color:D.success,fontFamily:p.regular}],children:"\u2713 Best price"})]})]}),jsxs(View,{style:w.quoteRight,children:[jsxs(Text,{style:[w.quoteAmount,{color:s.card.textRightColor,fontFamily:p.medium}],children:[_.destination_amount.toFixed(2)," USDC"]}),jsxs(Text,{style:[w.quoteSource,{color:s.card.subtextRightColor,fontFamily:p.regular}],children:["Fee: ",St,_.total_fee.toFixed(2)]})]})]},_.service_provider)})})})]})]}),jsx(View,{style:[w.continueButtonContainer,{backgroundColor:D.background}],children:jsx(TouchableOpacity,{onPress:We,disabled:O||Le||!P||parseFloat(n)<=0,style:[w.continueButton,{backgroundColor:s.container.buttonColor},(O||Le||!P)&&w.disabledButton],children:jsx(Text,{style:[w.continueButtonText,{color:s.container.buttonTitleColor,fontFamily:p.medium}],children:Le?"Loading...":"Continue"})})})]}),no()]}):Ht==="onramp"&&Ie?jsxs(View,{style:w.onrampContainer,children:[jsx(Image,{source:{uri:q(vo(Ie.provider.icon_urls,"png",Ie.provider.icon_url))},style:w.onrampProviderIcon}),jsxs(Text,{style:[w.onrampTitle,{color:s.container.titleColor,fontFamily:p.medium}],children:["Complete transaction with ",Ie.provider.service_provider_display_name]}),jsx(Text,{style:[w.onrampSubtitle,{color:s.container.subtitleColor,fontFamily:p.regular}],children:"You can close this modal."}),jsxs(View,{style:[w.flowDiagram,{backgroundColor:s.card.backgroundColor}],children:[jsxs(View,{style:w.flowStep,children:[jsx(Image,{source:{uri:De(`/icons/currencies/png/${Ie.sourceCurrency.toLowerCase()}.png`)},style:w.flowIconImage}),jsx(Text,{style:[w.flowLabel,{color:s.card.subtitleColor,fontFamily:p.regular}],children:"You use"}),jsx(Text,{style:[w.flowValue,{color:s.card.titleColor,fontFamily:p.medium}],children:Ie.sourceCurrency.toUpperCase()})]}),jsx(rt,{size:16,color:s.card.actionColor,strokeWidth:2}),jsxs(View,{style:w.flowStep,children:[jsxs(View,{style:w.flowIconWithBadge,children:[jsx(Image,{source:{uri:De("/icons/tokens/png/usdc.png")},style:w.flowIconImageNoBadge}),jsx(Image,{source:{uri:De("/icons/networks/png/polygon.png")},style:[w.flowNetworkBadge,{borderColor:D.background}]})]}),jsx(Text,{style:[w.flowLabel,{color:s.card.subtitleColor,fontFamily:p.regular}],children:"You buy"}),jsx(Text,{style:[w.flowValue,{color:s.card.titleColor,fontFamily:p.medium}],children:"USDC"})]}),jsx(rt,{size:16,color:s.card.actionColor,strokeWidth:2}),jsxs(View,{style:w.flowStep,children:[jsxs(View,{style:w.flowIconWithBadge,children:[jsx(Image,{source:{uri:De("/icons/tokens/png/usdc.png")},style:w.flowIconImageNoBadge}),jsx(Image,{source:{uri:De("/icons/networks/png/polygon.png")},style:[w.flowNetworkBadge,{borderColor:D.background}]})]}),jsx(Text,{style:[w.flowLabel,{color:s.card.subtitleColor,fontFamily:p.regular}],children:"You receive"}),jsx(Text,{style:[w.flowValue,{color:s.card.titleColor,fontFamily:p.medium}],children:a})]})]}),jsx(View,{style:[w.onrampInfoBox,{backgroundColor:s.card.backgroundColor}],children:jsx(Text,{style:[w.onrampInfoText,{color:s.card.descriptionColor,fontFamily:p.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 Ii({visible:e,onClose:t,url:o,providerName:i,colors:r,fonts:a}){return jsxs(ae,{visible:e,onClose:t,closeOnBackdropPress:false,showHandle:false,heightPercent:.92,noPadding:true,children:[jsxs(View,{style:zt.header,children:[jsx(TouchableOpacity,{onPress:t,style:zt.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(we,{size:20,color:r.foregroundMuted,strokeWidth:2})}),jsx(Text,{style:[zt.headerTitle,{color:r.foreground,fontFamily:a.medium}],children:i}),jsx(View,{style:zt.headerSpacer})]}),o&&jsx(View,{style:zt.container,children:jsx(WebView,{source:{uri:o},style:zt.webView,startInLoadingState:true,renderLoading:()=>jsx(View,{style:zt.loading,children:jsx(ActivityIndicator,{size:"large",color:r.primary})})})})]})}var zt=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"}}),w=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,borderRadius: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,borderRadius:8},quickAmountText:{fontSize:14,fontWeight:"500"},providerSection:{marginBottom:24},providerHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},providerLabel:{fontSize:12,fontWeight:"500"},refreshText:{fontSize:10},providerButton:{padding:16,borderRadius:12},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,borderRadius:12,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,borderRadius: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,borderRadius:7,borderWidth:2},onrampInfoBox:{marginTop:16,padding:16,borderRadius:12,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 Ri(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 Vi(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function qo({execution:e,onPress:t}){let {colors:o,fonts:i,components:r}=A(),a=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=q(ne(e.destination_token_metadata,"png")||De("/icons/tokens/png/usdc.png")),c=a?"Deposit Processing":"Deposit Completed",h=Ri(e.created_at||new Date().toISOString()),x=Vi(e.source_amount_usd);return jsxs(TouchableOpacity,{onPress:t,activeOpacity:.7,style:[lt.container,{backgroundColor:r.card.backgroundColor}],children:[jsxs(View,{style:lt.iconContainer,children:[jsx(Image,{source:{uri:l},style:lt.tokenIcon}),jsx(View,{style:[lt.statusBadge,{backgroundColor:a?o.warning:o.success,borderColor:r.card.backgroundColor}],children:a?jsx(Mr,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsx(we,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxs(View,{style:lt.textContainer,children:[jsx(Text,{style:[lt.title,{color:r.card.titleColor,fontFamily:i.medium}],children:c}),jsx(Text,{style:[lt.dateTime,{color:r.card.subtitleColor,fontFamily:i.regular}],children:h})]}),jsxs(View,{style:lt.rightContainer,children:[jsx(Text,{style:[lt.amount,{color:r.card.textRightColor,fontFamily:i.medium}],children:x}),jsx(rt,{size:20,color:r.card.actionColor,strokeWidth:2})]})]})}var lt=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12,borderRadius:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-2,right:-2,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"}});var{height:zi}=Dimensions.get("window");function cn(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 dn(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 Ei(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var un=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function pn(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Ai(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 Qo({visible:e,onClose:t,executions:o,externalUserId:i,publishableKey:r}){let{colors:a,fonts:d,components:l}=A(),[c,h]=useState(o),[x,L]=useState(false),[D,p]=useState(null),[s,n]=useState(false),k=useRef(null);useEffect(()=>{if(!e||!i)return;let f=async()=>{L(true);try{let Z=[...(await Dt(i,r)).data].sort((fe,P)=>{let xe=fe.created_at?new Date(fe.created_at).getTime():0;return (P.created_at?new Date(P.created_at).getTime():0)-xe});h(Z);}catch(X){console.error("Failed to fetch executions:",X),h(o);}finally{L(false);}};f();let se=setInterval(f,1e4);return ()=>clearInterval(se)},[e,i,r,o]),useEffect(()=>{o.length>0&&h(f=>{let se=new Set(f.map(Z=>Z.id)),X=o.filter(Z=>!se.has(Z.id));return X.length>0?[...X,...f]:f});},[o]),useEffect(()=>{e||p(null);},[e]);let F=f=>{p(f);},z=()=>{p(null),n(false);},b=()=>{p(null),t();};return jsxs(ae,{visible:e,onClose:b,closeOnBackdropPress:true,showHandle:false,heightPercent:.6,children:[jsx(Me,{title:D?"Deposit Details":"Deposit Tracker",onClose:b,showClose:!D,showBack:!!D,onBack:z}),D?(()=>{if(!D)return null;let f=D,se=f.status==="pending"||f.status==="waiting"||f.status==="delayed",X=f.status==="succeeded",Z=q(ne(f.destination_token_metadata,"png")||De("/icons/tokens/png/usdc.png")),fe=f.provider_metadata?.details,P=fe?.currencyIn,xe=fe?.currencyOut;P?.currency?.symbol||"USDC";xe?.currency?.symbol||"USDC";let Ue=dn(f.source_amount_base_unit,f.source_token_metadata?.decimals),Je=dn(f.destination_amount_base_unit,f.destination_token_metadata?.decimals),Le=Ei(f.source_amount_usd),Be=cn(f.source_chain_type,f.source_chain_id),je=cn(f.destination_chain_type,f.destination_chain_id),Se=()=>{f.explorer_url&&Linking.openURL(f.explorer_url);},ye=()=>{f.destination_explorer_url&&Linking.openURL(f.destination_explorer_url);};return jsxs(ScrollView,{ref:k,style:V.scrollContainer,contentContainerStyle:V.detailsContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:V.iconSection,children:[jsxs(View,{style:V.iconWrapper,children:[jsx(Image,{source:{uri:Z},style:V.tokenIcon}),jsx(View,{style:[V.statusBadge,{backgroundColor:se?a.warning:a.success,borderColor:a.background}],children:se?jsx(Fe,{size:14,color:"#FFFFFF",strokeWidth:2}):jsx(we,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxs(View,{style:V.statusRow,children:[jsx(View,{style:[V.statusDot,{backgroundColor:se?a.warning:a.success}]}),jsx(Text,{style:[V.statusText,{color:l.container.titleColor,fontFamily:d.semibold}],children:se?"Processing":"Completed"})]}),jsx(Text,{style:[V.dateText,{color:l.container.subtitleColor,fontFamily:d.regular}],children:Ai(f.created_at||new Date().toISOString())})]}),jsxs(View,{style:[V.card,{backgroundColor:l.card.backgroundColor}],children:[jsxs(View,{style:V.cardRow,children:[jsx(Text,{style:[V.cardLabel,{color:l.card.rowLeftLabel,fontFamily:d.regular}],children:"Amount Sent"}),jsxs(Text,{style:[V.cardValue,{color:l.card.rowRightLabel,fontFamily:d.medium}],children:[Ue," ",pn(f.source_currency)]})]}),jsx(View,{style:[V.cardDivider,{backgroundColor:a.border}]}),jsxs(View,{style:V.cardRow,children:[jsx(Text,{style:[V.cardLabel,{color:l.card.rowLeftLabel,fontFamily:d.regular}],children:"Amount Received"}),jsxs(Text,{style:[V.cardValue,{color:l.card.rowRightLabel,fontFamily:d.medium}],children:[Je," ",pn(f.destination_currency)]})]}),jsx(View,{style:[V.cardDivider,{backgroundColor:a.border}]}),jsxs(View,{style:V.cardRow,children:[jsx(Text,{style:[V.cardLabel,{color:l.card.rowLeftLabel,fontFamily:d.regular}],children:"USD Value"}),jsx(Text,{style:[V.cardValue,{color:l.card.rowRightLabel,fontFamily:d.medium}],children:Le})]}),jsx(View,{style:[V.cardDivider,{backgroundColor:a.border}]}),jsxs(View,{style:V.cardRow,children:[jsx(Text,{style:[V.cardLabel,{color:l.card.rowLeftLabel,fontFamily:d.regular}],children:"Source Network"}),jsx(Text,{style:[V.cardValue,{color:l.card.rowRightLabel,fontFamily:d.medium}],children:Be})]}),jsx(View,{style:[V.cardDivider,{backgroundColor:a.border}]}),jsxs(View,{style:V.cardRow,children:[jsx(Text,{style:[V.cardLabel,{color:l.card.rowLeftLabel,fontFamily:d.regular}],children:"Destination Network"}),jsx(Text,{style:[V.cardValue,{color:l.card.rowRightLabel,fontFamily:d.medium}],children:je})]})]}),jsxs(TouchableOpacity,{onPress:()=>{let dt=!s;n(dt),dt?setTimeout(()=>{k.current?.scrollToEnd({animated:true});},100):k.current?.scrollTo({y:0,animated:true});},style:V.toggleButton,activeOpacity:.7,children:[jsx(Text,{style:[V.toggleText,{color:l.container.actionTitle,fontFamily:d.regular}],children:s?"See less":"See more details"}),s?jsx(gt,{size:14,color:l.container.actionColor,strokeWidth:2}):jsx(Fe,{size:14,color:l.container.actionColor,strokeWidth:2})]}),s&&jsxs(View,{style:[V.card,{backgroundColor:l.card.backgroundColor}],children:[f.explorer_url&&jsxs(View,{children:[jsxs(TouchableOpacity,{onPress:Se,style:V.cardRow,children:[jsx(Text,{style:[V.cardLabel,{color:l.card.rowLeftLabel,fontFamily:d.regular}],children:"Deposit Tx"}),jsxs(View,{style:V.cardRowRight,children:[jsx(Text,{style:[V.cardValue,{color:l.card.rowRightLabel,fontFamily:d.medium}],children:un(f.transaction_hash)}),jsx(Vt,{size:14,color:l.card.actionIcon,strokeWidth:2})]})]}),jsx(View,{style:[V.cardDivider,{backgroundColor:a.border}]})]}),f.destination_explorer_url&&X&&jsxs(TouchableOpacity,{onPress:ye,style:V.cardRow,children:[jsx(Text,{style:[V.cardLabel,{color:l.card.rowLeftLabel,fontFamily:d.regular}],children:"Completion Tx"}),jsxs(View,{style:V.cardRowRight,children:[jsx(Text,{style:[V.cardValue,{color:l.card.rowRightLabel,fontFamily:d.medium}],children:un(f.destination_transaction_hashes[0])}),jsx(Vt,{size:14,color:l.card.actionIcon,strokeWidth:2})]})]})]})]})})():jsx(ScrollView,{style:V.scrollContainer,contentContainerStyle:V.scrollContent,showsVerticalScrollIndicator:false,children:c.length===0?jsxs(View,{style:V.emptyContainer,children:[jsx(Text,{style:[V.emptyText,{color:l.container.titleColor,fontFamily:d.medium}],children:"No deposits yet"}),jsx(Text,{style:[V.emptySubtext,{color:l.container.subtitleColor,fontFamily:d.regular}],children:"Your deposit history will appear here"})]}):jsx(View,{style:V.executionsList,children:c.map(f=>jsx(qo,{execution:f,onPress:()=>F(f)},f.id))})})]})}var V=StyleSheet.create({scrollContainer:{maxHeight:zi*.7,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 Co(e,t=true){let[o,i]=useState(null),[r,a]=useState(null),[d,l]=useState(false),[c,h]=useState(false),[x,L]=useState(null),[D,p]=useState(null);useEffect(()=>{!t||o||(l(true),ar().then(F=>{i(F),L(null);}).catch(F=>{L(F instanceof Error?F:new Error(String(F)));}).finally(()=>{l(false);}));},[t,o]),useEffect(()=>{!t||!e||r||(h(true),ao(e).then(F=>{a(F),p(null);}).catch(F=>{p(F instanceof Error?F:new Error(String(F)));}).finally(()=>{h(false);}));},[t,e,r]);let s=d||c,n=x||D||null,k=null;if(o&&r){let F=r.blocked_country_codes||[],z=o.alpha2.toUpperCase();k=!F.some(b=>b.toUpperCase()===z);}return {isAllowed:k,alpha2:o?.alpha2?.toLowerCase()??null,country:o?.country??null,isLoading:s,error:n}}var Ir="unifold_recent_tokens",Hi=5,yn=[{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 Ko(){try{let e=await Sr.getItem(Ir);return e?JSON.parse(e):[]}catch{return []}}async function Ui(e){try{let o=(await Ko()).filter(r=>!(r.symbol===e.symbol&&r.chainType===e.chainType&&r.chainId===e.chainId));o.unshift(e);let i=o.slice(0,Hi);await Sr.setItem(Ir,JSON.stringify(i));}catch{}}async function ji(e){try{let o=(await Ko()).filter(i=>!(i.symbol===e.symbol&&i.chainType===e.chainType&&i.chainId===e.chainId));return await Sr.setItem(Ir,JSON.stringify(o)),o}catch{return []}}function _r({visible:e,onClose:t,tokens:o,selectedToken:i,selectedChainKey:r,onSelect:a}){let{colors:d,fonts:l,components:c}=A(),[h,x]=useState(""),[L,D]=useState([]);useEffect(()=>{e&&Ko().then(D);},[e]),useEffect(()=>{e||x("");},[e]);let p=useMemo(()=>{let b=[];return o.forEach(S=>{S.chains.forEach(O=>{b.push({token:S,chain:O});});}),b},[o]),s=useMemo(()=>{let b=[],S=new Set,O=(f,se,X,Z)=>{let fe=`${f}-${se}:${X}`;if(S.has(fe))return;let P=o.find(he=>he.symbol===f);if(!P)return;let xe=P.chains.find(he=>he.chain_type===se&&he.chain_id===X);xe&&(S.add(fe),b.push({token:P,chain:xe,isRecent:Z}));};return L.forEach(f=>{O(f.symbol,f.chainType,f.chainId,true);}),yn.forEach(f=>{O(f.symbol,f.chainType,f.chainId,false);}),b},[o,L]),n=useMemo(()=>{if(!h.trim())return p;let b=h.toLowerCase();return p.filter(({token:S,chain:O})=>S.symbol.toLowerCase().includes(b)||S.name.toLowerCase().includes(b)||O.chain_name.toLowerCase().includes(b))},[p,h]),k=(b,S,O)=>yn.some(f=>f.symbol===b&&f.chainType===S&&f.chainId===O),F=async(b,S)=>{let O=`${S.chain_type}:${S.chain_id}`;if(!k(b.symbol,S.chain_type,S.chain_id)){await Ui({symbol:b.symbol,chainType:S.chain_type,chainId:S.chain_id});let f=await Ko();D(f);}x(""),a(b.symbol,O),t();},z=async(b,S)=>{let O=await ji({symbol:b.symbol,chainType:S.chain_type,chainId:S.chain_id});D(O);};return jsxs(ae,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:false,heightPercent:.9,children:[jsxs(View,{style:K.header,children:[jsx(View,{style:K.headerSpacer}),jsx(Text,{style:[K.headerTitle,{color:c.header.titleColor,fontFamily:l.medium}],children:"Select token to deposit"}),jsx(TouchableOpacity,{onPress:t,style:K.closeButton,children:jsx(Ve,{size:20,color:c.header.buttonColor,strokeWidth:2})})]}),jsx(View,{style:K.searchContainer,children:jsx(TextInput,{style:[K.searchInput,{backgroundColor:c.search.backgroundColor,color:c.search.inputColor,fontFamily:l.regular}],placeholder:"Search",placeholderTextColor:c.search.placeholderColor,value:h,onChangeText:x,autoCapitalize:"none",autoCorrect:false})}),s.length>0&&!h&&jsxs(View,{style:K.quickSelectSection,children:[jsx(Text,{style:[K.sectionLabel,{color:c.list.titleSectionColor,fontFamily:l.regular}],children:"Quick select"}),jsx(ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,contentContainerStyle:K.quickSelectScroll,children:s.map(({token:b,chain:S,isRecent:O})=>{let f=`${S.chain_type}:${S.chain_id}`;b.symbol===i&&f===r;return jsxs(View,{children:[O&&jsx(TouchableOpacity,{onPress:()=>z(b,S),style:K.removeButton,children:jsx(Ve,{size:12,color:d.foregroundMuted,strokeWidth:2})}),jsxs(TouchableOpacity,{onPress:()=>F(b,S),style:[K.quickSelectItem],children:[jsxs(View,{style:K.tokenIconContainer,children:[jsx(Image,{source:{uri:q(ne(b,"png"))},style:K.quickSelectIcon}),jsx(Image,{source:{uri:q(ne(S,"png"))},style:[K.quickSelectChainBadge,{borderColor:c.card.backgroundColor}]})]}),jsxs(View,{style:K.quickSelectText,children:[jsx(Text,{style:[K.quickSelectSymbol,{color:c.card.titleColor,fontFamily:l.medium}],children:b.symbol}),jsx(Text,{style:[K.quickSelectChain,{color:c.card.subtitleColor,fontFamily:l.regular}],children:S.chain_name})]})]})]},`quick-${b.symbol}-${f}`)})})]}),jsx(Text,{style:[K.sectionLabel,{color:c.list.titleSectionColor,fontFamily:l.regular}],children:"All supported tokens"}),jsx(ScrollView,{style:K.tokenList,showsVerticalScrollIndicator:false,contentContainerStyle:K.tokenListContent,children:n.length===0?jsx(View,{style:K.emptyState,children:jsx(Text,{style:[K.emptyText,{color:d.foregroundMuted,fontFamily:l.regular}],children:"No tokens found"})}):n.map(({token:b,chain:S})=>{let O=`${S.chain_type}:${S.chain_id}`,f=b.symbol===i&&O===r;return jsxs(TouchableOpacity,{onPress:()=>F(b,S),style:[K.tokenItem,{backgroundColor:f?c.card.backgroundColor:"transparent"}],children:[jsxs(View,{style:K.tokenIconContainerLarge,children:[jsx(Image,{source:{uri:q(ne(b,"png"))},style:K.tokenIcon}),jsx(Image,{source:{uri:q(ne(S,"png"))},style:[K.tokenChainBadge,{borderColor:c.card.backgroundColor}]})]}),jsxs(View,{style:K.tokenInfo,children:[jsx(Text,{style:[K.tokenSymbol,{color:c.card.titleColor,fontFamily:l.medium}],children:b.symbol}),jsx(Text,{style:[K.tokenChainName,{color:c.card.subtitleColor,fontFamily:l.regular}],children:S.chain_name})]}),jsxs(Text,{style:[K.minDeposit,{color:c.card.labelColor,fontFamily:l.regular}],children:["Minimum:"," ",jsxs(Text,{style:{color:c.card.labelHighlightRightColor,fontFamily:l.regular},children:["$",S.minimum_deposit_amount_usd]})]})]},`${b.symbol}-${O}`)})})]})}var K=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,borderRadius:8,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,borderRadius: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 Jo=(e,t)=>`${t}:${e}`,Gi=e=>{let[t,o]=e.split(":");return {chainType:t,chainId:o}};function vr({externalUserId:e,publishableKey:t,recipientAddress:o,destinationChainType:i,destinationChainId:r,destinationTokenAddress:a,destinationTokenSymbol:d,defaultChainType:l,defaultChainId:c,defaultTokenAddress:h,onExecutionsChange:x,onDepositSuccess:L,onDepositError:D,wallets:p}){let{colors:s,fonts:n,components:k}=A(),F=l&&c?`${l}:${c}`:"solana:mainnet",[z,b]=useState("USDC"),[S,O]=useState(F),[f,se]=useState([]),[X,Z]=useState(!p?.length),fe=p?.length?p:f,[P,xe]=useState([]),[he,Pe]=useState(true),[Ue,Je]=useState(false),[Le,Be]=useState(false),[je,Se]=useState(false),[ye,dt]=useState([]),[kt,oo]=useState(new Map),[Ie]=useState(()=>new Date),[wt,Ne]=useState(null),[Mt,bt]=useState(false),[te,ro]=useState(null),[Ot,qe]=useState(false),ot=new Map;P.forEach(N=>{N.chains.forEach(oe=>{let C=`${oe.chain_type}:${oe.chain_id}`;ot.has(C)||ot.set(C,oe);});});let Ht=Array.from(ot.values()),ut=Gi(S),xt=Ht.find(N=>N.chain_type===ut.chainType&&N.chain_id===ut.chainId),Ut=xt?.chain_type||"ethereum",_e=vt(fe,Ut)?.address||"",Tt=useRef(false);useEffect(()=>{async function N(){try{Pe(!0),Ne(null);let C=await so(t,a&&r&&i?{destination_token_address:a,destination_chain_id:r,destination_chain_type:i}:void 0);if(xe(C.data),C.data.length>0&&!Tt.current){Tt.current=!0;let g,I;if(l&&c)if(h)for(let R of C.data){let H=R.chains.find(re=>re.chain_type===l&&re.chain_id===c&&re.token_address.toLowerCase()===h.toLowerCase());if(H){g=R,I=H;break}}else for(let R of C.data){let H=R.chains.find(re=>re.chain_type===l&&re.chain_id===c);if(H){g=R,I=H;break}}if(!g&&a)for(let R of C.data){let H=R.chains.find(re=>re.token_address.toLowerCase()===a.toLowerCase());if(H){g=R,I=H;break}}g||(g=C.data.find(R=>R.symbol==="USDC"),g&&g.chains.length>0&&(I=g.chains[0])),g||(g=C.data.find(R=>R.symbol==="USDT"),g&&g.chains.length>0&&(I=g.chains[0])),g||(g=C.data[0],g.chains.length>0&&(I=g.chains[0])),g&&b(g.symbol),I&&O(Jo(I.chain_id,I.chain_type));}}catch(oe){console.error("Error fetching supported tokens:",oe),Ne("Failed to load supported tokens"),D?.({message:"Failed to load supported tokens",error:oe});}finally{Pe(false);}}N();},[t,a,r,i,l,c,h,D]),useEffect(()=>{x&&x(ye);},[ye,x]),useEffect(()=>{if(p?.length){Z(false);return}if(f.length>0){Z(false);return}let N=null,oe=false,C=async()=>{if(!oe){Z(true);try{let g=await _t({external_user_id:e,recipient_address:o,destination_chain_type:i,destination_chain_id:r,destination_token_address:a},t);oe||(se(g.data),Ne(null),Z(!1));}catch(g){console.error("Error fetching wallets, retrying in 5s:",g),oe||(Ne(g instanceof Error?g.message:"Failed to load wallets"),Z(false),N=setTimeout(C,5e3));}}};return C(),()=>{oe=true,N&&clearTimeout(N);}},[e,o,i,r,a,t,p,f.length]),useEffect(()=>{if(!e||!Ie)return;let N=setInterval(async()=>{try{let oe=await Dt(e,t),C=null;for(let g of oe.data){let I=g.created_at?new Date(g.created_at):null;if(!I||I<=Ie)continue;let R=kt.get(g.id);if(!R){C=g;break}if(["pending","waiting","delayed"].includes(R)&&g.status==="succeeded"){C=g;break}}if(C){let g=C;dt(I=>{let R=I.findIndex(H=>H.id===g.id);if(R>=0){let H=[...I];return H[R]=g,H}else return [...I,g]}),oo(I=>{let R=new Map(I);return R.set(g.id,g.status),R}),ro(g),bt(!0),g.status==="succeeded"&&L?.({message:"Deposit completed successfully",executionId:g.id}),x?.([...ye,g]);}}catch(oe){console.error("Error polling executions:",oe),D?.({message:"Failed to check deposit status",error:oe});}},3e3);return ()=>clearInterval(N)},[e,t,Ie,kt,ye,x,L,D]),useEffect(()=>{if(!P.length)return;let N=P.find(C=>C.symbol===z);if(!N||N.chains.length===0)return;if(!N.chains.some(C=>Jo(C.chain_id,C.chain_type)===S)){let C=N.chains[0];O(Jo(C.chain_id,C.chain_type));}},[z,P,S]);let We=P.find(N=>N.symbol===z),Ce=(We?.chains||[]).find(N=>Jo(N.chain_id,N.chain_type)===S),no=async()=>{if(_e)try{Clipboard.setString(_e),Je(!0),setTimeout(()=>Je(!1),2e3);}catch(N){console.error("Failed to copy:",N);}},_=Ce?.estimated_price_impact_percent??0,G=Ce?.max_slippage_percent??.25,ve=Ce?.minimum_deposit_amount_usd??3;return he?jsxs(View,{style:y.loadingContainer,children:[jsx(ActivityIndicator,{size:"large",color:s.primary}),jsx(Text,{style:[y.loadingText,{color:s.foregroundMuted,fontFamily:n.regular}],children:"Loading currencies..."})]}):wt&&P.length===0?jsxs(View,{style:y.errorContainer,children:[jsx(Text,{style:[y.errorText,{color:s.error,fontFamily:n.regular}],children:wt}),jsx(Text,{style:[y.errorHint,{color:s.foregroundMuted,fontFamily:n.regular}],children:"Please check your network connection and try again."})]}):jsxs(View,{style:y.container,children:[jsxs(View,{style:y.selectorSection,children:[jsx(Text,{style:[y.selectorLabel,{color:k.card.labelColor,fontFamily:n.medium}],children:"Select token to deposit"}),jsx(TouchableOpacity,{onPress:()=>Se(true),disabled:he||P.length===0,style:[y.tokenSelectorButton,{backgroundColor:k.card.backgroundColor}],activeOpacity:.7,children:he?jsxs(View,{style:y.tokenSelectorLoading,children:[jsx(View,{style:[y.loadingIcon,{backgroundColor:s.cardHover}]}),jsxs(View,{style:y.loadingTextContainer,children:[jsx(View,{style:[y.loadingLine,{backgroundColor:s.cardHover,width:60}]}),jsx(View,{style:[y.loadingLine,{backgroundColor:s.cardHover,width:100,marginTop:4}]})]})]}):jsxs(Fragment,{children:[jsxs(View,{style:y.tokenIconWrapper,children:[We&&jsx(Image,{source:{uri:q(ne(We,"png"))},style:y.tokenMainIcon}),(Ce||xt)&&jsx(Image,{source:{uri:q(ne(Ce||xt,"png"))},style:[y.tokenChainBadge,{borderColor:k.card.backgroundColor}]})]}),jsxs(View,{style:y.tokenSelectorInfo,children:[jsx(Text,{style:[y.tokenSelectorSymbol,{color:k.card.titleColor,fontFamily:n.semibold}],children:We?.symbol||z}),jsx(Text,{style:[y.tokenSelectorNetwork,{color:k.card.subtitleColor,fontFamily:n.regular}],numberOfLines:1,children:Ce?.chain_name||xt?.chain_name||"Select network"})]}),jsxs(View,{style:y.tokenSelectorRight,children:[jsxs(Text,{style:[y.minDepositText,{color:k.card.labelHighlightRightColor,fontFamily:n.medium}],children:["$",ve," min"]}),jsx(rt,{size:16,color:k.card.actionColor,strokeWidth:2})]})]})})]}),jsx(_r,{visible:je,onClose:()=>Se(false),tokens:P,selectedToken:z,selectedChainKey:S,onSelect:(N,oe)=>{b(N),O(oe);}}),jsx(View,{style:y.qrContainer,children:jsx(View,{style:[y.qrWrapper,{backgroundColor:s.background,borderColor:s.border}],children:X?jsxs(View,{style:y.qrLoading,children:[jsx(ActivityIndicator,{size:"small",color:s.primary}),jsx(Text,{style:[y.loadingText,{color:s.foregroundMuted,fontFamily:n.regular}],children:"Loading..."})]}):_e?jsx(Jt,{value:_e,size:180,logoUri:q(ne(Ce,"png")||De("/icons/networks/png/ethereum.png")),logoSize:45}):jsx(View,{style:y.qrLoading,children:jsx(Text,{style:[y.errorText,{color:s.error,fontFamily:n.regular}],children:"No address available"})})})}),jsxs(View,{style:y.addressSection,children:[jsxs(View,{style:y.addressHeader,children:[jsx(Text,{style:[y.addressLabel,{color:k.card.labelColor,fontFamily:n.medium}],children:"Deposit Address"}),Ue&&jsxs(View,{style:y.copiedIndicator,children:[jsx(we,{size:14,color:s.success,strokeWidth:2}),jsx(Text,{style:[y.copiedText,{color:s.success,fontFamily:n.regular}],children:"Copied"})]})]}),jsxs(TouchableOpacity,{onPress:no,disabled:!_e||X,activeOpacity:.7,style:[y.addressBox,{backgroundColor:k.card.backgroundColor}],children:[jsx(Text,{style:[y.addressText,{color:k.card.titleColor,fontFamily:n.regular}],numberOfLines:2,children:X?"Loading...":_e||"No address available"}),jsx(View,{style:y.addressCopyIcon,children:jsx(lo,{size:16,color:k.card.actionColor,strokeWidth:1})})]})]}),jsxs(View,{style:[y.detailsCard,{backgroundColor:k.card.backgroundColor}],children:[jsxs(TouchableOpacity,{onPress:()=>Be(!Le),style:y.detailsHeader,children:[jsxs(View,{style:y.detailsRow,children:[jsx(View,{style:[y.detailIcon,{backgroundColor:k.card.iconBackgroundColor}],children:jsx(Rt,{size:12,color:k.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[y.detailsLabel,{color:k.card.titleColor,fontFamily:n.regular}],children:"Processing time: < 1 min"})]}),jsx(View,{style:y.chevronContainer,children:Le?jsx(gt,{size:16,color:k.card.actionColor,strokeWidth:2}):jsx(Fe,{size:16,color:k.card.actionColor,strokeWidth:2})})]}),Le&&jsxs(View,{style:y.detailsContent,children:[jsxs(View,{style:y.detailsRow,children:[jsx(View,{style:[y.detailIcon,{backgroundColor:k.card.iconBackgroundColor}],children:jsx(qt,{size:12,color:k.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[y.detailsLabel,{color:k.card.titleColor,fontFamily:n.regular}],children:["Price impact: ",_.toFixed(2),"%"]}),jsx(TouchableOpacity,{onPress:()=>qe(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx($t,{size:14,color:k.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:y.detailsRow,children:[jsx(View,{style:[y.detailIcon,{backgroundColor:k.card.iconBackgroundColor}],children:jsx(Qt,{size:12,color:k.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[y.detailsLabel,{color:k.card.titleColor,fontFamily:n.regular}],children:["Slippage: Auto \u2022 ",G.toFixed(2),"%"]}),jsx(TouchableOpacity,{onPress:()=>qe(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx($t,{size:14,color:k.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:y.detailsRow,children:[jsx(View,{style:[y.detailIcon,{backgroundColor:k.card.iconBackgroundColor}],children:jsx(Lo,{size:12,color:k.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[y.detailsLabel,{color:k.card.titleColor,fontFamily:n.regular}],children:["Need help?"," ",jsx(Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsx(TouchableOpacity,{style:y.termsContainer,onPress:()=>Linking.openURL("https://unifold.io/terms"),children:jsx(Text,{style:[y.termsText,{color:s.primary,fontFamily:n.regular}],children:"Terms apply"})}),jsxs(ae,{visible:Ot,onClose:()=>qe(false),closeOnBackdropPress:true,showHandle:true,children:[jsxs(View,{style:[y.sheetHeader,{borderBottomColor:s.border}],children:[jsx(View,{style:y.sheetHeaderSpacer}),jsx(Text,{style:[y.sheetTitle,{color:k.header.titleColor,fontFamily:n.medium}],children:"Price Impact & Slippage"}),jsx(TouchableOpacity,{onPress:()=>qe(false),style:y.sheetCloseButton,children:jsx(Ve,{size:20,color:k.header.buttonColor,strokeWidth:2})})]}),jsxs(View,{style:y.infoSheetContent,children:[jsxs(View,{style:[y.infoCard,{backgroundColor:k.card.backgroundColor}],children:[jsxs(View,{style:y.infoCardHeader,children:[jsx(View,{style:[y.infoCardIcon,{backgroundColor:k.card.iconBackgroundColor}],children:jsx(qt,{size:16,color:k.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[y.infoCardTitle,{color:k.card.titleColor,fontFamily:n.medium}],children:"Price Impact"}),jsxs(Text,{style:[y.infoCardValue,{color:k.card.titleColor,fontFamily:n.medium}],children:[_.toFixed(2),"%"]})]}),jsx(Text,{style:[y.infoCardDescription,{color:k.card.descriptionColor,fontFamily:n.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:k.card.backgroundColor}],children:[jsxs(View,{style:y.infoCardHeader,children:[jsx(View,{style:[y.infoCardIcon,{backgroundColor:k.card.iconBackgroundColor}],children:jsx(Qt,{size:16,color:k.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[y.infoCardTitle,{color:k.card.titleColor,fontFamily:n.medium}],children:"Max Slippage"}),jsxs(Text,{style:[y.infoCardValue,{color:k.card.titleColor,fontFamily:n.medium}],children:[G.toFixed(2),"%"]})]}),jsx(Text,{style:[y.infoCardDescription,{color:k.card.descriptionColor,fontFamily:n.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."})]})]})]}),te&&jsx(Xt,{visible:Mt,status:te.status,tokenIconUrl:te.destination_token_metadata?.icon_urls?.find(N=>N.format==="png")?.url||te.destination_token_metadata?.icon_url||ne(We,"png"),explorerUrl:te.explorer_url,completionExplorerUrl:te.destination_explorer_url,date:te.created_at?new Date(te.created_at):void 0,amountUsd:te.source_amount_usd?parseFloat(te.source_amount_usd):void 0,onClose:()=>bt(false)})]})}var y=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,borderRadius: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,borderRadius:16,borderWidth:1},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,borderRadius:8},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 At={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"}};function es({visible:e,onClose:t,externalUserId:o,publishableKey:i,modalTitle:r="Deposit",destinationTokenSymbol:a,recipientAddress:d,destinationChainType:l,destinationChainId:c,destinationTokenAddress:h,defaultChainType:x,defaultChainId:L,defaultTokenAddress:D,hideDepositTracker:p=false,transferInputVariant:s="double_input",onDepositSuccess:n,onDepositError:k}){let{colors:F,fonts:z}=A(),[b,S]=useState([]),[O,f]=useState(false),[se,X]=useState(false),[Z,fe]=useState(false),[P,xe]=useState(null),[he,Pe]=useState("amount"),{isAllowed:Ue,isLoading:Je}=Co(i,e);useEffect(()=>{e&&!P&&ao(i).then(xe).catch(console.error);},[e,P,i]);let Le=()=>{t();},Be=b.filter(ye=>ye.status==="pending"||ye.status==="waiting").length,je=Je||e&&!P,Se=Ue===false;return jsxs(ae,{visible:e,onClose:Le,closeOnBackdropPress:false,showHandle:false,children:[jsx(Me,{title:r,showBack:false,onClose:Le}),je&&jsx(View,{style:ct.centeredContainer,children:jsx(ActivityIndicator,{size:"large",color:F.primary})}),!je&&Se&&jsxs(View,{style:ct.centeredContainer,children:[jsx(View,{style:[ct.iconContainer,{backgroundColor:F.cardHover}],children:jsx(Ro,{size:32,color:F.foreground,strokeWidth:1.5})}),jsx(Text,{style:[ct.blockedTitle,{color:F.foreground,fontFamily:z.semibold}],children:"No Tokens Available"}),jsx(Text,{style:[ct.blockedDescription,{color:F.foreground,opacity:.7,fontFamily:z.regular}],children:"There are no supported tokens available from your current location."})]}),!je&&!Se&&jsxs(View,{style:ct.optionsContainer,children:[jsx(co,{onPress:()=>X(true),title:At.transferCrypto.title,subtitle:At.transferCrypto.subtitle,featuredTokens:P?.transfer_crypto?.networks}),jsx(po,{onPress:()=>fe(true),title:At.depositWithCard.title,subtitle:At.depositWithCard.subtitle,paymentNetworks:P?.payment_networks?.networks}),!p&&jsx(go,{onPress:()=>f(true),title:At.depositTracker.title,subtitle:At.depositTracker.subtitle,badge:Be>0?Be:void 0})]}),jsx(Qo,{visible:O,onClose:()=>f(false),executions:b,externalUserId:o,publishableKey:i}),jsxs(ae,{visible:se,onClose:()=>X(false),closeOnBackdropPress:false,showHandle:false,heightPercent:.9,children:[jsx(Me,{title:At.transferCrypto.title,showBack:false,onClose:()=>X(false)}),jsx(ScrollView,{style:ct.transferScrollContainer,contentContainerStyle:ct.scrollContent,showsVerticalScrollIndicator:false,children:s==="single_input"?jsx(vr,{externalUserId:o,publishableKey:i,recipientAddress:d,destinationChainType:l,destinationChainId:c,destinationTokenAddress:h,destinationTokenSymbol:a,defaultChainType:x,defaultChainId:L,defaultTokenAddress:D,onExecutionsChange:S,onDepositSuccess:n,onDepositError:k}):jsx(Eo,{externalUserId:o,publishableKey:i,recipientAddress:d,destinationChainType:l,destinationChainId:c,destinationTokenAddress:h,destinationTokenSymbol:a,defaultChainType:x,defaultChainId:L,defaultTokenAddress:D,onExecutionsChange:S,onDepositSuccess:n,onDepositError:k})})]}),jsxs(ae,{visible:Z,onClose:()=>{fe(false),Pe("amount");},closeOnBackdropPress:false,showHandle:false,heightPercent:.9,children:[jsx(Me,{title:`Deposit ${a||"USDC"}`,showBack:he==="onramp",onBack:()=>Pe("amount"),onClose:()=>{fe(false),Pe("amount");}}),jsx(View,{style:ct.buyWithCardContainer,children:jsx(Uo,{externalUserId:o,publishableKey:i,destinationTokenSymbol:a,recipientAddress:d,destinationChainType:l,destinationChainId:c,destinationTokenAddress:h,onDepositSuccess:n,onDepositError:k,view:he,onViewChange:ye=>Pe(ye)})})]})]})}function Xo({theme:e="auto",...t}){return jsx(es,{...t})}var ct=StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{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",borderRadius:12,gap:8},text:{fontWeight:"600",textAlign:"center"},fullWidth:{width:"100%"},disabled:{opacity:.5}});StyleSheet.create({icon:{backgroundColor:"transparent"}});var ds=()=>new QueryClient({defaultOptions:{queries:{staleTime:6e4,retry:1}}}),xn=createContext(null);function us({children:e,publishableKey:t,config:o}){let[i]=useState(()=>ds()),[r,a]=useState(false),[d,l]=useState(null),c=useColorScheme(),h=useRef(false);h.current||(_o({publishableKey:t}),h.current=true);let x=useMemo(()=>{let z=o?.appearance||"dark";return z==="auto"?c==="dark"?"dark":"light":z},[o?.appearance,c]);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.'),_o({publishableKey:t});},[t]);let L=useRef(null),D=useRef(null),p=useCallback(z=>{D.current&&(clearTimeout(D.current),D.current=null),L.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),L.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),L.current=null);let b=new Promise((S,O)=>{L.current={resolve:S,reject:O};});return l(z),a(true),b},[]),s=useCallback(()=>{L.current&&(L.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),L.current=null),a(false),D.current=setTimeout(()=>{l(null),D.current=null;},200);},[]),n=useCallback(z=>{d?.onSuccess&&d.onSuccess(z),L.current&&(L.current.resolve(z),L.current=null);},[d]),k=useCallback(z=>{console.error("[UnifoldProvider] Deposit error:",z),d?.onError&&d.onError(z),L.current&&(L.current.reject(z),L.current=null);},[d]),F=useMemo(()=>({publishableKey:t,beginDeposit:p,closeDeposit:s}),[t,p,s]);return jsx(QueryClientProvider,{client:i,children:jsx(xn.Provider,{value:F,children:jsxs(To,{mode:x,accentColor:o?.accentColor,theme:o?.theme,fontFamily:o?.fontFamily,fonts:o?.fonts,components:o?.components,children:[e,d&&jsx(Xo,{visible:r,onClose:s,publishableKey:t,modalTitle:o?.modalTitle,externalUserId:d.externalUserId,destinationChainType:d.destinationChainType,destinationChainId:d.destinationChainId,destinationTokenSymbol:d.destinationTokenSymbol,recipientAddress:d.recipientAddress,destinationTokenAddress:d.destinationTokenAddress,defaultChainType:d.defaultChainType,defaultChainId:d.defaultChainId,defaultTokenAddress:d.defaultTokenAddress,hideDepositTracker:o?.hideDepositTracker,transferInputVariant:o?.transferInputVariant,onDepositSuccess:n,onDepositError:k,theme:x})]})})})}function ps(){let e=useContext(xn);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
2
+ export{us as UnifoldProvider,Fr as setDevApiUrl,Co as useAllowedCountry,ps as useUnifold};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unifold/connect-react-native",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Unifold Connect React Native SDK - Crypto deposit and onramp for React Native/Expo",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -18,6 +18,7 @@
18
18
  "LICENSE"
19
19
  ],
20
20
  "peerDependencies": {
21
+ "@react-native-async-storage/async-storage": ">=1.19.0",
21
22
  "expo": ">=49.0.0",
22
23
  "react": "^18.2.0 || ^19.0.0",
23
24
  "react-native": ">=0.72.0",
package/dist/index.d.mts DELETED
@@ -1,48 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode } from 'react';
3
- import { ThemeMode } from '@unifold/ui-react-native';
4
- export { AllowedCountryResult, ThemeMode, setDevApiUrl, useAllowedCountry } from '@unifold/ui-react-native';
5
-
6
- interface UnifoldConnectProviderConfig {
7
- publishableKey: string;
8
- config?: {
9
- modalTitle?: string;
10
- hideDepositTracker?: boolean;
11
- /** Theme appearance: 'light', 'dark', or 'auto' (system preference). Defaults to 'dark' */
12
- appearance?: ThemeMode | "auto";
13
- };
14
- }
15
- interface DepositResult {
16
- message: string;
17
- transaction?: unknown;
18
- executionId?: string;
19
- }
20
- interface DepositError {
21
- message: string;
22
- error?: unknown;
23
- code?: string;
24
- }
25
- interface DepositConfig {
26
- externalUserId: string;
27
- destinationChainType?: "ethereum" | "solana" | "bitcoin";
28
- destinationChainId?: string;
29
- destinationTokenAddress?: string;
30
- destinationTokenSymbol?: string;
31
- recipientAddress?: string;
32
- onSuccess?: (data: DepositResult) => void;
33
- onError?: (error: DepositError) => void;
34
- }
35
- interface ConnectContextValue {
36
- publishableKey: string;
37
- beginDeposit: (config: DepositConfig) => Promise<DepositResult>;
38
- closeDeposit: () => void;
39
- }
40
- interface UnifoldProviderProps {
41
- children: ReactNode;
42
- publishableKey: string;
43
- config?: UnifoldConnectProviderConfig["config"];
44
- }
45
- declare function UnifoldProvider({ children, publishableKey, config, }: UnifoldProviderProps): react_jsx_runtime.JSX.Element;
46
- declare function useUnifold(): ConnectContextValue;
47
-
48
- export { type DepositConfig, type DepositError, type DepositResult, type UnifoldConnectProviderConfig, UnifoldProvider, type UnifoldProviderProps, useUnifold };
package/dist/index.d.ts DELETED
@@ -1,48 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode } from 'react';
3
- import { ThemeMode } from '@unifold/ui-react-native';
4
- export { AllowedCountryResult, ThemeMode, setDevApiUrl, useAllowedCountry } from '@unifold/ui-react-native';
5
-
6
- interface UnifoldConnectProviderConfig {
7
- publishableKey: string;
8
- config?: {
9
- modalTitle?: string;
10
- hideDepositTracker?: boolean;
11
- /** Theme appearance: 'light', 'dark', or 'auto' (system preference). Defaults to 'dark' */
12
- appearance?: ThemeMode | "auto";
13
- };
14
- }
15
- interface DepositResult {
16
- message: string;
17
- transaction?: unknown;
18
- executionId?: string;
19
- }
20
- interface DepositError {
21
- message: string;
22
- error?: unknown;
23
- code?: string;
24
- }
25
- interface DepositConfig {
26
- externalUserId: string;
27
- destinationChainType?: "ethereum" | "solana" | "bitcoin";
28
- destinationChainId?: string;
29
- destinationTokenAddress?: string;
30
- destinationTokenSymbol?: string;
31
- recipientAddress?: string;
32
- onSuccess?: (data: DepositResult) => void;
33
- onError?: (error: DepositError) => void;
34
- }
35
- interface ConnectContextValue {
36
- publishableKey: string;
37
- beginDeposit: (config: DepositConfig) => Promise<DepositResult>;
38
- closeDeposit: () => void;
39
- }
40
- interface UnifoldProviderProps {
41
- children: ReactNode;
42
- publishableKey: string;
43
- config?: UnifoldConnectProviderConfig["config"];
44
- }
45
- declare function UnifoldProvider({ children, publishableKey, config, }: UnifoldProviderProps): react_jsx_runtime.JSX.Element;
46
- declare function useUnifold(): ConnectContextValue;
47
-
48
- export { type DepositConfig, type DepositError, type DepositResult, type UnifoldConnectProviderConfig, UnifoldProvider, type UnifoldProviderProps, useUnifold };