@unifold/connect-react-native 0.1.22 → 0.1.24

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